From 8487d693f5cd9268f4d9dac0337e782022827483 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 21 Jan 2022 14:02:59 +0100 Subject: [PATCH] - flags for the bolts. --- source/games/duke/src/actors_d.cpp | 4 ++-- source/games/duke/src/actors_r.cpp | 2 +- source/games/duke/src/constants.h | 7 +++++-- source/games/duke/src/dispatch.cpp | 3 --- source/games/duke/src/flags_d.cpp | 6 +++--- source/games/duke/src/flags_r.cpp | 6 +++--- source/games/duke/src/names.h | 3 --- source/games/duke/src/player.cpp | 2 +- source/games/duke/src/player_d.cpp | 2 +- source/games/duke/src/player_r.cpp | 2 +- source/games/duke/src/premap.cpp | 2 +- 11 files changed, 18 insertions(+), 21 deletions(-) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 2f0f28a62..6dd29cf93 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1101,7 +1101,7 @@ CLEAR_THE_BOLT2: } actor->spr.picnum++; - if ((krand() & 1) && sectp->floorpicnum == HURTRAIL) + if ((krand() & 1) && (gs.tileinfo[sectp->floorpicnum].flags & TFLAG_ELECTRIC)) S_PlayActorSound(SHORT_CIRCUIT, actor); if (actor->spr.picnum == SIDEBOLT1 + 4) actor->spr.picnum = SIDEBOLT1; @@ -1152,7 +1152,7 @@ CLEAR_THE_BOLT: if (l & 1) actor->spr.cstat ^= CSTAT_SPRITE_TRANSLUCENT; - if (actor->spr.picnum == (BOLT1+1) && (krand()&7) == 0 && sectp->floorpicnum == HURTRAIL) + if (actor->spr.picnum == (BOLT1+1) && (krand()&7) == 0 && (gs.tileinfo[sectp->floorpicnum].flags & TFLAG_ELECTRIC)) S_PlayActorSound(SHORT_CIRCUIT,actor); if (actor->spr.picnum==BOLT1+4) actor->spr.picnum=BOLT1; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index ff4bf8a72..6b98d0d56 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -794,7 +794,7 @@ CLEAR_THE_BOLT: if (l & 1) actor->spr.cstat ^= CSTAT_SPRITE_TRANSLUCENT; - if (actor->spr.picnum == (BOLT1 + 1) && (krand() & 1) && sectp->floorpicnum == HURTRAIL) + if (actor->spr.picnum == (BOLT1 + 1) && (krand() & 1) && (gs.tileinfo[sectp->floorpicnum].flags & TFLAG_ELECTRIC)) S_PlayActorSound(SHORT_CIRCUIT, actor); if (actor->spr.picnum == BOLT1 + 4) actor->spr.picnum = BOLT1; diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index 5f5148130..24a05aa4c 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -349,8 +349,11 @@ DEFINE_TFLAGS_OPERATORS(EDukeFlags2) enum { - TFLAG_WALLSWITCH = 1, - TFLAG_ADULT = 2, + TFLAG_WALLSWITCH = 1, + TFLAG_ADULT = 2, + TFLAG_ELECTRIC = 4, + TFLAG_CLEARINVENTORY = 8, // really dumb Duke stuff... + TFLAG_SLIME = 16, }; enum diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index e6e563a6a..23e5e7405 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -212,7 +212,6 @@ int TILE_BOTTOMSTATUSBAR; int TILE_THREEDEE; int TILE_INGAMEDUKETHREEDEE; int TILE_ATOMICHEALTH; -int TILE_FLOORSLIME; int TILE_JIBS6; int TILE_FIRE; int TILE_WATERBUBBLE; @@ -237,8 +236,6 @@ int TILE_LA; int TILE_LOADSCREEN; int TILE_CROSSHAIR; int TILE_BIGORBIT1; -int TILE_HURTRAIL; -int TILE_FLOORPLASMA; int TILE_EGG; END_DUKE_NS diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index 769041f6e..158bcef5d 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -144,6 +144,9 @@ void initactorflags_d() 4498, 4957 }); + settileflag(TFLAG_ELECTRIC, { HURTRAIL }); + settileflag(TFLAG_CLEARINVENTORY, { HURTRAIL, FLOORSLIME, FLOORPLASMA }); + settileflag(TFLAG_SLIME, { FLOORSLIME, FLOORSLIME + 1, FLOORSLIME + 2 }); gs.actorinfo[COMMANDER].gutsoffset = -(24 << 8); @@ -324,7 +327,6 @@ void initactorflags_d() TILE_STATIC = STATIC; TILE_BOTTOMSTATUSBAR = isWorldTour()? WIDESCREENSTATUSBAR : BOTTOMSTATUSBAR; TILE_ATOMICHEALTH = ATOMICHEALTH; - TILE_FLOORSLIME = FLOORSLIME; TILE_JIBS6 = JIBS6; TILE_FIRE = FIRE; TILE_WATERBUBBLE = WATERBUBBLE; @@ -347,8 +349,6 @@ void initactorflags_d() TILE_LOADSCREEN = LOADSCREEN; TILE_CROSSHAIR = CROSSHAIR; TILE_BIGORBIT1 = BIGORBIT1; - TILE_HURTRAIL = HURTRAIL; - TILE_FLOORPLASMA = FLOORPLASMA; TILE_EGG = EGG; } diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index 4c1157dad..562cf09ff 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -106,6 +106,9 @@ void initactorflags_r() DOLPHIN2, TOUGHGAL }); + settileflag(TFLAG_ELECTRIC, { HURTRAIL }); + settileflag(TFLAG_CLEARINVENTORY, { HURTRAIL, FLOORSLIME, FLOORPLASMA }); + settileflag(TFLAG_SLIME, { FLOORSLIME, FLOORSLIME + 1, FLOORSLIME + 2 }); for (auto& fa : gs.actorinfo) { @@ -296,7 +299,6 @@ void initactorflags_r() TILE_STATIC = STATIC; TILE_BOTTOMSTATUSBAR = BOTTOMSTATUSBAR; TILE_ATOMICHEALTH = ATOMICHEALTH; - TILE_FLOORSLIME = FLOORSLIME; TILE_JIBS6 = JIBS6; TILE_FIRE = FIRE; TILE_WATERBUBBLE = WATERBUBBLE; @@ -319,8 +321,6 @@ void initactorflags_r() TILE_LOADSCREEN = LOADSCREEN; TILE_CROSSHAIR = CROSSHAIR; TILE_BIGORBIT1 = BIGORBIT1; - TILE_HURTRAIL = HURTRAIL; - TILE_FLOORPLASMA = FLOORPLASMA; TILE_EGG = EGG; gs.playerheight = PHEIGHT_RR; diff --git a/source/games/duke/src/names.h b/source/games/duke/src/names.h index 3832f3408..d594cdd46 100644 --- a/source/games/duke/src/names.h +++ b/source/games/duke/src/names.h @@ -21,7 +21,6 @@ extern int TILE_CAMLIGHT; extern int TILE_STATIC; extern int TILE_BOTTOMSTATUSBAR; extern int TILE_ATOMICHEALTH; -extern int TILE_FLOORSLIME; extern int TILE_JIBS6; extern int TILE_FIRE; extern int TILE_WATERBUBBLE; @@ -46,8 +45,6 @@ extern int TILE_LA; extern int TILE_LOADSCREEN; extern int TILE_CROSSHAIR; extern int TILE_BIGORBIT1; -extern int TILE_HURTRAIL; -extern int TILE_FLOORPLASMA; extern int TILE_EGG; diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index f81a3e6d8..21cb6daef 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -84,7 +84,7 @@ int setpal(struct player_struct* p) if (p->DrugMode) palette = DRUGPAL; else if (p->heat_on) palette = SLIMEPAL; else if (!p->insector()) palette = BASEPAL; // don't crash if out of range. - else if (p->cursector->ceilingpicnum >= TILE_FLOORSLIME && p->cursector->ceilingpicnum <= TILE_FLOORSLIME + 2) palette = SLIMEPAL; + else if (gs.tileinfo[p->cursector->ceilingpicnum].flags & TFLAG_SLIME) palette = SLIMEPAL; else if (p->cursector->lotag == ST_2_UNDERWATER) palette = WATERPAL; else palette = BASEPAL; return palette; diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 17271e441..e3ee797d5 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2920,7 +2920,7 @@ void processinput_d(int snum) if (p->on_ground && truefdist <= gs.playerheight + (16 << 8)) { - int whichsound = j == HURTRAIL ? 0 : j == FLOORSLIME ? 1 : j == FLOORPLASMA ? 2 : -1; + int whichsound = (gs.tileinfo[j].flags & TFLAG_ELECTRIC) ? 0 : j == FLOORSLIME ? 1 : j == FLOORPLASMA ? 2 : -1; if (j >= 0) k = makepainsounds(snum, whichsound); } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 1dadf5e64..00f08af18 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3630,7 +3630,7 @@ void processinput_r(int snum) if (p->on_ground && truefdist <= gs.playerheight + (16 << 8)) { - int whichsound = j == HURTRAIL ? 0 : j == FLOORSLIME ? 1 : j == FLOORPLASMA ? 2 : + int whichsound = (gs.tileinfo[j].flags & TFLAG_ELECTRIC) ? 0 : j == FLOORSLIME ? 1 : j == FLOORPLASMA ? 2 : (isRRRA() && (j == RRTILE7768 || j == RRTILE7820) ? 3 : -1); if (j >= 0) k = makepainsounds(snum, whichsound); } diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 5f946af22..c0d8729ad 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -1049,7 +1049,7 @@ void enterlevel(MapRecord *mi, int gamemode) { bool clearweapon = !!(currentLevel->flags & LEVEL_CLEARWEAPONS); int pn = ps[i].GetActor()->sector()->floorpicnum; - if (pn == TILE_HURTRAIL || pn == TILE_FLOORSLIME || pn == TILE_FLOORPLASMA) + if (gs.tileinfo[pn].flags & TFLAG_CLEARINVENTORY) { resetinventory(i); clearweapon = true;