From 9e29c3970de68d5b374514f7ef70ce3500a65a16 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 24 Nov 2022 07:42:17 +0100 Subject: [PATCH] - generic destructibles --- source/core/defparser.cpp | 31 +- source/core/gamecontrol.h | 2 + source/core/namedef_custom.h | 5 + source/games/duke/src/dispatch.cpp | 3 - source/games/duke/src/flags_d.cpp | 3 - source/games/duke/src/flags_r.cpp | 3 - source/games/duke/src/funct.h | 1 + source/games/duke/src/namelist_r.h | 2 +- source/games/duke/src/names.h | 3 - source/games/duke/src/player_d.cpp | 1 + source/games/duke/src/premap.cpp | 5 + source/games/duke/src/sectors_d.cpp | 8 +- source/games/duke/src/sectors_r.cpp | 440 +----------------- source/games/duke/src/spawn.cpp | 26 +- source/games/duke/src/spawn_r.cpp | 73 --- source/games/duke/src/vmexports.cpp | 36 ++ .../redneck.ridesagain/engine/engine.def | 387 +++++++++++++++ wadsrc/static/zscript.txt | 1 + .../games/duke/actors/genericdestructible.zs | 190 ++++++++ .../static/zscript/games/duke/actors/jibs.zs | 11 + wadsrc/static/zscript/games/duke/dukeactor.zs | 10 + 21 files changed, 704 insertions(+), 537 deletions(-) create mode 100644 wadsrc/static/zscript/games/duke/actors/genericdestructible.zs diff --git a/source/core/defparser.cpp b/source/core/defparser.cpp index 482a19d96..023c16d70 100644 --- a/source/core/defparser.cpp +++ b/source/core/defparser.cpp @@ -2245,8 +2245,12 @@ static void parseSpawnClasses(FScanner& sc, FScriptPosition& pos) } while (!sc.CheckString("}")) { + // This will need some reworking once we can use real textures. int num = -1; int base = -1; + int basetex = -1; + int brokentex = -1; + FName sound = NAME_None; FName cname; sc.GetNumber(num, true); sc.MustGetStringName("="); @@ -2254,11 +2258,34 @@ static void parseSpawnClasses(FScanner& sc, FScriptPosition& pos) cname = sc.String; if (sc.CheckString(",")) { - sc.GetNumber(base, true); + if (sc.CheckNumber(true)) base = sc.Number; + else + { + sc.MustGetString(); + basetex = TileFiles.tileForName(sc.String); + if (basetex < 0) Printf(TEXTCOLOR_RED "Unknown texture %s in definition for spawn ID # %d\n", num); + if (sc.CheckString(",")) + { + sc.MustGetString(); + brokentex = TileFiles.tileForName(sc.String); + if (brokentex < 0) Printf(TEXTCOLOR_RED "Unknown texture %s in definition for spawn ID # %d\n", num); + if (sc.CheckString(",")) + { + sc.MustGetString(); + sound = sc.String; +#if 0 + // Sound engine is not initialized here. + S_FindSound(sc.String).index(); + if (sound <= 0) Printf(TEXTCOLOR_RED "Unknown sound %s in definition for spawn ID # %d\n", num); +#endif + } + } + + } } // todo: check for proper base class - spawnMap.Insert(num, { cname, nullptr, base }); + spawnMap.Insert(num, { cname, nullptr, base, basetex, brokentex, sound }); } sc.SetCMode(false); } diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index ddb84d6c6..ee69cd2e6 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -276,6 +276,8 @@ struct SpawnRec FName clsname; PClass* cls; int param; + int basetex, brokentex; + FName breaksound; PClass* Class(int pn) { diff --git a/source/core/namedef_custom.h b/source/core/namedef_custom.h index ba66d721b..87831393f 100644 --- a/source/core/namedef_custom.h +++ b/source/core/namedef_custom.h @@ -19,3 +19,8 @@ xx(DukeRespawnController) xx(DukeActivator) xx(DukeActivatorLocked) xx(DukeLocator) +xx(DukeGenericDestructible) + +xx(spawnstate) +xx(brokenstate) +xx(breaksound) \ No newline at end of file diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 6cf3c6649..c2a72cac2 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -194,7 +194,6 @@ int TILE_BOTTOMSTATUSBAR; int TILE_THREEDEE; int TILE_INGAMEDUKETHREEDEE; int TILE_ATOMICHEALTH; -int TILE_JIBS6; int TILE_FIRE; int TILE_WATERBUBBLE; int TILE_SMALLSMOKE; @@ -204,12 +203,10 @@ int TILE_FOOTPRINTS2; int TILE_FOOTPRINTS3; int TILE_FOOTPRINTS4; int TILE_CLOUDYSKIES; -int TILE_ARROW; int TILE_ACCESSSWITCH; int TILE_ACCESSSWITCH2; int TILE_GLASSPIECES; int TILE_HEN; -int TILE_BETAVERSION; int TILE_MIRROR; int TILE_CLOUDYOCEAN; int TILE_MOONSKY1; diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index 4b2c8f48c..8535a35af 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -222,7 +222,6 @@ void initactorflags_d() TILE_STATIC = STATIC; TILE_BOTTOMSTATUSBAR = isWorldTour()? WIDESCREENSTATUSBAR : BOTTOMSTATUSBAR; TILE_ATOMICHEALTH = ATOMICHEALTH; - TILE_JIBS6 = JIBS6; TILE_FIRE = FIRE; TILE_WATERBUBBLE = WATERBUBBLE; TILE_SMALLSMOKE = SMALLSMOKE; @@ -232,11 +231,9 @@ void initactorflags_d() TILE_FOOTPRINTS3 = FOOTPRINTS3; TILE_FOOTPRINTS4 = FOOTPRINTS4; TILE_CLOUDYSKIES = CLOUDYSKIES; - TILE_ARROW = ARROW; TILE_ACCESSSWITCH = ACCESSSWITCH; TILE_ACCESSSWITCH2 = ACCESSSWITCH2; TILE_GLASSPIECES = GLASSPIECES; - TILE_BETAVERSION = BETAVERSION; TILE_MIRROR = MIRROR; TILE_CLOUDYOCEAN = CLOUDYOCEAN; TILE_MOONSKY1 = MOONSKY1; diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index 783dd364e..8a18b733a 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -228,7 +228,6 @@ void initactorflags_r() TILE_STATIC = STATIC; TILE_BOTTOMSTATUSBAR = BOTTOMSTATUSBAR; TILE_ATOMICHEALTH = ATOMICHEALTH; - TILE_JIBS6 = JIBS6; TILE_FIRE = FIRE; TILE_WATERBUBBLE = WATERBUBBLE; TILE_SMALLSMOKE = SMALLSMOKE; @@ -238,11 +237,9 @@ void initactorflags_r() TILE_FOOTPRINTS3 = FOOTPRINTS3; TILE_FOOTPRINTS4 = FOOTPRINTS4; TILE_CLOUDYSKIES = CLOUDYSKIES; - TILE_ARROW = ARROW; TILE_ACCESSSWITCH = ACCESSSWITCH; TILE_ACCESSSWITCH2 = ACCESSSWITCH2; TILE_GLASSPIECES = GLASSPIECES; - TILE_BETAVERSION = BETAVERSION; TILE_MIRROR = MIRROR; TILE_HEN = HEN; TILE_MOONSKY1 = MOONSKY1; diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 8a4723871..198c47a2a 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -162,6 +162,7 @@ void makeitfall(DDukeActor* s); DAngle furthestangle(DDukeActor* snum, int angDiv); void getglobalz(DDukeActor* s); void OnEvent(int id, int pnum = -1, DDukeActor* snum = nullptr, int dist = -1); +void setFromSpawnRec(DDukeActor* act, SpawnRec* info); DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, int s_pn, int8_t s_shd, const DVector2& scale, DAngle s_ang, double s_vel, double s_zvel, DDukeActor* s_ow, int8_t s_stat); DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, PClassActor* cls, int8_t s_shd, const DVector2& scale, DAngle s_ang, double s_vel, double s_zvel, DDukeActor* s_ow, int8_t s_stat); diff --git a/source/games/duke/src/namelist_r.h b/source/games/duke/src/namelist_r.h index abf3383fb..b4a5fa04d 100644 --- a/source/games/duke/src/namelist_r.h +++ b/source/games/duke/src/namelist_r.h @@ -602,7 +602,7 @@ y(RRTILE1812, 1812) y(RRTILE1814, 1814) y(RRTILE1817, 1817) y(RRTILE1821, 1821) -y(RRTILE1824, 1824) +x(YELLOWBOTTLE, 1824) y(RRTILE1826, 1826) y(RRTILE1850, 1850) y(RRTILE1851, 1851) diff --git a/source/games/duke/src/names.h b/source/games/duke/src/names.h index 89090f7c2..8b381ad32 100644 --- a/source/games/duke/src/names.h +++ b/source/games/duke/src/names.h @@ -15,7 +15,6 @@ extern int TILE_CAMLIGHT; extern int TILE_STATIC; extern int TILE_BOTTOMSTATUSBAR; extern int TILE_ATOMICHEALTH; -extern int TILE_JIBS6; extern int TILE_FIRE; extern int TILE_WATERBUBBLE; extern int TILE_SMALLSMOKE; @@ -25,12 +24,10 @@ extern int TILE_FOOTPRINTS2; extern int TILE_FOOTPRINTS3; extern int TILE_FOOTPRINTS4; extern int TILE_CLOUDYSKIES; -extern int TILE_ARROW; extern int TILE_ACCESSSWITCH; extern int TILE_ACCESSSWITCH2; extern int TILE_GLASSPIECES; extern int TILE_HEN; -extern int TILE_BETAVERSION; extern int TILE_MIRROR; extern int TILE_CLOUDYOCEAN; extern int TILE_MOONSKY1; diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 4a29965a4..30e6aabc1 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -3181,3 +3181,4 @@ HORIZONLY: } END_DUKE_NS + diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 169ae72c3..85575238a 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -940,6 +940,10 @@ static TArray spawnactors(SpawnSpriteDef& sprites) } auto sprt = &sprites.sprites[i]; + + if (sprt->picnum == 7220) + sprt->picnum = 8490; + auto info = spawnMap.CheckKey(sprt->picnum); auto cls = info ? info->Class(sprt->picnum) : nullptr;; auto actor = static_cast(InsertActor(cls? cls : RUNTIME_CLASS(DDukeActor), sprt->sectp, sprt->statnum)); @@ -947,6 +951,7 @@ static TArray spawnactors(SpawnSpriteDef& sprites) { spawns[j++] = actor; actor->initFromSprite(&sprites.sprites[i]); + setFromSpawnRec(actor, info); actor->time = i; if (sprites.sprext.Size()) actor->sprext = sprites.sprext[i]; else actor->sprext = {}; diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 339e9f248..3679ea4e9 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -936,10 +936,10 @@ bool checkhitceiling_d(sectortype* sectp) void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj) { - if ((targ->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL) && targ->spr.hitag == 0 && targ->spr.lotag == 0 && targ->spr.statnum == 0) + if ((targ->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL) && targ->spr.hitag == 0 && targ->spr.lotag == 0 && targ->spr.statnum == STAT_DEFAULT) return; - if ((proj->spr.picnum == FREEZEBLAST || proj->GetOwner() != targ) && targ->spr.statnum != 4) + if ((proj->spr.picnum == FREEZEBLAST || proj->GetOwner() != targ) && targ->spr.statnum != STAT_PROJECTILE) { if (badguy(targ) == 1) { @@ -995,7 +995,7 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj) if ((targ->spr.scale.X < 0.375 || targ->spr.picnum == SHARK) && proj->spr.picnum == SHRINKSPARK) return; } - if (targ->spr.statnum != 2) + if (targ->spr.statnum != STAT_ZOMBIEACTOR) { if (proj->spr.picnum == FREEZEBLAST && ((targ->spr.picnum == APLAYER && targ->spr.pal == 1) || (gs.freezerhurtowner == 0 && proj->GetOwner() == targ))) return; @@ -1018,7 +1018,7 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj) targ->SetHitOwner(Owner); } - if (targ->spr.statnum == 10) + if (targ->spr.statnum == STAT_PLAYER) { auto p = targ->spr.yint; if (ps[p].newOwner != nullptr) diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 353858aca..32b09c58f 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -1397,373 +1397,6 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) { case IRONWHEELSWITCH: break; - case RRTILE8487: - case RRTILE8489: - S_PlayActorSound(471, targ); - targ->spr.picnum++; - break; - case RRTILE7638: - case RRTILE7644: - case RRTILE7646: - case RRTILE7650: - case RRTILE7653: - case RRTILE7655: - case RRTILE7691: - case RRTILE7876: - case RRTILE7881: - case RRTILE7883: - targ->spr.picnum++; - S_PlayActorSound(VENT_BUST, targ); - break; - case RRTILE7879: - targ->spr.picnum++; - S_PlayActorSound(495, targ); - fi.hitradius(targ, 10, 0, 0, 1, 1); - break; - case RRTILE7648: - case RRTILE7694: - case RRTILE7700: - case RRTILE7702: - case RRTILE7711: - targ->spr.picnum++; - S_PlayActorSound(47, targ); - break; - case RRTILE7636: - targ->spr.picnum += 3; - S_PlayActorSound(VENT_BUST, targ); - break; - case RRTILE7875: - targ->spr.picnum += 3; - S_PlayActorSound(VENT_BUST, targ); - break; - case RRTILE7640: - targ->spr.picnum += 2; - S_PlayActorSound(VENT_BUST, targ); - break; - case RRTILE7595: - case RRTILE7704: - targ->spr.picnum = RRTILE7705; - S_PlayActorSound(495, targ); - break; - case RRTILE8579: - targ->spr.picnum = RRTILE5014; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7441: - targ->spr.picnum = RRTILE5016; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7534: - targ->spr.picnum = RRTILE5029; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7545: - targ->spr.picnum = RRTILE5030; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7547: - targ->spr.picnum = RRTILE5031; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7574: - targ->spr.picnum = RRTILE5032; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7575: - targ->spr.picnum = RRTILE5033; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7578: - targ->spr.picnum = RRTILE5034; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7478: - targ->spr.picnum = RRTILE5035; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8525: - targ->spr.picnum = RRTILE5036; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8537: - targ->spr.picnum = RRTILE5062; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8215: - targ->spr.picnum = RRTILE5064; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8216: - targ->spr.picnum = RRTILE5065; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8217: - targ->spr.picnum = RRTILE5066; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8218: - targ->spr.picnum = RRTILE5067; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8220: - targ->spr.picnum = RRTILE5068; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8221: - targ->spr.picnum = RRTILE5069; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8312: - targ->spr.picnum = RRTILE5071; - S_PlayActorSound(472, targ); - break; - case RRTILE8395: - targ->spr.picnum = RRTILE5072; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8423: - targ->spr.picnum = RRTILE5073; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE3462: - targ->spr.picnum = RRTILE5074; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case UWHIP: - targ->spr.picnum = RRTILE5075; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8608: - targ->spr.picnum = RRTILE5083; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8609: - targ->spr.picnum = RRTILE5084; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8567: - case RRTILE8568: - case RRTILE8569: - case RRTILE8570: - case RRTILE8571: - targ->spr.picnum = RRTILE5082; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8640: - targ->spr.picnum = RRTILE5085; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8611: - targ->spr.picnum = RRTILE5086; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case TECHLIGHTBUST2: - targ->spr.picnum = TECHLIGHTBUST4; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8497: - targ->spr.picnum = RRTILE5076; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8162: - case RRTILE8163: - case RRTILE8164: - case RRTILE8165: - case RRTILE8166: - case RRTILE8167: - case RRTILE8168: - ChangeActorStat(targ, STAT_MISC); - targ->spr.picnum = RRTILE5063; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8589: - case RRTILE8590: - case RRTILE8591: - case RRTILE8592: - case RRTILE8593: - case RRTILE8594: - case RRTILE8595: - ChangeActorStat(targ, STAT_MISC); - targ->spr.picnum = RRTILE8588; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE3497: - targ->spr.picnum = RRTILE5076; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE3498: - targ->spr.picnum = RRTILE5077; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE3499: - targ->spr.picnum = RRTILE5078; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8503: - targ->spr.picnum = RRTILE5079; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7901: - targ->spr.picnum = RRTILE5080; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7696: - targ->spr.picnum = RRTILE7697; - S_PlayActorSound(DUKE_SHUCKS, targ); - break; - case RRTILE7806: - targ->spr.picnum = RRTILE5043; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7885: - case RRTILE7890: - targ->spr.picnum = RRTILE5045; - S_PlayActorSound(495, targ); - fi.hitradius(targ, 10, 0, 0, 1, 1); - break; - case RRTILE7886: - targ->spr.picnum = RRTILE5046; - S_PlayActorSound(495, targ); - fi.hitradius(targ, 10, 0, 0, 1, 1); - break; - case RRTILE7887: - targ->spr.picnum = RRTILE5044; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - fi.hitradius(targ, 10, 0, 0, 1, 1); - break; - case RRTILE7900: - targ->spr.picnum = RRTILE5047; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7906: - targ->spr.picnum = RRTILE5048; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7912: - case RRTILE7913: - targ->spr.picnum = RRTILE5049; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8047: - targ->spr.picnum = RRTILE5050; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8596: - targ->spr.picnum = RRTILE8598; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8059: - targ->spr.picnum = RRTILE5051; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8060: - targ->spr.picnum = RRTILE5052; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8222: - targ->spr.picnum = RRTILE5053; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8223: - targ->spr.picnum = RRTILE5054; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8224: - targ->spr.picnum = RRTILE5055; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8370: - targ->spr.picnum = RRTILE5056; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8371: - targ->spr.picnum = RRTILE5057; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8372: - targ->spr.picnum = RRTILE5058; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8373: - targ->spr.picnum = RRTILE5059; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8396: - targ->spr.picnum = RRTILE5038; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8397: - targ->spr.picnum = RRTILE5039; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8398: - targ->spr.picnum = RRTILE5040; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8399: - targ->spr.picnum = RRTILE5041; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8385: - targ->spr.picnum = RRTILE8386; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8387: - targ->spr.picnum = RRTILE8388; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8389: - targ->spr.picnum = RRTILE8390; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8391: - targ->spr.picnum = RRTILE8392; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE7553: - targ->spr.picnum = RRTILE5035; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8475: - targ->spr.picnum = RRTILE5075; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8498: - targ->spr.picnum = RRTILE5077; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE8499: - targ->spr.picnum = RRTILE5078; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE2445: - targ->spr.picnum = RRTILE2450; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; - case RRTILE2123: - targ->spr.picnum = RRTILE2124; - S_PlayActorSound(GLASS_BREAKING, targ); - lotsofglass(targ, nullptr, 10); - break; - case RRTILE3773: - targ->spr.picnum = RRTILE8651; - S_PlayActorSound(GLASS_BREAKING, targ); - lotsofglass(targ, nullptr, 10); - break; - case RRTILE7533: - targ->spr.picnum = RRTILE5035; - S_PlayActorSound(495, targ); - fi.hitradius(targ, 10, 0, 0, 1, 1); - break; - case RRTILE8394: - targ->spr.picnum = RRTILE5072; - S_PlayActorSound(495, targ); - break; - case RRTILE8461: - case RRTILE8462: - targ->spr.picnum = RRTILE5074; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; case RRTILE8679: targ->spr.picnum = RRTILE8680; S_PlayActorSound(DUKE_SHUCKS, targ); @@ -1781,15 +1414,6 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) } } break; - case RRTILE3584: - targ->spr.picnum = RRTILE8681; - S_PlayActorSound(495, targ); - fi.hitradius(targ, 250, 0, 0, 1, 1); - break; - case RRTILE8682: - targ->spr.picnum = RRTILE8683; - S_PlayActorSound(GLASS_HEAVYBREAK, targ); - break; case RRTILE8099: if (targ->spr.lotag == 5) { @@ -1804,60 +1428,10 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) } } break; - case RRTILE2437: - S_PlayActorSound(439, targ); - break; } switch (targ->spr.picnum) { - case RRTILE3114: - targ->spr.picnum = RRTILE3117; - break; - case RRTILE2876: - targ->spr.picnum = RRTILE2990; - break; - case RRTILE3152: - targ->spr.picnum = RRTILE3218; - break; - case RRTILE3153: - targ->spr.picnum = RRTILE3219; - break; - case RRTILE2030: - targ->spr.picnum = RRTILE2034; - S_PlayActorSound(GLASS_BREAKING, targ); - lotsofglass(targ, nullptr, 10); - break; - case RRTILE2893: - case RRTILE2915: - case RRTILE3115: - case RRTILE3171: - switch (targ->spr.picnum) - { - case RRTILE2915: - targ->spr.picnum = RRTILE2977; - break; - case RRTILE2893: - targ->spr.picnum = RRTILE2978; - break; - case RRTILE3115: - targ->spr.picnum = RRTILE3116; - break; - case RRTILE3171: - targ->spr.picnum = RRTILE3216; - break; - } - S_PlayActorSound(GLASS_BREAKING, targ); - lotsofglass(targ, nullptr, 10); - break; - case RRTILE2156: - case RRTILE2158: - case RRTILE2160: - case RRTILE2175: - targ->spr.picnum++; - S_PlayActorSound(GLASS_BREAKING, targ); - lotsofglass(targ, nullptr, 10); - break; case RRTILE2137: case RRTILE2151: case RRTILE2152: @@ -1945,7 +1519,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) targ->Destroy(); } break; - case RRTILE1824: + case YELLOWBOTTLE: if (!isRRRA()) break; [[fallthrough]]; case BOTTLE1: @@ -2036,18 +1610,6 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) S_PlayActorSound(GLASS_HEAVYBREAK, targ); break; - case GRATE1: - targ->spr.picnum = BGRATE1; - targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; - S_PlayActorSound(VENT_BUST, targ); - break; - - case CIRCLEPANNEL: - targ->spr.picnum = CIRCLEPANNELBROKE; - targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; - S_PlayActorSound(VENT_BUST, targ); - break; - case PIPE1: case PIPE2: case PIPE3: diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 23571948b..fbe778d8e 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -43,6 +43,22 @@ source as it is released. BEGIN_DUKE_NS +void setFromSpawnRec(DDukeActor* act, SpawnRec* info) +{ + if (info) + { + //int basepicnum = info->param; + //act->basepicnum = basepicnum; + if (info->basetex > 0 && act->IsKindOf(NAME_DukeGenericDestructible)) + { + // allow defining simple destructibles without actual actor definitions. + act->IntVar(NAME_spawnstate) = info->basetex; + act->IntVar(NAME_brokenstate) = info->brokentex; + act->IntVar(NAME_breaksound) = S_FindSound(info->breaksound.GetChars()).index(); + } + } +} + //--------------------------------------------------------------------------- // // this creates a new actor but does not run any init code on it @@ -56,26 +72,24 @@ DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, PClassActor* if (whatsectp == nullptr || !validSectorIndex(sectindex(whatsectp))) return nullptr; // spawning out of range sprites will also crash. if (clstype == nullptr && (s_pn < 0 || s_pn >= MAXTILES)) return nullptr; + SpawnRec* info = nullptr; - int basepicnum = -1; if (!clstype) { - auto info = spawnMap.CheckKey(s_pn); + info = spawnMap.CheckKey(s_pn); if (info) { clstype = static_cast(info->Class(s_pn)); - basepicnum = info->param; } } auto act = static_cast(InsertActor(clstype? clstype : RUNTIME_CLASS(DDukeActor), whatsectp, s_stat)); - if (act == nullptr) return nullptr; SetupGameVarsForActor(act); - act->basepicnum = basepicnum; - act->spr.pos = pos; if (s_pn != -1) act->spr.picnum = s_pn; // if -1 use the class default. + setFromSpawnRec(act, info); + act->spr.pos = pos; act->spr.shade = s_shd; if (!scale.isZero()) act->spr.scale = DVector2(scale.X, scale.Y); diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 4648801a6..1b03f8b4e 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -142,28 +142,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* ChangeActorStat(act, 122); break; - case BIKEJIBA: - case BIKEJIBB: - case BIKEJIBC: - case BIKERJIBA: - case BIKERJIBB: - case BIKERJIBC: - case BIKERJIBD: - case CHEERJIBA: - case CHEERJIBB: - case CHEERJIBC: - case CHEERJIBD: - case FBOATJIBA: - case FBOATJIBB: - case RABBITJIBA: - case RABBITJIBB: - case RABBITJIBC: - case MAMAJIBA: - case MAMAJIBB: - // impossible to do with better methods outside of redoing the entire switch/case block - if (isRRRA()) goto rrra_badguy; - else goto default_case; - case WATERSPLASH2: case MUD: if (actj) @@ -204,59 +182,8 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* case DOMELITE: if (act->spr.picnum != WATERSPLASH2) act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL; - if (act->spr.picnum == DOMELITE) - act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL; - [[fallthrough]]; - case JIBS1: - case JIBS2: - case JIBS3: - case JIBS4: - case JIBS5: - case JIBS6: - case DUKETORSO: - case DUKEGUN: - case DUKELEG: - case BILLYJIBA: - case BILLYJIBB: - case HULKJIBA: - case HULKJIBB: - case HULKJIBC: - case MINJIBA: - case MINJIBB: - case MINJIBC: - case COOTJIBA: - case COOTJIBB: - case COOTJIBC: - rrra_badguy: - if (act->spr.picnum == JIBS6) - { - act->spr.scale *= 0.5; - } - else if (isRRRA()) - { - if (act->spr.picnum == RABBITJIBA) - { - act->spr.scale = DVector2(0.28125, 0.28125); - } - else if (act->spr.picnum == RABBITJIBB) - { - act->spr.scale = DVector2(0.5625, 0.5625); - } - else if (act->spr.picnum == RABBITJIBC) - { - act->spr.scale = DVector2(0.84375, 0.84375); - } - } ChangeActorStat(act, STAT_MISC); break; - case TONGUE: - if (actj) - act->spr.Angles.Yaw = actj->spr.Angles.Yaw; - act->spr.pos.Z -= gs.playerheight; - act->vel.Z = 1 - krandf(2); - act->vel.X = 4 - krandf(8); - ChangeActorStat(act, STAT_PROJECTILE); - break; case TRANSPORTERSTAR: case TRANSPORTERBEAM: spawntransporter(actj, act, act->spr.picnum == TRANSPORTERBEAM); diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index afa91c559..fa572be1f 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -978,6 +978,30 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, floorflags, duke_floorflags) ACTION_RETURN_INT(duke_floorflags(sect)); } +int duke_wallflags(walltype* wal) +{ + return tileflags(wal->picnum); +} + +DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, wallflags, duke_wallflags) +{ + PARAM_PROLOGUE; + PARAM_POINTER(sect, walltype); + ACTION_RETURN_INT(duke_wallflags(sect)); +} + +int duke_ismirror(walltype* wal) +{ + return wal->picnum == TILE_MIRROR || wal->overpicnum == TILE_MIRROR; +} + +DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, ismirror, duke_ismirror) +{ + PARAM_PROLOGUE; + PARAM_POINTER(wal, walltype); + ACTION_RETURN_BOOL(duke_ismirror(wal)); +} + DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, addcycler, addcycler) { PARAM_PROLOGUE; @@ -1093,6 +1117,18 @@ DEFINE_ACTION_FUNCTION_NATIVE(_tspritetype, setWeaponOrAmmoSprite, tspritetype_s return 0; } +// this must still work around the lack of proper texture support on the script side. +DEFINE_ACTION_FUNCTION(DDukeGenericDestructible, SetBroken) +{ + PARAM_SELF_STRUCT_PROLOGUE(DDukeActor); + PARAM_INT(bust); + int tilenum = self->IntVar(bust ? NAME_brokenstate : NAME_spawnstate); + if (tilenum > 0) self->spr.picnum = tilenum; + ACTION_RETURN_BOOL(tilenum > 0); +} + + + void spawnguts(DDukeActor* origin, PClass* type, int count) { diff --git a/wadsrc/static/filter/redneck.ridesagain/engine/engine.def b/wadsrc/static/filter/redneck.ridesagain/engine/engine.def index 3c606aa39..710d85907 100644 --- a/wadsrc/static/filter/redneck.ridesagain/engine/engine.def +++ b/wadsrc/static/filter/redneck.ridesagain/engine/engine.def @@ -30,6 +30,393 @@ spawnclasses 7397 = RedneckRabbitJibC 8890 = RedneckMamaJibA 8895 = RedneckMamaJibB + + 8487 = DukeGenericDestructible, "RRTILE8487", "RRTILE8488", "BALLOON" + 8489 = DukeGenericDestructible, "RRTILE8489", "RRTILE8490", "BALLOON" + + /* + case RRTILE8487: + case RRTILE8489: + S_PlayActorSound(471, targ); + targ->spr.picnum++; + break; + case RRTILE7638: + case RRTILE7644: + case RRTILE7646: + case RRTILE7650: + case RRTILE7653: + case RRTILE7655: + case RRTILE7691: + case RRTILE7876: + case RRTILE7881: + case RRTILE7883: + targ->spr.picnum++; + S_PlayActorSound(VENT_BUST, targ); + break; + case RRTILE7879: + targ->spr.picnum++; + S_PlayActorSound(495, targ); + fi.hitradius(targ, 10, 0, 0, 1, 1); + break; + case RRTILE7648: + case RRTILE7694: + case RRTILE7700: + case RRTILE7702: + case RRTILE7711: + targ->spr.picnum++; + S_PlayActorSound(47, targ); + break; + case RRTILE7636: + targ->spr.picnum += 3; + S_PlayActorSound(VENT_BUST, targ); + break; + case RRTILE7875: + targ->spr.picnum += 3; + S_PlayActorSound(VENT_BUST, targ); + break; + case RRTILE7640: + targ->spr.picnum += 2; + S_PlayActorSound(VENT_BUST, targ); + break; + case RRTILE7595: + case RRTILE7704: + targ->spr.picnum = RRTILE7705; + S_PlayActorSound(495, targ); + break; + case RRTILE8579: + targ->spr.picnum = RRTILE5014; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7441: + targ->spr.picnum = RRTILE5016; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7534: + targ->spr.picnum = RRTILE5029; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7545: + targ->spr.picnum = RRTILE5030; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7547: + targ->spr.picnum = RRTILE5031; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7574: + targ->spr.picnum = RRTILE5032; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7575: + targ->spr.picnum = RRTILE5033; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7578: + targ->spr.picnum = RRTILE5034; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7478: + targ->spr.picnum = RRTILE5035; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8525: + targ->spr.picnum = RRTILE5036; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8537: + targ->spr.picnum = RRTILE5062; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8215: + targ->spr.picnum = RRTILE5064; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8216: + targ->spr.picnum = RRTILE5065; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8217: + targ->spr.picnum = RRTILE5066; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8218: + targ->spr.picnum = RRTILE5067; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8220: + targ->spr.picnum = RRTILE5068; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8221: + targ->spr.picnum = RRTILE5069; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8312: + targ->spr.picnum = RRTILE5071; + S_PlayActorSound(472, targ); + break; + case RRTILE8395: + targ->spr.picnum = RRTILE5072; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8423: + targ->spr.picnum = RRTILE5073; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE3462: + targ->spr.picnum = RRTILE5074; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case UWHIP: + targ->spr.picnum = RRTILE5075; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8608: + targ->spr.picnum = RRTILE5083; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8609: + targ->spr.picnum = RRTILE5084; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8567: + case RRTILE8568: + case RRTILE8569: + case RRTILE8570: + case RRTILE8571: + targ->spr.picnum = RRTILE5082; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8640: + targ->spr.picnum = RRTILE5085; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8611: + targ->spr.picnum = RRTILE5086; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case TECHLIGHTBUST2: + targ->spr.picnum = TECHLIGHTBUST4; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8497: + targ->spr.picnum = RRTILE5076; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8162: + case RRTILE8163: + case RRTILE8164: + case RRTILE8165: + case RRTILE8166: + case RRTILE8167: + case RRTILE8168: + ChangeActorStat(targ, STAT_MISC); + targ->spr.picnum = RRTILE5063; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8589: + case RRTILE8590: + case RRTILE8591: + case RRTILE8592: + case RRTILE8593: + case RRTILE8594: + case RRTILE8595: + ChangeActorStat(targ, STAT_MISC); + targ->spr.picnum = RRTILE8588; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE3497: + targ->spr.picnum = RRTILE5076; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE3498: + targ->spr.picnum = RRTILE5077; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE3499: + targ->spr.picnum = RRTILE5078; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8503: + targ->spr.picnum = RRTILE5079; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7901: + targ->spr.picnum = RRTILE5080; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7696: + targ->spr.picnum = RRTILE7697; + S_PlayActorSound(DUKE_SHUCKS, targ); + break; + case RRTILE7806: + targ->spr.picnum = RRTILE5043; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7885: + case RRTILE7890: + targ->spr.picnum = RRTILE5045; + S_PlayActorSound(495, targ); + fi.hitradius(targ, 10, 0, 0, 1, 1); + break; + case RRTILE7886: + targ->spr.picnum = RRTILE5046; + S_PlayActorSound(495, targ); + fi.hitradius(targ, 10, 0, 0, 1, 1); + break; + case RRTILE7887: + targ->spr.picnum = RRTILE5044; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + fi.hitradius(targ, 10, 0, 0, 1, 1); + break; + case RRTILE7900: + targ->spr.picnum = RRTILE5047; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7906: + targ->spr.picnum = RRTILE5048; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7912: + case RRTILE7913: + targ->spr.picnum = RRTILE5049; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8047: + targ->spr.picnum = RRTILE5050; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8596: + targ->spr.picnum = RRTILE8598; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8059: + targ->spr.picnum = RRTILE5051; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8060: + targ->spr.picnum = RRTILE5052; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8222: + targ->spr.picnum = RRTILE5053; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8223: + targ->spr.picnum = RRTILE5054; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8224: + targ->spr.picnum = RRTILE5055; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8370: + targ->spr.picnum = RRTILE5056; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8371: + targ->spr.picnum = RRTILE5057; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8372: + targ->spr.picnum = RRTILE5058; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8373: + targ->spr.picnum = RRTILE5059; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8396: + targ->spr.picnum = RRTILE5038; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8397: + targ->spr.picnum = RRTILE5039; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8398: + targ->spr.picnum = RRTILE5040; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8399: + targ->spr.picnum = RRTILE5041; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8385: + targ->spr.picnum = RRTILE8386; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8387: + targ->spr.picnum = RRTILE8388; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8389: + targ->spr.picnum = RRTILE8390; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8391: + targ->spr.picnum = RRTILE8392; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE7553: + targ->spr.picnum = RRTILE5035; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8475: + targ->spr.picnum = RRTILE5075; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8498: + targ->spr.picnum = RRTILE5077; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE8499: + targ->spr.picnum = RRTILE5078; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE2445: + targ->spr.picnum = RRTILE2450; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE2123: + targ->spr.picnum = RRTILE2124; + S_PlayActorSound(GLASS_BREAKING, targ); + lotsofglass(targ, nullptr, 10); + break; + case RRTILE3773: + targ->spr.picnum = RRTILE8651; + S_PlayActorSound(GLASS_BREAKING, targ); + lotsofglass(targ, nullptr, 10); + break; + case RRTILE7533: + targ->spr.picnum = RRTILE5035; + S_PlayActorSound(495, targ); + fi.hitradius(targ, 10, 0, 0, 1, 1); + break; + case RRTILE8394: + targ->spr.picnum = RRTILE5072; + S_PlayActorSound(495, targ); + break; + case RRTILE8461: + case RRTILE8462: + targ->spr.picnum = RRTILE5074; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE3584: + targ->spr.picnum = RRTILE8681; + S_PlayActorSound(495, targ); + fi.hitradius(targ, 250, 0, 0, 1, 1); + break; + case RRTILE8682: + targ->spr.picnum = RRTILE8683; + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + break; + case RRTILE2437: + S_PlayActorSound(439, targ); + break; + +} +*/ } tileflag TFLAG_WALLSWITCH { diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index ce7ba619f..07a4ef15f 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -75,6 +75,7 @@ version "4.10" #include "zscript/games/duke/actors/canwithsomething.zs" #include "zscript/games/duke/actors/tongue.zs" +#include "zscript/games/duke/actors/genericdestructible.zs" #include "zscript/games/duke/actors/rabbitspawner.zs" #include "zscript/games/duke/actors/chickenplant.zs" #include "zscript/games/duke/actors/lumberblade.zs" diff --git a/wadsrc/static/zscript/games/duke/actors/genericdestructible.zs b/wadsrc/static/zscript/games/duke/actors/genericdestructible.zs new file mode 100644 index 000000000..6808be5d3 --- /dev/null +++ b/wadsrc/static/zscript/games/duke/actors/genericdestructible.zs @@ -0,0 +1,190 @@ + + +class DukeGenericDestructible : DukeActor +{ + TextureID spawnstate, brokenstate; + Sound breaksound; + bool broken; + + native bool SetBroken(bool bust); // sets broken texture. Must be done natively as long as we do not have proper texture support. + + virtual bool DestroyAction() { return false; } // for customized subclasses + + override void Initialize() + { + self.SetBroken(false); + } + + override void OnHit(DukeActor proj) + { + if (broken) return; + + broken = true; + bool res1 = self.SetBroken(true); + bool res2 = DestroyAction(); + if (res1 || res2) + self.Destroy(); + } +} + +class DukeGenericDamagingDestructible : DukeGenericDestructible +{ + override bool DestroyAction() + { + self.hitradius(10, 0, 0, 1, 1); + return false; + } +} + +class DukeGenericGlassSpawningDestructible : DukeGenericDestructible +{ + override bool DestroyAction() + { + self.lotsofglass(10); + return false; + } +} + +class DukeGenericUnblockingDestructible : DukeGenericDestructible +{ + override bool DestroyAction() + { + self.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; + return false; + } +} + +/* +// todo: RRRA + + +// RR + + case RRTILE3114: + targ->spr.picnum = RRTILE3117; + break; + case RRTILE2876: + targ->spr.picnum = RRTILE2990; + break; + case RRTILE3152: + targ->spr.picnum = RRTILE3218; + break; + case RRTILE3153: + targ->spr.picnum = RRTILE3219; + break; + case RRTILE2030: + targ->spr.picnum = RRTILE2034; + S_PlayActorSound(GLASS_BREAKING, targ); + lotsofglass(targ, nullptr, 10); + break; + case RRTILE2893: + case RRTILE2915: + case RRTILE3115: + case RRTILE3171: + switch (targ->spr.picnum) + { + case RRTILE2915: + targ->spr.picnum = RRTILE2977; + break; + case RRTILE2893: + targ->spr.picnum = RRTILE2978; + break; + case RRTILE3115: + targ->spr.picnum = RRTILE3116; + break; + case RRTILE3171: + targ->spr.picnum = RRTILE3216; + break; + } + S_PlayActorSound(GLASS_BREAKING, targ); + lotsofglass(targ, nullptr, 10); + break; + case RRTILE2156: + case RRTILE2158: + case RRTILE2160: + case RRTILE2175: + targ->spr.picnum++; + S_PlayActorSound(GLASS_BREAKING, targ); + lotsofglass(targ, nullptr, 10); + break; + + case RRTILE2654: + case RRTILE2656: + case RRTILE3172: + if (!isRRRA()) break; + S_PlayActorSound(GLASS_BREAKING, targ); + lotsofglass(targ, nullptr, 10); + targ->Destroy(); + break; + case GRATE1: + targ->spr.picnum = BGRATE1; + targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; + S_PlayActorSound(VENT_BUST, targ); + break; + + case CIRCLEPANNEL: + targ->spr.picnum = CIRCLEPANNELBROKE; + targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; + S_PlayActorSound(VENT_BUST, targ); + break; + ++ + case GRATE1: + targ->spr.picnum = BGRATE1; + targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; + S_PlayActorSound(VENT_BUST, targ); + break; + + case CIRCLEPANNEL: + targ->spr.picnum = CIRCLEPANNELBROKE; + targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; + S_PlayActorSound(VENT_BUST, targ); + break; + + +Duke + + case GRATE1: + targ->spr.picnum = BGRATE1; + targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; + S_PlayActorSound(VENT_BUST, targ); + break; + + case CIRCLEPANNEL: + targ->spr.picnum = CIRCLEPANNELBROKE; + targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; + S_PlayActorSound(VENT_BUST, targ); + break; + case PANNEL1: + case PANNEL2: + targ->spr.picnum = BPANNEL1; + targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; + S_PlayActorSound(VENT_BUST, targ); + break; + case PANNEL3: + targ->spr.picnum = BPANNEL3; + targ->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; + S_PlayActorSound(VENT_BUST, targ); + break; + + + case CHAIR1: + case CHAIR2: + targ->spr.picnum = BROKENCHAIR; + targ->spr.cstat = 0; + break; + case CHAIR3: + case MOVIECAMERA: + case SCALE: + case VACUUM: + case CAMERALIGHT: + case IVUNIT: + case POT1: + case POT2: + case POT3: + case TRIPODCAMERA: + S_PlayActorSound(GLASS_HEAVYBREAK, targ); + for (j = 0; j < 16; j++) RANDOMSCRAP(targ); + targ->Destroy(); + break; +*/ diff --git a/wadsrc/static/zscript/games/duke/actors/jibs.zs b/wadsrc/static/zscript/games/duke/actors/jibs.zs index 6e6341ed8..64d2f8a9e 100644 --- a/wadsrc/static/zscript/games/duke/actors/jibs.zs +++ b/wadsrc/static/zscript/games/duke/actors/jibs.zs @@ -252,6 +252,11 @@ class DukeJibs6 : DukeJibs1 { spritesetindex 1; } + + override void Initialize() + { + if (Raze.isRR()) self.scale *= 0.5; // only RR needs this. + } } class DukeHeadJib1 : DukeJibs1 @@ -544,6 +549,8 @@ class RedneckRabbitJibA : DukeJibs1 default { pic "RABBITJIBA"; + ScaleX 0.28125; + ScaleY 0.28125; } } @@ -552,6 +559,8 @@ class RedneckRabbitJibB : DukeJibs1 default { pic "RABBITJIBB"; + ScaleX 0.5625; + ScaleY 0.5625; } } @@ -560,6 +569,8 @@ class RedneckRabbitJibC : DukeJibs1 default { pic "RABBITJIBC"; + ScaleX 0.84375; + ScaleY 0.84375; } } diff --git a/wadsrc/static/zscript/games/duke/dukeactor.zs b/wadsrc/static/zscript/games/duke/dukeactor.zs index 235753aa4..b4a5d1fac 100644 --- a/wadsrc/static/zscript/games/duke/dukeactor.zs +++ b/wadsrc/static/zscript/games/duke/dukeactor.zs @@ -221,11 +221,13 @@ struct DukeLevel native static void operatemasterswitches(int lotag); native static void operateactivators(int lotag, DukePlayer p); native static int floorflags(sectortype s); + native static int wallflags(walltype s); native static void AddCycler(sectortype sector, int lotag, int shade, int shade2, int hitag, int state); native static void addtorch(sectortype sector, int shade, int lotag); native static void addlightning(sectortype sector, int shade); native static int addambient(int hitag, int lotag); native static void resetswitch(int tag); // + native bool isMirror(walltype wal); } struct DukeStatIterator @@ -305,4 +307,12 @@ enum sflags2_t SFLAG2_ALWAYSROTATE1 = 0x00001000, SFLAG2_DIENOW = 0x00002000, SFLAG2_TRANFERPALTOJIBS = 0x00004000, + SFLAG2_NORADIUSPUSH = 0x00008000, + SFLAG2_FREEZEDAMAGE = 0x00010000, + SFLAG2_REFLECTIVE = 0x00020000, + SFLAG2_SPAWNRABBITGUTS = 0x00040000, // this depends on the shooter, not the projectile so it has to be done with a flag. + SFLAG2_NONSMOKYROCKET = 0x00080000, // same with this one. Flags should later be copied to the projectile once posible. + SFLAG2_MIRRORREFLECT = 0x00100000, + SFLAG2_NOCIRCLEREFLECT = 0x00200000, // yet another shooter flag. :( + SFLAG2_UNDERWATERSLOWDOWN = 0x00400000, };