diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 58b8f75e4..18c99c741 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -245,10 +245,9 @@ void insertspriteq(DDukeActor* const actor) { if (spriteq[spriteqloc] != nullptr) { - // Why is this not deleted here? - // Also todo: Make list size a CVAR. + // todo: Make list size a CVAR. spriteq[spriteqloc]->s->xrepeat = 0; - // deletesprite(spriteq[spriteqloc]); + deletesprite(spriteq[spriteqloc]); } spriteq[spriteqloc] = actor; spriteqloc = (spriteqloc + 1) % spriteqamount; @@ -779,7 +778,8 @@ void movecrane(DDukeActor *actor, int crane) else if (t[0] == 9) t[0] = 0; - SetActor(cpt.poleactor, { spri->x, spri->y, spri->z - (34 << 8) }); + if (cpt.poleactor) + SetActor(cpt.poleactor, { spri->x, spri->y, spri->z - (34 << 8) }); auto Owner = actor->GetOwner(); if (Owner != nullptr || actor->IsActiveCrane()) diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 7048f5150..ad3abf644 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -248,14 +248,14 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in continue; case VIEWSCREEN: case VIEWSCREEN2: - if (camsprite != nullptr && h->GetHitOwner()->temp_data[0] == 1) + if (camsprite != nullptr && h->GetHitOwner() && h->GetHitOwner()->temp_data[0] == 1) { t->picnum = STATIC; t->cstat |= (rand() & 12); t->xrepeat += 8; t->yrepeat += 8; } - else if (camsprite == h->GetHitOwner()) + else if (camsprite && camsprite == h->GetHitOwner()) { t->picnum = TILE_VIEWSCR; } diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 73818dccf..b1ec56fc5 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -113,7 +113,7 @@ public: { UnloadSound(schan->SoundID); currentCommentarySound = 0; - currentCommentarySprite->s->picnum = DEVELOPERCOMMENTARY; + if (currentCommentarySprite) currentCommentarySprite->s->picnum = DEVELOPERCOMMENTARY; I_SetRelativeVolume(1.0f); UnmuteSounds(); } diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 67195ab01..dacd5cbc0 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -500,6 +500,7 @@ void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE) apt.x = sp->x; apt.y = sp->y; apt.z = sp->z; + apt.poleactor = nullptr; DukeStatIterator it(STAT_DEFAULT); while (auto act = it.Next())