- some more sectors.

This commit is contained in:
Christoph Oelckers 2021-11-22 22:38:27 +01:00
parent 78d9b78193
commit aee560624d
13 changed files with 51 additions and 52 deletions

View file

@ -33,7 +33,7 @@ DExhumedActor* BuildAnim(DExhumedActor* actor, int val, int val2, int x, int y,
void FuncAnim(int, int, int, int);
void BuildExplosion(DExhumedActor* actor);
void BuildSplash(DExhumedActor* actor, int nSector);
void BuildSplash(DExhumedActor* actor, sectortype* nSector);
// anubis

View file

@ -255,7 +255,7 @@ void BuildExplosion(DExhumedActor* pActor)
BuildAnim(nullptr, edx, 0, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, pSprite->xrepeat, 4);
}
void BuildSplash(DExhumedActor* actor, int nSector)
void BuildSplash(DExhumedActor* actor, sectortype* pSector)
{
auto pSprite = &actor->s();
int nRepeat, nSound;
@ -271,7 +271,7 @@ void BuildSplash(DExhumedActor* actor, int nSector)
nSound = kSound1;
}
int bIsLava = sector[nSector].Flag & kSectLava;
int bIsLava = pSector->Flag & kSectLava;
int edx, nFlag;
@ -286,7 +286,7 @@ void BuildSplash(DExhumedActor* actor, int nSector)
nFlag = 0;
}
auto pActor = BuildAnim(nullptr, edx, 0, pSprite->x, pSprite->y, sector[nSector].floorz, nSector, nRepeat, nFlag);
auto pActor = BuildAnim(nullptr, edx, 0, pSprite->x, pSprite->y, pSector->floorz, sectnum(pSector), nRepeat, nFlag);
if (!bIsLava)
{

View file

@ -220,8 +220,8 @@ void AIAnubis::Tick(RunListEvent* ev)
if (pTarget != nullptr) // NOTE: nTarget can be -1. this check wasn't in original code. TODO: demo compatiblity?
{
if (cansee(sp->x, sp->y, sp->z - GetActorHeight(ap), sp->sectnum,
pTarget->s().x, pTarget->s().y, pTarget->s().z - GetActorHeight(pTarget), pTarget->s().sectnum))
if (cansee(sp->x, sp->y, sp->z - GetActorHeight(ap), sp->sector(),
pTarget->s().x, pTarget->s().y, pTarget->s().z - GetActorHeight(pTarget), pTarget->s().sector()))
{
sp->xvel = 0;
sp->yvel = 0;

View file

@ -488,15 +488,14 @@ HITSPRITE:
auto pWall = &wall[hitwall];
if (pWall->picnum == kEnergy1)
{
int nSector = pWall->nextsector;
if (nSector > -1)
if (pWall->twoSided())
{
int nDamage = BulletInfo[pBullet->nType].nDamage;
if (pBullet->nDoubleDamage > 1) {
nDamage *= 2;
}
runlist_DamageEnemy(EnergyBlocks[sector[nSector].extra], pActor, nDamage);
runlist_DamageEnemy(EnergyBlocks[pWall->nextSector()->extra], pActor, nDamage);
}
}
}
@ -511,7 +510,7 @@ HITSPRITE:
pSprite->x = x2;
pSprite->y = y2;
pSprite->z = z2;
BuildSplash(pActor, hitsect);
BuildSplash(pActor, pHitSect);
}
else
{

View file

@ -260,7 +260,7 @@ void AILavaDude::Tick(RunListEvent* ev)
if (pTarget && nAction < 4)
{
if (!(pTarget->s().cstat & 0x101) || pTarget->s().sectnum >= 1024)
if (!(pTarget->s().cstat & 0x101) || pTarget->s().statnum == MAXSTATUS)
{
pTarget = nullptr;
pActor->pTarget = nullptr;

View file

@ -223,10 +223,10 @@ void clipwall()
}
int BelowNear(DExhumedActor* pActor, int x, int y, int walldist, int nSector)
int BelowNear(DExhumedActor* pActor, int x, int y, int walldist, int _nSector)
{
auto pSprite = &pActor->s();
nSector = pSprite->sectnum;
auto pSector = pSprite->sector();
int z = pSprite->z;
int z2;
@ -237,44 +237,43 @@ int BelowNear(DExhumedActor* pActor, int x, int y, int walldist, int nSector)
}
else
{
z2 = sector[nSector].floorz + sector[nSector].Depth;
z2 = pSector->floorz + pSector->Depth;
BFSSearch search(numsectors, nSector);
BFSSectorSearch search(pSector);
int edx = 0;
for (unsigned nCurSector; (nCurSector = search.GetNext()) != BFSSearch::EOL;)
sectortype* pTempSect = nullptr;
while (auto pCurSector = search.GetNext())
{
for (auto& wal : wallsofsector(nCurSector))
for (auto& wal : wallsofsector(pCurSector))
{
int nNextSector = wal.nextsector;
if (nNextSector >= 0)
if (wal.twoSided())
{
if (!search.Check(nNextSector))
if (!search.Check(wal.nextSector()))
{
vec2_t pos = { x, y };
if (clipinsidebox(&pos, wallnum(&wal), walldist))
{
search.Add(nNextSector);
search.Add(wal.nextSector());
}
}
}
}
int nSect2 = nCurSector;
auto pSect2 = pCurSector;
while (nSect2 >= 0)
while (pSect2)
{
edx = nSect2;
nSect2 = sector[nSect2].Below;
pTempSect = pSect2;
pSect2 = pSect2->Below>=0? &sector[pSect2->Below] : nullptr;
}
int ecx = sector[edx].floorz + sector[edx].Depth;
int ecx = pTempSect->floorz + pTempSect->Depth;
int eax = ecx - z;
if (eax < 0 && eax >= -5120)
{
z2 = ecx;
nSector = edx;
pSector = pTempSect;
}
}
}
@ -283,7 +282,7 @@ int BelowNear(DExhumedActor* pActor, int x, int y, int walldist, int nSector)
if (z2 < pSprite->z)
{
pSprite->z = z2;
overridesect = nSector;
overridesect = sectnum(pSector);
pSprite->zvel = 0;
bTouchFloor = true;
@ -300,6 +299,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
{
spritetype* pSprite = &pActor->s();
int nSector =pSprite->sectnum;
auto pSector = pSprite->sector();
assert(validSectorIndex(nSector));
overridesect = nSector;
@ -456,7 +456,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
if ((sector[nSector].Depth != 0) || (edi != nSector && (sector[edi].Flag & kSectUnderwater)))
{
assert(validSectorIndex(nSector));
BuildSplash(pActor, nSector);
BuildSplash(pActor, pSector);
}
}

View file

@ -214,8 +214,8 @@ void AIMummy::Tick(RunListEvent* ev)
{
if (RandomBit() && pTarget)
{
if (cansee(pSprite->x, pSprite->y, pSprite->z - GetActorHeight(pActor), pSprite->sectnum,
pTarget->s().x, pTarget->s().y, pTarget->s().z - GetActorHeight(pTarget), pTarget->s().sectnum))
if (cansee(pSprite->x, pSprite->y, pSprite->z - GetActorHeight(pActor), pSprite->sector(),
pTarget->s().x, pTarget->s().y, pTarget->s().z - GetActorHeight(pTarget), pTarget->s().sector()))
{
pActor->nAction = 3;
pActor->nFrame = 0;

View file

@ -129,12 +129,12 @@ void BuildRat(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAngl
DExhumedActor* FindFood(DExhumedActor* pActor)
{
auto pSprite = &pActor->s();
int nSector = pSprite->sectnum;
auto pSector = pSprite->sector();
int x = pSprite->x;
int y = pSprite->y;
int z = pSprite->z;
int z2 = (z + sector[nSector].ceilingz) / 2;
int z2 = (z + pSector->ceilingz) / 2;
if (nChunkTotal)
{
@ -142,7 +142,7 @@ DExhumedActor* FindFood(DExhumedActor* pActor)
if (pActor2 != nullptr)
{
auto pSprite2 = &pActor2->s();
if (cansee(x, y, z2, nSector, pSprite2->x, pSprite2->y, pSprite2->z, pSprite2->sectnum)) {
if (cansee(x, y, z2, pSector, pSprite2->x, pSprite2->y, pSprite2->z, pSprite2->sector())) {
return pActor2;
}
}
@ -158,7 +158,7 @@ DExhumedActor* FindFood(DExhumedActor* pActor)
auto pSprite2 = &pActor2->s();
if (nPlayerPic == pSprite2->picnum)
{
if (cansee(x, y, z, nSector, pSprite2->x, pSprite2->y, pSprite2->z, pSprite2->sectnum)) {
if (cansee(x, y, z, pSector, pSprite2->x, pSprite2->y, pSprite2->z, pSprite2->sector())) {
return pActor2;
}
}

View file

@ -1783,9 +1783,9 @@ void runlist_DamageEnemy(DExhumedActor* pActor, DExhumedActor* pActor2, int nDam
{
// Do a taunt
auto pPlayerActor = PlayerList[nPlayer].Actor();
int nSector = pPlayerActor->s().sectnum;
auto pSector = pPlayerActor->s().sector();
if (!(sector[nSector].Flag & kSectUnderwater))
if (!(pSector->Flag & kSectUnderwater))
{
int ebx = 0x4000;

View file

@ -440,8 +440,8 @@ void AIScorp::Effect(RunListEvent* ev, DExhumedActor* pTarget, int mode)
{
pActor->nCount = 45;
if (cansee(pSprite->x, pSprite->y, pSprite->z - GetActorHeight(pActor), pSprite->sectnum,
pTarget->s().x, pTarget->s().y, pTarget->s().z - GetActorHeight(pTarget), pTarget->s().sectnum))
if (cansee(pSprite->x, pSprite->y, pSprite->z - GetActorHeight(pActor), pSprite->sector(),
pTarget->s().x, pTarget->s().y, pTarget->s().z - GetActorHeight(pTarget), pTarget->s().sector()))
{
pSprite->xvel = 0;
pSprite->yvel = 0;

View file

@ -178,14 +178,14 @@ void AISpider::Tick(RunListEvent* ev)
case 3:
{
case_3:
int nSector =sp->sectnum;
auto pSector =sp->sector();
if (sp->cstat & 8)
{
sp->zvel = 0;
sp->z = sector[nSector].ceilingz + (tileHeight(sp->picnum) << 5);
sp->z = pSector->ceilingz + (tileHeight(sp->picnum) << 5);
if (sector[nSector].ceilingstat & 1)
if (pSector->ceilingstat & 1)
{
sp->cstat ^= 8;
sp->zvel = 1;
@ -216,7 +216,7 @@ void AISpider::Tick(RunListEvent* ev)
{
sp->cstat ^= 8;
sp->zvel = 1;
sp->z = sector[nSector].ceilingz + GetActorHeight(spp);
sp->z = pSector->ceilingz + GetActorHeight(spp);
}
else
{

View file

@ -111,7 +111,7 @@ static void analyzesprites(spritetype* tsprite, int& spritesortcnt, int x, int y
if (pTSprite->sectnum >= 0)
{
sectortype *pSector = &sector[pTSprite->sectnum];
sectortype *pSector = pTSprite->sector();
int nSectShade = (pSector->ceilingstat & 1) ? pSector->ceilingshade : pSector->floorshade;
int nShade = pTSprite->shade + nSectShade + 6;
pTSprite->shade = clamp(nShade, -128, 127);
@ -305,15 +305,15 @@ void DrawView(double smoothRatio, bool sceneonly)
}
}
}
auto pSector = &sector[nSector];
nCamerax = playerX;
nCameray = playerY;
nCameraz = playerZ;
int Z = sector[nSector].ceilingz + 256;
int Z = pSector->ceilingz + 256;
if (Z <= viewz)
{
Z = sector[nSector].floorz - 256;
Z = pSector->floorz - 256;
if (Z < viewz)
viewz = Z;

View file

@ -338,15 +338,15 @@ void AIWasp::Tick(RunListEvent* ev)
}
case 5:
{
int nSector =pSprite->sectnum;
auto pSector =pSprite->sector();
pSprite->z += pSprite->zvel;
if (pSprite->z >= sector[nSector].floorz)
if (pSprite->z >= pSector->floorz)
{
if (sector[nSector].Below > -1)
if (pSector->Below > -1)
{
BuildSplash(pActor, nSector);
BuildSplash(pActor, pSector);
pSprite->cstat |= 0x8000;
}