From 4b35a30de539c885856c3564d7dba7b786d04ebd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 9 Jun 2021 23:53:05 +0200 Subject: [PATCH] - RR: fixed the bowling lane lights. Tiles had not been made writable. Also renamed a few bowling related things. --- source/games/duke/src/actors_r.cpp | 16 ++++++++-------- source/games/duke/src/bowling.cpp | 22 +++++++++++++--------- source/games/duke/src/namelist_r.h | 6 +++--- source/games/duke/src/sectors_r.cpp | 6 +++--- source/games/duke/src/spawn_r.cpp | 8 ++++---- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 73d1a2e2a..c424e80fa 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -293,7 +293,7 @@ SKIPWALLCHECK: fi.checkhitsprite(act2, actor); } } - else if (spri2->extra >= 0 && act2 != actor && (badguy(act2) || spri2->picnum == QUEBALL || spri2->picnum == RRTILE3440 || spri2->picnum == STRIPEBALL || (spri2->cstat & 257) || spri2->picnum == DUKELYINGDEAD)) + else if (spri2->extra >= 0 && act2 != actor && (badguy(act2) || spri2->picnum == QUEBALL || spri2->picnum == BOWLINGPIN || spri2->picnum == STRIPEBALL || (spri2->cstat & 257) || spri2->picnum == DUKELYINGDEAD)) { if (spri->picnum == MORTER && act2 == Owner) { @@ -350,7 +350,7 @@ SKIPWALLCHECK: } if (spri2->picnum == STATUEFLASH || spri2->picnum == QUEBALL || - spri2->picnum == STRIPEBALL || spri2->picnum == RRTILE3440) + spri2->picnum == STRIPEBALL || spri2->picnum == BOWLINGPIN) fi.checkhitsprite(act2, actor); if (spri2->picnum != RADIUSEXPLOSION && @@ -2441,7 +2441,7 @@ void rr_specialstats() while (auto act = it.Next()) { auto s = act->s; - if (s->picnum == RRTILE280) + if (s->picnum == BOWLINGPINSPOT) if (s->lotag == 100) { auto pst = pinsectorresetup(s->sectnum); @@ -2793,12 +2793,12 @@ static int henstand(DDukeActor *actor) s->xvel--; if (s->xvel < 0) s->xvel = 0; s->cstat = 257; - if (s->picnum == RRTILE3440) + if (s->picnum == BOWLINGPIN) { s->cstat |= 4 & s->xvel; s->cstat |= 8 & s->xvel; if (krand() & 1) - s->picnum = RRTILE3440 + 1; + s->picnum = BOWLINGPIN + 1; } else if (s->picnum == HENSTAND) { @@ -2809,7 +2809,7 @@ static int henstand(DDukeActor *actor) if (!s->xvel) return 2;//deletesprite(actor); still needs to run a script but should not do on a deleted object } - if (s->picnum == RRTILE3440 || (s->picnum == RRTILE3440 + 1 && !s->xvel)) + if (s->picnum == BOWLINGPIN || (s->picnum == BOWLINGPIN + 1 && !s->xvel)) { return 2;//deletesprite(actor); still needs to run a script but should not do on a deleted object } @@ -2983,8 +2983,8 @@ void moveactors_r(void) { S_StopSound(356, nullptr); } - case RRTILE3440: - case RRTILE3440+1: + case BOWLINGPIN: + case BOWLINGPIN+1: case HENSTAND: case HENSTAND+1: { diff --git a/source/games/duke/src/bowling.cpp b/source/games/duke/src/bowling.cpp index 817526a93..31dab54bb 100644 --- a/source/games/duke/src/bowling.cpp +++ b/source/games/duke/src/bowling.cpp @@ -30,6 +30,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "global.h" #include "names_r.h" #include "dukeactor.h" +#include "buildtiles.h" BEGIN_DUKE_NS @@ -43,9 +44,9 @@ void ballreturn(DDukeActor *ball) DukeStatIterator it2(STAT_BOWLING); while (auto act2 = it2.Next()) { - if (act2->s->picnum == RRTILE282 && act->s->hitag == act2->s->hitag) + if (act2->s->picnum == BOWLINGBALLSPOT && act->s->hitag == act2->s->hitag) spawn(act2, BOWLINGBALLSPRITE); - if (act2->s->picnum == RRTILE280 && act->s->hitag == act2->s->hitag && act2->s->lotag == 0) + if (act2->s->picnum == BOWLINGPINSPOT && act->s->hitag == act2->s->hitag && act2->s->lotag == 0) { act2->s->lotag = 100; act2->s->extra++; @@ -94,12 +95,12 @@ short checkpins(short sect) DukeSectIterator it(sect); while (auto a2 = it.Next()) { - if (a2->s->picnum == RRTILE3440) + if (a2->s->picnum == BOWLINGPIN) { pin++; pins[a2->s->lotag] = 1; } - if (a2->s->picnum == RRTILE280) + if (a2->s->picnum == BOWLINGPINSPOT) { tag = a2->s->hitag; } @@ -107,8 +108,9 @@ short checkpins(short sect) if (tag) { - tag += 2024; - tileCopySection(2024, 0, 0, 128, 64, tag, 0, 0); + tag += LANEPICS + 1; + TileFiles.tileMakeWritable(tag); + tileCopySection(LANEPICS + 1, 0, 0, 128, 64, tag, 0, 0); for (i = 0; i < 10; i++) { if (pins[i] == 1) @@ -156,7 +158,7 @@ short checkpins(short sect) y = 24; break; } - tileCopySection(2023, 0, 0, 8, 8, tag, x - 4, y - 10); + tileCopySection(LANEPICS, 0, 0, 8, 8, tag, x - 4, y - 10); } } } @@ -171,7 +173,7 @@ void resetpins(short sect) DukeSectIterator it(sect); while (auto a2 = it.Next()) { - if (a2->s->picnum == RRTILE3440) + if (a2->s->picnum == BOWLINGPIN) deletesprite(a2); } it.Reset(sect); @@ -179,7 +181,7 @@ void resetpins(short sect) { if (a2->s->picnum == 283) { - auto spawned = spawn(a2, RRTILE3440); + auto spawned = spawn(a2, BOWLINGPIN); spawned->s->lotag = a2->s->lotag; if (spawned->s->lotag == 3 || spawned->s->lotag == 5) { @@ -197,6 +199,7 @@ void resetpins(short sect) if (tag) { tag += LANEPICS + 1; + TileFiles.tileMakeWritable(tag); tileCopySection(LANEPICS + 1, 0, 0, 128, 64, tag, 0, 0); for (i = 0; i < 10; i++) { @@ -258,6 +261,7 @@ void resetlanepics(void) pic = tag + 1; if (pic == 0) continue; pic += LANEPICS + 1; + TileFiles.tileMakeWritable(pic); tileCopySection(LANEPICS + 1, 0, 0, 128, 64, pic, 0, 0); for (i = 0; i < 10; i++) { diff --git a/source/games/duke/src/namelist_r.h b/source/games/duke/src/namelist_r.h index 8e7674406..f25032d67 100644 --- a/source/games/duke/src/namelist_r.h +++ b/source/games/duke/src/namelist_r.h @@ -158,9 +158,9 @@ x(WALLLIGHT2, 248) x(WALLLIGHTBUST2, 249) x(LIGHTSWITCH2, 250) x(UFOBEAM, 252) -y(RRTILE280, 280) +y(BOWLINGPINSPOT, 280) y(RRTILE281, 281) -y(RRTILE282, 282) +y(BOWLINGBALLSPOT, 282) y(RRTILE283, 283) y(RRTILE285, 285) y(RRTILE286, 286) @@ -919,7 +919,7 @@ x(BOWLINGBALLH, 3428) x(BOWLINGBALL, 3430) x(BOWLINGBALLSPRITE, 3437) x(POWDERH, 3438) -y(RRTILE3440, 3440) +x(BOWLINGPIN, 3440) x(DEVISTATOR, 3445) x(RPGGUN, 3452) y(RRTILE3462, 3462) diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 4b89feab1..37c938ef1 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -2080,8 +2080,8 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) case STRIPEBALL: case QUEBALL: - case RRTILE3440: - case RRTILE3440 + 1: + case BOWLINGPIN: + case BOWLINGPIN + 1: case HENSTAND: case HENSTAND + 1: if (pspr->picnum == QUEBALL || pspr->picnum == STRIPEBALL) @@ -2092,7 +2092,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) if (S_CheckSoundPlaying(POOLBALLHIT) < 2) S_PlayActorSound(POOLBALLHIT, targ); } - else if (pspr->picnum == RRTILE3440 || pspr->picnum == RRTILE3440 + 1) + else if (pspr->picnum == BOWLINGPIN || pspr->picnum == BOWLINGPIN + 1) { pspr->xvel = (s->xvel >> 1) + (s->xvel >> 2); pspr->ang -= ((s->ang << 1) + krand()) & 64; diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 7a2067c49..dc700f672 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -56,9 +56,9 @@ int spawn_r(int j, int pn) default_case: spawninitdefault(actj, act); break; - case RRTILE280: + case BOWLINGPINSPOT: case RRTILE281: - case RRTILE282: + case BOWLINGBALLSPOT: case RRTILE283: case RRTILE2025: case RRTILE2026: @@ -70,7 +70,7 @@ int spawn_r(int j, int pn) sp->yrepeat = 0; sp->clipdist = 0; sp->extra = 0; - changespritestat(i,105); + changespritestat(i,STAT_BOWLING); break; case RRTILE3410: sp->extra = 0; @@ -535,7 +535,7 @@ int spawn_r(int j, int pn) sp->xvel = 0; changespritestat(i,1); break; - case RRTILE3440: + case BOWLINGPIN: sp->cstat = 257; sp->clipdist = 48; sp->xrepeat = 23;