mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-12-22 07:18:49 -05:00
Start win animation
This commit is contained in:
parent
d5f4d63216
commit
b747ad56ff
10
constants.h
10
constants.h
@ -166,6 +166,16 @@
|
||||
*/
|
||||
#define SFG_STORYTEXT_DURATION 15000
|
||||
|
||||
/**
|
||||
Time in ms of the player death animation.
|
||||
*/
|
||||
#define SFG_LOSE_ANIMATION_DURATION 2000
|
||||
|
||||
/**
|
||||
Time in ms of the level win animation.
|
||||
*/
|
||||
#define SFG_WIN_ANIMATION_DURATION 500
|
||||
|
||||
// ----------------------------
|
||||
// derived constants
|
||||
|
||||
|
40
main.c
40
main.c
@ -2730,6 +2730,11 @@ void SFG_gameStepPlaying()
|
||||
eliminate = 0;
|
||||
break;
|
||||
|
||||
case SFG_LEVEL_ELEMENT_FINISH:
|
||||
SFG_setGameState(SFG_GAME_STATE_WIN);
|
||||
eliminate = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
eliminate = 0;
|
||||
break;
|
||||
@ -2951,7 +2956,7 @@ void SFG_gameStep()
|
||||
|
||||
case SFG_GAME_STATE_LOSE:
|
||||
{
|
||||
// player die animation
|
||||
// player die animation (lose)
|
||||
|
||||
SFG_updateLevel();
|
||||
|
||||
@ -2972,6 +2977,20 @@ void SFG_gameStep()
|
||||
break;
|
||||
}
|
||||
|
||||
case SFG_GAME_STATE_WIN:
|
||||
{
|
||||
// win animation
|
||||
|
||||
SFG_updateLevel();
|
||||
|
||||
int32_t t = SFG_game.frameTime - SFG_game.stateChangeTime;
|
||||
|
||||
if ((t > SFG_WIN_ANIMATION_DURATION) && SFG_keyIsDown(SFG_KEY_A))
|
||||
SFG_setGameState(SFG_GAME_STATE_MENU);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SFG_GAME_STATE_MAP:
|
||||
if (SFG_keyIsDown(SFG_KEY_B))
|
||||
SFG_setGameState(SFG_GAME_STATE_MENU);
|
||||
@ -3371,6 +3390,22 @@ void SFG_drawMenu()
|
||||
#undef SCROLL_PIXELS_PER_FRAME
|
||||
}
|
||||
|
||||
void SFG_drawWinOverlay()
|
||||
{
|
||||
uint32_t t = RCL_min(SFG_WIN_ANIMATION_DURATION,
|
||||
SFG_game.frameTime - SFG_game.stateChangeTime);
|
||||
|
||||
uint32_t l = (t * (SFG_GAME_RESOLUTION_Y / 4)) / SFG_WIN_ANIMATION_DURATION;
|
||||
|
||||
|
||||
for (uint16_t j = 0; j < l; ++j)
|
||||
for (uint16_t i = 0; i < SFG_GAME_RESOLUTION_X; ++i)
|
||||
{
|
||||
SFG_setPixel(i,j,0);
|
||||
SFG_setPixel(i,SFG_GAME_RESOLUTION_Y - j - 1,0);
|
||||
}
|
||||
}
|
||||
|
||||
void SFG_draw()
|
||||
{
|
||||
#if SFG_BACKGROUND_BLUR != 0
|
||||
@ -3627,6 +3662,9 @@ void SFG_draw()
|
||||
<= SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES)
|
||||
SFG_drawIndicationBorder(SFG_HUD_BORDER_INDICATOR_WIDTH_PIXELS,
|
||||
SFG_HUD_ITEM_TAKEN_INDICATION_COLOR);
|
||||
|
||||
if (SFG_game.state == SFG_GAME_STATE_WIN)
|
||||
SFG_drawWinOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,11 +177,6 @@
|
||||
*/
|
||||
#define SFG_BACKGROUND_BLUR 0
|
||||
|
||||
/**
|
||||
Time in ms of the player death animation.
|
||||
*/
|
||||
#define SFG_LOSE_ANIMATION_DURATION 2000
|
||||
|
||||
//------ developer/debug settings ------
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user