Continue win screen

This commit is contained in:
Miloslav Číž 2020-09-15 19:08:04 +02:00
parent 8e27d0fa53
commit e42839f2e5
2 changed files with 47 additions and 25 deletions

25
game.h
View File

@ -3176,6 +3176,7 @@ void SFG_gameStepPlaying()
case SFG_LEVEL_ELEMENT_FINISH: case SFG_LEVEL_ELEMENT_FINISH:
SFG_levelEnds(); SFG_levelEnds();
SFG_playGameSound(2,255);
SFG_setGameState(SFG_GAME_STATE_WIN); SFG_setGameState(SFG_GAME_STATE_WIN);
eliminate = 0; eliminate = 0;
break; break;
@ -3465,8 +3466,16 @@ void SFG_gameStep()
int32_t t = SFG_game.frameTime - SFG_game.stateChangeTime; int32_t t = SFG_game.frameTime - SFG_game.stateChangeTime;
if ((t > SFG_WIN_ANIMATION_DURATION) && SFG_keyIsDown(SFG_KEY_A)) if (t > SFG_WIN_ANIMATION_DURATION)
{
if (SFG_keyIsDown(SFG_KEY_RIGHT))
{
// TODO: save here
SFG_setGameState(SFG_GAME_STATE_MENU); SFG_setGameState(SFG_GAME_STATE_MENU);
}
else if (SFG_keyIsDown(SFG_KEY_LEFT))
SFG_setGameState(SFG_GAME_STATE_MENU);
}
break; break;
} }
@ -3956,11 +3965,13 @@ void SFG_drawWinOverlay()
uint16_t x = (SFG_GAME_RESOLUTION_X - uint16_t x = (SFG_GAME_RESOLUTION_X -
SFG_textHorizontalSize(textLine,SFG_FONT_SIZE_BIG)) / 2; SFG_textHorizontalSize(textLine,SFG_FONT_SIZE_BIG)) / 2;
SFG_drawText(textLine,x,y,SFG_FONT_SIZE_BIG,7,255,0); SFG_drawText(textLine,x,y,SFG_FONT_SIZE_BIG,7 + SFG_game.blink * 95,255,0);
uint32_t completionTime = SFG_MS_PER_FRAME * uint32_t completionTime = SFG_MS_PER_FRAME *
(SFG_currentLevel.frameEnd - SFG_currentLevel.frameStart); (SFG_currentLevel.frameEnd - SFG_currentLevel.frameStart);
if (t >= (SFG_WIN_ANIMATION_DURATION / 2))
{
y += (SFG_FONT_SIZE_BIG + SFG_FONT_SIZE_MEDIUM) * SFG_FONT_CHARACTER_SIZE; y += (SFG_FONT_SIZE_BIG + SFG_FONT_SIZE_MEDIUM) * SFG_FONT_CHARACTER_SIZE;
x = SFG_GAME_RESOLUTION_X / 4; x = SFG_GAME_RESOLUTION_X / 4;
@ -3990,7 +4001,17 @@ void SFG_drawWinOverlay()
SFG_drawText(SFG_TEXT_KILLS,x,y,SFG_FONT_SIZE_SMALL,7,255,0); SFG_drawText(SFG_TEXT_KILLS,x,y,SFG_FONT_SIZE_SMALL,7,255,0);
if (t >= (SFG_WIN_ANIMATION_DURATION - 1))
{
y += (SFG_FONT_SIZE_BIG + SFG_FONT_SIZE_MEDIUM) * SFG_FONT_CHARACTER_SIZE;
SFG_drawText(SFG_TEXT_SAVE_PROMPT,
(SFG_GAME_RESOLUTION_X - SFG_textHorizontalSize(SFG_TEXT_SAVE_PROMPT,
SFG_FONT_SIZE_MEDIUM)) / 2,y,SFG_FONT_SIZE_MEDIUM,7,255,0);
}
#undef CHAR_SIZE #undef CHAR_SIZE
}
#undef STRIP_HEIGHT #undef STRIP_HEIGHT
#undef STRIP_START #undef STRIP_START

View File

@ -26,6 +26,7 @@ SFG_PROGRAM_MEMORY char *SFG_menuItemTexts[] =
}; };
#define SFG_TEXT_KILLS "kills" #define SFG_TEXT_KILLS "kills"
#define SFG_TEXT_SAVE_PROMPT "save? L no yes R"
SFG_PROGRAM_MEMORY char *SFG_introText = SFG_PROGRAM_MEMORY char *SFG_introText =
"Near future, capitalist hell, Macrochip corp has enslaved man via " "Near future, capitalist hell, Macrochip corp has enslaved man via "