Add a slope thinker queue.
Signed-off-by: Nev3r <apophycens@gmail.com>
This commit is contained in:
parent
83001a5bc9
commit
b3ac590e5e
|
@ -1997,8 +1997,6 @@ static inline void SaveDynamicSlopeThinker(const thinker_t *th, const UINT8 type
|
||||||
{
|
{
|
||||||
const dynplanethink_t* ht = (const void*)th;
|
const dynplanethink_t* ht = (const void*)th;
|
||||||
|
|
||||||
CONS_Printf("Number of slopes: %d\n", slopecount);
|
|
||||||
|
|
||||||
WRITEUINT8(save_p, type);
|
WRITEUINT8(save_p, type);
|
||||||
WRITEUINT8(save_p, ht->type);
|
WRITEUINT8(save_p, ht->type);
|
||||||
WRITEUINT32(save_p, SaveSlope(ht->slope));
|
WRITEUINT32(save_p, SaveSlope(ht->slope));
|
||||||
|
|
|
@ -2912,6 +2912,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
P_ResetDynamicSlopes(fromnetsave);
|
P_ResetDynamicSlopes(fromnetsave);
|
||||||
|
P_LinkSlopeThinkers(); // Spawn slope thinkers just after plane move thinkers to avoid movement/update delays.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
P_LoadThings(loademblems);
|
P_LoadThings(loademblems);
|
||||||
|
|
|
@ -28,6 +28,46 @@
|
||||||
pslope_t *slopelist = NULL;
|
pslope_t *slopelist = NULL;
|
||||||
UINT16 slopecount = 0;
|
UINT16 slopecount = 0;
|
||||||
|
|
||||||
|
thinker_t *dynthinklist;
|
||||||
|
size_t dynthinknum;
|
||||||
|
|
||||||
|
/// Links previously queued thinker list to the main thinker list.
|
||||||
|
void P_LinkSlopeThinkers (void)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
thinker_t *th = dynthinklist;
|
||||||
|
|
||||||
|
CONS_Printf("Number of dynamic thinkers: %d\n", dynthinknum);
|
||||||
|
|
||||||
|
for (i = 0; i < dynthinknum; i++)
|
||||||
|
{
|
||||||
|
thinker_t *next = th->next;
|
||||||
|
P_AddThinker(th);
|
||||||
|
th = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Queues a thinker to a partial linked list to be immediately incorporated later via P_LinkSlopeThinkers().
|
||||||
|
static void P_QueueSlopeThinker (thinker_t* th)
|
||||||
|
{
|
||||||
|
thinker_t* last = dynthinklist;
|
||||||
|
|
||||||
|
// First entry.
|
||||||
|
if (!last)
|
||||||
|
{
|
||||||
|
dynthinklist = th;
|
||||||
|
dynthinknum++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (last->next)
|
||||||
|
last = last->next;
|
||||||
|
|
||||||
|
last->next = th;
|
||||||
|
|
||||||
|
dynthinknum++;
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate line normal
|
// Calculate line normal
|
||||||
void P_CalculateSlopeNormal(pslope_t *slope) {
|
void P_CalculateSlopeNormal(pslope_t *slope) {
|
||||||
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
|
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
|
||||||
|
@ -171,7 +211,7 @@ static inline void P_AddDynSlopeThinker (pslope_t* slope, dynplanetype_t type, l
|
||||||
th->slope = slope;
|
th->slope = slope;
|
||||||
th->type = type;
|
th->type = type;
|
||||||
|
|
||||||
P_AddThinker(&th->thinker);
|
P_QueueSlopeThinker(&th->thinker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -556,6 +596,9 @@ void P_ResetDynamicSlopes(const UINT32 fromsave) {
|
||||||
slopelist = NULL;
|
slopelist = NULL;
|
||||||
slopecount = 0;
|
slopecount = 0;
|
||||||
|
|
||||||
|
dynthinklist = NULL;
|
||||||
|
dynthinknum = 0;
|
||||||
|
|
||||||
// We'll handle copy slopes later, after all the tag lists have been made.
|
// We'll handle copy slopes later, after all the tag lists have been made.
|
||||||
// Yes, this means copied slopes won't affect things' spawning heights. Too bad for you.
|
// Yes, this means copied slopes won't affect things' spawning heights. Too bad for you.
|
||||||
for (i = 0; i < numlines; i++)
|
for (i = 0; i < numlines; i++)
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
extern pslope_t *slopelist;
|
extern pslope_t *slopelist;
|
||||||
extern UINT16 slopecount;
|
extern UINT16 slopecount;
|
||||||
|
|
||||||
|
void P_LinkSlopeThinkers (void);
|
||||||
|
|
||||||
void P_CalculateSlopeNormal(pslope_t *slope);
|
void P_CalculateSlopeNormal(pslope_t *slope);
|
||||||
void P_ResetDynamicSlopes(const UINT32 fromsave);
|
void P_ResetDynamicSlopes(const UINT32 fromsave);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue