- wall flag interface cleanup.

With wall textures now available the workarounds could be removed.
This commit is contained in:
Christoph Oelckers 2022-12-23 17:55:28 +01:00
parent 041d5214a4
commit 1f5cd93564
7 changed files with 35 additions and 43 deletions

View file

@ -154,6 +154,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Raze, FindSoundByResID, Raze_FindSoundByResID)
ACTION_RETURN_INT(Raze_FindSoundByResID(i)); 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 // internal sector struct - no longer identical with on-disk format

View file

@ -215,6 +215,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Duke, isaccessswitch, Duke_isaccessswitch)
return 0; 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_UNSIZED(dlevel)
DEFINE_GLOBAL(camsprite) DEFINE_GLOBAL(camsprite)
@ -1251,30 +1264,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, floorsurface, duke_floorsurface)
ACTION_RETURN_INT(duke_floorsurface(sect)); 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) int duke_ceilingsurface(sectortype* sector)
{ {
return tilesurface(sector->ceilingtexture); return tilesurface(sector->ceilingtexture);
@ -1287,19 +1276,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, ceilingsurface, duke_ceilingsurface)
ACTION_RETURN_INT(duke_ceilingsurface(sect)); 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) int duke_ismirror(walltype* wal)
{ {
return wal->walltexture == mirrortex || wal->overtexture == mirrortex; return wal->walltexture == mirrortex || wal->overtexture == mirrortex;

View file

@ -62,7 +62,7 @@ class DukeBloodSplat1 : DukeActor
return true; return true;
if (wal.hitag != 0) if (wal.hitag != 0)
return true; return true;
if (dlevel.wallflags(wal, 1) & Duke.TFLAG_NOBLOODSPLAT) if (Raze.tileflags(wal.walltexture) & Duke.TFLAG_NOBLOODSPLAT)
return true; return true;
if ((wal.cstat & CSTAT_WALL_MASKED) != 0) if ((wal.cstat & CSTAT_WALL_MASKED) != 0)
return true; return true;

View file

@ -1019,7 +1019,7 @@ class RedneckSawBlade : DukeProjectile
override bool weaponhitwall(walltype wal) override bool weaponhitwall(walltype wal)
{ {
if (dlevel.wallflags(wal, 0) & Duke.TFLAG_NOCIRCLEREFLECT) if (Raze.tileflags(wal.walltexture) & Duke.TFLAG_NOCIRCLEREFLECT)
{ {
self.Destroy(); self.Destroy();
return true; return true;

View file

@ -364,10 +364,7 @@ struct DukeLevel
native static void operatemasterswitches(int lotag); native static void operatemasterswitches(int lotag);
native static void operateactivators(int lotag, DukePlayer p); native static void operateactivators(int lotag, DukePlayer p);
native static int floorsurface(sectortype s); native static int floorsurface(sectortype s);
native static int floorflags(sectortype s);
native static int ceilingsurface(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 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 addtorch(sectortype sector, int shade, int lotag);
native static void addlightning(sectortype sector, int shade); native static void addlightning(sectortype sector, int shade);

View file

@ -77,6 +77,11 @@ struct Duke native
TFLAG_BLOCKDOOR = 1 << 4, TFLAG_BLOCKDOOR = 1 << 4,
TFLAG_NOBLOODSPLAT = 1 << 5, TFLAG_NOBLOODSPLAT = 1 << 5,
TFLAG_NOCIRCLEREFLECT = 1 << 6, 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 enum ETexSurfaces
@ -174,6 +179,7 @@ struct Duke native
static native int getPlayerIndex(DukePlayer p); static native int getPlayerIndex(DukePlayer p);
static native void setlastvisinc(int amount); static native void setlastvisinc(int amount);
static native bool isaccessswitch(TextureID tex); static native bool isaccessswitch(TextureID tex);
static native bool isshootableswitch(TextureID tex);
static int rnd(int val) static int rnd(int val)
{ {
return (random(0, 255) >= (255 - (val))); return (random(0, 255) >= (255 - (val)));

View file

@ -214,7 +214,7 @@ struct Raze
native static void SetReverbDelay(int d); native static void SetReverbDelay(int d);
native static Sound FindSoundByResID(int id); 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 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); native static sectortype, Vector3 clipmove(Vector3 pos, sectortype sect, Vector2 move, double walldist, double ceildist, double flordist, uint cliptype, CollisionData coll, int clipmoveboxtracenum = 3);