shithub: choc

Download patch

ref: 22a3794c3848186631d5e5bdd61b9eefcb8563ac
parent: 9bd7fbd74b9e876a461a0100bdc4ae5c08d5a7c9
parent: cfaae7739779fbefc10dd0fd1b73d30e6f6b2c1f
author: Turo Lamminen <turol@users.noreply.github.com>
date: Sat Nov 12 11:04:45 EST 2022

Merge pull request #1545 from turol/clang-15-fix

Fix Hexen type correctness on Clang 15

--- 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;
 
--- a/src/hexen/sv_save.c
+++ b/src/hexen/sv_save.c
@@ -72,9 +72,9 @@
 {
     thinkClass_t tClass;
     think_t thinkerFunc;
-    void (*writeFunc)();
-    void (*readFunc)();
-    void (*restoreFunc) ();
+    void (*writeFunc)(thinker_t *thinker);
+    void (*readFunc)(thinker_t *thinker);
+    void (*restoreFunc)(thinker_t *thinker);
     size_t size;
 } thinkInfo_t;
 
@@ -112,9 +112,9 @@
 static void RemoveAllThinkers(void);
 static int GetMobjNum(mobj_t * mobj);
 static void SetMobjPtr(mobj_t **ptr, unsigned int archiveNum);
-static void RestoreSSThinker(ssthinker_t * sst);
-static void RestorePlatRaise(plat_t * plat);
-static void RestoreMoveCeiling(ceiling_t * ceiling);
+static void RestoreSSThinker(thinker_t *sst);
+static void RestorePlatRaise(thinker_t *thinker);
+static void RestoreMoveCeiling(thinker_t *thinker);
 static void AssertSegment(gameArchiveSegment_t segType);
 static void ClearSaveSlot(int slot);
 static void CopySaveSlot(int sourceSlot, int destSlot);
@@ -1109,8 +1109,10 @@
 // floormove_t
 //
 
-static void StreamIn_floormove_t(floormove_t *str)
+static void StreamIn_floormove_t(thinker_t *thinker)
 {
+    floormove_t *str = (floormove_t *) thinker;
+
     int i;
 
     // thinker_t thinker;
@@ -1166,8 +1168,10 @@
     str->textureChange = SV_ReadByte();
 }
 
-static void StreamOut_floormove_t(floormove_t *str)
+static void StreamOut_floormove_t(thinker_t *thinker)
 {
+    floormove_t *str = (floormove_t *) thinker;
+
     // thinker_t thinker;
     StreamOut_thinker_t(&str->thinker);
 
@@ -1225,8 +1229,10 @@
 // plat_t
 //
 
-static void StreamIn_plat_t(plat_t *str)
+static void StreamIn_plat_t(thinker_t *thinker)
 {
+    plat_t *str = (plat_t *) thinker;
+
     int i;
 
     // thinker_t thinker;
@@ -1267,8 +1273,10 @@
     str->type = SV_ReadLong();
 }
 
-static void StreamOut_plat_t(plat_t *str)
+static void StreamOut_plat_t(thinker_t *thinker)
 {
+    plat_t *str = (plat_t *) thinker;
+
     // thinker_t thinker;
     StreamOut_thinker_t(&str->thinker);
 
@@ -1311,8 +1319,10 @@
 // ceiling_t
 //
 
-static void StreamIn_ceiling_t(ceiling_t *str)
+static void StreamIn_ceiling_t(thinker_t *thinker)
 {
+    ceiling_t *str = (ceiling_t *) thinker;
+
     int i;
 
     // thinker_t thinker;
@@ -1345,8 +1355,10 @@
     str->olddirection = SV_ReadLong();
 }
 
-static void StreamOut_ceiling_t(ceiling_t *str)
+static void StreamOut_ceiling_t(thinker_t *thinker)
 {
+    ceiling_t *str = (ceiling_t *) thinker;
+
     // thinker_t thinker;
     StreamOut_thinker_t(&str->thinker);
 
@@ -1381,8 +1393,10 @@
 // light_t
 //
 
-static void StreamIn_light_t(light_t *str)
+static void StreamIn_light_t(thinker_t *thinker)
 {
+    light_t *str = (light_t *) thinker;
+
     int i;
 
     // thinker_t thinker;
@@ -1411,8 +1425,10 @@
     str->count = SV_ReadLong();
 }
 
-static void StreamOut_light_t(light_t *str)
+static void StreamOut_light_t(thinker_t *thinker)
 {
+    light_t *str = (light_t *) thinker;
+
     // thinker_t thinker;
     StreamOut_thinker_t(&str->thinker);
 
@@ -1443,8 +1459,10 @@
 // vldoor_t
 //
 
-static void StreamIn_vldoor_t(vldoor_t *str)
+static void StreamIn_vldoor_t(thinker_t *thinker)
 {
+    vldoor_t *str = (vldoor_t *) thinker;
+
     int i;
 
     // thinker_t thinker;
@@ -1473,8 +1491,10 @@
     str->topcountdown = SV_ReadLong();
 }
 
-static void StreamOut_vldoor_t(vldoor_t *str)
+static void StreamOut_vldoor_t(thinker_t *thinker)
 {
+    vldoor_t *str = (vldoor_t *) thinker;
+
     // thinker_t thinker;
     StreamOut_thinker_t(&str->thinker);
 
@@ -1505,8 +1525,10 @@
 // phase_t
 //
 
-static void StreamIn_phase_t(phase_t *str)
+static void StreamIn_phase_t(thinker_t *thinker)
 {
+    phase_t *str = (phase_t *) thinker;
+
     int i;
 
     // thinker_t thinker;
@@ -1523,8 +1545,10 @@
     str->base = SV_ReadLong();
 }
 
-static void StreamOut_phase_t(phase_t *str)
+static void StreamOut_phase_t(thinker_t *thinker)
 {
+    phase_t *str = (phase_t *) thinker;
+
     // thinker_t thinker;
     StreamOut_thinker_t(&str->thinker);
 
@@ -1543,8 +1567,10 @@
 // acs_t
 //
 
-static void StreamIn_acs_t(acs_t *str)
+static void StreamIn_acs_t(thinker_t *thinker)
 {
+    acs_t *str = (acs_t *) thinker;
+
     int i;
 
     // thinker_t thinker;
@@ -1596,8 +1622,10 @@
     str->ip = SV_ReadLong();
 }
 
-static void StreamOut_acs_t(acs_t *str)
+static void StreamOut_acs_t(thinker_t *thinker)
 {
+    acs_t *str = (acs_t *) thinker;
+
     int i;
 
     // thinker_t thinker;
@@ -1652,8 +1680,10 @@
 // polyevent_t
 //
 
-static void StreamIn_polyevent_t(polyevent_t *str)
+static void StreamIn_polyevent_t(thinker_t *thinker)
 {
+    polyevent_t *str = (polyevent_t *) thinker;
+
     // thinker_t thinker;
     StreamIn_thinker_t(&str->thinker);
 
@@ -1676,8 +1706,10 @@
     str->ySpeed = SV_ReadLong();
 }
 
-static void StreamOut_polyevent_t(polyevent_t *str)
+static void StreamOut_polyevent_t(thinker_t *thinker)
 {
+    polyevent_t *str = (polyevent_t *) thinker;
+
     // thinker_t thinker;
     StreamOut_thinker_t(&str->thinker);
 
@@ -1705,8 +1737,10 @@
 // pillar_t
 //
 
-static void StreamIn_pillar_t(pillar_t *str)
+static void StreamIn_pillar_t(thinker_t *thinker)
 {
+    pillar_t *str = (pillar_t *) thinker;
+
     int i;
 
     // thinker_t thinker;
@@ -1735,8 +1769,10 @@
     str->crush = SV_ReadLong();
 }
 
-static void StreamOut_pillar_t(pillar_t *str)
+static void StreamOut_pillar_t(thinker_t *thinker)
 {
+    pillar_t *str = (pillar_t *) thinker;
+
     // thinker_t thinker;
     StreamOut_thinker_t(&str->thinker);
 
@@ -1767,8 +1803,10 @@
 // polydoor_t
 //
 
-static void StreamIn_polydoor_t(polydoor_t *str)
+static void StreamIn_polydoor_t(thinker_t *thinker)
 {
+    polydoor_t *str = (polydoor_t *) thinker;
+
     // thinker_t thinker;
     StreamIn_thinker_t(&str->thinker);
 
@@ -1804,8 +1842,10 @@
     str->close = SV_ReadLong();
 }
 
-static void StreamOut_polydoor_t(polydoor_t *str)
+static void StreamOut_polydoor_t(thinker_t *thinker)
 {
+    polydoor_t *str = (polydoor_t *) thinker;
+
     // thinker_t thinker;
     StreamOut_thinker_t(&str->thinker);
 
@@ -1846,8 +1886,10 @@
 // floorWaggle_t
 //
 
-static void StreamIn_floorWaggle_t(floorWaggle_t *str)
+static void StreamIn_floorWaggle_t(thinker_t *thinker)
 {
+    floorWaggle_t *str = (floorWaggle_t *) thinker;
+
     int i;
 
     // thinker_t thinker;
@@ -1882,8 +1924,10 @@
     str->state = SV_ReadLong();
 }
 
-static void StreamOut_floorWaggle_t(floorWaggle_t *str)
+static void StreamOut_floorWaggle_t(thinker_t *thinker)
 {
+    floorWaggle_t *str = (floorWaggle_t *) thinker;
+
     // thinker_t thinker;
     StreamOut_thinker_t(&str->thinker);
 
@@ -2883,8 +2927,9 @@
 //
 //==========================================================================
 
-static void RestoreSSThinker(ssthinker_t *sst)
+static void RestoreSSThinker(thinker_t *thinker)
 {
+    ssthinker_t *sst = (ssthinker_t *) thinker;
     sst->sector->specialdata = sst->thinker.function;
 }
 
@@ -2894,8 +2939,9 @@
 //
 //==========================================================================
 
-static void RestorePlatRaise(plat_t *plat)
+static void RestorePlatRaise(thinker_t *thinker)
 {
+    plat_t *plat = (plat_t *) thinker;
     plat->sector->specialdata = T_PlatRaise;
     P_AddActivePlat(plat);
 }
@@ -2906,8 +2952,9 @@
 //
 //==========================================================================
 
-static void RestoreMoveCeiling(ceiling_t *ceiling)
+static void RestoreMoveCeiling(thinker_t *thinker)
 {
+    ceiling_t *ceiling = (ceiling_t *) thinker;
     ceiling->sector->specialdata = T_MoveCeiling;
     P_AddActiveCeiling(ceiling);
 }