From 1f5cd93564e952a944e31f979f809d90d4fc53e9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 23 Dec 2022 17:55:28 +0100 Subject: [PATCH] - wall flag interface cleanup. With wall textures now available the workarounds could be removed. --- source/core/vmexports.cpp | 13 +++++ source/games/duke/src/vmexports.cpp | 50 +++++-------------- .../zscript/games/duke/actors/bloodsplats.zs | 2 +- .../zscript/games/duke/actors/projectiles.zs | 2 +- wadsrc/static/zscript/games/duke/dukeactor.zs | 3 -- wadsrc/static/zscript/games/duke/dukegame.zs | 6 +++ wadsrc/static/zscript/razebase.zs | 2 +- 7 files changed, 35 insertions(+), 43 deletions(-) diff --git a/source/core/vmexports.cpp b/source/core/vmexports.cpp index d44899735..faceb7293 100644 --- a/source/core/vmexports.cpp +++ b/source/core/vmexports.cpp @@ -154,6 +154,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Raze, FindSoundByResID, Raze_FindSoundByResID) ACTION_RETURN_INT(Raze_FindSoundByResID(i)); } +int raze_tileflags(int tex) +{ + return tileflags(FSetTextureID(tex)); +} + +DEFINE_ACTION_FUNCTION_NATIVE(_Raze, tileflags, raze_tileflags) +{ + PARAM_PROLOGUE; + PARAM_INT(which); + ACTION_RETURN_INT(raze_tileflags(which)); +} + + //============================================================================= // // internal sector struct - no longer identical with on-disk format diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index d47c27bb6..5c6ad4a7d 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -215,6 +215,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Duke, isaccessswitch, Duke_isaccessswitch) return 0; } +int Duke_isshootableswitch(int texint) +{ + return isshootableswitch(FSetTextureID(texint)); +} + +DEFINE_ACTION_FUNCTION_NATIVE(_Duke, isshootableswitch, Duke_isshootableswitch) +{ + PARAM_PROLOGUE; + PARAM_INT(v); + ACTION_RETURN_BOOL(Duke_isshootableswitch(v)); + return 0; +} + DEFINE_GLOBAL_UNSIZED(dlevel) DEFINE_GLOBAL(camsprite) @@ -1251,30 +1264,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, floorsurface, duke_floorsurface) ACTION_RETURN_INT(duke_floorsurface(sect)); } -int duke_floorflags(sectortype* sector) -{ - return tileflags(sector->floortexture); -} - -DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, floorflags, duke_floorflags) -{ - PARAM_PROLOGUE; - PARAM_POINTER(sect, sectortype); - ACTION_RETURN_INT(duke_floorflags(sect)); -} - -int duke_ceilingflags(sectortype* sector) -{ - return tileflags(sector->ceilingtexture); -} - -DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, ceilingflags, duke_ceilingflags) -{ - PARAM_PROLOGUE; - PARAM_POINTER(sect, sectortype); - ACTION_RETURN_INT(duke_ceilingflags(sect)); -} - int duke_ceilingsurface(sectortype* sector) { return tilesurface(sector->ceilingtexture); @@ -1287,19 +1276,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, ceilingsurface, duke_ceilingsurface) ACTION_RETURN_INT(duke_ceilingsurface(sect)); } -int duke_wallflags(walltype* wal, int which) -{ - return tileflags(which? wal->overtexture : wal->walltexture); -} - -DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, wallflags, duke_wallflags) -{ - PARAM_PROLOGUE; - PARAM_POINTER(sect, walltype); - PARAM_INT(which); - ACTION_RETURN_INT(duke_wallflags(sect, which)); -} - int duke_ismirror(walltype* wal) { return wal->walltexture == mirrortex || wal->overtexture == mirrortex; diff --git a/wadsrc/static/zscript/games/duke/actors/bloodsplats.zs b/wadsrc/static/zscript/games/duke/actors/bloodsplats.zs index 5c9d0bdbd..b22ae777d 100644 --- a/wadsrc/static/zscript/games/duke/actors/bloodsplats.zs +++ b/wadsrc/static/zscript/games/duke/actors/bloodsplats.zs @@ -62,7 +62,7 @@ class DukeBloodSplat1 : DukeActor return true; if (wal.hitag != 0) return true; - if (dlevel.wallflags(wal, 1) & Duke.TFLAG_NOBLOODSPLAT) + if (Raze.tileflags(wal.walltexture) & Duke.TFLAG_NOBLOODSPLAT) return true; if ((wal.cstat & CSTAT_WALL_MASKED) != 0) return true; diff --git a/wadsrc/static/zscript/games/duke/actors/projectiles.zs b/wadsrc/static/zscript/games/duke/actors/projectiles.zs index 1881b6f4e..8508136c2 100644 --- a/wadsrc/static/zscript/games/duke/actors/projectiles.zs +++ b/wadsrc/static/zscript/games/duke/actors/projectiles.zs @@ -1019,7 +1019,7 @@ class RedneckSawBlade : DukeProjectile override bool weaponhitwall(walltype wal) { - if (dlevel.wallflags(wal, 0) & Duke.TFLAG_NOCIRCLEREFLECT) + if (Raze.tileflags(wal.walltexture) & Duke.TFLAG_NOCIRCLEREFLECT) { self.Destroy(); return true; diff --git a/wadsrc/static/zscript/games/duke/dukeactor.zs b/wadsrc/static/zscript/games/duke/dukeactor.zs index 84ddcb17d..bce5d0bff 100644 --- a/wadsrc/static/zscript/games/duke/dukeactor.zs +++ b/wadsrc/static/zscript/games/duke/dukeactor.zs @@ -364,10 +364,7 @@ struct DukeLevel 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); native static void addtorch(sectortype sector, int shade, int lotag); native static void addlightning(sectortype sector, int shade); diff --git a/wadsrc/static/zscript/games/duke/dukegame.zs b/wadsrc/static/zscript/games/duke/dukegame.zs index 8473d1823..053012cf8 100644 --- a/wadsrc/static/zscript/games/duke/dukegame.zs +++ b/wadsrc/static/zscript/games/duke/dukegame.zs @@ -77,6 +77,11 @@ struct Duke native TFLAG_BLOCKDOOR = 1 << 4, TFLAG_NOBLOODSPLAT = 1 << 5, TFLAG_NOCIRCLEREFLECT = 1 << 6, + TFLAG_SEASICKWALL = 1 << 7, + TFLAG_FORCEFIELD = 1 << 8, + TFLAG_ANIMFORCEFIELD = 1 << 9, + TFLAG_ANIMSCREEN = 1 << 10, + TFLAG_ANIMSCREENNOISE = 1 << 11, }; enum ETexSurfaces @@ -174,6 +179,7 @@ struct Duke native static native int getPlayerIndex(DukePlayer p); static native void setlastvisinc(int amount); static native bool isaccessswitch(TextureID tex); + static native bool isshootableswitch(TextureID tex); static int rnd(int val) { return (random(0, 255) >= (255 - (val))); diff --git a/wadsrc/static/zscript/razebase.zs b/wadsrc/static/zscript/razebase.zs index 360ce0834..be18290d0 100644 --- a/wadsrc/static/zscript/razebase.zs +++ b/wadsrc/static/zscript/razebase.zs @@ -214,7 +214,7 @@ struct Raze native static void SetReverbDelay(int d); native static Sound FindSoundByResID(int id); - //native static int tileflags(TextureID tex) + 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);