Skip to content

Commit

Permalink
[MX, GL, EE] Fixes crash when completing the game or on game over
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFakeMontyOnTheRun committed Jul 1, 2024
1 parent e376830 commit 0164108
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/include/Enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ enum EDirection {
enum CrawlerState {
kCrawlerGameOver = -1,
kCrawlerQuit = 0,
kCrawlerGameInProgress = 1
kCrawlerGameInProgress = 1,
kCrawlerGameFinished = 2
};

enum ECommand {
Expand Down
4 changes: 4 additions & 0 deletions common/src/Dungeon.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,22 @@ struct GameSnapshot dungeonTick(const enum ECommand command) {

switch (getGameStatus()) {
case kBadVictory:
gameSnapshot.should_continue = kCrawlerGameFinished;
enterState(kBadVictoryEpilogue);
return gameSnapshot;

case kBadGameOver:
gameSnapshot.should_continue = kCrawlerGameFinished;
enterState(kBadGameOverEpilogue);
return gameSnapshot;

case kGoodVictory:
gameSnapshot.should_continue = kCrawlerGameFinished;
enterState(kGoodVictoryEpilogue);
return gameSnapshot;

case kGoodGameOver:
gameSnapshot.should_continue = kCrawlerGameFinished;
enterState(kGoodGameOverEpilogue);
return gameSnapshot;
default:
Expand Down
4 changes: 4 additions & 0 deletions common/src/Events.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ int loopTick(enum ECommand command) {

tickMission(command);

if (crawlerGameState == kCrawlerGameFinished) {
return kCrawlerGameFinished;
}

if (gameTicks != 0) {
yCameraOffset = ((struct CTile3DProperties *) getFromMap(&tileProperties,
LEVEL_MAP(x, z)))->mFloorHeight -
Expand Down

0 comments on commit 0164108

Please sign in to comment.