mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-30 21:20:54 +00:00
Merge branch 'polyobj-waypoint-thinker-optimise' into 'next'
Polyobj waypoint thinker optimise See merge request STJr/SRB2!586
This commit is contained in:
commit
b5df2d5c3f
3 changed files with 25 additions and 2 deletions
|
@ -1825,6 +1825,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
if (po->thinker == NULL)
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
/*
|
||||
// Find out target first.
|
||||
// We redo this each tic to make savegame compatibility easier.
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
|
@ -1843,6 +1844,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
target = th->target;
|
||||
|
||||
if (!target)
|
||||
{
|
||||
|
@ -2025,6 +2029,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
|
||||
target = waypoint;
|
||||
th->pointnum = target->health;
|
||||
// Set the mobj as your target! -- Monster Iestyn 27/12/19
|
||||
P_SetTarget(&th->target, target);
|
||||
|
||||
// calculate MOMX/MOMY/MOMZ for next waypoint
|
||||
// change slope
|
||||
|
@ -2651,6 +2657,9 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
|||
|
||||
// Set pointnum
|
||||
th->pointnum = target->health;
|
||||
th->target = NULL; // set to NULL first so the below doesn't go wrong
|
||||
// Set the mobj as your target! -- Monster Iestyn 27/12/19
|
||||
P_SetTarget(&th->target, target);
|
||||
|
||||
// We don't deal with the mirror crap here, we'll
|
||||
// handle that in the T_Thinker function.
|
||||
|
|
|
@ -161,6 +161,8 @@ typedef struct polywaypoint_s
|
|||
fixed_t diffx;
|
||||
fixed_t diffy;
|
||||
fixed_t diffz;
|
||||
|
||||
mobj_t *target; // next waypoint mobj
|
||||
} polywaypoint_t;
|
||||
|
||||
typedef struct polyslidedoor_s
|
||||
|
|
|
@ -2055,6 +2055,7 @@ static void SavePolywaypointThinker(const thinker_t *th, UINT8 type)
|
|||
WRITEFIXED(save_p, ht->diffx);
|
||||
WRITEFIXED(save_p, ht->diffy);
|
||||
WRITEFIXED(save_p, ht->diffz);
|
||||
WRITEUINT32(save_p, SaveMobjnum(ht->target));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -3244,6 +3245,7 @@ static inline thinker_t* LoadPolywaypointThinker(actionf_p1 thinker)
|
|||
ht->diffx = READFIXED(save_p);
|
||||
ht->diffy = READFIXED(save_p);
|
||||
ht->diffz = READFIXED(save_p);
|
||||
ht->target = LoadMobj(READUINT32(save_p));
|
||||
return &ht->thinker;
|
||||
}
|
||||
|
||||
|
@ -3538,6 +3540,7 @@ static void P_NetUnArchiveThinkers(void)
|
|||
|
||||
case tc_polywaypoint:
|
||||
th = LoadPolywaypointThinker((actionf_p1)T_PolyObjWaypoint);
|
||||
restoreNum = true;
|
||||
break;
|
||||
|
||||
case tc_polyslidedoor:
|
||||
|
@ -3599,9 +3602,9 @@ static void P_NetUnArchiveThinkers(void)
|
|||
if (restoreNum)
|
||||
{
|
||||
executor_t *delay = NULL;
|
||||
polywaypoint_t *polywp = NULL;
|
||||
UINT32 mobjnum;
|
||||
for (currentthinker = thlist[THINK_MAIN].next; currentthinker != &thlist[THINK_MAIN];
|
||||
currentthinker = currentthinker->next)
|
||||
for (currentthinker = thlist[THINK_MAIN].next; currentthinker != &thlist[THINK_MAIN]; currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1 != (actionf_p1)T_ExecutorDelay)
|
||||
continue;
|
||||
|
@ -3610,6 +3613,15 @@ static void P_NetUnArchiveThinkers(void)
|
|||
continue;
|
||||
delay->caller = P_FindNewPosition(mobjnum);
|
||||
}
|
||||
for (currentthinker = thlist[THINK_POLYOBJ].next; currentthinker != &thlist[THINK_POLYOBJ]; currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1 != (actionf_p1)T_PolyObjWaypoint)
|
||||
continue;
|
||||
polywp = (void *)currentthinker;
|
||||
if (!(mobjnum = (UINT32)(size_t)polywp->target))
|
||||
continue;
|
||||
polywp->target = P_FindNewPosition(mobjnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue