1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-15 09:34:18 +02:00

fix loading game

This commit is contained in:
XProger
2018-10-18 06:25:25 +03:00
parent ccc270ee2b
commit c59459235b
3 changed files with 28 additions and 25 deletions

View File

@@ -186,11 +186,18 @@ namespace Game {
if (level->isEnded) if (level->isEnded)
return true; return true;
#ifdef _DEBUG
if (Input::down[ik0] && !level->inventory->isActive()) { if (Input::down[ik0] && !level->inventory->isActive()) {
level->inventory->toggle(0, Inventory::PAGE_LEVEL_STATS); level->inventory->toggle(0, Inventory::PAGE_LEVEL_STATS);
Input::down[ik0] = false; Input::down[ik0] = false;
} }
if (Input::down[ikF]) {
level->flipMap();
Input::down[ikF] = false;
}
#endif
if (Input::down[ik5] && !level->inventory->isActive()) { if (Input::down[ik5] && !level->inventory->isActive()) {
if (level->players[0]->canSaveGame()) if (level->players[0]->canSaveGame())
level->saveGame(true, false); level->saveGame(true, false);

View File

@@ -71,11 +71,22 @@ struct Level : IGame {
// IGame implementation ======== // IGame implementation ========
virtual void loadLevel(TR::LevelID id) { virtual void loadLevel(TR::LevelID id) {
if (nextLevel != TR::LVL_MAX) return;
sndWater = sndTrack = NULL; sndWater = sndTrack = NULL;
Sound::stopAll(); Sound::stopAll();
nextLevel = id;
}
virtual void loadNextLevel() {
TR::LevelID id = TR::LVL_MAX;
#ifdef _OS_WEB
if (level.id == TR::LVL_TR1_2 && level.version != TR::VER_TR1_PC) {
id = TR::LVL_TR1_TITLE;
return;
} else
#endif
id = (level.isEnd() || level.isHome()) ? level.getTitleId() : TR::LevelID(level.id + 1);
if (nextLevel == TR::LVL_MAX) {
if (!level.isTitle() && loadSlot == -1 && !TR::isCutsceneLevel(level.id)) { if (!level.isTitle() && loadSlot == -1 && !TR::isCutsceneLevel(level.id)) {
// update statistics info for current level // update statistics info for current level
saveGame(false, true); saveGame(false, true);
@@ -87,18 +98,8 @@ struct Level : IGame {
loadSlot = getSaveSlot(level.id, false); loadSlot = getSaveSlot(level.id, false);
} }
} }
loadLevel(id);
nextLevel = id;
} }
virtual void loadNextLevel() {
#ifdef _OS_WEB
if (level.id == TR::LVL_TR1_2 && level.version != TR::VER_TR1_PC) {
loadLevel(TR::LVL_TR1_TITLE);
return;
}
#endif
loadLevel((level.isEnd() || level.isHome()) ? level.getTitleId() : TR::LevelID(level.id + 1));
} }
virtual void invShow(int playerIndex, int page, int itemIndex = -1) { virtual void invShow(int playerIndex, int page, int itemIndex = -1) {
@@ -2436,11 +2437,6 @@ struct Level : IGame {
Core::setViewport(Core::x, Core::y, Core::width, Core::height); Core::setViewport(Core::x, Core::y, Core::width, Core::height);
camera->setup(true); camera->setup(true);
if (Input::down[ikF]) {
flipMap();
Input::down[ikF] = false;
}
Debug::begin(); Debug::begin();
/* /*
lara->updateEntity(); // TODO clip angle while rotating lara->updateEntity(); // TODO clip angle while rotating

View File

@@ -393,13 +393,13 @@ namespace UI {
MeshBuilder *mesh = game->getMesh(); MeshBuilder *mesh = game->getMesh();
int seq = level->extra.glyphs; int seq = level->extra.glyphs;
int x = int(pos.x) + getLeftOffset(text, align, width); int x = int(pos.x) + getLeftOffset(text, align, int(width));
int y = int(pos.y); int y = int(pos.y);
while (char c = *text++) { while (char c = *text++) {
if (c == '@') { if (c == '@') {
x = int(pos.x) + getLeftOffset(text, align, width); x = int(pos.x) + getLeftOffset(text, align, int(width));
y += 16; y += 16;
continue; continue;
} }