mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Underwater: player must be submerged for 15 seconds to play a "gasp" when they resurface
This commit is contained in:
parent
fc86b5b1db
commit
44ff1d26cc
4 changed files with 22 additions and 6 deletions
|
|
@ -810,6 +810,8 @@ struct player_t
|
||||||
|
|
||||||
SINT8 glanceDir; // Direction the player is trying to look backwards in
|
SINT8 glanceDir; // Direction the player is trying to look backwards in
|
||||||
|
|
||||||
|
UINT16 breathTimer; // Holding your breath underwater
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
// rideroid //
|
// rideroid //
|
||||||
//////////////
|
//////////////
|
||||||
|
|
|
||||||
|
|
@ -9306,6 +9306,12 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||||
|
|
||||||
player->icecube.shaketimer--;
|
player->icecube.shaketimer--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((player->mo->eflags & MFE_UNDERWATER) && player->curshield != KSHIELD_BUBBLE)
|
||||||
|
{
|
||||||
|
if (player->breathTimer < UINT16_MAX)
|
||||||
|
player->breathTimer++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void K_KartResetPlayerColor(player_t *player)
|
void K_KartResetPlayerColor(player_t *player)
|
||||||
|
|
|
||||||
16
src/p_mobj.c
16
src/p_mobj.c
|
|
@ -3441,13 +3441,17 @@ void P_MobjCheckWater(mobj_t *mobj)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p != NULL
|
if (wasinwater && p != NULL)
|
||||||
&& p->curshield != KSHIELD_BUBBLE
|
|
||||||
&& mobj->waterskip == 0
|
|
||||||
&& wasinwater)
|
|
||||||
{
|
{
|
||||||
// Play the gasp sound
|
if (p->curshield != KSHIELD_BUBBLE
|
||||||
S_StartSound(mobj, sfx_s3k38);
|
&& mobj->waterskip == 0
|
||||||
|
&& p->breathTimer > 15*TICRATE)
|
||||||
|
{
|
||||||
|
// Play the gasp sound
|
||||||
|
S_StartSound(mobj, sfx_s3k38);
|
||||||
|
}
|
||||||
|
|
||||||
|
p->breathTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mobj->flags & MF_APPLYTERRAIN)
|
if (mobj->flags & MF_APPLYTERRAIN)
|
||||||
|
|
|
||||||
|
|
@ -549,6 +549,8 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
||||||
|
|
||||||
WRITESINT8(save->p, players[i].glanceDir);
|
WRITESINT8(save->p, players[i].glanceDir);
|
||||||
|
|
||||||
|
WRITEUINT16(save->p, players[i].breathTimer);
|
||||||
|
|
||||||
WRITEUINT8(save->p, players[i].typing_timer);
|
WRITEUINT8(save->p, players[i].typing_timer);
|
||||||
WRITEUINT8(save->p, players[i].typing_duration);
|
WRITEUINT8(save->p, players[i].typing_duration);
|
||||||
|
|
||||||
|
|
@ -1137,6 +1139,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
||||||
|
|
||||||
players[i].glanceDir = READSINT8(save->p);
|
players[i].glanceDir = READSINT8(save->p);
|
||||||
|
|
||||||
|
players[i].breathTimer = READUINT16(save->p);
|
||||||
|
|
||||||
players[i].typing_timer = READUINT8(save->p);
|
players[i].typing_timer = READUINT8(save->p);
|
||||||
players[i].typing_duration = READUINT8(save->p);
|
players[i].typing_duration = READUINT8(save->p);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue