Change water chime and add drown warning without music

This commit is contained in:
Lucas S. Vieira 2024-12-21 12:38:48 -03:00
parent 90164a1b97
commit 8f022974a8
3 changed files with 61 additions and 44 deletions

Binary file not shown.

View file

@ -1013,20 +1013,33 @@ player_update(Player *player)
else {
if(player->remaining_air_frames > 0) player->remaining_air_frames--;
uint8_t emit_bubble = !((player->remaining_air_frames + 1) % 120)
&& (player->remaining_air_frames > 0);
// Warning chime control
switch(player->remaining_air_frames) {
case (25 * 60):
case (20 * 60):
case (15 * 60):
// TODO: Warning chime
sound_play_vag(sfx_count, 0);
break;
case (12 * 60):
// TODO: Start drowning music
// TODO: Warning bubble "5"
emit_bubble = 1;
default:
// Start with a countdown of 8.
// By now the player should've already seen the "5" and "4"
// bubbles.
if((player->remaining_air_frames > 0)
&& (player->remaining_air_frames <= (8 * 60))
&& !(player->remaining_air_frames % 60)) {
// Play sample every second.
// Notice that warning bubbles are actually emitted
// every two seconds.
sound_play_vag(sfx_count, 0);
}
break;
}
uint8_t emit_bubble = !((player->remaining_air_frames + 1) % 120)
&& (player->remaining_air_frames > 0);
switch(player->remaining_air_frames) {
case (12 * 60): emit_bubble = 1; break; // TODO: Warning bubble "5"
case (10 * 60): emit_bubble = 1; break; // TODO: Warning bubble "4"
case (8 * 60): emit_bubble = 1; break; // TODO: Warning bubble "3"
case (6 * 60): emit_bubble = 1; break; // TODO: Warning bubble "2"
@ -1057,7 +1070,7 @@ player_update(Player *player)
player->pos.vy += player->vel.vy;
// Print sensors state
if(debug_mode > 0) {
if(debug_mode > 1) {
char buffer[255];
snprintf(buffer, 255,
"COL %s%s.%s%s.%s.%s\n"

View file

@ -502,7 +502,7 @@ screen_level_draw(void *d)
}
// Heads-up display
if(!debug_mode && (level_mode != LEVEL_MODE_DEMO)) {
if((debug_mode <= 1) && (level_mode != LEVEL_MODE_DEMO)) {
font_set_color(
LERPC(level_fade, 0xc8),
LERPC(level_fade, 0xc8),
@ -563,48 +563,52 @@ screen_level_draw(void *d)
snprintf(buffer, 255, "OBJS %3d", object_pool_get_count());
font_draw_sm(buffer, 248, 28);
// Rings and time, for convenience
// Rings, time and air for convenience
snprintf(buffer, 255, "RING %03d", level_ring_count);
font_draw_sm(buffer, 248, 36);
snprintf(buffer, 255, "TIME %03d", (get_elapsed_frames() / 60));
font_draw_sm(buffer, 248, 44);
snprintf(buffer, 255, "AIR %02d", player.remaining_air_frames / 60);
font_draw_sm(buffer, 248, 52);
// Player debug
snprintf(buffer, 255,
"GSP %08x\n"
"SPD %08x %08x\n"
"ANG %08x G.P %s %s %3d\n"
"POS %08x %08x\n"
"ACT %02u AIR %02u\n"
,
player.vel.vz,
player.vel.vx, player.vel.vy,
player.angle,
(player.gsmode == CDIR_FLOOR)
? "FL"
: (player.gsmode == CDIR_RWALL)
? "RW"
: (player.gsmode == CDIR_LWALL)
? "LW"
: (player.gsmode == CDIR_CEILING)
? "CE"
: " ",
(player.psmode == CDIR_FLOOR)
? "FL"
: (player.psmode == CDIR_RWALL)
? "RW"
: (player.psmode == CDIR_LWALL)
? "LW"
: (player.psmode == CDIR_CEILING)
? "CE"
: " ",
(int32_t)(((int32_t)player.angle * (int32_t)(360 << 12)) >> 24), // angle in deg
player.pos.vx, player.pos.vy,
player.action,
player.remaining_air_frames / 60
);
font_draw_sm(buffer, 8, 12);
if(debug_mode > 1) {
snprintf(buffer, 255,
"GSP %08x\n"
"SPD %08x %08x\n"
"ANG %08x G.P %s %s %3d\n"
"POS %08x %08x\n"
"ACT %02u\n"
,
player.vel.vz,
player.vel.vx, player.vel.vy,
player.angle,
(player.gsmode == CDIR_FLOOR)
? "FL"
: (player.gsmode == CDIR_RWALL)
? "RW"
: (player.gsmode == CDIR_LWALL)
? "LW"
: (player.gsmode == CDIR_CEILING)
? "CE"
: " ",
(player.psmode == CDIR_FLOOR)
? "FL"
: (player.psmode == CDIR_RWALL)
? "RW"
: (player.psmode == CDIR_LWALL)
? "LW"
: (player.psmode == CDIR_CEILING)
? "CE"
: " ",
(int32_t)(((int32_t)player.angle * (int32_t)(360 << 12)) >> 24), // angle in deg
player.pos.vx, player.pos.vy,
player.action
);
font_draw_sm(buffer, 8, 12);
}
}
}