Add quick win option

This commit is contained in:
Miloslav Číž 2020-11-17 10:52:09 +01:00
parent c7b1dd2677
commit 7a34b61d55
3 changed files with 23 additions and 6 deletions

21
game.h
View File

@ -3048,11 +3048,25 @@ void SFG_updatePlayerHeight()
RCL_CAMERA_COLL_HEIGHT_BELOW;
}
void SFG_winLevel()
{
SFG_levelEnds();
SFG_setGameState(SFG_GAME_STATE_WIN);
SFG_playGameSound(2,255);
SFG_processEvent(SFG_EVENT_VIBRATE,0);
SFG_processEvent(SFG_EVENT_LEVEL_WON,SFG_currentLevel.levelNumber + 1);
}
/**
Part of SFG_gameStep() for SFG_GAME_STATE_PLAYING.
*/
void SFG_gameStepPlaying()
{
#if SFG_QUICK_WIN
if (SFG_game.stateTime > 500)
SFG_winLevel();
#endif
if (
(SFG_keyIsDown(SFG_KEY_C) && SFG_keyIsDown(SFG_KEY_DOWN)) ||
SFG_keyIsDown(SFG_KEY_MENU))
@ -3394,12 +3408,7 @@ void SFG_gameStepPlaying()
break;
case SFG_LEVEL_ELEMENT_FINISH:
SFG_levelEnds();
SFG_setGameState(SFG_GAME_STATE_WIN);
SFG_playGameSound(2,255);
SFG_processEvent(SFG_EVENT_VIBRATE,0);
SFG_processEvent(
SFG_EVENT_LEVEL_WON,SFG_currentLevel.levelNumber + 1);
SFG_winLevel();
eliminate = 0;
break;

View File

@ -25,6 +25,7 @@
#endif
// #define SFG_START_LEVEL 1
// #define SFG_QUICK_WIN 1
#define SFG_IMMORTAL 1
// #define SFG_ALL_LEVELS 1
// #define SFG_UNLOCK_DOOR 1

View File

@ -447,6 +447,13 @@
#define SFG_IMMORTAL 0
#endif
/**
Developer setting, with 1 every level is won immediately after start.
*/
#ifndef SFG_QUICK_WIN
#define SFG_QUICK_WIN 0
#endif
/**
Reveals all levels to be played.
*/