diff --git a/src/g_demo.c b/src/g_demo.c index 100395a63..187fea6dc 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -1226,11 +1226,16 @@ void G_ConsGhostTic(INT32 playernum) void G_GhostTicker(void) { demoghost *g,*p; - for(g = ghosts, p = NULL; g; g = g->next) + for (g = ghosts, p = NULL; g; g = g->next) { UINT16 ziptic; UINT8 xziptic; + if (g->done) + { + continue; + } + // Pause jhosts that cross until we cross ourself. if (g->linecrossed && !linecrossed) continue; @@ -1276,7 +1281,9 @@ readghosttic: } } else - I_Error("Ghost is not a record attack ghost DXD"); //@TODO lmao don't blow up like this + { + I_Error("Ghost is not a record attack ghost DXD (ziptic = %u)", ziptic); //@TODO lmao don't blow up like this + } ziptic = READUINT8(g->p); } @@ -1532,12 +1539,11 @@ skippedghosttic: if (follow) follow->fuse = TICRATE; #endif + g->done = true; if (p) + { p->next = g->next; - else - ghosts = g->next; - Z_Free(g->skinlist); - Z_Free(g); + } continue; } diff --git a/src/g_demo.h b/src/g_demo.h index 89e7f6fd7..dcfd920fc 100644 --- a/src/g_demo.h +++ b/src/g_demo.h @@ -170,6 +170,7 @@ struct demoghost { UINT16 version; UINT8 numskins; boolean linecrossed; + boolean done; democharlist_t *skinlist; mobj_t oldmo, *mo; struct demoghost *next;