mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- wall switch check turned into a flag.
This commit is contained in:
parent
8a0baf3aad
commit
1c4dcde743
6 changed files with 121 additions and 59 deletions
|
@ -241,11 +241,6 @@ inline int LocateTheLocator(int const tag, int const sectNum)
|
|||
return A_FindLocator(tag, sectNum);
|
||||
}
|
||||
|
||||
int A_CheckSwitchTile(int spriteNum);
|
||||
inline int wallswitchcheck(int s)
|
||||
{
|
||||
return A_CheckSwitchTile(s);
|
||||
}
|
||||
int A_IncurDamage(int spriteNum);
|
||||
void A_AddToDeleteQueue(int spriteNum);
|
||||
void A_DeleteSprite(int spriteNum);
|
||||
|
|
|
@ -88,6 +88,49 @@ void initactorflags_d()
|
|||
{
|
||||
setflag(SFLAG_INTERNAL_BADGUY|SFLAG_NODAMAGEPUSH, { FIREFLY, BOSS5, BOSS5STAYPUT });
|
||||
}
|
||||
}
|
||||
|
||||
settileflag(TFLAG_WALLSWITCH, {
|
||||
HANDPRINTSWITCH,
|
||||
HANDPRINTSWITCH+1,
|
||||
ALIENSWITCH,
|
||||
ALIENSWITCH+1,
|
||||
MULTISWITCH,
|
||||
MULTISWITCH+1,
|
||||
MULTISWITCH+2,
|
||||
MULTISWITCH+3,
|
||||
ACCESSSWITCH,
|
||||
ACCESSSWITCH2,
|
||||
PULLSWITCH,
|
||||
PULLSWITCH+1,
|
||||
HANDSWITCH,
|
||||
HANDSWITCH+1,
|
||||
SLOTDOOR,
|
||||
SLOTDOOR+1,
|
||||
LIGHTSWITCH,
|
||||
LIGHTSWITCH+1,
|
||||
SPACELIGHTSWITCH,
|
||||
SPACELIGHTSWITCH+1,
|
||||
SPACEDOORSWITCH,
|
||||
SPACEDOORSWITCH+1,
|
||||
FRANKENSTINESWITCH,
|
||||
FRANKENSTINESWITCH+1,
|
||||
LIGHTSWITCH2,
|
||||
LIGHTSWITCH2+1,
|
||||
POWERSWITCH1,
|
||||
POWERSWITCH1+1,
|
||||
LOCKSWITCH1,
|
||||
LOCKSWITCH1+1,
|
||||
POWERSWITCH2,
|
||||
POWERSWITCH2+1,
|
||||
DIPSWITCH,
|
||||
DIPSWITCH+1,
|
||||
DIPSWITCH2,
|
||||
DIPSWITCH2+1,
|
||||
TECHSWITCH,
|
||||
TECHSWITCH+1,
|
||||
DIPSWITCH3,
|
||||
DIPSWITCH3+1});
|
||||
}
|
||||
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -102,6 +102,57 @@ void initactorflags_r()
|
|||
{
|
||||
setflag(SFLAG_NODAMAGEPUSH, { HULK, SBMOVE });
|
||||
}
|
||||
|
||||
settileflag(TFLAG_WALLSWITCH, {
|
||||
HANDPRINTSWITCH,
|
||||
HANDPRINTSWITCH+1,
|
||||
ALIENSWITCH,
|
||||
ALIENSWITCH+1,
|
||||
MULTISWITCH,
|
||||
MULTISWITCH+1,
|
||||
MULTISWITCH+2,
|
||||
MULTISWITCH+3,
|
||||
ACCESSSWITCH,
|
||||
ACCESSSWITCH2,
|
||||
PULLSWITCH,
|
||||
PULLSWITCH+1,
|
||||
HANDSWITCH,
|
||||
HANDSWITCH+1,
|
||||
SLOTDOOR,
|
||||
SLOTDOOR+1,
|
||||
LIGHTSWITCH,
|
||||
LIGHTSWITCH+1,
|
||||
SPACELIGHTSWITCH,
|
||||
SPACELIGHTSWITCH+1,
|
||||
SPACEDOORSWITCH,
|
||||
SPACEDOORSWITCH+1,
|
||||
FRANKENSTINESWITCH,
|
||||
FRANKENSTINESWITCH+1,
|
||||
LIGHTSWITCH2,
|
||||
LIGHTSWITCH2+1,
|
||||
POWERSWITCH1,
|
||||
POWERSWITCH1+1,
|
||||
LOCKSWITCH1,
|
||||
LOCKSWITCH1+1,
|
||||
POWERSWITCH2,
|
||||
POWERSWITCH2+1,
|
||||
DIPSWITCH,
|
||||
DIPSWITCH+1,
|
||||
DIPSWITCH2,
|
||||
DIPSWITCH2+1,
|
||||
TECHSWITCH,
|
||||
TECHSWITCH+1,
|
||||
DIPSWITCH3,
|
||||
DIPSWITCH3+1,
|
||||
NUKEBUTTON,
|
||||
NUKEBUTTON+1});
|
||||
if (isRRRA()) settileflag(TFLAG_WALLSWITCH, {
|
||||
MULTISWITCH2,
|
||||
MULTISWITCH2+1,
|
||||
MULTISWITCH2+2,
|
||||
MULTISWITCH2+3,
|
||||
RRTILE8464,
|
||||
RRTILE8464+1});
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
|
@ -303,6 +303,17 @@ inline int32_t G_GetTeamPalette(int32_t team)
|
|||
return pal[team];
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
TFLAG_WALLSWITCH = 1
|
||||
};
|
||||
// for now just flags not related to actors, may get more info later.
|
||||
struct TileInfo
|
||||
{
|
||||
int flags;
|
||||
};
|
||||
extern TileInfo tileinfo[MAXTILES];
|
||||
|
||||
inline int actorflag(int spritenum, int mask)
|
||||
{
|
||||
return (((actorinfo[sprite[spritenum].picnum].flags/* ^ actor[spritenum].flags*/) & mask) != 0);
|
||||
|
@ -321,6 +332,19 @@ inline void setflag(int flag, const std::initializer_list<short>& types)
|
|||
}
|
||||
}
|
||||
|
||||
inline void settileflag(int flag, const std::initializer_list<short>& types)
|
||||
{
|
||||
for (auto val : types)
|
||||
{
|
||||
tileinfo[val].flags |= flag;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool wallswitchcheck(int s)
|
||||
{
|
||||
return !!(tileinfo[s].flags & TFLAG_WALLSWITCH);
|
||||
}
|
||||
|
||||
// (unsigned)iPicnum check: AMC TC Rusty Nails, bayonet MG alt. fire, iPicnum == -1 (via aplWeaponShoots)
|
||||
#define A_CheckSpriteTileFlags(iPicnum, iType) (((unsigned)iPicnum < MAXTILES) && (actorinfo[iPicnum].flags & iType) != 0)
|
||||
#define S_StopSound(num) S_StopEnvSound(num, -1)
|
||||
|
|
|
@ -177,7 +177,7 @@ int initspriteforspawn(int j, int pn, const std::initializer_list<int> &excludes
|
|||
if (!isIn(sp->picnum, excludes) && (sp->cstat & 48))
|
||||
{
|
||||
if (sp->shade == 127) return i;
|
||||
if (wallswitchcheck(i) == 1 && (sp->cstat & 16))
|
||||
if (wallswitchcheck(i) && (sp->cstat & 16))
|
||||
{
|
||||
if (sp->picnum != TILE_ACCESSSWITCH && sp->picnum != TILE_ACCESSSWITCH2 && sprite[i].pal)
|
||||
{
|
||||
|
|
|
@ -245,58 +245,7 @@ void A_PlayAlertSound(int spriteNum)
|
|||
}
|
||||
}
|
||||
|
||||
int A_CheckSwitchTile(int spriteNum)
|
||||
{
|
||||
// picnum 0 would oob in the switch below,
|
||||
|
||||
if (PN(spriteNum) <= 0)
|
||||
return 0;
|
||||
|
||||
// TILE_MULTISWITCH has 4 states so deal with it separately,
|
||||
// TILE_ACCESSSWITCH and TILE_ACCESSSWITCH2 are only active in one state so deal with
|
||||
// them separately.
|
||||
|
||||
if ((PN(spriteNum) >= TILE_MULTISWITCH && PN(spriteNum) <= TILE_MULTISWITCH + 3) || (PN(spriteNum) == TILE_ACCESSSWITCH || PN(spriteNum) == TILE_ACCESSSWITCH2))
|
||||
return 1;
|
||||
|
||||
if (RRRA && PN(spriteNum) >= TILE_MULTISWITCH2 && PN(spriteNum) <= TILE_MULTISWITCH2 + 3)
|
||||
return 1;
|
||||
|
||||
// Loop to catch both states of switches.
|
||||
for (bssize_t j=1; j>=0; j--)
|
||||
{
|
||||
switch (DYNAMICTILEMAP(PN(spriteNum)-j))
|
||||
{
|
||||
case RRTILE8464__STATICRR:
|
||||
if (RRRA) return 1;
|
||||
break;
|
||||
case NUKEBUTTON__STATIC:
|
||||
if (RR) return 1;
|
||||
break;
|
||||
case HANDPRINTSWITCH__STATIC:
|
||||
case ALIENSWITCH__STATIC:
|
||||
case MULTISWITCH__STATIC:
|
||||
case PULLSWITCH__STATIC:
|
||||
case HANDSWITCH__STATIC:
|
||||
case SLOTDOOR__STATIC:
|
||||
case LIGHTSWITCH__STATIC:
|
||||
case SPACELIGHTSWITCH__STATIC:
|
||||
case SPACEDOORSWITCH__STATIC:
|
||||
case FRANKENSTINESWITCH__STATIC:
|
||||
case LIGHTSWITCH2__STATIC:
|
||||
case POWERSWITCH1__STATIC:
|
||||
case LOCKSWITCH1__STATIC:
|
||||
case POWERSWITCH2__STATIC:
|
||||
case DIPSWITCH__STATIC:
|
||||
case DIPSWITCH2__STATIC:
|
||||
case TECHSWITCH__STATIC:
|
||||
case DIPSWITCH3__STATIC:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
TileInfo tileinfo[MAXTILES];
|
||||
|
||||
|
||||
void movefta_d(void);
|
||||
|
|
Loading…
Reference in a new issue