mirror of https://gitlab.com/drummyfish/anarch.git
Fix save/load
This commit is contained in:
parent
e7134f9683
commit
65d1c1db94
17
game.h
17
game.h
|
@ -663,8 +663,16 @@ void SFG_levelEnds()
|
||||||
SFG_currentLevel.completionTime10sOfS = (SFG_MS_PER_FRAME *
|
SFG_currentLevel.completionTime10sOfS = (SFG_MS_PER_FRAME *
|
||||||
(SFG_game.frame - SFG_currentLevel.frameStart)) / 100;
|
(SFG_game.frame - SFG_currentLevel.frameStart)) / 100;
|
||||||
|
|
||||||
|
if (SFG_currentLevel.levelNumber >= (SFG_game.save[0] & 0x0f))
|
||||||
|
{
|
||||||
|
SFG_game.save[0] = // save progress
|
||||||
|
(SFG_game.save[0] & 0xf0) | (SFG_currentLevel.levelNumber + 1);
|
||||||
|
|
||||||
|
SFG_gameSave();
|
||||||
|
}
|
||||||
|
|
||||||
SFG_currentLevel.monstersDead = 0;
|
SFG_currentLevel.monstersDead = 0;
|
||||||
|
|
||||||
for (uint16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i)
|
for (uint16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i)
|
||||||
if (SFG_currentLevel.monsterRecords[i].health == 0)
|
if (SFG_currentLevel.monsterRecords[i].health == 0)
|
||||||
SFG_currentLevel.monstersDead++;
|
SFG_currentLevel.monstersDead++;
|
||||||
|
@ -3965,13 +3973,6 @@ void SFG_gameStep()
|
||||||
SFG_updateLevel();
|
SFG_updateLevel();
|
||||||
SFG_updatePlayerHeight(); // in case player is on elevator
|
SFG_updatePlayerHeight(); // in case player is on elevator
|
||||||
|
|
||||||
if (SFG_currentLevel.levelNumber > (SFG_game.save[0] & 0x0f))
|
|
||||||
{
|
|
||||||
SFG_game.save[0] = // save progress
|
|
||||||
(SFG_game.save[0] & 0xf0) | SFG_currentLevel.levelNumber;
|
|
||||||
SFG_gameSave();
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t x = 0, y = 0;
|
int16_t x = 0, y = 0;
|
||||||
|
|
||||||
SFG_getMouseOffset(&x,&y); // this keeps centering the mouse
|
SFG_getMouseOffset(&x,&y); // this keeps centering the mouse
|
||||||
|
|
Loading…
Reference in New Issue