1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-07-31 10:20:27 +02:00

add quick save and restore the game state for GCW0

This commit is contained in:
XProger
2020-01-31 23:03:05 +03:00
parent 780b3e96a6
commit d02c1d9274
3 changed files with 15 additions and 7 deletions

View File

@@ -225,12 +225,16 @@ namespace Game {
} }
if (slot > -1) { if (slot > -1) {
level->loadGame(slot);
if (forced) { if (forced) {
level->loadGame(slot); level->loadGame(slot);
level->loadLevel(saveSlots[slot].getLevelID()); level->loadLevel(saveSlots[slot].getLevelID());
level->loadNextLevelData(); level->loadNextLevelData();
} else { if (nextLevel) {
level->loadGame(slot); startLevel(nextLevel);
nextLevel = NULL;
inventory->titleTimer = 0.0f;
}
} }
} }
} }

View File

@@ -1,3 +1,3 @@
set -e set -e
/opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-g++ -o OpenLara -D__GCW0__ -std=c++11 -O3 -s -g0 -mips32r2 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections -Wno-invalid-source-encoding main.cpp ../../libs/stb_vorbis/stb_vorbis.c ../../libs/minimp3/minimp3.cpp ../../libs/tinf/tinflate.c -I/opt/vc/include -I../../ -L/opt/vc/lib/ -lGLESv2 -lEGL -lm -lrt -lpthread -lasound -ludev /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-g++ -o OpenLara -D__GCW0__ -std=c++11 -Os -s -g0 -mips32r2 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections -Wno-invalid-source-encoding main.cpp ../../libs/stb_vorbis/stb_vorbis.c ../../libs/minimp3/minimp3.cpp ../../libs/tinf/tinflate.c -I/opt/vc/include -I../../ -L/opt/vc/lib/ -lGLESv2 -lEGL -lm -lrt -lpthread -lasound -ludev
/opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-strip ../../../bin/OpenLara --strip-all --remove-section=.comment --remove-section=.note /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-strip ../../../bin/OpenLara --strip-all --remove-section=.comment --remove-section=.note

View File

@@ -246,7 +246,10 @@ JoyKey codeToJoyKey(int code) {
case KEY_KPDOT : return jkR; case KEY_KPDOT : return jkR;
case KEY_PAGEUP : return jkLT; case KEY_PAGEUP : return jkLT;
case KEY_PAGEDOWN : return jkRT; case KEY_PAGEDOWN : return jkRT;
case KEY_POWER : Core::quit(); case KEY_POWER : {
Game::quickSave();
Core::quit();
}
} }
return jkNone; return jkNone;
} }
@@ -376,12 +379,10 @@ int main(int argc, char **argv) {
strcpy(contentDir, home); strcpy(contentDir, home);
strcat(contentDir, "/.openlara/"); strcat(contentDir, "/.openlara/");
LOG("content dir: %s\n", contentDir);
struct stat st = {0}; struct stat st = {0};
if (stat(contentDir, &st) == -1) { if (stat(contentDir, &st) == -1) {
LOG("no data directory found, please copy the original game content into /home/.openlara/\n"); LOG("no data directory found, please copy the original game content into %s\n", contentDir);
return -1; return -1;
} }
@@ -400,6 +401,9 @@ int main(int argc, char **argv) {
startTime = t.tv_sec; startTime = t.tv_sec;
Game::init(); Game::init();
Game::quickLoad(true);
inputInit(); inputInit();
sndInit(); sndInit();