mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-19 15:40:58 +00:00
- sector ambience
This commit is contained in:
parent
c933eff59f
commit
0b254255e2
6 changed files with 32 additions and 65 deletions
|
@ -104,7 +104,7 @@ struct sectortype
|
|||
};
|
||||
struct // Exhumed
|
||||
{
|
||||
int SoundSect;
|
||||
sectortype* pSoundSect;
|
||||
int Depth;
|
||||
int Above;
|
||||
int Below;
|
||||
|
|
|
@ -474,7 +474,6 @@ void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang,
|
|||
// 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;
|
||||
|
|
|
@ -573,7 +573,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort
|
|||
}
|
||||
else if (isExhumed())
|
||||
{
|
||||
arc("SoundSect", c.SoundSect, def->SoundSect)
|
||||
arc("SoundSect", c.pSoundSect, def->pSoundSect)
|
||||
("Depth", c.Depth, def->Depth)
|
||||
("Above", c.Above, def->Above)
|
||||
("Below", c.Below, def->Below)
|
||||
|
|
|
@ -243,17 +243,6 @@ void SnapSectors(int nSectorA, int nSectorB, int b)
|
|||
}
|
||||
}
|
||||
|
||||
void InitSectFlag()
|
||||
{
|
||||
for(auto& Sect : sectors())
|
||||
{
|
||||
Sect.SoundSect = -1;
|
||||
Sect.Sound = -1;
|
||||
Sect.Above = -1;
|
||||
Sect.Below = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
|
||||
{
|
||||
auto pSprite = &pActor->s();
|
||||
|
@ -778,7 +767,6 @@ void LoadObjects()
|
|||
InitSwitch();
|
||||
InitElev();
|
||||
InitWallFace();
|
||||
InitSectFlag();
|
||||
|
||||
for (auto& sect : sectors())
|
||||
{
|
||||
|
|
|
@ -1482,21 +1482,18 @@ void DimLights()
|
|||
if (word_96786 == 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < numsectors; i++)
|
||||
for (auto§ : sectors())
|
||||
{
|
||||
if (sector[i].ceilingshade < 100)
|
||||
sector[i].ceilingshade++;
|
||||
if (sect.ceilingshade < 100)
|
||||
sect.ceilingshade++;
|
||||
|
||||
if (sector[i].floorshade < 100)
|
||||
sector[i].floorshade++;
|
||||
if (sect.floorshade < 100)
|
||||
sect.floorshade++;
|
||||
|
||||
int startwall = sector[i].wallptr;
|
||||
int endwall = startwall + sector[i].wallnum;
|
||||
|
||||
for (int nWall = startwall; nWall < endwall; nWall++)
|
||||
for (auto& wal : wallsofsector(§))
|
||||
{
|
||||
if (wall[nWall].shade < 100)
|
||||
wall[nWall].shade++;
|
||||
if (wal.shade < 100)
|
||||
wal.shade++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2478,8 +2475,6 @@ void DoMovingSects()
|
|||
|
||||
void PostProcess()
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (unsigned i = 0; i < sMoveSect.Size(); i++)
|
||||
{
|
||||
int nTrail = sMoveSect[i].nTrail;
|
||||
|
@ -2529,35 +2524,31 @@ void PostProcess()
|
|||
|
||||
if (!(currentLevel->gameflags & LEVEL_EX_COUNTDOWN))
|
||||
{
|
||||
// esi is i
|
||||
for (i = 0; i < numsectors; i++)
|
||||
for (auto& sect : sectors())
|
||||
{
|
||||
auto secti = §or[i];
|
||||
int var_20 = 30000;
|
||||
|
||||
if (secti->Speed && secti->Depth && !(secti->Flag & kSectLava))
|
||||
if (sect.Speed && sect.Depth && !(sect.Flag & kSectLava))
|
||||
{
|
||||
secti->SoundSect = i;
|
||||
secti->Sound = StaticSound[kSound43];
|
||||
sect.pSoundSect = §
|
||||
sect.Sound = StaticSound[kSound43];
|
||||
}
|
||||
else
|
||||
{
|
||||
// ebp and ecx are j
|
||||
for (j = 0; j < numsectors; j++)
|
||||
for (auto& sectj : sectors())
|
||||
{
|
||||
auto sectj = §or[j];
|
||||
// loc_23CA6:
|
||||
|
||||
if (i != j && sectj->Speed && !(secti->Flag & kSectLava))
|
||||
if (§ != §j && sectj.Speed && !(sect.Flag & kSectLava))
|
||||
{
|
||||
int xVal = abs(secti->firstWall()->x - sectj->firstWall()->x);
|
||||
int yVal = abs(secti->firstWall()->y - sectj->firstWall()->y);
|
||||
int xVal = abs(sect.firstWall()->x - sectj.firstWall()->x);
|
||||
int yVal = abs(sect.firstWall()->y - sectj.firstWall()->y);
|
||||
|
||||
if (xVal < 15000 && yVal < 15000 && (xVal + yVal < var_20))
|
||||
{
|
||||
var_20 = xVal + yVal;
|
||||
secti->SoundSect = j;
|
||||
secti->Sound = StaticSound[kSound43];
|
||||
sect.pSoundSect = §j;
|
||||
sect.Sound = StaticSound[kSound43];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2566,30 +2557,19 @@ void PostProcess()
|
|||
}
|
||||
else // nMap == kMap20)
|
||||
{
|
||||
// int var_24 = 0;
|
||||
int ebp = 0;
|
||||
|
||||
for (i = 0; i < numsectors; i++)
|
||||
for(auto& sect : sectors())
|
||||
{
|
||||
auto secti = §or[i];
|
||||
secti->SoundSect = i;
|
||||
secti->Sound = StaticSound[kSound62];
|
||||
sect.pSoundSect = §
|
||||
sect.Sound = StaticSound[kSound62];
|
||||
|
||||
int startwall = sector[ebp].wallptr;
|
||||
int endwall = sector[ebp].wallptr + sector[ebp].wallnum;
|
||||
|
||||
int nWall = startwall;
|
||||
|
||||
while (nWall < endwall)
|
||||
for(auto& wal : wallsofsector(§))
|
||||
{
|
||||
if (wall[nWall].picnum == kTile3603)
|
||||
if (wal.picnum == kTile3603)
|
||||
{
|
||||
wall[nWall].pal = 1;
|
||||
auto pActor = insertActor(i, 407);
|
||||
wal.pal = 1;
|
||||
auto pActor = insertActor(§, 407);
|
||||
pActor->s().cstat = 0x8000;
|
||||
}
|
||||
|
||||
nWall++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -676,11 +676,11 @@ void CheckAmbience(int nSector)
|
|||
auto sect = §or[nSector];
|
||||
if (sect->Sound != -1)
|
||||
{
|
||||
int nSector2 = sect->SoundSect;
|
||||
walltype* pWall = sector[nSector2].firstWall();
|
||||
auto pSector2 = sect->pSoundSect;
|
||||
walltype* pWall = pSector2->firstWall();
|
||||
if (!soundEngine->IsSourcePlayingSomething(SOURCE_Ambient, &amb, 0))
|
||||
{
|
||||
vec3_t v = { pWall->x, pWall->y, sector[nSector2].floorz };
|
||||
vec3_t v = { pWall->x, pWall->y, pSector2->floorz };
|
||||
amb = GetSoundPos(&v);
|
||||
soundEngine->StartSound(SOURCE_Ambient, &amb, nullptr, CHAN_BODY, CHANF_TRANSIENT, sect->Sound + 1, 1.f, ATTN_NORM);
|
||||
return;
|
||||
|
@ -689,14 +689,14 @@ void CheckAmbience(int nSector)
|
|||
{
|
||||
if (chan->SourceType == SOURCE_Ambient)
|
||||
{
|
||||
if (nSector == nSector2)
|
||||
if (sect == pSector2)
|
||||
{
|
||||
spritetype* pSprite = &PlayerList[0].Actor()->s();
|
||||
amb = GetSoundPos(&pSprite->pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
vec3_t v = { pWall->x, pWall->y, sector[nSector2].floorz };
|
||||
vec3_t v = { pWall->x, pWall->y, pSector2->floorz };
|
||||
amb = GetSoundPos(&v);
|
||||
}
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue