Skip to content

Commit

Permalink
- chickenplant scriptified.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers authored and mjr4077au committed Nov 26, 2022
1 parent 71df589 commit becafec
Show file tree
Hide file tree
Showing 18 changed files with 559 additions and 286 deletions.
178 changes: 4 additions & 174 deletions source/games/duke/src/actors_r.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ int movesprite_ex_r(DDukeActor* actor, const DVector3& change, unsigned int clip

void lotsoffeathers_r(DDukeActor *actor, int n)
{
lotsofstuff(actor, n, MONEY);
lotsofstuff(actor, n, FEATHER);
}


Expand Down Expand Up @@ -715,7 +715,7 @@ static void chickenarrow(DDukeActor* actor)
if (spawned) spawned->spr.pos.Z += 1;
if ((krand() & 15) == 2)
{
spawn(actor, MONEY);
spawn(actor, FEATHER);
}
}
DDukeActor* ts = actor->seek_actor;
Expand Down Expand Up @@ -1917,91 +1917,9 @@ void rr_specialstats()
}
}

if (chickenplant)
if (ud.chickenplant)
{
it.Reset(STAT_CHICKENPLANT);
while (auto act = it.Next())
{
switch (act->spr.picnum)
{
case CHICKENASPAWN:
act->spr.lotag--;
if (act->spr.lotag < 0)
{
spawn(act, CHICKENA)->spr.angle = act->spr.angle;
act->spr.lotag = 128;
}
break;
case CHICKENCSPAWN:
act->spr.lotag--;
if (act->spr.lotag < 0)
{
spawn(act, CHICKENC)->spr.angle = act->spr.angle;
act->spr.lotag = 256;
}
break;
case FEATHERSPAWN:
act->spr.lotag--;
if (act->spr.lotag < 0)
{
lotsoffeathers_r(act, (krand() & 3) + 4);
act->spr.lotag = 84;
}
break;
case CHICKENHEADSPAWN:
act->spr.lotag--;
if (act->spr.lotag < 0)
{
auto j = spawn(act, CHICKENHEAD);
act->spr.lotag = 96;
if (j && !isRRRA()) S_PlayActorSound(472, j);
}
break;
case LOAFSPAWN:
act->spr.lotag--;
if (act->spr.lotag < 0)
{
spawn(act, CHICKENLOAF)->spr.angle = act->spr.angle;
act->spr.lotag = 448;
}
break;
case NUGGETSPAWN:
act->spr.lotag--;
if (act->spr.lotag < 0)
{
spawn(act, CHICKENNUGGET)->spr.angle = act->spr.angle;
act->spr.lotag = 64;
}
break;
case ROASTSPAWN:
act->spr.lotag--;
if (act->spr.lotag < 0)
{
spawn(act, ROASTEDCHICKEN)->spr.angle = act->spr.angle;
act->spr.lotag = 512;
}
break;
case BONELESSSPAWN:
act->spr.lotag--;
if (act->spr.lotag < 0)
{
spawn(act, BONELESSCHICKEN)->spr.angle = act->spr.angle;
act->spr.lotag = 224;
}
break;
case JIBSSPAWN:
act->spr.lotag--;
if (act->spr.lotag < 0)
{
fi.guts(act, JIBS1, 1, myconnectindex);
fi.guts(act, JIBS2, 1, myconnectindex);
fi.guts(act, JIBS3, 1, myconnectindex);
fi.guts(act, JIBS4, 1, myconnectindex);
act->spr.lotag = 256;
}
break;
}
}
tickstat(STAT_CHICKENPLANT);
}

it.Reset(STAT_BOWLING);
Expand Down Expand Up @@ -2423,94 +2341,6 @@ void moveactors_r(void)
case RAT:
if (!rat(act, !isRRRA())) continue;
break;
case CHICKENA:
case CHICKENB:
case CHICKENC:
if (!chickenplant)
{
act->Destroy();
continue;
}
if (sectp->lotag == 903)
makeitfall(act);
movesprite_ex(act, DVector3(act->spr.angle.ToVector() * act->vel.X, act->vel.Z), CLIPMASK0, coll);
switch (sectp->lotag)
{
case 901:
act->spr.picnum = CHICKENB;
break;
case 902:
act->spr.picnum = CHICKENC;
break;
case 903:
if (act->spr.pos.Z >= sectp->floorz - 8)
{
act->Destroy();
continue;
}
break;
case 904:
act->Destroy();
continue;
break;
}
if (coll.type > kHitSector)
{
act->Destroy();
continue;
}
break;

case CHICKENLOAF:
case CHICKENNUGGET:
case ROASTEDCHICKEN:
case BONELESSCHICKEN:
if (!chickenplant)
{
act->Destroy();
continue;
}
makeitfall(act);
movesprite_ex(act, DVector3(act->spr.angle.ToVector() * act->vel.X, act->vel.Z), CLIPMASK0, coll);
if (coll.type > kHitSector)
{
act->Destroy();
continue;
}
if (sectp->lotag == 903)
{
if (act->spr.pos.Z >= sectp->floorz - 4)
{
act->Destroy();
continue;
}
}
else if (sectp->lotag == 904)
{
act->Destroy();
continue;
}
break;

case CHICKENHEAD:
if (!chickenplant)
{
act->Destroy();
continue;
}
makeitfall(act);
movesprite_ex(act, DVector3(act->spr.angle.ToVector() * act->vel.X, act->vel.Z), CLIPMASK0, coll);
if (act->spr.pos.Z >= sectp->floorz - 8)
{
if (sectp->lotag == 1)
{
auto j = spawn(act, WATERSPLASH2);
if (j) j->spr.pos.Z = j->sector()->floorz;
}
act->Destroy();
continue;
}
break;
case BOWLINGBALL:
if (act->vel.X != 0)
{
Expand Down
4 changes: 2 additions & 2 deletions source/games/duke/src/animatesprites_r.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case FOOTPRINTS4:
if (t->pal == 6)
t->shade = -127;
case MONEY:
case MONEY + 1:
case FEATHER:
case FEATHER + 1:
break;
case POWDERKEG:
continue;
Expand Down
4 changes: 2 additions & 2 deletions source/games/duke/src/flags_r.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ void initactorflags_r()
TECHSWITCH + 1,
DIPSWITCH3,
DIPSWITCH3 + 1,
NUKEBUTTON,
NUKEBUTTON + 1 });
CHICKENPLANTBUTTON,
CHICKENPLANTBUTTON + 1 });
if (isRRRA()) settileflag(TFLAG_WALLSWITCH, {
MULTISWITCH2,
MULTISWITCH2 + 1,
Expand Down
1 change: 0 additions & 1 deletion source/games/duke/src/global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ int earthquaketime;
int global_random; // readonly - one single global per-frame random value. Ugh...

// Redneck Rampage
int chickenplant; // readonly - used to trigger some special behavior if a special item is found in a map.
int thunderon; // readonly - enables thunder effect in RR if true.
int ufospawn; // UFO spawn flag
int ufocnt; // UFO spawn count
Expand Down
8 changes: 3 additions & 5 deletions source/games/duke/src/namelist_r.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ x(LIGHTSWITCH, 86)
x(SPACEDOORSWITCH, 88)
x(SPACELIGHTSWITCH, 90)
x(FRANKENSTINESWITCH, 92)
x(NUKEBUTTON, 94)
x(CHICKENPLANTBUTTON, 94)
x(MULTISWITCH, 98)
x(DOORTILE1, 102)
x(DOORTILE2, 103)
Expand Down Expand Up @@ -171,8 +171,8 @@ x(ROASTSPAWN, 291)
x(BONELESSSPAWN, 292)
x(JIBSSPAWN, 293)
x(KEGHOLDER, 295) // that's what the text on the sprite says. It doesn't seem to do anything.
y(RRTELEPORT, 296)
y(RRTELEPORTDEST, 297)
x(RRTELEPORT, 296)
x(RRTELEPORTDEST, 297)
x(CDPLAYER, 370)
y(RRTILE380, 380)
x(BONUSPIC01, 403)
Expand Down Expand Up @@ -406,7 +406,6 @@ x(NUKEBARREL, 1304)
x(NUKEBARRELDENTED, 1305)
x(NUKEBARRELLEAKED, 1306)
x(CANWITHSOMETHING, 1309)
x(MONEY, 1310)
x(FEATHER, 1310)
x(BANNER, 1313)
x(EXPLODINGBARREL, 1315)
Expand Down Expand Up @@ -884,7 +883,6 @@ y(RRTILE3115, 3115)
y(RRTILE3116, 3116)
y(RRTILE3117, 3117)
x(CHICKENLOAF, 3120)
y(RRTILE3121, 3121)
x(CHICKENNUGGET, 3122)
x(ROASTEDCHICKEN, 3123)
x(BONELESSCHICKEN, 3124)
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/premap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ void prelevel_common(int g)
geocnt = 0;
ambienttags.Clear();
thunderon = 0;
chickenplant = 0;
ud.chickenplant = 0;
WindTime = 0;
WindDir = nullAngle;
fakebubba_spawn = 0;
Expand Down
8 changes: 6 additions & 2 deletions source/games/duke/src/premap_r.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,10 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
{
ps[0].Exit = ac->spr.pos.XY();
}
else if (ac->spr.picnum == CHICKENPLANTBUTTON)
{
ud.chickenplant = 1;
}
else
{
premapcontroller(ac);
Expand Down Expand Up @@ -624,8 +628,8 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
case POWERSWITCH1 + 1:
case LOCKSWITCH1 + 1:
case POWERSWITCH2 + 1:
case NUKEBUTTON:
case NUKEBUTTON + 1:
case CHICKENPLANTBUTTON:
case CHICKENPLANTBUTTON + 1:

for (j = 0; j < lotaglist; j++)
if (ac->spr.lotag == lotags[j])
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/savegame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
("numplayersprites", numplayersprites)
("spriteqloc", spriteqloc)
("animates", animates)
("chickenplant", ud.chickenplant)

("numclouds", numclouds)
("cloudx", cloudx)
Expand All @@ -393,7 +394,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
.Array("mirrorsector", mirrorsector, mirrorcnt)
.Array("mirrorwall", mirrorwall, mirrorcnt)
("wupass", wupass)
("chickenplant", chickenplant)
("thunderon", thunderon)
("ufospawn", ufospawn)
("ufocnt", ufocnt)
Expand Down
16 changes: 8 additions & 8 deletions source/games/duke/src/sectors_r.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
case LOCKSWITCH1 + 1:
case POWERSWITCH2:
case POWERSWITCH2 + 1:
case NUKEBUTTON:
case NUKEBUTTON + 1:
case CHICKENPLANTBUTTON:
case CHICKENPLANTBUTTON + 1:
case RRTILE2214:
case RRTILE2697:
case RRTILE2697 + 1:
Expand Down Expand Up @@ -510,7 +510,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
case PULLSWITCH:
case DIPSWITCH2:
case DIPSWITCH3:
case NUKEBUTTON:
case CHICKENPLANTBUTTON:
case RRTILE2697:
case RRTILE2707:
if (other->spr.picnum == DIPSWITCH3)
Expand All @@ -532,8 +532,8 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
other->spr.picnum++;
break;
}
if (other->spr.picnum == NUKEBUTTON)
chickenplant = 0;
if (other->spr.picnum == CHICKENPLANTBUTTON)
ud.chickenplant = 0;
if (other->spr.picnum == RRTILE8660)
{
BellTime = 132;
Expand All @@ -554,11 +554,11 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
case FRANKENSTINESWITCH + 1:
case DIPSWITCH2 + 1:
case DIPSWITCH3 + 1:
case NUKEBUTTON + 1:
case CHICKENPLANTBUTTON + 1:
case RRTILE2697 + 1:
case RRTILE2707 + 1:
if (other->spr.picnum == NUKEBUTTON + 1)
chickenplant = 1;
if (other->spr.picnum == CHICKENPLANTBUTTON + 1)
ud.chickenplant = 1;
if (other->spr.hitag != 999)
other->spr.picnum--;
break;
Expand Down
Loading

0 comments on commit becafec

Please sign in to comment.