- switched all aiPlay3DSound calls to use actors.

This commit is contained in:
Christoph Oelckers 2021-05-05 11:51:10 +02:00
parent bdba52aede
commit 61d9cd1b17
11 changed files with 43 additions and 48 deletions

View file

@ -7419,11 +7419,6 @@ bool dudeIsPlayingSeq(spritetype* pSprite, int nSeq)
return dudeIsPlayingSeq(&bloodActors[pSprite->index], nSeq);
}
void aiPlay3DSound(spritetype* pSprite, int a2, AI_SFX_PRIORITY a3, int a4)
{
return aiPlay3DSound(&bloodActors[pSprite->index], a2, a3, a4);
}
void aiSetTarget_(XSPRITE* pXSprite, int nTarget)
{
aiSetTarget(&bloodActors[pXSprite->reference], &bloodActors[nTarget]);

View file

@ -416,7 +416,7 @@ void aiActivateDude(DBloodActor* actor)
if (Chance(0x8000))
{
if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(actor, 4008+Random(5), AI_SFX_PRIORITY_1, -1);
else aiPlay3DSound(pSprite, 1008+Random(5), AI_SFX_PRIORITY_1, -1);
else aiPlay3DSound(actor, 1008+Random(5), AI_SFX_PRIORITY_1, -1);
}
break;
case kMediumWater:
@ -764,7 +764,7 @@ void aiActivateDude(DBloodActor* actor)
aiNewState(actor, &houndSearch);
else
{
aiPlay3DSound(pSprite, 1300, AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 1300, AI_SFX_PRIORITY_1, -1);
aiNewState(actor, &houndChase);
}
break;
@ -773,7 +773,7 @@ void aiActivateDude(DBloodActor* actor)
aiNewState(actor, &handSearch);
else
{
aiPlay3DSound(pSprite, 1900, AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 1900, AI_SFX_PRIORITY_1, -1);
aiNewState(actor, &handChase);
}
break;
@ -782,7 +782,7 @@ void aiActivateDude(DBloodActor* actor)
aiNewState(actor, &ratSearch);
else
{
aiPlay3DSound(pSprite, 2100, AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 2100, AI_SFX_PRIORITY_1, -1);
aiNewState(actor, &ratChase);
}
break;
@ -1076,7 +1076,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
if (pExtra->canBurn && pExtra->availDeaths[kDamageBurn] > 0) {
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
aiPlay3DSound(actor, 361, AI_SFX_PRIORITY_0, -1);
playGenDudeSound(pSprite, kGenDudeSndBurning);
pSprite->type = kDudeModernCustomBurning;
@ -1223,7 +1223,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
pSprite->type = kDudeBurningInnocent;
aiNewState(actor, &cultistBurnGoto);
}
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
aiPlay3DSound(actor, 361, AI_SFX_PRIORITY_0, -1);
actor->dudeExtra.time = PlayClock+360;
actHealDude(actor, dudeInfo[39].startHealth, dudeInfo[39].startHealth);
evKill(actor, kCallbackFXFlameLick);
@ -1317,8 +1317,8 @@ void RecoilDude(DBloodActor* actor)
case kDudeCultistTesla:
case kDudeCultistTNT:
case kDudeCultistBeast:
if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(pSprite, 4013+Random(2), AI_SFX_PRIORITY_2, -1);
else aiPlay3DSound(pSprite, 1013+Random(2), AI_SFX_PRIORITY_2, -1);
if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(actor, 4013+Random(2), AI_SFX_PRIORITY_2, -1);
else aiPlay3DSound(actor, 1013+Random(2), AI_SFX_PRIORITY_2, -1);
if (!v4 && pXSprite->medium == kMediumNormal) {
if (pDudeExtra->teslaHit) aiNewState(actor, &cultistTeslaRecoil);
@ -1348,7 +1348,7 @@ void RecoilDude(DBloodActor* actor)
break;
#endif
case kDudeZombieButcher:
aiPlay3DSound(pSprite, 1202, AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 1202, AI_SFX_PRIORITY_2, -1);
if (pDudeExtra->teslaHit)
aiNewState(actor, &zombieFTeslaRecoil);
else
@ -1356,7 +1356,7 @@ void RecoilDude(DBloodActor* actor)
break;
case kDudeZombieAxeNormal:
case kDudeZombieAxeBuried:
aiPlay3DSound(pSprite, 1106, AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 1106, AI_SFX_PRIORITY_2, -1);
if (pDudeExtra->teslaHit && pXSprite->data3 > pDudeInfo->startHealth/3)
aiNewState(actor, &zombieATeslaRecoil);
else if (pXSprite->data3 > pDudeInfo->startHealth/3)
@ -1365,61 +1365,61 @@ void RecoilDude(DBloodActor* actor)
aiNewState(actor, &zombieARecoil);
break;
case kDudeBurningZombieAxe:
aiPlay3DSound(pSprite, 1106, AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 1106, AI_SFX_PRIORITY_2, -1);
aiNewState(actor, &zombieABurnGoto);
break;
case kDudeBurningZombieButcher:
aiPlay3DSound(pSprite, 1202, AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 1202, AI_SFX_PRIORITY_2, -1);
aiNewState(actor, &zombieFBurnGoto);
break;
case kDudeGargoyleFlesh:
case kDudeGargoyleStone:
aiPlay3DSound(pSprite, 1402, AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 1402, AI_SFX_PRIORITY_2, -1);
aiNewState(actor, &gargoyleFRecoil);
break;
case kDudeCerberusTwoHead:
aiPlay3DSound(pSprite, 2302+Random(2), AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 2302+Random(2), AI_SFX_PRIORITY_2, -1);
if (pDudeExtra->teslaHit && pXSprite->data3 > pDudeInfo->startHealth/3)
aiNewState(actor, &cerberusTeslaRecoil);
else
aiNewState(actor, &cerberusRecoil);
break;
case kDudeCerberusOneHead:
aiPlay3DSound(pSprite, 2302+Random(2), AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 2302+Random(2), AI_SFX_PRIORITY_2, -1);
aiNewState(actor, &cerberus2Recoil);
break;
case kDudeHellHound:
aiPlay3DSound(pSprite, 1302, AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 1302, AI_SFX_PRIORITY_2, -1);
if (pDudeExtra->teslaHit)
aiNewState(actor, &houndTeslaRecoil);
else
aiNewState(actor, &houndRecoil);
break;
case kDudeTchernobog:
aiPlay3DSound(pSprite, 2370+Random(2), AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 2370+Random(2), AI_SFX_PRIORITY_2, -1);
aiNewState(actor, &tchernobogRecoil);
break;
case kDudeHand:
aiPlay3DSound(pSprite, 1902, AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 1902, AI_SFX_PRIORITY_2, -1);
aiNewState(actor, &handRecoil);
break;
case kDudeRat:
aiPlay3DSound(pSprite, 2102, AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 2102, AI_SFX_PRIORITY_2, -1);
aiNewState(actor, &ratRecoil);
break;
case kDudeBat:
aiPlay3DSound(pSprite, 2002, AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 2002, AI_SFX_PRIORITY_2, -1);
aiNewState(actor, &batRecoil);
break;
case kDudeBoneEel:
aiPlay3DSound(pSprite, 1502, AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 1502, AI_SFX_PRIORITY_2, -1);
aiNewState(actor, &eelRecoil);
break;
case kDudeGillBeast: {
XSECTOR *pXSector = NULL;
if (sector[pSprite->sectnum].extra > 0)
pXSector = &xsector[sector[pSprite->sectnum].extra];
aiPlay3DSound(pSprite, 1702, AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 1702, AI_SFX_PRIORITY_2, -1);
if (pXSector && pXSector->Underwater)
aiNewState(actor, &gillBeastSwimRecoil);
else
@ -1427,7 +1427,7 @@ void RecoilDude(DBloodActor* actor)
break;
}
case kDudePhantasm:
aiPlay3DSound(pSprite, 1602, AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 1602, AI_SFX_PRIORITY_2, -1);
if (pDudeExtra->teslaHit)
aiNewState(actor, &ghostTeslaRecoil);
else
@ -1436,15 +1436,15 @@ void RecoilDude(DBloodActor* actor)
case kDudeSpiderBrown:
case kDudeSpiderRed:
case kDudeSpiderBlack:
aiPlay3DSound(pSprite, 1802+Random(1), AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 1802+Random(1), AI_SFX_PRIORITY_2, -1);
aiNewState(actor, &spidDodge);
break;
case kDudeSpiderMother:
aiPlay3DSound(pSprite, 1851+Random(1), AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 1851+Random(1), AI_SFX_PRIORITY_2, -1);
aiNewState(actor, &spidDodge);
break;
case kDudeInnocent:
aiPlay3DSound(pSprite, 7007+Random(2), AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 7007+Random(2), AI_SFX_PRIORITY_2, -1);
if (pDudeExtra->teslaHit)
aiNewState(actor, &innocentTeslaRecoil);
else
@ -1469,7 +1469,7 @@ void RecoilDude(DBloodActor* actor)
}
break;
case kDudeBeast:
aiPlay3DSound(pSprite, 9004+Random(2), AI_SFX_PRIORITY_2, -1);
aiPlay3DSound(actor, 9004+Random(2), AI_SFX_PRIORITY_2, -1);
if (pXSprite->medium == kMediumNormal)
{
if (pDudeExtra->teslaHit)

View file

@ -97,7 +97,6 @@ void aiInitSprite(spritetype *pSprite);
bool CanMove(DBloodActor* pSprite, int a2, int nAngle, int nRange);
bool dudeIsPlayingSeq(spritetype* pSprite, int nSeq); // deprecated
void aiPlay3DSound(spritetype* pSprite, int a2, AI_SFX_PRIORITY a3, int a4);
void aiSetTarget_(XSPRITE* pXSprite, int x, int y, int z);
void aiSetTarget_(XSPRITE* pXSprite, int nTarget);

View file

@ -441,7 +441,7 @@ static void beastThinkSwimChase(DBloodActor* actor)
aiNewState(actor, &beastSwimSlash);
else
{
aiPlay3DSound(pSprite, 9009+Random(2), AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 9009+Random(2), AI_SFX_PRIORITY_1, -1);
aiNewState(actor, &beast138FD0);
}
}

View file

@ -154,7 +154,7 @@ static void calebThinkChase(DBloodActor* actor)
aiNewState(actor, &tinycalebSwimSearch);
else
{
aiPlay3DSound(pSprite, 11000+Random(4), AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 11000+Random(4), AI_SFX_PRIORITY_1, -1);
aiNewState(actor, &tinycalebSearch);
}
return;

View file

@ -264,9 +264,9 @@ static void cultThinkChase(DBloodActor* actor)
case kMediumNormal:
aiNewState(actor, &cultistSearch);
if (pSprite->type == kDudeCultistTommy)
aiPlay3DSound(pSprite, 4021+Random(4), AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 4021+Random(4), AI_SFX_PRIORITY_1, -1);
else
aiPlay3DSound(pSprite, 1021+Random(4), AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 1021+Random(4), AI_SFX_PRIORITY_1, -1);
break;
case kMediumWater:
case kMediumGoo:

View file

@ -74,7 +74,7 @@ AISTATE statueSBreakSEQ = { kAiStateOther, 5, -1, 0, entrySStatue, NULL, playSta
static void playStatueBreakSnd(DBloodActor* actor) {
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiPlay3DSound(pSprite, 313, AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 313, AI_SFX_PRIORITY_1, -1);
}
void SlashFSeqCallback(int, DBloodActor* actor)
@ -452,11 +452,11 @@ static void gargThinkChase(DBloodActor* actor)
}
else if ((height2-height > 0x2000 || floorZ-bottom > 0x2000) && nDist < 0x1400 && nDist > 0xa00)
{
aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 1400, AI_SFX_PRIORITY_1, -1);
aiNewState(actor, &gargoyleSwoop);
}
else if ((height2-height < 0x2000 || floorZ-bottom < 0x2000) && abs(nDeltaAngle) < 85)
aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 1400, AI_SFX_PRIORITY_1, -1);
break;
case kDudeGargoyleStone:
if (nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
@ -507,13 +507,13 @@ static void gargThinkChase(DBloodActor* actor)
else if ((height2-height > 0x2000 || floorZ-bottom > 0x2000) && nDist < 0x1400 && nDist > 0x800)
{
if (pSprite->type == kDudeGargoyleFlesh)
aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 1400, AI_SFX_PRIORITY_1, -1);
else
aiPlay3DSound(pSprite, 1450, AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 1450, AI_SFX_PRIORITY_1, -1);
aiNewState(actor, &gargoyleSwoop);
}
else if ((height2-height < 0x2000 || floorZ-bottom < 0x2000) && abs(nDeltaAngle) < 85)
aiPlay3DSound(pSprite, 1450, AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 1450, AI_SFX_PRIORITY_1, -1);
break;
}
}

View file

@ -419,11 +419,11 @@ static void ghostThinkChase(DBloodActor* actor)
}
else if ((height2-height > 0x2000 || floorZ-bottom > 0x2000) && nDist < 0x1400 && nDist > 0x800)
{
aiPlay3DSound(pSprite, 1600, AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 1600, AI_SFX_PRIORITY_1, -1);
aiNewState(actor, &ghostSwoop);
}
else if ((height2-height < 0x2000 || floorZ-bottom < 0x2000) && abs(nDeltaAngle) < 85)
aiPlay3DSound(pSprite, 1600, AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 1600, AI_SFX_PRIORITY_1, -1);
break;
}
}

View file

@ -293,7 +293,7 @@ static void gillThinkSwimChase(DBloodActor* actor)
aiNewState(actor, &gillBeastSwimBite);
else
{
aiPlay3DSound(pSprite, 1700, AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 1700, AI_SFX_PRIORITY_1, -1);
aiNewState(actor, &gillBeast13A154);
}
}

View file

@ -109,7 +109,7 @@ static void innocThinkChase(DBloodActor* actor)
}
}
aiPlay3DSound(pSprite, 7000+Random(6), AI_SFX_PRIORITY_1, -1);
aiPlay3DSound(actor, 7000+Random(6), AI_SFX_PRIORITY_1, -1);
aiNewState(actor, &innocentGoto);
actor->SetTarget(nullptr);
}

View file

@ -1132,6 +1132,7 @@ void aiGenDudeNewState(spritetype* pSprite, AISTATE* pAIState) {
bool playGenDudeSound(spritetype* pSprite, int mode) {
if (mode < kGenDudeSndTargetSpot || mode >= kGenDudeSndMax) return false;
auto actor = &bloodActors[pSprite->index];
const GENDUDESND* sndInfo =& gCustomDudeSnd[mode]; bool gotSnd = false;
short sndStartId = xsprite[pSprite->extra].sysData1; int rand = sndInfo->randomRange;
int sndId = (sndStartId <= 0) ? sndInfo->defaultSndId : sndStartId + sndInfo->sndIdOffset;
@ -1186,7 +1187,7 @@ bool playGenDudeSound(spritetype* pSprite, int mode) {
}
if (gotSnd == false) return false;
else if (sndInfo->aiPlaySound) aiPlay3DSound(pSprite, sndId, AI_SFX_PRIORITY_2, -1);
else if (sndInfo->aiPlaySound) aiPlay3DSound(actor, sndId, AI_SFX_PRIORITY_2, -1);
else sfxPlay3DSound(pSprite, sndId, -1, 0);
pExtra->sndPlaying = true;