Mercurial > mm7
comparison Actor.cpp @ 1883:7d334cc596e0
Actor::PlaySound cleaned up
author | Grumpy7 |
---|---|
date | Sat, 19 Oct 2013 06:48:02 +0200 |
parents | b3191dddab9f |
children | c77de46b31b1 |
comparison
equal
deleted
inserted
replaced
1882:b3191dddab9f | 1883:7d334cc596e0 |
---|---|
1979 void Actor::AI_Bored(unsigned int uActorID, unsigned int uObjID, AIDirection *a4) | 1979 void Actor::AI_Bored(unsigned int uActorID, unsigned int uObjID, AIDirection *a4) |
1980 { | 1980 { |
1981 unsigned int v7; // eax@3 | 1981 unsigned int v7; // eax@3 |
1982 unsigned int v9; // eax@3 | 1982 unsigned int v9; // eax@3 |
1983 | 1983 |
1984 assert(uActorID < uNumActors); | 1984 Actor* actor = &pActors[uActorID]; |
1985 auto actor = &pActors[uActorID]; | |
1986 | 1985 |
1987 AIDirection a3; // [sp+Ch] [bp-5Ch]@2 | 1986 AIDirection a3; // [sp+Ch] [bp-5Ch]@2 |
1988 if (!a4) | 1987 if (!a4) |
1989 a4 = Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), uObjID, &a3, 0); | 1988 a4 = Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), uObjID, &a3, 0); |
1990 | 1989 |
2011 | 2010 |
2012 //----- (00402F27) -------------------------------------------------------- | 2011 //----- (00402F27) -------------------------------------------------------- |
2013 void Actor::Resurrect(unsigned int uActorID) | 2012 void Actor::Resurrect(unsigned int uActorID) |
2014 { | 2013 { |
2015 Actor *pActor; // esi@1 | 2014 Actor *pActor; // esi@1 |
2016 SpriteFrame *v2; // edx@1 | |
2017 int v3; // eax@1 | |
2018 | 2015 |
2019 pActor = &pActors[uActorID]; | 2016 pActor = &pActors[uActorID]; |
2020 v2 = pSpriteFrameTable->pSpriteSFrames; | |
2021 v3 = pActor->pSpriteIDs[ANIM_Dying]; | |
2022 pActor->uCurrentActionTime = 0; | 2017 pActor->uCurrentActionTime = 0; |
2023 pActor->uAIState = Resurrected; | 2018 pActor->uAIState = Resurrected; |
2024 pActor->uCurrentActionAnimation = ANIM_Dying; | 2019 pActor->uCurrentActionAnimation = ANIM_Dying; |
2025 pActor->uCurrentActionLength = 8 * v2[v3].uAnimLength; | 2020 pActor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[pActor->pSpriteIDs[ANIM_Dying]].uAnimLength; |
2026 pActor->sCurrentHP = LOWORD(pActor->pMonsterInfo.uHP); | 2021 pActor->sCurrentHP = LOWORD(pActor->pMonsterInfo.uHP); |
2027 Actor::PlaySound(uActorID, 1u); | 2022 Actor::PlaySound(uActorID, 1u); |
2028 pActor->UpdateAnimation(); | 2023 pActor->UpdateAnimation(); |
2029 } | 2024 } |
2030 | 2025 |
2093 } | 2088 } |
2094 | 2089 |
2095 //----- (00402CED) -------------------------------------------------------- | 2090 //----- (00402CED) -------------------------------------------------------- |
2096 void Actor::PlaySound(unsigned int uActorID, unsigned int uSoundID) | 2091 void Actor::PlaySound(unsigned int uActorID, unsigned int uSoundID) |
2097 { | 2092 { |
2098 //Actor *v2; // eax@1 | |
2099 unsigned __int16 v3; // dx@1 | 2093 unsigned __int16 v3; // dx@1 |
2100 int v4; // eax@3 | 2094 |
2101 int v5; // eax@4 | |
2102 unsigned int v6; // eax@6 | |
2103 //signed int v7; // eax@12 | |
2104 signed int v8; // [sp-18h] [bp-1Ch]@10 | |
2105 signed int v9; // [sp-14h] [bp-18h]@10 | |
2106 int v10; // [sp-10h] [bp-14h]@10 | |
2107 unsigned int v11; // [sp-Ch] [bp-10h]@10 | |
2108 int v12; // [sp-8h] [bp-Ch]@10 | |
2109 | |
2110 //v2 = &pActors[uActorID]; | |
2111 v3 = pActors[uActorID].pSoundSampleIDs[uSoundID]; | 2095 v3 = pActors[uActorID].pSoundSampleIDs[uSoundID]; |
2112 if ( v3 ) | 2096 if ( v3 ) |
2113 { | 2097 { |
2114 if ( (signed __int64)pActors[uActorID].pActorBuffs[3].uExpireTime <= 0 ) | 2098 if ( pActors[uActorID].pActorBuffs[3].uExpireTime <= 0 ) |
2115 { | 2099 { |
2116 v12 = 0; | 2100 pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); |
2117 v8 = -1; | |
2118 } | 2101 } |
2119 else | 2102 else |
2120 { | 2103 { |
2121 v4 = pActors[uActorID].pActorBuffs[3].uPower - 2; | 2104 switch(pActors[uActorID].pActorBuffs[3].uPower) |
2122 if ( v4 ) | 2105 { |
2123 { | 2106 case 1: |
2124 v5 = v4 - 1; | 2107 pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, 0, 0, 0, 0, 33075); |
2125 if ( v5 ) | 2108 break; |
2126 { | 2109 case 2: |
2127 if ( v5 == 1 ) | 2110 pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, 0, 0, 0, 0, 33075); |
2128 v6 = 55125; | 2111 break; |
2129 else | 2112 case 3: |
2130 v6 = uActorID; | 2113 case 4: |
2131 } | 2114 pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, 0, 0, 0, 0, 33075); |
2132 else | 2115 break; |
2133 { | 2116 default: |
2134 v6 = 44100; | 2117 pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); |
2135 } | 2118 break; |
2136 } | 2119 } |
2137 else | 2120 } |
2138 { | |
2139 v6 = 33075; | |
2140 } | |
2141 v12 = v6; | |
2142 v8 = 0; | |
2143 } | |
2144 pAudioPlayer->PlaySound((SoundID)(signed __int16)v3, PID(OBJECT_Actor, uActorID), 0, v8, 0, 0, 0, v12); | |
2145 } | 2121 } |
2146 } | 2122 } |
2147 | 2123 |
2148 //----- (00402AD7) -------------------------------------------------------- | 2124 //----- (00402AD7) -------------------------------------------------------- |
2149 void Actor::AI_Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir) | 2125 void Actor::AI_Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir) |