mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- made wall flags type safe
This commit is contained in:
parent
1e30f461e6
commit
8f012d1beb
8 changed files with 20 additions and 18 deletions
|
@ -451,7 +451,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
|
|||
|
||||
int const initialsectnum = *sectnum;
|
||||
|
||||
int32_t const dawalclipmask = (cliptype & 65535); // CLIPMASK0 = 0x00010001
|
||||
int32_t const dawalclipmask = (cliptype & 65535); // CLIPMASK0 = 0x00010001 (in desperate need of getting fixed!)
|
||||
int32_t const dasprclipmask = (cliptype >> 16); // CLIPMASK1 = 0x01000040
|
||||
|
||||
vec2_t const move = { xvect, yvect };
|
||||
|
@ -514,7 +514,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
|
|||
|
||||
int clipyou = 0;
|
||||
|
||||
if (wal->nextsector < 0 || (wal->cstat&dawalclipmask))
|
||||
if (wal->nextsector < 0 || (wal->cstat & EWallFlags::FromInt(dawalclipmask)))
|
||||
{
|
||||
clipyou = 1;
|
||||
}
|
||||
|
@ -879,7 +879,7 @@ int pushmove_(vec3_t *const vect, int *const sectnum,
|
|||
if (clipinsidebox(&vect->vec2, i, walldist-4) == 1)
|
||||
{
|
||||
int j = 0;
|
||||
if (wal->nextsector < 0 || wal->cstat&dawalclipmask) j = 1;
|
||||
if (wal->nextsector < 0 || wal->cstat & EWallFlags::FromInt(dawalclipmask)) j = 1;
|
||||
else
|
||||
{
|
||||
int32_t daz2;
|
||||
|
@ -1005,7 +1005,7 @@ void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBas
|
|||
if (da.x >= da.y)
|
||||
continue;
|
||||
|
||||
if (wal.cstat&dawalclipmask) continue; // XXX?
|
||||
if (wal.cstat & EWallFlags::FromInt(dawalclipmask)) continue; // XXX?
|
||||
|
||||
if (((nextsect->ceilingstat & CSTAT_SECTOR_SKY) == 0) && (pos.z <= nextsect->ceilingz+(3<<8))) continue;
|
||||
if (((nextsect->floorstat & CSTAT_SECTOR_SKY) == 0) && (pos.z >= nextsect->floorz-(3<<8))) continue;
|
||||
|
@ -1297,7 +1297,7 @@ int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& dire
|
|||
|
||||
if (!curspr)
|
||||
{
|
||||
if ((!wal->twoSided()) || (wal->cstat&dawalclipmask))
|
||||
if ((!wal->twoSided()) || (wal->cstat & EWallFlags::FromInt(dawalclipmask)))
|
||||
{
|
||||
hit_set(&hitinfo, sec, wal, nullptr, intx, inty, intz);
|
||||
continue;
|
||||
|
|
|
@ -221,7 +221,7 @@ static int32_t LoadMapHack(const char *filename, SpawnSpriteDef& sprites)
|
|||
{
|
||||
if (currentwall != -1 && validateWall())
|
||||
{
|
||||
wall[currentwall].cstat &= ~sc.Number;
|
||||
wall[currentwall].cstat &= EWallFlags::FromInt(~sc.Number);
|
||||
}
|
||||
else if (currentsprite != -1 && validateSprite())
|
||||
{
|
||||
|
@ -235,7 +235,7 @@ static int32_t LoadMapHack(const char *filename, SpawnSpriteDef& sprites)
|
|||
{
|
||||
if (currentwall != -1 && validateWall())
|
||||
{
|
||||
wall[currentwall].cstat |= sc.Number;
|
||||
wall[currentwall].cstat |= EWallFlags::FromInt(sc.Number);
|
||||
}
|
||||
else if (currentsprite != -1 && validateSprite())
|
||||
{
|
||||
|
|
|
@ -184,7 +184,7 @@ static void ReadWallV7(FileReader& fr, walltype& wall)
|
|||
wall.point2 = fr.ReadInt16();
|
||||
wall.nextwall = fr.ReadInt16();
|
||||
wall.nextsector = fr.ReadInt16();
|
||||
wall.cstat = fr.ReadUInt16();
|
||||
wall.cstat = EWallFlags::FromInt(fr.ReadUInt16());
|
||||
wall.picnum = fr.ReadInt16();
|
||||
wall.overpicnum = fr.ReadInt16();
|
||||
wall.shade = fr.ReadInt8();
|
||||
|
@ -209,7 +209,7 @@ static void ReadWallV6(FileReader& fr, walltype& wall)
|
|||
wall.overpicnum = fr.ReadInt16();
|
||||
wall.shade = fr.ReadInt8();
|
||||
wall.pal = fr.ReadUInt8();
|
||||
wall.cstat = fr.ReadUInt16();
|
||||
wall.cstat = EWallFlags::FromInt(fr.ReadUInt16());
|
||||
wall.xrepeat = fr.ReadUInt8();
|
||||
wall.yrepeat = fr.ReadUInt8();
|
||||
wall.xpan_ = fr.ReadUInt8();
|
||||
|
@ -227,7 +227,7 @@ static void ReadWallV5(FileReader& fr, walltype& wall)
|
|||
wall.picnum = fr.ReadInt16();
|
||||
wall.overpicnum = fr.ReadInt16();
|
||||
wall.shade = fr.ReadInt8();
|
||||
wall.cstat = fr.ReadUInt16();
|
||||
wall.cstat = EWallFlags::FromInt(fr.ReadUInt16());
|
||||
wall.xrepeat = fr.ReadUInt8();
|
||||
wall.yrepeat = fr.ReadUInt8();
|
||||
wall.xpan_ = fr.ReadUInt8();
|
||||
|
|
|
@ -116,6 +116,9 @@ enum EWallBits // names are from Shadow Warrior
|
|||
|
||||
};
|
||||
|
||||
typedef TFlags<EWallBits, uint16_t> EWallFlags;
|
||||
DEFINE_TFLAGS_OPERATORS(EWallFlags)
|
||||
|
||||
enum ESpriteBits // names mostly from SW.
|
||||
{
|
||||
CSTAT_SPRITE_BLOCK = 1, // bit 0: 1 = Blocking sprite (use with clipmove, getzrange) "B"
|
||||
|
@ -312,7 +315,7 @@ struct walltype
|
|||
float xpan_;
|
||||
float ypan_;
|
||||
|
||||
uint16_t cstat;
|
||||
EWallFlags cstat;
|
||||
int16_t picnum;
|
||||
int16_t overpicnum;
|
||||
union { int16_t lotag, type; }; // type is for Blood
|
||||
|
|
|
@ -5384,7 +5384,7 @@ int MoveMissile(DBloodActor* actor)
|
|||
if (pXWall->triggerVector)
|
||||
{
|
||||
trTriggerWall(pWall, kCmdWallImpact);
|
||||
if (!(pWall->cstat & 64))
|
||||
if (!(pWall->cstat & CSTAT_WALL_BLOCK_HITSCAN))
|
||||
{
|
||||
cliptype = -1;
|
||||
if (i-- > 0)
|
||||
|
@ -6814,8 +6814,7 @@ bool actCheckRespawn(DBloodActor* actor)
|
|||
|
||||
bool actCanSplatWall(walltype* pWall)
|
||||
{
|
||||
if (pWall->cstat & 16384) return 0;
|
||||
if (pWall->cstat & 32768) return 0;
|
||||
if (pWall->cstat & (CSTAT_WALL_MOVE_MASK)) return 0;
|
||||
|
||||
int nType = pWall->type;
|
||||
if (nType >= kWallBase && nType < kWallMax) return 0;
|
||||
|
|
|
@ -445,8 +445,8 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect
|
|||
pWall->point2 = LittleShort(load.point2);
|
||||
pWall->nextwall = LittleShort(load.nextwall);
|
||||
pWall->nextsector = LittleShort(load.nextsector);
|
||||
pWall->cstat = LittleShort(load.cstat);
|
||||
pWall->picnum = LittleShort(load.picnum);
|
||||
pWall->cstat = EWallFlags::FromInt(LittleShort(load.cstat));
|
||||
pWall->picnum = EWallFlags::FromInt(LittleShort(load.picnum));
|
||||
pWall->overpicnum = LittleShort(load.overpicnum);
|
||||
pWall->type = LittleShort(load.type);
|
||||
pWall->hitag = LittleShort(load.hitag);
|
||||
|
|
|
@ -3782,7 +3782,7 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
|||
case 25: return condCmp(pObj->picnum, arg1, arg2, cmpOp);
|
||||
case 26: return condCmp(pObj->pal, arg1, arg2, cmpOp);
|
||||
case 27: return condCmp(pObj->shade, arg1, arg2, cmpOp);
|
||||
case 28: return (pObj->cstat & arg1);
|
||||
case 28: return (pObj->cstat & EWallFlags::FromInt(arg1));
|
||||
case 29: return (pObj->hitag & arg1);
|
||||
case 30: return condCmp(pObj->xrepeat, arg1, arg2, cmpOp);
|
||||
case 31: return condCmp(pObj->xpan(), arg1, arg2, cmpOp);
|
||||
|
|
|
@ -979,7 +979,7 @@ void DoWall(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, i
|
|||
if (!bSet) SetGameVarID(lVar2, wallp->nextsector, sActor, sPlayer);
|
||||
break;
|
||||
case WALL_CSTAT:
|
||||
if (bSet) wallp->cstat = lValue;
|
||||
if (bSet) wallp->cstat = EWallFlags::FromInt(lValue);
|
||||
else SetGameVarID(lVar2, wallp->cstat, sActor, sPlayer);
|
||||
break;
|
||||
case WALL_PICNUM:
|
||||
|
|
Loading…
Reference in a new issue