From 673ea69d35fef7df2ffd3cd93c1d00c22e98afc2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 12 Dec 2022 12:48:41 +0100 Subject: [PATCH] - scriptified a few more skeleton items needed by PicforName. --- source/core/namedef_custom.h | 2 + source/games/duke/src/animatesprites_d.cpp | 4 -- source/games/duke/src/animatesprites_r.cpp | 4 -- source/games/duke/src/dispatch.cpp | 1 - source/games/duke/src/flags_d.cpp | 1 - source/games/duke/src/flags_r.cpp | 1 - source/games/duke/src/gameexec.cpp | 4 +- source/games/duke/src/names.h | 1 - source/games/duke/src/spawn_d.cpp | 6 --- source/games/duke/src/spawn_r.cpp | 23 +--------- source/games/duke/src/vmexports.cpp | 3 -- .../filter/dukelike/rmapinfo.spawnclasses | 4 +- .../redneck.ridesagain/rmapinfo.spawnclasses | 3 ++ .../filter/redneck/rmapinfo.spawnclasses | 3 ++ wadsrc/static/zscript.txt | 6 +++ .../zscript/games/duke/actors/atomichealth.zs | 43 +++++++++++++++++++ .../zscript/games/duke/actors/batteryammo.zs | 25 +++++++++++ .../games/duke/actors/gamblingmachine.zs | 6 +-- .../zscript/games/duke/actors/rabbit.zs | 12 ++++++ .../zscript/games/duke/actors/sixpak.zs | 27 ++++++++++++ wadsrc/static/zscript/games/duke/dukeactor.zs | 43 +++++++++++++++++++ 21 files changed, 174 insertions(+), 48 deletions(-) create mode 100644 wadsrc/static/zscript/games/duke/actors/atomichealth.zs create mode 100644 wadsrc/static/zscript/games/duke/actors/batteryammo.zs create mode 100644 wadsrc/static/zscript/games/duke/actors/rabbit.zs create mode 100644 wadsrc/static/zscript/games/duke/actors/sixpak.zs diff --git a/source/core/namedef_custom.h b/source/core/namedef_custom.h index 28948bd17..04eea0f26 100644 --- a/source/core/namedef_custom.h +++ b/source/core/namedef_custom.h @@ -35,6 +35,8 @@ xx(RedneckJaildoorSound) xx(RedneckGeometryEffect) xx(RedneckKeyinfoSetter) xx(DukeSectorEffector) +xx(RedneckGoogooCluster) +xx(DukeAtomicHealth) xx(spawnstate) xx(brokenstate) diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 50205e3dd..c745f84fe 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -140,9 +140,6 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi } break; - case DTILE_ATOMICHEALTH: - t->pos.Z -= 4; - break; case DTILE_CRYSTALAMMO: t->shade = int(BobVal(PlayClock << 4) * 16); continue; @@ -303,7 +300,6 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi switch (h->spr.picnum) { - case DTILE_ATOMICHEALTH: case DTILE_GROWSPARK: case DTILE_CHAINGUN: case DTILE_SHRINKEREXPLOSION: diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index fdd96387b..6f7fdc2eb 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -139,9 +139,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi } break; - case RTILE_ATOMICHEALTH: - t->pos.Z -= 4; - break; case RTILE_CRYSTALAMMO: t->shade = int(BobVal(PlayClock << 4) * 16); break; @@ -350,7 +347,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi t->shade = -127; break; - case RTILE_ATOMICHEALTH: case RTILE_CHAINGUN: case RTILE_EXPLOSION3: t->shade = -127; diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index d015ed9b9..482df79ba 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -171,7 +171,6 @@ int TILE_STATIC; int TILE_BOTTOMSTATUSBAR; int TILE_THREEDEE; int TILE_INGAMEDUKETHREEDEE; -int TILE_ATOMICHEALTH; int TILE_FIRE; int TILE_WATERBUBBLE; int TILE_SMALLSMOKE; diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index 611866d49..4bc01bc88 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -286,7 +286,6 @@ void initactorflags_d() TILE_CAMLIGHT = DTILE_CAMLIGHT; TILE_STATIC = DTILE_STATIC; TILE_BOTTOMSTATUSBAR = isWorldTour()? DTILE_WIDESCREENSTATUSBAR : DTILE_BOTTOMSTATUSBAR; - TILE_ATOMICHEALTH = DTILE_ATOMICHEALTH; TILE_FIRE = DTILE_FIRE; TILE_WATERBUBBLE = DTILE_WATERBUBBLE; TILE_SMALLSMOKE = DTILE_SMALLSMOKE; diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index ac4d388a6..26bed5033 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -286,7 +286,6 @@ void initactorflags_r() TILE_CAMLIGHT = RTILE_CAMLIGHT; TILE_STATIC = RTILE_STATIC; TILE_BOTTOMSTATUSBAR = RTILE_BOTTOMSTATUSBAR; - TILE_ATOMICHEALTH = RTILE_ATOMICHEALTH; TILE_FIRE = RTILE_FIRE; TILE_WATERBUBBLE = RTILE_WATERBUBBLE; TILE_SMALLSMOKE = RTILE_SMALLSMOKE; diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 236dd83d5..0ddc6d096 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -2011,7 +2011,7 @@ int ParseState::parse(void) if (ps[g_p].drink_amt < 0) ps[g_p].drink_amt = 0; j = ps[g_p].GetActor()->spr.extra; - if (g_ac->spr.picnum != TILE_ATOMICHEALTH) + if (g_ac->GetClass()->TypeName != NAME_RedneckGoogooCluster) { if (j > gs.max_player_health && *insptr > 0) { @@ -2072,7 +2072,7 @@ int ParseState::parse(void) j = ps[g_p].GetActor()->spr.extra; - if(g_ac->spr.picnum != TILE_ATOMICHEALTH) + if(!g_ac->IsKindOf(NAME_DukeAtomicHealth) && g_ac->GetClass()->TypeName != NAME_RedneckGoogooCluster) { if( j > gs.max_player_health && *insptr > 0 ) { diff --git a/source/games/duke/src/names.h b/source/games/duke/src/names.h index 03c16658a..5de733f9c 100644 --- a/source/games/duke/src/names.h +++ b/source/games/duke/src/names.h @@ -12,7 +12,6 @@ extern int TILE_CAMCORNER; extern int TILE_CAMLIGHT; extern int TILE_STATIC; extern int TILE_BOTTOMSTATUSBAR; -extern int TILE_ATOMICHEALTH; extern int TILE_FIRE; extern int TILE_WATERBUBBLE; extern int TILE_SMALLSMOKE; diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 4b93844c9..8fbd29d56 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -433,7 +433,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* break; [[fallthrough]]; - case DTILE_ATOMICHEALTH: case DTILE_STEROIDS: case DTILE_HEATSENSOR: case DTILE_SHIELD: @@ -455,7 +454,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* case DTILE_HBOMBAMMO: case DTILE_CRYSTALAMMO: case DTILE_GROWAMMO: - case DTILE_BATTERYAMMO: case DTILE_DEVISTATORAMMO: case DTILE_RPGAMMO: case DTILE_BOOTS: @@ -463,7 +461,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* case DTILE_AMMOLOTS: case DTILE_COLA: case DTILE_FIRSTAID: - case DTILE_SIXPAK: if (actj) { act->spr.lotag = 0; @@ -490,9 +487,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* case DTILE_ACCESSCARD: - if (act->spr.picnum == DTILE_ATOMICHEALTH) - act->spr.cstat |= CSTAT_SPRITE_YCENTER; - if (ud.multimode > 1 && ud.coop != 1 && act->spr.picnum == DTILE_ACCESSCARD) { act->spr.scale = DVector2(0, 0); diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index bd0a77cb4..10cc79add 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -204,7 +204,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* case RTILE_MINIONBOAT: case RTILE_HULKBOAT: case RTILE_CHEERBOAT: - case RTILE_RABBIT: case RTILE_ROCK: case RTILE_ROCK2: case RTILE_MAMACLOUD: @@ -320,10 +319,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* act->spr.scale = DVector2(0.25, 0.25); act->setClipDistFromTile(); break; - case RTILE_RABBIT: - act->spr.scale = DVector2(0.28125, 0.28125); - act->setClipDistFromTile(); - break; case RTILE_MAMACLOUD: act->spr.scale = DVector2(1, 1); act->spr.cstat = CSTAT_SPRITE_TRANSLUCENT; @@ -434,9 +429,8 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL; - if (act->spr.picnum != 5501) - if (actorfella(act)) - ps[myconnectindex].max_actors_killed++; + if (actorfella(act)) + ps[myconnectindex].max_actors_killed++; if (actj) { @@ -457,7 +451,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* if (!isRRRA()) goto default_case; [[fallthrough]]; - case RTILE_ATOMICHEALTH: case RTILE_STEROIDS: case RTILE_HEATSENSOR: case RTILE_SHIELD: @@ -479,7 +472,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* case RTILE_HBOMBAMMO: case RTILE_CRYSTALAMMO: case RTILE_GROWAMMO: - case RTILE_BATTERYAMMO: case RTILE_DEVISTATORAMMO: case RTILE_RPGAMMO: case RTILE_BOOTS: @@ -487,7 +479,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* case RTILE_AMMOLOTS: case RTILE_BEER: case RTILE_FIRSTAID: - case RTILE_SIXPAK: case RTILE_SAWAMMO: case RTILE_BOWLINGBALLSPRITE: @@ -524,9 +515,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* case RTILE_ACCESSCARD: - if (act->spr.picnum == RTILE_ATOMICHEALTH) - act->spr.cstat |= CSTAT_SPRITE_YCENTER; - if (ud.multimode > 1 && ud.coop != 1 && act->spr.picnum == RTILE_ACCESSCARD) { act->spr.scale = DVector2(0, 0); @@ -557,10 +545,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* act->spr.scale = DVector2(0.28125, 0.265625); if (isRRRA()) act->spr.cstat = CSTAT_SPRITE_BLOCK_HITSCAN; break; - case RTILE_SIXPAK: - act->spr.scale = DVector2(0.203125, 0.140625); - if (isRRRA()) act->spr.cstat = CSTAT_SPRITE_BLOCK_HITSCAN; - break; case RTILE_FIRSTAID: act->spr.scale = DVector2(0.125, 0.125); break; @@ -593,9 +577,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* case RTILE_AIRTANK: act->spr.scale = DVector2(0.296875, 0.25); break; - case RTILE_BATTERYAMMO: - act->spr.scale = DVector2(0.234375, 0.234375); - break; case RTILE_BOWLINGBALLSPRITE: act->spr.scale = DVector2(0.171875, 0.171875); break; diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index 50fa441f9..25b9ce0b0 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -14,9 +14,6 @@ int PicForName(int intname) if (classnameToTile.CountUsed() == 0) { static std::pair classes[] = { - {"RedneckRabbit","RABBIT"}, - {"DukeBatteryAmmo", "BATTERYAMMO"}, - {"DukeSixpak", "SIXPAK"}, {"DukeAtomicHealth", "ATOMICHEALTH"}, {"DukeShrinkerExplosion", "SHRINKEREXPLOSION" }, {"DukeWaterBubble", "WATERBUBBLE"}, diff --git a/wadsrc/static/filter/dukelike/rmapinfo.spawnclasses b/wadsrc/static/filter/dukelike/rmapinfo.spawnclasses index 69f707fae..405f1c219 100644 --- a/wadsrc/static/filter/dukelike/rmapinfo.spawnclasses +++ b/wadsrc/static/filter/dukelike/rmapinfo.spawnclasses @@ -244,5 +244,7 @@ spawnclasses 2310 = DukeBurning2 1890 = DukeExplosion2 2219 = DukeExplosion2Bot - + 41 = DukeBatteryAmmo + 52 = DukeSixpak + 100 = DukeAtomicHealth } diff --git a/wadsrc/static/filter/redneck.ridesagain/rmapinfo.spawnclasses b/wadsrc/static/filter/redneck.ridesagain/rmapinfo.spawnclasses index 053a8ea5b..5cfa94342 100644 --- a/wadsrc/static/filter/redneck.ridesagain/rmapinfo.spawnclasses +++ b/wadsrc/static/filter/redneck.ridesagain/rmapinfo.spawnclasses @@ -160,4 +160,7 @@ spawnclasses 7506 = DukeActor, "*RRTILE7506" 8860 = RedneckBellSwitch + // stuff below uses CON + + 7280 = RedneckRabbit } diff --git a/wadsrc/static/filter/redneck/rmapinfo.spawnclasses b/wadsrc/static/filter/redneck/rmapinfo.spawnclasses index d05d1a095..a74e98c00 100644 --- a/wadsrc/static/filter/redneck/rmapinfo.spawnclasses +++ b/wadsrc/static/filter/redneck/rmapinfo.spawnclasses @@ -278,6 +278,9 @@ spawnclasses 1196 = DukeToiletWater 1494 = DukeBurning 1441 = DukeExplosion2 + 41 = RedneckRifleAmmo + 52 = RedneckPorkRinds + 5595 = RedneckGoogooCluster } diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 67c886323..38ce88bc1 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -107,6 +107,10 @@ version "4.10" #include "zscript/games/duke/actors/burning.zs" #include "zscript/games/duke/actors/explosion2.zs" +#include "zscript/games/duke/actors/batteryammo.zs" +#include "zscript/games/duke/actors/sixpak.zs" +#include "zscript/games/duke/actors/atomichealth.zs" + #include "zscript/games/duke/actors/flamethrowerflame.zs" #include "zscript/games/duke/actors/firefly.zs" @@ -125,6 +129,8 @@ version "4.10" #include "zscript/games/duke/actors/airplane.zs" #include "zscript/games/duke/actors/piano.zs" +#include "zscript/games/duke/actors/rabbit.zs" + #include "zscript/games/duke/world/dukebreak.zs" #include "zscript/games/duke/world/redneckbreak.zs" diff --git a/wadsrc/static/zscript/games/duke/actors/atomichealth.zs b/wadsrc/static/zscript/games/duke/actors/atomichealth.zs new file mode 100644 index 000000000..ae89ea1e9 --- /dev/null +++ b/wadsrc/static/zscript/games/duke/actors/atomichealth.zs @@ -0,0 +1,43 @@ +class DukeAtomicHealth : DukeActor +{ + default + { + pic "ATOMICHEALTH"; + } + + override void Initialize() + { + commonItemSetup(); + self.cstat |= CSTAT_SPRITE_YCENTER; + } + + override bool animate(tspritetype t) + { + t.pos.Z -= 4; + t.shade = -127; + return false; + } +} + +class RedneckGoogooCluster : DukeActor +{ + default + { + pic "ATOMICHEALTH"; + } + + override void Initialize() + { + commonItemSetup((0.125, 0.125)); + self.cstat |= CSTAT_SPRITE_YCENTER; + } + + override bool animate(tspritetype t) + { + t.pos.Z -= 4; + t.shade = -127; + return false; + } + +} + diff --git a/wadsrc/static/zscript/games/duke/actors/batteryammo.zs b/wadsrc/static/zscript/games/duke/actors/batteryammo.zs new file mode 100644 index 000000000..bac8f43a7 --- /dev/null +++ b/wadsrc/static/zscript/games/duke/actors/batteryammo.zs @@ -0,0 +1,25 @@ +class DukeBatteryAmmo : DukeActor +{ + default + { + pic "BATTERYAMMO"; + } + + override void Initialize() + { + commonItemSetup(); + } +} + +class RedneckRifleAmmo : DukeActor +{ + default + { + pic "BATTERYAMMO"; + } + + override void Initialize() + { + commonItemSetup((0.234375, 0.234375)); + } +} diff --git a/wadsrc/static/zscript/games/duke/actors/gamblingmachine.zs b/wadsrc/static/zscript/games/duke/actors/gamblingmachine.zs index a57fa0b8d..3f5c2868b 100644 --- a/wadsrc/static/zscript/games/duke/actors/gamblingmachine.zs +++ b/wadsrc/static/zscript/games/duke/actors/gamblingmachine.zs @@ -46,7 +46,7 @@ class RedneckGamblingMachine : DukeActor else { spriteindex = 2; - self.spawn("DukeBatteryAmmo"); + self.spawn("RedneckRifleAmmo"); pl.SlotWin |= 1; self.PlayActorSound(winsound); } @@ -74,7 +74,7 @@ class RedneckGamblingMachine : DukeActor else { spriteindex = 5; - self.spawn("DukeSixpak"); + self.spawn("RedneckPorkRinds"); pl.SlotWin |= 4; self.PlayActorSound(winsound); } @@ -88,7 +88,7 @@ class RedneckGamblingMachine : DukeActor else { spriteindex = 4; - spawn("DukeAtomicHealth"); + spawn("RedneckGoogooCluster"); pl.SlotWin |= 8; self.PlayActorSound(winsound); } diff --git a/wadsrc/static/zscript/games/duke/actors/rabbit.zs b/wadsrc/static/zscript/games/duke/actors/rabbit.zs new file mode 100644 index 000000000..fef74321e --- /dev/null +++ b/wadsrc/static/zscript/games/duke/actors/rabbit.zs @@ -0,0 +1,12 @@ +class RedneckRabbit : DukeActor +{ + default + { + pic "RABBIT"; + } + + override void Initialize() + { + self.scale = (0.28125, 0.28125); + } +} diff --git a/wadsrc/static/zscript/games/duke/actors/sixpak.zs b/wadsrc/static/zscript/games/duke/actors/sixpak.zs new file mode 100644 index 000000000..a99067ad5 --- /dev/null +++ b/wadsrc/static/zscript/games/duke/actors/sixpak.zs @@ -0,0 +1,27 @@ +class DukeSixpak : DukeActor +{ + default + { + pic "SIXPAK"; + } + + override void Initialize() + { + commonItemSetup(); + } +} + +class RedneckPorkRinds : DukeActor +{ + default + { + pic "SIXPAK"; + } + + override void Initialize() + { + commonItemSetup((0.203125, 0.140625)); + if (Raze.isRRRA()) self.cstat = CSTAT_SPRITE_BLOCK_HITSCAN; + } +} + diff --git a/wadsrc/static/zscript/games/duke/dukeactor.zs b/wadsrc/static/zscript/games/duke/dukeactor.zs index 73376680b..ca1f49146 100644 --- a/wadsrc/static/zscript/games/duke/dukeactor.zs +++ b/wadsrc/static/zscript/games/duke/dukeactor.zs @@ -274,6 +274,49 @@ class DukeActor : CoreActor native } + void commonItemSetup(Vector2 scale = (0.5, 0.5), int usefloorshade = -1) + { + let owner = self.ownerActor; + if (owner != self) + { + self.lotag = 0; + self.pos.Z -= 32; + self.vel.Z = -4; + self.DoMove(CLIPMASK0); + self.cstat |= randomxflip(); + } + else + { + self.cstat = 0; + } + + if ((ud.multimode < 2 && self.pal != 0) || (self.lotag > ud.player_skill)) + { + self.scale = (0, 0); + self.ChangeStat(STAT_MISC); + return; + } + + self.pal = 0; + self.shade = -17; + self.scale = scale; + + if (owner != self) self.ChangeStat(STAT_ACTOR); + else + { + self.ChangeStat(STAT_ZOMBIEACTOR); + self.makeitfall(); + } + + // RR defaults to using the floor shade here, let's make this configurable. + if (usefloorshade == 1 || (usefloorshade == -1 && Raze.isRR())) + { + self.shade = self.sector.floorshade; + } + + } + + int checkLocationForFloorSprite(double radius) { bool away = self.isAwayFromWall(radius);