mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-13 08:34:32 +02:00
#15 fix emscripten compilation
This commit is contained in:
@@ -526,9 +526,9 @@ namespace TR {
|
|||||||
} else if (id == LVL_TR2_TITLE) {
|
} else if (id == LVL_TR2_TITLE) {
|
||||||
sprintf(dst, "DATA/%s.tr2", LEVEL_INFO[id].name);
|
sprintf(dst, "DATA/%s.tr2", LEVEL_INFO[id].name);
|
||||||
} else if (id == LVL_TR2_EMPRTOMB) {
|
} else if (id == LVL_TR2_EMPRTOMB) {
|
||||||
dst = "DATA/Emprtomb.tr2";
|
strcpy(dst, "DATA/Emprtomb.tr2");
|
||||||
} else {
|
} else {
|
||||||
sprintf(dst, "DATA/%s.TR2", LEVEL_INFO[id]);
|
sprintf(dst, "DATA/%s.TR2", LEVEL_INFO[id].name);
|
||||||
}
|
}
|
||||||
if (Stream::existsContent(dst)) break;
|
if (Stream::existsContent(dst)) break;
|
||||||
strcpy(dst, LEVEL_INFO[id].name);
|
strcpy(dst, LEVEL_INFO[id].name);
|
||||||
@@ -536,7 +536,7 @@ namespace TR {
|
|||||||
strcat(dst, ".TR2");
|
strcat(dst, ".TR2");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VER_TR2_PSX : sprintf(dst, "DATA/%s.PSX", LEVEL_INFO[id]); break;
|
case VER_TR2_PSX : sprintf(dst, "DATA/%s.PSX", LEVEL_INFO[id].name); break;
|
||||||
case VER_TR3_PC : sprintf(dst, isCutsceneLevel(id) ? "cuts/%s.TR2" : "data/%s.TR2", LEVEL_INFO[id].name); break;
|
case VER_TR3_PC : sprintf(dst, isCutsceneLevel(id) ? "cuts/%s.TR2" : "data/%s.TR2", LEVEL_INFO[id].name); break;
|
||||||
default : ASSERT(false);
|
default : ASSERT(false);
|
||||||
}
|
}
|
||||||
@@ -548,7 +548,7 @@ namespace TR {
|
|||||||
strcat(dst, LEVEL_INFO[id].name);
|
strcat(dst, LEVEL_INFO[id].name);
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
strcat(buf, ".PSX");
|
strcat(dst, ".PSX");
|
||||||
#else
|
#else
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case VER_TR1_PC : strcat(dst, ".PHD"); break;
|
case VER_TR1_PC : strcat(dst, ".PHD"); break;
|
||||||
|
13
src/utils.h
13
src/utils.h
@@ -1007,11 +1007,12 @@ struct Stream {
|
|||||||
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *data;
|
char *data;
|
||||||
|
char *name;
|
||||||
int size, pos;
|
int size, pos;
|
||||||
|
|
||||||
Stream(const void *data, int size) : callback(NULL), userData(NULL), f(NULL), data((char*)data), size(size), pos(0) {}
|
Stream(const void *data, int size) : callback(NULL), userData(NULL), f(NULL), data((char*)data), name(NULL), size(size), pos(0) {}
|
||||||
|
|
||||||
Stream(const char *name, Callback *callback = NULL, void *userData = NULL) : callback(callback), userData(userData), data(NULL), size(-1), pos(0) {
|
Stream(const char *name, Callback *callback = NULL, void *userData = NULL) : callback(callback), userData(userData), data(NULL), name(NULL), size(-1), pos(0) {
|
||||||
if (contentDir[0] && (!cacheDir[0] || !strstr(name, cacheDir))) {
|
if (contentDir[0] && (!cacheDir[0] || !strstr(name, cacheDir))) {
|
||||||
char path[255];
|
char path[255];
|
||||||
path[0] = 0;
|
path[0] = 0;
|
||||||
@@ -1050,6 +1051,7 @@ struct Stream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
~Stream() {
|
~Stream() {
|
||||||
|
delete[] name;
|
||||||
if (f) fclose(f);
|
if (f) fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1114,9 +1116,10 @@ namespace String {
|
|||||||
|
|
||||||
void toLower(char *str) {
|
void toLower(char *str) {
|
||||||
if (!str) return;
|
if (!str) return;
|
||||||
while (*str) {
|
|
||||||
*str = tolower(*str);
|
while (char &c = *str++) {
|
||||||
str++;
|
if (c >= 'A' && c <= 'Z')
|
||||||
|
c -= 'Z' - 'z';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user