Make the player move forward at the end of level

This commit is contained in:
Lucas S. Vieira 2025-01-01 00:38:06 -03:00
parent 299e81b319
commit 68bae545ff
5 changed files with 19 additions and 4 deletions

View file

@ -7,6 +7,7 @@ typedef enum {
LEVEL_MODE_NORMAL,
LEVEL_MODE_RECORD,
LEVEL_MODE_DEMO,
LEVEL_MODE_FINISHED,
} LEVELMODE;
void screen_level_load();

View file

@ -249,12 +249,19 @@ _goal_sign_update(ObjectState *state, ObjectTableEntry *, VECTOR *pos)
state->timer--;
if(state->timer < 0) {
// Set animation according to character
state->anim_state.animation = 2;
state->timer = 360; // 6-seconds music
sound_bgm_play(BGM_LEVELCLEAR);
state->anim_state.animation = 2;
screen_level_setmode(LEVEL_MODE_FINISHED);
_goal_sign_change_score();
}
} else if((state->anim_state.animation == 2)
&& (player.pos.vx < camera.pos.vx + (CENTERX << 12))) {
state->timer = 360; // 6-seconds music
} else if(state->anim_state.animation < OBJ_ANIMATION_NO_ANIMATION) {
if(state->timer == 360) {
// First frame
sound_bgm_play(BGM_LEVELCLEAR);
}
state->timer--;
// Doesn't hurt to not allow the CD reader to go berserk

View file

@ -642,7 +642,7 @@ _player_update_collision_tb(Player *player)
void
_player_resolve_collision_modes(Player *player)
{
// NOTE THAT PLAYER INPUT IS NOT UPDATED AUTOMATICALLY!
// NOTE THAT PLAYER INPUT IS NOT UPDATED AUTOMATICALLY!
// One must call input_get_state on player->input so that
// player input is recognized. This is done in screen_level.c.

View file

@ -136,6 +136,10 @@ screen_level_load()
|| level_mode == LEVEL_MODE_RECORD) {
data->level_transition = 1;
}
// Recover control if mode is "hold forward"
if(level_mode == LEVEL_MODE_FINISHED)
level_mode = LEVEL_MODE_NORMAL;
}
void
@ -313,6 +317,9 @@ screen_level_update(void *d)
demo_record();
input_get_state(&player.input);
break;
case LEVEL_MODE_FINISHED:
player.input.current = player.input.old = 0x0020;
break;
default:
input_get_state(&player.input);
break;

View file

@ -438,7 +438,7 @@ screen_title_draw(void *d)
x = SCREEN_XRES - (strlen(GIT_VERSION) * 8) - 8;
font_draw_sm(GIT_VERSION, x, SCREEN_YRES - 21);
snprintf(buffer, 255, "2024 luksamuk");
snprintf(buffer, 255, "2024-2025 luksamuk");
x = SCREEN_XRES - (strlen(buffer) * 8) - 8;
font_draw_sm(buffer, x, SCREEN_YRES - 14);
}