commit 3f0ef936beacc1688773353b4fab44e4545a6338
Author: Turo Lamminen <turol@iki.fi>
AuthorDate: Tue Sep 6 14:26:18 2022 +0300
Commit: Turo Lamminen <turol@iki.fi>
CommitDate: Tue Nov 1 18:03:43 2022 +0200
heretic: Improve type correctness for thinker_t think functions
---
src/heretic/doomdef.h | 2 +-
src/heretic/p_ceilng.c | 3 ++-
src/heretic/p_doors.c | 3 ++-
src/heretic/p_floor.c | 3 ++-
src/heretic/p_lights.c | 12 +++++++++---
src/heretic/p_local.h | 4 ++--
src/heretic/p_mobj.c | 6 ++++--
src/heretic/p_plats.c | 3 ++-
src/heretic/p_spec.h | 14 +++++++-------
9 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/src/heretic/doomdef.h b/src/heretic/doomdef.h
index 21b00ea0..01c34198 100644
--- a/src/heretic/doomdef.h
+++ b/src/heretic/doomdef.h
@@ -131,7 +131,7 @@ typedef enum
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
{
diff --git a/src/heretic/p_ceilng.c b/src/heretic/p_ceilng.c
index cc1c88a3..c37d3973 100644
--- a/src/heretic/p_ceilng.c
+++ b/src/heretic/p_ceilng.c
@@ -34,8 +34,9 @@ ceiling_t *activeceilings[MAXCEILINGS];
// 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)
diff --git a/src/heretic/p_doors.c b/src/heretic/p_doors.c
index fcae83a1..3cd40373 100644
--- a/src/heretic/p_doors.c
+++ b/src/heretic/p_doors.c
@@ -35,8 +35,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)
diff --git a/src/heretic/p_floor.c b/src/heretic/p_floor.c
index 9c307bf6..d95a157a 100644
--- a/src/heretic/p_floor.c
+++ b/src/heretic/p_floor.c
@@ -179,8 +179,9 @@ result_e T_MovePlane(sector_t * sector, fixed_t speed,
// 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;
res = T_MovePlane(floor->sector, floor->speed,
diff --git a/src/heretic/p_lights.c b/src/heretic/p_lights.c
index 3011d479..407041b3 100644
--- a/src/heretic/p_lights.c
+++ b/src/heretic/p_lights.c
@@ -34,8 +34,10 @@
// that spawn thinkers
//
//==================================================================
-void T_LightFlash(lightflash_t * flash)
+void T_LightFlash(thinker_t *thinker)
{
+ lightflash_t *flash = (lightflash_t *) thinker;
+
if (--flash->count)
return;
@@ -91,8 +93,10 @@ void P_SpawnLightFlash(sector_t * sector)
// After the map has been loaded, scan each sector for specials that spawn thinkers
//
//==================================================================
-void T_StrobeFlash(strobe_t * flash)
+void T_StrobeFlash(thinker_t *thinker)
{
+ strobe_t *flash = (strobe_t *) thinker;
+
if (--flash->count)
return;
@@ -235,8 +239,10 @@ void EV_LightTurnOn(line_t * line, int bright)
// Spawn glowing light
//
//==================================================================
-void T_Glow(glow_t * g)
+void T_Glow(thinker_t *thinker)
{
+ glow_t *g = (glow_t *) thinker;
+
switch (g->direction)
{
case -1: // DOWN
diff --git a/src/heretic/p_local.h b/src/heretic/p_local.h
index fe125c1a..6137d3d0 100644
--- a/src/heretic/p_local.h
+++ b/src/heretic/p_local.h
@@ -143,8 +143,8 @@ boolean P_SetMobjStateNF(mobj_t * mobj, statenum_t state);
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);
diff --git a/src/heretic/p_mobj.c b/src/heretic/p_mobj.c
index 14a4f238..363dabe4 100644
--- a/src/heretic/p_mobj.c
+++ b/src/heretic/p_mobj.c
@@ -668,8 +668,9 @@ void P_NightmareRespawn(mobj_t * mobj)
//
//----------------------------------------------------------------------------
-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;
@@ -739,8 +740,9 @@ void P_BlasterMobjThinker(mobj_t * mobj)
//
//----------------------------------------------------------------------------
-void P_MobjThinker(mobj_t * mobj)
+void P_MobjThinker(thinker_t *thinker)
{
+ mobj_t *mobj = (mobj_t *) thinker;
mobj_t *onmo;
// Handle X and Y momentums
diff --git a/src/heretic/p_plats.c b/src/heretic/p_plats.c
index 664b0cd0..861a9a51 100644
--- a/src/heretic/p_plats.c
+++ b/src/heretic/p_plats.c
@@ -30,8 +30,9 @@ plat_t *activeplats[MAXPLATS];
// 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)
diff --git a/src/heretic/p_spec.h b/src/heretic/p_spec.h
index b26244af..7d78e4d2 100644
--- a/src/heretic/p_spec.h
+++ b/src/heretic/p_spec.h
@@ -143,14 +143,14 @@ typedef struct
#define FASTDARK 15
#define SLOWDARK 35
-void T_LightFlash(lightflash_t * flash);
+void T_LightFlash(thinker_t *thinker);
void P_SpawnLightFlash(sector_t * sector);
-void T_StrobeFlash(strobe_t * flash);
+void T_StrobeFlash(thinker_t *thinker);
void P_SpawnStrobeFlash(sector_t * sector, int fastOrSlow, int inSync);
void EV_StartLightStrobing(line_t * line);
void EV_TurnTagLightsOff(line_t * line);
void EV_LightTurnOn(line_t * line, int bright);
-void T_Glow(glow_t * g);
+void T_Glow(thinker_t *thinker);
void P_SpawnGlowingLight(sector_t * sector);
/*
@@ -237,7 +237,7 @@ typedef struct
extern plat_t *activeplats[MAXPLATS];
-void T_PlatRaise(plat_t * plat);
+void T_PlatRaise(thinker_t *thinker);
int EV_DoPlat(line_t * line, plattype_e type, int amount);
void P_AddActivePlat(plat_t * plat);
void P_RemoveActivePlat(plat_t * plat);
@@ -278,7 +278,7 @@ typedef struct
void EV_VerticalDoor(line_t * line, mobj_t * thing);
int EV_DoDoor(line_t * line, vldoor_e type, fixed_t speed);
-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);
@@ -318,7 +318,7 @@ typedef struct
extern ceiling_t *activeceilings[MAXCEILINGS];
int EV_DoCeiling(line_t * line, 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);
@@ -376,7 +376,7 @@ result_e T_MovePlane(sector_t * sector, fixed_t speed,
int EV_BuildStairs(line_t * line, fixed_t stepDelta);
int EV_DoFloor(line_t * line, floor_e floortype);
-void T_MoveFloor(floormove_t * floor);
+void T_MoveFloor(thinker_t *thinker);
/*
===============================================================================