ref: d9f275813817870c9252ca5b370963a83d989488
parent: 9bd7fbd74b9e876a461a0100bdc4ae5c08d5a7c9
author: Turo Lamminen <[email protected]>
date: Sat Nov 5 13:39:10 EDT 2022
hexen: Improve type correctness for thinker_t think functions
--- a/src/hexen/h2def.h
+++ b/src/hexen/h2def.h
@@ -159,8 +159,12 @@
===============================================================================
*/
+
+struct thinker_s;
+
+
// think_t is a function pointer to a routine to handle an actor
-typedef void (*think_t) ();
+typedef void (*think_t)(struct thinker_s *);
typedef struct thinker_s
{
--- a/src/hexen/p_acs.c
+++ b/src/hexen/p_acs.c
@@ -768,8 +768,9 @@
//
//==========================================================================
-void T_InterpretACS(acs_t * script)
+void T_InterpretACS(thinker_t *thinker)
{
+ acs_t *script = (acs_t *) thinker;
int cmd;
int action;
--- a/src/hexen/p_ceilng.c
+++ b/src/hexen/p_ceilng.c
@@ -33,8 +33,9 @@
// T_MoveCeiling
//
//==================================================================
-void T_MoveCeiling(ceiling_t * ceiling)
+void T_MoveCeiling(thinker_t *thinker)
{
+ ceiling_t *ceiling = (ceiling_t *) thinker;
result_e res;
switch (ceiling->direction)
--- a/src/hexen/p_doors.c
+++ b/src/hexen/p_doors.c
@@ -31,8 +31,9 @@
// T_VerticalDoor
//
//==================================================================
-void T_VerticalDoor(vldoor_t * door)
+void T_VerticalDoor(thinker_t *thinker)
{
+ vldoor_t *door = (vldoor_t *) thinker;
result_e res;
switch (door->direction)
--- a/src/hexen/p_floor.c
+++ b/src/hexen/p_floor.c
@@ -183,8 +183,9 @@
// MOVE A FLOOR TO IT'S DESTINATION (UP OR DOWN)
//
//==================================================================
-void T_MoveFloor(floormove_t * floor)
+void T_MoveFloor(thinker_t *thinker)
{
+ floormove_t *floor = (floormove_t *) thinker;
result_e res;
if (floor->resetDelayCount)
@@ -653,8 +654,9 @@
//
//=========================================================================
-void T_BuildPillar(pillar_t * pillar)
+void T_BuildPillar(thinker_t *thinker)
{
+ pillar_t *pillar = (pillar_t *) thinker;
result_e res1;
result_e res2;
@@ -861,8 +863,9 @@
#define WGLSTATE_STABLE 2
#define WGLSTATE_REDUCE 3
-void T_FloorWaggle(floorWaggle_t * waggle)
+void T_FloorWaggle(thinker_t *thinker)
{
+ floorWaggle_t *waggle = (floorWaggle_t *) thinker;
switch (waggle->state)
{
case WGLSTATE_EXPAND:
--- a/src/hexen/p_lights.c
+++ b/src/hexen/p_lights.c
@@ -25,8 +25,9 @@
//
//============================================================================
-void T_Light(light_t * light)
+void T_Light(thinker_t *thinker)
{
+ light_t *light = (light_t *) thinker;
if (light->count)
{
light->count--;
@@ -251,8 +252,9 @@
32, 32, 48, 64, 80, 96, 112, 128
};
-void T_Phase(phase_t * phase)
+void T_Phase(thinker_t *thinker)
{
+ phase_t *phase = (phase_t *) thinker;
phase->index = (phase->index + 1) & 63;
phase->sector->lightlevel = phase->base + PhaseTable[phase->index];
}
--- a/src/hexen/p_local.h
+++ b/src/hexen/p_local.h
@@ -151,8 +151,8 @@
void P_ThrustMobj(mobj_t * mo, angle_t angle, fixed_t move);
int P_FaceMobj(mobj_t * source, mobj_t * target, angle_t * delta);
boolean P_SeekerMissile(mobj_t * actor, angle_t thresh, angle_t turnMax);
-void P_MobjThinker(mobj_t * mobj);
-void P_BlasterMobjThinker(mobj_t * mobj);
+void P_MobjThinker(thinker_t *thinker);
+void P_BlasterMobjThinker(thinker_t *thinker);
void P_SpawnPuff(fixed_t x, fixed_t y, fixed_t z);
void P_SpawnBlood(fixed_t x, fixed_t y, fixed_t z, int damage);
void P_BloodSplatter(fixed_t x, fixed_t y, fixed_t z, mobj_t * originator);
@@ -408,11 +408,11 @@
extern polyblock_t **PolyBlockMap;
-void T_PolyDoor(polydoor_t * pd);
-void T_RotatePoly(polyevent_t * pe);
+void T_PolyDoor(thinker_t *thinker);
+void T_RotatePoly(thinker_t *thinker);
boolean EV_RotatePoly(line_t * line, byte * args, int direction, boolean
overRide);
-void T_MovePoly(polyevent_t * pe);
+void T_MovePoly(thinker_t *thinker);
boolean EV_MovePoly(line_t * line, byte * args, boolean timesEight, boolean
overRide);
boolean EV_OpenPolyDoor(line_t * line, byte * args, podoortype_t type);
--- a/src/hexen/p_mobj.c
+++ b/src/hexen/p_mobj.c
@@ -922,8 +922,9 @@
//
//----------------------------------------------------------------------------
-void P_BlasterMobjThinker(mobj_t * mobj)
+void P_BlasterMobjThinker(thinker_t *thinker)
{
+ mobj_t *mobj = (mobj_t *) thinker;
int i;
fixed_t xfrac;
fixed_t yfrac;
@@ -1051,8 +1052,9 @@
//
//----------------------------------------------------------------------------
-void P_MobjThinker(mobj_t * mobj)
+void P_MobjThinker(thinker_t *thinker)
{
+ mobj_t *mobj = (mobj_t *) thinker;
mobj_t *onmo;
/*
// Reset to not blasted when momentums are gone
--- a/src/hexen/p_plats.c
+++ b/src/hexen/p_plats.c
@@ -27,8 +27,9 @@
// Move a plat up and down
//
//==================================================================
-void T_PlatRaise(plat_t * plat)
+void T_PlatRaise(thinker_t *thinker)
{
+ plat_t *plat = (plat_t *) thinker;
result_e res;
switch (plat->status)
--- a/src/hexen/p_spec.h
+++ b/src/hexen/p_spec.h
@@ -133,8 +133,8 @@
#define LIGHT_SEQUENCE 3
#define LIGHT_SEQUENCE_ALT 4
-void T_Phase(phase_t * phase);
-void T_Light(light_t * light);
+void T_Phase(thinker_t *thinker);
+void T_Light(thinker_t *thinker);
void P_SpawnPhasedLight(sector_t * sector, int base, int index);
void P_SpawnLightSequence(sector_t * sector, int indexStep);
boolean EV_SpawnLight(line_t * line, byte * arg, lighttype_t type);
@@ -290,7 +290,7 @@
extern plat_t *activeplats[MAXPLATS];
-void T_PlatRaise(plat_t * plat);
+void T_PlatRaise(thinker_t *thinker);
int EV_DoPlat(line_t * line, byte * args, plattype_e type, int amount);
void P_AddActivePlat(plat_t * plat);
void P_RemoveActivePlat(plat_t * plat);
@@ -329,7 +329,7 @@
boolean EV_VerticalDoor(line_t * line, mobj_t * thing);
int EV_DoDoor(line_t * line, byte * args, vldoor_e type);
-void T_VerticalDoor(vldoor_t * door);
+void T_VerticalDoor(thinker_t *thinker);
//void P_SpawnDoorCloseIn30(sector_t *sec);
//void P_SpawnDoorRaiseIn5Mins(sector_t *sec, int secnum);
@@ -372,7 +372,7 @@
extern ceiling_t *activeceilings[MAXCEILINGS];
int EV_DoCeiling(line_t * line, byte * args, ceiling_e type);
-void T_MoveCeiling(ceiling_t * ceiling);
+void T_MoveCeiling(thinker_t *thinker);
void P_AddActiveCeiling(ceiling_t * c);
void P_RemoveActiveCeiling(ceiling_t * c);
int EV_CeilingCrushStop(line_t * line, byte * args);
@@ -470,9 +470,9 @@
int EV_BuildStairs(line_t * line, byte * args, int direction, stairs_e type);
int EV_DoFloor(line_t * line, byte * args, floor_e floortype);
-void T_MoveFloor(floormove_t * floor);
-void T_BuildPillar(pillar_t * pillar);
-void T_FloorWaggle(floorWaggle_t * waggle);
+void T_MoveFloor(thinker_t *thinker);
+void T_BuildPillar(thinker_t *thinker);
+void T_FloorWaggle(thinker_t *thinker);
int EV_BuildPillar(line_t * line, byte * args, boolean crush);
int EV_OpenPillar(line_t * line, byte * args);
int EV_DoFloorAndCeiling(line_t * line, byte * args, boolean raise);
@@ -553,7 +553,7 @@
boolean P_StartLockedACS(line_t * line, byte * args, mobj_t * mo, int side);
boolean P_TerminateACS(int number, int map);
boolean P_SuspendACS(int number, int map);
-void T_InterpretACS(acs_t * script);
+void T_InterpretACS(thinker_t *thinker);
void P_TagFinished(int tag);
void P_PolyobjFinished(int po);
void P_ACSInitNewGame(void);
--- a/src/hexen/po_man.c
+++ b/src/hexen/po_man.c
@@ -72,8 +72,9 @@
//
//==========================================================================
-void T_RotatePoly(polyevent_t * pe)
+void T_RotatePoly(thinker_t *thinker)
{
+ polyevent_t *pe = (polyevent_t *) thinker;
int absSpeed;
polyobj_t *poly;
@@ -206,8 +207,9 @@
//
//==========================================================================
-void T_MovePoly(polyevent_t * pe)
+void T_MovePoly(thinker_t *thinker)
{
+ polyevent_t *pe = (polyevent_t *) thinker;
int absSpeed;
polyobj_t *poly;
@@ -324,8 +326,9 @@
//
//==========================================================================
-void T_PolyDoor(polydoor_t * pd)
+void T_PolyDoor(thinker_t *thinker)
{
+ polydoor_t *pd = (polydoor_t *) thinker;
int absSpeed;
polyobj_t *poly;