shithub: choc

Download patch

ref: 3f0ef936beacc1688773353b4fab44e4545a6338
parent: 34174041c84540de27f4c3981be7ae5b2ca2c4b6
author: Turo Lamminen <[email protected]>
date: Tue Sep 6 10:26:18 EDT 2022

heretic: Improve type correctness for thinker_t think functions

--- a/src/heretic/doomdef.h
+++ b/src/heretic/doomdef.h
@@ -131,7 +131,7 @@
 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/heretic/p_ceilng.c
+++ b/src/heretic/p_ceilng.c
@@ -34,8 +34,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/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)
--- a/src/heretic/p_floor.c
+++ b/src/heretic/p_floor.c
@@ -179,8 +179,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;
 
     res = T_MovePlane(floor->sector, floor->speed,
--- 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 @@
 //      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 @@
 //      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
--- a/src/heretic/p_local.h
+++ b/src/heretic/p_local.h
@@ -143,8 +143,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);
--- a/src/heretic/p_mobj.c
+++ b/src/heretic/p_mobj.c
@@ -668,8 +668,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;
@@ -739,8 +740,9 @@
 //
 //----------------------------------------------------------------------------
 
-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
--- a/src/heretic/p_plats.c
+++ b/src/heretic/p_plats.c
@@ -30,8 +30,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/heretic/p_spec.h
+++ b/src/heretic/p_spec.h
@@ -143,14 +143,14 @@
 #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 @@
 
 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 @@
 
 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 @@
 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 @@
 
 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);
 
 /*
 ===============================================================================