From 1b3f55121680cd3a497bb88e5de803c747001260 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 25 Nov 2022 17:43:13 +0100 Subject: [PATCH] - use a flag for outer space textures. --- source/games/duke/src/actors.cpp | 10 ++--- source/games/duke/src/actors_d.cpp | 44 +----------------- source/games/duke/src/actors_r.cpp | 45 +------------------ source/games/duke/src/constants.h | 1 + source/games/duke/src/dispatch.cpp | 8 ---- source/games/duke/src/duke3d.h | 2 - source/games/duke/src/funct.h | 3 ++ source/games/duke/src/gameexec.cpp | 4 +- source/games/duke/src/sectors.cpp | 23 ++++++++++ .../filter/dukeengine/engine/defines.def | 1 + .../static/filter/dukelike/engine/engine.def | 5 +++ .../redneck.ridesagain/engine/engine.def | 2 + 12 files changed, 46 insertions(+), 102 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index eac3eb210..b2276acef 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -451,7 +451,7 @@ void moveplayers(void) act->SetHitOwner(act); if (ud.god == 0) - if (fi.ceilingspace(act->sector()) || fi.floorspace(act->sector())) + if (ceilingspace(act->sector()) || floorspace(act->sector())) quickkill(p); } else @@ -4028,11 +4028,11 @@ void makeitfall(DDukeActor* actor) { double grav; - if( fi.floorspace(actor->sector()) ) + if( floorspace(actor->sector()) ) grav = 0; else { - if( fi.ceilingspace(actor->sector()) || actor->sector()->lotag == ST_2_UNDERWATER) + if( ceilingspace(actor->sector()) || actor->sector()->lotag == ST_2_UNDERWATER) grav = gs.gravity/6; else grav = gs.gravity; } @@ -4269,11 +4269,11 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO double grav; int sphit = fallspecial? fallspecial(actor, playernum) : 0; - if (fi.floorspace(actor->sector())) + if (floorspace(actor->sector())) grav = 0; else { - if (fi.ceilingspace(actor->sector()) || actor->sector()->lotag == 2) + if (ceilingspace(actor->sector()) || actor->sector()->lotag == 2) grav = gs.gravity / 6; else grav = gs.gravity; } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index e4f39c44b..47161dd93 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -43,46 +43,6 @@ This file contains parts of DukeGDX by Alexander Makarov-[M210] (m210-2007@mail. BEGIN_DUKE_NS -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -bool ceilingspace_d(sectortype* sectp) -{ - if (sectp && (sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0) - { - switch(sectp->ceilingpicnum) - { - case MOONSKY1: - case BIGORBIT1: - return 1; - } - } - return 0; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -bool floorspace_d(sectortype* sectp) -{ - if (sectp && (sectp->floorstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0) - { - switch(sectp->floorpicnum) - { - case MOONSKY1: - case BIGORBIT1: - return 1; - } - } - return 0; -} - //--------------------------------------------------------------------------- // // @@ -758,10 +718,10 @@ void movefallers_d(void) } double grav; - if (fi.floorspace(act->sector())) grav = 0; + if (floorspace(act->sector())) grav = 0; else { - if (fi.ceilingspace(act->sector())) + if (ceilingspace(act->sector())) grav = gs.gravity / 6; else grav = gs.gravity; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index a594ebc14..48866ac47 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -45,47 +45,6 @@ void resetpins(sectortype* sect); void resetlanepics(void); -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -bool ceilingspace_r(sectortype* sectp) -{ - if (sectp && (sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0) - { - switch(sectp->ceilingpicnum) - { - case MOONSKY1: - case BIGORBIT1: - return 1; - } - } - return 0; -} - - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -bool floorspace_r(sectortype* sectp) -{ - if (sectp && (sectp->floorstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0) - { - switch(sectp->floorpicnum) - { - case MOONSKY1: - case BIGORBIT1: - return 1; - } - } - return 0; -} - //--------------------------------------------------------------------------- // // @@ -625,10 +584,10 @@ void movefallers_r(void) } double grav; - if (fi.floorspace(act->sector())) grav = 0; + if (floorspace(act->sector())) grav = 0; else { - if (fi.ceilingspace(act->sector())) + if (ceilingspace(act->sector())) grav = gs.gravity / 6; else grav = gs.gravity; diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index 5e5ec76ba..23c24395a 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -380,6 +380,7 @@ enum TFLAG_SLIME = 1 << 4, TFLAG_DOORWALL = 1 << 5, TFLAG_BLOCKDOOR = 1 << 6, + TFLAG_OUTERSPACE = 1 << 7, }; diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 5fb323c7a..8407a4479 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -54,10 +54,6 @@ void checkhitdefault_r(DDukeActor* i, DDukeActor* sn); void checksectors_d(int snum); void checksectors_r(int snum); -bool ceilingspace_d(sectortype*); -bool ceilingspace_r(sectortype*); -bool floorspace_d(sectortype*); -bool floorspace_r(sectortype*); void addweapon_d(player_struct* p, int weapon, bool wswitch); void addweapon_r(player_struct* p, int weapon, bool wswitch); void hitradius_d(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4); @@ -122,8 +118,6 @@ void SetDispatcher() checksectors_d, spawninit_d, - ceilingspace_d, - floorspace_d, addweapon_d, hitradius_d, lotsofmoney_d, @@ -164,8 +158,6 @@ void SetDispatcher() checksectors_r, spawninit_r, - ceilingspace_r, - floorspace_r, addweapon_r, hitradius_r, lotsoffeathers_r, diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index c4df5e6e2..192fe612f 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -86,8 +86,6 @@ struct Dispatcher void (*checksectors)(int low); DDukeActor* (*spawninit)(DDukeActor* actj, DDukeActor* act, TArray* actors); - bool (*ceilingspace)(sectortype* sectp); - bool (*floorspace)(sectortype* sectp); void (*addweapon)(player_struct *p, int weapon, bool wswitch); void (*hitradius)(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4); void (*lotsofmoney)(DDukeActor *s, int n); diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 3654afad5..ffc3ec5ff 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -21,6 +21,9 @@ void addtorch(sectortype* sect, int shade, int lotag); void addlightning(sectortype* sect, int shade); int addambient(int hitag, int lotag); +bool ceilingspace(sectortype* sectp); +bool floorspace(sectortype* sectp); + void movecyclers(void); void movedummyplayers(void); void resetlanepics(void); diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index c6c97e51a..c37983195 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -2507,7 +2507,7 @@ int ParseState::parse(void) } break; case concmd_ifinspace: - parseifelse(fi.ceilingspace(g_ac->sector())); + parseifelse(ceilingspace(g_ac->sector())); break; case concmd_spritepal: @@ -2815,7 +2815,7 @@ int ParseState::parse(void) insptr++; break; case concmd_ifinouterspace: - parseifelse( fi.floorspace(g_ac->sector())); + parseifelse( floorspace(g_ac->sector())); break; case concmd_ifnotmoving: parseifelse( g_ac->movflag > kHitSector ); diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index a919cafa7..a3345af59 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -44,6 +44,29 @@ BEGIN_DUKE_NS static int interptype[] = { Interp_Sect_Floorz, Interp_Sect_Ceilingz, Interp_Wall_X, Interp_Wall_Y }; +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +bool ceilingspace(sectortype* sectp) +{ + return (sectp && (sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0 && (tileflags(sectp->ceilingpicnum) & TFLAG_OUTERSPACE)); +} + + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +bool floorspace(sectortype* sectp) +{ + return (sectp && (sectp->floorstat & CSTAT_SECTOR_SKY) && sectp->floorpal == 0 && (tileflags(sectp->floorpicnum) & TFLAG_OUTERSPACE)); +} + //--------------------------------------------------------------------------- // // diff --git a/wadsrc/static/filter/dukeengine/engine/defines.def b/wadsrc/static/filter/dukeengine/engine/defines.def index d1317ed78..c083b905b 100644 --- a/wadsrc/static/filter/dukeengine/engine/defines.def +++ b/wadsrc/static/filter/dukeengine/engine/defines.def @@ -8,3 +8,4 @@ define TFLAG_CLEARINVENTORY 8 define TFLAG_SLIME 16 define TFLAG_DOORWALL 32 define TFLAG_BLOCKDOOR 64 +define TFLAG_OUTERSPACE 128 diff --git a/wadsrc/static/filter/dukelike/engine/engine.def b/wadsrc/static/filter/dukelike/engine/engine.def index 3cd6aabb1..380721c03 100644 --- a/wadsrc/static/filter/dukelike/engine/engine.def +++ b/wadsrc/static/filter/dukelike/engine/engine.def @@ -187,3 +187,8 @@ tileflag TFLAG_DOORWALL { DOORTILE22 DOORTILE23 } + +tileflag TFLAG_OUTERSPACE { + MOONSKY1 + BIGORBIT1 + } diff --git a/wadsrc/static/filter/redneck.ridesagain/engine/engine.def b/wadsrc/static/filter/redneck.ridesagain/engine/engine.def index bc5fde485..1c050c88b 100644 --- a/wadsrc/static/filter/redneck.ridesagain/engine/engine.def +++ b/wadsrc/static/filter/redneck.ridesagain/engine/engine.def @@ -1,3 +1,5 @@ +include "engine/defines.def" + spawnclasses { 2430 = RedneckCactusLargeYellow