mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- migrated Exhumed's sector extensions to the actual struct.
This commit is contained in:
parent
e034635e12
commit
a21f6b6240
18 changed files with 136 additions and 135 deletions
|
@ -209,6 +209,12 @@ inline bool isSWALL()
|
|||
return g_gameType & (GAMEFLAG_SW | GAMEFLAG_SWWANTON | GAMEFLAG_SWTWINDRAG);
|
||||
}
|
||||
|
||||
inline bool isExhumed()
|
||||
{
|
||||
return g_gameType & GAMEFLAG_PSEXHUMED;
|
||||
}
|
||||
|
||||
|
||||
TArray<GrpEntry> GrpScan();
|
||||
void S_PauseSound(bool notmusic, bool notsfx);
|
||||
void S_ResumeSound(bool notsfx);
|
||||
|
|
|
@ -465,6 +465,15 @@ 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 (isExhumed())
|
||||
{
|
||||
sector[i].SoundSect = -1;
|
||||
sector[i].Sound = -1;
|
||||
sector[i].Above = -1;
|
||||
sector[i].Below = -1;
|
||||
}
|
||||
}
|
||||
|
||||
fr.Seek(wallpos, FileReader::SeekSet);
|
||||
|
|
|
@ -570,6 +570,18 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort
|
|||
BLD_NS::Serialize(arc, "xsector", *c._xs, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isExhumed())
|
||||
{
|
||||
arc("SoundSect", c.SoundSect, def->SoundSect)
|
||||
("Depth", c.Depth, def->Depth)
|
||||
("Above", c.Above, def->Above)
|
||||
("Below", c.Below, def->Below)
|
||||
("Sound", c.Sound, def->Sound)
|
||||
("Flag", c.Flag, def->Flag)
|
||||
("Damage", c.Damage, def->Damage)
|
||||
("Speed", c.Speed, def->Speed);
|
||||
|
||||
}
|
||||
|
||||
arc.EndObject();
|
||||
|
|
|
@ -243,7 +243,7 @@ void BuildExplosion(DExhumedActor* pActor)
|
|||
|
||||
int edx = 36;
|
||||
|
||||
if (SectFlag[nSector] & kSectUnderwater)
|
||||
if (sector[nSector].Flag & kSectUnderwater)
|
||||
{
|
||||
edx = 75;
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ void BuildSplash(DExhumedActor* actor, int nSector)
|
|||
nSound = kSound1;
|
||||
}
|
||||
|
||||
int bIsLava = SectFlag[nSector] & kSectLava;
|
||||
int bIsLava = sector[nSector].Flag & kSectLava;
|
||||
|
||||
int edx, nFlag;
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ void AIBubble::Tick(RunListEvent* ev)
|
|||
|
||||
if (pSprite->z <= sector[nSector].ceilingz)
|
||||
{
|
||||
int nSectAbove = SectAbove[nSector];
|
||||
int nSectAbove = sector[nSector].Above;
|
||||
|
||||
if (pSprite->hitag > -1 && nSectAbove != -1) {
|
||||
BuildAnim(nullptr, 70, 0, pSprite->x, pSprite->y, sector[nSectAbove].floorz, nSectAbove, 64, 0);
|
||||
|
|
|
@ -313,7 +313,7 @@ int MoveBullet(short nBullet)
|
|||
int x = pSprite->x;
|
||||
int y = pSprite->y;
|
||||
int z = pSprite->z; // ebx
|
||||
short nSectFlag = SectFlag[pSprite->sectnum];
|
||||
short nSectFlag = pSprite->sector()->Flag;
|
||||
|
||||
int x2, y2, z2;
|
||||
|
||||
|
@ -412,7 +412,7 @@ MOVEEND:
|
|||
nVal = coll.type || coll.exbits? 1:0;
|
||||
|
||||
// pSprite->sectnum may have changed since we set nSectFlag ?
|
||||
short nFlagVal = nSectFlag ^ SectFlag[pSprite->sectnum];
|
||||
short nFlagVal = nSectFlag ^ pSprite->sector()->Flag;
|
||||
if (nFlagVal & kSectUnderwater)
|
||||
{
|
||||
DestroyBullet(nBullet);
|
||||
|
@ -504,7 +504,8 @@ HITWALL:
|
|||
{
|
||||
if (hitactor == nullptr && hitwall < 0)
|
||||
{
|
||||
if ((SectBelow[hitsect] >= 0 && (SectFlag[SectBelow[hitsect]] & kSectUnderwater)) || SectDepth[hitsect])
|
||||
auto pHitSect = §or[hitsect];
|
||||
if ((pHitSect->Below >= 0 && (sector[pHitSect->Below].Flag & kSectUnderwater)) || pHitSect->Depth)
|
||||
{
|
||||
pSprite->x = x2;
|
||||
pSprite->y = y2;
|
||||
|
@ -711,13 +712,13 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, int n
|
|||
|
||||
while (pBulletSprite->z < sector[nSector].ceilingz)
|
||||
{
|
||||
if (SectAbove[nSector] == -1)
|
||||
if (sector[nSector].Above == -1)
|
||||
{
|
||||
pBulletSprite->z = sector[nSector].ceilingz;
|
||||
break;
|
||||
}
|
||||
|
||||
nSector = SectAbove[nSector];
|
||||
nSector = sector[nSector].Above;
|
||||
ChangeActorSect(pBulletActor, nSector);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,15 +89,6 @@ extern int Counters[kNumCounters];
|
|||
|
||||
void SnapSectors(int nSectorA, int nSectorB, int b);
|
||||
|
||||
extern short SectSound[];
|
||||
extern short SectDamage[];
|
||||
extern short SectSpeed[];
|
||||
extern int SectBelow[];
|
||||
extern short SectFlag[];
|
||||
extern int SectDepth[];
|
||||
extern int SectSoundSect[];
|
||||
extern int SectAbove[];
|
||||
|
||||
void LoadObjects();
|
||||
|
||||
// light
|
||||
|
|
|
@ -326,7 +326,7 @@ void AIFish::Tick(RunListEvent* ev)
|
|||
|
||||
short nAction = pActor->nAction;
|
||||
|
||||
if (!(SectFlag[pSprite->sectnum] & kSectUnderwater))
|
||||
if (!(pSprite->sector()->Flag & kSectUnderwater))
|
||||
{
|
||||
Gravity(pActor);
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ void AIFish::Tick(RunListEvent* ev)
|
|||
// loc_2EF54
|
||||
Collision coll = movesprite(pActor, pSprite->xvel << 13, pSprite->yvel << 13, pSprite->zvel << 2, 0, 0, CLIPMASK0);
|
||||
|
||||
if (!(SectFlag[pSprite->sectnum] & kSectUnderwater))
|
||||
if (!(pSprite->sector()->Flag & kSectUnderwater))
|
||||
{
|
||||
ChangeActorSect(pActor, nSector);
|
||||
pSprite->x = x;
|
||||
|
|
|
@ -153,7 +153,7 @@ void ExplodeGrenade(DExhumedActor* pActor)
|
|||
|
||||
pActor->nFrame = 1;
|
||||
|
||||
if (SectFlag[nGrenadeSect] & kSectUnderwater)
|
||||
if (sector[nGrenadeSect].Flag & kSectUnderwater)
|
||||
{
|
||||
var_28 = 75;
|
||||
var_20 = 60;
|
||||
|
@ -300,7 +300,7 @@ void AIGrenade::Tick(RunListEvent* ev)
|
|||
{
|
||||
if (zVel)
|
||||
{
|
||||
if (SectDamage[pGrenadeSprite->sectnum] > 0)
|
||||
if (pGrenadeSprite->sector()->Damage > 0)
|
||||
{
|
||||
ExplodeGrenade(pActor);
|
||||
return;
|
||||
|
|
|
@ -233,7 +233,7 @@ uint8_t WeaponCanFire(int nPlayer)
|
|||
short nWeapon = PlayerList[nPlayer].nCurrentWeapon;
|
||||
int nSector =PlayerList[nPlayer].nPlayerViewSect;
|
||||
|
||||
if (!(SectFlag[nSector] & kSectUnderwater) || WeaponInfo[nWeapon].bFireUnderwater)
|
||||
if (!(sector[nSector].Flag & kSectUnderwater) || WeaponInfo[nWeapon].bFireUnderwater)
|
||||
{
|
||||
short nAmmoType = WeaponInfo[nWeapon].nAmmoType;
|
||||
|
||||
|
@ -324,7 +324,7 @@ void MoveWeapons(int nPlayer)
|
|||
{
|
||||
static int dword_96E22 = 0;
|
||||
|
||||
short nSectFlag = SectFlag[PlayerList[nPlayer].nPlayerViewSect];
|
||||
int nSectFlag = sector[PlayerList[nPlayer].nPlayerViewSect].Flag;
|
||||
|
||||
if ((nSectFlag & kSectUnderwater) && (totalmoves & 1)) {
|
||||
return;
|
||||
|
|
|
@ -51,15 +51,6 @@ int movefifopos;
|
|||
|
||||
short nCurBodyGunNum;
|
||||
|
||||
int SectSoundSect[kMaxSectors] = { 0 };
|
||||
short SectSound[kMaxSectors] = { 0 };
|
||||
short SectFlag[kMaxSectors] = { 0 };
|
||||
int SectDepth[kMaxSectors] = { 0 };
|
||||
int SectAbove[kMaxSectors] = { 0 };
|
||||
short SectDamage[kMaxSectors] = { 0 };
|
||||
short SectSpeed[kMaxSectors] = { 0 };
|
||||
int SectBelow[kMaxSectors] = { 0 };
|
||||
|
||||
int Counters[kNumCounters];
|
||||
|
||||
|
||||
|
@ -205,12 +196,12 @@ void InitNewGame()
|
|||
|
||||
void SetBelow(short nCurSector, short nBelowSector)
|
||||
{
|
||||
SectBelow[nCurSector] = nBelowSector;
|
||||
sector[nCurSector].Below = nBelowSector;
|
||||
}
|
||||
|
||||
void SetAbove(short nCurSector, short nAboveSector)
|
||||
{
|
||||
SectAbove[nCurSector] = nAboveSector;
|
||||
sector[nCurSector].Above = nAboveSector;
|
||||
}
|
||||
|
||||
void SnapSectors(int nSectorA, int nSectorB, int b)
|
||||
|
@ -269,23 +260,19 @@ void SnapSectors(int nSectorA, int nSectorB, int b)
|
|||
sector[nSectorB].ceilingz = sector[nSectorA].floorz;
|
||||
}
|
||||
|
||||
if (SectFlag[nSectorA] & 0x1000) {
|
||||
if (sector[nSectorA].Flag & 0x1000) {
|
||||
SnapBobs(nSectorA, nSectorB);
|
||||
}
|
||||
}
|
||||
|
||||
void InitSectFlag()
|
||||
{
|
||||
for (int i = 0; i < kMaxSectors; i++)
|
||||
for(auto& Sect : sectors())
|
||||
{
|
||||
SectSoundSect[i] = -1;
|
||||
SectSound[i] = -1;
|
||||
SectAbove[i] = -1;
|
||||
SectBelow[i] = -1;
|
||||
SectDepth[i] = 0;
|
||||
SectFlag[i] = 0;
|
||||
SectSpeed[i] = 0;
|
||||
SectDamage[i] = 0;
|
||||
Sect.SoundSect = -1;
|
||||
Sect.Sound = -1;
|
||||
Sect.Above = -1;
|
||||
Sect.Below = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -603,7 +590,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag)
|
|||
{
|
||||
int nSector =pSprite->sectnum;
|
||||
SetAbove(nSector, nHitag);
|
||||
SectFlag[nSector] |= kSectUnderwater;
|
||||
sector[nSector].Flag |= kSectUnderwater;
|
||||
|
||||
DeleteActor(pActor);
|
||||
return;
|
||||
|
@ -631,10 +618,10 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag)
|
|||
nDamage = 1;
|
||||
}
|
||||
|
||||
int nSector =pSprite->sectnum;
|
||||
auto pSector =pSprite->sector();
|
||||
|
||||
SectDamage[nSector] = nDamage;
|
||||
SectFlag[nSector] |= kSectLava;
|
||||
pSector->Damage = nDamage;
|
||||
pSector->Flag |= kSectLava;
|
||||
|
||||
DeleteActor(pActor);
|
||||
return;
|
||||
|
@ -648,8 +635,8 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag)
|
|||
}
|
||||
case 94: // water
|
||||
{
|
||||
int nSector =pSprite->sectnum;
|
||||
SectDepth[nSector] = nHitag << 8;
|
||||
auto pSector = pSprite->sector();
|
||||
pSector->Depth = nHitag << 8;
|
||||
|
||||
DeleteActor(pActor);
|
||||
return;
|
||||
|
@ -667,10 +654,9 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag)
|
|||
case 79:
|
||||
case 89:
|
||||
{
|
||||
int nSector =pSprite->sectnum;
|
||||
|
||||
SectSpeed[nSector] = nSpeed;
|
||||
SectFlag[nSector] |= pSprite->ang;
|
||||
auto pSector = pSprite->sector();
|
||||
pSector->Speed = nSpeed;
|
||||
pSector->Flag |= pSprite->ang;
|
||||
|
||||
DeleteActor(pActor);
|
||||
return;
|
||||
|
@ -684,8 +670,8 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag)
|
|||
}
|
||||
case 80: // underwater
|
||||
{
|
||||
int nSector =pSprite->sectnum;
|
||||
SectFlag[nSector] |= kSectUnderwater;
|
||||
auto pSector = pSprite->sector();
|
||||
pSector->Flag |= kSectUnderwater;
|
||||
|
||||
DeleteActor(pActor);
|
||||
return;
|
||||
|
@ -694,8 +680,8 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag)
|
|||
{
|
||||
AddFlow(pSprite->sectnum, nSpeed, 1, pSprite->ang);
|
||||
|
||||
int nSector =pSprite->sectnum;
|
||||
SectFlag[nSector] |= 0x8000;
|
||||
auto pSector = pSprite->sector();
|
||||
pSector->Flag |= 0x8000;
|
||||
|
||||
DeleteActor(pActor);
|
||||
return;
|
||||
|
@ -879,14 +865,6 @@ void SerializeInit(FSerializer& arc)
|
|||
("curchunk", nCurChunkNum)
|
||||
.Array("bodygunsprite", nBodyGunSprite, countof(nBodyGunSprite))
|
||||
("curbodygun", nCurBodyGunNum)
|
||||
.Array("soundsect", SectSoundSect, numsectors)
|
||||
.Array("sectsound", SectSound, numsectors)
|
||||
.Array("sectflag", SectFlag, numsectors)
|
||||
.Array("sectdepth", SectDepth, numsectors)
|
||||
.Array("sectabove", SectAbove, numsectors)
|
||||
.Array("sectdamage", SectDamage, numsectors)
|
||||
.Array("sectspeed", SectSpeed, numsectors)
|
||||
.Array("sectbelow", SectBelow, numsectors)
|
||||
.Array("counters", Counters, kNumCounters)
|
||||
.EndObject();
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ int BelowNear(DExhumedActor* pActor, int x, int y, int walldist, int nSector)
|
|||
}
|
||||
else
|
||||
{
|
||||
z2 = sector[nSector].floorz + SectDepth[nSector];
|
||||
z2 = sector[nSector].floorz + sector[nSector].Depth;
|
||||
|
||||
BFSSearch search(numsectors, nSector);
|
||||
|
||||
|
@ -265,10 +265,10 @@ int BelowNear(DExhumedActor* pActor, int x, int y, int walldist, int nSector)
|
|||
while (nSect2 >= 0)
|
||||
{
|
||||
edx = nSect2;
|
||||
nSect2 = SectBelow[nSect2];
|
||||
nSect2 = sector[nSect2].Below;
|
||||
}
|
||||
|
||||
int ecx = sector[edx].floorz + SectDepth[edx];
|
||||
int ecx = sector[edx].floorz + sector[edx].Depth;
|
||||
int eax = ecx - z;
|
||||
|
||||
if (eax < 0 && eax >= -5120)
|
||||
|
@ -312,7 +312,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
|||
|
||||
Collision nRet(0);
|
||||
|
||||
short nSectFlags = SectFlag[nSector];
|
||||
short nSectFlags = sector[nSector].Flag;
|
||||
|
||||
if (nSectFlags & kSectUnderwater) {
|
||||
z >>= 1;
|
||||
|
@ -329,18 +329,16 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
|||
}
|
||||
|
||||
// loc_151E7:
|
||||
while (ebp > pSprite->sector()->floorz && SectBelow[pSprite->sectnum] >= 0)
|
||||
while (ebp > pSprite->sector()->floorz && pSprite->sector()->Below >= 0)
|
||||
{
|
||||
edi = SectBelow[pSprite->sectnum];
|
||||
|
||||
ChangeActorSect(pActor, edi);
|
||||
ChangeActorSect(pActor, pSprite->sector()->Below);
|
||||
}
|
||||
|
||||
if (edi != nSector)
|
||||
{
|
||||
pSprite->z = ebp;
|
||||
|
||||
if (SectFlag[edi] & kSectUnderwater)
|
||||
if (sector[edi].Flag & kSectUnderwater)
|
||||
{
|
||||
if (pActor == PlayerList[nLocalPlayer].Actor()) {
|
||||
D3PlayFX(StaticSound[kSound2], pActor);
|
||||
|
@ -353,9 +351,9 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
|||
}
|
||||
else
|
||||
{
|
||||
while ((ebp < pSprite->sector()->ceilingz) && (SectAbove[pSprite->sectnum] >= 0))
|
||||
while ((ebp < pSprite->sector()->ceilingz) && (pSprite->sector()->Above >= 0))
|
||||
{
|
||||
edi = SectAbove[pSprite->sectnum];
|
||||
edi = pSprite->sector()->Above;
|
||||
|
||||
ChangeActorSect(pActor, edi);
|
||||
}
|
||||
|
@ -374,7 +372,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
|||
int mySprfloor = sprfloor;
|
||||
|
||||
if (loHit.type != kHitSprite) {
|
||||
mySprfloor += SectDepth[pSprite->sectnum];
|
||||
mySprfloor += pSprite->sector()->Depth;
|
||||
}
|
||||
|
||||
if (ebp > mySprfloor)
|
||||
|
@ -415,11 +413,11 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
|||
else
|
||||
{
|
||||
// Path B
|
||||
if (SectBelow[pSprite->sectnum] == -1)
|
||||
if (pSprite->sector()->Below == -1)
|
||||
{
|
||||
nRet.exbits |= kHitAux2;
|
||||
|
||||
short nSectDamage = SectDamage[pSprite->sectnum];
|
||||
int nSectDamage = pSprite->sector()->Damage;
|
||||
|
||||
if (nSectDamage != 0)
|
||||
{
|
||||
|
@ -446,7 +444,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((ebp - height) < sprceiling && (hiHit.type == kHitSprite || SectAbove[pSprite->sectnum] == -1))
|
||||
if ((ebp - height) < sprceiling && (hiHit.type == kHitSprite || pSprite->sector()->Above == -1))
|
||||
{
|
||||
ebp = sprceiling + height;
|
||||
nRet.exbits |= kHitAux1;
|
||||
|
@ -455,7 +453,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
|
|||
|
||||
if (spriteZ <= floorZ && ebp > floorZ)
|
||||
{
|
||||
if ((SectDepth[nSector] != 0) || (edi != nSector && (SectFlag[edi] & kSectUnderwater)))
|
||||
if ((sector[nSector].Depth != 0) || (edi != nSector && (sector[edi].Flag & kSectUnderwater)))
|
||||
{
|
||||
assert(validSectorIndex(nSector));
|
||||
BuildSplash(pActor, nSector);
|
||||
|
@ -503,7 +501,7 @@ Collision movesprite(DExhumedActor* pActor, int dx, int dy, int dz, int ceildist
|
|||
|
||||
int floorZ = sector[nSector].floorz;
|
||||
|
||||
if ((SectFlag[nSector] & kSectUnderwater) || (floorZ < z))
|
||||
if ((sector[nSector].Flag & kSectUnderwater) || (floorZ < z))
|
||||
{
|
||||
dx >>= 1;
|
||||
dy >>= 1;
|
||||
|
@ -574,7 +572,7 @@ void Gravity(DExhumedActor* actor)
|
|||
auto pSprite = &actor->s();
|
||||
int nSector =pSprite->sectnum;
|
||||
|
||||
if (SectFlag[nSector] & kSectUnderwater)
|
||||
if (sector[nSector].Flag & kSectUnderwater)
|
||||
{
|
||||
if (pSprite->statnum != 100)
|
||||
{
|
||||
|
@ -628,26 +626,26 @@ Collision MoveCreatureWithCaution(DExhumedActor* pActor)
|
|||
int x = pSprite->x;
|
||||
int y = pSprite->y;
|
||||
int z = pSprite->z;
|
||||
short nSectorPre = pSprite->sectnum;
|
||||
auto pSectorPre = pSprite->sector();
|
||||
|
||||
auto ecx = MoveCreature(pActor);
|
||||
|
||||
int nSector =pSprite->sectnum;
|
||||
auto pSector =pSprite->sector();
|
||||
|
||||
if (nSector != nSectorPre)
|
||||
if (pSector != pSectorPre)
|
||||
{
|
||||
int zDiff = sector[nSectorPre].floorz - sector[nSector].floorz;
|
||||
int zDiff = pSectorPre->floorz - pSector->floorz;
|
||||
if (zDiff < 0) {
|
||||
zDiff = -zDiff;
|
||||
}
|
||||
|
||||
if (zDiff > 15360 || (SectFlag[nSector] & kSectUnderwater) || (SectBelow[nSector] > -1 && SectFlag[SectBelow[nSector]]) || SectDamage[nSector])
|
||||
if (zDiff > 15360 || (pSector->Flag & kSectUnderwater) || (pSector->Below > -1 && sector[pSector->Below].Flag) || pSector->Damage)
|
||||
{
|
||||
pSprite->x = x;
|
||||
pSprite->y = y;
|
||||
pSprite->z = z;
|
||||
|
||||
ChangeActorSect(pActor, nSectorPre);
|
||||
ChangeActorSect(pActor, sectnum(pSectorPre));
|
||||
|
||||
pSprite->ang = (pSprite->ang + 256) & kAngleMask;
|
||||
pSprite->xvel = bcos(pSprite->ang, -2);
|
||||
|
@ -750,13 +748,14 @@ DExhumedActor* FindPlayer(DExhumedActor* pActor, int nDistance, bool dontengage)
|
|||
|
||||
void CheckSectorFloor(int nSector, int z, int *x, int *y)
|
||||
{
|
||||
short nSpeed = SectSpeed[nSector];
|
||||
auto pSector = §or[nSector];
|
||||
int nSpeed = pSector->Speed;
|
||||
|
||||
if (!nSpeed) {
|
||||
return;
|
||||
}
|
||||
|
||||
short nFlag = SectFlag[nSector];
|
||||
short nFlag = pSector->Flag;
|
||||
short nAng = nFlag & kAngleMask;
|
||||
|
||||
if (z >= sector[nSector].floorz)
|
||||
|
@ -891,7 +890,7 @@ void MoveSector(int nSector, int nAngle, int *nXVel, int *nYVel)
|
|||
|
||||
|
||||
short nBlock = pSector->extra;
|
||||
short nSectFlag = SectFlag[nSector];
|
||||
short nSectFlag = sector[nSector].Flag;
|
||||
|
||||
int nFloorZ = pSector->floorz;
|
||||
int startwall = pSector->wallptr;
|
||||
|
|
|
@ -2199,7 +2199,7 @@ void DoDrips()
|
|||
|
||||
short nSeqOffset = SeqOffsets[kSeqDrips];
|
||||
|
||||
if (!(SectFlag[pSprite->sectnum] & kSectLava)) {
|
||||
if (!(pSprite->sector()->Flag & kSectLava)) {
|
||||
nSeqOffset++;
|
||||
}
|
||||
|
||||
|
@ -2293,7 +2293,7 @@ void AddSectorBob(int nSector, int nHitag, int bx)
|
|||
sBob[nBobs].nSector = nSector;
|
||||
StartInterpolation(nSector, bx == 0 ? Interp_Sect_Floorz : Interp_Sect_Ceilingz);
|
||||
|
||||
SectFlag[nSector] |= 0x0010;
|
||||
sector[nSector].Flag |= 0x0010;
|
||||
}
|
||||
|
||||
int FindTrail(int nVal)
|
||||
|
@ -2555,7 +2555,7 @@ void PostProcess()
|
|||
|
||||
int nSector =sMoveSect[i].nSector;
|
||||
|
||||
if (SectFlag[nSector] & kSectUnderwater)
|
||||
if (sector[nSector].Flag & kSectUnderwater)
|
||||
{
|
||||
sector[nSector].ceilingstat |= 0x40;
|
||||
sector[nSector].floorstat &= 0xBFFF;
|
||||
|
@ -2596,30 +2596,32 @@ void PostProcess()
|
|||
// esi is i
|
||||
for (i = 0; i < numsectors; i++)
|
||||
{
|
||||
auto secti = §or[i];
|
||||
int var_20 = 30000;
|
||||
|
||||
if (SectSpeed[i] && SectDepth[i] && !(SectFlag[i] & kSectLava))
|
||||
if (secti->Speed && secti->Depth && !(secti->Flag & kSectLava))
|
||||
{
|
||||
SectSoundSect[i] = i;
|
||||
SectSound[i] = StaticSound[kSound43];
|
||||
secti->SoundSect = i;
|
||||
secti->Sound = StaticSound[kSound43];
|
||||
}
|
||||
else
|
||||
{
|
||||
// ebp and ecx are j
|
||||
for (j = 0; j < numsectors; j++)
|
||||
{
|
||||
auto sectj = §or[j];
|
||||
// loc_23CA6:
|
||||
|
||||
if (i != j && SectSpeed[j] && !(SectFlag[i] & kSectLava))
|
||||
if (i != j && sectj->Speed && !(secti->Flag & kSectLava))
|
||||
{
|
||||
int xVal = abs(sector[i].firstWall()->x - sector[j].firstWall()->x);
|
||||
int yVal = abs(sector[i].firstWall()->y - sector[j].firstWall()->y);
|
||||
int xVal = abs(secti->firstWall()->x - sectj->firstWall()->x);
|
||||
int yVal = abs(secti->firstWall()->y - sectj->firstWall()->y);
|
||||
|
||||
if (xVal < 15000 && yVal < 15000 && (xVal + yVal < var_20))
|
||||
{
|
||||
var_20 = xVal + yVal;
|
||||
SectSoundSect[i] = j;
|
||||
SectSound[i] = StaticSound[kSound43];
|
||||
secti->SoundSect = j;
|
||||
secti->Sound = StaticSound[kSound43];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2633,8 +2635,9 @@ void PostProcess()
|
|||
|
||||
for (i = 0; i < numsectors; i++)
|
||||
{
|
||||
SectSoundSect[i] = i;
|
||||
SectSound[i] = StaticSound[kSound62];
|
||||
auto secti = §or[i];
|
||||
secti->SoundSect = i;
|
||||
secti->Sound = StaticSound[kSound62];
|
||||
|
||||
int startwall = sector[ebp].wallptr;
|
||||
int endwall = sector[ebp].wallptr + sector[ebp].wallnum;
|
||||
|
|
|
@ -458,8 +458,9 @@ void StartDeathSeq(int nPlayer, int nVal)
|
|||
if (nWeapon > kWeaponSword && nWeapon <= kWeaponRing)
|
||||
{
|
||||
int nSector =pSprite->sectnum;
|
||||
if (SectBelow[nSector] > -1) {
|
||||
nSector = SectBelow[nSector];
|
||||
auto pSector = pSprite->sector();
|
||||
if (pSector->Below > -1) {
|
||||
nSector = pSector->Below;
|
||||
}
|
||||
|
||||
auto pGunActor = GrabBodyGunSprite();
|
||||
|
@ -490,7 +491,7 @@ void StartDeathSeq(int nPlayer, int nVal)
|
|||
|
||||
SetNewWeaponImmediate(nPlayer, -2);
|
||||
|
||||
if (SectDamage[pSprite->sectnum] <= 0)
|
||||
if (pSprite->sector()->Damage <= 0)
|
||||
{
|
||||
PlayerList[nPlayer].nDeathType = nVal;
|
||||
}
|
||||
|
@ -501,7 +502,7 @@ void StartDeathSeq(int nPlayer, int nVal)
|
|||
|
||||
nVal *= 2;
|
||||
|
||||
if (nVal || !(SectFlag[pSprite->sectnum] & kSectUnderwater))
|
||||
if (nVal || !(pSprite->sector()->Flag & kSectUnderwater))
|
||||
{
|
||||
PlayerList[nPlayer].nAction = nVal + 17;
|
||||
}
|
||||
|
@ -673,7 +674,7 @@ void AIPlayer::Damage(RunListEvent* ev)
|
|||
return;
|
||||
}
|
||||
|
||||
if (SectFlag[pPlayerSprite->sectnum] & kSectUnderwater)
|
||||
if (pPlayerSprite->sector()->Flag & kSectUnderwater)
|
||||
{
|
||||
if (nAction != 12)
|
||||
{
|
||||
|
@ -864,7 +865,7 @@ void AIPlayer::Tick(RunListEvent* ev)
|
|||
|
||||
// loc_1A4E6
|
||||
int nSector =pPlayerSprite->sectnum;
|
||||
short nSectFlag = SectFlag[PlayerList[nPlayer].nPlayerViewSect];
|
||||
int nSectFlag = sector[PlayerList[nPlayer].nPlayerViewSect].Flag;
|
||||
|
||||
int playerX = pPlayerSprite->x;
|
||||
int playerY = pPlayerSprite->y;
|
||||
|
@ -929,7 +930,7 @@ void AIPlayer::Tick(RunListEvent* ev)
|
|||
}
|
||||
|
||||
// int _bTouchFloor = bTouchFloor;
|
||||
short bUnderwater = SectFlag[pPlayerSprite->sectnum] & kSectUnderwater;
|
||||
short bUnderwater = pPlayerSprite->sector()->Flag & kSectUnderwater;
|
||||
|
||||
if (bUnderwater)
|
||||
{
|
||||
|
@ -938,7 +939,7 @@ void AIPlayer::Tick(RunListEvent* ev)
|
|||
}
|
||||
|
||||
// Trigger Ramses?
|
||||
if ((SectFlag[pPlayerSprite->sectnum] & 0x8000) && bTouchFloor)
|
||||
if ((pPlayerSprite->sector()->Flag & 0x8000) && bTouchFloor)
|
||||
{
|
||||
if (nTotalPlayers <= 1)
|
||||
{
|
||||
|
@ -1121,10 +1122,10 @@ sectdone:
|
|||
if (EyeZ >= nCeilZ)
|
||||
break;
|
||||
|
||||
if (SectAbove[nViewSect] <= -1)
|
||||
if (sector[nViewSect].Above <= -1)
|
||||
break;
|
||||
|
||||
nViewSect = SectAbove[nViewSect];
|
||||
nViewSect = sector[nViewSect].Above;
|
||||
}
|
||||
|
||||
// Do underwater sector check
|
||||
|
@ -1171,7 +1172,7 @@ sectdone:
|
|||
PlayerList[nPlayer].nPlayerDX = pPlayerSprite->x - spr_x;
|
||||
PlayerList[nPlayer].nPlayerDY = pPlayerSprite->y - spr_y;
|
||||
|
||||
int var_5C = SectFlag[nViewSect] & kSectUnderwater;
|
||||
int var_5C = sector[nViewSect].Flag & kSectUnderwater;
|
||||
|
||||
auto actions = sPlayerInput[nPlayer].actions;
|
||||
|
||||
|
@ -1249,11 +1250,11 @@ sectdone:
|
|||
}
|
||||
else
|
||||
{
|
||||
int nTmpSectNum = pPlayerSprite->sectnum;
|
||||
auto pTmpSect = pPlayerSprite->sector();
|
||||
|
||||
if (PlayerList[nPlayer].totalvel > 25 && pPlayerSprite->z > sector[nTmpSectNum].floorz)
|
||||
if (PlayerList[nPlayer].totalvel > 25 && pPlayerSprite->z > pTmpSect->floorz)
|
||||
{
|
||||
if (SectDepth[nTmpSectNum] && !SectSpeed[nTmpSectNum] && !SectDamage[nTmpSectNum])
|
||||
if (pTmpSect->Depth && !pTmpSect->Speed && !pTmpSect->Damage)
|
||||
{
|
||||
D3PlayFX(StaticSound[kSound42], pPlayerActor);
|
||||
}
|
||||
|
@ -2593,7 +2594,7 @@ sectdone:
|
|||
}
|
||||
else if (PlayerList[nPlayer].horizon.horiz.asq16() <= 0)
|
||||
{
|
||||
if (!(SectFlag[pPlayerSprite->sectnum] & kSectUnderwater))
|
||||
if (!(pPlayerSprite->sector()->Flag & kSectUnderwater))
|
||||
{
|
||||
SetNewWeapon(nPlayer, PlayerList[nPlayer].nDeathType + 8);
|
||||
}
|
||||
|
@ -2607,10 +2608,10 @@ sectdone:
|
|||
// loc_1C4E1
|
||||
pDopple->s().pos = pPlayerSprite->pos;
|
||||
|
||||
if (SectAbove[pPlayerSprite->sectnum] > -1)
|
||||
if (pPlayerSprite->sector()->Above > -1)
|
||||
{
|
||||
pDopple->s().ang = pPlayerSprite->ang;
|
||||
ChangeActorSect(pDopple, SectAbove[pPlayerSprite->sectnum]);
|
||||
ChangeActorSect(pDopple, pPlayerSprite->sector()->Above);
|
||||
pDopple->s().cstat = 0x101;
|
||||
}
|
||||
else
|
||||
|
@ -2764,7 +2765,7 @@ DEFINE_ACTION_FUNCTION(_ExhumedPlayer, IsUnderwater)
|
|||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(Player);
|
||||
auto nLocalPlayer = self - PlayerList;
|
||||
ACTION_RETURN_BOOL(SectFlag[PlayerList[nLocalPlayer].nPlayerViewSect] & kSectUnderwater);
|
||||
ACTION_RETURN_BOOL(sector[PlayerList[nLocalPlayer].nPlayerViewSect].Flag & kSectUnderwater);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_ExhumedPlayer, GetAngle)
|
||||
|
|
|
@ -1509,7 +1509,7 @@ void runlist_ProcessSectorTag(int nSector, int nLotag, int nHitag)
|
|||
|
||||
case 80:
|
||||
{
|
||||
SectFlag[nSector] |= 0x8000;
|
||||
sector[nSector].Flag |= 0x8000;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1784,7 +1784,7 @@ void runlist_DamageEnemy(DExhumedActor* pActor, DExhumedActor* pActor2, short nD
|
|||
auto pPlayerActor = PlayerList[nPlayer].Actor();
|
||||
int nSector = pPlayerActor->s().sectnum;
|
||||
|
||||
if (!(SectFlag[nSector] & kSectUnderwater))
|
||||
if (!(sector[nSector].Flag & kSectUnderwater))
|
||||
{
|
||||
int ebx = 0x4000;
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ void seq_DrawPilotLightSeq(double xOffset, double yOffset)
|
|||
{
|
||||
short nSect = PlayerList[nLocalPlayer].nPlayerViewSect;
|
||||
|
||||
if (!(SectFlag[nSect] & kSectUnderwater))
|
||||
if (!(sector[nSect].Flag & kSectUnderwater))
|
||||
{
|
||||
short nFrame = nPilotLightBase + nPilotLightFrame;
|
||||
short nFrameBase = FrameBase[nFrame];
|
||||
|
|
|
@ -238,7 +238,7 @@ void InitFX(void)
|
|||
void GetSpriteSoundPitch(int* pVolume, int* pPitch)
|
||||
{
|
||||
int nSoundSect = PlayerList[nLocalPlayer].nPlayerViewSect;
|
||||
int nLocalSectFlags = SectFlag[nSoundSect];
|
||||
int nLocalSectFlags = sector[nSoundSect].Flag;
|
||||
if (nLocalSectFlags & kSectUnderwater)
|
||||
{
|
||||
if (*pVolume == 255)
|
||||
|
@ -673,15 +673,16 @@ void PlayFXAtXYZ(unsigned short ax, int x, int y, int z, int nSector, EChanFlags
|
|||
void CheckAmbience(int nSector)
|
||||
{
|
||||
if (!SoundEnabled()) return;
|
||||
if (SectSound[nSector] != -1)
|
||||
auto sect = §or[nSector];
|
||||
if (sect->Sound != -1)
|
||||
{
|
||||
int nSector2 = SectSoundSect[nSector];
|
||||
walltype* pWall = &wall[sector[nSector2].wallptr];
|
||||
int nSector2 = sect->SoundSect;
|
||||
walltype* pWall = sector[nSector2].firstWall();
|
||||
if (!soundEngine->IsSourcePlayingSomething(SOURCE_Ambient, &amb, 0))
|
||||
{
|
||||
vec3_t v = { pWall->x, pWall->y, sector[nSector2].floorz };
|
||||
amb = GetSoundPos(&v);
|
||||
soundEngine->StartSound(SOURCE_Ambient, &amb, nullptr, CHAN_BODY, CHANF_TRANSIENT, SectSound[nSector] + 1, 1.f, ATTN_NORM);
|
||||
soundEngine->StartSound(SOURCE_Ambient, &amb, nullptr, CHAN_BODY, CHANF_TRANSIENT, sect->Sound + 1, 1.f, ATTN_NORM);
|
||||
return;
|
||||
}
|
||||
soundEngine->EnumerateChannels([=](FSoundChan* chan)
|
||||
|
@ -725,7 +726,7 @@ void UpdateCreepySounds()
|
|||
nCreepyTimer--;
|
||||
if (nCreepyTimer <= 0)
|
||||
{
|
||||
if (nCreaturesKilled < nCreaturesTotal && !(SectFlag[PlayerList[nLocalPlayer].nPlayerViewSect] & 0x2000))
|
||||
if (nCreaturesKilled < nCreaturesTotal && !(sector[PlayerList[nLocalPlayer].nPlayerViewSect].Flag & 0x2000))
|
||||
{
|
||||
int vsi = seq_GetFrameSound(SeqOffsets[kSeqCreepy], totalmoves % SeqSize[SeqOffsets[kSeqCreepy]]);
|
||||
if (vsi >= 0 && (vsi & 0x1ff) < kMaxSounds)
|
||||
|
|
|
@ -217,7 +217,7 @@ void AIWasp::Tick(RunListEvent* ev)
|
|||
{
|
||||
pTarget = pActor->pTarget;
|
||||
|
||||
if (pTarget && (!(pTarget->s().cstat & 0x101) || (SectFlag[pTarget->s().sectnum] & kSectUnderwater)))
|
||||
if (pTarget && (!(pTarget->s().cstat & 0x101) || (pTarget->s().sector()->Flag & kSectUnderwater)))
|
||||
{
|
||||
// goto pink
|
||||
pActor->pTarget = nullptr;
|
||||
|
@ -344,7 +344,7 @@ void AIWasp::Tick(RunListEvent* ev)
|
|||
|
||||
if (pSprite->z >= sector[nSector].floorz)
|
||||
{
|
||||
if (SectBelow[nSector] > -1)
|
||||
if (sector[nSector].Below > -1)
|
||||
{
|
||||
BuildSplash(pActor, nSector);
|
||||
pSprite->cstat |= 0x8000;
|
||||
|
|
Loading…
Reference in a new issue