Skip to content

Commit

Permalink
- exported two more settings to tile flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers authored and mjr4077au committed Nov 26, 2022
1 parent 1c21cca commit c46721e
Show file tree
Hide file tree
Showing 14 changed files with 196 additions and 215 deletions.
3 changes: 3 additions & 0 deletions source/games/duke/src/constants.h
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions source/games/duke/src/dispatch.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -113,7 +111,6 @@ void SetDispatcher()
think_d,
movetransports_d,
initactorflags_d,
isadoorwall_d,
animatewalls_d,
operateforcefields_d,
checkhitswitch_d,
Expand Down Expand Up @@ -156,7 +153,6 @@ void SetDispatcher()
think_r,
movetransports_r,
initactorflags_r,
isadoorwall_r,
animatewalls_r,
operateforcefields_r,
checkhitswitch_r,
Expand Down
1 change: 0 additions & 1 deletion source/games/duke/src/duke3d.h
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/game.cpp
Expand Up @@ -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)
Expand Down
23 changes: 15 additions & 8 deletions source/games/duke/src/inlines.h
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion source/games/duke/src/namelist_r.h
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion source/games/duke/src/player_d.cpp
Expand Up @@ -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 ||
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/player_r.cpp
Expand Up @@ -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;
Expand Down
45 changes: 4 additions & 41 deletions source/games/duke/src/sectors_d.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c46721e

Please sign in to comment.