mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 05:11:34 +00:00
Merge branch 'ld414-invalid-sound-fix' into 'next'
Ld414 invalid sound fix This fixes Linedef type 414 crashing the game if an invalid sound number was supplied to it (this can happen if you, say, scrambled THZ2's textures *cough*), whether or not the "Repeat Midtexture" flag is checked. See merge request !196
This commit is contained in:
commit
1efd2aa770
1 changed files with 66 additions and 58 deletions
22
src/p_spec.c
22
src/p_spec.c
|
@ -2437,12 +2437,22 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
|
|
||||||
case 414: // Play SFX
|
case 414: // Play SFX
|
||||||
{
|
{
|
||||||
fixed_t sfxnum;
|
INT32 sfxnum;
|
||||||
|
|
||||||
sfxnum = sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS;
|
sfxnum = sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS;
|
||||||
|
|
||||||
if (line->tag != 0 && line->flags & ML_EFFECT5)
|
if (sfxnum == sfx_None)
|
||||||
|
return; // Do nothing!
|
||||||
|
if (sfxnum < sfx_None || sfxnum >= NUMSFX)
|
||||||
{
|
{
|
||||||
|
CONS_Debug(DBG_GAMELOGIC, "Line type 414 Executor: sfx number %d is invalid!\n", sfxnum);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (line->tag != 0) // Do special stuff only if a non-zero linedef tag is set
|
||||||
|
{
|
||||||
|
if (line->flags & ML_EFFECT5) // Repeat Midtexture
|
||||||
|
{
|
||||||
|
// Additionally play the sound from tagged sectors' soundorgs
|
||||||
sector_t *sec;
|
sector_t *sec;
|
||||||
|
|
||||||
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0)
|
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0)
|
||||||
|
@ -2451,7 +2461,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
S_StartSound(&sec->soundorg, sfxnum);
|
S_StartSound(&sec->soundorg, sfxnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (line->tag != 0 && mo)
|
else if (mo) // A mobj must have triggered the executor
|
||||||
{
|
{
|
||||||
// Only trigger if mobj is touching the tag
|
// Only trigger if mobj is touching the tag
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
|
@ -2477,9 +2487,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
if (!foundit)
|
if (!foundit)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (sfxnum < NUMSFX && sfxnum > sfx_None)
|
|
||||||
{
|
|
||||||
if (line->flags & ML_NOCLIMB)
|
if (line->flags & ML_NOCLIMB)
|
||||||
{
|
{
|
||||||
// play the sound from nowhere, but only if display player triggered it
|
// play the sound from nowhere, but only if display player triggered it
|
||||||
|
@ -2505,7 +2514,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
S_StartSound(mo, sfxnum);
|
S_StartSound(mo, sfxnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 415: // Run a script
|
case 415: // Run a script
|
||||||
|
@ -3476,7 +3484,7 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar
|
||||||
//
|
//
|
||||||
// Is player standing on the sector's "ground"?
|
// Is player standing on the sector's "ground"?
|
||||||
//
|
//
|
||||||
static inline boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec)
|
static boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec)
|
||||||
{
|
{
|
||||||
if (mo->eflags & MFE_VERTICALFLIP)
|
if (mo->eflags & MFE_VERTICALFLIP)
|
||||||
return (mo->z+mo->height == P_GetSpecialTopZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_CEILING);
|
return (mo->z+mo->height == P_GetSpecialTopZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_CEILING);
|
||||||
|
|
Loading…
Reference in a new issue