- exported two more settings to tile flags.

This commit is contained in:
Christoph Oelckers 2022-11-25 17:29:27 +01:00
parent 0281e5dff8
commit c7cdf96a62
14 changed files with 196 additions and 215 deletions

View file

@ -378,6 +378,9 @@ enum
TFLAG_ELECTRIC = 1 << 2,
TFLAG_CLEARINVENTORY = 1 << 3, // really dumb Duke stuff...
TFLAG_SLIME = 1 << 4,
TFLAG_DOORWALL = 1 << 5,
TFLAG_BLOCKDOOR = 1 << 6,
};
enum

View file

@ -35,8 +35,6 @@ BEGIN_DUKE_NS
void initactorflags_d();
void initactorflags_r();
bool isadoorwall_d(int dapic);
bool isadoorwall_r(int dapic);
void animatewalls_d(void);
void animatewalls_r(void);
void operateforcefields_r(DDukeActor* act, int low);
@ -113,7 +111,6 @@ void SetDispatcher()
think_d,
movetransports_d,
initactorflags_d,
isadoorwall_d,
animatewalls_d,
operateforcefields_d,
checkhitswitch_d,
@ -156,7 +153,6 @@ void SetDispatcher()
think_r,
movetransports_r,
initactorflags_r,
isadoorwall_r,
animatewalls_r,
operateforcefields_r,
checkhitswitch_r,

View file

@ -75,7 +75,6 @@ struct Dispatcher
void (*think)();
void (*movetransports)();
void (*initactorflags)();
bool (*isadoorwall)(int dapic);
void (*animatewalls)();
void (*operateforcefields)(DDukeActor* act, int low);
bool (*checkhitswitch)(int snum, walltype* w, DDukeActor* act);

View file

@ -291,7 +291,7 @@ static void initTiles()
}
#define x(a, b) registerName(#a, b);
#define y(a, b) // Do not create names for RRTILExxxx.
#define y(a, b) registerName(#a, b);
static void SetTileNames()
{
auto registerName = [](const char* name, int index)

View file

@ -100,23 +100,30 @@ inline bool inventory(DDukeActor* S)
return actorflag(S, SFLAG_INVENTORY);
}
inline int& tileflags(int tilenum)
inline int& tileflags(unsigned int tilenum)
{
static int sink = 0;
if (tilenum >= MAXTILES) return sink;
return TileFiles.tiledata[tilenum].tileflags;
}
inline void settileflag(int flag, const std::initializer_list<short>& types)
{
for (auto val : types)
{
tileflags(val) |= flag;
}
}
inline bool wallswitchcheck(DDukeActor* s)
{
return !!(tileflags(s->spr.picnum) & TFLAG_WALLSWITCH);
}
inline bool isadoorwall(int dapic)
{
return tileflags(dapic) & TFLAG_DOORWALL;
}
inline bool isablockdoor(int dapic)
{
return tileflags(dapic) & TFLAG_BLOCKDOOR;
}
inline int checkcursectnums(sectortype* se)
{
int i;

View file

@ -987,12 +987,15 @@ y(RRTILE3500, 3500)
x(SLINGBLADE, 3510)
y(RRTILE3584, 3584)
y(RRTILE3586, 3586)
y(LADDER, 3587)
x(LADDER, 3587)
y(RRTILE3600, 3600)
y(RRTILE3631, 3631)
y(RRTILE3635, 3635)
y(RRTILE3637, 3637)
y(RRTILE3643, 3643)
y(RRTILE3644, 3644)
y(RRTILE3645, 3645)
y(RRTILE3646, 3646)
y(RRTILE3647, 3647)
y(RRTILE3652, 3652)
y(RRTILE3653, 3653)

View file

@ -465,7 +465,9 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
{
spawn(spark, SMALLSMOKE);
if (fi.isadoorwall(hit.hitWall->picnum) == 1)
if (isadoorwall(hit.hitWall->picnum) == 1)
goto SKIPBULLETHOLE;
if (isablockdoor(hit.hitWall->picnum) == 1)
goto SKIPBULLETHOLE;
if (p >= 0 && (
hit.hitWall->picnum == DIPSWITCH ||

View file

@ -360,7 +360,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
{
spawn(spark, SMALLSMOKE);
if (fi.isadoorwall(hit.hitWall->picnum) == 1)
if (isadoorwall(hit.hitWall->picnum) == 1)
goto SKIPBULLETHOLE;
if (isablockdoor(hit.hitWall->picnum) == 1)
goto SKIPBULLETHOLE;

View file

@ -49,43 +49,6 @@ BEGIN_DUKE_NS
//
//---------------------------------------------------------------------------
bool isadoorwall_d(int dapic)
{
switch(dapic)
{
case DOORTILE1:
case DOORTILE2:
case DOORTILE3:
case DOORTILE4:
case DOORTILE5:
case DOORTILE6:
case DOORTILE7:
case DOORTILE8:
case DOORTILE9:
case DOORTILE10:
case DOORTILE11:
case DOORTILE12:
case DOORTILE14:
case DOORTILE15:
case DOORTILE16:
case DOORTILE17:
case DOORTILE18:
case DOORTILE19:
case DOORTILE20:
case DOORTILE21:
case DOORTILE22:
case DOORTILE23:
return 1;
}
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void animatewalls_d(void)
{
int t;
@ -320,7 +283,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
if (check_activator_motion(lotag)) return 0;
break;
default:
if (fi.isadoorwall(picnum) == 0) return 0;
if (isadoorwall(picnum) == 0) return 0;
break;
}
@ -456,7 +419,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
switch (picnum)
{
default:
if (fi.isadoorwall(picnum) == 0) break;
if (isadoorwall(picnum) == 0) break;
[[fallthrough]];
case DIPSWITCH:
case DIPSWITCHON:
@ -558,7 +521,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
picnum == ALIENSWITCH || picnum == ALIENSWITCHON ||
picnum == TECHSWITCH || picnum == TECHSWITCHON) return 1;
if (hitag == 0 && fi.isadoorwall(picnum) == 0)
if (hitag == 0 && isadoorwall(picnum) == 0)
{
if (act)
S_PlaySound3D(SWITCH_ON, act, v);
@ -1649,7 +1612,7 @@ void checksectors_d(int snum)
if (near.hitWall)
{
if (near.hitWall->lotag > 0 && fi.isadoorwall(near.hitWall->picnum))
if (near.hitWall->lotag > 0 && isadoorwall(near.hitWall->picnum))
{
if (hitscanwall == near.hitWall || hitscanwall == nullptr)
fi.checkhitswitch(snum, near.hitWall, nullptr);

View file

@ -43,159 +43,6 @@ BEGIN_DUKE_NS
//
//---------------------------------------------------------------------------
bool isadoorwall_r(int dapic)
{
switch(dapic)
{
case DOORTILE1:
case DOORTILE2:
case DOORTILE3:
case DOORTILE4:
case DOORTILE5:
case DOORTILE6:
case DOORTILE7:
case DOORTILE8:
case DOORTILE9:
case DOORTILE10:
case DOORTILE11:
case DOORTILE12:
case DOORTILE14:
case DOORTILE15:
case DOORTILE16:
case DOORTILE17:
case DOORTILE18:
case DOORTILE19:
case DOORTILE20:
case DOORTILE21:
case DOORTILE22:
case RRTILE1856:
case RRTILE1877:
return 1;
}
return 0;
}
bool isablockdoor(int dapic)
{
switch (dapic)
{
case RRTILE1792:
case RRTILE1801:
case RRTILE1805:
case RRTILE1807:
case RRTILE1808:
case RRTILE1812:
case RRTILE1821:
case RRTILE1826:
case RRTILE1850:
case RRTILE1851:
case RRTILE1856:
case RRTILE1877:
case RRTILE1938:
case RRTILE1942:
case RRTILE1944:
case RRTILE1945:
case RRTILE1951:
case RRTILE1961:
case RRTILE1964:
case RRTILE1985:
case RRTILE1995:
case RRTILE2022:
case RRTILE2052:
case RRTILE2053:
case RRTILE2060:
case RRTILE2074:
case RRTILE2132:
case RRTILE2136:
case RRTILE2139:
case RRTILE2150:
case RRTILE2178:
case RRTILE2186:
case RRTILE2319:
case RRTILE2321:
case RRTILE2326:
case RRTILE2329:
case RRTILE2578:
case RRTILE2581:
case RRTILE2610:
case RRTILE2613:
case RRTILE2621:
case RRTILE2622:
case RRTILE2676:
case RRTILE2732:
case RRTILE2831:
case RRTILE2832:
case RRTILE2842:
case RRTILE2940:
case RRTILE2970:
case RRTILE3083:
case RRTILE3100:
case RRTILE3155:
case RRTILE3195:
case RRTILE3232:
case RRTILE3600:
case RRTILE3631:
case RRTILE3635:
case RRTILE3637:
case RRTILE3643+2:
case RRTILE3643+3:
case RRTILE3647:
case RRTILE3652:
case RRTILE3653:
case RRTILE3671:
case RRTILE3673:
case RRTILE3684:
case RRTILE3708:
case RRTILE3714:
case RRTILE3716:
case RRTILE3723:
case RRTILE3725:
case RRTILE3737:
case RRTILE3754:
case RRTILE3762:
case RRTILE3763:
case RRTILE3764:
case RRTILE3765:
case RRTILE3767:
case RRTILE3793:
case RRTILE3814:
case RRTILE3815:
case RRTILE3819:
case RRTILE3827:
case RRTILE3837:
return true;
case RRTILE1996:
case RRTILE2382:
case RRTILE2961:
case RRTILE3804:
case RRTILE7430:
case RRTILE7467:
case RRTILE7469:
case RRTILE7470:
case RRTILE7475:
case RRTILE7566:
case RRTILE7576:
case RRTILE7716:
case RRTILE8063:
case RRTILE8067:
case RRTILE8076:
case RRTILE8106:
case RRTILE8379:
case RRTILE8380:
case RRTILE8565:
case RRTILE8605:
return isRRRA();
}
return false;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void animatewalls_r(void)
{
int t;
@ -448,7 +295,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
if (check_activator_motion(lotag)) return 0;
break;
default:
if (fi.isadoorwall(picnum) == 0) return 0;
if (isadoorwall(picnum) == 0) return 0;
break;
}
@ -642,7 +489,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
switch (picnum)
{
default:
if (fi.isadoorwall(picnum) == 0) break;
if (isadoorwall(picnum) == 0) break;
[[fallthrough]];
case DIPSWITCH:
case DIPSWITCHON:
@ -834,7 +681,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
picnum == ALIENSWITCH || picnum == ALIENSWITCHON ||
picnum == TECHSWITCH || picnum == TECHSWITCHON) return 1;
if (hitag == 0 && fi.isadoorwall(picnum) == 0)
if (hitag == 0 && isadoorwall(picnum) == 0)
{
if (act)
S_PlaySound3D(SWITCH_ON, act, v);
@ -2540,7 +2387,7 @@ void checksectors_r(int snum)
if (near.hitWall)
{
if (near.hitWall->lotag > 0 && fi.isadoorwall(near.hitWall->picnum))
if (near.hitWall->lotag > 0 && isadoorwall(near.hitWall->picnum))
{
if (hitscanwall == near.hitWall || hitscanwall == nullptr)
fi.checkhitswitch(snum, near.hitWall, nullptr);

View file

@ -6,3 +6,5 @@ define TFLAG_ADULT 2
define TFLAG_ELECTRIC 4
define TFLAG_CLEARINVENTORY 8
define TFLAG_SLIME 16
define TFLAG_DOORWALL 32
define TFLAG_BLOCKDOOR 64

View file

@ -162,3 +162,28 @@ tileflag TFLAG_ADULT {
tileflag TFLAG_ELECTRIC { HURTRAIL }
tileflag TFLAG_CLEARINVENTORY { HURTRAIL FLOORSLIME FLOORPLASMA }
tileflag TFLAG_SLIME { FLOORSLIME FLOORSLIME1 FLOORSLIME2 }
tileflag TFLAG_DOORWALL {
DOORTILE1
DOORTILE2
DOORTILE3
DOORTILE4
DOORTILE5
DOORTILE6
DOORTILE7
DOORTILE8
DOORTILE9
DOORTILE10
DOORTILE11
DOORTILE12
DOORTILE14
DOORTILE15
DOORTILE16
DOORTILE17
DOORTILE18
DOORTILE19
DOORTILE20
DOORTILE21
DOORTILE22
DOORTILE23
}

View file

@ -20,3 +20,25 @@ tileflag TFLAG_WALLSWITCH {
IRONWHEELSWITCH
IRONWHEELSWITCHON }
tileflag TFLAG_BLOCKDOOR {
RRTILE1996
RRTILE2382
RRTILE2961
RRTILE3804
RRTILE7430
RRTILE7467
RRTILE7469
RRTILE7470
RRTILE7475
RRTILE7566
RRTILE7576
RRTILE7716
RRTILE8063
RRTILE8067
RRTILE8076
RRTILE8106
RRTILE8379
RRTILE8380
RRTILE8565
RRTILE8605
}

View file

@ -120,3 +120,115 @@ tileflag TFLAG_ELECTRIC { HURTRAIL }
tileflag TFLAG_CLEARINVENTORY { HURTRAIL FLOORSLIME FLOORPLASMA }
tileflag TFLAG_SLIME { FLOORSLIME FLOORSLIME1 FLOORSLIME2 }
tileflag TFLAG_DOORWALL {
DOORTILE1
DOORTILE2
DOORTILE3
DOORTILE4
DOORTILE5
DOORTILE6
DOORTILE7
DOORTILE8
DOORTILE9
DOORTILE10
DOORTILE11
DOORTILE12
DOORTILE14
DOORTILE15
DOORTILE16
DOORTILE17
DOORTILE18
DOORTILE19
DOORTILE20
DOORTILE21
DOORTILE22
RRTILE1856
RRTILE1877
}
tileflag TFLAG_BLOCKDOOR {
RRTILE1792
RRTILE1801
RRTILE1805
RRTILE1807
RRTILE1808
RRTILE1812
RRTILE1821
RRTILE1826
RRTILE1850
RRTILE1851
RRTILE1856
RRTILE1877
RRTILE1938
RRTILE1942
RRTILE1944
RRTILE1945
RRTILE1951
RRTILE1961
RRTILE1964
RRTILE1985
RRTILE1995
RRTILE2022
RRTILE2052
RRTILE2053
RRTILE2060
RRTILE2074
RRTILE2132
RRTILE2136
RRTILE2139
RRTILE2150
RRTILE2178
RRTILE2186
RRTILE2319
RRTILE2321
RRTILE2326
RRTILE2329
RRTILE2578
RRTILE2581
RRTILE2610
RRTILE2613
RRTILE2621
RRTILE2622
RRTILE2676
RRTILE2732
RRTILE2831
RRTILE2832
RRTILE2842
RRTILE2940
RRTILE2970
RRTILE3083
RRTILE3100
RRTILE3155
RRTILE3195
RRTILE3232
RRTILE3600
RRTILE3631
RRTILE3635
RRTILE3637
RRTILE3645
RRTILE3646
RRTILE3647
RRTILE3652
RRTILE3653
RRTILE3671
RRTILE3673
RRTILE3684
RRTILE3708
RRTILE3714
RRTILE3716
RRTILE3723
RRTILE3725
RRTILE3737
RRTILE3754
RRTILE3762
RRTILE3763
RRTILE3764
RRTILE3765
RRTILE3767
RRTILE3793
RRTILE3814
RRTILE3815
RRTILE3819
RRTILE3827
RRTILE3837
}