# HG changeset patch # User Ritor1 # Date 1355888170 -21600 # Node ID dd1e818a6b4ca289df686e96f4f1528be9d6111b # Parent f87034a41fb80b6a10eb52bcd1bdc80c8e1eea2f# Parent b1f67710227f6f048767091f71984661b9918c1a Слияние diff -r f87034a41fb8 -r dd1e818a6b4c Arcomage.cpp --- a/Arcomage.cpp Wed Dec 19 09:35:53 2012 +0600 +++ b/Arcomage.cpp Wed Dec 19 09:36:10 2012 +0600 @@ -5757,7 +5757,7 @@ v4 = 120; do { - *v3 = pSoundList->_4A9A67(v4++, 0); + *v3 = pSoundList->LoadSound(v4++, 0); ++v3; } while ( (signed int)v3 <= (signed int)&unk_4FAA20 ); diff -r f87034a41fb8 -r dd1e818a6b4c AudioPlayer.cpp --- a/AudioPlayer.cpp Wed Dec 19 09:35:53 2012 +0600 +++ b/AudioPlayer.cpp Wed Dec 19 09:36:10 2012 +0600 @@ -120,7 +120,7 @@ } //----- (004A9A67) -------------------------------------------------------- -__int16 SoundList::_4A9A67(int a1, unsigned int a3) +__int16 SoundList::LoadSound(int a1, unsigned int a3) { AILSOUNDINFO v24; // [sp+84h] [bp-28h]@23 @@ -610,9 +610,9 @@ // 4D8300: using guessed type int __stdcall AIL_end_3D_sample(int); //----- (004AA306) -------------------------------------------------------- -void AudioPlayer::PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int a5, signed int a6, int a7, unsigned int uVolume, int sPlaybackRate) +void AudioPlayer::PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int PartyX, signed int PartyY, int a7, unsigned int uVolume, int sPlaybackRate) { - AudioPlayer *v9; // esi@1 + AudioPlayer *pAudioPlayer1; // esi@1 signed int v10; // edx@5 int *pSoundID; // ecx@6 int v12; // edi@13 @@ -620,85 +620,85 @@ signed int v14; // eax@20 int v15; // eax@24 signed int v16; // eax@25 - LayingItem *v17; // eax@28 + LayingItem *pLayingItem; // eax@28 signed int v18; // eax@29 - Actor *v19; // eax@32 + Actor *pActor1; // eax@32 signed int v20; // ecx@32 double v21; // st7@32 signed int v22; // ecx@33 - AudioPlayer_3DSample *v23; // esi@53 - AudioPlayer_3DSample *v24; // esi@61 + AudioPlayer_3DSample *pAudioPlayer_3DSample; // esi@53 + AudioPlayer_3DSample *pAudioPlayer_3DSample1; // esi@61 int v25; // esi@67 double v26; // st7@68 int v27; // ST18_4@68 int v28; // ebx@68 int v29; // eax@68 - AudioPlayer_3DSample *v30; // esi@69 + AudioPlayer_3DSample *pAudioPlayer_3DSample2; // esi@69 int v31; // ST18_4@70 int v32; // ebx@70 int v33; // eax@70 int v34; // eax@70 char v35; // zf@70 signed int v36; // ebx@74 - AudioPlayer *v37; // edi@79 - AudioPlayer_3DSample *v38; // esi@79 + AudioPlayer *pAudioPlayer2; // edi@79 + AudioPlayer_3DSample *pAudioPlayer_3DSample3; // esi@79 unsigned int v39; // ebx@80 int v40; // eax@81 char *v41; // edi@82 int v42; // esi@82 double v43; // st7@91 - LayingItem *v44; // eax@92 - Actor *v45; // eax@93 + LayingItem *pLayingItem2; // eax@92 + Actor *pActor; // eax@93 signed int v46; // ecx@93 double v47; // st7@93 - BLVDoor *v48; // eax@97 + BLVDoor *pBLVDoor; // eax@97 double v49; // st7@104 int v50; // ST18_4@104 int v51; // ebx@104 int v52; // eax@104 float v53; // ST0C_4@106 float v54; // ST04_4@106 - AudioPlayer *v55; // edx@106 - SoundDesc *v56; // edx@107 - LayingItem *v57; // eax@114 + AudioPlayer *pAudioPlayer3; // edx@106 + SoundDesc *pSoundDesc; // edx@107 + LayingItem *pLayingItem3; // eax@114 int v58; // edx@115 int v59; // ecx@115 - Actor *v60; // eax@118 - MixerChannel *v61; // esi@126 + Actor *pActor2; // eax@118 + MixerChannel *pMixerChannel; // esi@126 signed int v62; // esi@133 - AudioPlayer *v63; // ebx@133 - MixerChannel *v64; // edi@134 + AudioPlayer *pAudioPlayer4; // ebx@133 + MixerChannel *pMixerChannel2; // edi@134 int v65; // ebx@141 - AudioPlayer *v66; // ecx@142 - MixerChannel *v67; // edi@142 + AudioPlayer *pAudioPlayer5; // ecx@142 + MixerChannel *pMixerChannel3; // edi@142 int v68; // eax@143 - MixerChannel *v69; // edi@149 + MixerChannel *pMixerChannel4; // edi@149 int v70; // ecx@152 - SoundDesc *v71; // eax@153 + SoundDesc *pSoundDesc2; // eax@153 int v72; // edi@156 - MixerChannel *v73; // esi@157 - unsigned int v74; // eax@157 - int v75; // ebx@159 + MixerChannel *pMixerChannel5; // esi@157 + unsigned int pVolume; // eax@157 + int pPartyX; // ebx@159 int v76; // ebx@160 - LayingItem *v77; // edi@164 - unsigned int v78; // edx@166 - unsigned int v79; // ecx@166 + LayingItem *pLayingItem4; // edi@164 + unsigned int pPosY; // edx@166 + unsigned int pPosX; // ecx@166 int v80; // eax@167 - Actor *v81; // edi@168 - BLVDoor *v82; // edi@173 + Actor *pActor3; // edi@168 + BLVDoor *pBLVDoor2; // edi@173 int v83; // eax@183 int v84; // eax@183 _SAMPLE *v85; // ST18_4@186 unsigned int v86; // [sp+14h] [bp-60h]@84 int v87; // [sp+14h] [bp-60h]@115 - RenderVertexSoft a1; // [sp+24h] [bp-50h]@1 + RenderVertexSoft RenderVertexSoft; // [sp+24h] [bp-50h]@1 unsigned int v89; // [sp+54h] [bp-20h]@12 int v90; // [sp+58h] [bp-1Ch]@68 float v91; // [sp+5Ch] [bp-18h]@68 unsigned int v92; // [sp+60h] [bp-14h]@10 float v93; // [sp+64h] [bp-10h]@1 signed int varC; // [sp+68h] [bp-Ch]@68 - AudioPlayer *v94; // [sp+6Ch] [bp-8h]@1 + AudioPlayer *pAudioPlayer; // [sp+6Ch] [bp-8h]@1 int v96; // [sp+70h] [bp-4h]@19 signed int uNumRepeatsb; // [sp+84h] [bp+10h]@93 float uNumRepeatsa; // [sp+84h] [bp+10h]@104 @@ -708,10 +708,10 @@ int v102; // [sp+90h] [bp+1Ch]@60 int v103; // [sp+90h] [bp+1Ch]@68 - v9 = this; + pAudioPlayer1 = this; v35 = this->bPlayerReady == 0; - v94 = this; - a1.flt_2C = 0.0; + pAudioPlayer = this; + RenderVertexSoft.flt_2C = 0.0; LODWORD(v93) = 10000; if ( v35 || !uSoundVolumeMultiplier || !this->hDigDriver || !eSoundID ) return; @@ -735,9 +735,9 @@ v92 = v10; if ( !v10 ) return; - if ( !v9->b3DSoundInitialized || (v89 = 120 * v10, !(pSoundList->pSounds[v10].uFlags & 2)) ) + if ( !pAudioPlayer1->b3DSoundInitialized || (v89 = 120 * v10, !(pSoundList->pSounds[v10].uFlags & 2)) ) { - v56 = (SoundDesc *)7; + //pSoundDesc = (SoundDesc *)7; if ( a3 < 0 ) { if ( a3 == -1 ) @@ -754,84 +754,83 @@ if ( a3 != -1 ) { LODWORD(v91) = 0; - if ( v94->uMixerChannels > 0 ) + if ( pAudioPlayer->uMixerChannels > 0 ) { - v61 = v94->pMixerChannels; + pMixerChannel = pAudioPlayer->pMixerChannels; do { - if ( AIL_sample_status(v61->hSample) == 4 - && v61->dword_000004 == a3 - && AIL_sample_status(v61->hSample) == 4 ) + if ( AIL_sample_status(pMixerChannel->hSample) == 4 && pMixerChannel->dword_000004 == a3 + && AIL_sample_status(pMixerChannel->hSample) == 4 ) { - if ( v61->uSourceTrackIdx == v92 ) + if ( pMixerChannel->uSourceTrackIdx == v92 ) return; - AIL_end_sample(v61->hSample); - _4ABE55(v61); + AIL_end_sample(pMixerChannel->hSample); + _4ABE55(pMixerChannel); } ++LODWORD(v91); - ++v61; + ++pMixerChannel; } - while ( SLODWORD(v91) < v94->uMixerChannels ); + while ( SLODWORD(v91) < pAudioPlayer->uMixerChannels ); } } } LABEL_133: v62 = varC; - v63 = v94; + pAudioPlayer4 = pAudioPlayer; if ( varC <= v96 ) { - v64 = &v94->pMixerChannels[varC]; - while ( AIL_sample_status(v64->hSample) != 2 ) + pMixerChannel2 = &pAudioPlayer->pMixerChannels[varC]; + while ( AIL_sample_status(pMixerChannel2->hSample) != 2 ) { ++v62; - ++v64; + ++pMixerChannel2; if ( v62 > v96 ) goto LABEL_140; } - AIL_end_sample(v64->hSample); - if ( v64->uSourceTrackIdx ) - _4ABE55(v64); + AIL_end_sample(pMixerChannel2->hSample); + if ( pMixerChannel2->uSourceTrackIdx ) + _4ABE55(pMixerChannel2); } LABEL_140: if ( v62 != v96 + 1 ) { LABEL_150: if ( LODWORD(v93) == 10000 ) - LODWORD(v93) = v63->uMasterVolume; + LODWORD(v93) = pAudioPlayer4->uMasterVolume; v70 = 0; if ( !a7 ) { - v56 = pSoundList->pSounds; - v71 = &pSoundList->pSounds[v92]; - if ( !v71->pSoundData[0] ) + //pSoundDesc = pSoundList->pSounds; + pSoundDesc2 = &pSoundList->pSounds[v92]; + if ( !pSoundDesc2->pSoundData[0] ) { - if (v71->eType == SOUND_DESC_SWAP) - pSoundList->_4A9A67(eSoundID, 0); + if (pSoundDesc2->eType == SOUND_DESC_SWAP) + pSoundList->LoadSound(eSoundID, 0); } } v72 = 4 * (a7 + 30 * v92) + 44; if ( !*(int *)&pSoundList->pSounds->pSoundName[v72] ) return; - v73 = &v63->pMixerChannels[v62]; - AIL_init_sample(v73->hSample); - AIL_set_sample_file(v73->hSample, (void *)(*(int *)&pSoundList->pSounds->pSoundName[v72] + 4 * (a7 == 0)), -1); - v74 = uVolume; + pMixerChannel5 = &pAudioPlayer4->pMixerChannels[v62]; + AIL_init_sample(pMixerChannel5->hSample); + AIL_set_sample_file(pMixerChannel5->hSample, (void *)(*(int *)&pSoundList->pSounds->pSoundName[v72] + 4 * (a7 == 0)), -1); + pVolume = uVolume; if ( !uVolume ) - v74 = LODWORD(v93); - AIL_set_sample_volume(v73->hSample, v74); - v75 = a5; - if ( a5 != -1 ) + pVolume = LODWORD(v93); + AIL_set_sample_volume(pMixerChannel5->hSample, pVolume); + pPartyX = PartyX; + if ( PartyX != -1 ) { - if ( !a5 ) - v75 = pParty->vPosition.x; - if ( !a6 ) - a6 = pParty->vPosition.y; + if ( !PartyX ) + pPartyX = pParty->vPosition.x; + if ( !PartyY ) + PartyY = pParty->vPosition.y; if ( uNumRepeats ) - AIL_set_sample_loop_count(v73->hSample, uNumRepeats - 1); - v83 = sub_4AB66C(v75, a6); - AIL_set_sample_pan(v73->hSample, v83); - v84 = GetSoundStrengthByDistanceFromParty(v75, a6, pParty->vPosition.z); - AIL_set_sample_volume(v73->hSample, v84); + AIL_set_sample_loop_count(pMixerChannel5->hSample, uNumRepeats - 1); + v83 = sub_4AB66C(pPartyX, PartyY); + AIL_set_sample_pan(pMixerChannel5->hSample, v83); + v84 = GetSoundStrengthByDistanceFromParty(pPartyX, PartyY, pParty->vPosition.z); + AIL_set_sample_volume(pMixerChannel5->hSample, v84); v76 = a3; goto LABEL_184; } @@ -840,62 +839,68 @@ { if ( uCurrentlyLoadedLevelType != LEVEL_Indoor ) goto LABEL_184; - v82 = &pIndoor->pDoors[a3 >> 3]; - if ( !v82->uDoorID ) + pBLVDoor2 = &pIndoor->pDoors[a3 >> 3]; + if ( !pBLVDoor2->uDoorID ) return; - if ( !GetSoundStrengthByDistanceFromParty(*v82->pXOffsets, *v82->pYOffsets, *v82->pZOffsets) ) + if ( !GetSoundStrengthByDistanceFromParty(*pBLVDoor2->pXOffsets, *pBLVDoor2->pYOffsets, *pBLVDoor2->pZOffsets) ) { - AIL_end_sample(v73->hSample); - v94->AudioPlayer::_4ABE55(v73); + AIL_end_sample(pMixerChannel5->hSample); + pAudioPlayer->AudioPlayer::_4ABE55(pMixerChannel5); return; } - v78 = *v82->pYOffsets; - v79 = *v82->pXOffsets; - goto LABEL_167; + pPosY = *pBLVDoor2->pYOffsets; + pPosX = *pBLVDoor2->pXOffsets; + //goto LABEL_167; + v80 = sub_4AB66C(pPosX, pPosY); + AIL_set_sample_pan(pMixerChannel5->hSample, v80); + goto LABEL_184; } if ( (a3 & 7) == 2 ) { - v77 = &pLayingItems[a3 >> 3]; - if ( !GetSoundStrengthByDistanceFromParty(v77->vPosition.x, v77->vPosition.y, v77->vPosition.z) ) + pLayingItem4 = &pLayingItems[a3 >> 3]; + if ( !GetSoundStrengthByDistanceFromParty(pLayingItem4->vPosition.x, pLayingItem4->vPosition.y, pLayingItem4->vPosition.z) ) return; } else { if ( (a3 & 7) == 3 ) { - v81 = &pActors[a3 >> 3]; - if ( !GetSoundStrengthByDistanceFromParty(v81->vPosition.x, v81->vPosition.y, v81->vPosition.z) ) + pActor3 = &pActors[a3 >> 3]; + if ( !GetSoundStrengthByDistanceFromParty(pActor3->vPosition.x, pActor3->vPosition.y, pActor3->vPosition.z) ) return; - v78 = v81->vPosition.y; - v79 = v81->vPosition.x; - goto LABEL_167; + pPosY = pActor3->vPosition.y; + pPosX = pActor3->vPosition.x; + //goto LABEL_167; + v80 = sub_4AB66C(pPosX, pPosY); + AIL_set_sample_pan(pMixerChannel5->hSample, v80); + goto LABEL_184; } if ( (a3 & 7) != 5 ) { LABEL_184: if ( uNumRepeats ) - AIL_set_sample_loop_count(v73->hSample, uNumRepeats - 1); - v85 = v73->hSample; - v73->uSourceTrackIdx = v92; - v73->dword_000004 = v76; - v73->uSourceTrackID = eSoundID; + AIL_set_sample_loop_count(pMixerChannel5->hSample, uNumRepeats - 1); + v85 = pMixerChannel5->hSample; + pMixerChannel5->uSourceTrackIdx = v92; + pMixerChannel5->dword_000004 = v76; + pMixerChannel5->uSourceTrackID = eSoundID; AIL_start_sample(v85); if ( sPlaybackRate ) - AIL_set_sample_playback_rate(v73->hSample, sPlaybackRate); + AIL_set_sample_playback_rate(pMixerChannel5->hSample, sPlaybackRate); if ( (v76 & 7) == 4 ) - AIL_sample_ms_position(v73->hSample, &sLastTrackLengthMS, 0); + AIL_sample_ms_position(pMixerChannel5->hSample, &sLastTrackLengthMS, 0); return; } - v77 = (LayingItem *)&pLevelDecorations[a3 >> 3]; - if ( !GetSoundStrengthByDistanceFromParty(v77->vPosition.x, v77->vPosition.y, v77->vPosition.z) ) + pLayingItem4 = (LayingItem *)&pLevelDecorations[a3 >> 3]; + if ( !GetSoundStrengthByDistanceFromParty(pLayingItem4->vPosition.x, pLayingItem4->vPosition.y, pLayingItem4->vPosition.z) ) return; - AIL_set_sample_loop_count(v73->hSample, uNumRepeats - 1); + AIL_set_sample_loop_count(pMixerChannel5->hSample, uNumRepeats - 1); } - v78 = v77->vPosition.y; - v79 = v77->vPosition.x; -LABEL_167: - v80 = sub_4AB66C(v79, v78); - AIL_set_sample_pan(v73->hSample, v80); + pPosY = pLayingItem4->vPosition.y; + pPosX = pLayingItem4->vPosition.x; +//LABEL_167: + v80 = sub_4AB66C(pPosX, pPosY); + AIL_set_sample_pan(pMixerChannel5->hSample, v80); goto LABEL_184; } v65 = varC; @@ -903,27 +908,27 @@ v91 = v93; if ( varC <= v96 ) { - v66 = v94; - v67 = &v94->pMixerChannels[varC]; + pAudioPlayer5 = pAudioPlayer; + pMixerChannel3 = &pAudioPlayer->pMixerChannels[varC]; do { - v68 = AIL_sample_volume(v67->hSample); + v68 = AIL_sample_volume(pMixerChannel3->hSample); if ( v68 < SLODWORD(v91) ) { LODWORD(v91) = v68; v62 = v65; } ++v65; - ++v67; + ++pMixerChannel3; } while ( v65 <= v96 ); if ( v62 != -1 ) { -LABEL_149: - v63 = v94; - v69 = &v94->pMixerChannels[v62]; - AIL_end_sample(v69->hSample); - _4ABE55(v69); +//LABEL_149: + pAudioPlayer4 = pAudioPlayer; + pMixerChannel4 = &pAudioPlayer->pMixerChannels[v62]; + AIL_end_sample(pMixerChannel4->hSample); + _4ABE55(pMixerChannel4); goto LABEL_150; } v65 = varC; @@ -931,26 +936,31 @@ v62 = 13; if ( v65 != 13 ) return; - goto LABEL_149; + //goto LABEL_149; + pAudioPlayer4 = pAudioPlayer; + pMixerChannel4 = &pAudioPlayer->pMixerChannels[v62]; + AIL_end_sample(pMixerChannel4->hSample); + _4ABE55(pMixerChannel4); + goto LABEL_150; } if ( (a3 & 7) == 2 ) { varC = 5; v96 = 7; - v57 = &pLayingItems[a3 >> 3]; + pLayingItem3 = &pLayingItems[a3 >> 3]; } else { if ( (a3 & 7) == 3 ) { *(float *)&varC = 0.0; - v60 = &pActors[a3 >> 3]; + pActor2 = &pActors[a3 >> 3]; v96 = 3; - v58 = v60->vPosition.y; - v87 = v60->vPosition.z; - v59 = v60->vPosition.x; + v58 = pActor2->vPosition.y; + v87 = pActor2->vPosition.z; + v59 = pActor2->vPosition.x; LABEL_116: - LODWORD(v93) = GetSoundStrengthByDistanceFromParty(v59, (int)v56, v87); + LODWORD(v93) = GetSoundStrengthByDistanceFromParty(v59, /*(int)pSoundDesc*/ v58, v87); if ( v93 == 0.0 ) return; goto LABEL_123; @@ -971,32 +981,41 @@ } varC = 4; v96 = 4; - v57 = (LayingItem *)&pLevelDecorations[a3 >> 3]; + pLayingItem3 = (LayingItem *)&pLevelDecorations[a3 >> 3]; } - v87 = v57->vPosition.z; - v58 = v57->vPosition.y; - v59 = v57->vPosition.x; + v87 = pLayingItem3->vPosition.z; + v58 = pLayingItem3->vPosition.y; + v59 = pLayingItem3->vPosition.x; goto LABEL_116; } v12 = 13; if ( a3 < 0 ) { - v15 = v9->uNum3DSamples; + v15 = pAudioPlayer1->uNum3DSamples; if ( a3 == -1 ) { if ( v15 < 16 ) v12 = v15 - 1; v96 = v12; - goto LABEL_46; + //goto LABEL_46; + RenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x; + RenderVertexSoft.vWorldPosition.y = (double)pParty->vPosition.y; + v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; + goto LABEL_47; } if ( v15 >= 16 ) v15 = 14; v12 = v15; - goto LABEL_45; + //goto LABEL_45; + v96 = v15; + RenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x; + RenderVertexSoft.vWorldPosition.y = (double)pParty->vPosition.y; + v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; + goto LABEL_47; } if ( (a3 & 7) == 2 ) { - v22 = v9->uNum3DSamples; + v22 = pAudioPlayer1->uNum3DSamples; if ( v22 < 16 ) { v12 = 5 * v22 / 16; @@ -1007,36 +1026,40 @@ v96 = 7; v12 = 5; } - v17 = &pLayingItems[a3 >> 3]; + pLayingItem = &pLayingItems[a3 >> 3]; } else { if ( (a3 & 7) == 3 ) { - v18 = v9->uNum3DSamples; + v18 = pAudioPlayer1->uNum3DSamples; v12 = 0; if ( v18 < 16 ) v96 = 3 * v18 / 16; else v96 = 3; - v19 = &pActors[a3 >> 3]; - v20 = v19->vPosition.y; - a1.vWorldPosition.x = (double)v19->vPosition.x; - v100 = v19->vPosition.z; - a1.vWorldPosition.y = (double)v20; + pActor1 = &pActors[a3 >> 3]; + v20 = pActor1->vPosition.y; + RenderVertexSoft.vWorldPosition.x = (double)pActor1->vPosition.x; + v100 = pActor1->vPosition.z; + RenderVertexSoft.vWorldPosition.y = (double)v20; v21 = (double)v100; goto LABEL_47; } if ( (a3 & 7) != 5 ) { - v13 = v9->uNum3DSamples; + v13 = pAudioPlayer1->uNum3DSamples; if ( (a3 & 7) == 6 ) { if ( v13 >= 16 ) { v96 = 9; v12 = 8; - goto LABEL_46; + //goto LABEL_46; + RenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x; + RenderVertexSoft.vWorldPosition.y = (double)pParty->vPosition.y; + v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; + goto LABEL_47; } v12 = 8 * v13 / 16; v14 = 9 * v13; @@ -1047,9 +1070,9 @@ { v96 = 12; v12 = 10; -LABEL_46: - a1.vWorldPosition.x = (double)pParty->vPosition.x; - a1.vWorldPosition.y = (double)pParty->vPosition.y; +//LABEL_46: + RenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x; + RenderVertexSoft.vWorldPosition.y = (double)pParty->vPosition.y; v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; goto LABEL_47; } @@ -1057,11 +1080,15 @@ v14 = 12 * v13; } v15 = v14 / 16; -LABEL_45: +//LABEL_45: v96 = v15; - goto LABEL_46; + //goto LABEL_46; + RenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x; + RenderVertexSoft.vWorldPosition.y = (double)pParty->vPosition.y; + v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; + goto LABEL_47; } - v16 = v9->uNum3DSamples; + v16 = pAudioPlayer1->uNum3DSamples; if ( v16 < 16 ) { v12 = v16 / 4; @@ -1072,55 +1099,56 @@ v12 = 4; v96 = 4; } - v17 = (LayingItem *)&pLevelDecorations[a3 >> 3]; + pLayingItem = (LayingItem *)&pLevelDecorations[a3 >> 3]; } - a1.vWorldPosition.x = (double)v17->vPosition.x; - a1.vWorldPosition.y = (double)v17->vPosition.y; - v21 = (double)v17->vPosition.z; + RenderVertexSoft.vWorldPosition.x = (double)pLayingItem->vPosition.x; + RenderVertexSoft.vWorldPosition.y = (double)pLayingItem->vPosition.y; + v21 = (double)pLayingItem->vPosition.z; LABEL_47: - a1.vWorldPosition.z = v21; + RenderVertexSoft.vWorldPosition.z = v21; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - sub_4AAEA6_transform(&a1); + sub_4AAEA6_transform(&RenderVertexSoft); else - pGame->pIndoorCameraD3D->ViewTransform(&a1, 1u); + pGame->pIndoorCameraD3D->ViewTransform(&RenderVertexSoft, 1); if ( a3 ) { if ( a3 != -1 ) { v101 = 0; - if ( v9->uNum3DSamples > 0 ) + if ( pAudioPlayer1->uNum3DSamples > 0 ) { - v23 = v94->p3DSamples; + pAudioPlayer_3DSample = pAudioPlayer->p3DSamples; do { - if ( AIL_3D_sample_status(v23->hSample) == 4 && v23->field_4 == a3 && AIL_3D_sample_status(v23->hSample) == 4 ) + if ( AIL_3D_sample_status(pAudioPlayer_3DSample->hSample) == 4 + && pAudioPlayer_3DSample->field_4 == a3 && AIL_3D_sample_status(pAudioPlayer_3DSample->hSample) == 4 ) { - if ( v23->field_8 == v92 ) + if ( pAudioPlayer_3DSample->field_8 == v92 ) return; - AIL_end_3D_sample(v23->hSample); - v94->_4ABF23(v23); + AIL_end_3D_sample(pAudioPlayer_3DSample->hSample); + pAudioPlayer->_4ABF23(pAudioPlayer_3DSample); } ++v101; - ++v23; + ++pAudioPlayer_3DSample; } - while ( v101 < v94->uNum3DSamples ); + while ( v101 < pAudioPlayer->uNum3DSamples ); } } } v102 = v12; if ( v12 <= v96 ) { - v24 = &v94->p3DSamples[v12]; - while ( AIL_3D_sample_status(v24->hSample) != 2 ) + pAudioPlayer_3DSample1 = &pAudioPlayer->p3DSamples[v12]; + while ( AIL_3D_sample_status(pAudioPlayer_3DSample1->hSample) != 2 ) { ++v102; - ++v24; + ++pAudioPlayer_3DSample1; if ( v102 > v96 ) goto LABEL_67; } - AIL_end_3D_sample(v24->hSample); - if ( v24->field_8 ) - v94->_4ABF23(v24); + AIL_end_3D_sample(pAudioPlayer_3DSample1->hSample); + if ( pAudioPlayer_3DSample1->field_8 ) + pAudioPlayer->_4ABF23(pAudioPlayer_3DSample1); } LABEL_67: v25 = v96; @@ -1128,9 +1156,9 @@ { LODWORD(v91) = -1; v103 = 0; - *(float *)&varC = a1.vWorldViewPosition.y * -0.012207031; + *(float *)&varC = RenderVertexSoft.vWorldViewPosition.y * -0.012207031; v93 = 0.0; - v26 = a1.vWorldViewPosition.x * 0.012207031; + v26 = RenderVertexSoft.vWorldViewPosition.x * 0.012207031; *(float *)&uVolume = v26; v27 = abs((signed __int64)v26); v28 = abs((signed __int64)v93); @@ -1139,10 +1167,10 @@ sPlaybackRate = v12; if ( v12 > v25 ) goto LABEL_192; - v30 = &v94->p3DSamples[v12]; + pAudioPlayer_3DSample2 = &pAudioPlayer->p3DSamples[v12]; do { - AIL_3D_position(v30->hSample, &varC, &v93, (long *)&uVolume); + AIL_3D_position(pAudioPlayer_3DSample2->hSample, &varC, &v93, (long *)&uVolume); v31 = abs((signed __int64)*(float *)&uVolume); v32 = abs((signed __int64)v93); v33 = abs((signed __int64)*(float *)&varC); @@ -1163,7 +1191,7 @@ v36 = LODWORD(v91); } ++sPlaybackRate; - ++v30; + ++pAudioPlayer_3DSample2; } while ( sPlaybackRate <= v96 ); if ( v36 == -1 ) @@ -1173,16 +1201,16 @@ if ( v12 != 13 ) return; } - v37 = v94; - v38 = &v94->p3DSamples[v36]; - AIL_end_3D_sample(v38->hSample); - v37->_4ABF23(v38); + pAudioPlayer2 = pAudioPlayer; + pAudioPlayer_3DSample3 = &pAudioPlayer->p3DSamples[v36]; + AIL_end_3D_sample(pAudioPlayer_3DSample3->hSample); + pAudioPlayer2->_4ABF23(pAudioPlayer_3DSample3); v102 = v36; } v39 = v89; - if ( pSoundList->pSounds[v89 / 0x78].p3DSound || (LOWORD(v40) = pSoundList->_4A9A67(eSoundID, 0), v40) ) + if ( pSoundList->pSounds[v89 / 0x78].p3DSound || (LOWORD(v40) = pSoundList->LoadSound(eSoundID, 0), v40) ) { - v41 = (char *)v94 + 16 * v102; + v41 = (char *)pAudioPlayer + 16 * v102; v42 = (int)(v41 + 20); if ( AIL_set_3D_sample_file(*((int *)v41 + 5), *(void **)((char *)&pSoundList->pSounds->p3DSound + v39)) ) { @@ -1191,33 +1219,36 @@ else v86 = 1; AIL_set_3D_sample_loop_count(*(int *)v42, v86); - if ( a5 == -1 ) + if ( PartyX == -1 ) { if ( (a3 & 7) == 1 ) { - if ( uCurrentlyLoadedLevelType != LEVEL_Indoor ) - goto LABEL_103; - v48 = &pIndoor->pDoors[a3 >> 3]; - if ( !v48->uDoorID ) - return; - a1.vWorldPosition.x = (double)*v48->pXOffsets; - a1.vWorldPosition.y = (double)*v48->pYOffsets; - v47 = (double)*v48->pZOffsets; -LABEL_101: - a1.vWorldPosition.z = v47; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { - sub_4AAEA6_transform(&a1); - goto LABEL_104; - } -LABEL_103: - pGame->pIndoorCameraD3D->ViewTransform(&a1, 1u); -LABEL_104: + //goto LABEL_103; + pBLVDoor = &pIndoor->pDoors[a3 >> 3]; + if ( !pBLVDoor->uDoorID ) + return; + RenderVertexSoft.vWorldPosition.x = (double)*pBLVDoor->pXOffsets; + RenderVertexSoft.vWorldPosition.y = (double)*pBLVDoor->pYOffsets; + v47 = (double)*pBLVDoor->pZOffsets; +LABEL_101: + RenderVertexSoft.vWorldPosition.z = v47; + //if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + //{ + sub_4AAEA6_transform(&RenderVertexSoft); + //goto LABEL_104; + //} + } +//LABEL_103: + if ( uCurrentlyLoadedLevelType != LEVEL_Indoor ) + pGame->pIndoorCameraD3D->ViewTransform(&RenderVertexSoft, 1); +//LABEL_104: AIL_start_3D_sample(*(int *)v42); AIL_set_3D_sample_float_distances(*(int **)v42, 100.0, 20.0, 100.0, 20.0); - AIL_set_3D_sample_volume(*(int **)v42, v94->s3DSoundVolume); - v99 = a1.vWorldViewPosition.y * -0.012207031; - v49 = a1.vWorldViewPosition.x * 0.012207031; + AIL_set_3D_sample_volume(*(int **)v42, pAudioPlayer->s3DSoundVolume); + v99 = RenderVertexSoft.vWorldViewPosition.y * -0.012207031; + v49 = RenderVertexSoft.vWorldViewPosition.x * 0.012207031; uNumRepeatsa = v49; v50 = abs((signed __int64)v49); v51 = abs(0); @@ -1228,59 +1259,57 @@ v53 = -uNumRepeatsa; v54 = -v99; AIL_set_3D_orientation((void *)*(int *)v42, LODWORD(v54), 0.0, LODWORD(v53), 0.0, 1.0, 0.0); - v55 = v94; + pAudioPlayer3 = pAudioPlayer; *((int *)v41 + 6) = a3; *((int *)v41 + 7) = v92; - *(&v55->bEAXSupported + 4 * (v102 + 2)) = eSoundID; + *(&pAudioPlayer3->bEAXSupported + 4 * (v102 + 2)) = eSoundID; } else { AIL_end_3D_sample(*(int **)v42); - v94->_4ABF23((AudioPlayer_3DSample *)(v41 + 20)); + pAudioPlayer->_4ABF23((AudioPlayer_3DSample *)(v41 + 20)); } return; } if ( (a3 & 7) == 2 ) { - v44 = &pLayingItems[a3 >> 3]; + pLayingItem2 = &pLayingItems[a3 >> 3]; } else { if ( (a3 & 7) == 3 ) { - v45 = &pActors[a3 >> 3]; - v46 = v45->vPosition.y; - a1.vWorldPosition.x = (double)v45->vPosition.x; - uNumRepeatsb = v45->vPosition.z; - a1.vWorldPosition.y = (double)v46; + pActor = &pActors[a3 >> 3]; + v46 = pActor->vPosition.y; + RenderVertexSoft.vWorldPosition.x = (double)pActor->vPosition.x; + uNumRepeatsb = pActor->vPosition.z; + RenderVertexSoft.vWorldPosition.y = (double)v46; v47 = (double)uNumRepeatsb; goto LABEL_101; } if ( (a3 & 7) != 5 ) { - a1.vWorldPosition.x = (double)pParty->vPosition.x; + RenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x; v43 = (double)pParty->vPosition.y; LABEL_100: - a1.vWorldPosition.y = v43; + RenderVertexSoft.vWorldPosition.y = v43; v47 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; goto LABEL_101; } - v44 = (LayingItem *)&pLevelDecorations[a3 >> 3]; + pLayingItem2 = (LayingItem *)&pLevelDecorations[a3 >> 3]; } - a1.vWorldPosition.x = (double)v44->vPosition.x; - a1.vWorldPosition.y = (double)v44->vPosition.y; - v47 = (double)v44->vPosition.z; + RenderVertexSoft.vWorldPosition.x = (double)pLayingItem2->vPosition.x; + RenderVertexSoft.vWorldPosition.y = (double)pLayingItem2->vPosition.y; + v47 = (double)pLayingItem2->vPosition.z; goto LABEL_101; } - a1.vWorldPosition.x = (double)a5; - v43 = (double)a6; + RenderVertexSoft.vWorldPosition.x = (double)PartyX; + v43 = (double)PartyY; goto LABEL_100; } } } - - //----- (0040DEA5) -------------------------------------------------------- void __cdecl AudioPlayer::MessWithChannels() { diff -r f87034a41fb8 -r dd1e818a6b4c AudioPlayer.h --- a/AudioPlayer.h Wed Dec 19 09:35:53 2012 +0600 +++ b/AudioPlayer.h Wed Dec 19 09:36:10 2012 +0600 @@ -247,7 +247,7 @@ {} void Initialize(); - __int16 _4A9A67(int a1, unsigned int a3); + __int16 LoadSound(int a1, unsigned int a3); int LoadSound(unsigned int a2, LPVOID lpBuffer, int uBufferSizeLeft, int *pOutSoundSize, int a6); SoundDesc *Release(); void _4A9D79(int a2); diff -r f87034a41fb8 -r dd1e818a6b4c Indoor.cpp --- a/Indoor.cpp Wed Dec 19 09:35:53 2012 +0600 +++ b/Indoor.cpp Wed Dec 19 09:36:10 2012 +0600 @@ -3141,12 +3141,12 @@ free(pRawDLV); //v5 = 0; - pSoundList->_4A9A67(64, 0); - pSoundList->_4A9A67(103, 0); - pSoundList->_4A9A67(63, 0); - pSoundList->_4A9A67(102, 0); - pSoundList->_4A9A67(50, 0); - pSoundList->_4A9A67(89, 0); + pSoundList->LoadSound(64, 0); + pSoundList->LoadSound(103, 0); + pSoundList->LoadSound(63, 0); + pSoundList->LoadSound(102, 0); + pSoundList->LoadSound(50, 0); + pSoundList->LoadSound(89, 0); return 0; } @@ -4514,8 +4514,8 @@ RespawnGlobalDecorations(); } - pSoundList->_4A9A67(pDoorSoundIDsByLocationID[v39], 0); - pSoundList->_4A9A67(pDoorSoundIDsByLocationID[v39] + 1, 0); + pSoundList->LoadSound(pDoorSoundIDsByLocationID[v39], 0); + pSoundList->LoadSound(pDoorSoundIDsByLocationID[v39] + 1, 0); for (uint i = 0; i < pIndoor->uNumDoors; ++i) { @@ -4612,7 +4612,7 @@ v15 = pDecorationList->pDecorations[pDecortaion->uDecorationDescID].uSoundID; if (v15 && _6807E0_num_decorations_with_sounds_6807B8 < 9) { - pSoundList->_4A9A67(v15, 0); + pSoundList->LoadSound(v15, 0); v16 = _6807E0_num_decorations_with_sounds_6807B8++; _6807B8_level_decorations_ids[v16] = i; } diff -r f87034a41fb8 -r dd1e818a6b4c Outdoor.cpp --- a/Outdoor.cpp Wed Dec 19 09:35:53 2012 +0600 +++ b/Outdoor.cpp Wed Dec 19 09:36:10 2012 +0600 @@ -2288,12 +2288,12 @@ pBitmaps_LOD->pTextures[uSky_TextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[uSky_TextureID].palette_id1); pPaletteManager->RecalculateAll(); - pSoundList->_4A9A67(53, 0); - pSoundList->_4A9A67(92, 0); - pSoundList->_4A9A67(57, 0); - pSoundList->_4A9A67(96, 0); - pSoundList->_4A9A67(64, 0); - pSoundList->_4A9A67(103, 0); + pSoundList->LoadSound(53, 0); + pSoundList->LoadSound(92, 0); + pSoundList->LoadSound(57, 0); + pSoundList->LoadSound(96, 0); + pSoundList->LoadSound(64, 0); + pSoundList->LoadSound(103, 0); v102 = thisa; thisa = 3; do @@ -2303,34 +2303,34 @@ switch ( *(short *)v102 ) { case 1: - pSoundList->_4A9A67(58, 0); + pSoundList->LoadSound(58, 0); v108 = 0; v107 = 97; break; case 2: - pSoundList->_4A9A67(52, 0); + pSoundList->LoadSound(52, 0); v108 = 0; v107 = 91; break; case 3: - pSoundList->_4A9A67(51, 0); + pSoundList->LoadSound(51, 0); v108 = 0; v107 = 90; break; case 5: - pSoundList->_4A9A67(62, 0); + pSoundList->LoadSound(62, 0); v108 = 0; v107 = 101; break; case 6: - pSoundList->_4A9A67(49, 0); + pSoundList->LoadSound(49, 0); v108 = 0; v107 = 88; break; default: if ( *(short *)v102 != 7 ) goto LABEL_175; - pSoundList->_4A9A67(61, 0); + pSoundList->LoadSound(61, 0); v108 = 0; v107 = 100; break; @@ -2338,11 +2338,11 @@ } else { - pSoundList->_4A9A67(54, 0); + pSoundList->LoadSound(54, 0); v108 = 0; v107 = 93; } - pSoundList->_4A9A67(v107, v108); + pSoundList->LoadSound(v107, v108); LABEL_175: v102 += 4; --thisa; @@ -2687,7 +2687,7 @@ v4 = pDecorationList->pDecorations[decor->uDecorationDescID].uSoundID; if ( v4 && _6807E0_num_decorations_with_sounds_6807B8 < 9 ) { - pSoundList->_4A9A67(v4, 0); + pSoundList->LoadSound(v4, 0); v5 = _6807E0_num_decorations_with_sounds_6807B8++; _6807B8_level_decorations_ids[v5] = i; } diff -r f87034a41fb8 -r dd1e818a6b4c Player.cpp --- a/Player.cpp Wed Dec 19 09:35:53 2012 +0600 +++ b/Player.cpp Wed Dec 19 09:36:10 2012 +0600 @@ -628,15 +628,7 @@ + 4998; v12 = 8 * v22 + 312; LOBYTE(v12) = v12 | 4; - pAudioPlayer->PlaySound( - (SoundID)v23, - v12, - 0, - -1, - 0, - 0, - (signed __int64)(pSoundVolumeLevels[(char)uVoicesVolumeMultiplier] * 128.0), - 0); + pAudioPlayer->PlaySound((SoundID)v23, v12, 0, -1, 0, 0, (signed __int64)(pSoundVolumeLevels[(char)uVoicesVolumeMultiplier] * 128.0), 0); } } } diff -r f87034a41fb8 -r dd1e818a6b4c Render.cpp --- a/Render.cpp Wed Dec 19 09:35:53 2012 +0600 +++ b/Render.cpp Wed Dec 19 09:36:10 2012 +0600 @@ -1024,6 +1024,7 @@ int v125; // [sp+6Ch] [bp-8h]@9 float v126; // [sp+70h] [bp-4h]@9 + memset(&v102, 0, sizeof(v102)); v105 = pIndoorCamera->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2); v0 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCamera->sRotationY); v1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + v0); @@ -1838,7 +1839,7 @@ v5 = abs(X); v6 = abs(v83); --X; - v93 = &stru_76E5C8[v5 << 7] + v6; + v93 = &stru_76E5C8[(v5 << 7) + v6]; if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), ((a8 = v9, diff -r f87034a41fb8 -r dd1e818a6b4c mm7_2.cpp --- a/mm7_2.cpp Wed Dec 19 09:35:53 2012 +0600 +++ b/mm7_2.cpp Wed Dec 19 09:36:10 2012 +0600 @@ -3390,14 +3390,14 @@ ya = 4; do { - pSoundList->_4A9A67((signed __int16)*v11, 0); + pSoundList->LoadSound((signed __int16)*v11, 0); ++v11; --ya; } while ( ya ); v12 = 0; do - LOWORD(v13) = pSoundList->_4A9A67(v12++ + word_4EE088_sound_ids[v9->uSpell1ID], 1u); + LOWORD(v13) = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[v9->uSpell1ID], 1u); while ( v13 ); ++uNumActors; } @@ -11888,14 +11888,14 @@ auto v11 = &pMonsterList->pMonsters[v9]; do { - pSoundList->_4A9A67(v11->pSoundSampleIDs[4 - v18], 0); + pSoundList->LoadSound(v11->pSoundSampleIDs[4 - v18], 0); //v11 = (int *)((char *)v11 + 2); --v18; } while ( v18 ); v12 = 0; do - v13 = pSoundList->_4A9A67(v12++ + word_4EE088_sound_ids[v10->uSpell1ID], 1); + v13 = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[v10->uSpell1ID], 1); while ( v13 ); ++_v0; } diff -r f87034a41fb8 -r dd1e818a6b4c mm7_3.cpp --- a/mm7_3.cpp Wed Dec 19 09:35:53 2012 +0600 +++ b/mm7_3.cpp Wed Dec 19 09:36:10 2012 +0600 @@ -15409,7 +15409,7 @@ if (_evt->v4 == 3) { - pSoundList->_4A9A67( + pSoundList->LoadSound( _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8), 0); diff -r f87034a41fb8 -r dd1e818a6b4c mm7_4.cpp --- a/mm7_4.cpp Wed Dec 19 09:35:53 2012 +0600 +++ b/mm7_4.cpp Wed Dec 19 09:36:10 2012 +0600 @@ -2924,8 +2924,8 @@ if (byte_4ED498) for (uint i = 0; i < 4; ++i) { - pSoundList->_4A9A67(2 * (byte_4ED498 + 50 * pParty->pPlayers[i].uVoiceID) + 4998, 0); - pSoundList->_4A9A67(2 * (byte_4ED498 + 50 * pParty->pPlayers[i].uVoiceID) + 4999, 0); + pSoundList->LoadSound(2 * (byte_4ED498 + 50 * pParty->pPlayers[i].uVoiceID) + 4998, 0); + pSoundList->LoadSound(2 * (byte_4ED498 + 50 * pParty->pPlayers[i].uVoiceID) + 4999, 0); } } diff -r f87034a41fb8 -r dd1e818a6b4c mm7_5.cpp --- a/mm7_5.cpp Wed Dec 19 09:35:53 2012 +0600 +++ b/mm7_5.cpp Wed Dec 19 09:36:10 2012 +0600 @@ -3378,11 +3378,11 @@ signed int v4; // eax@29 int v5; // ecx@29 enum PLAYER_SKILL_TYPE v6; // edi@37 - GUIWindow *v7; // eax@56 + GUIWindow *pWindow; // eax@56 unsigned int v8; // edx@56 - Player *v9; // edi@57 + Player *pCurrentPlayer; // edi@57 signed int v10; // eax@58 - GUIButton *v11; // eax@59 + GUIButton *pButton; // eax@59 unsigned __int8 v12; // sf@62 signed int v13; // eax@64 unsigned int v14; // eax@66 @@ -3413,7 +3413,7 @@ int v43; // [sp-10h] [bp-20h]@56 int uNum; // [sp+4h] [bp-Ch]@3 UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3 - int v46; // [sp+Ch] [bp-4h]@3 + int pSex; // [sp+Ch] [bp-4h]@3 Player *pPlayer; if ( pMessageQueue_50CBD0->uNumMessages ) @@ -3423,7 +3423,7 @@ pPlayer = pParty->pPlayers; do { - pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, &v46); + pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, &pSex); switch (pUIMessageType) { case UIMSG_MainMenu_ShowPartyCreationWnd: @@ -3432,39 +3432,32 @@ SetCurrentMenuID(MENU_NEWGAME); } continue; - case UIMSG_MainMenu_ShowLoadWindow: { GUIWindow::Create(495, 227, 0, 0, WINDOW_5A, (int)pMainMenu_BtnLoad, 0); SetCurrentMenuID(MENU_SAVELOAD); } continue; - case UIMSG_ShowCredits: { GUIWindow::Create(495, 282, 0, 0, WINDOW_5A, (int)pMainMenu_BtnCredits, 0); SetCurrentMenuID(MENU_CREDITS); } continue; - case UIMSG_ExitToWindows: { GUIWindow::Create(495, 337, 0, 0, WINDOW_5A, (int)pMainMenu_BtnExit, 0); SetCurrentMenuID(MENU_FINISHED); } continue; - case UIMSG_LoadGame: { if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) continue; - SetCurrentMenuID(MENU_LOAD); } continue; } - - switch (pUIMessageType) { case UIMSG_A5: // WINDOW_5A @@ -3493,15 +3486,12 @@ } } continue; - - case UIMSG_A4: { GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_5E, (int)ptr_69BD64, 0); } continue; } - if ( (signed int)pUIMessageType > UIMSG_PlayerCreationRemoveDownSkill ) { if ( pUIMessageType > UIMSG_A3 ) @@ -3580,7 +3570,7 @@ dword_6A0C9C = uNum - 1; if ( dword_6A0C9C < 1 ) dword_6A0C9C = 0; - v7 = pGUIWindow_CurrentMenu; + pWindow = pGUIWindow_CurrentMenu; v43 = 0; v39 = (int)ptr_69BD58; v8 = pGUIWindow_CurrentMenu->uFrameY + 323; @@ -3680,49 +3670,41 @@ pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; uPlayerCreationUI_SelectedCharacter = uNum; -LABEL_36: - v42 = 0; - v38 = 0; - v36 = 0; - v34 = 0; - v32 = -1; - v31 = 0; - v30 = 0; - pSoundID = (SoundID)66; -LABEL_40: - pAudioPlayer->PlaySound(pSoundID, v30, v31, v32, v34, v36, v38, v42); + pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); continue; } if ( pUIMessageType == UIMSG_PlayerCreationVoiceBack ) { - v9 = &pPlayer[uNum]; - v46 = v9->GetSexByVoice(); + pCurrentPlayer = &pPlayer[uNum]; + pSex = pCurrentPlayer->GetSexByVoice(); do { - v12 = ((v9->uVoiceID-- - 1) & 0x80000000u) != 0; + v12 = ((pCurrentPlayer->uVoiceID-- - 1) & 0x80000000u) != 0; if ( v12 ) - v9->uVoiceID = 19; - v13 = v9->GetSexByVoice(); - } - while ( v13 != v46 ); - v11 = pCreationUI_BtnPressLeft2[uNum]; - goto LABEL_60; + pCurrentPlayer->uVoiceID = 19; + v13 = pCurrentPlayer->GetSexByVoice(); + } + while ( v13 != pSex ); + pButton = pCreationUI_BtnPressLeft2[uNum]; + GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, (enum WindowType)92, (int)pButton, 1); + pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); + pCurrentPlayer->PlaySound(102, 0); + continue; } if ( pUIMessageType == UIMSG_PlayerCreationVoiceForward ) { - v9 = &pPlayer[uNum]; - v46 = v9->GetSexByVoice(); + pCurrentPlayer = &pPlayer[uNum]; + pSex = pCurrentPlayer->GetSexByVoice(); do { - v9->uVoiceID = (signed int)(v9->uVoiceID + 1) % 20; - v10 = v9->GetSexByVoice(); - } - while ( v10 != v46 ); - v11 = pCreationUI_BtnPressRight2[uNum]; -LABEL_60: - GUIWindow::Create(v11->uX, v11->uY, 0, 0, (enum WindowType)92, (int)v11, 1); + pCurrentPlayer->uVoiceID = (signed int)(pCurrentPlayer->uVoiceID + 1) % 20; + v10 = pCurrentPlayer->GetSexByVoice(); + } + while ( v10 != pSex ); + pButton = pCreationUI_BtnPressRight2[uNum]; + GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, (enum WindowType)92, (int)pButton, 1); pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); - v9->PlaySound(102, 0); + pCurrentPlayer->PlaySound(102, 0); continue; } if ( pUIMessageType == UIMSG_A2 ) @@ -3730,12 +3712,12 @@ --dword_6A0C9C; if ( dword_6A0C9C < 0 ) dword_6A0C9C = 0; - v7 = pGUIWindow_CurrentMenu; + pWindow = pGUIWindow_CurrentMenu; v43 = 0; v39 = (int)ptr_69BD5C; v8 = pGUIWindow_CurrentMenu->uFrameY + 197; LABEL_105: - GUIWindow::Create(v7->uFrameX + 215, v8, 0, 0, (WindowType)90, v39, v43); + GUIWindow::Create(pWindow->uFrameX + 215, v8, 0, 0, (WindowType)90, v39, v43); continue; } } @@ -3749,7 +3731,10 @@ v1 = (char *)pParty->pPlayers; v5 = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; - goto LABEL_44; + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; + pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) + + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; + continue; } if ( (signed int)pUIMessageType > UIMSG_3C ) { @@ -3758,30 +3743,16 @@ GUIWindow::Create(613, 393, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnPlus, 1); (&pPlayer[uPlayerCreationUI_SelectedCharacter])->IncreaseAttribute( (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); - v42 = 0; - v38 = 0; - v36 = 0; - v34 = 0; - v32 = -1; - v31 = 0; - v30 = 0; - pSoundID = (SoundID)20; - goto LABEL_40; + pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0); + continue; } if ( pUIMessageType == UIMSG_PlayerCreationClickMinus ) { GUIWindow::Create(523, 393, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnMinus, 1); (&pPlayer[uPlayerCreationUI_SelectedCharacter])->DecreaseAttribute( (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); - v42 = 0; - v38 = 0; - v36 = 0; - v34 = 0; - v32 = -1; - v31 = 0; - v30 = 0; - pSoundID = (SoundID)23; - goto LABEL_40; + pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0); + continue; } if ( pUIMessageType == UIMSG_PlayerCreationSelectActiveSkill ) { @@ -3789,20 +3760,14 @@ v6 = _t->GetSkillIdxByOrder(uNum + 4); if ( _t->GetSkillIdxByOrder(3) == 37 ) pParty->pPlayers[0].pActiveSkills[v6 + 3486 * uPlayerCreationUI_SelectedCharacter] = 1; - v42 = 0; - v38 = 0; - v36 = 0; - v34 = 0; - v32 = -1; - v31 = 0; - v30 = 0; - pSoundID = (SoundID)24; - goto LABEL_40; + pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); + continue; } if ( pUIMessageType == UIMSG_PlayerCreationSelectClass ) { (&pPlayer[uPlayerCreationUI_SelectedCharacter])->Reset(uNum); - goto LABEL_36; + pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); + continue; } if ( pUIMessageType == UIMSG_PlayerCreationClickOK ) { @@ -3824,10 +3789,9 @@ { uPlayerCreationUI_SelectedCharacter = uNum; v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; - v46 = pGUIWindow_CurrentMenu->pStartingPosActiveItem; + pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem; v41 = 2; - v5 = v4 % 7 + v46 + 7 * uNum; -LABEL_44: + v5 = v4 % 7 + pSex + 7 * uNum; pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; @@ -15794,11 +15758,11 @@ enum PLAYER_SKILL_TYPE v18; // eax@98 char *pStr2; // eax@99 unsigned int v20; // eax@108 - unsigned int v21; // eax@109 - const char *v22; // eax@111 - char *v23; // ebx@112 - char *v24; // edx@113 - unsigned int v25; // eax@113 + unsigned int pSkillId; // eax@109 + const char *pSkillInfo; // eax@111 + //char *v23; // ebx@112 + char *pHint; // edx@113 + unsigned int pColor; // eax@113 GUIWindow pWindow; // [sp+4h] [bp-74h]@32 double v27; // [sp+58h] [bp-20h]@33 struct tagPOINT Point; // [sp+60h] [bp-18h]@6 @@ -16045,11 +16009,6 @@ goto LABEL_132; } pWindow.Hint = 0; - pButton = pGUIWindow_CurrentMenu->pControlsHead; - if ( !pButton ) - goto LABEL_132; - v13 = pY; - //pStr = v29; pStr = 0; for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) { @@ -16057,7 +16016,7 @@ && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) { pControlID = pButton->uControlID; - switch (pControlID) + switch ( pControlID ) { case 0: //stats info pWindow.Hint = pAttributeDescriptions[(signed int)pButton->uControlParam % 7]; @@ -16065,65 +16024,57 @@ break; case 62: //Plus button info pStr = pGlobalTXT_LocalizationStrings[670];// - pStr2 = pGlobalTXT_LocalizationStrings[671];//" , " - pWindow.Hint = pStr2; + pWindow.Hint = pGlobalTXT_LocalizationStrings[671];//" , " break; case 63: //Minus button info pStr = pGlobalTXT_LocalizationStrings[668];// - pStr2 = pGlobalTXT_LocalizationStrings[669];//" , " - pWindow.Hint = pStr2; + pWindow.Hint = pGlobalTXT_LocalizationStrings[669];//" , " break; case 64: //Available skill button info v18 = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->uControlParam + 4); pStr = pSkillNames[v18]; pWindow.Hint = pSkillDesc[v18]; - v13 = pY; break; case 65: //Available Class Info pWindow.Hint = pClassDescriptions[pButton->uControlParam]; pStr = pClassNames[pButton->uControlParam]; break; case 66: //OK Info - pStr2 = pGlobalTXT_LocalizationStrings[664];// . + pWindow.Hint = pGlobalTXT_LocalizationStrings[664];// . pStr = pGlobalTXT_LocalizationStrings[665];// - pWindow.Hint = pStr2; - break; + break; case 67: //Clear info - pStr2 = pGlobalTXT_LocalizationStrings[666];// . + pWindow.Hint = pGlobalTXT_LocalizationStrings[666];// . pStr = pGlobalTXT_LocalizationStrings[667];// - pWindow.Hint = pStr2; break; case 118: // Character info - v20 = pButton->uControlParam; - pStr = pParty->pPlayers[v20].pName; - pStr2 = pClassDescriptions[pParty->pPlayers[v20].uClass]; - pWindow.Hint = pStr2; + pStr = pParty->pPlayers[pButton->uControlParam].pName; + pWindow.Hint = pClassDescriptions[pParty->pPlayers[pButton->uControlParam].uClass]; break; } if ( pControlID > 68 && pControlID <= 75 ) //Sellected skills info { - v21 = pParty->pPlayers[pButton->uControlParam].GetSkillIdxByOrder(pControlID - 72); - pY = v21; - if ( (v21 & 0x80000000u) == 0 || (signed int)v21 < 37 ) - { - v22 = CharacterUI_GetSkillDescText(pButton->uControlParam, (enum PLAYER_SKILL_TYPE)v21); - strcpy(pTmpBuf2, v22); + pSkillId = pParty->pPlayers[pButton->uControlParam].GetSkillIdxByOrder(pControlID - 72); + pY = 0; + if ( (signed int)pSkillId < 37 ) + { + pSkillInfo = CharacterUI_GetSkillDescText(pButton->uControlParam, (enum PLAYER_SKILL_TYPE)pSkillId); + strcpy(pTmpBuf2, pSkillInfo); pWindow.Hint = pTmpBuf2; - pStr = pSkillNames[pY]; + pStr = pSkillNames[pSkillId]; } } } } - v23 = pWindow.Hint; if ( pWindow.Hint ) { - v24 = pWindow.Hint; + pHint = pWindow.Hint; pWindow.Hint = 0; pWindow.uFrameWidth = 384; pWindow.uFrameHeight = 256; pWindow.uFrameX = 128; pWindow.uFrameY = 40; - pWindow.uFrameHeight = pFontSmallnum->CalcTextHeight(v24, &pWindow, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; + pWindow.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &pWindow, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; pWindow.DrawMessageBox(0); @@ -16133,10 +16084,10 @@ pWindow.uFrameHeight -= 12; pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; - v25 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0x9B); - sprintf(pTmpBuf, pStr, v25, format_4E2D80);//sprintfex - sprintfex(pTmpBuf, format_4E2D80, v25, pStr) + pColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0x9B); + sprintf(pTmpBuf, pStr, pColor, format_4E2D80);//sprintfex - sprintfex(pTmpBuf, format_4E2D80, v25, pStr) pWindow.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3); - pWindow.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v23, 0, 0, 0); + pWindow.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, pHint, 0, 0, 0); } LABEL_132: dword_507BF0_is_there_popup_onscreen = 1;