Mercurial > mm7
changeset 187:49728858c35e
On player voices
author | Nomad |
---|---|
date | Fri, 15 Feb 2013 22:38:05 +0200 |
parents | d65528fc3bda |
children | 207b2492e14b |
files | Actor.cpp AudioPlayer.h GUIWindow.h Game.cpp LayingItem.cpp LayingItem.h MM7.h Outdoor.cpp Player.cpp Player.h mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp mm7_data.cpp mm7_data.h |
diffstat | 18 files changed, 429 insertions(+), 322 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Fri Feb 15 19:53:40 2013 +0200 +++ b/Actor.cpp Fri Feb 15 22:38:05 2013 +0200 @@ -155,9 +155,9 @@ int v10; // eax@11 GUIWindow *v11; // ecx@19 signed int v12; // eax@21 - int v13; // [sp-8h] [bp-44h]@34 + //int v13; // [sp-8h] [bp-44h]@34 const char *v14; // [sp-4h] [bp-40h]@4 - int v15; // [sp-4h] [bp-40h]@34 + //int v15; // [sp-4h] [bp-40h]@34 signed int v16; // [sp-4h] [bp-40h]@35 int v17; // [sp+10h] [bp-2Ch]@1 char pContainer[32]; // [sp+14h] [bp-28h]@3 @@ -271,17 +271,11 @@ pDialogueWindow->CreateButton(407u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); if ( v17 && uActiveCharacter && !(v5->uFlags & 0x80) ) { - if ( pParty->uCurrentHour < 5 || pParty->uCurrentHour > 0x15 ) - { - v15 = 0; - v13 = 23; - } + __debugbreak(); // find out what's the speech + if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_23, 0); else - { - v15 = 0; - v13 = 22; - } - pPlayers[uActiveCharacter]->PlaySound(v13, v15); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_22, 0); } }
--- a/AudioPlayer.h Fri Feb 15 19:53:40 2013 +0200 +++ b/AudioPlayer.h Fri Feb 15 22:38:05 2013 +0200 @@ -77,6 +77,7 @@ SOUND_EnteringAHouse = 0x6, SOUND_8 = 0x8, SOUND_27 = 0x1B, + SOUND_Button = 66, SOUND_Arcomage_LoseResources = 0x78, SOUND_Arcomage_AddResources = 0x79, SOUND_Arcomage_TowerWallDamage = 0x7A,
--- a/GUIWindow.h Fri Feb 15 19:53:40 2013 +0200 +++ b/GUIWindow.h Fri Feb 15 22:38:05 2013 +0200 @@ -67,7 +67,7 @@ WINDOW_59 = 0x59, WINDOW_5A = 0x5A, WINDOW_5B = 0x5B, - WINDOW_5C = 0x5C, + WINDOW_VoiceSwitcherButton = 0x5C, WINDOW_5D = 0x5D, WINDOW_5E = 0x5E, WINDOW_5F = 0x5F, @@ -207,7 +207,7 @@ UIMSG_73 = 0x73, UIMSG_74 = 0x74, UIMSG_75 = 0x75, - UIMSG_PlayerCreationSelectQuality = 0x76, + UIMSG_PlayerCreation_SelectAttribute = 0x76, UIMSG_InventoryLeftClick = 0x78, UIMSG_SkillUp = 0x79, UIMSG_7A = 0x7A, @@ -227,8 +227,8 @@ UIMSG_8D = 0x8D, UIMSG_8E = 0x8E, UIMSG_8F = 0x8F, - UIMSG_PlayerCreationVoiceBack = 0x90, - UIMSG_PlayerCreationVoiceForward = 0x91, + UIMSG_PlayerCreation_VoicePrev = 0x90, + UIMSG_PlayerCreation_VoiceNext = 0x91, UIMSG_92 = 0x92, UIMSG_StartNPCDialogue = 0xA1, UIMSG_ArrowUp = 0xA2, @@ -240,8 +240,8 @@ UIMSG_A8 = 0xA8, UIMSG_A9 = 0xA9, UIMSG_AA = 0xAA, - UIMSG_SelectFacePlayerBack = 0xAB, - UIMSG_SelectFacePlayerForward = 0xAC, + UIMSG_PlayerCreation_FacePrev = 0xAB, + UIMSG_PlayerCreation_FaceNext = 0xAC, UIMSG_AD = 0xAD, UIMSG_AE = 0xAE, UIMSG_AF = 0xAF,
--- a/Game.cpp Fri Feb 15 19:53:40 2013 +0200 +++ b/Game.cpp Fri Feb 15 22:38:05 2013 +0200 @@ -470,7 +470,7 @@ if ( v11 ) { v12 = rand(); - pPlayers[v17[v12 % v11]]->PlaySound(99, 0); + pPlayers[v17[v12 % v11]]->PlaySound(SPEECH_99, 0); } ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2u);// "Once again you've cheated death!.." "Вы снова обхитрили смерть! …" uGameState = 0;
--- a/LayingItem.cpp Fri Feb 15 19:53:40 2013 +0200 +++ b/LayingItem.cpp Fri Feb 15 22:38:05 2013 +0200 @@ -13,7 +13,7 @@ //----- (00438E35) -------------------------------------------------------- -__int16 LayingItem::_438E35() +void LayingItem::_438E35() { LayingItem *v1; // edi@1 MapInfo *pMapInfo; // esi@1 @@ -85,9 +85,9 @@ v18 = 2; break; default: - LOWORD(v10) = v1->uItemType - 814; + //LOWORD(v10) = v1->uItemType - 814; if ( v1->uItemType != 814 ) - return v10; + return; v18 = 8; break; } @@ -95,14 +95,13 @@ do { if ( (*v12)->CanAct() && (v13 = (*v12)->GetPerception() + 20, rand() % v13 > 20) ) - LOWORD(v10) = (*v12)->PlaySound(6, 0); + (*v12)->PlaySound(SPEECH_6, 0); else - LOWORD(v10) = (*v12)->ReceiveDamage(v11, v18); + (*v12)->ReceiveDamage(v11, v18); ++v12; } while ( (signed int)v12 <= (signed int)&pPlayers[4] ); } - return v10; }
--- a/LayingItem.h Fri Feb 15 19:53:40 2013 +0200 +++ b/LayingItem.h Fri Feb 15 22:38:05 2013 +0200 @@ -10,7 +10,7 @@ LayingItem(); int Create(int yaw, int pitch, int a4, int a5); void _46BEF1_apply_spells(); - __int16 _438E35(); + void _438E35(); static void UpdateObject_fn0_BLV(unsigned int uLayingItemID); static void UpdateObject_fn0_ODM(unsigned int uLayingItemID);
--- a/MM7.h Fri Feb 15 19:53:40 2013 +0200 +++ b/MM7.h Fri Feb 15 22:38:05 2013 +0200 @@ -225,15 +225,6 @@ -/* 301 */ -enum PlayerSpeech -{ - SPEECH_Yell = 0x41, -}; - - - -
--- a/Outdoor.cpp Fri Feb 15 19:53:40 2013 +0200 +++ b/Outdoor.cpp Fri Feb 15 22:38:05 2013 +0200 @@ -2009,8 +2009,7 @@ header.pMagic[2] != 'i' || header.pMagic[3] != 'i' ) { - MessageBoxW(nullptr, L"Can't load file!", - L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:746", 0); + MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:746", 0); Str2 = (char *)1; } //v74 = 0;
--- a/Player.cpp Fri Feb 15 19:53:40 2013 +0200 +++ b/Player.cpp Fri Feb 15 22:38:05 2013 +0200 @@ -1,5 +1,6 @@ +#include <assert.h> + #include "OSAPI.h" - #include "Player.h" #include "PlayerFrameTable.h" #include "Texture.h" @@ -569,43 +570,44 @@ } //----- (004948B1) -------------------------------------------------------- -__int16 Player::PlaySound(int a2, int a3) -{ - Player *pPlayer; // edi@1 - int v4; // eax@4 +void Player::PlaySound(PlayerSpeech speech, int a3) +{ + //Player *pPlayer; // edi@1 + //int v4; // eax@4 signed int v5; // esi@4 - short *v6; // ebx@4 + char *v6; // ebx@4 signed int v7; // ecx@5 unsigned __int8 v8; // al@6 int v9; // eax@10 - unsigned int pVoiceID; // ecx@10 + //unsigned int pVoiceID; // ecx@10 int v11; // esi@10 signed int v12; // eax@11 signed int v13; // esi@12 int v14; // eax@12 - int v15; // eax@17 + //int v15; // eax@17 int pExpression; // ebx@17 signed int v17; // ecx@19 char *pSoundID; // edi@20 int v20[5]; // [sp+Ch] [bp-1Ch]@7 - Player *pPlayer2; // [sp+20h] [bp-8h]@1 + //Player *pPlayer2; // [sp+20h] [bp-8h]@1 int pPlayerNum; // [sp+24h] [bp-4h]@1 int pSoundId; // [sp+30h] [bp+8h]@4 - pPlayer = this; - pPlayer2 = this; + //pPlayer = this; + //pPlayer2 = this; + pPlayerNum = 1; - do - { - if ( this == pPlayers[pPlayerNum] ) + for (int i = 0; i < 4; ++i) + if (&pParty->pPlayers[i] == this) + { + pPlayerNum = i + 1; break; - ++pPlayerNum; - } - while ( pPlayerNum <= 4 ); - v4 = a2;//102 + } + + //v4 = a2;//102 v5 = 0; pSoundId = 0; - v6 = &SoundSetAction[8 * v4];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? + v6 = (char *)&SoundSetAction[4 * speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? if ( uVoicesVolumeMultiplier ) { v7 = 0; @@ -620,15 +622,15 @@ if ( v5 ) { v9 = rand(); - pVoiceID = pPlayer->uVoiceID; + //pVoiceID = uVoiceID; v11 = v20[v9 % v5]; - if ( LOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[pVoiceID]) ) - { - pSoundId = rand() % SLOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[pVoiceID]) - + 2 * (v11 + 50 * pPlayer2->uVoiceID) + if ( LOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[uVoiceID]) ) + { + pSoundId = rand() % SLOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[uVoiceID]) + + 2 * (v11 + 50 * uVoiceID) + 4998; v12 = 8 * pPlayerNum + 312; - LOBYTE(v12) = v12 | 4; + LOBYTE(v12) = v12 | OBJECT_Player; pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, (pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0), 0); } } @@ -644,9 +646,8 @@ while ( -3 - (signed int)v6 + v14 < 5 ); if ( v13 ) { - v15 = rand(); pPlayerNum = 0; - pExpression = v20[v15 % v13]; + pExpression = v20[rand() % v13]; if ( pExpression == 21 && pSoundId ) { v17 = 0; @@ -669,26 +670,27 @@ if ( pSoundList->pSounds[v17].pSoundData[0] ) pPlayerNum = (sLastTrackLengthMS << 7) / 1000; } - LOWORD(v14) = pPlayer2->PlayEmotion((CHARACTER_EXPRESSION_ID)pExpression, pPlayerNum); - } - return v14; + /*LOWORD(v14) = */PlayEmotion((CHARACTER_EXPRESSION_ID)pExpression, pPlayerNum); + } + //return v14; } // 4948B1: using guessed type int var_1C[5]; //----- (00494A25) -------------------------------------------------------- -__int16 Player::PlayEmotion(CHARACTER_EXPRESSION_ID expr, int a3) -{ - signed int v3; // eax@1 - CHARACTER_EXPRESSION_ID v4; // dx@1 +void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) +{ + //signed int v3; // eax@1 + //CHARACTER_EXPRESSION_ID v4; // dx@1 signed int v5; // edi@15 PlayerFrame *v6; // esi@17 signed int v7; // eax@20 - LOWORD(v3) = this->expression; - v4 = expr; - if ( (short)v3 != 4 && (short)v3 != 12 || expr != 58 ) - { - v3 = (unsigned __int16)v3; + //LOWORD(v3) = this->expression; + //v4 = expr; + if (expression != CHARACTER_EXPRESSION_SLEEP && + expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) + { + int v3 = (unsigned)expression; if ( (signed int)(unsigned __int16)v3 >= 2 ) { if ( v3 <= 7 ) @@ -697,19 +699,19 @@ { if ( v3 > 11 ) { - if ( v3 == 12 || v3 > 97 && v3 <= 99 ) - return v3; + if ( v3 == CHARACTER_EXPRESSION_PERTIFIED || v3 > 97 && v3 <= 99 ) + return; goto LABEL_15; } LABEL_12: - if ( expr != 34 && expr != 35 && expr != 36 ) - return v3; + if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) + return; goto LABEL_15; } } } LABEL_15: - LOWORD(v3) = a3; + //LOWORD(v3) = a3; v5 = 0; this->uExpressionTimeLength = a3; this->uExpressionTimePassed = 0; @@ -723,7 +725,7 @@ else { v6 = pPlayerFrameTable->pFrames; - while ( v6->expression != expr ) + while ( v6->expression != new_expression ) { ++v5; ++v6; @@ -732,13 +734,11 @@ } v7 = v5; } - v4 = expr; - LOWORD(v3) = 8 * pPlayerFrameTable->pFrames[v3].uAnimLength; - this->uExpressionTimeLength = v3; - } - this->expression = v4; + //v4 = expr; + this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; + } + expression = new_expression; viewparams->bRedrawGameUI = 1; - return v3; } //----- (0049327B) -------------------------------------------------------- @@ -1237,7 +1237,7 @@ goto LABEL_76; goto LABEL_82; case 0xDu: - v3->PlaySound(32, 0); + v3->PlaySound(SPEECH_32, 0); v13 = (char *)&v3->sHealth; goto LABEL_70; case 0xEu: @@ -1268,9 +1268,9 @@ goto LABEL_76; } v28 = 0; - v25 = 35; + v25 = SPEECH_35; LABEL_67: - v3->PlaySound(v25, v28); + v3->PlaySound((PlayerSpeech)v25, v28); if ( v3->sHealth > 0 ) v3->sHealth = 0; v13 = (char *)&v3->sMana; @@ -1295,7 +1295,7 @@ if ( v30 == 2 ) { if ( v31 == 1 ) - pPlayers[v21]->PlaySound(107, 0); + pPlayers[v21]->PlaySound(SPEECH_107, 0); } result = 1; break; @@ -1345,11 +1345,11 @@ } v26 = 0; v20 = (v18 != 0) + 23; - v23 = 99; + v23 = SPEECH_99; v3->uFace = v20; v3->uVoiceID = v20; LABEL_81: - v3->PlaySound(v23, v26); + v3->PlaySound((PlayerSpeech)v23, v26); goto LABEL_82; default: goto LABEL_82; @@ -1462,7 +1462,7 @@ if ( v12 == -1 ) { if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(15, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_15, 0); result = 0; } else @@ -2390,7 +2390,7 @@ memcpy(&v9->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5], pItem, 0x24u); pItem->Reset(); pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); - v19->PlaySound(60, 0); + v19->PlaySound(SPEECH_60, 0); if ( !v21 ) { v7->Release(); @@ -3666,13 +3666,13 @@ unsigned int v7; // eax@8 char *v8; // ecx@9 int v9; // eax@9 - signed int typea; // [sp+14h] [bp+8h]@1 + //signed int typea; // [sp+14h] [bp+8h]@1 v3 = this; this->pConditions[2] = 0i64; v4 = CalculateIncommingDamage(resistance, type); v3->sHealth -= v4; - typea = v4; + //typea = v4; v5 = v3->sHealth; v6 = v5 < -10; LOBYTE(v6) = v5 <= -10; @@ -3705,9 +3705,9 @@ } } } - if ( typea && CanAct() ) - PlaySound(24, 0); - return typea; + if ( v4 && CanAct() ) + PlaySound(SPEECH_24, 0); + return v4; } //----- (0048DCF6) -------------------------------------------------------- @@ -4018,11 +4018,11 @@ v26 = v48; if ( *(char *)(v48 + 21) & 2 ) goto LABEL_84; - PlaySound(40, 0); + PlaySound(SPEECH_40, 0); *(int *)(v26 + 20) |= 2u; goto LABEL_79; case 20: - PlaySound(40, 0); + PlaySound(SPEECH_40, 0); v27 = pActor->array_000234; if ( pActor->array_000234[0].uItemID ) { @@ -4044,11 +4044,11 @@ v30 = (SoundID)47; goto LABEL_83; case 21: - PlaySound(42, 0); + PlaySound(SPEECH_42, 0); ++v5->sAgeModifier; goto LABEL_82; case 22: - PlaySound(41, 0); + PlaySound(SPEECH_41, 0); v5->sMana = 0; LABEL_82: v42 = 0; @@ -6407,7 +6407,7 @@ } //----- (00490141) -------------------------------------------------------- -int Player::GetSexByVoice() +PLAYER_SEX Player::GetSexByVoice() { signed int result; // eax@1 @@ -6426,8 +6426,8 @@ case 0x11u: case 0x14u: case 0x17u: - result = 0; - break; + return SEX_MALE; + case 4u: case 5u: case 6u: @@ -6440,12 +6440,11 @@ case 0x13u: case 0x15u: case 0x18u: - result = 1; - break; + return SEX_FEMALE; + default: - return result; - } - return result; + assert(false); + } } //----- (00490188) -------------------------------------------------------- @@ -7006,7 +7005,7 @@ pParty->pPlayers[a2-1].Heal(v69);//((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->Heal(v69); } LABEL_112: - v3->PlaySound(36, 0); + v3->PlaySound(SPEECH_36, 0); goto LABEL_173; } LABEL_172: @@ -7448,7 +7447,7 @@ ShowStatusBarString(pTmpBuf, 2u); pMouse->RemoveHoldingItem(); pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); - v3->PlaySound(93, 0); + v3->PlaySound(SPEECH_93, 0); pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) { @@ -7551,9 +7550,9 @@ { sub_467F48(pParty->pPickedItem.uItemID); v65 = 0; - v56 = 37; + v56 = SPEECH_37; LABEL_67: - v3->PlaySound(v56, v65); + v3->PlaySound((PlayerSpeech)v56, v65); return; } LABEL_89: @@ -7623,7 +7622,7 @@ goto LABEL_67; } *v72 = 1; - v3->PlaySound(21, 0); + v3->PlaySound(SPEECH_21, 0); v73 = 0; LABEL_173: v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; @@ -8434,7 +8433,7 @@ { v20 = pPlayers[v3 + 1]; v30 = 1; - v20->PlaySound(96, 0); + v20->PlaySound(SPEECH_96, 0); v21 = pAutonoteTxt[a3-1].eType;// dword_72371C[2 * a3]; bFlashAutonotesBook = 1; dword_506568 = v21; @@ -8505,7 +8504,7 @@ v12 = pPlayers[v3 + 1]; v30 = 1; v31 = 1; - v12->PlaySound(96, 0); + v12->PlaySound(SPEECH_96, 0); } v13 = v4->field_152; goto LABEL_51; @@ -8521,7 +8520,7 @@ bFlashQuestBook = 1; v30 = 1; v31 = 1; - v14->PlaySound(93, 0); + v14->PlaySound(SPEECH_93, 0); } v13 = (char *)pParty->_award_bits; LABEL_51: @@ -8621,11 +8620,11 @@ this->uMightBonus = (unsigned __int8)a3; LABEL_111: v28 = 0; - v26 = 91; + v26 = SPEECH_91; LABEL_112: v19 = pPlayers[v3 + 1]; v31 = 1; - v19->PlaySound(v26, v28); + v19->PlaySound((PlayerSpeech)v26, v28); goto LABEL_169; } if ( var <= VAR_FireResistanceBonus ) @@ -8934,7 +8933,7 @@ v14 = pPlayers[uPlayerIdx + 1]; v34 = 1; v3 = 1; - v14->PlaySound(96, 0); + v14->PlaySound(SPEECH_96, 0); } v15 = v4->field_152; goto LABEL_44; @@ -8954,7 +8953,7 @@ bFlashQuestBook = 1; v34 = 1; v3 = 1; - v17->PlaySound(93, 0); + v17->PlaySound(SPEECH_93, 0); } v15 = (char *)pParty->_award_bits; LABEL_44: @@ -9105,10 +9104,10 @@ if ( *v19 > 255 ) *v19 = 255; v31 = 0; - v29 = 91; + v29 = SPEECH_91; LABEL_116: v3 = 1; - pPlayers[uPlayerIdx + 1]->PlaySound(v29, v31); + pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); goto _play_anim_and_maybe_sound; } if ( var <= VAR_DisarmTrapSkill ) @@ -9217,7 +9216,7 @@ { v23 = pPlayers[uPlayerIdx + 1]; v34 = 1; - v23->PlaySound(96, 0); + v23->PlaySound(SPEECH_96, 0); v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; bFlashAutonotesBook = 1; dword_506568 = v24; @@ -9565,7 +9564,7 @@ goto LABEL_17; case VAR_QBits_QuestsDone: _449B7E_toggle_bit(pParty->_award_bits, (__int16)a3, 0); - pPlayers[v4 + 1]->PlaySound(96, 0); + pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); return; case VAR_PlayerItemInHands: v15 = (char *)this->pInventoryIndices; @@ -9688,9 +9687,9 @@ this->sResMagicBonus -= (signed __int16)a3; LABEL_72: v25 = 0; - v23 = 91; + v23 = SPEECH_91; LABEL_73: - pPlayers[v4 + 1]->PlaySound(v23, v25); + pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); goto LABEL_17; case VAR_FixedFood: Party::TakeFood((unsigned int)a3);
--- a/Player.h Fri Feb 15 19:53:40 2013 +0200 +++ b/Player.h Fri Feb 15 22:38:05 2013 +0200 @@ -6,6 +6,124 @@ + + +/* 301 */ +enum PlayerSpeech +{ + SPEECH_1 = 1, + SPEECH_2 = 2, + SPEECH_3 = 3, + SPEECH_4 = 4, + SPEECH_5 = 5, + SPEECH_6 = 6, + SPEECH_7 = 7, + SPEECH_8 = 8, + SPEECH_9 = 9, + SPEECH_10 = 10, + SPEECH_11 = 11, + SPEECH_12 = 12, + SPEECH_14 = 14, + SPEECH_15 = 15, + SPEECH_16 = 16, + SPEECH_17 = 17, + SPEECH_18 = 18, + SPEECH_19 = 19, + SPEECH_20 = 20, + SPEECH_21 = 21, + SPEECH_22 = 22, + SPEECH_23 = 23, + SPEECH_24 = 24, + SPEECH_25 = 25, + SPEECH_26 = 26, + SPEECH_27 = 27, + SPEECH_28 = 28, + SPEECH_29 = 29, + SPEECH_30 = 30, + SPEECH_31 = 31, + SPEECH_32 = 32, + SPEECH_33 = 33, + SPEECH_34 = 34, + SPEECH_35 = 35, + SPEECH_36 = 36, + SPEECH_37 = 37, + SPEECH_38 = 38, + SPEECH_39 = 39, + SPEECH_40 = 40, + SPEECH_41 = 41, + SPEECH_42 = 42, + SPEECH_43 = 43, + SPEECH_44 = 44, + SPEECH_45 = 45, + SPEECH_46 = 46, + SPEECH_47 = 47, + SPEECH_48 = 48, + SPEECH_49 = 49, + SPEECH_50 = 50, + SPEECH_51 = 51, + SPEECH_52 = 52, + SPEECH_53 = 53, + SPEECH_54 = 54, + SPEECH_55 = 55, + SPEECH_56 = 56, + SPEECH_57 = 57, + SPEECH_58 = 58, + SPEECH_59 = 59, + SPEECH_60 = 60, + SPEECH_61 = 61, + SPEECH_62 = 62, + SPEECH_63 = 63, + SPEECH_64 = 64, + SPEECH_Yell = 65, + SPEECH_66 = 66, + SPEECH_67 = 67, + SPEECH_68 = 68, + SPEECH_69 = 69, + SPEECH_70 = 70, + SPEECH_71 = 71, + SPEECH_72 = 72, + SPEECH_73 = 73, + SPEECH_74 = 74, + SPEECH_75 = 75, + SPEECH_76 = 76, + SPEECH_77 = 77, + SPEECH_78 = 78, + SPEECH_79 = 79, + SPEECH_80 = 80, + SPEECH_81 = 81, + SPEECH_82 = 82, + SPEECH_83 = 83, + SPEECH_84 = 84, + SPEECH_85 = 85, + SPEECH_86 = 86, + SPEECH_87 = 87, + SPEECH_88 = 88, + SPEECH_89 = 89, + SPEECH_90 = 90, + SPEECH_91 = 91, + SPEECH_92 = 92, + SPEECH_93 = 93, + SPEECH_94 = 94, + SPEECH_95 = 95, + SPEECH_96 = 96, + SPEECH_97 = 97, + SPEECH_98 = 98, + SPEECH_99 = 99, + SPEECH_100 = 100, + SPEECH_101 = 101, + SPEECH_PickMe = 102, + SPEECH_103 = 103, + SPEECH_104 = 104, + SPEECH_105 = 105, + SPEECH_106 = 106, + SPEECH_107 = 107, + SPEECH_108 = 108, + SPEECH_109 = 109, + SPEECH_110 = 110, +}; + + + /* 339 */ enum CHARACTER_RACE { @@ -255,6 +373,7 @@ CHARACTER_EXPRESSION_55 = 55, CHARACTER_EXPRESSION_56 = 56, CHARACTER_EXPRESSION_57 = 57, + CHARACTER_EXPRESSION_58 = 58, // ? @@ -363,7 +482,7 @@ char GetActualSkillLevel(enum PLAYER_SKILL_TYPE uSkillType); int GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2); enum CHARACTER_RACE GetRace(); - int GetSexByVoice(); + PLAYER_SEX GetSexByVoice(); void SetInitialStats(); int SetSexByVoice(); void Reset(PLAYER_CLASS_TYPE classType); @@ -397,8 +516,8 @@ bool CanEquip_RaceAndAlignmentCheck(unsigned int uItemID); int SetCondition(unsigned int uConditionIdx, int a3); int _49327B(unsigned int uClass, int a3); - __int16 PlaySound(int a2, int a3); - __int16 PlayEmotion(CHARACTER_EXPRESSION_ID expression, int a3); + void PlaySound(PlayerSpeech speech, int a3); + void PlayEmotion(CHARACTER_EXPRESSION_ID expression, int a3); char _4160CA(int a2); unsigned int GetItemIDAtInventoryIndex(int *a2); int _4B6FF9();
--- a/mm7_1.cpp Fri Feb 15 19:53:40 2013 +0200 +++ b/mm7_1.cpp Fri Feb 15 22:38:05 2013 +0200 @@ -2081,7 +2081,7 @@ pWindowList[v3].pCurrentPosActiveItem -= v12; if ( v8 ) { - pAudioPlayer->PlaySound((SoundID)66, v1, v1, -1, v1, v1, v1, v1); + pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); v2 = pMessageQueue_50CBD0->uNumMessages; } } @@ -2121,7 +2121,7 @@ pWindowList[v3].pCurrentPosActiveItem = v7; if ( v8 ) { - pAudioPlayer->PlaySound((SoundID)66, v1, v1, -1, v1, v1, v1, v1); + pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); v2 = pMessageQueue_50CBD0->uNumMessages; } } @@ -2450,13 +2450,13 @@ } else { - v83 = (char *)8; + v83 = (char *)SPEECH_8; if ( _this->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) ) - v83 = (char *)7; + v83 = (char *)SPEECH_7; } if ( dword_4E455C ) { - pPlayers[uActiveCharacter]->PlaySound((int)v83, 0); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)(int)v83, 0); dword_4E455C = 0; } } @@ -2468,14 +2468,14 @@ if ( v10 ) _this->uAttributes = _this->uAttributes & 0xFFFFFFFD | 1; v10 = (v12->uAttributes & 2) == 0; - v83 = (char *)11; + v83 = (char *)SPEECH_11; if ( v10 ) - v83 = (char *)10; + v83 = (char *)SPEECH_10; else ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2u); if ( dword_4E455C ) { - pPlayers[uActiveCharacter]->PlaySound((int)v83, 0); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)(int)v83, 0); dword_4E455C = 0; } } @@ -3263,15 +3263,15 @@ if ( v119 | v116 | i | (unsigned int)v112 ) { if ( v121->pMonsterInfo.uLevel >= v47->uLevel - 5 ) - v73 = 105; + v73 = SPEECH_105; else - v73 = 104; + v73 = SPEECH_104; } else { - v73 = 106; - } - v47->PlaySound(v73, 0); + v73 = SPEECH_106; + } + v47->PlaySound((PlayerSpeech)v73, 0); } LABEL_84: a2 = pParty->pPlayers; @@ -4089,7 +4089,7 @@ if ( v22 == v5 ) { if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(15, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_15, 0); return 0; } v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4->uItemID].pIconName, TEXTURE_16BIT_PALETTE); @@ -4519,7 +4519,7 @@ if ( *(float *)&sRotY != 0.0 ) { if ( !dword_507CD8 ) - pPlayers[uActiveCharacter]->PlaySound(4, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_4, 0); } dword_507CD8 = 0; v3 = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Chest, a4, 0); @@ -5756,7 +5756,7 @@ goto LABEL_9; v4 = pPlayers[uActiveCharacter]; } - v4->PlaySound(15, 0); + v4->PlaySound(SPEECH_15, 0); } LABEL_9: if ( !pCurrentScreen )
--- a/mm7_2.cpp Fri Feb 15 19:53:40 2013 +0200 +++ b/mm7_2.cpp Fri Feb 15 22:38:05 2013 +0200 @@ -243,7 +243,7 @@ if ( pParty->uFine < 0 ) pParty->uFine = 0; if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(81, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); v0 = ptr_507BC0; } else @@ -347,7 +347,7 @@ Party::TakeGold(v7); pParty->uNumGoldInBank += v7; if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(81, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); } v0 = ptr_507BC0; LABEL_16: @@ -743,7 +743,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(67, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); goto LABEL_43; } if ( pParty->uNumGold >= v7 ) @@ -4188,7 +4188,7 @@ Party::TakeGold(v37); dword_F8B1E4 = 1; *(short *)v38 = 1; - v35->PlaySound(78, 0); + v35->PlaySound(SPEECH_78, 0); } } } @@ -4599,7 +4599,7 @@ memcpy(&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v25 + 5], v20, 0x24u); goto LABEL_42; } - v0->PlaySound(15, 0); + v0->PlaySound(SPEECH_15, 0); v54 = 5; LABEL_70: v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" @@ -4689,12 +4689,12 @@ pRenderer->ClearZBuffer(0, 479); v27 = v77; v53 = 0; - v51 = 75; + v51 = SPEECH_75; LABEL_81: - v27->PlaySound(v51, v53); + v27->PlaySound((PlayerSpeech)v51, v53); return; } - v0->PlaySound(15, 0); + v0->PlaySound(SPEECH_15, 0); v54 = 2; goto LABEL_70; } @@ -4717,7 +4717,7 @@ v51 = 77; goto LABEL_80; } - v0->PlaySound(79, 0); + v0->PlaySound(SPEECH_79, 0); v56 = 0; v52 = 0; v50 = 0; @@ -4753,7 +4753,7 @@ dword_F8B1E4 = 1; Party::TakeGold(v80); *(int *)(v12 + 20) |= 1u; - v0->PlaySound(73, 0); + v0->PlaySound(SPEECH_73, 0); v9 = pGlobalTXT_LocalizationStrings[569]; goto LABEL_25; } @@ -4806,7 +4806,7 @@ v8 = *(int *)(v3 + 20); LOBYTE(v8) = v8 & 0xFD; *(int *)(v3 + 20) = v8 | 1; - v0->PlaySound(74, 0); + v0->PlaySound(SPEECH_74, 0); v9 = pGlobalTXT_LocalizationStrings[570]; LABEL_25: v54 = 2; @@ -15119,7 +15119,7 @@ if ( (signed int)SkillToMastery(v5) < 3 ) { LABEL_8: - v0->PlaySound(39, 0); + v0->PlaySound(SPEECH_39, 0); return; } v3 = pParty->pPickedItem.uItemID;
--- a/mm7_3.cpp Fri Feb 15 19:53:40 2013 +0200 +++ b/mm7_3.cpp Fri Feb 15 22:38:05 2013 +0200 @@ -2676,7 +2676,7 @@ if ( !uActiveCharacter ) goto LABEL_87; v65 = 0; - v63 = 63; + v63 = SPEECH_63; goto LABEL_76; case PARTY_LookDown: __debugbreak(); @@ -2687,9 +2687,9 @@ if ( uActiveCharacter ) { v65 = 0; - v63 = 64; + v63 = SPEECH_64; LABEL_76: - pPlayers[v35]->PlaySound(v63, v65); + pPlayers[v35]->PlaySound((PlayerSpeech)v63, v65); } break; case PARTY_CenterView: @@ -3507,7 +3507,7 @@ if ( _angle_x > 128 ) _angle_x = 128; if (uActiveCharacter) - pPlayers[uActiveCharacter]->PlaySound(63, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_63, 0); break; case PARTY_LookDown: @@ -3515,7 +3515,7 @@ if ( _angle_x < -128 ) _angle_x = -128; if (uActiveCharacter) - pPlayers[uActiveCharacter]->PlaySound(64, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_64, 0); break; case PARTY_Jump: @@ -3623,7 +3623,7 @@ { auto player = pParty->pPlayers + i; if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) && player->CanAct()) - player->PlaySound(66, 0); + player->PlaySound(SPEECH_66, 0); } } } @@ -18141,7 +18141,7 @@ LABEL_119: v56 = &pParty->pPlayers[v57]; LABEL_120: - v56->PlaySound(v114, v118); + v56->PlaySound((PlayerSpeech)v114, v118); ++v122; //v4 = v124; //v5 = pSomeEVT; @@ -18150,12 +18150,12 @@ break; } v55 = pParty->pPlayers; - do - { - v55->PlaySound(_evt->v6, 0); + for (int iii = 0; iii < 4; ++iii) + { + v55->PlaySound((PlayerSpeech)_evt->v6, 0); ++v55; } - while ( (signed int)v55 < (signed int)pParty->pHirelings ); + //while ( (signed int)v55 < (signed int)pParty->pHirelings ); ++v122; //v4 = v124; //v5 = pSomeEVT;
--- a/mm7_4.cpp Fri Feb 15 19:53:40 2013 +0200 +++ b/mm7_4.cpp Fri Feb 15 22:38:05 2013 +0200 @@ -3147,7 +3147,7 @@ if ( qword_A750D8 <= 0 ) { if ( pPlayers[word_A750E2]->CanAct() ) - pPlayers[word_A750E2]->PlaySound(word_A750E0, 0); + pPlayers[word_A750E2]->PlaySound((PlayerSpeech)word_A750E0, 0); qword_A750D8 = 0i64; } } @@ -9565,7 +9565,7 @@ v13[1] |= 1u; break; } - pPlayers[uActiveCharacter]->PlaySound(85, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); } if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { @@ -9635,9 +9635,9 @@ if ( uActiveCharacter ) { v25 = 0; - v23 = 86; + v23 = SPEECH_86; LABEL_50: - pPlayers[v11]->PlaySound(v23, v25); + pPlayers[v11]->PlaySound((PlayerSpeech)v23, v25); goto _return; } } @@ -9664,7 +9664,7 @@ ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(38, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_38, 0); v19 = pGlobalTXT_LocalizationStrings[155]; goto LABEL_77; } @@ -11762,7 +11762,7 @@ if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) pOutdoor->SetFog(); } - v0->PlaySound(87, 0); + v0->PlaySound(SPEECH_87, 0); sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);// // "%s is now Level %lu and has earned %lu Skill Points!" ShowStatusBarString(pTmpBuf, 2u); @@ -12692,7 +12692,7 @@ byte_F8B1EC = 0; uDialogueType = 13; if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(38, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_38, 0); v7 = pGlobalTXT_LocalizationStrings[155]; goto LABEL_64; } @@ -12724,7 +12724,7 @@ if ( (uDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 ) pDialogue_SpeakingActor->uAIState = Removed; if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(61, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); goto LABEL_87; } if ( v3 == 22 ) @@ -13496,7 +13496,7 @@ } } ++byte_F8B1EF[v29]; - v1->PlaySound(83, 0); + v1->PlaySound(SPEECH_83, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); goto LABEL_46; } @@ -13557,7 +13557,7 @@ HIDWORD(v1->pConditions[17]) = (int)v39; LABEL_63: pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); - v1->PlaySound(82, 0); + v1->PlaySound(SPEECH_82, 0); pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); LABEL_46: result = pMessageQueue_50CBD0->uNumMessages; @@ -14220,7 +14220,7 @@ v12 = (unsigned __int8)v5[8]; if ( (signed int)ptr_507BC0->ptr_1C >= 63 ) { - v63 = 72; + v63 = SPEECH_72; v13 = 2500; if ( CheckHiredNPCSpeciality(8u) ) v12 -= 2; @@ -14230,7 +14230,7 @@ } else { - v63 = 71; + v63 = SPEECH_71; v13 = 1500; v47[1] = (const char *)35; } @@ -14241,7 +14241,7 @@ if ( v12 < 1 ) v12 = 1; RestAndHeal(1440 * v12); - v61->PlaySound(v63, 0); + v61->PlaySound((PlayerSpeech)v63, 0); v14 = GetTickCount(); v15 = v14 + v13; if ( v15 < v14 ) @@ -14900,7 +14900,7 @@ if ( BYTE1(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].field_C) ) HousePlaySomeSound(v9, 1); if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) - pPlayers[uActiveCharacter]->PlaySound(47, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); result = v23; if ( v23 ) uCurrentHouse_Animation = v23; @@ -15106,7 +15106,7 @@ sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], v6, aAMPMNames[v7], v9, aAMPMNames[v8]); ShowStatusBarString(pTmpBuf, 2u); if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(3, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0); return 0; } }
--- a/mm7_5.cpp Fri Feb 15 19:53:40 2013 +0200 +++ b/mm7_5.cpp Fri Feb 15 22:38:05 2013 +0200 @@ -2879,9 +2879,9 @@ { v89 = uActiveCharacter; v176 = 0; - v160 = 108; + v160 = SPEECH_108; LABEL_619: - pPlayers[v89]->PlaySound(v160, v176); + pPlayers[v89]->PlaySound((PlayerSpeech)v160, v176); } } else @@ -3022,7 +3022,7 @@ pPlayers[uActiveCharacter]->uQuickSpell = v99; stru_A750F8[uActiveCharacter + 3]._494836(v99, uActiveCharacter); if ( uActiveCharacter ) - pPlayer10->PlaySound(12, 0); + pPlayer10->PlaySound(SPEECH_12, 0); byte_506550 = 0; continue; case UIMSG_33: @@ -3243,7 +3243,7 @@ pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); free((void *)uNumSeconds); stru_506E40._40E55E("gamma.pcx", 0); - GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, (enum WindowType)92, (int)pBtn_GameSettings, 0); + GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_VoiceSwitcherButton, (int)pBtn_GameSettings, 0); //LABEL_453: if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; @@ -3342,7 +3342,7 @@ { *(short *)v105 = uNumSeconds + 1; pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F; - pPlayer4->PlaySound(14, 0); + pPlayer4->PlaySound(SPEECH_14, 0); v165 = 0; v151 = 0; v144 = 0; @@ -3744,11 +3744,11 @@ enum PLAYER_SKILL_TYPE v6; // edi@37 GUIWindow *pWindow; // eax@56 unsigned int v8; // edx@56 - Player *pCurrentPlayer; // edi@57 + //Player *pCurrentPlayer; // edi@57 signed int v10; // eax@58 GUIButton *pButton; // eax@59 - unsigned __int8 v12; // sf@62 - signed int v13; // eax@64 + //unsigned __int8 v12; // sf@62 + //signed int v13; // eax@64 unsigned int v14; // eax@66 int v15; // edi@70 char v16; // zf@73 @@ -3777,7 +3777,7 @@ int v43; // [sp-10h] [bp-20h]@56 int uNum; // [sp+4h] [bp-Ch]@3 UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3 - int pSex; // [sp+Ch] [bp-4h]@3 + //int pSex; // [sp+Ch] [bp-4h]@3 Player *pPlayer; if ( pMessageQueue_50CBD0->uNumMessages ) @@ -3787,7 +3787,9 @@ pPlayer = pParty->pPlayers; do { - pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, &pSex); + int param2; + pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, ¶m2); + switch (pUIMessageType) // For buttons of window MainMenu { case UIMSG_MainMenu_ShowPartyCreationWnd: @@ -3816,6 +3818,99 @@ continue; } + + switch (pUIMessageType) // For buttons of Party Creation Window + { + case UIMSG_PlayerCreation_SelectAttribute: + { + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) + % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; + uPlayerCreationUI_SelectedCharacter = uNum; + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + } + continue; + + case UIMSG_PlayerCreation_VoicePrev: + { + auto player = &pParty->pPlayers[uNum]; + auto sex = player->GetSexByVoice(); + do + { + if (player->uVoiceID == 0) + player->uVoiceID = 19; + else --player->uVoiceID; + } + while (player->GetSexByVoice() != sex); + + pButton = pCreationUI_BtnPressLeft2[uNum]; + GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1); + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + player->PlaySound(SPEECH_PickMe, 0); + } + continue; + + case UIMSG_PlayerCreation_VoiceNext: + { + auto player = &pParty->pPlayers[uNum]; + auto sex = player->GetSexByVoice(); + do + { + player->uVoiceID = (player->uVoiceID + 1) % 20; + } + while (player->GetSexByVoice() != sex); + + pButton = pCreationUI_BtnPressRight2[uNum]; + GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1); + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + player->PlaySound(SPEECH_PickMe, 0); + } + continue; + + case UIMSG_PlayerCreation_FacePrev: + { + pPlayer = &pParty->pPlayers[uNum]; + unsigned char v12 = (char)((int)pPlayer->uFace - 1) < 0; + --pPlayer->uFace; + if ( v12 ) + pPlayer->uFace = 19; + pPlayer->uVoiceID = pPlayer->uFace; + pPlayer->SetInitialStats(); + pPlayer->SetSexByVoice(); + pPlayer->RandomizeName(); + v25 = uNum; + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) + % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; + uPlayerCreationUI_SelectedCharacter = v25; + GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressLeft[v25], 1); + //v0 = pAudioPlayer; + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); + pPlayer->PlaySound(SPEECH_PickMe, 0); + //v1 = (char *)pParty->pPlayers; + } + continue; + + case UIMSG_PlayerCreation_FaceNext: + { + pPlayer = &pParty->pPlayers[uNum]; + v20 = (char)((int)pPlayer->uFace + 1) % 20; + pPlayer->uFace = v20; + pPlayer->uVoiceID = v20; + pPlayer->SetInitialStats(); + pPlayer->SetSexByVoice(); + pPlayer->RandomizeName(); + v21 = uNum; + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) + % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; + uPlayerCreationUI_SelectedCharacter = v21; + GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressRight[v21], 1); + //v0 = pAudioPlayer; + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + pPlayer->PlaySound(SPEECH_PickMe, 0); + //v1 = (char *)pParty->pPlayers; + } + continue; + } + switch (pUIMessageType) // For buttons of window LoadGame { case UIMSG_LoadGame: @@ -3887,50 +3982,6 @@ { if ( pUIMessageType > UIMSG_DownArrow ) { - if ( pUIMessageType == UIMSG_SelectFacePlayerBack ) - { - pPlayer = &pParty->pPlayers[uNum]; - v12 = (char)((int)pPlayer->uFace - 1) < 0; - --pPlayer->uFace; - if ( v12 ) - pPlayer->uFace = 19; - pPlayer->uVoiceID = pPlayer->uFace; - pPlayer->SetInitialStats(); - pPlayer->SetSexByVoice(); - pPlayer->RandomizeName(); - v25 = uNum; - pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) - % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; - uPlayerCreationUI_SelectedCharacter = v25; - GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, - (enum WindowType)92, (int)pCreationUI_BtnPressLeft[v25], 1); - //v0 = pAudioPlayer; - pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0.0, 0); - pPlayer->PlaySound(102, 0); - //v1 = (char *)pParty->pPlayers; - continue; - } - if ( pUIMessageType == UIMSG_SelectFacePlayerForward ) - { - pPlayer = &pParty->pPlayers[uNum]; - v20 = (char)((int)pPlayer->uFace + 1) % 20; - pPlayer->uFace = v20; - pPlayer->uVoiceID = v20; - pPlayer->SetInitialStats(); - pPlayer->SetSexByVoice(); - pPlayer->RandomizeName(); - v21 = uNum; - pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) - % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; - uPlayerCreationUI_SelectedCharacter = v21; - GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, (enum WindowType)92, - (int)pCreationUI_BtnPressRight[v21], 1); - //v0 = pAudioPlayer; - pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); - pPlayer->PlaySound(102, 0); - //v1 = (char *)pParty->pPlayers; - continue; - } if ( pUIMessageType == UIMSG_AD )//unknow { __debugbreak(); @@ -3957,7 +4008,7 @@ pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; } - GUIWindow::Create(602, 450, 0, 0, (enum WindowType)92, (int)pBtn_GameSettings, 0); + GUIWindow::Create(602, 450, 0, 0, WINDOW_VoiceSwitcherButton, (int)pBtn_GameSettings, 0); if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; @@ -4045,50 +4096,6 @@ //VideoPlayer::dtor(); } } - else - { - if ( pUIMessageType == UIMSG_PlayerCreationSelectQuality ) - { - pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) - % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; - uPlayerCreationUI_SelectedCharacter = uNum; - pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); - continue; - } - if ( pUIMessageType == UIMSG_PlayerCreationVoiceBack )// есть проблема со звуками - { - pCurrentPlayer = &pPlayer[uNum]; - pSex = pCurrentPlayer->GetSexByVoice(); - do - { - v12 = (pCurrentPlayer->uVoiceID-- - 1) == 0; - if ( v12 ) - 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 ) - { - pCurrentPlayer = &pPlayer[uNum]; - pSex = pCurrentPlayer->GetSexByVoice(); - do - { - pCurrentPlayer->uVoiceID = (signed int)(pCurrentPlayer->uVoiceID + 1) % 20; - } - while ( pCurrentPlayer->GetSexByVoice() != 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); - pCurrentPlayer->PlaySound(102, 0); - continue; - } - } } else { @@ -4133,7 +4140,7 @@ if ( pUIMessageType == UIMSG_PlayerCreationSelectClass ) { pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)uNum); - pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); continue; } if ( pUIMessageType == UIMSG_PlayerCreationClickOK ) @@ -4156,7 +4163,7 @@ { uPlayerCreationUI_SelectedCharacter = uNum; v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; - pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem; + int pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem; v41 = 2; v5 = v4 % 7 + pSex + 7 * uNum; pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; @@ -5127,7 +5134,7 @@ // 50FE08: using guessed type stru298 stru_50FE08; //----- (00439474) -------------------------------------------------------- -bool __fastcall DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) +void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) { signed int v3; // eax@1 LayingItem *v4; // ebx@1 @@ -5212,8 +5219,8 @@ } v5 = v3 & 7; uPlayerID = v3 >> 3; - if ( v5 != 4 ) - return uPlayerID; + if (v5 != OBJECT_Player) + return; pPlayer = &pParty->pPlayers[uPlayerID]; if ( uPlayerID < 0 && uPlayerID > 3 ) { @@ -5222,7 +5229,7 @@ pMonster = &pActors[uActorID_Monster_]; uPlayerID = pMonster->IsAlive(); if ( uPlayerID ) - return uPlayerID; + return; BYTE1(pMonster->uAttributes) |= 0xC0u; if ( pMonster->uAIState == Fleeing ) pMonster->uAttributes |= 0x20000u; @@ -5311,7 +5318,7 @@ if ( uPlayerID >= 2560 ) { if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) ) - return uPlayerID; + return; v61 = 2; } else @@ -5363,8 +5370,8 @@ if ( !stru_50C198.PlayerHitOrMiss(pPlayer, pMonster, v61, a4) ) { LABEL_68: - LOWORD(uPlayerID) = pPlayer->PlaySound(52, 0); - return uPlayerID; + pPlayer->PlaySound(SPEECH_52, 0); + return; } goto LABEL_69; } @@ -5515,10 +5522,10 @@ Actor::_43AC45(uActorID_Monster_, 1); if ( pMonster->pMonsterInfo.uExp ) sub_4269A2_GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp); - v40 = 51; + v40 = SPEECH_51; if ( rand() % 100 < 20 ) v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1; - pPlayer->PlaySound(v40, 0); + pPlayer->PlaySound((PlayerSpeech)v40, 0); v41 = 0; if ( bShowDamage ) { @@ -5585,7 +5592,7 @@ pMonster->vVelocity.y = 50 * LOWORD(pVelocity->y); pMonster->vVelocity.z = 50 * LOWORD(pVelocity->z); } - return Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster_, 1, v61); + Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster_, 1, v61); } // 4D864C: using guessed type char byte_4D864C; @@ -5832,10 +5839,10 @@ Actor::_43AC45(uActorID, 1); if ( v7->pMonsterInfo.uExp ) sub_4269A2_GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); - v34 = 51; + v34 = SPEECH_51; if ( rand() % 100 < 20 ) v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; - v6->PlaySound(v34, 0); + v6->PlaySound((PlayerSpeech)v34, 0); } } } @@ -5860,7 +5867,7 @@ if ( v6->sHealth > 0 ) { if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) - v6->PlaySound(48, 0); + v6->PlaySound(SPEECH_48, 0); } } } @@ -5892,7 +5899,7 @@ { sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[637], v45->pName); ShowStatusBarString(pTmpBuf, 2u); - v45->PlaySound(6, 0); + v45->PlaySound(SPEECH_6, 0); return; } } @@ -6018,10 +6025,10 @@ Actor::_43AC45(uActorID, 1); if ( v44->pMonsterInfo.uExp ) sub_4269A2_GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); - v64 = 51; + v64 = SPEECH_51; if ( rand() % 100 < 20 ) v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; - v45->PlaySound(v64, 0); + v45->PlaySound((PlayerSpeech)v64, 0); } } } @@ -15294,7 +15301,7 @@ continue; } v18 = v17 - 1; - if ( pWindowType == WINDOW_5C ) // Change page in AutonotesBook + if ( pWindowType == WINDOW_VoiceSwitcherButton ) // Change page in AutonotesBook { if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); @@ -15890,7 +15897,7 @@ *(int *)(v22 + 552) |= 1u; if ( !dword_4E455C ) goto LABEL_92; - v0->PlaySound(16, 0); + v0->PlaySound(SPEECH_16, 0); goto LABEL_91; } if ( v45 ) @@ -15931,7 +15938,7 @@ if ( dword_4E455C ) { if ( v0->CanAct() ) - v0->PlaySound(17, 0); + v0->PlaySound(SPEECH_17, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); LABEL_91: dword_4E455C = 0; @@ -15979,7 +15986,7 @@ dword_50CDCC = 1; if ( dword_4E455C ) { - v0->PlaySound(16, 0); + v0->PlaySound(SPEECH_16, 0); dword_4E455C = 0; } }
--- a/mm7_6.cpp Fri Feb 15 19:53:40 2013 +0200 +++ b/mm7_6.cpp Fri Feb 15 22:38:05 2013 +0200 @@ -4071,7 +4071,7 @@ } if ( v727 != 0.0 ) { - pPlayer->PlaySound(49, 0); + pPlayer->PlaySound(SPEECH_49, 0); goto LABEL_1162; } } @@ -5312,7 +5312,7 @@ pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, v1, v1, -1, v1, v1, v1, v1); v318 = v726; v3->spellnum = v1; - v318->PlaySound(43, v1); + v318->PlaySound(SPEECH_43, v1); } goto LABEL_83; } @@ -6089,7 +6089,7 @@ || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) { if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) - pParty->pPlayers[v396].PlaySound(25, v1); + pParty->pPlayers[v396].PlaySound(SPEECH_25, v1); if ( v731 == 4 ) { v397 = v3->uPlayerID_2; @@ -6424,7 +6424,7 @@ if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) { if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) - pParty->pPlayers[v440].PlaySound(25, v1); + pParty->pPlayers[v440].PlaySound(SPEECH_25, v1); if ( v731 == 4 ) { v441 = v3->uPlayerID_2; @@ -7740,7 +7740,7 @@ v222 = (char *)HIDWORD(v733); if ( v223 ) LABEL_439: - ((Player *)v222)->PlaySound(103, v1); + ((Player *)v222)->PlaySound(SPEECH_103, v1); } v222 += 6972; HIDWORD(v733) = (int)v222; @@ -8049,7 +8049,7 @@ else { v34 = 5; - v1->PlaySound(50, v3); + v1->PlaySound(SPEECH_50, v3); } switch ( v34 ) { @@ -9110,14 +9110,12 @@ v5->Add(partyAction); break; case INPUT_Yell: - //__debugbreak(); - if ( !pCurrentScreen - && uActiveCharacter ) + if (!pCurrentScreen && uActiveCharacter) { pParty->Yell(); - pPlayers[uActiveCharacter]->PlaySound(65, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); } - break; + break; case INPUT_Pass: //__debugbreak(); if ( pCurrentScreen )
--- a/mm7_data.cpp Fri Feb 15 19:53:40 2013 +0200 +++ b/mm7_data.cpp Fri Feb 15 22:38:05 2013 +0200 @@ -1094,7 +1094,7 @@ "pc19lhu", "pc20lhu", "pc21lhu", "pc22lhu", "pc23lhu", "pc24lhu", "pc25lhu" }; -short SoundSetAction[192]= +short SoundSetAction[192]= // 4ED3D8 { 0, 0, 0, 0, 0, 0, 0, 0, 38, 0, 0, 37, 38, 45, 0, 0, 37, 0, 0, 47, 53, 0, 0, 0, 2, 0, 0, 25, 0, 0, 0, 0, 1, 0, 0, 47, 0, 0, 0, 0, 3, 0, 0, 41, 42, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 5, 0, 0, 21, 22, 23, 24, 45, 6, 0, 0, 47, 0, 0, 0, 0, 7, 0,
--- a/mm7_data.h Fri Feb 15 19:53:40 2013 +0200 +++ b/mm7_data.h Fri Feb 15 22:38:05 2013 +0200 @@ -2386,7 +2386,7 @@ int /*__usercall*/ sr_sub_4D72EC/*<eax>*/(int a1/*<ebp>*/); int /*__usercall*/ sr_sub_4D73DF/*<eax>*/(int a1/*<ebp>*/); signed int __fastcall SpawnRandomTreasure(struct MapInfo *a1, struct SpawnPointMM7 *a2); -bool __fastcall DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, struct Vec3_int_ *pVelocity); +void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, struct Vec3_int_ *pVelocity); #define ErrD3D(hr) do {extern void ErrHR(HRESULT, const char *, const char *, const char *, int); ErrHR(hr, "Direct3D", __FUNCTION__, __FILE__, __LINE__);} while(0)