From ab59504be0e5682e72f2353a9498e957f8ccdc9c Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 29 Sep 2018 20:28:27 +0100 Subject: [PATCH] Experimental: Making the ghetto waypoints we have right now their own mobj list in order to make them slightly less bullshit --- src/info.c | 2 +- src/k_kart.c | 11 +---------- src/p_mobj.c | 3 +++ src/p_mobj.h | 2 ++ src/p_saveg.c | 12 ++++++++---- src/p_tick.c | 1 + 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/info.c b/src/info.c index b3e4e7c7..c0fb24fb 100644 --- a/src/info.c +++ b/src/info.c @@ -4089,7 +4089,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 4, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY, // flags + MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_SCENERY, // flags S_NULL // raisestate }, diff --git a/src/k_kart.c b/src/k_kart.c index ed91616b..db317803 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4235,7 +4235,6 @@ static void K_KartUpdatePosition(player_t *player) fixed_t oldposition = player->kartstuff[k_position]; fixed_t i, ppcd, pncd, ipcd, incd; fixed_t pmo, imo; - thinker_t *th; mobj_t *mo; if (player->spectator || !player->mo) @@ -4260,16 +4259,8 @@ static void K_KartUpdatePosition(player_t *player) player->kartstuff[k_nextcheck] = players[i].kartstuff[k_nextcheck] = 0; // This checks every thing on the map, and looks for MT_BOSS3WAYPOINT (the thing we're using for checkpoint wp's, for now) - for (th = thinkercap.next; th != &thinkercap; th = th->next) + for (mo = waypointcap; mo != NULL; mo = mo->tracer) { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj at all, shoo - continue; - - mo = (mobj_t *)th; - - if (mo->type != MT_BOSS3WAYPOINT) // TODO: Change to 'MT_WAYPOINT'? - continue; - pmo = P_AproxDistance(P_AproxDistance( mo->x - player->mo->x, mo->y - player->mo->y), mo->z - player->mo->z) / FRACUNIT; diff --git a/src/p_mobj.c b/src/p_mobj.c index 0f065733..d22d5cb6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -48,6 +48,7 @@ actioncache_t actioncachehead; static mobj_t *overlaycap = NULL; static mobj_t *shadowcap = NULL; +mobj_t *waypointcap = NULL; void P_InitCachedActions(void) { @@ -11076,6 +11077,8 @@ ML_NOCLIMB : Direction not controllable else if (i == MT_BOSS3WAYPOINT) // SRB2kart 120217 - Used to store checkpoint num { mobj->health = mthing->angle; + P_SetTarget(&mobj->tracer, waypointcap); + P_SetTarget(&waypointcap, mobj); } else if (i == MT_SPIKE) { diff --git a/src/p_mobj.h b/src/p_mobj.h index 34d1f644..df6e7642 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -429,6 +429,8 @@ typedef struct actioncache_s extern actioncache_t actioncachehead; +extern mobj_t *waypointcap; + void P_InitCachedActions(void); void P_RunCachedActions(void); void P_AddCachedAction(mobj_t *mobj, INT32 statenum); diff --git a/src/p_saveg.c b/src/p_saveg.c index d9f43000..ffcc8789 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -945,11 +945,10 @@ typedef enum MD2_EXTVAL2 = 1<<6, MD2_HNEXT = 1<<7, MD2_HPREV = 1<<8, + MD2_COLORIZED = 1<<9, + MD2_WAYPOINTCAP = 1<<10 #ifdef ESLOPE - MD2_SLOPE = 1<<9, - MD2_COLORIZED = 1<<10 -#else - MD2_COLORIZED = 1<<9 + , MD2_SLOPE = 1<<11 #endif } mobj_diff2_t; @@ -1146,6 +1145,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) #endif if (mobj->colorized) diff2 |= MD2_COLORIZED; + if (mobj == waypointcap) + diff2 |= MD2_WAYPOINTCAP; if (diff2 != 0) diff |= MD_MORE; @@ -2165,6 +2166,9 @@ static void LoadMobjThinker(actionf_p1 thinker) P_AddThinker(&mobj->thinker); + if (diff2 & MD2_WAYPOINTCAP) + P_SetTarget(&waypointcap, mobj); + mobj->info = (mobjinfo_t *)next; // temporarily, set when leave this function } diff --git a/src/p_tick.c b/src/p_tick.c index 3a55353d..3c5ed0b9 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -180,6 +180,7 @@ void Command_CountMobjs_f(void) void P_InitThinkers(void) { thinkercap.prev = thinkercap.next = &thinkercap; + waypointcap = NULL; } //