mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-23 12:04:38 -04:00
play sound when hitting animated floor (#931)
* play sound when hitting animated floor * play sounds instead of "oof" only * fix sound group * add support for "small" splash sounds when merely stepping down into liquid * fix build * compat fix * introduce a flatterrain[] lookup table * comments
This commit is contained in:
parent
3a97d652d7
commit
cba9bd5454
@ -657,6 +657,13 @@ struct {
|
||||
{sfx_itmbk, sfx_getpow},
|
||||
{sfx_getpow, sfx_itemup},
|
||||
{sfx_itemup, sfx_None},
|
||||
|
||||
{sfx_splash, sfx_oof},
|
||||
{sfx_ploosh, sfx_oof},
|
||||
{sfx_lvsiz, sfx_oof},
|
||||
{sfx_splsml, sfx_None},
|
||||
{sfx_plosml, sfx_None},
|
||||
{sfx_lavsml, sfx_None},
|
||||
};
|
||||
|
||||
//
|
||||
|
10
src/p_mobj.c
10
src/p_mobj.c
@ -523,8 +523,10 @@ floater:
|
||||
P_DamageMobj(mo, NULL, NULL, mo->health);
|
||||
else
|
||||
if (mo->player && // killough 5/12/98: exclude voodoo dolls
|
||||
mo->player->mo == mo &&
|
||||
mo->momz < -GRAVITY*8)
|
||||
mo->player->mo == mo)
|
||||
{
|
||||
int oof = 0;
|
||||
if (mo->momz < -GRAVITY*8)
|
||||
{
|
||||
// Squat down.
|
||||
// Decrease viewheight for a moment
|
||||
@ -532,8 +534,10 @@ floater:
|
||||
// and utter appropriate sound.
|
||||
|
||||
mo->player->deltaviewheight = mo->momz>>3;
|
||||
S_StartSound (mo, sfx_oof);
|
||||
oof = 1;
|
||||
}
|
||||
P_HitFloor(mo, oof); // [FG] play sound when hitting animated floor
|
||||
}
|
||||
mo->momz = 0;
|
||||
}
|
||||
|
||||
|
53
src/p_spec.c
53
src/p_spec.c
@ -57,11 +57,21 @@
|
||||
#include "r_sky.h" // R_GetSkyColor
|
||||
#include "m_swap.h"
|
||||
#include "i_video.h" // [FG] uncapped
|
||||
#include "m_misc2.h"
|
||||
|
||||
//
|
||||
// Animating textures and planes
|
||||
// There is another anim_t used in wi_stuff, unrelated.
|
||||
//
|
||||
|
||||
typedef enum
|
||||
{
|
||||
terrain_solid,
|
||||
terrain_water,
|
||||
terrain_slime,
|
||||
terrain_lava
|
||||
} terrain_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
boolean istexture;
|
||||
@ -159,6 +169,33 @@ void P_InitPicAnims (void)
|
||||
|
||||
lastanim->picnum = R_FlatNumForName (animdefs[i].endname);
|
||||
lastanim->basepic = R_FlatNumForName (animdefs[i].startname);
|
||||
|
||||
if (lastanim->picnum >= lastanim->basepic)
|
||||
{
|
||||
char *startname;
|
||||
terrain_t terrain;
|
||||
int j;
|
||||
|
||||
startname = M_StringDuplicate(animdefs[i].startname);
|
||||
M_ForceUppercase(startname);
|
||||
|
||||
// [FG] play sound when hitting animated floor
|
||||
if (strstr(startname, "WATER") || strstr(startname, "BLOOD"))
|
||||
terrain = terrain_water;
|
||||
else if (strstr(startname, "NUKAGE") || strstr(startname, "SLIME"))
|
||||
terrain = terrain_slime;
|
||||
else if (strstr(startname, "LAVA"))
|
||||
terrain = terrain_lava;
|
||||
else
|
||||
terrain = terrain_solid;
|
||||
|
||||
free(startname);
|
||||
|
||||
for (j = lastanim->basepic; j <= lastanim->picnum; j++)
|
||||
{
|
||||
flatterrain[j] = terrain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastanim->istexture = animdefs[i].istexture;
|
||||
@ -179,6 +216,22 @@ void P_InitPicAnims (void)
|
||||
Z_ChangeTag (animdefs,PU_CACHE); //jff 3/23/98 allow table to be freed
|
||||
}
|
||||
|
||||
// [FG] play sound when hitting animated floor
|
||||
void P_HitFloor (mobj_t *mo, int oof)
|
||||
{
|
||||
const short floorpic = mo->subsector->sector->floorpic;
|
||||
terrain_t terrain = flatterrain[floorpic];
|
||||
|
||||
int hitsound[][2] = {
|
||||
{sfx_None, sfx_oof}, // terrain_solid
|
||||
{sfx_splsml, sfx_splash}, // terrain_water
|
||||
{sfx_plosml, sfx_ploosh}, // terrain_slime
|
||||
{sfx_lavsml, sfx_lvsiz} // terrain_lava
|
||||
};
|
||||
|
||||
S_StartSound(mo, hitsound[terrain][oof]);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Linedef and Sector Special Implementation Utility Functions
|
||||
|
@ -1009,6 +1009,8 @@ int P_ActivateInStasisCeiling(line_t *line);
|
||||
|
||||
mobj_t *P_GetPushThing(int); // phares 3/23/98
|
||||
|
||||
void P_HitFloor (mobj_t *mo, int oof); // [FG] play sound when hitting animated floor
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -122,6 +122,7 @@ unsigned **texturecolumnofs2;
|
||||
byte **texturecomposite;
|
||||
byte **texturecomposite2;
|
||||
int *flattranslation; // for global animation
|
||||
int *flatterrain;
|
||||
int *texturetranslation;
|
||||
const byte **texturebrightmap; // [crispy] brightmaps
|
||||
|
||||
@ -780,8 +781,14 @@ void R_InitFlats(void)
|
||||
flattranslation =
|
||||
Z_Malloc((numflats+1)*sizeof(*flattranslation), PU_STATIC, 0);
|
||||
|
||||
flatterrain =
|
||||
Z_Malloc((numflats+1)*sizeof(*flatterrain), PU_STATIC, 0);
|
||||
|
||||
for (i=0 ; i<numflats ; i++)
|
||||
{
|
||||
flattranslation[i] = i;
|
||||
flatterrain[i] = 0; // terrain_solid
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -62,6 +62,8 @@ extern int firstflat;
|
||||
extern int *flattranslation;
|
||||
extern int *texturetranslation;
|
||||
|
||||
extern int *flatterrain;
|
||||
|
||||
// Sprite....
|
||||
extern int firstspritelump;
|
||||
extern int lastspritelump;
|
||||
|
@ -262,6 +262,14 @@ sfxinfo_t original_S_sfx[NUMSFX] = {
|
||||
// [crispy] play DSSECRET if available
|
||||
SOUND("secret", sg_none, 100),
|
||||
|
||||
// [FG] play sound when hitting animated floor
|
||||
SOUND("splash", sg_oof, 96),
|
||||
SOUND("ploosh", sg_oof, 96),
|
||||
SOUND("lvsiz", sg_oof, 96),
|
||||
SOUND("splsml", sg_oof, 96),
|
||||
SOUND("plosml", sg_oof, 96),
|
||||
SOUND("lavsml", sg_oof, 96),
|
||||
|
||||
[500] = SOUND("fre000", sg_none, 127),
|
||||
[501] = SOUND("fre001", sg_none, 127),
|
||||
[502] = SOUND("fre002", sg_none, 127),
|
||||
|
@ -317,6 +317,14 @@ typedef enum {
|
||||
// [crispy] play DSSECRET if available
|
||||
sfx_secret,
|
||||
|
||||
// [FG] play sound when hitting animated floor
|
||||
sfx_splash,
|
||||
sfx_ploosh,
|
||||
sfx_lvsiz,
|
||||
sfx_splsml,
|
||||
sfx_plosml,
|
||||
sfx_lavsml,
|
||||
|
||||
sfx_fre000 = 500,
|
||||
sfx_fre001,
|
||||
sfx_fre002,
|
||||
|
Loading…
x
Reference in New Issue
Block a user