Skip to content

Commit

Permalink
- RR: fixed the bowling lane lights.
Browse files Browse the repository at this point in the history
Tiles had not been made writable.
Also renamed a few bowling related things.
  • Loading branch information
coelckers committed Jun 9, 2021
1 parent 1cea743 commit 4b35a30
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 27 deletions.
16 changes: 8 additions & 8 deletions source/games/duke/src/actors_r.cpp
Expand Up @@ -293,7 +293,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
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)
{
Expand Down Expand Up @@ -350,7 +350,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
}

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 &&
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand All @@ -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
}
Expand Down Expand Up @@ -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:
{
Expand Down
22 changes: 13 additions & 9 deletions source/games/duke/src/bowling.cpp
Expand Up @@ -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

Expand All @@ -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++;
Expand Down Expand Up @@ -94,21 +95,22 @@ 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;
}
}

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)
Expand Down Expand Up @@ -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);
}
}
}
Expand All @@ -171,15 +173,15 @@ 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);
while (auto a2 = it.Next())
{
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)
{
Expand All @@ -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++)
{
Expand Down Expand Up @@ -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++)
{
Expand Down
6 changes: 3 additions & 3 deletions source/games/duke/src/namelist_r.h
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions source/games/duke/src/sectors_r.cpp
Expand Up @@ -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)
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions source/games/duke/src/spawn_r.cpp
Expand Up @@ -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:
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4b35a30

Please sign in to comment.