From 4a306a21dcdd231c564e8f694be5a27b58c4b37f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 9 Dec 2022 00:44:48 +0100 Subject: [PATCH] - split several texture flags off into a surface type value. Using the same field in the TexExtInfo struct as Blood's surfType. This frees up a lot of flags for later use. --- source/core/g_mapinfo.cpp | 47 +++++++++++++++++++ source/core/g_mapinfo.h | 1 + source/core/textures/texinfo.h | 10 ++++ source/games/duke/src/actors_d.cpp | 5 ++ source/games/duke/src/actors_lava.cpp | 4 +- source/games/duke/src/actors_r.cpp | 6 +-- source/games/duke/src/animatesprites_d.cpp | 2 +- source/games/duke/src/animatesprites_r.cpp | 2 +- source/games/duke/src/constants.h | 29 ++++++++---- source/games/duke/src/funct.h | 1 + source/games/duke/src/gameexec.cpp | 2 +- source/games/duke/src/inlines.h | 5 -- source/games/duke/src/namelist_r.h | 6 +-- source/games/duke/src/player.cpp | 4 +- source/games/duke/src/player_d.cpp | 9 ++-- source/games/duke/src/player_r.cpp | 10 ++-- source/games/duke/src/prediction.cpp | 2 +- source/games/duke/src/premap.cpp | 10 +++- source/games/duke/src/premap_r.cpp | 2 - source/games/duke/src/sectors.cpp | 4 +- source/games/duke/src/vmexports.cpp | 24 ++++++++++ wadsrc/static/filter/dukeengine/constants.mi | 33 ++++++++----- .../static/filter/dukelike/rmapinfo.texflags | 15 ++++-- .../redneck.ridesagain/rmapinfo.texflags | 6 ++- .../static/filter/redneck/rmapinfo.texflags | 20 +++++--- .../static/zscript/games/duke/actors/bolt.zs | 4 +- .../zscript/games/duke/actors/watersplash.zs | 4 +- wadsrc/static/zscript/games/duke/dukeactor.zs | 2 + wadsrc/static/zscript/games/duke/dukegame.zs | 31 +++++++----- wadsrc/static/zscript/razebase.zs | 2 + 30 files changed, 216 insertions(+), 86 deletions(-) diff --git a/source/core/g_mapinfo.cpp b/source/core/g_mapinfo.cpp index 76eb63f2b..db44f8862 100644 --- a/source/core/g_mapinfo.cpp +++ b/source/core/g_mapinfo.cpp @@ -525,6 +525,49 @@ void FMapInfoParser::ParseTextureFlags() // //========================================================================== +void FMapInfoParser::ParseSurfaceTypes() +{ + int num = -1; + + // this block deliberately uses a 'type = texture, texture...' syntax because it is a lot easier to handle than doing the reverse + sc.MustGetStringName("{"); + while (!sc.CheckString("}")) + { + // Do not use internal lookup here because this code must be able to gracefully skip the definition if the flag constant does not exist. + // This also blocks passing in literal numbers which is quite intentional. + sc.MustGetString(); + FName cname(sc.String, true); + auto lookup = cname == NAME_None ? nullptr : sc.LookupSymbol(cname); + num = 0; + if (lookup) num = int(lookup->Number); + else + sc.ScriptMessage("'%s': Unknown surface type", sc.String); + ParseAssign(); + do + { + sc.MustGetString(); + // this must also get null textures and ones not yet loaded. + auto tex = TexMan.CheckForTexture(sc.String, ETextureType::Any, FTextureManager::TEXMAN_ReturnAll | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ForceLookup); + + if (!tex.isValid()) + { + sc.ScriptMessage("textureflags:Unknown texture name '%s'", sc.String); + } + else + { + AccessExtInfo(tex).surftype = num; + } + + } while (sc.CheckString(",")); + } +} + +//========================================================================== +// +// +// +//========================================================================== + void FMapInfoParser::ParseCutscene(CutsceneDef& cdef) { FString sound; @@ -1580,6 +1623,10 @@ void FMapInfoParser::ParseMapInfo (int lump, MapRecord &gamedefaults, MapRecord { ParseTextureFlags(); } + else if (sc.Compare("surfacetypes")) + { + ParseSurfaceTypes(); + } else if (sc.Compare("constants")) { ParseConstants(); diff --git a/source/core/g_mapinfo.h b/source/core/g_mapinfo.h index f3e55018a..c0aecdaa1 100644 --- a/source/core/g_mapinfo.h +++ b/source/core/g_mapinfo.h @@ -94,6 +94,7 @@ struct FMapInfoParser void ParseBreakWall(); void ParseBreakCeiling(); void ParseTextureFlags(); + void ParseSurfaceTypes(); void ParseConstants(); void ParseMapInfo (int lump, MapRecord &gamedefaults, MapRecord &defaultinfo); diff --git a/source/core/textures/texinfo.h b/source/core/textures/texinfo.h index 0841e51b3..3e04ee4da 100644 --- a/source/core/textures/texinfo.h +++ b/source/core/textures/texinfo.h @@ -142,3 +142,13 @@ inline const TileOffs* GetHiresOffset(FTextureID tex) else return nullptr; } +inline const unsigned tileflags(FTextureID texid) +{ + return GetExtInfo(texid).flags; +} + +inline const uint8_t tilesurface(FTextureID texid) +{ + return GetExtInfo(texid).surftype; +} + diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 389a9472c..be13cac56 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1753,6 +1753,11 @@ void think_d(void) doanimations(); tickstat(STAT_FX); //ST 11 +#if 0 // still needs a bit of work. + if (numplayers < 2 && thunderon) + thunder(); +#endif + thinktime.Unclock(); } diff --git a/source/games/duke/src/actors_lava.cpp b/source/games/duke/src/actors_lava.cpp index c9ef08a81..adf75ad6d 100644 --- a/source/games/duke/src/actors_lava.cpp +++ b/source/games/duke/src/actors_lava.cpp @@ -477,9 +477,9 @@ void thunder(void) thunder_brightness = brightness; } } - if (!winderflash) + if (!winderflash && isRR()) { - auto tex = tileGetTexture(RTILE_RRTILE2562); + auto tex = tileGetTexture(RTILE_CATACOMB); // this cannot be easily generalized. :( if (tex->isSeen(true)) { if (krand() > 65000) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 87e1d80c9..75d87bd73 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1787,7 +1787,7 @@ static int fallspecial(DDukeActor *actor, int playernum) actor->attackertype = RTILE_SHOTSPARK1; actor->hitextra = 1; } - else if (isRRRA() && (actor->sector()->floorpicnum == RTILE_RRTILE7820 || actor->sector()->floorpicnum == RTILE_RRTILE7768)) + else if (tilesurface(actor->sector()->floortexture()) == TSURF_MAGMA) { if (actor->spr.picnum != RTILE_MINION && actor->spr.pal != 19) { @@ -1885,7 +1885,7 @@ void destroyit(DDukeActor *actor) destsect->ceilingpal = srcsect->ceilingpal; destsect->ceilingxpan_ = srcsect->ceilingxpan_; destsect->ceilingypan_ = srcsect->ceilingypan_; - destsect->floorpicnum = srcsect->floorpicnum; + destsect->setfloortexture(srcsect->floortexture()); destsect->floorheinum = srcsect->floorheinum; destsect->floorshade = srcsect->floorshade; destsect->floorpal = srcsect->floorpal; @@ -1943,8 +1943,6 @@ bool spawnweapondebris_r(int picnum) // //--------------------------------------------------------------------------- -void thunder(void); - void think_r(void) { thinktime.Reset(); diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index ee39b3137..b051b3851 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -276,7 +276,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi break; case DTILE_WATERBUBBLE: - if (t->sectp->floorpicnum == DTILE_FLOORSLIME) + if (tilesurface(t->sectp->floortexture()) == TSURF_SLIME) { t->pal = 7; break; diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index b1ed4ead6..5838975c3 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -325,7 +325,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi break; case RTILE_WATERBUBBLE: - if (t->sectp->floorpicnum == RTILE_FLOORSLIME) + if (tilesurface(t->sectp->floortexture()) == TSURF_SLIME) { t->pal = 7; break; diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index ea60b78a9..c7347de6c 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -417,16 +417,25 @@ enum { TFLAG_WALLSWITCH = 1 << 0, TFLAG_ADULT = 1 << 1, - TFLAG_ELECTRIC = 1 << 2, - TFLAG_CLEARINVENTORY = 1 << 3, // really dumb Duke stuff... - TFLAG_SLIME = 1 << 4, - TFLAG_DOORWALL = 1 << 5, - TFLAG_BLOCKDOOR = 1 << 6, - TFLAG_OUTERSPACE = 1 << 7, - TFLAG_NOBLOODSPLAT = 1 << 8, - TFLAG_NOCIRCLEREFLECT = 1 << 9, - TFLAG_MUDDY = 1 << 10, - TFLAG_PURPLELAVA = 1 << 11, // very special kind of terrain type. + TFLAG_CLEARINVENTORY = 1 << 2, // really dumb Duke stuff... + TFLAG_DOORWALL = 1 << 3, + TFLAG_BLOCKDOOR = 1 << 4, + TFLAG_NOBLOODSPLAT = 1 << 5, + TFLAG_NOCIRCLEREFLECT = 1 << 6, +}; + +enum +{ + TSURF_NONE = 0, + TSURF_ELECTRIC = 1, + TSURF_SLIME = 2, + TSURF_OUTERSPACE = 3, + TSURF_MUDDY = 4, + TSURF_PURPLELAVA = 5, // very special kind of terrain type. + TSURF_SCROLLSKY = 6, + TSURF_THUNDERSKY = 7, + TSURF_PLASMA = 8, + TSURF_MAGMA = 9, }; enum diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 027676062..720d86e45 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -219,6 +219,7 @@ void PlayerColorChanged(void); bool movementBlocked(player_struct *p); void loadcons(); void DrawStatusBar(); +void thunder(void); void drawshadows(tspriteArray& tsprites, tspritetype* t, DDukeActor* h); void applyanimations(tspritetype* t, DDukeActor* h, const DVector2& viewVec, DAngle viewang); diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index f3bcb1aa6..423ac4c5b 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -2296,7 +2296,7 @@ int ParseState::parse(void) parseifelse(ud.coop || numplayers > 2); break; case concmd_ifonmud: - parseifelse(abs(g_ac->spr.pos.Z - g_ac->sector()->floorz) < 32 && (tileflags(g_ac->sector()->floortexture()) & TFLAG_MUDDY) != 0); + parseifelse(abs(g_ac->spr.pos.Z - g_ac->sector()->floorz) < 32 && (tilesurface(g_ac->sector()->floortexture()) == TSURF_MUDDY) != 0); break; case concmd_ifonwater: parseifelse( abs(g_ac->spr.pos.Z-g_ac->sector()->floorz) < 32 && g_ac->sector()->lotag == ST_1_ABOVE_WATER); diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 6f1efa6a2..e7eacdfe9 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -120,11 +120,6 @@ inline bool inventory(DDukeActor* S) return actorflag(S, SFLAG_INVENTORY); } -inline const unsigned& tileflags(FTextureID texid) -{ - return GetExtInfo(texid).flags; -} - inline bool wallswitchcheck(DDukeActor* s) { return !!(tileflags(s->spr.spritetexture()) & TFLAG_WALLSWITCH); diff --git a/source/games/duke/src/namelist_r.h b/source/games/duke/src/namelist_r.h index 98e04251c..657e8d9bf 100644 --- a/source/games/duke/src/namelist_r.h +++ b/source/games/duke/src/namelist_r.h @@ -767,7 +767,7 @@ x(ORDERING, 2531) x(TEXTSTORY, 2541) x(LOADSCREEN, 2542) y(RRTILE2560, 2560) -y(RRTILE2562, 2562) +y(CATACOMB, 2562) y(RRTILE2564, 2564) y(RRTILE2573, 2573) y(RRTILE2574, 2574) @@ -1261,9 +1261,9 @@ y(HOTELSIGN, 7711) y(HOTELSIGNBROKE, 7712) y(RRTILE7716, 7716) y(RRTILE7756, 7756) -y(RRTILE7768, 7768) +y(MAGMA1, 7768) y(RRTILE7806, 7806) -y(RRTILE7820, 7820) +y(MAGMA2, 7820) y(RRTILE7859, 7859) y(RRTILE7870, 7870) y(RRTILE7873, 7873) diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index aa6cb48e3..830bcd4db 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -84,7 +84,7 @@ int setpal(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 (tileflags(p->cursector->ceilingtexture()) & TFLAG_SLIME) palette = SLIMEPAL; + else if (tilesurface(p->cursector->ceilingtexture()) == TSURF_SLIME) palette = SLIMEPAL; else if (p->cursector->lotag == ST_2_UNDERWATER) palette = WATERPAL; else palette = BASEPAL; return palette; @@ -1003,7 +1003,7 @@ void purplelavacheck(player_struct* p) { auto sect = pact->sector(); // one texflag for a single texture again, just to avoid one hard coded check... - if ((tileflags(sect->floortexture()) & TFLAG_PURPLELAVA) || (tileflags(sect->ceilingtexture()) & TFLAG_PURPLELAVA)) + if ((tilesurface(sect->floortexture()) & TSURF_PURPLELAVA) || (tilesurface(sect->ceilingtexture()) & TSURF_PURPLELAVA)) { if (p->boot_amount > 0) { diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 792742fce..2434fb72b 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -1756,7 +1756,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo p->dummyplayersprite = spawn(pact, DTILE_PLAYERONWATER); p->footprintcount = 6; - if (p->cursector->floorpicnum == DTILE_FLOORSLIME) + if (tilesurface(p->cursector->floortexture()) == TSURF_SLIME) p->footprintpal = 8; else p->footprintpal = 0; p->footprintshade = 0; @@ -2888,14 +2888,13 @@ void processinput_d(int snum) if (p->spritebridge == 0 && pact->insector()) { auto sect = pact->sector(); - k = 0; if (p->on_ground && truefdist <= gs.playerheight + 16) { - int j = sect->floorpicnum; - int whichsound = (tileflags(tileGetTextureID(j)) & TFLAG_ELECTRIC) ? 0 : j == DTILE_FLOORSLIME ? 1 : j == DTILE_FLOORPLASMA ? 2 : -1; - if (j >= 0) k = makepainsounds(snum, whichsound); + int surface = tilesurface(sect->floortexture()); + int whichsound = surface == TSURF_ELECTRIC? 0 : surface == TSURF_SLIME? 1 : surface == TSURF_PLASMA? 2 : -1; + k = makepainsounds(snum, whichsound); } if (k) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 874599677..78a105fec 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -2002,7 +2002,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo p->dummyplayersprite = spawn(pact, RTILE_PLAYERONWATER); p->footprintcount = 6; - if (p->cursector->floorpicnum == RTILE_FLOORSLIME) + if (tilesurface(p->cursector->floortexture()) == TSURF_SLIME) { p->footprintpal = 8; p->footprintshade = 0; @@ -3498,14 +3498,14 @@ void processinput_r(int snum) if (p->spritebridge == 0 && pact->insector()) { - int j = pact->sector()->floorpicnum; + auto sect = pact->sector(); k = 0; if (p->on_ground && truefdist <= gs.playerheight + 16) { - int whichsound = (tileflags(tileGetTextureID(j)) & TFLAG_ELECTRIC) ? 0 : j == RTILE_FLOORSLIME ? 1 : j == RTILE_FLOORPLASMA ? 2 : - (isRRRA() && (j == RTILE_RRTILE7768 || j == RTILE_RRTILE7820) ? 3 : -1); - if (j >= 0) k = makepainsounds(snum, whichsound); + int surface = tilesurface(sect->floortexture()); + int whichsound = surface == TSURF_ELECTRIC ? 0 : surface == TSURF_SLIME ? 1 : surface == TSURF_PLASMA ? 2 : surface == TSURF_MAGMA ? 3 : -1; + k = makepainsounds(snum, whichsound); } if (k) diff --git a/source/games/duke/src/prediction.cpp b/source/games/duke/src/prediction.cpp index 1acb23948..cbc2da886 100644 --- a/source/games/duke/src/prediction.cpp +++ b/source/games/duke/src/prediction.cpp @@ -123,7 +123,7 @@ void fakedomovethings(void) shrunk = (p->GetActor()->s.y_repeat < (isRR()? 8 : 32)); - if( ud.clipping == 0 && ( psect->floorpicnum == MIRROR || psect == nullptr) ) + if( ud.clipping == 0 && ( psect->floortexture == mirrortex || psect == nullptr) ) { mypos.XY() = omypos.XY(); } diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 88721f979..99888877b 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -689,7 +689,7 @@ void prelevel_common(int g) if (sectp->ceilingstat & CSTAT_SECTOR_SKY) { - if (sectp->ceilingpicnum == TILE_CLOUDYSKIES && numclouds < 127) + if (tilesurface(sectp->ceilingtexture()) == TSURF_SCROLLSKY && numclouds < 127) clouds[numclouds++] = sectp; if (ps[0].one_parallax_sectnum == nullptr) @@ -868,7 +868,7 @@ static void SpawnPortals() for (unsigned i = 0; i < sector.Size(); i++) { auto sectp = §or[i]; - if (sectp->floorpicnum == FOF && sectp->portalflags != PORTAL_SECTOR_FLOOR) + if (sectp->floortexture() == foftex && sectp->portalflags != PORTAL_SECTOR_FLOOR) { for (auto& pt : allPortals) { @@ -979,6 +979,12 @@ static int LoadTheMap(MapRecord *mi, player_struct*p, int gamemode) auto actorlist = spawnactors(sprites); + for (auto& sect : sector) + { + if (tilesurface(sect.ceilingtexture()) == TSURF_THUNDERSKY) + thunderon = 1; + } + if (isRR()) prelevel_r(gamemode, actorlist); else prelevel_d(gamemode, actorlist); diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index 43ede2d23..cc7a2cc1d 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -432,8 +432,6 @@ void prelevel_r(int g, TArray& actors) for (auto§: sector) { auto sectp = § - if (sectp->ceilingpicnum == RTILE_RRTHUNDERSKY) - thunderon = 1; switch (sectp->lotag) { diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 7cf9bd33c..1b76a6afd 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -52,7 +52,7 @@ static int interptype[] = { Interp_Sect_Floorz, Interp_Sect_Ceilingz, Interp_Wal bool ceilingspace(sectortype* sectp) { - return (sectp && (sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0 && (tileflags(sectp->ceilingtexture()) & TFLAG_OUTERSPACE)); + return (sectp && (sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0 && (tilesurface(sectp->ceilingtexture()) == TSURF_OUTERSPACE)); } @@ -65,7 +65,7 @@ bool ceilingspace(sectortype* sectp) bool floorspace(sectortype* sectp) { // Yes, ceilingpal in this check is correct... - return (sectp && (sectp->floorstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0 && (tileflags(sectp->floortexture()) & TFLAG_OUTERSPACE)); + return (sectp && (sectp->floorstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0 && (tilesurface(sectp->floortexture()) == TSURF_OUTERSPACE)); } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index b894457f1..b130b137f 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -1284,6 +1284,18 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, operateactivators, operateactivators) return 0; } +int duke_floorsurface(sectortype* sector) +{ + return tilesurface(sector->floortexture()); +} + +DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, floorsurface, duke_floorsurface) +{ + PARAM_PROLOGUE; + PARAM_POINTER(sect, sectortype); + ACTION_RETURN_INT(duke_floorsurface(sect)); +} + int duke_floorflags(sectortype* sector) { return tileflags(sector->floortexture()); @@ -1308,6 +1320,18 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, ceilingflags, duke_ceilingflags) ACTION_RETURN_INT(duke_ceilingflags(sect)); } +int duke_ceilingsurface(sectortype* sector) +{ + return tilesurface(sector->ceilingtexture()); +} + +DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, ceilingsurface, duke_ceilingsurface) +{ + PARAM_PROLOGUE; + PARAM_POINTER(sect, sectortype); + ACTION_RETURN_INT(duke_ceilingsurface(sect)); +} + int duke_wallflags(walltype* wal, int which) { return tileflags(which? wal->overtexture() : wal->walltexture()); diff --git a/wadsrc/static/filter/dukeengine/constants.mi b/wadsrc/static/filter/dukeengine/constants.mi index 67ef45e61..c3bcb7354 100644 --- a/wadsrc/static/filter/dukeengine/constants.mi +++ b/wadsrc/static/filter/dukeengine/constants.mi @@ -2,18 +2,25 @@ constants { - // Tile flags. - TFLAG_WALLSWITCH = 1 - TFLAG_ADULT = 2 - TFLAG_ELECTRIC = 4 - TFLAG_CLEARINVENTORY = 8 - TFLAG_SLIME = 16 - TFLAG_DOORWALL = 32 - TFLAG_BLOCKDOOR = 64 - TFLAG_OUTERSPACE = 128 - TFLAG_NOBLOODSPLAT = 256 - TFLAG_NOCIRCLEREFLECT = 512 - TFLAG_MUDDY = 1024 - TFLAG_PURPLELAVA = 2048 + // texture flags + TFLAG_WALLSWITCH = 1 + TFLAG_ADULT = 2 + TFLAG_CLEARINVENTORY = 4 // really dumb Duke stuff... + TFLAG_DOORWALL = 8 + TFLAG_BLOCKDOOR = 16 + TFLAG_NOBLOODSPLAT = 32 + TFLAG_NOCIRCLEREFLECT = 64 + // surface (terrain/environment) types + TSURF_NONE = 0 + TSURF_ELECTRIC = 1 + TSURF_SLIME = 2 + TSURF_OUTERSPACE = 3 + TSURF_MUDDY = 4 + TSURF_PURPLELAVA = 5 // very special kind of terrain type. + TSURF_SCROLLSKY = 6 + TSURF_THUNDERSKY = 7 + TSURF_PLASMA = 8 + TSURF_MAGMA = 9 } + diff --git a/wadsrc/static/filter/dukelike/rmapinfo.texflags b/wadsrc/static/filter/dukelike/rmapinfo.texflags index 88da5a86b..e4f55ac09 100644 --- a/wadsrc/static/filter/dukelike/rmapinfo.texflags +++ b/wadsrc/static/filter/dukelike/rmapinfo.texflags @@ -127,9 +127,14 @@ textureflags DOORTILE22, DOORTILE23 - // should be made terrain types later - TFLAG_ELECTRIC = HURTRAIL - TFLAG_SLIME = FLOORSLIME, FLOORSLIME1, FLOORSLIME2 - TFLAG_OUTERSPACE = MOONSKY1, BIGORBIT1 - TFLAG_PURPLELAVA = PURPLELAVA +} + +surfacetypes +{ + TSURF_ELECTRIC = HURTRAIL + TSURF_SLIME = FLOORSLIME, FLOORSLIME1, FLOORSLIME2 + TSURF_OUTERSPACE = MOONSKY1, BIGORBIT1 + TSURF_PURPLELAVA = PURPLELAVA + TSURF_PLASMA = FLOORPLASMA + TSURF_SCROLLSKY = CLOUDYSKIES } \ No newline at end of file diff --git a/wadsrc/static/filter/redneck.ridesagain/rmapinfo.texflags b/wadsrc/static/filter/redneck.ridesagain/rmapinfo.texflags index 11a1e10ed..2e7b564e0 100644 --- a/wadsrc/static/filter/redneck.ridesagain/rmapinfo.texflags +++ b/wadsrc/static/filter/redneck.ridesagain/rmapinfo.texflags @@ -33,4 +33,8 @@ textureflags RRTILE8565, RRTILE8605 } - + +surfacetypes +{ + TSURF_MAGMA = MAGMA1, MAGMA2 +} diff --git a/wadsrc/static/filter/redneck/rmapinfo.texflags b/wadsrc/static/filter/redneck/rmapinfo.texflags index a4a8daf57..f71ec747b 100644 --- a/wadsrc/static/filter/redneck/rmapinfo.texflags +++ b/wadsrc/static/filter/redneck/rmapinfo.texflags @@ -47,11 +47,6 @@ textureflags CHICKENPLANTBUTTON, CHICKENPLANTBUTTONON - TFLAG_ELECTRIC = HURTRAIL - TFLAG_CLEARINVENTORY = HURTRAIL, FLOORSLIME, FLOORPLASMA - TFLAG_SLIME = FLOORSLIME, FLOORSLIME1, FLOORSLIME2 - TFLAG_MUDDY = MUDDY - TFLAG_DOORWALL = DOORTILE1, DOORTILE2, @@ -164,4 +159,17 @@ textureflags RRTILE3827, RRTILE3837 -} \ No newline at end of file + TFLAG_CLEARINVENTORY = HURTRAIL, FLOORSLIME, FLOORPLASMA +} + + +surfacetypes +{ + TSURF_ELECTRIC = HURTRAIL + TSURF_SLIME = FLOORSLIME, FLOORSLIME1, FLOORSLIME2 + TSURF_OUTERSPACE = MOONSKY1, BIGORBIT1 + TSURF_PLASMA = FLOORPLASMA + TSURF_MUDDY = MUDDY + TSURF_THUNDERSKY = RRTHUNDERSKY + +} diff --git a/wadsrc/static/zscript/games/duke/actors/bolt.zs b/wadsrc/static/zscript/games/duke/actors/bolt.zs index 798a907d9..b3a49685c 100644 --- a/wadsrc/static/zscript/games/duke/actors/bolt.zs +++ b/wadsrc/static/zscript/games/duke/actors/bolt.zs @@ -53,7 +53,7 @@ class DukeBolt1 : DukeActor if (l & 1) self.cstat ^= CSTAT_SPRITE_TRANSLUCENT; - if (self.spritesetindex == 1 && random(0, 7) == 0 && (dlevel.floorflags(sectp) & Duke.TFLAG_ELECTRIC)) + if (self.spritesetindex == 1 && random(0, 7) == 0 && (dlevel.floorsurface(sectp) == Duke.TSURF_ELECTRIC)) self.PlayActorSound("SHORT_CIRCUIT"); if (self.spritesetindex & 1) @@ -132,7 +132,7 @@ class DukeSideBolt1 : DukeBolt1 } self.SetSpriteSetImage((self.spritesetindex + 1) % self.GetSpriteSetSize()); - if (random(0, 1) && (dlevel.floorflags(sectp) & Duke.TFLAG_ELECTRIC)) + if (random(0, 1) && (dlevel.floorsurface(sectp) == Duke.TSURF_ELECTRIC)) self.PlayActorSound("SHORT_CIRCUIT"); } diff --git a/wadsrc/static/zscript/games/duke/actors/watersplash.zs b/wadsrc/static/zscript/games/duke/actors/watersplash.zs index 7c13784af..a436c9c5f 100644 --- a/wadsrc/static/zscript/games/duke/actors/watersplash.zs +++ b/wadsrc/static/zscript/games/duke/actors/watersplash.zs @@ -37,7 +37,7 @@ class DukeWatersplash : DukeActor self.pos.Z = f; } - if ((dlevel.floorflags(sectp) & Duke.TFLAG_SLIME) || (dlevel.ceilingflags(sectp) & Duke.TFLAG_SLIME)) + if ((dlevel.floorsurface(sectp) == Duke.TSURF_SLIME) || (dlevel.ceilingsurface(sectp) & Duke.TSURF_SLIME)) self.pal = 7; self.ChangeStat(STAT_MISC); } @@ -93,7 +93,7 @@ class RedneckMudSplash : DukeWatersplash override void Tick() { let sectp = self.sector; - DoTick(dlevel.floorflags(sectp) & Duke.TFLAG_MUDDY); + DoTick(dlevel.floorsurface(sectp) & Duke.TSURF_MUDDY); } } diff --git a/wadsrc/static/zscript/games/duke/dukeactor.zs b/wadsrc/static/zscript/games/duke/dukeactor.zs index 98ac6603a..c1d25b8b0 100644 --- a/wadsrc/static/zscript/games/duke/dukeactor.zs +++ b/wadsrc/static/zscript/games/duke/dukeactor.zs @@ -301,7 +301,9 @@ struct DukeLevel native static int check_activator_motion(int lotag); native static void operatemasterswitches(int lotag); native static void operateactivators(int lotag, DukePlayer p); + native static int floorsurface(sectortype s); native static int floorflags(sectortype s); + native static int ceilingsurface(sectortype s); native static int ceilingflags(sectortype s); native static int wallflags(walltype s, int which); native static void AddCycler(sectortype sector, int lotag, int shade, int shade2, int hitag, int state); diff --git a/wadsrc/static/zscript/games/duke/dukegame.zs b/wadsrc/static/zscript/games/duke/dukegame.zs index 68d7dad84..0b3706140 100644 --- a/wadsrc/static/zscript/games/duke/dukegame.zs +++ b/wadsrc/static/zscript/games/duke/dukegame.zs @@ -68,20 +68,29 @@ struct Duke native CLIPMASK1 = (256 << 16) + 64 } - enum ETextureFlags + enum ETexFlags { TFLAG_WALLSWITCH = 1 << 0, TFLAG_ADULT = 1 << 1, - TFLAG_ELECTRIC = 1 << 2, - TFLAG_CLEARINVENTORY = 1 << 3, // really dumb Duke stuff... - TFLAG_SLIME = 1 << 4, - TFLAG_DOORWALL = 1 << 5, - TFLAG_BLOCKDOOR = 1 << 6, - TFLAG_OUTERSPACE = 1 << 7, - TFLAG_NOBLOODSPLAT = 1 << 8, - TFLAG_NOCIRCLEREFLECT = 1 << 9, - TFLAG_MUDDY = 1 << 10, - TFLAG_PURPLELAVA = 1 << 11, // very special kind of terrain type. + TFLAG_CLEARINVENTORY = 1 << 2, // really dumb Duke stuff... + TFLAG_DOORWALL = 1 << 3, + TFLAG_BLOCKDOOR = 1 << 4, + TFLAG_NOBLOODSPLAT = 1 << 5, + TFLAG_NOCIRCLEREFLECT = 1 << 6, + }; + + enum ETexSurfaces + { + TSURF_NONE = 0, + TSURF_ELECTRIC = 1, + TSURF_SLIME = 2, + TSURF_OUTERSPACE = 3, + TSURF_MUDDY = 4, + TSURF_PURPLELAVA = 5, // very special kind of terrain type. + TSURF_SCROLLSKY = 6, + TSURF_THUNDERSKY = 7, + TSURF_PLASMA = 8, + TSURF_MAGMA = 9, }; enum ESoundFlags diff --git a/wadsrc/static/zscript/razebase.zs b/wadsrc/static/zscript/razebase.zs index ba87fa4a5..65ba5a27e 100644 --- a/wadsrc/static/zscript/razebase.zs +++ b/wadsrc/static/zscript/razebase.zs @@ -177,6 +177,8 @@ struct Raze native static void SetReverb(int r); native static void SetReverbDelay(int d); native static Sound FindSoundByResID(int id); + + //native static int tileflags(TextureID tex) native static sectortype updatesector(Vector2 pos, sectortype lastsect, double maxdist = 96); native static sectortype, Vector3 clipmove(Vector3 pos, sectortype sect, Vector2 move, double walldist, double ceildist, double flordist, uint cliptype, CollisionData coll, int clipmoveboxtracenum = 3);