mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-11 23:54:09 +02:00
add level file versioning by file extension
This commit is contained in:
@@ -288,6 +288,16 @@ namespace TR {
|
|||||||
{ "STPAUL" , STR_TR3_STPAUL , TRACK_TR3_CAVES },
|
{ "STPAUL" , STR_TR3_STPAUL , TRACK_TR3_CAVES },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Version getGameVersionByLevel(LevelID id) {
|
||||||
|
if (id >= LVL_TR1_TITLE && id <= LVL_TR1_END2)
|
||||||
|
return VER_TR1;
|
||||||
|
if (id >= LVL_TR2_TITLE && id <= LVL_TR2_HOUSE)
|
||||||
|
return VER_TR2;
|
||||||
|
if (id >= LVL_TR3_TITLE && id <= LVL_TR3_STPAUL)
|
||||||
|
return VER_TR3;
|
||||||
|
return VER_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
LevelID getLevelID(int size, const char *name, Version &version, bool &isDemoLevel) {
|
LevelID getLevelID(int size, const char *name, Version &version, bool &isDemoLevel) {
|
||||||
isDemoLevel = false;
|
isDemoLevel = false;
|
||||||
switch (size) {
|
switch (size) {
|
||||||
@@ -683,16 +693,30 @@ namespace TR {
|
|||||||
// skip file extension
|
// skip file extension
|
||||||
char buf[255];
|
char buf[255];
|
||||||
strcpy(buf, name + start);
|
strcpy(buf, name + start);
|
||||||
|
char *ext = NULL;
|
||||||
for (int i = 0; i < int(strlen(buf)); i++)
|
for (int i = 0; i < int(strlen(buf)); i++)
|
||||||
if (buf[i] == '.') {
|
if (buf[i] == '.') {
|
||||||
buf[i] = 0;
|
buf[i] = 0;
|
||||||
|
ext = buf + i + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// compare with standard levels
|
// compare with standard levels
|
||||||
// TODO: fix TITLE (2-3), HOUSE (3), CUTx (2-3)
|
// TODO: fix TITLE (2-3), HOUSE (3), CUTx (2-3)
|
||||||
for (int i = 0; i < LVL_MAX; i++)
|
for (int i = 0; i < LVL_MAX; i++)
|
||||||
if (!strcmp(buf, LEVEL_INFO[i].name))
|
if (!strcmp(buf, LEVEL_INFO[i].name)) {
|
||||||
return LevelID(i);
|
LevelID id = LevelID(i);
|
||||||
|
if (ext) {
|
||||||
|
version = getGameVersionByLevel(id);
|
||||||
|
if (!strcmp("PSX", ext)) {
|
||||||
|
version = Version(version | VER_PSX);
|
||||||
|
} else if (!strcmp("SAT", ext)) {
|
||||||
|
version = Version(version | VER_SAT);
|
||||||
|
} else {
|
||||||
|
version = Version(version | VER_PC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return LVL_CUSTOM;
|
return LVL_CUSTOM;
|
||||||
@@ -778,16 +802,6 @@ namespace TR {
|
|||||||
return VER_UNKNOWN;
|
return VER_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version getGameVersionByLevel(LevelID id) {
|
|
||||||
if (id >= LVL_TR1_TITLE && id <= LVL_TR1_END2)
|
|
||||||
return VER_TR1;
|
|
||||||
if (id >= LVL_TR2_TITLE && id <= LVL_TR2_HOUSE)
|
|
||||||
return VER_TR2;
|
|
||||||
if (id >= LVL_TR3_TITLE && id <= LVL_TR3_STPAUL)
|
|
||||||
return VER_TR3;
|
|
||||||
return VER_UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
void getGameLevelFile(char *dst, Version version, LevelID id) {
|
void getGameLevelFile(char *dst, Version version, LevelID id) {
|
||||||
if (useEasyStart) {
|
if (useEasyStart) {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
|
Reference in New Issue
Block a user