Don't play slam sound too often
This commit is contained in:
1 parent
82d30b5abf
commit
5da6739077
4 files changed
+13
-1
No files matched your search
+7
-1
@@ -3001,8 +3001,14 @@ static void K_StretchPlayerGravity(player_t *p)
|
||||
I_Assert(p->mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(p->mo));
|
||||
|
||||
if (cv_slamsound.value == 1 && (p->mo->eflags & MFE_JUSTHITFLOOR) && p->mo->stretchslam > 4*mos)
|
||||
if (p->mo->slamsoundtimer)
|
||||
p->mo->slamsoundtimer--;
|
||||
|
||||
if (cv_slamsound.value == 1 && (p->mo->eflags & MFE_JUSTHITFLOOR) && p->mo->stretchslam > 4*mos && !p->mo->slamsoundtimer)
|
||||
{
|
||||
S_StartSound(p->mo, sfx_s3k4c);
|
||||
p->mo->slamsoundtimer = TICRATE;
|
||||
}
|
||||
|
||||
if (!P_IsObjectOnGround(p->mo))
|
||||
{
|
||||
|
||||
@@ -9564,6 +9564,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
mobj->spriteyscale = mobj->realyscale;
|
||||
mobj->spritexoffset = mobj->spriteyoffset = 0;
|
||||
|
||||
// Funni slam sound when landing
|
||||
mobj->slamsoundtimer = 0;
|
||||
|
||||
// set subsector and/or block links
|
||||
P_SetThingPosition(mobj);
|
||||
I_Assert(mobj->subsector != NULL);
|
||||
|
||||
@@ -394,6 +394,8 @@ typedef struct mobj_s
|
||||
boolean colorized; // Whether the mobj uses the rainbow colormap
|
||||
boolean rollmodel; // OpenGL: Should this model rotate?
|
||||
|
||||
tic_t slamsoundtimer;
|
||||
|
||||
// WARNING: New fields must be added separately to savegame and Lua.
|
||||
} mobj_t;
|
||||
|
||||
|
||||
@@ -1984,6 +1984,7 @@ static void LoadMobjThinker(actionf_p1 thinker)
|
||||
mobj->spritexscale = mobj->spriteyscale = mobj->old_spritexscale = mobj->old_spriteyscale = FRACUNIT;
|
||||
mobj->realxscale = mobj->realyscale = FRACUNIT;
|
||||
mobj->stretchslam = 0;
|
||||
mobj->slamsoundtimer = 0;
|
||||
|
||||
mobj->sloperoll = mobj->reservezangle = mobj->reservexydir = 0;
|
||||
|
||||
|
||||
Reference in new issue
Block a user