1
0
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:
XProger
2017-12-10 05:03:22 +03:00
parent 31c163675f
commit 8219740b9f
2 changed files with 12 additions and 9 deletions

View File

@@ -526,9 +526,9 @@ namespace TR {
} else if (id == LVL_TR2_TITLE) {
sprintf(dst, "DATA/%s.tr2", LEVEL_INFO[id].name);
} else if (id == LVL_TR2_EMPRTOMB) {
dst = "DATA/Emprtomb.tr2";
strcpy(dst, "DATA/Emprtomb.tr2");
} else {
sprintf(dst, "DATA/%s.TR2", LEVEL_INFO[id]);
sprintf(dst, "DATA/%s.TR2", LEVEL_INFO[id].name);
}
if (Stream::existsContent(dst)) break;
strcpy(dst, LEVEL_INFO[id].name);
@@ -536,7 +536,7 @@ namespace TR {
strcat(dst, ".TR2");
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;
default : ASSERT(false);
}
@@ -548,7 +548,7 @@ namespace TR {
strcat(dst, LEVEL_INFO[id].name);
#ifdef __EMSCRIPTEN__
strcat(buf, ".PSX");
strcat(dst, ".PSX");
#else
switch (version) {
case VER_TR1_PC : strcat(dst, ".PHD"); break;

View File

@@ -1007,11 +1007,12 @@ struct Stream {
FILE *f;
char *data;
char *name;
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))) {
char path[255];
path[0] = 0;
@@ -1050,6 +1051,7 @@ struct Stream {
}
~Stream() {
delete[] name;
if (f) fclose(f);
}
@@ -1114,9 +1116,10 @@ namespace String {
void toLower(char *str) {
if (!str) return;
while (*str) {
*str = tolower(*str);
str++;
while (char &c = *str++) {
if (c >= 'A' && c <= 'Z')
c -= 'Z' - 'z';
}
}