Mercurial > mm7
changeset 1883:7d334cc596e0
Actor::PlaySound cleaned up
author | Grumpy7 |
---|---|
date | Sat, 19 Oct 2013 06:48:02 +0200 |
parents | b3191dddab9f |
children | c77de46b31b1 |
files | Actor.cpp |
diffstat | 1 files changed, 18 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Sat Oct 19 06:27:07 2013 +0200 +++ b/Actor.cpp Sat Oct 19 06:48:02 2013 +0200 @@ -1981,8 +1981,7 @@ unsigned int v7; // eax@3 unsigned int v9; // eax@3 - assert(uActorID < uNumActors); - auto actor = &pActors[uActorID]; + Actor* actor = &pActors[uActorID]; AIDirection a3; // [sp+Ch] [bp-5Ch]@2 if (!a4) @@ -2013,16 +2012,12 @@ void Actor::Resurrect(unsigned int uActorID) { Actor *pActor; // esi@1 - SpriteFrame *v2; // edx@1 - int v3; // eax@1 pActor = &pActors[uActorID]; - v2 = pSpriteFrameTable->pSpriteSFrames; - v3 = pActor->pSpriteIDs[ANIM_Dying]; pActor->uCurrentActionTime = 0; pActor->uAIState = Resurrected; pActor->uCurrentActionAnimation = ANIM_Dying; - pActor->uCurrentActionLength = 8 * v2[v3].uAnimLength; + pActor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[pActor->pSpriteIDs[ANIM_Dying]].uAnimLength; pActor->sCurrentHP = LOWORD(pActor->pMonsterInfo.uHP); Actor::PlaySound(uActorID, 1u); pActor->UpdateAnimation(); @@ -2095,53 +2090,34 @@ //----- (00402CED) -------------------------------------------------------- void Actor::PlaySound(unsigned int uActorID, unsigned int uSoundID) { - //Actor *v2; // eax@1 unsigned __int16 v3; // dx@1 - int v4; // eax@3 - int v5; // eax@4 - unsigned int v6; // eax@6 - //signed int v7; // eax@12 - signed int v8; // [sp-18h] [bp-1Ch]@10 - signed int v9; // [sp-14h] [bp-18h]@10 - int v10; // [sp-10h] [bp-14h]@10 - unsigned int v11; // [sp-Ch] [bp-10h]@10 - int v12; // [sp-8h] [bp-Ch]@10 - //v2 = &pActors[uActorID]; v3 = pActors[uActorID].pSoundSampleIDs[uSoundID]; if ( v3 ) { - if ( (signed __int64)pActors[uActorID].pActorBuffs[3].uExpireTime <= 0 ) + if ( pActors[uActorID].pActorBuffs[3].uExpireTime <= 0 ) { - v12 = 0; - v8 = -1; + pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); } else { - v4 = pActors[uActorID].pActorBuffs[3].uPower - 2; - if ( v4 ) + switch(pActors[uActorID].pActorBuffs[3].uPower) { - v5 = v4 - 1; - if ( v5 ) - { - if ( v5 == 1 ) - v6 = 55125; - else - v6 = uActorID; - } - else - { - v6 = 44100; - } + case 1: + pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, 0, 0, 0, 0, 33075); + break; + case 2: + pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, 0, 0, 0, 0, 33075); + break; + case 3: + case 4: + pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, 0, 0, 0, 0, 33075); + break; + default: + pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); + break; } - else - { - v6 = 33075; - } - v12 = v6; - v8 = 0; } - pAudioPlayer->PlaySound((SoundID)(signed __int16)v3, PID(OBJECT_Actor, uActorID), 0, v8, 0, 0, 0, v12); } }