- hitinfo.hitwall is also gone.

This commit is contained in:
Christoph Oelckers 2021-11-25 00:01:12 +01:00
parent 270a443c88
commit 6ae8e93de8
7 changed files with 25 additions and 33 deletions

View file

@ -3436,9 +3436,9 @@ int DoPlayerWadeSuperJump(PLAYERp pp)
bsin(pp->angle.ang.asbuild() + angs[i]), // Y vector of 3D ang bsin(pp->angle.ang.asbuild() + angs[i]), // Y vector of 3D ang
0, &hitinfo, CLIPMASK_MISSILE); // Z vector of 3D ang 0, &hitinfo, CLIPMASK_MISSILE); // Z vector of 3D ang
if (hitinfo.hitwall >= 0 && hitinfo.sector() != nullptr) if (hitinfo.wall() != nullptr && hitinfo.sector() != nullptr)
{ {
hitinfo.setSector(hitinfo.wall()->nextSector()); hitinfo.hitSector = hitinfo.wall()->nextSector();
if (hitinfo.sector() != nullptr && labs(hitinfo.sector()->floorz - pp->posz) < Z(50)) if (hitinfo.sector() != nullptr && labs(hitinfo.sector()->floorz - pp->posz) < Z(50))
{ {
@ -3782,7 +3782,7 @@ bool PlayerOnLadder(PLAYERp pp)
else else
{ {
// if you hit a wall and it is not a climb wall - forget it // if you hit a wall and it is not a climb wall - forget it
if (hitinfo.hitwall >= 0 && hitinfo.wall()->lotag != TAG_WALL_CLIMB) if (hitinfo.wall() != nullptr && hitinfo.wall()->lotag != TAG_WALL_CLIMB)
return false; return false;
} }
} }

View file

@ -956,7 +956,7 @@ int InitRipperHang(DSWActor* actor)
dist = Distance(sp->x, sp->y, hitinfo.pos.x, hitinfo.pos.y); dist = Distance(sp->x, sp->y, hitinfo.pos.x, hitinfo.pos.y);
if (hitinfo.hitwall < 0 || dist < 2000 || dist > 7000) if (hitinfo.wall() == nullptr || dist < 2000 || dist > 7000)
{ {
continue; continue;
} }

View file

@ -958,7 +958,7 @@ int InitRipper2Hang(DSWActor* actor)
dist = Distance(sp->x, sp->y, hitinfo.pos.x, hitinfo.pos.y); dist = Distance(sp->x, sp->y, hitinfo.pos.x, hitinfo.pos.y);
if (hitinfo.hitwall < 0 || dist < 2000 || dist > 7000) if (hitinfo.wall() == nullptr || dist < 2000 || dist > 7000)
{ {
continue; continue;
} }

View file

@ -2102,7 +2102,7 @@ bool NearThings(PLAYERp pp)
if (neartagsect >= 0) if (neartagsect >= 0)
return true; return true;
if (hitinfo.hitwall >= 0) if (hitinfo.wall() != nullptr)
{ {
WALLp wp; WALLp wp;

View file

@ -201,33 +201,25 @@ inline int Collision::setFromEngine(int value)
struct HITINFO { struct HITINFO {
DSWActor* hitactor; DSWActor* hitactor;
sectortype* hitSector; sectortype* hitSector;
int hitwall; walltype* hitWall;
short hitsprite;
vec3_t pos; vec3_t pos;
void clearObj() void clearObj()
{ {
pos = {}; pos = {};
hitwall = -1;
hitsprite = -1;
hitactor = nullptr; hitactor = nullptr;
hitSector = nullptr; hitSector = nullptr;
hitWall = nullptr;
} }
void set(hitdata_t* hit) void set(hitdata_t* hit)
{ {
hitSector = &::sector[hit->sect]; hitSector = hit->sect == -1? nullptr : &::sector[hit->sect];
hitwall = hit->wall; hitWall = hit->wall == -1 ? nullptr : &::wall[hit->wall];
hitsprite = hit->sprite;
hitactor = hit->sprite >= 0 ? &swActors[hit->sprite] : nullptr; hitactor = hit->sprite >= 0 ? &swActors[hit->sprite] : nullptr;
pos = hit->pos; pos = hit->pos;
} }
void setSector(sectortype* sect) walltype* wall() const { return hitWall; }
{
hitSector = sect;
}
walltype* wall() const { return hitwall == -1? nullptr : &::wall[hitwall]; }
sectortype* sector() const { return hitSector; } sectortype* sector() const { return hitSector; }
}; };

View file

@ -3147,7 +3147,7 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor)
if (hitinfo.hitactor != nullptr) if (hitinfo.hitactor != nullptr)
return false; return false;
if (hitinfo.hitwall < 0) if (hitinfo.wall() == nullptr)
return false; return false;
zdiff = labs(sp->z - hitinfo.wall()->nextSector()->floorz) >> 8; zdiff = labs(sp->z - hitinfo.wall()->nextSector()->floorz) >> 8;

View file

@ -12609,7 +12609,7 @@ int InitSwordAttack(PLAYERp pp)
} }
if (hitinfo.hitwall >= 0) if (hitinfo.wall() != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hitinfo.wall()->twoSided())
{ {
@ -12812,7 +12812,7 @@ int InitFistAttack(PLAYERp pp)
} }
if (hitinfo.hitwall >= 0) if (hitinfo.wall() != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hitinfo.wall()->twoSided())
{ {
@ -13511,7 +13511,7 @@ int ContinueHitscan(PLAYERp pp, sectortype* sect, int x, int y, int z, short ang
if (hitinfo.sector() == nullptr) if (hitinfo.sector() == nullptr)
return 0; return 0;
if (hitinfo.hitactor == nullptr && hitinfo.hitwall < 0) if (hitinfo.hitactor == nullptr && hitinfo.wall() == nullptr)
{ {
if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1)) if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1))
{ {
@ -13524,7 +13524,7 @@ int ContinueHitscan(PLAYERp pp, sectortype* sect, int x, int y, int z, short ang
} }
} }
if (hitinfo.hitwall >= 0) if (hitinfo.wall() != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hitinfo.wall()->twoSided())
{ {
@ -13647,7 +13647,7 @@ int InitShotgun(PLAYERp pp)
continue; continue;
} }
if (hitinfo.hitactor == nullptr && hitinfo.hitwall < 0) if (hitinfo.hitactor == nullptr && hitinfo.wall() == nullptr)
{ {
if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1)) if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1))
{ {
@ -13681,7 +13681,7 @@ int InitShotgun(PLAYERp pp)
} }
} }
if (hitinfo.hitwall >= 0) if (hitinfo.wall() != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hitinfo.wall()->twoSided())
{ {
@ -16209,7 +16209,7 @@ int InitUzi(PLAYERp pp)
SetVisHigh(); SetVisHigh();
// check to see what you hit // check to see what you hit
if (hitinfo.hitactor == nullptr && hitinfo.hitwall < 0) if (hitinfo.hitactor == nullptr && hitinfo.wall() == nullptr)
{ {
if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1)) if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1))
{ {
@ -16244,7 +16244,7 @@ int InitUzi(PLAYERp pp)
} }
} }
if (hitinfo.hitwall >= 0) if (hitinfo.wall() != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hitinfo.wall()->twoSided())
{ {
@ -16754,7 +16754,7 @@ int InitSobjMachineGun(DSWActor* actor, PLAYERp pp)
return 0; return 0;
} }
if (hitinfo.hitactor == nullptr && hitinfo.hitwall < 0) if (hitinfo.hitactor == nullptr && hitinfo.wall() == nullptr)
{ {
if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1)) if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1))
{ {
@ -17161,7 +17161,7 @@ int InitTurretMgun(SECTOR_OBJECTp sop)
if (hitinfo.sector() == nullptr) if (hitinfo.sector() == nullptr)
continue; continue;
if (hitinfo.hitactor == nullptr && hitinfo.hitwall < 0) if (hitinfo.hitactor == nullptr && hitinfo.wall() == nullptr)
{ {
if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1)) if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1))
{ {
@ -17182,7 +17182,7 @@ int InitTurretMgun(SECTOR_OBJECTp sop)
} }
if (hitinfo.hitwall >= 0) if (hitinfo.wall() != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hitinfo.wall()->twoSided())
{ {
@ -17318,7 +17318,7 @@ int InitEnemyUzi(DSWActor* actor)
PlaySound(DIGI_NINJAUZIATTACK, actor, v3df_none); PlaySound(DIGI_NINJAUZIATTACK, actor, v3df_none);
} }
if (hitinfo.hitwall >= 0) if (hitinfo.wall() != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hitinfo.wall()->twoSided())
{ {
@ -18918,7 +18918,7 @@ DSWActor* QueueWallBlood(DSWActor* actor, short ang)
if (hitinfo.hitactor != nullptr) if (hitinfo.hitactor != nullptr)
return nullptr; // Don't try to put blood on a sprite return nullptr; // Don't try to put blood on a sprite
if (hitinfo.hitwall >= 0) // Don't check if blood didn't hit a wall, otherwise the ASSERT fails! if (hitinfo.wall() != nullptr) // Don't check if blood didn't hit a wall, otherwise the ASSERT fails!
{ {
if (TestDontStick(nullptr, hitinfo.wall())) if (TestDontStick(nullptr, hitinfo.wall()))
return nullptr; return nullptr;