From 38e0ac1e3f73fb0d46e7f1d7ca97037cfd26b389 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 21 Oct 2020 21:46:39 +0200 Subject: [PATCH] - movefountain and moveflammable. # Conflicts: # source/games/duke/src/actors.cpp --- source/games/duke/src/actors.cpp | 32 ++++++++++++++++-------------- source/games/duke/src/actors_d.cpp | 4 ++-- source/games/duke/src/actors_r.cpp | 4 ++-- source/games/duke/src/funct.h | 4 ++-- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index abb296853..2763f87a5 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -837,26 +837,29 @@ void movecrane(DDukeActor *actor, int crane) // //--------------------------------------------------------------------------- -void movefountain(int i, int fountain) +void movefountain(DDukeActor *actor, int fountain) { - auto t = &hittype[i].temp_data[0]; - auto &pn = sprite[i].picnum; + int* t = &actor->temp_data[0]; int x; if (t[0] > 0) { if (t[0] < 20) { t[0]++; - if (++pn == fountain + 3) pn = fountain + 1; + + actor->s.picnum++; + + if (actor->s.picnum == fountain + 3) + actor->s.picnum = fountain + 1; } else { - findplayer(&sprite[i], &x); + findplayer(actor, &x); if (x > 512) { t[0] = 0; - pn = fountain; + actor->s.picnum = fountain; } else t[0] = 1; } @@ -868,10 +871,9 @@ void movefountain(int i, int fountain) // //--------------------------------------------------------------------------- -void moveflammable(int i, int tire, int box, int pool) +void moveflammable(DDukeActor* actor, int tire, int box, int pool) { - auto spri = &sprite[i]; - auto actor = &hittype[i]; + auto spri = &actor->s; int j; if (actor->temp_data[0] == 1) { @@ -881,15 +883,15 @@ void moveflammable(int i, int tire, int box, int pool) if (!isRR() && spri->picnum == tire && actor->temp_data[1] == 32) { spri->cstat = 0; - j = fi.spawn(i, pool); - sprite[j].shade = 127; + auto spawned = spawn(actor, pool); + spawned->s.shade = 127; } else { if (spri->shade < 64) spri->shade++; else { - deletesprite(i); + deletesprite(actor); return; } } @@ -897,7 +899,7 @@ void moveflammable(int i, int tire, int box, int pool) j = spri->xrepeat - (krand() & 7); if (j < 10) { - deletesprite(i); + deletesprite(actor); return; } @@ -906,14 +908,14 @@ void moveflammable(int i, int tire, int box, int pool) j = spri->yrepeat - (krand() & 7); if (j < 4) { - deletesprite(i); + deletesprite(actor); return; } spri->yrepeat = j; } if (box >= 0 && spri->picnum == box) { - makeitfall(i); + makeitfall(actor); actor->ceilingz = sector[spri->sectnum].ceilingz; } } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index c0da755f2..aefc3e72d 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1507,12 +1507,12 @@ void movestandables_d(void) else if (picnum >= WATERFOUNTAIN && picnum <= WATERFOUNTAIN + 3) { - movefountain(i, WATERFOUNTAIN); + movefountain(&hittype[i], WATERFOUNTAIN); } else if (AFLAMABLE(picnum)) { - moveflammable(i, TIRE, BOX, BLOODPOOL); + moveflammable(&hittype[i], TIRE, BOX, BLOODPOOL); } else if (picnum == TRIPBOMB) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index e5d338628..d1b27f0ae 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1064,12 +1064,12 @@ void movestandables_r(void) else if (picnum >= WATERFOUNTAIN && picnum <= WATERFOUNTAIN + 3) { - movefountain(i, WATERFOUNTAIN); + movefountain(&hittype[i], WATERFOUNTAIN); } else if (AFLAMABLE(picnum)) { - moveflammable(i, TIRE, BOX, BLOODPOOL); + moveflammable(&hittype[i], TIRE, BOX, BLOODPOOL); } diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 148b06e1a..fe2b8781a 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -31,8 +31,8 @@ void moveclouds(double smoothratio); void RANDOMSCRAP(DDukeActor* i); void ms(DDukeActor* i); void movecrane(DDukeActor* i, int crane); -void movefountain(int i, int fountain); -void moveflammable(int i, int tire, int box, int pool); +void movefountain(DDukeActor* i, int fountain); +void moveflammable(DDukeActor* i, int tire, int box, int pool); void detonate(int i, int explosion); void movemasterswitch(int i, int spectype1, int spectype2); void movetrash(int i);