- scriptified transport vehicles.

This commit is contained in:
Christoph Oelckers 2022-11-30 17:15:44 +01:00
parent f1d6e0e6bb
commit bc34746227
17 changed files with 66 additions and 43 deletions

View file

@ -579,7 +579,7 @@ void operaterespawns(int low)
void detonate(DDukeActor *actor, int explosion) void detonate(DDukeActor *actor, int explosion)
{ {
earthquaketime = 16; ud.earthquaketime = 16;
DukeStatIterator itj(STAT_EFFECTOR); DukeStatIterator itj(STAT_EFFECTOR);
while (auto effector = itj.Next()) while (auto effector = itj.Next())
@ -1523,7 +1523,7 @@ void handle_se02(DDukeActor* actor)
{ {
if ((actor->temp_data[0] & 31) == 8) if ((actor->temp_data[0] & 31) == 8)
{ {
earthquaketime = 48; ud.earthquaketime = 48;
S_PlayActorSound(EARTHQUAKE, ps[screenpeek].GetActor()); S_PlayActorSound(EARTHQUAKE, ps[screenpeek].GetActor());
} }

View file

@ -1797,7 +1797,6 @@ DETONATEB:
void moveactors_d(void) void moveactors_d(void)
{ {
int p; int p;
unsigned int k;
DukeStatIterator it(STAT_ACTOR); DukeStatIterator it(STAT_ACTOR);
while (auto act = it.Next()) while (auto act = it.Next())
@ -1826,28 +1825,6 @@ void moveactors_d(void)
if (isWorldTour()) flamethrowerflame(act); if (isWorldTour()) flamethrowerflame(act);
continue; continue;
case HELECOPT:
case DUKECAR:
act->spr.pos.Z += act->vel.Z;
act->temp_data[0]++;
if (act->temp_data[0] == 4) S_PlayActorSound(WAR_AMBIENCE2, act);
if (act->temp_data[0] > (26 * 8))
{
S_PlaySound(RPG_EXPLODE);
for (int j = 0; j < 32; j++)
RANDOMSCRAP(act);
earthquaketime = 16;
act->Destroy();
continue;
}
else if ((act->temp_data[0] & 3) == 0)
spawn(act, EXPLOSION2);
ssp(act, CLIPMASK0);
break;
case GREENSLIME: case GREENSLIME:
case GREENSLIME + 1: case GREENSLIME + 1:
case GREENSLIME + 2: case GREENSLIME + 2:
@ -2337,7 +2314,7 @@ void moveeffectors_d(void) //STATNUM 3
break; break;
case SE_33_QUAKE_DEBRIS: case SE_33_QUAKE_DEBRIS:
if (earthquaketime > 0 && (krand() & 7) == 0) if (ud.earthquaketime > 0 && (krand() & 7) == 0)
RANDOMSCRAP(act); RANDOMSCRAP(act);
break; break;
case SE_36_PROJ_SHOOTER: case SE_36_PROJ_SHOOTER:

View file

@ -1148,7 +1148,7 @@ static void rrra_specialstats()
{ {
S_PlaySound(215); S_PlaySound(215);
act->Destroy(); act->Destroy();
earthquaketime = 32; ud.earthquaketime = 32;
SetPlayerPal(&ps[myconnectindex], PalEntry(32, 32, 32, 48)); SetPlayerPal(&ps[myconnectindex], PalEntry(32, 32, 32, 48));
} }
} }
@ -2092,7 +2092,7 @@ void moveeffectors_r(void) //STATNUM 3
break; break;
case SE_33_QUAKE_DEBRIS: case SE_33_QUAKE_DEBRIS:
if (earthquaketime > 0 && (krand() & 7) == 0) if (ud.earthquaketime > 0 && (krand() & 7) == 0)
RANDOMSCRAP(act); RANDOMSCRAP(act);
break; break;
case SE_36_PROJ_SHOOTER: case SE_36_PROJ_SHOOTER:

View file

@ -1624,9 +1624,9 @@ int ParseState::parse(void)
break; break;
case concmd_mamaquake: case concmd_mamaquake:
if (g_ac->spr.pal == 31) if (g_ac->spr.pal == 31)
earthquaketime = 4; ud.earthquaketime = 4;
else if (g_ac->spr.pal == 32) else if (g_ac->spr.pal == 32)
earthquaketime = 6; ud.earthquaketime = 6;
insptr++; insptr++;
break; break;
case concmd_garybanjo: case concmd_garybanjo:

View file

@ -64,7 +64,7 @@ void GameInterface::Ticker()
if (playrunning()) if (playrunning())
{ {
if (earthquaketime > 0) earthquaketime--; if (ud.earthquaketime > 0) ud.earthquaketime--;
ud.cameraactor = nullptr; ud.cameraactor = nullptr;
everyothertime++; everyothertime++;

View file

@ -56,7 +56,6 @@ player_struct ps[MAXPLAYERS];
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
int lastvisinc; // weapon flash int lastvisinc; // weapon flash
int earthquaketime;
int global_random; // readonly - one single global per-frame random value. Ugh... int global_random; // readonly - one single global per-frame random value. Ugh...
// Redneck Rampage // Redneck Rampage

View file

@ -72,7 +72,6 @@ extern int lastvisinc;
extern animwalltype animwall[MAXANIMWALLS]; extern animwalltype animwall[MAXANIMWALLS];
extern int numanimwalls; extern int numanimwalls;
extern int numclouds; extern int numclouds;
extern int earthquaketime;
extern int global_random; extern int global_random;
extern int mirrorcnt; extern int mirrorcnt;
extern int numplayersprites; extern int numplayersprites;
@ -111,7 +110,6 @@ extern sectortype* mirrorsector[64];
extern walltype* mirrorwall[64]; extern walltype* mirrorwall[64];
extern int wupass; extern int wupass;
extern int chickenplant;
extern int thunderon; extern int thunderon;
extern int ufospawn; extern int ufospawn;
extern int ufocnt; extern int ufocnt;

View file

@ -426,7 +426,7 @@ void resetprestat(int snum,int g)
mspos.Clear(); mspos.Clear();
animates.Clear(); animates.Clear();
camsprite =nullptr; camsprite =nullptr;
earthquaketime = 0; ud.earthquaketime = 0;
WindTime = 0; WindTime = 0;
WindDir = nullAngle; WindDir = nullAngle;

View file

@ -314,10 +314,10 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
double cz = p->GetActor()->ceilingz; double cz = p->GetActor()->ceilingz;
double fz = p->GetActor()->floorz; double fz = p->GetActor()->floorz;
if (earthquaketime > 0 && p->on_ground == 1) if (ud.earthquaketime > 0 && p->on_ground == 1)
{ {
cpos.Z += 1 - (((earthquaketime) & 1) * 2.); cpos.Z += 1 - (((ud.earthquaketime) & 1) * 2.);
cangles.Yaw += DAngle::fromBuild((2 - ((earthquaketime) & 2)) << 2); cangles.Yaw += DAngle::fromBuild((2 - ((ud.earthquaketime) & 2)) << 2);
} }
if (p->GetActor()->spr.pal == 1) cpos.Z -= 18; if (p->GetActor()->spr.pal == 1) cpos.Z -= 18;

View file

@ -373,7 +373,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
("numanimwalls", numanimwalls) ("numanimwalls", numanimwalls)
.Array("animwall", animwall, numanimwalls) .Array("animwall", animwall, numanimwalls)
("camsprite", camsprite) ("camsprite", camsprite)
("earthquaketime", earthquaketime) ("earthquaketime", ud.earthquaketime)
("gs.freezerhurtowner", gs.freezerhurtowner) ("gs.freezerhurtowner", gs.freezerhurtowner)
("global_random", global_random) ("global_random", global_random)
("gs.impact_damage", gs.impact_damage) ("gs.impact_damage", gs.impact_damage)

View file

@ -355,9 +355,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.shade = actj->spr.shade; act->spr.shade = actj->spr.shade;
act->spr.pal = ps[actj->PlayerIndex()].palookup; act->spr.pal = ps[actj->PlayerIndex()].palookup;
} }
[[fallthrough]];
case DUKECAR:
case HELECOPT:
act->spr.cstat = 0; act->spr.cstat = 0;
act->spr.extra = 1; act->spr.extra = 1;
act->vel.X = 292 / 16.; act->vel.X = 292 / 16.;

View file

@ -162,6 +162,7 @@ struct user_defs
int m_ffire, ffire, m_player_skill, multimode; int m_ffire, ffire, m_player_skill, multimode;
int player_skill, marker; int player_skill, marker;
int chickenplant; // readonly - used to trigger some special behavior if a special item is found in a map. int chickenplant; // readonly - used to trigger some special behavior if a special item is found in a map.
int earthquaketime;
TObjPtr<DDukeActor*> cameraactor; TObjPtr<DDukeActor*> cameraactor;

View file

@ -1323,6 +1323,7 @@ DEFINE_FIELD_X(DukeUserDefs, user_defs, marker);
DEFINE_FIELD_X(DukeUserDefs, user_defs, bomb_tag); DEFINE_FIELD_X(DukeUserDefs, user_defs, bomb_tag);
DEFINE_FIELD_X(DukeUserDefs, user_defs, cameraactor); DEFINE_FIELD_X(DukeUserDefs, user_defs, cameraactor);
DEFINE_FIELD_X(DukeUserDefs, user_defs, chickenplant); DEFINE_FIELD_X(DukeUserDefs, user_defs, chickenplant);
DEFINE_FIELD_X(DukeUserDefs, user_defs, earthquaketime);
DEFINE_FIELD_X(DukeUserDefs, user_defs, ufospawnsminion); DEFINE_FIELD_X(DukeUserDefs, user_defs, ufospawnsminion);
DEFINE_GLOBAL_UNSIZED(ud) DEFINE_GLOBAL_UNSIZED(ud)

View file

@ -74,6 +74,8 @@ spawnclasses
4502 = DukeLetter 4502 = DukeLetter
4361 = DukeDuck 4361 = DukeDuck
4359 = DukeTarget 4359 = DukeTarget
1346 = DukeHelicopter
2491 = DukeCar
1272 = DukeTrash 1272 = DukeTrash
634 = DukeBolt1 634 = DukeBolt1

View file

@ -86,6 +86,7 @@ version "4.10"
#include "zscript/games/duke/actors/reactor.zs" #include "zscript/games/duke/actors/reactor.zs"
#include "zscript/games/duke/actors/destructibles.zs" #include "zscript/games/duke/actors/destructibles.zs"
#include "zscript/games/duke/actors/ducktarget.zs" #include "zscript/games/duke/actors/ducktarget.zs"
#include "zscript/games/duke/actors/helicopt.zs"
#include "zscript/games/duke/actors/redneckmisc.zs" #include "zscript/games/duke/actors/redneckmisc.zs"
#include "zscript/games/duke/actors/rabbitspawner.zs" #include "zscript/games/duke/actors/rabbitspawner.zs"

View file

@ -0,0 +1,46 @@
class DukeCar : DukeActor
{
default
{
extra 1;
clipdist 32;
pic "DUKECAR";
statnum STAT_ACTOR;
}
override void Initialize()
{
self.vel.X = 292 / 16.;
self.vel.Z = 360 / 256.;
self.cstat = CSTAT_SPRITE_BLOCK_ALL;
}
override void Tick()
{
self.pos.Z += self.vel.Z;
self.temp_data[0]++;
if (self.temp_data[0] == 4) self.PlayActorSound("WAR_AMBIENCE2");
if (self.temp_data[0] > (26 * 8))
{
Duke.PlaySound("RPG_EXPLODE");
for (int j = 0; j < 32; j++)
self.RANDOMSCRAP();
ud.earthquaketime = 16;
self.Destroy();
return;
}
else if ((self.temp_data[0] & 3) == 0)
self.spawn("DukeExplosion2");
self.DoMove(CLIPMASK0);
}
}
class DukeHelicopter : DukeCar
{
default
{
pic "HELECOPT";
}
}

View file

@ -446,7 +446,8 @@ struct DukeUserDefs native
native readonly int respawn_monsters, respawn_items, respawn_inventory, recstat, monsters_off, brightness; native readonly int respawn_monsters, respawn_items, respawn_inventory, recstat, monsters_off, brightness;
native readonly int ffire, multimode; native readonly int ffire, multimode;
native readonly int player_skill, marker, chickenplant; native readonly int player_skill, marker, chickenplant;
native int earthquaketime;
native uint8 ufospawnsminion; native uint8 ufospawnsminion;
native int16 bomb_tag; native int16 bomb_tag;
native DukeActor cameraactor; native DukeActor cameraactor;