- moved RR's native actors to a subfolder

This commit is contained in:
Christoph Oelckers 2022-12-31 10:04:45 +01:00
parent 665370c86d
commit 0c5f3a5dcd
16 changed files with 482 additions and 491 deletions

View file

@ -93,18 +93,8 @@ version "4.10"
#include "zscript/games/duke/actors/redneckmisc.zs"
#include "zscript/games/duke/actors/redneckitems.zs"
#include "zscript/games/duke/actors/redneckenemies.zs"
#include "zscript/games/duke/actors/emptybike.zs"
#include "zscript/games/duke/actors/rrteleport.zs"
#include "zscript/games/duke/actors/bowling.zs"
#include "zscript/games/duke/actors/rabbitspawner.zs"
#include "zscript/games/duke/actors/chickenplant.zs"
#include "zscript/games/duke/actors/lumberblade.zs"
#include "zscript/games/duke/actors/rrcactus.zs"
#include "zscript/games/duke/actors/balloons.zs"
#include "zscript/games/duke/actors/gamblingmachine.zs"
#include "zscript/games/duke/actors/pigback.zs"
#include "zscript/games/duke/actors/airplane.zs"
#include "zscript/games/duke/actors/piano.zs"
#include "zscript/games/duke/actors/coot.zs"
#include "zscript/games/duke/actors/billyray.zs"
@ -170,6 +160,19 @@ version "4.10"
#include "zscript/games/duke/actors/dukeenemies/tank.zs"
#include "zscript/games/duke/actors/dukeenemies/turret.zs"
#include "zscript/games/duke/actors/redneckcstuff/airplane.zs"
#include "zscript/games/duke/actors/redneckcstuff/balloons.zs"
#include "zscript/games/duke/actors/redneckcstuff/bowling.zs"
#include "zscript/games/duke/actors/redneckcstuff/chickenplant.zs"
#include "zscript/games/duke/actors/redneckcstuff/emptybike.zs"
#include "zscript/games/duke/actors/redneckcstuff/gamblingmachine.zs"
#include "zscript/games/duke/actors/redneckcstuff/lumberblade.zs"
#include "zscript/games/duke/actors/redneckcstuff/piano.zs"
#include "zscript/games/duke/actors/redneckcstuff/pigback.zs"
#include "zscript/games/duke/actors/redneckcstuff/redneckmisc.zs"
#include "zscript/games/duke/actors/redneckcstuff/rrcactus.zs"
#include "zscript/games/duke/actors/redneckcstuff/rrteleport.zs"
#include "zscript/games/duke/actors/dukeweapons/melee.zs"
#include "zscript/games/duke/actors/dukeweapons/hitscan.zs"
#include "zscript/games/duke/actors/dukeweapons/projectiles.zs"

View file

@ -1,356 +1,3 @@
class RedneckBowlingPin : DukeActor
{
default
{
RedneckBowlingPin.Behavior 0;
spriteset "BOWLINGPIN", "BOWLINGPIN1", "BOWLINGPIN2";
+HITRADIUS_FORCEEFFECT;
+HITRADIUSCHECK;
}
meta int behavior;
property behavior: behavior;
override void Initialize()
{
self.cstat |= CSTAT_SPRITE_BLOCK_ALL;
self.clipdist = 12;
self.scale = (0.359375, 0.359375);
self.ChangeStat(STAT_ZOMBIEACTOR);
}
protected void DoTick(int type)
{
if (self.sector.lotag == 900)
self.vel.X = 0;
if(self.vel.X != 0)
{
self.makeitfall();
CollisionData coll;
self.movesprite_ex((self.angle.ToVector() * self.vel.X, self.vel.Z), CLIPMASK0, coll);
if (coll.type)
{
if (coll.type == kHitWall)
{
double k = coll.hitWall().delta().Angle();
self.angle = k * 2 - self.angle;
}
else if (coll.type == kHitSprite)
{
let hitact = DukeActor(coll.hitActor());
// avoid checkhitsprite here. The way this was handled was just wrong on all accounts
self.collide(hitact);
if (hitact is "RedneckHen")
{
let ns = hitact.spawn("RedneckHenstand");
hitact.scale = (0,0);
hitact.ChangeStat(STAT_MISC);
if (ns)
{
ns.vel.X = 2;
ns.lotag = 40;
ns.angle = self.angle;
}
}
}
}
self.vel.X -= 1/16.;
if(self.vel.X < 0) self.vel.X = 0;
self.cstat = CSTAT_SPRITE_BLOCK_ALL;
if (type < 2 && self.vel.X > 0)
{
self.cstat |= CSTAT_SPRITE_XFLIP & int(self.vel.X * 16);
self.cstat |= CSTAT_SPRITE_YFLIP & int(self.vel.X * 16);
if (random(0, 1)) self.setSpritesetImage(1);
}
if (type < 2 && self.vel.X == 0)
{
if (type == 0 && self.spritesetindex == 1) self.setSpritesetImage(2);
return;
}
}
else if (self.sector.lotag == 900 && type != 2)
{
self.Destroy();
}
else
{
if (type == 0 && self.spritesetindex == 1) self.setSpritesetImage(2);
}
}
override void Tick()
{
DoTick(0);
}
virtual void collide(DukeActor targa)
{
let targ = RedneckBowlingPin(targa);
if (!targ) return;
if (targ.behavior == 0)
{
self.vel.X *= 0.75;
self.angle -= targ.angle * 2 + frandom(0, 11.25);
targ.angle += frandom(0, 22.5 / 8);
targ.PlayActorSound("BOWLPIN");
}
else if (targ.behavior == 1)
{
self.vel.X *= 0.75;
self.angle -= targ.angle * 2 + frandom(0, 22.5 / 8);
targ.angle += frandom(0, 22.5 / 8);
targ.PlayActorSound("BOWLPIN");
}
}
override void onHit(DukeActor hitter)
{
if (random(0, 3))
{
self.vel.X = 10.25;
self.angle = hitter.angle;
}
}
}
// chickens on the bowling lane...
class RedneckHenstand : RedneckBowlingPin
{
default
{
spriteset "HENSTAND", "HENSTAND1";
RedneckBowlingPin.Behavior 1;
-HITRADIUS_FORCEEFFECT;
-HITRADIUSCHECK;
}
override void Initialize()
{
Super.Initialize();
self.scale.Y = 234375;
}
override void Tick()
{
self.lotag--;
if (self.lotag == 0)
{
self.spawn("RedneckHen");
self.scale = (0,0);
self.ChangeStat(STAT_MISC);
return;
}
DoTick(1);
}
}
class RedneckBowlingBall : RedneckBowlingPin
{
default
{
pic "BOWLINGBALL";
RedneckBowlingPin.Behavior 2;
-HITRADIUS_FORCEEFFECT;
-HITRADIUSCHECK;
}
override void Initialize()
{
self.clipdist = 16;
self.scale = (0.171875, 0.140625);
self.ChangeStat(STAT_ACTOR);
}
override void Tick()
{
if (self.vel.X != 0)
{
if(!Duke.CheckSoundPlaying("BOWLLOOP"))
self.PlayActorSound("BOWLLOOP");
}
else
{
self.spawn("RedneckBowlingBallSprite");
self.Destroy();
return;
}
if (self.sector.lotag == 900)
{
self.StopSound("BOWLLOOP");
}
DoTick(2);
if (self.sector.lotag == 900)
{
self.ballreturn();
self.Destroy();
return;
}
}
private void ballreturn()
{
DukeStatIterator it;
for (let act1 = it.First(STAT_BOWLING); act1; act1 = it.Next())
{
if (act1.getClassName() == 'RedneckBowlingSectorLink' && self.sector == act1.sector)
{
DukeStatIterator it2;
for (let act2 = it2.First(STAT_BOWLING); act2; act2 = it2.Next())
{
if (act2.getClassName() == 'RedneckBowlingBallSpot' && act1.hitag == act2.hitag)
{
act2.spawn("RedneckBowlingBallSprite");
}
if (act2.getClassName() == 'RedneckBowlingPinController' && act1.hitag == act2.hitag && act2.lotag == 0)
{
let sec = act2.sector;
act2.lotag = 100;
act2.extra++;
int j = dlevel.getanimationindex(dlevel.anim_ceilingz, sec);
if (j == -1)
dlevel.setanimation(sec, dlevel.anim_ceilingz, sec, sec.floorz, 0.25);
}
}
}
}
}
override void onHit(DukeActor hitter)
{
}
override void collide(DukeActor targ)
{
targ.vel.X = self.vel.X * 0.75;
if (random(0, 32767) & 16) targ.angle -= 22.5 / 8;
targ.PlayActorSound("BOWLPIN");
}
override bool ShootThis(DukeActor actor, DukePlayer plr, Vector3 spos, double sang) const
{
let j = actor.spawn(self.GetClassName());
if (j)
{
j.vel.X = 250 / 16.;
j.angle = self.angle;
j.pos.Z -= 15;
}
return true;
}
}
class RedneckBowlingController : DukeActor
{
override void Initialize()
{
self.cstat = CSTAT_SPRITE_INVISIBLE;
self.clipdist = 0;
self.extra = 0;
self.ChangeStat(STAT_BOWLING);
}
}
class RedneckBowlingPinController : RedneckBowlingController
{
override void Tick()
{
if (self.lotag == 100)
{
let pst = pinsectorresetup();
if (pst)
{
self.lotag = 0;
if (self.extra == 1)
{
pst = checkpins();
if (!pst)
{
self.extra = 2;
}
}
if (self.extra == 2)
{
self.extra = 0;
resetpins();
}
}
}
}
int pinsectorresetup()
{
let sec = self.sector;
int j = dlevel.getanimationindex(dlevel.anim_ceilingz, sec);
if (j == -1)
{
double z = sec.nextsectorneighborz(sec.ceilingz, sectortype.Find_CeilingUp | sectortype.Find_Safe).ceilingz;
dlevel.setanimation(sec, dlevel.anim_ceilingz, sec, z, 0.25);
return 1;
}
return 0;
}
int checkpins()
{
int pins = 0;
int pin = 0;
DukeSectIterator it;
for (let a2 = it.First(self.sector); a2; a2 = it.Next())
{
if (a2.GetClassName() == 'RedneckBowlingPin' && a2.spritesetindex == 0)
{
pin++;
pins |= 1 << a2.lotag;
}
}
Duke.updatepindisplay(self.hitag, pins);
return pin;
}
void resetpins()
{
int i, tag = 0;
DukeSectIterator it;
for (let a2 = it.First(self.sector); a2; a2 = it.Next())
{
if (a2.GetClassName() == 'RedneckBowlingPin')
a2.Destroy();
}
for (let a2 = it.First(self.sector); a2; a2 = it.Next())
{
if (a2.GetClassName() == 'RedneckBowlingPinSpot')
{
let spawned = a2.spawn('RedneckBowlingPin');
if (spawned)
{
spawned.lotag = a2.lotag;
spawned.clipdist = 12; // random formula here was bogus and always produced 48.
spawned.angle -= 22.5 * 0.125 * (((random(0, 32767) & 32) - (random(0, 32767) & 64)) >> 5);
}
}
}
Duke.updatepindisplay(self.hitag, 0xffff);
}
}
class RedneckBowlingSectorLink : RedneckBowlingController
{ }
class RedneckBowlingBallSpot : RedneckBowlingController
{ }
class RedneckBowlingPinSpot : RedneckBowlingController
{ }
class RedneckBowlingBallsprite : DukeActor
{

View file

@ -1,14 +0,0 @@
class DukeNaturalLightning : DukeActor
{
default
{
pic "NATURALLIGHTNING";
+FULLBRIGHT;
}
override void Initialize()
{
self.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
self.cstat |= CSTAT_SPRITE_INVISIBLE;
}
}

View file

@ -0,0 +1,354 @@
class RedneckBowlingPin : DukeActor
{
default
{
RedneckBowlingPin.Behavior 0;
spriteset "BOWLINGPIN", "BOWLINGPIN1", "BOWLINGPIN2";
+HITRADIUS_FORCEEFFECT;
+HITRADIUSCHECK;
}
meta int behavior;
property behavior: behavior;
override void Initialize()
{
self.cstat |= CSTAT_SPRITE_BLOCK_ALL;
self.clipdist = 12;
self.scale = (0.359375, 0.359375);
self.ChangeStat(STAT_ZOMBIEACTOR);
}
protected void DoTick(int type)
{
if (self.sector.lotag == 900)
self.vel.X = 0;
if(self.vel.X != 0)
{
self.makeitfall();
CollisionData coll;
self.movesprite_ex((self.angle.ToVector() * self.vel.X, self.vel.Z), CLIPMASK0, coll);
if (coll.type)
{
if (coll.type == kHitWall)
{
double k = coll.hitWall().delta().Angle();
self.angle = k * 2 - self.angle;
}
else if (coll.type == kHitSprite)
{
let hitact = DukeActor(coll.hitActor());
// avoid checkhitsprite here. The way this was handled was just wrong on all accounts
self.collide(hitact);
if (hitact is "RedneckHen")
{
let ns = hitact.spawn("RedneckHenstand");
hitact.scale = (0,0);
hitact.ChangeStat(STAT_MISC);
if (ns)
{
ns.vel.X = 2;
ns.lotag = 40;
ns.angle = self.angle;
}
}
}
}
self.vel.X -= 1/16.;
if(self.vel.X < 0) self.vel.X = 0;
self.cstat = CSTAT_SPRITE_BLOCK_ALL;
if (type < 2 && self.vel.X > 0)
{
self.cstat |= CSTAT_SPRITE_XFLIP & int(self.vel.X * 16);
self.cstat |= CSTAT_SPRITE_YFLIP & int(self.vel.X * 16);
if (random(0, 1)) self.setSpritesetImage(1);
}
if (type < 2 && self.vel.X == 0)
{
if (type == 0 && self.spritesetindex == 1) self.setSpritesetImage(2);
return;
}
}
else if (self.sector.lotag == 900 && type != 2)
{
self.Destroy();
}
else
{
if (type == 0 && self.spritesetindex == 1) self.setSpritesetImage(2);
}
}
override void Tick()
{
DoTick(0);
}
virtual void collide(DukeActor targa)
{
let targ = RedneckBowlingPin(targa);
if (!targ) return;
if (targ.behavior == 0)
{
self.vel.X *= 0.75;
self.angle -= targ.angle * 2 + frandom(0, 11.25);
targ.angle += frandom(0, 22.5 / 8);
targ.PlayActorSound("BOWLPIN");
}
else if (targ.behavior == 1)
{
self.vel.X *= 0.75;
self.angle -= targ.angle * 2 + frandom(0, 22.5 / 8);
targ.angle += frandom(0, 22.5 / 8);
targ.PlayActorSound("BOWLPIN");
}
}
override void onHit(DukeActor hitter)
{
if (random(0, 3))
{
self.vel.X = 10.25;
self.angle = hitter.angle;
}
}
}
// chickens on the bowling lane...
class RedneckHenstand : RedneckBowlingPin
{
default
{
spriteset "HENSTAND", "HENSTAND1";
RedneckBowlingPin.Behavior 1;
-HITRADIUS_FORCEEFFECT;
-HITRADIUSCHECK;
}
override void Initialize()
{
Super.Initialize();
self.scale.Y = 234375;
}
override void Tick()
{
self.lotag--;
if (self.lotag == 0)
{
self.spawn("RedneckHen");
self.scale = (0,0);
self.ChangeStat(STAT_MISC);
return;
}
DoTick(1);
}
}
class RedneckBowlingBall : RedneckBowlingPin
{
default
{
pic "BOWLINGBALL";
RedneckBowlingPin.Behavior 2;
-HITRADIUS_FORCEEFFECT;
-HITRADIUSCHECK;
}
override void Initialize()
{
self.clipdist = 16;
self.scale = (0.171875, 0.140625);
self.ChangeStat(STAT_ACTOR);
}
override void Tick()
{
if (self.vel.X != 0)
{
if(!Duke.CheckSoundPlaying("BOWLLOOP"))
self.PlayActorSound("BOWLLOOP");
}
else
{
self.spawn("RedneckBowlingBallSprite");
self.Destroy();
return;
}
if (self.sector.lotag == 900)
{
self.StopSound("BOWLLOOP");
}
DoTick(2);
if (self.sector.lotag == 900)
{
self.ballreturn();
self.Destroy();
return;
}
}
private void ballreturn()
{
DukeStatIterator it;
for (let act1 = it.First(STAT_BOWLING); act1; act1 = it.Next())
{
if (act1.getClassName() == 'RedneckBowlingSectorLink' && self.sector == act1.sector)
{
DukeStatIterator it2;
for (let act2 = it2.First(STAT_BOWLING); act2; act2 = it2.Next())
{
if (act2.getClassName() == 'RedneckBowlingBallSpot' && act1.hitag == act2.hitag)
{
act2.spawn("RedneckBowlingBallSprite");
}
if (act2.getClassName() == 'RedneckBowlingPinController' && act1.hitag == act2.hitag && act2.lotag == 0)
{
let sec = act2.sector;
act2.lotag = 100;
act2.extra++;
int j = dlevel.getanimationindex(dlevel.anim_ceilingz, sec);
if (j == -1)
dlevel.setanimation(sec, dlevel.anim_ceilingz, sec, sec.floorz, 0.25);
}
}
}
}
}
override void onHit(DukeActor hitter)
{
}
override void collide(DukeActor targ)
{
targ.vel.X = self.vel.X * 0.75;
if (random(0, 32767) & 16) targ.angle -= 22.5 / 8;
targ.PlayActorSound("BOWLPIN");
}
override bool ShootThis(DukeActor actor, DukePlayer plr, Vector3 spos, double sang) const
{
let j = actor.spawn(self.GetClassName());
if (j)
{
j.vel.X = 250 / 16.;
j.angle = self.angle;
j.pos.Z -= 15;
}
return true;
}
}
class RedneckBowlingController : DukeActor
{
override void Initialize()
{
self.cstat = CSTAT_SPRITE_INVISIBLE;
self.clipdist = 0;
self.extra = 0;
self.ChangeStat(STAT_BOWLING);
}
}
class RedneckBowlingPinController : RedneckBowlingController
{
override void Tick()
{
if (self.lotag == 100)
{
let pst = pinsectorresetup();
if (pst)
{
self.lotag = 0;
if (self.extra == 1)
{
pst = checkpins();
if (!pst)
{
self.extra = 2;
}
}
if (self.extra == 2)
{
self.extra = 0;
resetpins();
}
}
}
}
int pinsectorresetup()
{
let sec = self.sector;
int j = dlevel.getanimationindex(dlevel.anim_ceilingz, sec);
if (j == -1)
{
double z = sec.nextsectorneighborz(sec.ceilingz, sectortype.Find_CeilingUp | sectortype.Find_Safe).ceilingz;
dlevel.setanimation(sec, dlevel.anim_ceilingz, sec, z, 0.25);
return 1;
}
return 0;
}
int checkpins()
{
int pins = 0;
int pin = 0;
DukeSectIterator it;
for (let a2 = it.First(self.sector); a2; a2 = it.Next())
{
if (a2.GetClassName() == 'RedneckBowlingPin' && a2.spritesetindex == 0)
{
pin++;
pins |= 1 << a2.lotag;
}
}
Duke.updatepindisplay(self.hitag, pins);
return pin;
}
void resetpins()
{
int i, tag = 0;
DukeSectIterator it;
for (let a2 = it.First(self.sector); a2; a2 = it.Next())
{
if (a2.GetClassName() == 'RedneckBowlingPin')
a2.Destroy();
}
for (let a2 = it.First(self.sector); a2; a2 = it.Next())
{
if (a2.GetClassName() == 'RedneckBowlingPinSpot')
{
let spawned = a2.spawn('RedneckBowlingPin');
if (spawned)
{
spawned.lotag = a2.lotag;
spawned.clipdist = 12; // random formula here was bogus and always produced 48.
spawned.angle -= 22.5 * 0.125 * (((random(0, 32767) & 32) - (random(0, 32767) & 64)) >> 5);
}
}
}
Duke.updatepindisplay(self.hitag, 0xffff);
}
}
class RedneckBowlingSectorLink : RedneckBowlingController
{ }
class RedneckBowlingBallSpot : RedneckBowlingController
{ }
class RedneckBowlingPinSpot : RedneckBowlingController
{ }

View file

@ -0,0 +1,115 @@
class RedneckBell : DukeActor
{
default
{
pic "BIGBELL";
}
override void OnHit(DukeActor proj)
{
self.PlayActorSound("BELL");
}
}
class RedneckMusicNotes : DukeActor
{
default
{
pic "MUSICNOTES";
}
override void Initialize()
{
self.lotag = -1;
self.clipdist = 0;
}
override bool OnUse(DukePlayer user)
{
if (!self.CheckSoundPlaying("PIANO_P3"))
self.PlayActorSound("PIANO_P3");
return true;
}
}
class RedneckJoe9000 : DukeActor
{
default
{
pic "JOE9000";
}
override void Initialize()
{
self.lotag = 1;
self.clipdist = 0;
}
override bool OnUse(DukePlayer user)
{
if (ud.multimode < 2)
{
if (ud.joe9000 != 0)
{
if (!self.CheckSoundPlaying("JOE9000A") && !self.CheckSoundPlaying("JOE9000B") && !self.CheckSoundPlaying("JOE9000C"))
{
if (random(0, 1))
self.PlayActorSound("JOE9000B");
else
self.PlayActorSound("JOE9000C");
}
}
else
{
self.PlayActorSound("JOE9000A");
ud.joe9000 = 1;
}
}
return true;
}
}
class RedneckBellSwitch : DukeActor
{
default
{
spriteset "BELLSWITCH", "BELLSWITCHON", "BELLSWITCHOFF";
}
override bool TriggerSwitch(DukePlayer activator)
{
if (self.spritesetindex == 1 || dlevel.check_activator_motion(lotag)) return true;
self.detail = 132;
self.setSpriteSetImage(1);
self.changeStat(STAT_MISC); // needs to be made to call Tick
return 2; // 2 lets the switch code perform the trigger action without messing around with this actor.
}
override void Tick()
{
if (self.detail > 0)
{
self.detail--;
if (self.detail == 0)
self.SetSpritesetImage(2); // stop animating
}
}
}
class RedneckLetsBowl : DukeActor
{
default
{
spriteset "LETSBOWL", "LETSBOWL1";
}
override bool animate(tspritetype t)
{
t.SetspritePic(self, (PlayClock >> 2) & 1);
return true;
}
}

View file

@ -1,118 +1,4 @@
class RedneckBell : DukeActor
{
default
{
pic "BIGBELL";
}
override void OnHit(DukeActor proj)
{
self.PlayActorSound("BELL");
}
}
class RedneckMusicNotes : DukeActor
{
default
{
pic "MUSICNOTES";
}
override void Initialize()
{
self.lotag = -1;
self.clipdist = 0;
}
override bool OnUse(DukePlayer user)
{
if (!self.CheckSoundPlaying("PIANO_P3"))
self.PlayActorSound("PIANO_P3");
return true;
}
}
class RedneckJoe9000 : DukeActor
{
default
{
pic "JOE9000";
}
override void Initialize()
{
self.lotag = 1;
self.clipdist = 0;
}
override bool OnUse(DukePlayer user)
{
if (ud.multimode < 2)
{
if (ud.joe9000 != 0)
{
if (!self.CheckSoundPlaying("JOE9000A") && !self.CheckSoundPlaying("JOE9000B") && !self.CheckSoundPlaying("JOE9000C"))
{
if (random(0, 1))
self.PlayActorSound("JOE9000B");
else
self.PlayActorSound("JOE9000C");
}
}
else
{
self.PlayActorSound("JOE9000A");
ud.joe9000 = 1;
}
}
return true;
}
}
class RedneckBellSwitch : DukeActor
{
default
{
spriteset "BELLSWITCH", "BELLSWITCHON", "BELLSWITCHOFF";
}
override bool TriggerSwitch(DukePlayer activator)
{
if (self.spritesetindex == 1 || dlevel.check_activator_motion(lotag)) return true;
self.detail = 132;
self.setSpriteSetImage(1);
self.changeStat(STAT_MISC); // needs to be made to call Tick
return 2; // 2 lets the switch code perform the trigger action without messing around with this actor.
}
override void Tick()
{
if (self.detail > 0)
{
self.detail--;
if (self.detail == 0)
self.SetSpritesetImage(2); // stop animating
}
}
}
class RedneckLetsBowl : DukeActor
{
default
{
spriteset "LETSBOWL", "LETSBOWL1";
}
override bool animate(tspritetype t)
{
t.SetspritePic(self, (PlayClock >> 2) & 1);
return true;
}
}
class RedneckWacoWindow : DukeActor
{
default