mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +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
|
struct // Exhumed
|
||||||
{
|
{
|
||||||
sectortype* pSoundSect;
|
sectortype* pSoundSect;
|
||||||
|
sectortype* pAbove, * pBelow;
|
||||||
int Depth;
|
int Depth;
|
||||||
int Above;
|
|
||||||
int Below;
|
|
||||||
short Sound;
|
short Sound;
|
||||||
short Flag;
|
short Flag;
|
||||||
short Damage;
|
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;
|
case 6: ReadSectorV6(fr, sector[i]); break;
|
||||||
default: ReadSectorV7(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.
|
// 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.
|
||||||
// This way they just get copied to the sector backup array. These 4 are the only values in all games needing such treatment.
|
|
||||||
if (isExhumed())
|
if (isExhumed())
|
||||||
{
|
{
|
||||||
sector[i].Sound = -1;
|
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)
|
arc("SoundSect", c.pSoundSect, def->pSoundSect)
|
||||||
("Depth", c.Depth, def->Depth)
|
("Depth", c.Depth, def->Depth)
|
||||||
("Above", c.Above, def->Above)
|
("Above", c.pAbove, def->pAbove)
|
||||||
("Below", c.Below, def->Below)
|
("Below", c.pBelow, def->pBelow)
|
||||||
("Sound", c.Sound, def->Sound)
|
("Sound", c.Sound, def->Sound)
|
||||||
("Flag", c.Flag, def->Flag)
|
("Flag", c.Flag, def->Flag)
|
||||||
("Damage", c.Damage, def->Damage)
|
("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.
|
// repurpose otherwise unused fields in sectortype as temporary storage.
|
||||||
if (k == tag + 0)
|
if (k == tag + 0)
|
||||||
{
|
{
|
||||||
sect->Above = sect->floorz;
|
sect->Flag = sect->floorz;
|
||||||
sect->floorz += (((z - sect->floorz) / 32768) + 1) * 32768;
|
sect->floorz += (((z - sect->floorz) / 32768) + 1) * 32768;
|
||||||
sect->Below = sect->floorpicnum;
|
sect->Damage = sect->floorpicnum;
|
||||||
sect->floorpicnum = 13;
|
sect->floorpicnum = 13;
|
||||||
}
|
}
|
||||||
if (k == tag + 1)
|
if (k == tag + 1)
|
||||||
{
|
{
|
||||||
sect->Above = sect->ceilingz;
|
sect->Flag = sect->ceilingz;
|
||||||
sect->ceilingz += (((z - sect->ceilingz) / 32768) - 1) * 32768;
|
sect->ceilingz += (((z - sect->ceilingz) / 32768) - 1) * 32768;
|
||||||
sect->Below = sect->ceilingpicnum;
|
sect->Damage = sect->ceilingpicnum;
|
||||||
sect->ceilingpicnum = 13;
|
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();
|
auto sect = spr->sector();
|
||||||
if (k == tag + 0)
|
if (k == tag + 0)
|
||||||
{
|
{
|
||||||
sect->floorz = sect->Above;
|
sect->floorz = sect->Flag;
|
||||||
sect->floorpicnum = sect->Below;
|
sect->floorpicnum = sect->Damage;
|
||||||
}
|
}
|
||||||
if (k == tag + 1)
|
if (k == tag + 1)
|
||||||
{
|
{
|
||||||
sect->ceilingz = sect->Above;
|
sect->ceilingz = sect->Flag;
|
||||||
sect->ceilingpicnum = sect->Below;
|
sect->ceilingpicnum = sect->Damage;
|
||||||
}
|
}
|
||||||
}// end if
|
}// end if
|
||||||
}// end for
|
}// end for
|
||||||
|
|
|
@ -93,14 +93,14 @@ void AIBubble::Tick(RunListEvent* ev)
|
||||||
|
|
||||||
pSprite->z += pSprite->zvel;
|
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) {
|
if (pSprite->hitag > -1 && pSectAbove != nullptr) {
|
||||||
BuildAnim(nullptr, 70, 0, pSprite->x, pSprite->y, sector[nSectAbove].floorz, nSectAbove, 64, 0);
|
BuildAnim(nullptr, 70, 0, pSprite->x, pSprite->y, pSectAbove->floorz, sectnum(pSectAbove), 64, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DestroyBubble(pActor);
|
DestroyBubble(pActor);
|
||||||
|
|
|
@ -505,7 +505,7 @@ HITSPRITE:
|
||||||
if (hitactor == nullptr && hitwall < 0)
|
if (hitactor == nullptr && hitwall < 0)
|
||||||
{
|
{
|
||||||
auto pHitSect = §or[hitsect];
|
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->x = x2;
|
||||||
pSprite->y = y2;
|
pSprite->y = y2;
|
||||||
|
@ -708,18 +708,18 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, int n
|
||||||
|
|
||||||
int var_18 = 0;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
nSector = sector[nSector].Above;
|
pSector = pSector->pAbove;
|
||||||
ChangeActorSect(pBulletActor, nSector);
|
ChangeActorSect(pBulletActor, pSector);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pTarget == nullptr)
|
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)
|
void SnapSectors(int nSectorA, int nSectorB, int b)
|
||||||
{
|
{
|
||||||
for(auto& wal1 : wallsofsector(nSectorA))
|
for(auto& wal1 : wallsofsector(nSectorA))
|
||||||
|
@ -555,18 +545,18 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
|
||||||
}
|
}
|
||||||
case 99: // underwater type 2
|
case 99: // underwater type 2
|
||||||
{
|
{
|
||||||
int nSector =pSprite->sectnum;
|
auto pSector =pSprite->sector();
|
||||||
SetAbove(nSector, nHitag);
|
pSector->pAbove = §or[nHitag];
|
||||||
sector[nSector].Flag |= kSectUnderwater;
|
pSector->Flag |= kSectUnderwater;
|
||||||
|
|
||||||
DeleteActor(pActor);
|
DeleteActor(pActor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 98:
|
case 98:
|
||||||
{
|
{
|
||||||
int nSector =pSprite->sectnum;
|
auto pSector = pSprite->sector();
|
||||||
SetBelow(nSector, nHitag);
|
pSector->pBelow = §or[nHitag];
|
||||||
SnapSectors(nSector, nHitag, 1);
|
SnapSectors(sectnum(pSector), nHitag, 1);
|
||||||
|
|
||||||
DeleteActor(pActor);
|
DeleteActor(pActor);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -264,7 +264,7 @@ int BelowNear(DExhumedActor* pActor, int x, int y, int walldist, int _nSector)
|
||||||
while (pSect2)
|
while (pSect2)
|
||||||
{
|
{
|
||||||
pTempSect = pSect2;
|
pTempSect = pSect2;
|
||||||
pSect2 = pSect2->Below>=0? §or[pSect2->Below] : nullptr;
|
pSect2 = pSect2->pBelow;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ecx = pTempSect->floorz + pTempSect->Depth;
|
int ecx = pTempSect->floorz + pTempSect->Depth;
|
||||||
|
@ -329,9 +329,9 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
||||||
}
|
}
|
||||||
|
|
||||||
// loc_151E7:
|
// 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)
|
if (edi != nSector)
|
||||||
|
@ -351,11 +351,9 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
||||||
}
|
}
|
||||||
else
|
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, pSprite->sector()->pAbove);
|
||||||
|
|
||||||
ChangeActorSect(pActor, edi);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +411,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Path B
|
// Path B
|
||||||
if (pSprite->sector()->Below == -1)
|
if (pSprite->sector()->pBelow == nullptr)
|
||||||
{
|
{
|
||||||
nRet.exbits |= kHitAux2;
|
nRet.exbits |= kHitAux2;
|
||||||
|
|
||||||
|
@ -444,7 +442,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
||||||
}
|
}
|
||||||
else
|
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;
|
ebp = sprceiling + height;
|
||||||
nRet.exbits |= kHitAux1;
|
nRet.exbits |= kHitAux1;
|
||||||
|
@ -639,7 +637,7 @@ Collision MoveCreatureWithCaution(DExhumedActor* pActor)
|
||||||
zDiff = -zDiff;
|
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->x = x;
|
||||||
pSprite->y = y;
|
pSprite->y = y;
|
||||||
|
|
|
@ -456,19 +456,18 @@ void StartDeathSeq(int nPlayer, int nVal)
|
||||||
|
|
||||||
if (nWeapon > kWeaponSword && nWeapon <= kWeaponRing)
|
if (nWeapon > kWeaponSword && nWeapon <= kWeaponRing)
|
||||||
{
|
{
|
||||||
int nSector =pSprite->sectnum;
|
|
||||||
auto pSector = pSprite->sector();
|
auto pSector = pSprite->sector();
|
||||||
if (pSector->Below > -1) {
|
if (pSector->pBelow != nullptr) {
|
||||||
nSector = pSector->Below;
|
pSector = pSector->pBelow;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pGunActor = GrabBodyGunSprite();
|
auto pGunActor = GrabBodyGunSprite();
|
||||||
ChangeActorSect(pGunActor, nSector);
|
ChangeActorSect(pGunActor, pSector);
|
||||||
auto pGunSprite = &pGunActor->s();
|
auto pGunSprite = &pGunActor->s();
|
||||||
|
|
||||||
pGunSprite->x = pSprite->x;
|
pGunSprite->x = pSprite->x;
|
||||||
pGunSprite->y = pSprite->y;
|
pGunSprite->y = pSprite->y;
|
||||||
pGunSprite->z = sector[nSector].floorz - 512;
|
pGunSprite->z = pSector->floorz - 512;
|
||||||
|
|
||||||
ChangeActorStat(pGunActor, nGunLotag[nWeapon] + 900);
|
ChangeActorStat(pGunActor, nGunLotag[nWeapon] + 900);
|
||||||
|
|
||||||
|
@ -1110,27 +1109,27 @@ sectdone:
|
||||||
PlayerList[nPlayer].ototalvel = PlayerList[nPlayer].totalvel;
|
PlayerList[nPlayer].ototalvel = PlayerList[nPlayer].totalvel;
|
||||||
PlayerList[nPlayer].totalvel = ksqrt(sqrtNum);
|
PlayerList[nPlayer].totalvel = ksqrt(sqrtNum);
|
||||||
|
|
||||||
int nViewSect = pPlayerSprite->sectnum;
|
auto pViewSect = pPlayerSprite->sector();
|
||||||
|
|
||||||
int EyeZ = PlayerList[nPlayer].eyelevel + pPlayerSprite->z + nQuake[nPlayer];
|
int EyeZ = PlayerList[nPlayer].eyelevel + pPlayerSprite->z + nQuake[nPlayer];
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
int nCeilZ = sector[nViewSect].ceilingz;
|
int nCeilZ = pViewSect->ceilingz;
|
||||||
|
|
||||||
if (EyeZ >= nCeilZ)
|
if (EyeZ >= nCeilZ)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (sector[nViewSect].Above <= -1)
|
if (pViewSect->pAbove == nullptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
nViewSect = sector[nViewSect].Above;
|
pViewSect = pViewSect->pAbove;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do underwater sector check
|
// Do underwater sector check
|
||||||
if (bUnderwater)
|
if (bUnderwater)
|
||||||
{
|
{
|
||||||
if (nViewSect != pPlayerSprite->sectnum)
|
if (pViewSect != pPlayerSprite->sector())
|
||||||
{
|
{
|
||||||
if (nMove.type == kHitWall)
|
if (nMove.type == kHitWall)
|
||||||
{
|
{
|
||||||
|
@ -1138,19 +1137,19 @@ sectdone:
|
||||||
int var_D4 = pPlayerSprite->y;
|
int var_D4 = pPlayerSprite->y;
|
||||||
int var_C8 = pPlayerSprite->z;
|
int var_C8 = pPlayerSprite->z;
|
||||||
|
|
||||||
ChangeActorSect(pPlayerActor, nViewSect);
|
ChangeActorSect(pPlayerActor, pViewSect);
|
||||||
|
|
||||||
pPlayerSprite->x = spr_x;
|
pPlayerSprite->x = spr_x;
|
||||||
pPlayerSprite->y = spr_y;
|
pPlayerSprite->y = spr_y;
|
||||||
|
|
||||||
int var_FC = sector[nViewSect].floorz + (-5120);
|
int var_FC = pViewSect->floorz + (-5120);
|
||||||
|
|
||||||
pPlayerSprite->z = var_FC;
|
pPlayerSprite->z = var_FC;
|
||||||
|
|
||||||
auto coll = movesprite(pPlayerActor, x, y, 0, 5120, 0, CLIPMASK0);
|
auto coll = movesprite(pPlayerActor, x, y, 0, 5120, 0, CLIPMASK0);
|
||||||
if (coll.type == kHitWall)
|
if (coll.type == kHitWall)
|
||||||
{
|
{
|
||||||
ChangeActorSect(pPlayerActor, pPlayerSprite->sectnum);
|
ChangeActorSect(pPlayerActor, pPlayerSprite->sector());
|
||||||
|
|
||||||
pPlayerSprite->x = var_C4;
|
pPlayerSprite->x = var_C4;
|
||||||
pPlayerSprite->y = var_D4;
|
pPlayerSprite->y = var_D4;
|
||||||
|
@ -1166,12 +1165,12 @@ sectdone:
|
||||||
}
|
}
|
||||||
|
|
||||||
// loc_1ADAF
|
// loc_1ADAF
|
||||||
PlayerList[nPlayer].nPlayerViewSect = nViewSect;
|
PlayerList[nPlayer].nPlayerViewSect = sectnum(pViewSect);
|
||||||
|
|
||||||
PlayerList[nPlayer].nPlayerDX = pPlayerSprite->x - spr_x;
|
PlayerList[nPlayer].nPlayerDX = pPlayerSprite->x - spr_x;
|
||||||
PlayerList[nPlayer].nPlayerDY = pPlayerSprite->y - spr_y;
|
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;
|
auto actions = sPlayerInput[nPlayer].actions;
|
||||||
|
|
||||||
|
@ -2608,10 +2607,10 @@ sectdone:
|
||||||
// loc_1C4E1
|
// loc_1C4E1
|
||||||
pDopple->s().pos = pPlayerSprite->pos;
|
pDopple->s().pos = pPlayerSprite->pos;
|
||||||
|
|
||||||
if (pPlayerSprite->sector()->Above > -1)
|
if (pPlayerSprite->sector()->pAbove != nullptr)
|
||||||
{
|
{
|
||||||
pDopple->s().ang = pPlayerSprite->ang;
|
pDopple->s().ang = pPlayerSprite->ang;
|
||||||
ChangeActorSect(pDopple, pPlayerSprite->sector()->Above);
|
ChangeActorSect(pDopple, pPlayerSprite->sector()->pAbove);
|
||||||
pDopple->s().cstat = 0x101;
|
pDopple->s().cstat = 0x101;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -344,7 +344,7 @@ void AIWasp::Tick(RunListEvent* ev)
|
||||||
|
|
||||||
if (pSprite->z >= pSector->floorz)
|
if (pSprite->z >= pSector->floorz)
|
||||||
{
|
{
|
||||||
if (pSector->Below > -1)
|
if (pSector->pBelow != nullptr)
|
||||||
{
|
{
|
||||||
BuildSplash(pActor, pSector);
|
BuildSplash(pActor, pSector);
|
||||||
pSprite->cstat |= 0x8000;
|
pSprite->cstat |= 0x8000;
|
||||||
|
|
Loading…
Reference in a new issue