From 61013af910b900939a8ea6ae1ca509134b21b7c1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 3 Nov 2020 18:43:08 +0100 Subject: [PATCH] - fixed three crashes found when testing WW2GI. --- source/games/duke/src/gameexec.cpp | 2 +- source/games/duke/src/player.cpp | 2 +- source/games/duke/src/player_d.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 1ed741824..76e6b7fbd 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1505,7 +1505,7 @@ static bool ifcansee(DDukeActor* actor, int pnum) int ParseState::parse(void) { int j, l, s; - auto g_sp = &g_ac->s; + auto g_sp = g_ac? &g_ac->s : nullptr; if(killit_flag) return 1; diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index e6fb886e1..f04bddd81 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -1117,7 +1117,7 @@ void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith, i spawned->s.y = hity; spawned->s.z = hitz; spawned->s.cstat |= (krand() & 4); - ssp(k, CLIPMASK0); + ssp(spawned, CLIPMASK0); setsprite(spawned, spawned->s.pos); if (s->picnum == OOZFILTER || s->picnum == NEWBEAST) spawned->s.pal = 6; diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index e55f7b714..a747ae413 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -320,7 +320,7 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith auto s = &actor->s; int sect = s->sectnum; int zvel; - short hitsect, hitspr, hitwall, l, j, k; + short hitsect, hitspr, hitwall, l, j, k = -1; int hitx, hity, hitz; if (s->extra >= 0) s->shade = -96;