mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 14:41:55 +00:00
- Above and Below
This commit is contained in:
parent
7b84a1464c
commit
109ff8c3cb
10 changed files with 56 additions and 73 deletions
|
@ -104,10 +104,9 @@ struct sectortype
|
|||
};
|
||||
struct // Exhumed
|
||||
{
|
||||
sectortype* pSoundSect;
|
||||
sectortype* pSoundSect;
|
||||
sectortype* pAbove, * pBelow;
|
||||
int Depth;
|
||||
int Above;
|
||||
int Below;
|
||||
short Sound;
|
||||
short Flag;
|
||||
short Damage;
|
||||
|
|
|
@ -470,13 +470,10 @@ void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang,
|
|||
case 6: ReadSectorV6(fr, sector[i]); break;
|
||||
default: ReadSectorV7(fr, sector[i]); break;
|
||||
}
|
||||
// If we do not do this here, we need to do a lot more contortions to exclude these defaults from getting written out to savegames.
|
||||
// This way they just get copied to the sector backup array. These 4 are the only values in all games needing such treatment.
|
||||
// If we do not do this here, we need to do a lot more contortions to exclude this default from getting written out to savegames.
|
||||
if (isExhumed())
|
||||
{
|
||||
sector[i].Sound = -1;
|
||||
sector[i].Above = -1;
|
||||
sector[i].Below = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -575,8 +575,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort
|
|||
{
|
||||
arc("SoundSect", c.pSoundSect, def->pSoundSect)
|
||||
("Depth", c.Depth, def->Depth)
|
||||
("Above", c.Above, def->Above)
|
||||
("Below", c.Below, def->Below)
|
||||
("Above", c.pAbove, def->pAbove)
|
||||
("Below", c.pBelow, def->pBelow)
|
||||
("Sound", c.Sound, def->Sound)
|
||||
("Flag", c.Flag, def->Flag)
|
||||
("Damage", c.Damage, def->Damage)
|
||||
|
|
|
@ -73,16 +73,16 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
|
|||
// repurpose otherwise unused fields in sectortype as temporary storage.
|
||||
if (k == tag + 0)
|
||||
{
|
||||
sect->Above = sect->floorz;
|
||||
sect->Flag = sect->floorz;
|
||||
sect->floorz += (((z - sect->floorz) / 32768) + 1) * 32768;
|
||||
sect->Below = sect->floorpicnum;
|
||||
sect->Damage = sect->floorpicnum;
|
||||
sect->floorpicnum = 13;
|
||||
}
|
||||
if (k == tag + 1)
|
||||
{
|
||||
sect->Above = sect->ceilingz;
|
||||
sect->Flag = sect->ceilingz;
|
||||
sect->ceilingz += (((z - sect->ceilingz) / 32768) - 1) * 32768;
|
||||
sect->Below = sect->ceilingpicnum;
|
||||
sect->Damage = sect->ceilingpicnum;
|
||||
sect->ceilingpicnum = 13;
|
||||
}
|
||||
}
|
||||
|
@ -107,13 +107,13 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
|
|||
auto sect = spr->sector();
|
||||
if (k == tag + 0)
|
||||
{
|
||||
sect->floorz = sect->Above;
|
||||
sect->floorpicnum = sect->Below;
|
||||
sect->floorz = sect->Flag;
|
||||
sect->floorpicnum = sect->Damage;
|
||||
}
|
||||
if (k == tag + 1)
|
||||
{
|
||||
sect->ceilingz = sect->Above;
|
||||
sect->ceilingpicnum = sect->Below;
|
||||
sect->ceilingz = sect->Flag;
|
||||
sect->ceilingpicnum = sect->Damage;
|
||||
}
|
||||
}// end if
|
||||
}// end for
|
||||
|
|
|
@ -93,14 +93,14 @@ void AIBubble::Tick(RunListEvent* ev)
|
|||
|
||||
pSprite->z += pSprite->zvel;
|
||||
|
||||
int nSector = pSprite->sectnum;
|
||||
auto pSector = pSprite->sector();
|
||||
|
||||
if (pSprite->z <= sector[nSector].ceilingz)
|
||||
if (pSprite->z <= pSector->ceilingz)
|
||||
{
|
||||
int nSectAbove = sector[nSector].Above;
|
||||
auto pSectAbove = pSector->pAbove;
|
||||
|
||||
if (pSprite->hitag > -1 && nSectAbove != -1) {
|
||||
BuildAnim(nullptr, 70, 0, pSprite->x, pSprite->y, sector[nSectAbove].floorz, nSectAbove, 64, 0);
|
||||
if (pSprite->hitag > -1 && pSectAbove != nullptr) {
|
||||
BuildAnim(nullptr, 70, 0, pSprite->x, pSprite->y, pSectAbove->floorz, sectnum(pSectAbove), 64, 0);
|
||||
}
|
||||
|
||||
DestroyBubble(pActor);
|
||||
|
|
|
@ -505,7 +505,7 @@ HITSPRITE:
|
|||
if (hitactor == nullptr && hitwall < 0)
|
||||
{
|
||||
auto pHitSect = §or[hitsect];
|
||||
if ((pHitSect->Below >= 0 && (sector[pHitSect->Below].Flag & kSectUnderwater)) || pHitSect->Depth)
|
||||
if ((pHitSect->pBelow != nullptr && (pHitSect->pBelow->Flag & kSectUnderwater)) || pHitSect->Depth)
|
||||
{
|
||||
pSprite->x = x2;
|
||||
pSprite->y = y2;
|
||||
|
@ -708,18 +708,18 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, int n
|
|||
|
||||
int var_18 = 0;
|
||||
|
||||
nSector = pBulletSprite->sectnum;
|
||||
auto pSector = pBulletSprite->sector();
|
||||
|
||||
while (pBulletSprite->z < sector[nSector].ceilingz)
|
||||
while (pBulletSprite->z < pSector->ceilingz)
|
||||
{
|
||||
if (sector[nSector].Above == -1)
|
||||
if (pSector->pAbove == nullptr)
|
||||
{
|
||||
pBulletSprite->z = sector[nSector].ceilingz;
|
||||
pBulletSprite->z = pSector->ceilingz;
|
||||
break;
|
||||
}
|
||||
|
||||
nSector = sector[nSector].Above;
|
||||
ChangeActorSect(pBulletActor, nSector);
|
||||
pSector = pSector->pAbove;
|
||||
ChangeActorSect(pBulletActor, pSector);
|
||||
}
|
||||
|
||||
if (pTarget == nullptr)
|
||||
|
|
|
@ -194,16 +194,6 @@ void InitNewGame()
|
|||
}
|
||||
}
|
||||
|
||||
void SetBelow(int nCurSector, int nBelowSector)
|
||||
{
|
||||
sector[nCurSector].Below = nBelowSector;
|
||||
}
|
||||
|
||||
void SetAbove(int nCurSector, int nAboveSector)
|
||||
{
|
||||
sector[nCurSector].Above = nAboveSector;
|
||||
}
|
||||
|
||||
void SnapSectors(int nSectorA, int nSectorB, int b)
|
||||
{
|
||||
for(auto& wal1 : wallsofsector(nSectorA))
|
||||
|
@ -555,18 +545,18 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
|
|||
}
|
||||
case 99: // underwater type 2
|
||||
{
|
||||
int nSector =pSprite->sectnum;
|
||||
SetAbove(nSector, nHitag);
|
||||
sector[nSector].Flag |= kSectUnderwater;
|
||||
auto pSector =pSprite->sector();
|
||||
pSector->pAbove = §or[nHitag];
|
||||
pSector->Flag |= kSectUnderwater;
|
||||
|
||||
DeleteActor(pActor);
|
||||
return;
|
||||
}
|
||||
case 98:
|
||||
{
|
||||
int nSector =pSprite->sectnum;
|
||||
SetBelow(nSector, nHitag);
|
||||
SnapSectors(nSector, nHitag, 1);
|
||||
auto pSector = pSprite->sector();
|
||||
pSector->pBelow = §or[nHitag];
|
||||
SnapSectors(sectnum(pSector), nHitag, 1);
|
||||
|
||||
DeleteActor(pActor);
|
||||
return;
|
||||
|
|
|
@ -264,7 +264,7 @@ int BelowNear(DExhumedActor* pActor, int x, int y, int walldist, int _nSector)
|
|||
while (pSect2)
|
||||
{
|
||||
pTempSect = pSect2;
|
||||
pSect2 = pSect2->Below>=0? §or[pSect2->Below] : nullptr;
|
||||
pSect2 = pSect2->pBelow;
|
||||
}
|
||||
|
||||
int ecx = pTempSect->floorz + pTempSect->Depth;
|
||||
|
@ -329,9 +329,9 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
|||
}
|
||||
|
||||
// loc_151E7:
|
||||
while (ebp > pSprite->sector()->floorz && pSprite->sector()->Below >= 0)
|
||||
while (ebp > pSprite->sector()->floorz && pSprite->sector()->pBelow != nullptr)
|
||||
{
|
||||
ChangeActorSect(pActor, pSprite->sector()->Below);
|
||||
ChangeActorSect(pActor, pSprite->sector()->pBelow);
|
||||
}
|
||||
|
||||
if (edi != nSector)
|
||||
|
@ -351,11 +351,9 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
|||
}
|
||||
else
|
||||
{
|
||||
while ((ebp < pSprite->sector()->ceilingz) && (pSprite->sector()->Above >= 0))
|
||||
while ((ebp < pSprite->sector()->ceilingz) && (pSprite->sector()->pAbove != nullptr))
|
||||
{
|
||||
edi = pSprite->sector()->Above;
|
||||
|
||||
ChangeActorSect(pActor, edi);
|
||||
ChangeActorSect(pActor, pSprite->sector()->pAbove);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,7 +411,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
|||
else
|
||||
{
|
||||
// Path B
|
||||
if (pSprite->sector()->Below == -1)
|
||||
if (pSprite->sector()->pBelow == nullptr)
|
||||
{
|
||||
nRet.exbits |= kHitAux2;
|
||||
|
||||
|
@ -444,7 +442,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((ebp - height) < sprceiling && (hiHit.type == kHitSprite || pSprite->sector()->Above == -1))
|
||||
if ((ebp - height) < sprceiling && (hiHit.type == kHitSprite || pSprite->sector()->pAbove == nullptr))
|
||||
{
|
||||
ebp = sprceiling + height;
|
||||
nRet.exbits |= kHitAux1;
|
||||
|
@ -639,7 +637,7 @@ Collision MoveCreatureWithCaution(DExhumedActor* pActor)
|
|||
zDiff = -zDiff;
|
||||
}
|
||||
|
||||
if (zDiff > 15360 || (pSector->Flag & kSectUnderwater) || (pSector->Below > -1 && sector[pSector->Below].Flag) || pSector->Damage)
|
||||
if (zDiff > 15360 || (pSector->Flag & kSectUnderwater) || (pSector->pBelow != nullptr && pSector->pBelow->Flag) || pSector->Damage)
|
||||
{
|
||||
pSprite->x = x;
|
||||
pSprite->y = y;
|
||||
|
|
|
@ -456,19 +456,18 @@ void StartDeathSeq(int nPlayer, int nVal)
|
|||
|
||||
if (nWeapon > kWeaponSword && nWeapon <= kWeaponRing)
|
||||
{
|
||||
int nSector =pSprite->sectnum;
|
||||
auto pSector = pSprite->sector();
|
||||
if (pSector->Below > -1) {
|
||||
nSector = pSector->Below;
|
||||
if (pSector->pBelow != nullptr) {
|
||||
pSector = pSector->pBelow;
|
||||
}
|
||||
|
||||
auto pGunActor = GrabBodyGunSprite();
|
||||
ChangeActorSect(pGunActor, nSector);
|
||||
ChangeActorSect(pGunActor, pSector);
|
||||
auto pGunSprite = &pGunActor->s();
|
||||
|
||||
pGunSprite->x = pSprite->x;
|
||||
pGunSprite->y = pSprite->y;
|
||||
pGunSprite->z = sector[nSector].floorz - 512;
|
||||
pGunSprite->z = pSector->floorz - 512;
|
||||
|
||||
ChangeActorStat(pGunActor, nGunLotag[nWeapon] + 900);
|
||||
|
||||
|
@ -1110,27 +1109,27 @@ sectdone:
|
|||
PlayerList[nPlayer].ototalvel = PlayerList[nPlayer].totalvel;
|
||||
PlayerList[nPlayer].totalvel = ksqrt(sqrtNum);
|
||||
|
||||
int nViewSect = pPlayerSprite->sectnum;
|
||||
auto pViewSect = pPlayerSprite->sector();
|
||||
|
||||
int EyeZ = PlayerList[nPlayer].eyelevel + pPlayerSprite->z + nQuake[nPlayer];
|
||||
|
||||
while (1)
|
||||
{
|
||||
int nCeilZ = sector[nViewSect].ceilingz;
|
||||
int nCeilZ = pViewSect->ceilingz;
|
||||
|
||||
if (EyeZ >= nCeilZ)
|
||||
break;
|
||||
|
||||
if (sector[nViewSect].Above <= -1)
|
||||
if (pViewSect->pAbove == nullptr)
|
||||
break;
|
||||
|
||||
nViewSect = sector[nViewSect].Above;
|
||||
pViewSect = pViewSect->pAbove;
|
||||
}
|
||||
|
||||
// Do underwater sector check
|
||||
if (bUnderwater)
|
||||
{
|
||||
if (nViewSect != pPlayerSprite->sectnum)
|
||||
if (pViewSect != pPlayerSprite->sector())
|
||||
{
|
||||
if (nMove.type == kHitWall)
|
||||
{
|
||||
|
@ -1138,19 +1137,19 @@ sectdone:
|
|||
int var_D4 = pPlayerSprite->y;
|
||||
int var_C8 = pPlayerSprite->z;
|
||||
|
||||
ChangeActorSect(pPlayerActor, nViewSect);
|
||||
ChangeActorSect(pPlayerActor, pViewSect);
|
||||
|
||||
pPlayerSprite->x = spr_x;
|
||||
pPlayerSprite->y = spr_y;
|
||||
|
||||
int var_FC = sector[nViewSect].floorz + (-5120);
|
||||
int var_FC = pViewSect->floorz + (-5120);
|
||||
|
||||
pPlayerSprite->z = var_FC;
|
||||
|
||||
auto coll = movesprite(pPlayerActor, x, y, 0, 5120, 0, CLIPMASK0);
|
||||
if (coll.type == kHitWall)
|
||||
{
|
||||
ChangeActorSect(pPlayerActor, pPlayerSprite->sectnum);
|
||||
ChangeActorSect(pPlayerActor, pPlayerSprite->sector());
|
||||
|
||||
pPlayerSprite->x = var_C4;
|
||||
pPlayerSprite->y = var_D4;
|
||||
|
@ -1166,12 +1165,12 @@ sectdone:
|
|||
}
|
||||
|
||||
// loc_1ADAF
|
||||
PlayerList[nPlayer].nPlayerViewSect = nViewSect;
|
||||
PlayerList[nPlayer].nPlayerViewSect = sectnum(pViewSect);
|
||||
|
||||
PlayerList[nPlayer].nPlayerDX = pPlayerSprite->x - spr_x;
|
||||
PlayerList[nPlayer].nPlayerDY = pPlayerSprite->y - spr_y;
|
||||
|
||||
int var_5C = sector[nViewSect].Flag & kSectUnderwater;
|
||||
int var_5C = pViewSect->Flag & kSectUnderwater;
|
||||
|
||||
auto actions = sPlayerInput[nPlayer].actions;
|
||||
|
||||
|
@ -2608,10 +2607,10 @@ sectdone:
|
|||
// loc_1C4E1
|
||||
pDopple->s().pos = pPlayerSprite->pos;
|
||||
|
||||
if (pPlayerSprite->sector()->Above > -1)
|
||||
if (pPlayerSprite->sector()->pAbove != nullptr)
|
||||
{
|
||||
pDopple->s().ang = pPlayerSprite->ang;
|
||||
ChangeActorSect(pDopple, pPlayerSprite->sector()->Above);
|
||||
ChangeActorSect(pDopple, pPlayerSprite->sector()->pAbove);
|
||||
pDopple->s().cstat = 0x101;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -344,7 +344,7 @@ void AIWasp::Tick(RunListEvent* ev)
|
|||
|
||||
if (pSprite->z >= pSector->floorz)
|
||||
{
|
||||
if (pSector->Below > -1)
|
||||
if (pSector->pBelow != nullptr)
|
||||
{
|
||||
BuildSplash(pActor, pSector);
|
||||
pSprite->cstat |= 0x8000;
|
||||
|
|
Loading…
Reference in a new issue