- converted the two last non-CON-based active items - RRRA's empty bike and boat.

This commit is contained in:
Christoph Oelckers 2022-12-03 18:43:15 +01:00
parent fd26f7fd2d
commit 6fb263d61b
12 changed files with 121 additions and 108 deletions

View file

@ -1072,22 +1072,6 @@ void moveactors_r(void)
} }
else switch(act->spr.picnum) else switch(act->spr.picnum)
{ {
case EMPTYBIKE:
if (!isRRRA()) break;
makeitfall(act);
getglobalz(act);
if (sectp->lotag == 1)
{
SetActor(act, DVector3(act->spr.pos.X, act->spr.pos.Y, act->floorz + 16));
}
break;
case EMPTYBOAT:
if (!isRRRA()) break;
makeitfall(act);
getglobalz(act);
break;
case POWDERKEG: case POWDERKEG:
if (!isRRRA() || (sectp->lotag != ST_1_ABOVE_WATER && sectp->lotag != ST_160_FLOOR_TELEPORT)) if (!isRRRA() || (sectp->lotag != ST_1_ABOVE_WATER && sectp->lotag != ST_160_FLOOR_TELEPORT))
if (act->vel.X != 0) if (act->vel.X != 0)

View file

@ -158,30 +158,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case CRYSTALAMMO: case CRYSTALAMMO:
t->shade = int(BobVal(PlayClock << 4) * 16); t->shade = int(BobVal(PlayClock << 4) * 16);
break; break;
case EMPTYBIKE:
if (!isRRRA()) goto default_case;
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation2(h->spr.Angles.Yaw, kang);
if (k > 6)
{
k = 12 - k;
t->cstat |= CSTAT_SPRITE_XFLIP;
}
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
t->picnum = EMPTYBIKE + k;
break;
case EMPTYBOAT:
if (!isRRRA()) goto default_case;
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation2(h->spr.Angles.Yaw, kang);
if (k > 6)
{
k = 12 - k;
t->cstat |= CSTAT_SPRITE_XFLIP;
}
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
t->picnum = EMPTYBOAT + k;
break;
case APLAYER: case APLAYER:
p = h->PlayerIndex(); p = h->PlayerIndex();
@ -367,7 +343,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
} }
[[fallthrough]]; [[fallthrough]];
default: default:
default_case:
if (sectp->floorpal) if (sectp->floorpal)
copyfloorpal(t, sectp); copyfloorpal(t, sectp);

View file

@ -177,12 +177,12 @@ const char* GameInterface::GenericCheat(int player, int cheat)
return cheatMonsters(); return cheatMonsters();
case CHT_BIKE: case CHT_BIKE:
OnMotorcycle(&ps[player], nullptr); OnMotorcycle(&ps[player]);
ps[player].ammo_amount[MOTORCYCLE_WEAPON] = gs.max_ammo_amount[MOTORCYCLE_WEAPON]; ps[player].ammo_amount[MOTORCYCLE_WEAPON] = gs.max_ammo_amount[MOTORCYCLE_WEAPON];
return quoteMgr.GetQuote(QUOTE_ON_BIKE); return quoteMgr.GetQuote(QUOTE_ON_BIKE);
case CHT_BOAT: case CHT_BOAT:
OnBoat(&ps[player], 0); OnBoat(&ps[player]);
ps[player].ammo_amount[BOAT_WEAPON] = gs.max_ammo_amount[BOAT_WEAPON]; ps[player].ammo_amount[BOAT_WEAPON] = gs.max_ammo_amount[BOAT_WEAPON];
return quoteMgr.GetQuote(QUOTE_ON_BOAT); return quoteMgr.GetQuote(QUOTE_ON_BOAT);

View file

@ -189,9 +189,9 @@ void cacheit_d();
void cacheit_r(); void cacheit_r();
void FTA(int q, player_struct* p); void FTA(int q, player_struct* p);
void OnMotorcycle(player_struct *pl, DDukeActor* snum); void OnMotorcycle(player_struct *pl);
void OffMotorcycle(player_struct *pl); void OffMotorcycle(player_struct *pl);
void OnBoat(player_struct *pl, DDukeActor* snum); void OnBoat(player_struct *pl);
void OffBoat(player_struct *pl); void OffBoat(player_struct *pl);
void cameratext(DDukeActor* i); void cameratext(DDukeActor* i);

View file

@ -3871,17 +3871,10 @@ HORIZONLY:
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void OnMotorcycle(player_struct *p, DDukeActor* motosprite) void OnMotorcycle(player_struct *p)
{ {
if (!p->OnMotorcycle && !(p->cursector->lotag == 2)) if (!p->OnMotorcycle && p->cursector->lotag != ST_2_UNDERWATER)
{ {
if (motosprite)
{
p->GetActor()->spr.pos.XY() = motosprite->spr.pos.XY();
p->Angles.setYaw(motosprite->spr.Angles.Yaw, true);
p->ammo_amount[MOTORCYCLE_WEAPON] = motosprite->saved_ammo;
motosprite->Destroy();
}
p->over_shoulder_on = 0; p->over_shoulder_on = 0;
p->OnMotorcycle = 1; p->OnMotorcycle = 1;
p->last_full_weapon = p->curr_weapon; p->last_full_weapon = p->curr_weapon;
@ -3945,17 +3938,10 @@ void OffMotorcycle(player_struct *p)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void OnBoat(player_struct *p, DDukeActor* boat) void OnBoat(player_struct *p)
{ {
if (!p->OnBoat) if (!p->OnBoat)
{ {
if (boat)
{
p->GetActor()->spr.pos.XY() = boat->spr.pos.XY();
p->Angles.setYaw(boat->spr.Angles.Yaw, true);
p->ammo_amount[BOAT_WEAPON] = boat->saved_ammo;
boat->Destroy();
}
p->over_shoulder_on = 0; p->over_shoulder_on = 0;
p->OnBoat = 1; p->OnBoat = 1;
p->last_full_weapon = p->curr_weapon; p->last_full_weapon = p->curr_weapon;

View file

@ -1592,19 +1592,6 @@ void checksectors_r(int snum)
if (CallOnUse(neartagsprite, p)) if (CallOnUse(neartagsprite, p))
return; return;
} }
else
switch (neartagsprite->spr.picnum)
{
case EMPTYBIKE:
if (!isRRRA()) return;
OnMotorcycle(p, neartagsprite);
return;
case EMPTYBOAT:
if (!isRRRA()) return;
OnBoat(p, neartagsprite);
return;
break;
}
} }
if (!PlayerInput(snum, SB_OPEN)) return; if (!PlayerInput(snum, SB_OPEN)) return;

View file

@ -661,37 +661,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
spawneffector(act, actors); spawneffector(act, actors);
break; break;
case EMPTYBIKE:
if (!isRRRA()) goto default_case;
if (ud.multimode < 2 && act->spr.pal == 1)
{
act->spr.scale = DVector2(0, 0);
break;
}
act->spr.pal = 0;
act->spr.scale = DVector2(0.28125, 0.28125);
act->setClipDistFromTile();
act->saved_ammo = 100;
act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
act->spr.lotag = 1;
ChangeActorStat(act, STAT_ACTOR);
break;
case EMPTYBOAT:
if (!isRRRA()) goto default_case;
if (ud.multimode < 2 && act->spr.pal == 1)
{
act->spr.scale = DVector2(0, 0);
break;
}
act->spr.pal = 0;
act->spr.scale = DVector2(0.5, 0.5);
act->setClipDistFromTile();
act->saved_ammo = 20;
act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
act->spr.lotag = 1;
ChangeActorStat(act, STAT_ACTOR);
break;
case RUBBERCAN: case RUBBERCAN:
act->spr.extra = 0; act->spr.extra = 0;
[[fallthrough]]; [[fallthrough]];

View file

@ -1136,7 +1136,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, setbobpos, DukePlayer_setbobpos)
return 0; return 0;
} }
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, StartMotorcycle, OnMotorcycle)
{
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
OnMotorcycle(self);
return 0;
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, StartBoat, OnBoat)
{
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
OnBoat(self);
return 0;
}
static DDukeActor* duke_firstStat(DukeStatIterator* it, int statnum) static DDukeActor* duke_firstStat(DukeStatIterator* it, int statnum)

View file

@ -51,6 +51,8 @@ spawnclasses
8679 = RedneckSnakeRiverSign 8679 = RedneckSnakeRiverSign
8448 = RedneckMusicNotes 8448 = RedneckMusicNotes
8704 = RedneckJoe9000 8704 = RedneckJoe9000
7220 = RedneckEmptyBike
7233 = RedneckEmptyBoat
7636 = DukeGenericDestructible, "OLDPHOTO0", "OLDPHOTO0BROKE", "VENT_BUST" 7636 = DukeGenericDestructible, "OLDPHOTO0", "OLDPHOTO0BROKE", "VENT_BUST"
7638 = DukeGenericDestructible, "OLDPHOTO1", "OLDPHOTO1BROKE", "VENT_BUST" 7638 = DukeGenericDestructible, "OLDPHOTO1", "OLDPHOTO1BROKE", "VENT_BUST"
@ -66,7 +68,7 @@ spawnclasses
7876 = DukeGenericDestructible, "STREETSIGN1", "STREETSIGN1BROKE", "VENT_BUST" 7876 = DukeGenericDestructible, "STREETSIGN1", "STREETSIGN1BROKE", "VENT_BUST"
7881 = DukeGenericDestructible, "DANGERSIGN", "DANGERSIGNBROKE", "VENT_BUST" 7881 = DukeGenericDestructible, "DANGERSIGN", "DANGERSIGNBROKE", "VENT_BUST"
7883 = DukeGenericDestructible, "RADIATIONSIGN", "RADIATIONSIGNBROKE", "VENT_BUST" 7883 = DukeGenericDestructible, "RADIATIONSIGN", "RADIATIONSIGNBROKE", "VENT_BUST"
7879 = DukeGenericDamagingDestructible, "DIABLOHWAY", "DIABLOHWAYBROKE", "SIGNHIT" 7879 = DukeGenericDestructible, "DIABLOHWAY", "DIABLOHWAYBROKE", "SIGNHIT", damaging
7694 = DukeGenericDestructible, "BANKELPESO", "BANKELPESOBROKE", "WOODBREK" 7694 = DukeGenericDestructible, "BANKELPESO", "BANKELPESOBROKE", "WOODBREK"
7700 = DukeGenericDestructible, "SHERIFFSIGN", "SHERIFFSIGNBROKE", "WOODBREK" 7700 = DukeGenericDestructible, "SHERIFFSIGN", "SHERIFFSIGNBROKE", "WOODBREK"
7702 = DukeGenericDestructible, "STORESIGN", "STORESIGNBROKE", "WOODBREK" 7702 = DukeGenericDestructible, "STORESIGN", "STORESIGNBROKE", "WOODBREK"

View file

@ -102,6 +102,7 @@ version "4.10"
#include "zscript/games/duke/actors/redneckmisc.zs" #include "zscript/games/duke/actors/redneckmisc.zs"
#include "zscript/games/duke/actors/emptybike.zs"
#include "zscript/games/duke/actors/rrteleport.zs" #include "zscript/games/duke/actors/rrteleport.zs"
#include "zscript/games/duke/actors/bowling.zs" #include "zscript/games/duke/actors/bowling.zs"
#include "zscript/games/duke/actors/rabbitspawner.zs" #include "zscript/games/duke/actors/rabbitspawner.zs"

View file

@ -0,0 +1,95 @@
class RedneckEmptyBike : DukeActor
{
default
{
pic "EMPTYBIKE";
scaleX 0.28125;
scaleY 0.28125;
lotag 1;
statnum STAT_ACTOR;
}
override void Initialize()
{
if (ud.multimode < 2 && self.pal == 1)
{
self.scale = (0, 0);
self.ChangeStat(STAT_MISC);
return;
}
self.pal = 0;
self.setClipDistFromTile();
self.saved_ammo = 100;
self.cstat = CSTAT_SPRITE_BLOCK_ALL;
}
override void Tick()
{
self.makeitfall();
self.getglobalz();
if (self.sector.lotag == ST_1_ABOVE_WATER)
{
self.setPosition((self.pos.XY, self.floorz + 16));
}
}
override bool OnUse(DukePlayer p)
{
if (!p.OnMotorcycle && p.cursector.lotag != ST_2_UNDERWATER)
{
p.actor.pos.XY = self.pos.XY;
p.SetTargetAngle(self.angle, true);
p.ammo_amount[RRWpn.MOTORCYCLE_WEAPON] = self.saved_ammo;
self.Destroy();
p.StartMotorcycle();
}
return true;
}
}
class RedneckEmptyBoat : DukeActor
{
default
{
pic "EMPTYBOAT";
scaleX 0.5;
scaleY 0.5;
lotag 1;
statnum STAT_ACTOR;
}
override void Initialize()
{
if (ud.multimode < 2 && self.pal == 1)
{
self.scale = (0, 0);
self.ChangeStat(STAT_MISC);
return;
}
self.pal = 0;
self.setClipDistFromTile();
self.saved_ammo = 20;
self.cstat = CSTAT_SPRITE_BLOCK_ALL;
}
override void Tick()
{
self.makeitfall();
self.getglobalz();
}
override bool OnUse(DukePlayer p)
{
if (!p.OnBoat)
{
p.actor.pos.XY = self.pos.XY;
p.SetTargetAngle(self.angle, true);
p.ammo_amount[RRWpn.BOAT_WEAPON] = self.saved_ammo;
self.Destroy();
p.StartBoat();
}
return true;
}
}

View file

@ -361,6 +361,8 @@ struct DukePlayer native
native bool hitablockingwall(); native bool hitablockingwall();
native double getPitchWithView(); native double getPitchWithView();
native void setbobpos(); native void setbobpos();
native void StartMotorcycle();
native void StartBoat();
} }