Un-shitify T_* pointers

as with the last commit that did this, this fixes possible undefined behaviour reported by UBSan
This commit is contained in:
NepDisk 2025-10-23 23:47:25 -04:00
parent 0da6852029
commit 22120bafbc
3 changed files with 66 additions and 44 deletions

View file

@ -161,8 +161,9 @@ result_e T_MovePlane(sector_t *sector, fixed_t speed, fixed_t dest, boolean crus
//
// MOVE A FLOOR TO ITS DESTINATION (UP OR DOWN)
//
void T_MoveFloor(floormove_t *movefloor)
void T_MoveFloor(void *thinker)
{
floormove_t *movefloor = thinker;
result_e res = 0;
boolean remove = false;
@ -301,8 +302,9 @@ void T_MoveFloor(floormove_t *movefloor)
// The function moves the planes differently based on direction, so if it's
// traveling really fast, the floor and ceiling won't hit each other and
// stop the lift.
void T_MoveElevator(elevator_t *elevator)
void T_MoveElevator(void *thinker)
{
elevator_t *elevator = thinker;
result_e res1 = 0, res2 = 0, res = 0;
boolean dontupdate = false;
fixed_t oldfloor, oldceiling;
@ -548,8 +550,9 @@ void T_MoveElevator(elevator_t *elevator)
//
// Useful for things like intermittent falling lava.
//
void T_ContinuousFalling(continuousfall_t *faller)
void T_ContinuousFalling(void *thinker)
{
continuousfall_t *faller = thinker;
faller->sector->ceilingheight += faller->speed*faller->direction;
faller->sector->floorheight += faller->speed*faller->direction;
@ -614,8 +617,9 @@ static fixed_t P_SectorCheckWater(sector_t *analyzesector,
//////////////////////////////////////////////////
// Bounces a floating cheese
void T_BounceCheese(bouncecheese_t *bouncer)
void T_BounceCheese(void *thinker)
{
bouncecheese_t *bouncer = thinker;
fixed_t sectorheight;
fixed_t halfheight;
fixed_t waterheight;
@ -755,8 +759,9 @@ void T_BounceCheese(bouncecheese_t *bouncer)
// T_StartCrumble ////////////////////////////////
//////////////////////////////////////////////////
// Crumbling platform Tails 03-11-2002
void T_StartCrumble(crumble_t *crumble)
void T_StartCrumble(void *thinker)
{
crumble_t *crumble = thinker;
ffloor_t *rover;
sector_t *sector;
INT32 i;
@ -930,8 +935,9 @@ void T_StartCrumble(crumble_t *crumble)
//////////////////////////////////////////////////
// Mario hits a block!
//
void T_MarioBlock(mariothink_t *block)
void T_MarioBlock(void *thinker)
{
mariothink_t *block = thinker;
INT32 i;
T_MovePlane
@ -971,8 +977,9 @@ void T_MarioBlock(mariothink_t *block)
P_RecalcPrecipInSector(&sectors[i]);
}
void T_FloatSector(floatthink_t *floater)
void T_FloatSector(void *thinker)
{
floatthink_t *floater = thinker;
fixed_t cheeseheight;
fixed_t waterheight;
sector_t *actionsector;
@ -1065,8 +1072,9 @@ static mobj_t *SearchMarioNode(msecnode_t *node)
return thing;
}
void T_MarioBlockChecker(mariocheck_t *block)
void T_MarioBlockChecker(void *thinker)
{
mariocheck_t *block = thinker;
line_t *masterline = block->sourceline;
if (SearchMarioNode(block->sector->touching_thinglist))
{
@ -1084,8 +1092,9 @@ void T_MarioBlockChecker(mariocheck_t *block)
// This is the Thwomp's 'brain'. It looks around for players nearby, and if
// it finds any, **SMASH**!!! Muahahhaa....
void T_ThwompSector(thwomp_t *thwomp)
void T_ThwompSector(void *thinker)
{
thwomp_t *thwomp = thinker;
fixed_t thwompx, thwompy;
sector_t *actionsector;
ffloor_t *rover = NULL;
@ -1246,8 +1255,9 @@ static boolean T_SectorHasEnemies(sector_t *sec)
// Runs a linedef exec when no more MF_ENEMY/MF_BOSS objects with health are in the area
// \sa P_AddNoEnemiesThinker
//
void T_NoEnemiesSector(noenemies_t *nobaddies)
void T_NoEnemiesSector(void *thinker)
{
noenemies_t *nobaddies = thinker;
size_t i;
sector_t *sec = NULL;
INT32 secnum = -1;
@ -1301,8 +1311,9 @@ static boolean P_CheckAllTrigger(eachtime_t *eachtime)
return true;
}
void T_EachTimeThinker(eachtime_t *eachtime)
void T_EachTimeThinker(void *thinker)
{
eachtime_t *eachtime = thinker;
size_t i;
boolean oldPlayersInArea[MAXPLAYERS];
sector_t *caller[MAXPLAYERS];
@ -1362,8 +1373,9 @@ void T_EachTimeThinker(eachtime_t *eachtime)
// Rises up to its topmost position when a
// player steps on it. Lowers otherwise.
//
void T_RaiseSector(raise_t *raise)
void T_RaiseSector(void *thinker)
{
raise_t *raise = thinker;
msecnode_t *node;
mobj_t *thing;
sector_t *sector;
@ -1507,8 +1519,9 @@ void T_RaiseSector(raise_t *raise)
P_RecalcPrecipInSector(&sectors[i]);
}
void T_CameraScanner(elevator_t *elevator)
void T_CameraScanner(void *thinker)
{
elevator_t *elevator = thinker;
// leveltime is compared to make multiple scanners in one map function correctly.
static tic_t lastleveltime = 32000; // any number other than 0 should do here
static boolean camerascanned[MAXSPLITSCREENPLAYERS];
@ -1552,8 +1565,9 @@ void T_CameraScanner(elevator_t *elevator)
}
}
void T_PlaneDisplace(planedisplace_t *pd)
void T_PlaneDisplace(void *thinker)
{
planedisplace_t *pd = thinker;
sector_t *control, *target;
INT32 direction;
fixed_t diff;

View file

@ -1211,8 +1211,9 @@ INT32 P_FindMinSurroundingLight(sector_t *sector, INT32 max)
return min;
}
void T_ExecutorDelay(executor_t *e)
void T_ExecutorDelay(void *thinker)
{
executor_t *e = thinker;
if (--e->timer <= 0)
{
if (e->caller && P_MobjWasRemoved(e->caller)) // If the mobj died while we were delaying
@ -6721,8 +6722,9 @@ static inline void P_AddCameraScanner(sector_t *sourcesec, sector_t *actionsecto
* \sa P_AddLaserThinker
* \author SSNTails <http://www.ssntails.org>
*/
void T_LaserFlash(laserthink_t *flash)
void T_LaserFlash(void *thinker)
{
laserthink_t *flash = thinker;
msecnode_t *node;
mobj_t *thing;
INT32 s;
@ -8116,8 +8118,9 @@ static void P_DoScrollMove(mobj_t *thing, fixed_t dx, fixed_t dy, INT32 exclusiv
* \author Steven McGranahan
* \author Graue <graue@oceanbase.org>
*/
void T_Scroll(scroll_t *s)
void T_Scroll(void *thinker)
{
scroll_t *s = thinker;
fixed_t dx = s->dx, dy = s->dy;
boolean is3dblock = false;
@ -8520,8 +8523,9 @@ static void Add_MasterDisappearer(tic_t appeartime, tic_t disappeartime, tic_t o
* \param d Disappear thinker.
* \sa Add_MasterDisappearer
*/
void T_Disappear(disappear_t *d)
void T_Disappear(void *thinker)
{
disappear_t *d = thinker;
if (d->offset && !d->exists)
{
d->offset--;
@ -9006,8 +9010,9 @@ static void P_AddFakeFloorFader(ffloor_t *rover, size_t sectornum, size_t ffloor
* \param d Fade thinker.
* \sa P_AddFakeFloorFader
*/
void T_Fade(fade_t *d)
void T_Fade(void *thinker)
{
fade_t *d = thinker;
if (d->rover && !P_FadeFakeFloor(d->rover, d->sourcevalue, d->destvalue, d->speed, d->ticbased, &d->timer,
d->doexists, d->dotranslucent, d->dolighting, d->docolormap, d->docollision, d->doghostfade, d->exactalpha))
{
@ -9071,8 +9076,9 @@ static void Add_ColormapFader(sector_t *sector, extracolormap_t *source_exc, ext
P_AddThinker(THINK_MAIN, &d->thinker);
}
void T_FadeColormap(fadecolormap_t *d)
void T_FadeColormap(void *thinker)
{
fadecolormap_t *d = thinker;
if ((d->ticbased && --d->timer <= 0)
|| (!d->ticbased && (d->timer -= d->duration) <= 0)) // d->duration used as speed decrement
{
@ -9210,8 +9216,9 @@ boolean P_AllowFriction(mobj_t *mobj)
* \param f Friction thinker.
* \sa Add_Friction
*/
void T_Friction(friction_t *f)
void T_Friction(void *thinker)
{
friction_t *f = thinker;
sector_t *sec, *referrer = NULL;
mobj_t *thing;
msecnode_t *node;
@ -9363,8 +9370,9 @@ static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, fixed_t
* \todo Split up into multiple functions.
* \sa Add_Pusher, PIT_PushThing
*/
void T_Pusher(pusher_t *p)
void T_Pusher(void *thinker)
{
pusher_t *p = thinker;
sector_t *sec, *referrer = NULL;
mobj_t *thing;
msecnode_t *node;

View file

@ -1058,20 +1058,20 @@ void EV_DoContinuousFall(sector_t *sec, sector_t *backsector, fixed_t spd, boole
void EV_MarioBlock(ffloor_t *rover, sector_t *sector, mobj_t *puncher);
void T_MoveFloor(floormove_t *movefloor);
void T_MoveFloor(void *thinker);
void T_MoveElevator(elevator_t *elevator);
void T_ContinuousFalling(continuousfall_t *faller);
void T_BounceCheese(bouncecheese_t *bouncer);
void T_StartCrumble(crumble_t *crumble);
void T_MarioBlock(mariothink_t *block);
void T_FloatSector(floatthink_t *floater);
void T_MarioBlockChecker(mariocheck_t *block);
void T_ThwompSector(thwomp_t *thwomp);
void T_NoEnemiesSector(noenemies_t *nobaddies);
void T_EachTimeThinker(eachtime_t *eachtime);
void T_CameraScanner(elevator_t *elevator);
void T_RaiseSector(raise_t *raise);
void T_MoveElevator(void *thinker);
void T_ContinuousFalling(void *thinker);
void T_BounceCheese(void *thinker);
void T_StartCrumble(void *thinker);
void T_MarioBlock(void *thinker);
void T_FloatSector(void *thinker);
void T_MarioBlockChecker(void *thinker);
void T_ThwompSector(void *thinker);
void T_NoEnemiesSector(void *thinker);
void T_EachTimeThinker(void *thinker);
void T_CameraScanner(void *thinker);
void T_RaiseSector(void *thinker);
struct executor_t
{
@ -1082,7 +1082,7 @@ struct executor_t
INT32 timer; // Delay timer
};
void T_ExecutorDelay(executor_t *e);
void T_ExecutorDelay(void *thinker);
/** Generalized scroller.
*/
@ -1108,8 +1108,8 @@ struct scroll_t
} type;
};
void T_Scroll(scroll_t *s);
void T_LaserFlash(laserthink_t *flash);
void T_Scroll(void *thinker);
void T_LaserFlash(void *thinker);
/** Friction for ice/sludge effects.
*/
@ -1126,7 +1126,7 @@ struct friction_t
// Friction defines.
#define ORIG_FRICTION (62914) ///< Original value.
void T_Friction(friction_t *f);
void T_Friction(void *thinker);
typedef enum
{
@ -1162,7 +1162,7 @@ struct disappear_t
INT32 exists; ///< Exists toggle
};
void T_Disappear(disappear_t *d);
void T_Disappear(void *thinker);
// Model for fading FOFs
struct fade_t
@ -1188,7 +1188,7 @@ struct fade_t
boolean exactalpha; ///< Use exact alpha values (opengl)
};
void T_Fade(fade_t *d);
void T_Fade(void *thinker);
// Model for fading colormaps
@ -1203,10 +1203,10 @@ struct fadecolormap_t
INT32 timer; ///< Timer for tic-based logic (OR: internal speed counter)
};
void T_FadeColormap(fadecolormap_t *d);
void T_FadeColormap(void *thinker);
// Prototype function for pushers
void T_Pusher(pusher_t *p);
void T_Pusher(void *thinker);
// Plane displacement
struct planedisplace_t
@ -1227,7 +1227,7 @@ struct planedisplace_t
} type;
};
void T_PlaneDisplace(planedisplace_t *pd);
void T_PlaneDisplace(void *thinker);
void P_CalcHeight(player_t *player);