- most of the rest of the walls.

This commit is contained in:
Christoph Oelckers 2021-11-22 22:20:53 +01:00
parent 5374dafb56
commit 78d9b78193
9 changed files with 45 additions and 35 deletions

View file

@ -236,7 +236,7 @@ void BuildNear(int x, int y, int walldist, int nSector);
int PlotCourseToSprite(DExhumedActor* nSprite1, DExhumedActor* nSprite2);
void CheckSectorFloor(int nSector, int z, int *x, int *y);
int GetAngleToSprite(DExhumedActor* nSprite1, DExhumedActor* nSprite2);
int GetWallNormal(int nWall);
int GetWallNormal(walltype* nWall);
int GetUpAngle(DExhumedActor* nSprite1, int nVal, DExhumedActor* nSprite2, int ecx);
void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel);
Collision AngleChase(DExhumedActor* nSprite, DExhumedActor* nSprite2, int ebx, int ecx, int push1);

View file

@ -484,10 +484,11 @@ HITSPRITE:
}
else if (hitwall > -1)
{
HITWALL:
if (wall[hitwall].picnum == kEnergy1)
HITWALL:
auto pWall = &wall[hitwall];
if (pWall->picnum == kEnergy1)
{
int nSector =wall[hitwall].nextsector;
int nSector = pWall->nextsector;
if (nSector > -1)
{
int nDamage = BulletInfo[pBullet->nType].nDamage;

View file

@ -75,6 +75,16 @@ struct Collision
else { index = -1; actor = Actor(value & kHitIndexMask); }
return type;
}
walltype* wall()
{
return &::wall[index];
}
sectortype* sector()
{
return &::sector[index];
}
};
class DExhumedActor

View file

@ -82,7 +82,7 @@ void ThrowGrenade(int nPlayer, int, int, int ecx, int push1)
auto nMov = movesprite(pActor, bcos(nAngle) * (pPlayerSprite->clipdist << 3), bsin(nAngle) * (pPlayerSprite->clipdist << 3), ecx, 0, 0, CLIPMASK1);
if (nMov.type == kHitWall)
{
nAngle = GetWallNormal(nMov.index);
nAngle = GetWallNormal(nMov.wall());
BounceGrenade(pActor, nAngle);
}
}
@ -330,7 +330,7 @@ void AIGrenade::Tick(RunListEvent* ev)
// loc_2CF60:
if (nMov.type == kHitWall)
{
BounceGrenade(pActor, GetWallNormal(nMov.index));
BounceGrenade(pActor, GetWallNormal(nMov.wall()));
}
else if (nMov.type == kHitSprite)
{

View file

@ -450,7 +450,7 @@ void AILion::Tick(RunListEvent* ev)
if (nMov.type == kHitWall)
{
pActor->nAction = 7;
pSprite->ang = (GetWallNormal(nMov.index) + 1024) & kAngleMask;
pSprite->ang = (GetWallNormal(nMov.wall()) + 1024) & kAngleMask;
pActor->nCount = RandomSize(4);
return;
}

View file

@ -1245,9 +1245,9 @@ Collision AngleChase(DExhumedActor* pActor, DExhumedActor* pActor2, int ebx, int
return movesprite(pActor, x >> 2, y >> 2, (z >> 13) + bsin(ecx, -5), 0, 0, nClipType);
}
int GetWallNormal(int nWall)
int GetWallNormal(walltype* pWall)
{
auto delta = wall[nWall].delta();
auto delta = pWall->delta();
int nAngle = GetMyAngle(delta.x, delta.y);
return (nAngle + 512) & kAngleMask;
@ -1473,7 +1473,7 @@ void AICreatureChunk::Tick(RunListEvent* ev)
}
else if (nVal.type == kHitWall)
{
nAngle = GetWallNormal(nVal.index);
nAngle = GetWallNormal(nVal.wall());
}
else
{

View file

@ -105,22 +105,22 @@ void SetSavePoint(int nPlayer, int x, int y, int z, int nSector, int nAngle)
PlayerList[nPlayer].sPlayerSave.nAngle = nAngle;
}
void feebtag(int x, int y, int z, int nSector, DExhumedActor **nSprite, int nVal2, int nVal3)
void feebtag(int x, int y, int z, sectortype* pSector, DExhumedActor **nSprite, int nVal2, int nVal3)
{
*nSprite = nullptr;
int startwall = sector[nSector].wallptr;
auto startwall = pSector->firstWall();
int nWalls = sector[nSector].wallnum;
int nWalls = pSector->wallnum;
int var_20 = nVal2 & 2;
int var_14 = nVal2 & 1;
while (1)
{
if (nSector != -1)
if (pSector != nullptr)
{
ExhumedSectIterator it(nSector);
ExhumedSectIterator it(pSector);
while (auto pActor = it.Next())
{
auto pSprite = &pActor->s();
@ -158,7 +158,7 @@ void feebtag(int x, int y, int z, int nSector, DExhumedActor **nSprite, int nVal
if (nWalls < -1)
return;
nSector = wall[startwall].nextsector;
pSector = startwall->nextSector();
startwall++;
}
}
@ -1019,23 +1019,22 @@ void AIPlayer::Tick(RunListEvent* ev)
if (nMove.type == kHitSector || nMove.type == kHitWall)
{
int sectnum = 0;
sectortype* sect;
int nNormal = 0;
if (nMove.type == kHitSector)
{
sectnum = nMove.index;
sect = nMove.sector();
// Hm... Normal calculation here was broken.
}
else if (nMove.type == kHitWall)
else //if (nMove.type == kHitWall)
{
sectnum = wall[nMove.index].nextsector;
nNormal = GetWallNormal(nMove.index);
sect = nMove.wall()->nextSector();
nNormal = GetWallNormal(nMove.wall());
}
if (sectnum >= 0)
if (sect != nullptr)
{
auto sect = &sector[sectnum];
if ((sect->hitag == 45) && bTouchFloor)
{
int nDiff = AngleDiff(nNormal, (pPlayerSprite->ang + 1024) & kAngleMask);
@ -1321,7 +1320,7 @@ sectdone:
&nearTagSector, &nearTagWall, &nearTagSprite, (int32_t*)&nearHitDist, 1024, 2, nullptr);
DExhumedActor* pActorB;
feebtag(pPlayerSprite->x, pPlayerSprite->y, pPlayerSprite->z, pPlayerSprite->sectnum, &pActorB, var_30, 768);
feebtag(pPlayerSprite->x, pPlayerSprite->y, pPlayerSprite->z, pPlayerSprite->sector(), &pActorB, var_30, 768);
// Item pickup code
if (pActorB != nullptr && pActorB->s().statnum >= 900)
@ -2264,14 +2263,15 @@ sectdone:
{
ClearSpaceBar(nPlayer);
if (nearTagWall >= 0 && wall[nearTagWall].lotag > 0)
int tag;
if (nearTagWall >= 0 && (tag = wall[nearTagWall].lotag) > 0)
{
runlist_SignalRun(wall[nearTagWall].lotag - 1, nPlayer, &ExhumedAI::Use);
runlist_SignalRun(tag - 1, nPlayer, &ExhumedAI::Use);
}
if (nearTagSector >= 0 && sector[nearTagSector].lotag > 0)
if (nearTagSector >= 0 && (tag = sector[nearTagSector].lotag) > 0)
{
runlist_SignalRun(sector[nearTagSector].lotag - 1, nPlayer, &ExhumedAI::Use);
runlist_SignalRun(tag - 1, nPlayer, &ExhumedAI::Use);
}
}

View file

@ -575,7 +575,7 @@ void AIQueenEgg::Tick(RunListEvent* ev)
default:
return;
case kHitWall:
nAngle = GetWallNormal(nMov.index);
nAngle = GetWallNormal(nMov.wall());
break;
case kHitSprite:
nAngle = nMov.actor->s().ang;
@ -814,7 +814,7 @@ void AIQueenHead::Tick(RunListEvent* ev)
if (nMov.exbits == 0)
{
if (nMov.type == kHitSprite) nNewAng = nMov.actor->s().ang;
else if (nMov.type == kHitWall) nNewAng = GetWallNormal(nMov.index);
else if (nMov.type == kHitWall) nNewAng = GetWallNormal(nMov.wall());
}
else if (nMov.exbits == kHitAux2)
{

View file

@ -421,14 +421,13 @@ void AISet::Tick(RunListEvent* ev)
if (nMov.type == kHitWall)
{
int nWall = nMov.index;
int nSector = wall[nWall].nextsector;
auto pSector = nMov.wall()->nextSector();
if (nSector >= 0)
if (pSector)
{
if ((pSprite->z - sector[nSector].floorz) < 55000)
if ((pSprite->z - pSector->floorz) < 55000)
{
if (pSprite->z > sector[nSector].ceilingz)
if (pSprite->z > pSector->ceilingz)
{
pActor->nIndex = 1;
pActor->nAction = 7;