Stop elevator abuse

This commit is contained in:
MascaraSnake 2021-09-20 08:18:59 +02:00
parent 1784c7b0ef
commit 609fb91e4b
3 changed files with 12 additions and 14 deletions

View file

@ -30,7 +30,7 @@ void P_RemoveLighting(sector_t *sector)
// The thinker is the first member in all the lighting action structs,
// so just let the thinker get freed, and that will free the whole
// structure.
P_RemoveThinker(&((elevator_t *)sector->lightingdata)->thinker);
P_RemoveThinker(&((thinkerdata_t *)sector->lightingdata)->thinker);
sector->lightingdata = NULL;
}
}
@ -144,7 +144,7 @@ void P_SpawnLightningFlash(sector_t *sector)
minlight = ((lightflash_t *)sector->lightingdata)->minlight;
}
P_RemoveThinker(&((elevator_t *)sector->lightingdata)->thinker);
P_RemoveThinker(&((thinkerdata_t *)sector->lightingdata)->thinker);
}
sector->lightingdata = NULL;

View file

@ -2143,12 +2143,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (sectors[secnum].lightingdata)
{
// Stop the lighting madness going on in this sector!
P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker);
P_RemoveThinker(&((thinkerdata_t *)sectors[secnum].lightingdata)->thinker);
sectors[secnum].lightingdata = NULL;
// No, it's not an elevator_t, but any struct with a thinker_t named
// 'thinker' at the beginning will do here. (We don't know what it
// actually is: could be lightlevel_t, fireflicker_t, glow_t, etc.)
}
if (!(line->args[1] & TMLC_NOSECTOR))
@ -2534,7 +2530,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
TAG_ITER_SECTORS(line->args[0], secnum)
if (sectors[secnum].lightingdata)
{
P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker);
P_RemoveThinker(&((thinkerdata_t *)sectors[secnum].lightingdata)->thinker);
sectors[secnum].lightingdata = NULL;
}
break;
@ -3689,12 +3685,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (sectors[secnum].lightingdata)
{
// Stop any lighting effects going on in the sector
P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker);
P_RemoveThinker(&((thinkerdata_t *)sectors[secnum].lightingdata)->thinker);
sectors[secnum].lightingdata = NULL;
// No, it's not an elevator_t, but any struct with a thinker_t named
// 'thinker' at the beginning will do here. (We don't know what it
// actually is: could be lightlevel_t, fireflicker_t, glow_t, etc.)
}
if (line->args[2] == TML_FLOOR)
@ -8040,7 +8032,7 @@ static void P_ResetColormapFader(sector_t *sector)
// The thinker is the first member in all the action structs,
// so just let the thinker get freed, and that will free the whole
// structure.
P_RemoveThinker(&((elevator_t *)sector->fadecolormapdata)->thinker);
P_RemoveThinker(&((thinkerdata_t *)sector->fadecolormapdata)->thinker);
sector->fadecolormapdata = NULL;
}
}

View file

@ -219,6 +219,12 @@ void P_RunNightsCapsuleTouchExecutors(mobj_t *actor, boolean entering, boolean e
UINT16 P_GetFFloorID(ffloor_t *fflr);
ffloor_t *P_GetFFloorByID(sector_t *sec, UINT16 id);
// Use this when you don't know the type of your thinker data struct but need to access its thinker.
typedef struct
{
thinker_t thinker;
} thinkerdata_t;
//
// P_LIGHTS
//