From 65acafc2bd8fa4818553219b5df785ccb318f119 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 24 Oct 2022 18:00:31 +1100 Subject: [PATCH] - Duke: Move new blood spat code into function for use in RR code as well. --- source/games/duke/src/actors.cpp | 19 +++++++++++++++++++ source/games/duke/src/actors_d.cpp | 10 +--------- source/games/duke/src/actors_r.cpp | 5 +---- source/games/duke/src/funct.h | 1 + 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 102a49300..dfe418a38 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1965,6 +1965,25 @@ void camera(DDukeActor *actor) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void bloodsplats(DDukeActor *actor) +{ + if (actor->temp_data[0] < 7 * 26) + { + auto offset = krandf(1); + auto zadj = (1. / 16.); + auto sadj = (1. / 12.) * REPEAT_SCALE; + actor->spr.pos.Z += zadj + offset * zadj; + actor->spr.scale.Y += sadj + offset * sadj; + actor->temp_data[0]++; + } +} + //--------------------------------------------------------------------------- // // taken out of moveexplosion diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index d84414357..f0b6719d9 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -3002,15 +3002,7 @@ void moveexplosions_d(void) // STATNUM 5 case BLOODSPLAT3: case BLOODSPLAT4: - if (act->temp_data[0] < 7 * 26) - { - auto offset = krandf(1); - auto zadj = (1. / 16.); - auto sadj = (1. / 12.) * REPEAT_SCALE; - act->spr.pos.Z += zadj + offset * zadj; - act->spr.scale.Y += sadj + offset * sadj; - act->temp_data[0]++; - } + bloodsplats(act); continue; case NUKEBUTTON: diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 69ae2c8dc..b4c7de582 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -2904,10 +2904,7 @@ void moveexplosions_r(void) // STATNUM 5 case BLOODSPLAT3: case BLOODSPLAT4: - if (act->temp_data[0] == 7 * 26) continue; - act->spr.pos.Z += 1 / 16. + krandf(1 / 16.); - act->temp_data[0]++; - if ((act->temp_data[0] % 9) == 0) act->spr.scale.Y += (REPEAT_SCALE); + bloodsplats(act); continue; diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 380d1fe7d..b088e41d2 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -54,6 +54,7 @@ void recon(DDukeActor* i, int explosion, int firelaser, int attacksnd, int pains void ooz(DDukeActor* i); void reactor(DDukeActor* i, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT, int REACTORSPARK, int REACTOR2SPARK); void camera(DDukeActor* i); +void bloodsplats(DDukeActor* actor); void forcesphereexplode(DDukeActor* i); void watersplash2(DDukeActor* i); void frameeffect1(DDukeActor* i);