From acda4b7799ddb2497bd523063ccb333b48461156 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 24 Oct 2020 19:44:10 +0200 Subject: [PATCH] - fixed Duke's RPG explosion Fixes #146 --- source/games/duke/src/actors.cpp | 11 ++++++++--- source/games/duke/src/actors_d.cpp | 2 +- source/games/duke/src/actors_r.cpp | 6 +++--- source/games/duke/src/funct.h | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index a8342be53..814cc2149 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1404,7 +1404,7 @@ void movetongue(int i, int tongue, int jaw) // //--------------------------------------------------------------------------- -void rpgexplode(int i, int j, const vec3_t &pos, int EXPLOSION2, int newextra, int playsound) +void rpgexplode(int i, int j, const vec3_t &pos, int EXPLOSION2, int EXPLOSION2BOT, int newextra, int playsound) { auto act = &hittype[i]; auto s = &act->s; @@ -1418,8 +1418,13 @@ void rpgexplode(int i, int j, const vec3_t &pos, int EXPLOSION2, int newextra, i } else if ((j & kHitTypeMask) == kHitSector) { - k->s.cstat |= 8; - k->s.z += (48 << 8); + if (s->zvel > 0 && EXPLOSION2BOT >= 0) + fi.spawn(i, EXPLOSION2BOT); + else + { + k->s.cstat |= 8; + k->s.z += (48 << 8); + } } if (newextra > 0) s->extra = newextra; S_PlayActorSound(playsound, i); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 03a91b408..d5797b367 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1944,7 +1944,7 @@ static void weaponcommon_d(int i) if (s->picnum == RPG) { // j is only needed for the hit type mask. - rpgexplode(i, j, oldpos, EXPLOSION2, -1, RPG_EXPLODE); + rpgexplode(i, j, oldpos, EXPLOSION2, EXPLOSION2BOT, -1, RPG_EXPLODE); } else if (s->picnum == SHRINKSPARK) { diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 84d65ef74..afa766bc6 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1528,9 +1528,9 @@ static void weaponcommon_r(int i) if (s->picnum != SPIT) { - if (s->picnum == RPG) rpgexplode(i, j, oldpos, EXPLOSION2, -1, RPG_EXPLODE); - else if (isRRRA() && s->picnum == RPG2) rpgexplode(i, j, oldpos, EXPLOSION2, 150, 247); - else if (isRRRA() && s->picnum == RRTILE1790) rpgexplode(i, j, oldpos, EXPLOSION2, 160, RPG_EXPLODE); + if (s->picnum == RPG) rpgexplode(i, j, oldpos, EXPLOSION2, -1, -1, RPG_EXPLODE); + else if (isRRRA() && s->picnum == RPG2) rpgexplode(i, j, oldpos, EXPLOSION2, -1, 150, 247); + else if (isRRRA() && s->picnum == RRTILE1790) rpgexplode(i, j, oldpos, EXPLOSION2, -1, 160, RPG_EXPLODE); else if (s->picnum != FREEZEBLAST && s->picnum != FIRELASER && s->picnum != SHRINKSPARK) { k = fi.spawn(i, 1441); diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index c74167dbc..14cc0043d 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -42,7 +42,7 @@ void movetouchplate(int i, int plate); void movecanwithsomething(int i); void bounce(int i); void movetongue(int i, int tongue, int jaw); -void rpgexplode(int i, int j, const vec3_t& pos, int EXPLOSION2, int newextra, int playsound); +void rpgexplode(int i, int j, const vec3_t& pos, int EXPLOSION2, int EXPLOSION2BOT, int newextra, int playsound); void moveooz(int i, int seenine, int seeninedead, int ooz, int explosion); void lotsofstuff(DDukeActor* s, int n, int spawntype); bool respawnmarker(int i, int yellow, int green);