# HG changeset patch # User Ritor1 # Date 1412256791 -21600 # Node ID 28afacb08f7678c43bd1baf0c5efa2e69b381e0d # Parent 160e12614310e8c96874ecb2cc45a94a86606362# Parent fb1c61a82a554208038c7a2673f6aa92835a4f49 Слияние diff -r 160e12614310 -r 28afacb08f76 Arcomage/Arcomage.cpp --- a/Arcomage/Arcomage.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Arcomage/Arcomage.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -535,7 +535,7 @@ case 13: play_sound_id = SOUND_Arcomage_130; break; - case 55u: + case 55: play_sound_id = SOUND_Arcomage_131; break; case 49: @@ -975,11 +975,6 @@ ArcomageCard *v12; // ecx@20 int v56; // ecx@141 int v57; // edx@141 -// int v64; // eax@169 -// ArcomageCard *pCard; // ecx@169 -// char v66; // dl@169 -// char v67; // dl@173 -// int v68; // edx@174 int v132; // [sp-14h] [bp-14h]@0 ArcomagePlayer *enemy; // [sp-10h] [bp-10h]@5 ArcomagePlayer *player; // [sp-Ch] [bp-Ch]@5 @@ -1327,7 +1322,6 @@ void TurnChange() { char player_name[64]; // [sp+4h] [bp-64h]@4 - // RECT v6; // [sp+44h] [bp-24h]@6 ArcomageGame_stru1 v10; // [sp+54h] [bp-14h]@7 POINT v11; // [sp+60h] [bp-8h]@4 @@ -1422,19 +1416,12 @@ //----- (0040A560) -------------------------------------------------------- char PlayerTurn( int player_num ) { -// int v1; // ebp@0 -// unsigned __int64 v2; // qax@3 unsigned __int64 v3; // kr00_8@3 -// int v5; // esi@67 -// char Dest[100]; // [sp+8h] [bp-A8h]@67 -// int v8; // [sp+6Ch] [bp-44h]@3 RECT pSrcXYZW; // [sp+70h] [bp-40h]@75 -// int v10[4]; // [sp+80h] [bp-30h]@69 POINT pTargetXY; // [sp+90h] [bp-20h]@75 ArcomageGame_stru1 a2; // [sp+98h] [bp-18h]@8 int animation_stage; // [sp+A4h] [bp-Ch]@1 -// char v15; // [sp+AEh] [bp-2h]@63 bool break_loop; // [sp+AFh] [bp-1h]@1 uCardID = -1; @@ -2067,10 +2054,8 @@ { int v0; // eax@1 int v1; // eax@4 -// LONG v2; // ecx@4 int v3; // eax@5 int v4; // eax@8 -// LONG v5; // esi@8 RECT pSrcXYZW; // [sp+4h] [bp-18h]@4 POINT pTargetXY; // [sp+14h] [bp-8h]@4 @@ -2110,27 +2095,9 @@ void DrawCards() { int v0; // esi@1 -// char v1; // bl@1 int v2; // edi@1 - //int v3; // edx@2 -// int v4; // eax@3 -// int v5; // ecx@3 -// int v6; // eax@3 unsigned int v7; // ecx@4 -// int v8; // eax@16 -// int v9; // ecx@16 -// int v10; // eax@16 signed int v11; // edi@18 -// signed int v12; // esi@20 -// int v13; // ecx@20 -// int v14; // eax@23 -// signed int v15; // eax@25 -// int v16; // ecx@25 -// POINT *v17; // esi@26 -// signed int v18; // eax@29 -// AcromageCardOnTable *v19; // ecx@29 -// int v20; // ecx@31 -// int v21; // [sp-4h] [bp-2Ch]@8 RECT pSrcXYZW; // [sp+Ch] [bp-1Ch]@8 POINT pTargetXY; // [sp+1Ch] [bp-Ch]@1 int v24; // [sp+24h] [bp-4h]@1 @@ -2251,26 +2218,12 @@ { int v1; // eax@3 int v2; // eax@3 -// int v3; // esi@4 int v4; // eax@4 -// POINT *v5; // edx@6 -// RECT *v6; // ecx@6 int v8; // eax@15 -// AcromageCardOnTable *v9; // ecx@15 -// int v10; // ecx@19 -// int v11; // eax@20 -// int v12; // ecx@20 -// int v13; // eax@20 -// unsigned int v14; // ecx@21 double v15; // st7@22 -// POINT *v16; // edx@23 int v17; // eax@32 char v18; // zf@37 int v19; // eax@41 -// int v20; // eax@46 -// int v21; // ecx@46 -// int v22; // eax@46 -// int v23; // [sp-4h] [bp-2Ch]@28 RECT pSrcXYZW; // [sp+Ch] [bp-1Ch]@6 POINT pTargetXY; // [sp+1Ch] [bp-Ch]@20 int v26; // [sp+24h] [bp-4h]@1 @@ -2468,7 +2421,6 @@ signed int DrawCardsRectangles( int player_num ) { int v5; // eax@3 -// int i; // ecx@6 int color; // ST00_4@19 RECT pXYZW; // [sp+Ch] [bp-3Ch]@3 stru273 v26; // [sp+1Ch] [bp-2Ch]@2 @@ -2533,19 +2485,9 @@ bool DiscardCard( int player_num, signed int card_slot_index ) { int v2; // esi@2 -// signed int v3; // edi@2 -// char *v4; // eax@2 -// int v5; // ecx@7 -// int v6; // ebx@7 -// int v7; // esi@8 int v8; // eax@8 -// int v9; // esi@8 int v10; // ecx@8 -// int v11; // eax@8 int v12; // eax@8 -// signed int v13; // edx@9 -// unsigned int v14; // eax@12 -// char result; // al@12 int i; if ( card_slot_index <= -1 ) @@ -2594,20 +2536,11 @@ //----- (0040BE0E) -------------------------------------------------------- bool PlayCard( int player_num, int card_slot_num ) { -// int v3; // ebp@1 int v4; // ecx@2 -// ArcomagePlayer *v5; // esi@2 int card_index; // edi@2 -// int v7; // eax@2 -// int v8; // ebx@8 int cards_at_hand; // eax@8 -// int v10; // ebx@8 -// int v11; // ebp@8 int v12; // ecx@8 -// int v13; // eax@8 ArcomageCard *pCard; // eax@8 -// int v15; // ecx@8 -// int v16; // ecx@8 if ( card_slot_num <= -1 ) return false; @@ -2718,26 +2651,7 @@ }\ } ArcomagePlayer *player; // esi@1 -// int v3; // eax@1 ArcomagePlayer *enemy; // edi@1 -// int v5; // eax@2 -// char v6; // sf@2 -// unsigned __int8 v7; // of@2 -// int v8; // eax@3 -// int v9; // eax@4 -// char v10; // zf@5 -// int v11; // eax@8 -// unsigned __int8 v12; // zf@8 -// char v13; // sf@8 -// unsigned __int8 v14; // of@8 -// int v15; // eax@9 -// int v16; // eax@10 -// char v17; // zf@12 -// char v18; // al@15 -// int v19; // eax@16 -// int v20; // eax@17 -// int v21; // eax@22 -// int v22; // eax@23 int v23; // eax@26 signed int v24; // ebx@26 int v103; @@ -2872,19 +2786,10 @@ goto LABEL_231; default: LABEL_26: - v23 = pCard->draw_extra_card_count; - v24 = 0; - dword_4FAA68 = v23 + (pCard->field_30 == 1); - dword_4FAA64 = v23; - if ( v23 > 0 ) - { - do - { - GetNextCardFromDeck(player_num); - ++v24; - } - while ( v24 < pCard->draw_extra_card_count ); - } + dword_4FAA68 = pCard->draw_extra_card_count + (pCard->field_30 == 1); + dword_4FAA64 = pCard->draw_extra_card_count; + for ( uint i = 0; i < pCard->draw_extra_card_count; i++ ) + GetNextCardFromDeck(player_num); need_to_discard_card = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand; @@ -2934,19 +2839,10 @@ break; case 0: LABEL_231: - v103 = pCard->can_draw_extra_card2; - v104 = 0; - dword_4FAA68 = v103 + (pCard->field_4D == 1); - dword_4FAA64 = v103; - if ( v103 > 0 ) - { - do - { - GetNextCardFromDeck(player_num); - ++v104; - } - while ( v104 < pCard->can_draw_extra_card2 ); - } + dword_4FAA68 = pCard->can_draw_extra_card2 + (pCard->field_4D == 1); + dword_4FAA64 = pCard->can_draw_extra_card2; + for ( uint i = 0; i < pCard->can_draw_extra_card2; i++ ) + GetNextCardFromDeck(player_num); need_to_discard_card = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand; @@ -3287,7 +3183,6 @@ int am_40D2B4( POINT* startXY, int effect_value ) { int v2; // ebp@1 -// POINT *v3; // edi@1 int result; // eax@3 int v6; stru272_stru0 *v8; // ecx@12 @@ -3356,7 +3251,6 @@ //----- (0040D402) -------------------------------------------------------- int ApplyDamageToBuildings( int player_num, int damage ) { -// ArcomagePlayer *v2; // ecx@1 int v3; // esi@1 int result; // eax@3 @@ -3392,8 +3286,6 @@ int pl_resource; // edx@25 int en_resource; // eax@28 unsigned int tavern_num; // eax@54 -// char pText[64]; // [sp+Ch] [bp-48h]@1 -// POINT xy; // [sp+4Ch] [bp-8h]@1 winner = -1; victory_type = -1; @@ -3570,11 +3462,9 @@ //----- (00409C8B) -------------------------------------------------------- void ArcomageGame::PrepareArcomage() { -// signed __int64 v1; // qax@4 int v2; // esi@4 int v3; // esi@5 signed int v4; // edi@5 -// int v6; // edx@9 RECT pXYZW; // [sp+8h] [bp-1Ch]@5 POINT pXY; // [sp+18h] [bp-Ch]@5 diff -r 160e12614310 -r 28afacb08f76 Engine/Events.cpp --- a/Engine/Events.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Events.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -431,7 +431,7 @@ if ( v128 == 3 ) pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; if ( v128 == 13 ) - pMediaPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); + pMediaPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1); } ++curr_seq_num; break; @@ -653,7 +653,7 @@ activeLevelDecoration = (LevelDecoration*)1; if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) { - pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Invalid, 0, 0, -1, 0, 0, 0, 0); window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_HouseInterior, 165, 0); v48 = window_SpeakInHouse->pControlsHead; if ( window_SpeakInHouse->pControlsHead ) @@ -1176,7 +1176,7 @@ if ( EnterHouse((enum HOUSE_ID)EVT_DWORD(_evt->v5))) { pRenderer->Sub01(); - pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Invalid, 0, 0, -1, 0, 0, 0, 0); pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); v104 = 187; if ( uCurrentHouse_Animation != 167 ) diff -r 160e12614310 -r 28afacb08f76 Engine/Game.cpp --- a/Engine/Game.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Game.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -316,7 +316,10 @@ LoadPlayerPortraintsAndVoices(); pIcons_LOD->_inlined_sub1(); - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); + if ( use_music_folder ) + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + else + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); while ( 2 ) { @@ -1580,7 +1583,7 @@ case UIMSG_ChangeKeyButton: if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 ) { - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); continue; } v14 = uMessageParam; @@ -1607,7 +1610,7 @@ pPrevVirtualCidesMapping[i] = pKeyActionMap->GetActionVKey((enum InputAction)i); GameMenuUI_InvaligKeyBindingsFlags[i] = false; } - pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_219, 0, 0, -1, 0, 0, 0, 0); continue; case UIMSG_SelectKeyPage1: KeyboardPageNum = 1; @@ -1667,13 +1670,13 @@ if ( (uGammaPos -- -1) < 0 ) { uGammaPos = 0; - pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_21, 0, 0, -1, 0, 0, 0, 0); continue; } v19 = (double)(signed int)uGammaPos * 0.1 + 0.6; pGame->pGammaController->Initialize(v19); GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); - pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_21, 0, 0, -1, 0, 0, 0, 0); continue; } if ( uMessageParam == 5 ) @@ -1684,7 +1687,7 @@ v21 = (double)(signed int)uGammaPos * 0.1 + 0.6; pGame->pGammaController->Initialize(v21); GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); - pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_21, 0, 0, -1, 0, 0, 0, 0); continue; } uGammaPos = 9; @@ -1695,7 +1698,7 @@ v22 = (double)(signed int)uGammaPos * 0.1 + 0.6; pGame->pGammaController->Initialize(v22); } - pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_21, 0, 0, -1, 0, 0, 0, 0); continue; case UIMSG_ToggleBloodsplats: pGame->ToggleFlags2(0x20u); @@ -1715,7 +1718,10 @@ GUIWindow::Create(243, 216, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); if ( uMusicVolimeMultiplier ) pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); + if ( use_music_folder ) + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + else + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); continue; } if ( uMessageParam == 5 )//+ @@ -1726,7 +1732,10 @@ GUIWindow::Create(435, 216, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); if ( uMusicVolimeMultiplier ) pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); + if ( use_music_folder ) + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + else + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); continue; } uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17;//for mouse @@ -1734,7 +1743,10 @@ uMusicVolimeMultiplier = 9; if ( uMusicVolimeMultiplier ) pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); + if ( use_music_folder ) + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + else + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); continue; case UIMSG_ChangeSoundVolume: if ( uMessageParam == 4 )//reduce sound level button left @@ -1744,10 +1756,11 @@ uSoundVolumeMultiplier = 0; GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); - pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); - //int v = AIL_redbook_volume(pAudioPlayer->hAILRedbook); - //if (v) - //__debugbreak(); + pAudioPlayer->PlaySound(SOUND_shurch, -1, 0, -1, 0, 0, 0, 0); + int v = AIL_redbook_volume(pAudioPlayer->hAILRedbook); + //v = v+1; + if (v) + __debugbreak(); continue; } if ( uMessageParam == 5 )//Increase sound level button right @@ -1758,16 +1771,16 @@ //v168 = 1; v24 = 435; //v154 = (int)pBtn_SliderRight; - GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); + GUIWindow::Create(v24, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); - pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_shurch, -1, 0, -1, 0, 0, 0, 0); continue; } uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17; if ( (char)uSoundVolumeMultiplier > 8 ) uSoundVolumeMultiplier = 9; pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); - pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_shurch, -1, 0, -1, 0, 0, 0, 0); continue; case UIMSG_ToggleFlipOnExit: bFlipOnExit = bFlipOnExit == 0; @@ -1790,7 +1803,7 @@ GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); if ( !uVoicesVolumeMultiplier ) continue; - pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); + pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); continue; } if ( uMessageParam == 5 ) @@ -1801,7 +1814,7 @@ GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); if ( !uVoicesVolumeMultiplier ) continue; - pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); + pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); continue; } uVoicesVolumeMultiplier = (pMouse->GetCursorPos(&v205)->x - 263) / 17; @@ -1809,7 +1822,7 @@ uVoicesVolumeMultiplier = 9; if ( !uVoicesVolumeMultiplier ) continue; - pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); + pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); continue; case UIMSG_SetTurnSpeed: if ( uMessageParam ) @@ -2168,7 +2181,7 @@ stru_506E40.Release(); break; } - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); break; case SCREEN_REST://close rest screen if ( dword_506F14 ) @@ -2237,7 +2250,7 @@ continue; } GetHouseGoodbyeSpeech(); - pAudioPlayer->PlaySound(SOUND_7, 814, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_WoodDRClose, 814, 0, -1, 0, 0, 0, 0); pMediaPlayer->Unload(); pGUIWindow_CurrentMenu = window_SpeakInHouse; if ( pGUIWindow_Settings ) @@ -3255,13 +3268,13 @@ pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); v73 = "Can't jump to that location!"; } - ShowStatusBarString(v73, 6u); + ShowStatusBarString(v73, 6); continue; case UIMSG_CastQuickSpell: if ( bUnderwater == 1 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); continue; } if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) ) @@ -3357,7 +3370,7 @@ if ( dword_506F14 == 2 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); continue; } GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2, @@ -3369,7 +3382,7 @@ if ( dword_506F14 == 2 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); continue; } GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2, @@ -3440,7 +3453,7 @@ if ( dword_506F14 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); continue; } if ( pParty->uNumFoodRations < uRestUI_FoodRequiredToRest ) @@ -3487,7 +3500,7 @@ }*/ pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!" - pAudioPlayer->PlaySound((SoundID)227, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_227, 0, 0, -1, 0, 0, 0, 0); continue; } } @@ -3506,7 +3519,7 @@ if ( dword_506F14 == 2 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); continue; } GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2, @@ -3560,7 +3573,7 @@ { pPlayer10->uQuickSpell = 0; quick_spell_at_page = 0; - pAudioPlayer->PlaySound((SoundID)203, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_203, 0, 0, -1, 0, 0, 0, 0); continue; } pPlayers[uActiveCharacter]->uQuickSpell = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage; @@ -3585,7 +3598,7 @@ } } if ( !skill_count )// - pAudioPlayer->PlaySound((SoundID)(rand() % 2 + 204), 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_204), 0, 0, -1, 0, 0, 0, 0); else { if ( GetAsyncKeyState(VK_SHIFT) ) @@ -3603,7 +3616,7 @@ OnCloseSpellBookPage(); pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); pGUIWindow_CurrentMenu->OpenSpellBook(); - pAudioPlayer->PlaySound((SoundID)(rand() % 2 + 204), 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_204), 0, 0, -1, 0, 0, 0, 0); } continue; } @@ -3613,7 +3626,7 @@ OnCloseSpellBookPage(); pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; pGUIWindow_CurrentMenu->OpenSpellBook(); - pAudioPlayer->PlaySound((SoundID)(rand() % 2 + 204), 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_204), 0, 0, -1, 0, 0, 0, 0); continue; case UIMSG_SelectSpell: { @@ -3670,7 +3683,7 @@ if ( bUnderwater == true ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); } else { @@ -3684,7 +3697,7 @@ pCurrentScreen = SCREEN_SPELL_BOOK; pEventTimer->Pause(); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_SpellBook, 0, 0); - pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_48, 0, 0, -1, 0, 0, 0, 0); viewparams->field_48 = 1; continue; } @@ -3696,7 +3709,7 @@ pCurrentScreen = SCREEN_SPELL_BOOK; pEventTimer->Pause(); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_SpellBook, 0, 0); - pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_48, 0, 0, -1, 0, 0, 0, 0); viewparams->field_48 = 1; continue; } @@ -4260,12 +4273,12 @@ case UIMSG_PlayerCreationClickPlus: GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, (char *)1); pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); - pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_20, 0, 0, -1, 0, 0, 0, 0); break; case UIMSG_PlayerCreationClickMinus: GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, (char *)1); pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); - pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_23, 0, 0, -1, 0, 0, 0, 0); break; case UIMSG_PlayerCreationSelectActiveSkill: if ( pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(3) == 37 ) @@ -4300,7 +4313,7 @@ pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(3)] = 0; break; case UIMSG_PlayerCreationChangeName: - pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_24, 0, 0, -1, 0, 0, 0, 0); v3 = (void *)pParam; uPlayerCreationUI_SelectedCharacter = pParam; pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu); @@ -4469,7 +4482,7 @@ //----- (0042FBDD) -------------------------------------------------------- void sub_42FBDD() { - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); pRenderer->Present(); } @@ -4477,7 +4490,7 @@ //----- (0042FC15) -------------------------------------------------------- void CloseWindowBackground() { - pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, -2, 0, -1, 0, 0, 0, 0); pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); pRenderer->Present(); } @@ -4755,15 +4768,15 @@ if (GetFileAttributesW(pMagicPath) == -1) return false; + //Open CD audio wsprintfA(strCommand, "open %c: type cdaudio alias CD", c); - if (!mciSendStringA(strCommand, DstBuf, 255, 0))//Uninitialized memory access - - { - wsprintfA(strCommand, "info CD UPC wait"); - mciSendStringA(strCommand, DstBuf, 255, 0); - wsprintfA(strCommand, "close CD"); - mciSendStringA(strCommand, DstBuf, 255, 0); - } + if (!mciSendStringA(strCommand, DstBuf, 255, 0)) + { + wsprintfA(strCommand, "info CD UPC wait"); + mciSendStringA(strCommand, DstBuf, 255, 0); + wsprintfA(strCommand, "close CD"); + mciSendStringA(strCommand, DstBuf, 255, 0); + } memcpy(Filename, "X:\\anims\\magic7.vid", sizeof(Filename)); *Filename = c; @@ -5381,6 +5394,7 @@ bool new_sky = false; //new sky(need texture) int max_flight_height = 4000; //maximum altitude bool use_MMT = false; +bool use_music_folder = true; bool for_refactoring = false; //----- (00462C94) -------------------------------------------------------- @@ -5476,8 +5490,13 @@ if (GetCurrentMenuID() == MENU_NEWGAME) { + if ( use_music_folder ) + alSourceStop(mSourceID); + else + { if (pAudioPlayer->hAILRedbook) AIL_redbook_stop(pAudioPlayer->hAILRedbook); + } pParty->Reset(); pOtherOverlayList->Reset(); strcpy(pCurrentMapName, pStartingMapName); @@ -5507,10 +5526,15 @@ } if (GetCurrentMenuID() == MENU_CREDITS) { + if ( use_music_folder ) + alSourceStop(mSourceID); + else + { if (pAudioPlayer->hAILRedbook) AIL_redbook_stop(pAudioPlayer->hAILRedbook); - MainMenuUI_Credits_Loop(); - break; + } + MainMenuUI_Credits_Loop(); + break; } if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu) { @@ -5560,13 +5584,21 @@ break; } } - if (!bNoSound && pAudioPlayer->hAILRedbook) + if (!bNoSound ) { + if ( use_music_folder ) + { + PlayAudio(L"Music\\14.mp3"); + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + } + else if ( pAudioPlayer->hAILRedbook) + { pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); AIL_redbook_stop(pAudioPlayer->hAILRedbook); unsigned int startms, end_ms; AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &startms, &end_ms); AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms); + } } } //lua_close(L); diff -r 160e12614310 -r 28afacb08f76 Engine/Graphics/DecalBuilder.cpp --- a/Engine/Graphics/DecalBuilder.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Graphics/DecalBuilder.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -93,39 +93,8 @@ //----- (0049B540) -------------------------------------------------------- char DecalBuilder::ApplyDecals(int light_level, char a3, stru154 *a4, int a5, RenderVertexSoft *a6, IndoorCameraD3D_Vec4 *a7, char a8, unsigned int uSectorID) { - //char *v9; // eax@3 - //signed int v10; // ecx@3 - //RenderVertexSoft *v11; // eax@10 - //unsigned int v12; // edx@10 - //RenderVertexSoft *v13; // esi@11 - //RenderVertexSoft *v14; // edi@11 - //char v15; // zf@11 stru154 *v16; // esi@12 - //double v18; // st7@17 - //double v19; // st6@17 - //float v20; // eax@17 - //Bloodsplat *v21; // esi@21 - //int v22; // eax@21 - //int v23; // ecx@21 - //double v24; // st7@21 int v25; // ebx@21 - //double v26; // st7@21 - //int v27; // edi@21 - //double v28; // st7@21 - //float v29; // ST10_4@21 -// int v30; // ST08_4@21 - //DecalBuilder *v31; // esi@21 - //int v32; // [sp+4h] [bp-44h]@18 - //float v33; // [sp+8h] [bp-40h]@21 - //stru314 *v34; // [sp+Ch] [bp-3Ch]@21 - //float v35; // [sp+10h] [bp-38h]@21 - //float v36; // [sp+14h] [bp-34h]@17 - //int v37; // [sp+18h] [bp-30h]@17 - //int a5a; // [sp+28h] [bp-20h]@21 - //int v39; // [sp+2Ch] [bp-1Ch]@21 - //int v40; // [sp+30h] [bp-18h]@21 - //int v41; // [sp+34h] [bp-14h]@22 - //int v42; // [sp+38h] [bp-10h]@21 int v43; // [sp+3Ch] [bp-Ch]@21 //DecalBuilder *thisa; // [sp+40h] [bp-8h]@1 //RenderVertexSoft *a11; // [sp+44h] [bp-4h]@8 @@ -242,35 +211,11 @@ //----- (0049B790) -------------------------------------------------------- char DecalBuilder::_49B790_build_decal_geometry(int a2, char a3, Bloodsplat *a4, int a5, float a6, unsigned int uColorMultiplier, float a8, stru314 *a9, signed int a10, RenderVertexSoft *a11, char uClipFlags) { - //DecalBuilder *v12; // esi@1 Decal *v13; // edi@2 - //int *v14; // eax@2 - //double v15; // st7@4 - //double v16; // st7@4 - //int v17; // eax@4 - //stru314 *v18; // ebx@4 - //double v19; // st7@4 - //double v20; // st7@4 - //double v21; // st7@4 - //double v22; // st6@4 - //double v23; // st6@4 - //double v24; // st5@4 - //char *v25; // eax@4 - //signed int v26; // ecx@4 - //double v27; // st5@4 double v28; // st7@5 - //double v29; // st7@6 char result; // al@6 -// unsigned int *v31; // edi@7 -// RenderVertexSoft *v32; // ebx@8 -// std::string *v33; // ecx@15 int v34; // eax@19 -// const char *v35; // [sp-Ch] [bp-2Ch]@15 -// int v36; // [sp-8h] [bp-28h]@15 std::string v37; // [sp-4h] [bp-24h]@15 - //float v38; // [sp+8h] [bp-18h]@6 - //RenderVertexSoft *v39; // [sp+Ch] [bp-14h]@6 - //unsigned int v40; // [sp+10h] [bp-10h]@6 //int a6a; //RenderVertexSoft *a8a; diff -r 160e12614310 -r 28afacb08f76 Engine/Graphics/Indoor.cpp --- a/Engine/Graphics/Indoor.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Graphics/Indoor.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -424,7 +424,7 @@ return; ++pBLVRenderParams->uNumFacesRenderedThisFrame; - pFace->uAttributes |= FACE_UNKNOW4; + pFace->uAttributes |= FACE_UNKNOW7; if (!pFace->GetTexture()) return; @@ -2948,7 +2948,7 @@ bNoNPCHiring = false; pDest = 1; uCurrentlyLoadedLevelType = LEVEL_Indoor; - pGame->uFlags2 &= 0xFFFFFFF7u; + pGame->uFlags2 &= 0xFFFFFFF7;//~0x00000008 if ( Is_out15odm_underwater() ) { bUnderwater = true; @@ -3833,10 +3833,10 @@ if (pBLVRenderParams->uPartySectorID) { pBspRenderer->nodes[0].uSectorID = pBLVRenderParams->uPartySectorID; - pBspRenderer->nodes[0].uViewportW = pBLVRenderParams->uViewportW; + pBspRenderer->nodes[0].uViewportX = pBLVRenderParams->uViewportX; + pBspRenderer->nodes[0].uViewportY = pBLVRenderParams->uViewportY; pBspRenderer->nodes[0].uViewportZ = pBLVRenderParams->uViewportZ; - pBspRenderer->nodes[0].uViewportY = pBLVRenderParams->uViewportY; - pBspRenderer->nodes[0].uViewportX = pBLVRenderParams->uViewportX; + pBspRenderer->nodes[0].uViewportW = pBLVRenderParams->uViewportW; pBspRenderer->nodes[0].PortalScreenData.GetViewportData(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); pBspRenderer->nodes[0].uFaceID = -1; @@ -4890,7 +4890,7 @@ bool bFound = false; for (uint i = 0; i < pFace->uNumVertices; ++i) { - if ( PortalFace._view_transformed_z[i + 3] >= 524288 )// 8.0(0x80000) + if ( PortalFace._view_transformed_z[i + 3] >= 524288 )// 8.0(0x80000) 0x196A9FF >=0x80000 { bFound = true; break; @@ -5760,7 +5760,7 @@ if ( on_water ) pAudioPlayer->PlaySound(SOUND_RunAlongWater, 804, 1, -1, 0, 0, 0, 0); else if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_INDOOR_CARPET )// - pAudioPlayer->PlaySound((SoundID)50, 804, 1, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_50, 804, 1, -1, 0, 0, 0, 0); else pAudioPlayer->PlaySound(SOUND_RunAlong3DModel, 804, 1, -1, 0, 0, 0, 0); pParty->walk_sound_timer = 96;//64 @@ -5773,7 +5773,7 @@ if ( on_water ) pAudioPlayer->PlaySound(SOUND_WalkAlongWater, 804, 1, -1, 0, 0, 0, 0); else if ( pIndoor->pFaces[uFaceID].uAttributes & FACE_INDOOR_CARPET )// - pAudioPlayer->PlaySound((SoundID)89, 804, 1, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_89, 804, 1, -1, 0, 0, 0, 0); else pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0); pParty->walk_sound_timer = 144;//64 diff -r 160e12614310 -r 28afacb08f76 Engine/Graphics/Indoor.h --- a/Engine/Graphics/Indoor.h Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Graphics/Indoor.h Thu Oct 02 19:33:11 2014 +0600 @@ -469,7 +469,7 @@ #define FACE_FLUID 0x00000010 // wavy animated water or lava #define FACE_FLOW_VERTICAL 0x00000020 // Vertical flow of the lava or water #define FACE_DONT_CACHE_TEXTURE 0x00000040 // do not load face texture if it isn't loaded already -#define FACE_UNKNOW4 0x00000080 +#define FACE_UNKNOW7 0x00000080 #define FACE_XY_PLANE 0x00000100 #define FACE_XZ_PLANE 0x00000200 #define FACE_YZ_PLANE 0x00000400 diff -r 160e12614310 -r 28afacb08f76 Engine/Graphics/LightmapBuilder.cpp --- a/Engine/Graphics/LightmapBuilder.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Graphics/LightmapBuilder.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -31,12 +31,29 @@ //----- (0045DF13) -------------------------------------------------------- Lightmap::Lightmap() { - field_C18 = 0; + uNumVertices = -1; + for (uint i = 0; i < 64; ++i) + pVertices[i].flt_2C = 0.0f; + this->field_C18 = 0; + //this->vdestructor_ptr = &Lightmap_pvdtor; } //----- (0045BB06) -------------------------------------------------------- LightmapBuilder::LightmapBuilder() { + char *v2; // eax@1 + signed int v3; // ecx@1 + + for ( int i = 0; i < 512; ++i ) + this->std__vector_000004[i] = Lightmap(); + this->std__vector_000004_size = 0; + + for ( int i = 0; i < 768; ++i ) + this->std__vector_183808[i] = Lightmap(); + this->std__vector_183808_size = 0; + + for ( int i = 0; i < 256; i++ ) + this->field_3C8C34[i].flt_2C = 0.0f; } //----- (0045BC07) -------------------------------------------------------- @@ -542,12 +559,9 @@ if (!pLight->uRadius) return false; - if (pLight->vPosition.x > a2->pBounding.x1 - pLight->uRadius && - pLight->vPosition.x < a2->pBounding.x2 + pLight->uRadius && - pLight->vPosition.y > a2->pBounding.y1 - pLight->uRadius && - pLight->vPosition.y < a2->pBounding.y2 + pLight->uRadius && - pLight->vPosition.z > a2->pBounding.z1 - pLight->uRadius && - pLight->vPosition.z < a2->pBounding.z2 + pLight->uRadius) + if (pLight->vPosition.x > a2->pBounding.x1 - pLight->uRadius && pLight->vPosition.x < a2->pBounding.x2 + pLight->uRadius && + pLight->vPosition.y > a2->pBounding.y1 - pLight->uRadius && pLight->vPosition.y < a2->pBounding.y2 + pLight->uRadius && + pLight->vPosition.z > a2->pBounding.z1 - pLight->uRadius && pLight->vPosition.z < a2->pBounding.z2 + pLight->uRadius) { v13 = (double)pLight->vPosition.z * a2->pFacePlane.vNormal.z + (double)pLight->vPosition.y * a2->pFacePlane.vNormal.y + @@ -745,11 +759,6 @@ { float v7; // esi@1 int v8; // eax@1 -// int v9; // ebx@1 -// unsigned int v10; // ecx@1 -// int v11; // edx@2 -// int v12; // edx@4 -// unsigned int v13; // edx@6 double v14; // st7@7 double result; // st7@8 double v16; // st7@9 @@ -859,13 +868,8 @@ { int result; // eax@0 int v10; // ecx@8 - //unsigned int v12; // ebx@11 - //RenderD3D *v13; // ecx@11 char v14; // dl@11 - //__debugbreak(); - - result = (int)pFace; v10 = (pFace->pFacePlane.dist + pLight->vPosition.x * pFace->pFacePlane.vNormal.x + pLight->vPosition.y * pFace->pFacePlane.vNormal.y @@ -907,11 +911,10 @@ } } ++*pSlot; - LOBYTE(result) = 1; + return true; } else - LOBYTE(result) = 0; - return result; + return false; } // 4E94D2: using guessed type char _4E94D2_light_type; @@ -993,53 +996,18 @@ { StationaryLight *v8; // edi@1 bool result; // eax@1 -// unsigned int v10; // esi@2 RenderVertexSoft *v11; // ebx@2 float v12; // eax@3 float v13; // eax@4 -// double v14; // st7@11 double maxz; // st7@11 double v16; // st7@11 double v17; // st6@11 -// __int16 v18; // fps@11 -// char v19; // c0@11 char v20; // c2@11 -// char v21; // c3@11 -// double v22; // st6@12 -// __int16 v23; // fps@12 -// char v24; // c0@12 -// char v25; // c2@12 -// char v26; // c3@12 -// double v27; // st7@13 -// double v28; // st6@13 -// __int16 v29; // fps@13 -// char v30; // c0@13 -// char v31; // c2@13 -// char v32; // c3@13 -// double v33; // st6@14 -// __int16 v34; // fps@14 -// char v35; // c0@14 -// char v36; // c2@14 -// char v37; // c3@14 -// double v38; // st7@15 -// double v39; // st6@15 -// __int16 v40; // fps@15 -// char v41; // c0@15 -// char v42; // c2@15 -// char v43; // c3@15 -// double v44; // st6@16 -// __int16 v45; // fps@16 -// char v46; // c0@16 -// char v47; // c2@16 -// char v48; // c3@16 Vec3_float_ *v49; // esi@17 -// double v50; // st7@17 -// double v51; // st6@17 signed int v52; // ecx@17 unsigned int *v53; // esi@18 int v54; // eax@18 unsigned int v55; // ebx@18 - //RenderD3D *v56; // ecx@18 char v57; // dl@18 std::string v58; // [sp-18h] [bp-38h]@10 const char *v59; // [sp-8h] [bp-28h]@10 @@ -1272,42 +1240,9 @@ //----- (0045D74F) -------------------------------------------------------- bool LightmapBuilder::DrawLightmaps(int *indices) { - //char v3; // zf@1 -// IDirect3DDevice3 *v4; // eax@2 -// HRESULT v5; // eax@2 - //char *v6; // eax@2 - //struct IDirect3DTexture2 *v7; // edi@4 -// HRESULT v8; // eax@8 -// HRESULT v9; // eax@8 -// HRESULT v10; // eax@8 -// HRESULT v11; // eax@8 -// HRESULT v12; // eax@8 - //int *v13; // eax@8 - //float v14; // ecx@15 - //IDirect3DDevice3 *v15; // eax@21 - //HRESULT v16; // eax@21 - //IDirect3DDevice3 *v17; // eax@21 - //HRESULT v18; // eax@21 - //IDirect3DDevice3 *v19; // eax@21 - //HRESULT v20; // eax@21 - //IDirect3DDevice3 *v21; // eax@21 - //HRESULT v22; // eax@21 - //IDirect3DDevice3 *v23; // eax@23 std::string v25; // [sp+44h] [bp-44h]@12 -// signed int v26; // [sp+48h] [bp-40h]@21 -// signed int v27; // [sp+4Ch] [bp-3Ch]@21 Lightmap *v28; // [sp+50h] [bp-38h]@2 -// int v29; // [sp+54h] [bp-34h]@2 - //float v30; // [sp+58h] [bp-30h]@2 Vec3_float_ arg4; - //int arg4; // [sp+68h] [bp-20h]@8 - //float v32; // [sp+6Ch] [bp-1Ch]@8 - //float v33; // [sp+70h] [bp-18h]@8 -// int v34; // [sp+74h] [bp-14h]@19 -// int v35; // [sp+78h] [bp-10h]@2 - //int *v36; // [sp+7Ch] [bp-Ch]@10 - //int a1; // [sp+80h] [bp-8h]@12 - //float v38; // [sp+84h] [bp-4h]@1 if (std__vector_000004_size == 0) return true; @@ -1365,11 +1300,8 @@ { double v10; // st7@4 double v14; // st7@7 -// __int16 v15; // fps@8 double v18; // st3@8 signed int v24; // [sp-1Ch] [bp-670h]@13 -// const char *v25; // [sp-18h] [bp-66Ch]@13 -// int v26; // [sp-14h] [bp-668h]@13 RenderVertexD3D3 a2[32]; // [sp+0h] [bp-654h]@7 diff -r 160e12614310 -r 28afacb08f76 Engine/Graphics/Outdoor.cpp --- a/Engine/Graphics/Outdoor.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Graphics/Outdoor.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -139,11 +139,11 @@ pGame->PrepareBloodsplats(); if (bRedraw) pOutdoor->UpdateDiscoveredArea(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y), 1); - pGame->uFlags2 &= 0xFFFFFFFEu; + pGame->uFlags2 &= 0xFFFFFFFEu;//~0x00000001 if (/*pRenderer->pRenderD3D*/true && pRenderer->bUsingSpecular) pGame->pLightmapBuilder->uFlags |= 1; else - pGame->pLightmapBuilder->uFlags &= 0xFFFFFFFEu; + pGame->pLightmapBuilder->uFlags &= 0xFFFFFFFEu;//~0x00000001 uNumDecorationsDrawnThisFrame = 0; uNumSpritesDrawnThisFrame = 0; @@ -3218,7 +3218,7 @@ { //LOBYTE(pParty->uFlags) &= 0x7Fu; bWaterWalk = true; - *(short *)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; + *(short *)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1; if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) && pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 ) bWaterWalk = false; diff -r 160e12614310 -r 28afacb08f76 Engine/Graphics/Render.cpp --- a/Engine/Graphics/Render.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Graphics/Render.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -910,7 +910,7 @@ { unsigned int v6; // edi@9 int v7; // eax@9 - SpriteFrame *v8; // eax@9 + SpriteFrame *frame; // eax@9 unsigned __int16 *v10; // eax@9 int v13; // ecx@9 int v14; // ecx@20 @@ -968,11 +968,11 @@ case 486: // tree04 case 492: // tree10 pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 2); - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 2, v6 + v7); + frame = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 2, v6 + v7); break; default: - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + frame = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); } break; @@ -980,7 +980,7 @@ switch (decor_desc->uSpriteID) { } - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + frame = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); break; case 8: case 9: case 10: // autumn @@ -996,23 +996,23 @@ case 486: // tree04 case 492: // tree10 pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 1); - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 1, v6 + v7); + frame = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 1, v6 + v7); break; default: - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + frame = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); } break; case 5: case 6: case 7: // summer //all green by default - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + frame = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); break; default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); } else - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + frame = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); #pragma endregion //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); @@ -1021,15 +1021,15 @@ v38 = 0; v13 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + pLevelDecorations[i].field_10_y_rot - (signed int)v10) >> 8) & 7; v37 = (unsigned __int16 *)v13; - if ( v8->uFlags & 2 ) + if ( frame->uFlags & 2 ) v38 = 2; - if ( (256 << v13) & v8->uFlags ) + if ( (256 << v13) & frame->uFlags ) v38 |= 4; - if ( v8->uFlags & 0x40000 ) + if ( frame->uFlags & 0x40000 ) v38 |= 0x40; - if ( v8->uFlags & 0x20000 ) + if ( frame->uFlags & 0x20000 ) LOBYTE(v38) = v38 | 0x80; - if ( v8->uGlowRadius ) + if ( frame->uGlowRadius ) { if ( pRenderD3D && bUseColoredLights ) { @@ -1044,7 +1044,7 @@ v15 = 255; } pStationaryLightsStack->AddLight(pLevelDecorations[i].vPosition.x, pLevelDecorations[i].vPosition.y, pLevelDecorations[i].vPosition.z + decor_desc->uDecorationHeight / 2, - v8->uGlowRadius, v14, v15, v16, _4E94D0_light_type); + frame->uGlowRadius, v14, v15, v16, _4E94D0_light_type); } v17 = (pLevelDecorations[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; if (pGame->pIndoorCameraD3D->sRotationX) @@ -1064,25 +1064,25 @@ HIDWORD(v24) = SLOWORD(pODMRenderParams->int_fov_rad); v25 = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v24 / v20, v21) + 0x8000) >> 16); v40 = pViewport->uScreenCenterY - ((signed int)(fixpoint_mul(v24 / v20, v22) + 0x8000) >> 16); - v41 = fixpoint_mul(v8->scale, v24 / v20); + v41 = fixpoint_mul(frame->scale, v24 / v20); if ( pRenderD3D ) - b = fixpoint_mul(pSprites_LOD->pHardwareSprites[v8->pHwSpriteIDs[(int)v37]].uBufferWidth / 2, v41); + b = fixpoint_mul(pSprites_LOD->pHardwareSprites[frame->pHwSpriteIDs[(int)v37]].uBufferWidth / 2, v41); else { __debugbreak(); - b = fixpoint_mul(pSprites_LOD->pSpriteHeaders[v8->pHwSpriteIDs[(int)v37]].uWidth / 2, v41); + b = fixpoint_mul(pSprites_LOD->pSpriteHeaders[frame->pHwSpriteIDs[(int)v37]].uWidth / 2, v41); } if ( b + v25 >= (signed int)pViewport->uViewportTL_X && v25 - b <= (signed int)pViewport->uViewportBR_X ) { if (::uNumBillboardsToDraw >= 500) return; - pBillboardRenderList[::uNumBillboardsToDraw].HwSpriteID = v8->pHwSpriteIDs[(int)v37]; + pBillboardRenderList[::uNumBillboardsToDraw].HwSpriteID = frame->pHwSpriteIDs[(int)v37]; pBillboardRenderList[::uNumBillboardsToDraw]._screenspace_x_scaler_packedfloat = v41; pBillboardRenderList[::uNumBillboardsToDraw]._screenspace_y_scaler_packedfloat = v41; v29 = v38; pBillboardRenderList[::uNumBillboardsToDraw].uScreenSpaceX = v25; HIBYTE(v29) |= 2; - pBillboardRenderList[::uNumBillboardsToDraw].uPalette = v8->uPaletteIndex; + pBillboardRenderList[::uNumBillboardsToDraw].uPalette = frame->uPaletteIndex; pBillboardRenderList[::uNumBillboardsToDraw].field_1E = v29; pBillboardRenderList[::uNumBillboardsToDraw].world_x = pLevelDecorations[i].vPosition.x; pBillboardRenderList[::uNumBillboardsToDraw].world_y = pLevelDecorations[i].vPosition.y; @@ -1094,7 +1094,7 @@ pBillboardRenderList[::uNumBillboardsToDraw].uIndoorSectorID = 0; pBillboardRenderList[::uNumBillboardsToDraw].sZValue = v30 + v31; pBillboardRenderList[::uNumBillboardsToDraw].dimming_level = 0; - pBillboardRenderList[::uNumBillboardsToDraw].pSpriteFrame = v8; + pBillboardRenderList[::uNumBillboardsToDraw].pSpriteFrame = frame; pBillboardRenderList[::uNumBillboardsToDraw].sTintColor = 0; ::uNumBillboardsToDraw++; ++uNumDecorationsDrawnThisFrame; @@ -1119,25 +1119,25 @@ HIDWORD(v24) = SLOWORD(pODMRenderParams->int_fov_rad); v25 = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v24 / v20, v21) + 0x8000) >> 16); v40 = pViewport->uScreenCenterY - ((signed int)(fixpoint_mul(v24 / v20, v42) + 0x8000) >> 16); - v41 = fixpoint_mul(v8->scale, v24 / v20); + v41 = fixpoint_mul(frame->scale, v24 / v20); if ( pRenderD3D ) - b = fixpoint_mul(pSprites_LOD->pHardwareSprites[v8->pHwSpriteIDs[(int)v37]].uBufferWidth / 2, v41); + b = fixpoint_mul(pSprites_LOD->pHardwareSprites[frame->pHwSpriteIDs[(int)v37]].uBufferWidth / 2, v41); else { __debugbreak(); - b = fixpoint_mul(pSprites_LOD->pSpriteHeaders[v8->pHwSpriteIDs[(int)v37]].uWidth / 2, v41); + b = fixpoint_mul(pSprites_LOD->pSpriteHeaders[frame->pHwSpriteIDs[(int)v37]].uWidth / 2, v41); } if ( b + v25 >= (signed int)pViewport->uViewportTL_X && v25 - b <= (signed int)pViewport->uViewportBR_X ) { if (::uNumBillboardsToDraw >= 500) return; - pBillboardRenderList[::uNumBillboardsToDraw].HwSpriteID = v8->pHwSpriteIDs[(int)v37]; + pBillboardRenderList[::uNumBillboardsToDraw].HwSpriteID = frame->pHwSpriteIDs[(int)v37]; pBillboardRenderList[::uNumBillboardsToDraw]._screenspace_x_scaler_packedfloat = v41; pBillboardRenderList[::uNumBillboardsToDraw]._screenspace_y_scaler_packedfloat = v41; v29 = v38; pBillboardRenderList[::uNumBillboardsToDraw].uScreenSpaceX = v25; HIBYTE(v29) |= 2; - pBillboardRenderList[::uNumBillboardsToDraw].uPalette = v8->uPaletteIndex; + pBillboardRenderList[::uNumBillboardsToDraw].uPalette = frame->uPaletteIndex; pBillboardRenderList[::uNumBillboardsToDraw].field_1E = v29; pBillboardRenderList[::uNumBillboardsToDraw].world_x = pLevelDecorations[i].vPosition.x; pBillboardRenderList[::uNumBillboardsToDraw].world_y = pLevelDecorations[i].vPosition.y; @@ -1149,7 +1149,7 @@ pBillboardRenderList[::uNumBillboardsToDraw].uIndoorSectorID = 0; pBillboardRenderList[::uNumBillboardsToDraw].sZValue = v30 + v31; pBillboardRenderList[::uNumBillboardsToDraw].dimming_level = 0; - pBillboardRenderList[::uNumBillboardsToDraw].pSpriteFrame = v8; + pBillboardRenderList[::uNumBillboardsToDraw].pSpriteFrame = frame; pBillboardRenderList[::uNumBillboardsToDraw].sTintColor = 0; ::uNumBillboardsToDraw++; ++uNumDecorationsDrawnThisFrame; diff -r 160e12614310 -r 28afacb08f76 Engine/Graphics/RenderD3D11.cpp --- a/Engine/Graphics/RenderD3D11.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Graphics/RenderD3D11.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -253,7 +253,7 @@ } ErrorD3D(pSwapChain->SetFullscreenState(fullscreen, nullptr));*/ - + ID3D11Texture2D *pSwapChainSurface; { ErrorD3D(pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void **)&pSwapChainSurface)); diff -r 160e12614310 -r 28afacb08f76 Engine/Graphics/RenderD3D11.h diff -r 160e12614310 -r 28afacb08f76 Engine/Graphics/Sprites.cpp --- a/Engine/Graphics/Sprites.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Graphics/Sprites.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -263,14 +263,7 @@ //----- (0044D8D0) -------------------------------------------------------- SpriteFrame *SpriteFrameTable::GetFrame(unsigned int uSpriteID, unsigned int uTime) { - //SpriteFrame *v3; // edi@1 SpriteFrame *v4; // ecx@1 - //__int16 v5; // dx@2 - //int v6; // edx@3 - //unsigned int v7; // eax@3 - //char *i; // ecx@3 - //int v9; // esi@5 - //SpriteFrame *result; // eax@6 v4 = &pSpriteSFrames[uSpriteID]; if (~v4->uFlags & 1 || !v4->uAnimLength) diff -r 160e12614310 -r 28afacb08f76 Engine/LOD.cpp --- a/Engine/LOD.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/LOD.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -1442,7 +1442,7 @@ pFile = fopen(pFilename, "rb+"); if (!pFile) { - __debugbreak(); + // __debugbreak(); return false;// , } diff -r 160e12614310 -r 28afacb08f76 Engine/MMT.cpp --- a/Engine/MMT.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/MMT.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -1,7 +1,7 @@ #define _CRTDBG_MAP_ALLOC #include #include - +#include #define _CRT_SECURE_NO_WARNINGS #include "MMT.h" @@ -19,6 +19,10 @@ #include "Game.h" #include "Log.h" +bool FileExists(const char *fname) +{ + return access(fname, 0) != -1; +} void ShowLogoVideo() { @@ -84,10 +88,24 @@ { if (!bNoSound && pAudioPlayer->hAILRedbook ) { - pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0)); - AIL_redbook_stop(pAudioPlayer->hAILRedbook); - AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &uTrackStartMS, &uTrackEndMS); - AIL_redbook_play(pAudioPlayer->hAILRedbook, uTrackStartMS + 1, uTrackEndMS); + if ( use_music_folder ) + { + if (!FileExists("Music\\14.mp3")) + { + Log::Warning(L"File 14.mp3 in Music\\ folder not found"); + //Error("File 14.mp3 in Music\\ folder not found"); + return; + } + PlayAudio(L"Music\\14.mp3"); + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + } + else + { + pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0)); + AIL_redbook_stop(pAudioPlayer->hAILRedbook); + AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &uTrackStartMS, &uTrackEndMS); + AIL_redbook_play(pAudioPlayer->hAILRedbook, uTrackStartMS + 1, uTrackEndMS); + } } } bGameoverLoop = 0; @@ -210,8 +228,8 @@ pGUIWindow2 = 0; pAudioPlayer->StopChannels(-1, -1); - //if (!bNoSound ) - //PlayAudio(L"Sounds\\New_Sounds/Stronghold_Theme.mp3"); + if (!bNoSound ) + PlayAudio(L"Sounds\\New_Sounds/Stronghold_Theme.mp3"); //if (!bNoVideo ) //pVideoPlayer->PlayMovie(L"Anims\\New_Video/3DOLOGO.smk"); @@ -346,7 +364,6 @@ { do { - pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, &pParam2); switch (pUIMessageType) @@ -354,7 +371,8 @@ case UIMSG_MMT_MainMenu_MM6: //video //SetCurrentMenuID(MENU_MAIN_MM6); - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);//temporarily + alSourcef (mSourceID, AL_GAIN, 0.5f); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);//temporarily break; case UIMSG_MMT_MainMenu_MM7: //new button for 7 //GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); @@ -365,12 +383,14 @@ case UIMSG_MMT_MainMenu_MM8: //video //SetCurrentMenuID(MENU_MAIN_MM8); - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);//temporarily + alSourcei (mSourceID, AL_LOOPING, 1); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);//temporarily break; case UIMSG_MMT_MainMenu_Continue: //video //SetCurrentMenuID(MENU_MAIN_Continue); - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);//temporarily + alSourcef (mSourceID, AL_GAIN, 1.0f); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);//temporarily break; case UIMSG_ExitToWindows: GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); diff -r 160e12614310 -r 28afacb08f76 Engine/MMT.h --- a/Engine/MMT.h Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/MMT.h Thu Oct 02 19:33:11 2014 +0600 @@ -4,6 +4,8 @@ void MMT_MainMenu_Loop(); void MMT_MenuMessageProc(); void DrawMMTCopyrightWindow(); +extern bool FileExists(const char *fname); extern bool use_MMT; +extern bool use_music_folder; extern bool for_refactoring; \ No newline at end of file diff -r 160e12614310 -r 28afacb08f76 Engine/Objects/Actor.cpp --- a/Engine/Objects/Actor.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Objects/Actor.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -2277,7 +2277,7 @@ v6->uPitchAngle = v16; v6->uAIState = Pursuing; if ( rand() % 100 < 2 ) - Actor::PlaySound(uActorID, 2u); + Actor::PlaySound(uActorID, 2); v6->UpdateAnimation(); } diff -r 160e12614310 -r 28afacb08f76 Engine/Objects/Chest.cpp --- a/Engine/Objects/Chest.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Objects/Chest.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -163,7 +163,7 @@ pSpellObject.spell_target_pid = 0; pSpellObject.uFacing = 0; pSpellObject.Create(0, 0, 0, 0); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Explosion, 0, 0, -1, 0, 0, 0, 0); pSpellObject.ExplosionTraps(); chest->uFlags &= 0xFEu; if ( uActiveCharacter && !_A750D8_player_speech_timer && !OpenedTelekinesis ) diff -r 160e12614310 -r 28afacb08f76 Engine/Objects/Player.cpp --- a/Engine/Objects/Player.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Objects/Player.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -2313,97 +2313,97 @@ { case SPECIAL_ATTACK_CURSE: SetCondition(Condition_Cursed, 1); - pAudioPlayer->PlaySound((SoundID)221, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_221, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_WEAK: SetCondition(Condition_Weak, 1); - pAudioPlayer->PlaySound((SoundID)221, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_221, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_SLEEP: SetCondition(Condition_Sleep, 1); - pAudioPlayer->PlaySound((SoundID)221, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_221, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_DRUNK: SetCondition(Condition_Drunk, 1); - pAudioPlayer->PlaySound((SoundID)221, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_221, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_INSANE: SetCondition(Condition_Insane, 1); - pAudioPlayer->PlaySound((SoundID)224, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_224, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_POISON_WEAK: SetCondition(Condition_Poison_Weak, 1); - pAudioPlayer->PlaySound((SoundID)222, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_222, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_POISON_MEDIUM: SetCondition(Condition_Poison_Medium, 1); - pAudioPlayer->PlaySound((SoundID)222, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_222, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_POISON_SEVERE: SetCondition(Condition_Poison_Severe, 1); - pAudioPlayer->PlaySound((SoundID)222, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_222, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_DISEASE_WEAK: SetCondition(Condition_Disease_Weak, 1); - pAudioPlayer->PlaySound((SoundID)222, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_222, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_DISEASE_MEDIUM: SetCondition(Condition_Disease_Medium, 1); - pAudioPlayer->PlaySound((SoundID)222, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_222, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_DISEASE_SEVERE: SetCondition(Condition_Disease_Severe, 1); - pAudioPlayer->PlaySound((SoundID)222, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_222, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_PARALYZED: SetCondition(Condition_Paralyzed, 1); - pAudioPlayer->PlaySound((SoundID)224, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_224, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_UNCONSCIOUS: SetCondition(Condition_Unconcious, 1); - pAudioPlayer->PlaySound((SoundID)224, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_224, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_DEAD: SetCondition(Condition_Dead, 1); - pAudioPlayer->PlaySound((SoundID)225, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_225, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_PETRIFIED: SetCondition(Condition_Pertified, 1); - pAudioPlayer->PlaySound((SoundID)225, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_225, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_ERADICATED: SetCondition(Condition_Eradicated, 1); - pAudioPlayer->PlaySound((SoundID)225, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_225, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; @@ -2414,7 +2414,7 @@ { PlaySound(SPEECH_40, 0); v48->SetBroken(); - pAudioPlayer->PlaySound((SoundID)47, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_47, 0, 0, -1, 0, 0, 0, 0); } pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; @@ -2433,27 +2433,27 @@ } memcpy(v27, &this->pInventoryItemList[this->pInventoryMatrix[v47]-1], 0x24u); RemoveItemAtInventoryIndex(v47); - pAudioPlayer->PlaySound((SoundID)47, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_47, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_AGING: PlaySound(SPEECH_42, 0); ++this->sAgeModifier; - pAudioPlayer->PlaySound((SoundID)226, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_226, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_MANA_DRAIN: PlaySound(SPEECH_41, 0); this->sMana = 0; - pAudioPlayer->PlaySound((SoundID)226, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_226, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; case SPECIAL_ATTACK_FEAR: SetCondition(Condition_Fear, 1); - pAudioPlayer->PlaySound((SoundID)221, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_221, 0, 0, -1, 0, 0, 0, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); return 1; break; @@ -4322,10 +4322,10 @@ v68 = pParty->pPickedItem.GetDisplayName(); sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way" ShowStatusBarString(pTmpBuf.data(), 2); - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); return; } - pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0); if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) { @@ -4613,11 +4613,11 @@ default: v68 = pParty->pPickedItem.GetDisplayName(); sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way" - ShowStatusBarString(pTmpBuf.data(), 2u); - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + ShowStatusBarString(pTmpBuf.data(), 2); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); return; } - pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_210, 0, 0, -1, 0, 0, 0, 0); if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) { // if ( !v73 ) v73 is always 1 at this point @@ -4654,14 +4654,14 @@ v68 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()]; sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); - ShowStatusBarString(pTmpBuf.data(), 2u); - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + ShowStatusBarString(pTmpBuf.data(), 2); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); return; } if ( bUnderwater == 1 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); return; } @@ -4696,8 +4696,8 @@ { v66 = pParty->pPickedItem.GetDisplayName(); sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell" - ShowStatusBarString(pTmpBuf.data(), 2u); - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + ShowStatusBarString(pTmpBuf.data(), 2); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); return; } if ( !playerAffected->CanAct() ) @@ -4705,7 +4705,7 @@ v66 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()]; sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s" ShowStatusBarString(pTmpBuf.data(), 2); - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); return; } v16 = v15 % 11 + 1; @@ -4771,7 +4771,7 @@ v68 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()]; sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);//That player is %s ShowStatusBarString(pTmpBuf.data(), 2); - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); return; } else @@ -4864,31 +4864,31 @@ break; } - ShowStatusBarString(pTmpBuf.data(), 2u); + ShowStatusBarString(pTmpBuf.data(), 2); pMouse->RemoveHoldingItem(); pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); playerAffected->PlaySound(SPEECH_93, 0); - pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_219, 0, 0, -1, 0, 0, 0, 0); if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) - { - playerAffected->SetCondition(Condition_Eradicated, 0); - pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); - } + { + playerAffected->SetCondition(Condition_Eradicated, 0); + pAudioPlayer->PlaySound(SOUND_215, 0, 0, -1, 0, 0, 0, 0); + } else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) - { - playerAffected->SetCondition(Condition_Dead, 0); - pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); - } + { + playerAffected->SetCondition(Condition_Dead, 0); + pAudioPlayer->PlaySound(SOUND_215, 0, 0, -1, 0, 0, 0, 0); + } else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) { playerAffected->SetCondition(Condition_Pertified, 0); - pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_215, 0, 0, -1, 0, 0, 0, 0); } return; } else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple { - Party::GiveFood(1u); + Party::GiveFood(1); pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0); } else if ( pParty->pPickedItem.uItemID == 632 ) //Lute @@ -4922,8 +4922,8 @@ { v68 = pParty->pPickedItem.GetDisplayName(); sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way" - ShowStatusBarString(pTmpBuf.data(), 2u); - pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); + ShowStatusBarString(pTmpBuf.data(), 2); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); return; } diff -r 160e12614310 -r 28afacb08f76 Engine/Objects/SpriteObject.cpp --- a/Engine/Objects/SpriteObject.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/Objects/SpriteObject.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -1245,7 +1245,7 @@ pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; v13 = 8 * uLayingItemID; LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID); - pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Explosion, v13, 0, -1, 0, 0, 0, 0); return 0; } @@ -1279,7 +1279,7 @@ { v13 = 8 * uLayingItemID; LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID); - pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Explosion, v13, 0, -1, 0, 0, 0, 0); } return 0; } @@ -1339,7 +1339,7 @@ { v13 = 8 * uLayingItemID; LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID); - pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Explosion, v13, 0, -1, 0, 0, 0, 0); return 0; } return 0; @@ -1370,7 +1370,7 @@ AttackerInfo.Add(v38, 512, v40, v39, v37, 0, 0); if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); - pAudioPlayer->PlaySound(SOUND_8, v147, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Explosion, v147, 0, -1, 0, 0, 0, 0); return 0; } diff -r 160e12614310 -r 28afacb08f76 Engine/SaveLoad.cpp --- a/Engine/SaveLoad.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Engine/SaveLoad.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -28,6 +28,7 @@ #include "Engine/Graphics/Level/Decoration.h" #include "Game.h" +#include "MMT.h" @@ -203,7 +204,10 @@ pSavegameThumbnails[i].Release(); pIcons_LOD->RemoveTexturesPackFromTextureList(); - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); + if ( use_music_folder ) + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + else + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); if (uTurnSpeed) pParty->sRotationY = uTurnSpeed * pParty->sRotationY / (signed int)uTurnSpeed; diff -r 160e12614310 -r 28afacb08f76 GUI/GUIWindow.cpp --- a/GUI/GUIWindow.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/GUI/GUIWindow.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -1924,7 +1924,7 @@ case WINDOW_PressedButton2: { if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); pButton = (GUIButton *)pWindow->ptr_1C; if ( pButton->uX >= 0 && pButton->uX <= window->GetWidth() ) { @@ -1953,7 +1953,7 @@ case WINDOW_CharactersPressedButton: { if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); pButton = (GUIButton *)pWindow->ptr_1C; pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); viewparams->bRedrawGameUI = 1; @@ -1968,7 +1968,7 @@ case WINDOW_PressedButton: { if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); pButton = (GUIButton *)pWindow->ptr_1C; pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); viewparams->bRedrawGameUI = 1; @@ -1983,7 +1983,7 @@ case WINDOW_5D: { if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); pButton = (GUIButton *)pWindow->ptr_1C; pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); viewparams->bRedrawGameUI = 1; @@ -1993,7 +1993,7 @@ case WINDOW_SaveLoadBtn: { if (pWindow->Hint != (char *)1) - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); pButton = (GUIButton *)pWindow->ptr_1C; pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); pHint = pWindow->Hint; @@ -2010,7 +2010,7 @@ case WINDOW_LoadGame_CancelBtn: { if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); pButton = (GUIButton *)pWindow->ptr_1C; pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); viewparams->bRedrawGameUI = 1; @@ -2023,7 +2023,7 @@ case WINDOW_CloseRestWindowBtn: { if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); pGUIButton = (GUIButton *)pWindow->ptr_1C; pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]); pHint = pWindow->Hint; @@ -2037,7 +2037,7 @@ case WINDOW_ExitCharacterWindow: { if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); pButton = (GUIButton *)pWindow->ptr_1C; pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); pHint = pWindow->Hint; @@ -2059,7 +2059,7 @@ GUIButton2.uWidth = 171; GUIButton2.uHeight = 37; GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15)); viewparams->bRedrawGameUI = 1; GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);// 8 diff -r 160e12614310 -r 28afacb08f76 GUI/UI/Books/UIMapBook.cpp --- a/GUI/UI/Books/UIMapBook.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/GUI/UI/Books/UIMapBook.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -239,7 +239,7 @@ viewparams->_443225(); if ( BtnUp_flag | BtnDown_flag | Book_PageBtn3_flag | Book_PageBtn4_flag | Book_PageBtn5_flag | Book_PageBtn6_flag ) - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); BtnUp_flag = 0; BtnDown_flag = 0; Book_PageBtn6_flag = 0; @@ -272,52 +272,21 @@ int v28; // edx@21 int v29; // eax@21 double v30; // st7@23 -// signed __int64 v31; // qax@23 -// unsigned short *v32; // edx@23 int textr_width; // esi@23 -// signed int v34; // eax@23 -// signed int v35; // ecx@23 -// int v36; // esi@27 -// int v37; // ecx@27 -// int v38; // edx@31 -// unsigned int v39; // eax@33 -// short *v40; // esi@33 -// short *v41; // edi@33 -// unsigned __int8 v42; // cf@33 -// unsigned int v43; // ecx@33 -// short *v44; // edi@33 -// short *v45; // esi@33 -// int v46; // ecx@33 signed int v47; // esi@38 signed int v48; // ecx@38 int v49; // eax@38 signed int v50; // edx@55 unsigned int v51; // ecx@55 -// int result; // eax@72 int v54; // esi@75 int v55; // eax@75 -// __int16 v56; // si@85 double v57; // st7@85 -// int v58; // ebx@85 -// signed __int64 v59; // qax@85 signed int v60; // edi@85 -// signed __int64 v61; // qax@85 signed int v62; // ebx@85 signed int v63; // esi@85 int v64; // eax@87 -// unsigned int v65; // ebx@95 -// unsigned short *v66; // edx@95 -// unsigned __int16 *v67; // esi@96 -// int v68; // edi@98 -// unsigned __int16 v69; // cx@99 -// signed int v73; // [sp-4h] [bp-48068h]@59 -// unsigned __int16 v74; // [sp-4h] [bp-48068h]@79 - //unsigned short map_texture_16[320 * 460 + 256]; // [sp+Ch] [bp-48058h]@23 -// int v76; // [sp+4800Ch] [bp-58h]@23 - //unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27 unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23 int map_tile_X; // [sp+48020h] [bp-44h]@23 - //unsigned __int16* render16_data; unsigned char* texture8_data; unsigned char* curr_line; int scale_increment; @@ -339,8 +308,6 @@ unsigned int v95; // [sp+48058h] [bp-Ch]@16 int map_tile_Y; // [sp+4805Ch] [bp-8h]@10 const void *v97; // [sp+48060h] [bp-4h]@16 -// unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85 - //int a5a; // [sp+48070h] [bp+Ch]@86 screenCenter_X = (signed int)(tl_x + br_x) / 2; screenCenterY = (signed int)(tl_y + br_y) / 2; @@ -410,7 +377,7 @@ else { black = Color16(0, 0, 0); - teal = Color16(0, 0xFFu, 0xFFu); + teal = Color16(0, 0xFF, 0xFF); uNumBlueFacesInBLVMinimap = 0; if ( pIndoor->pMapOutlines->uNumOutlines ) { @@ -421,16 +388,16 @@ { if ( !(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) ) { - if ( !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW4) - && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW4) )) + if ( !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW7) + && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW7) )) { pIndoor->pMapOutlines->pOutlines[i].uFlags = pIndoor->pMapOutlines->pOutlines[i].uFlags | 1; pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); } } if ( (!(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) - && !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW4) - && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW4) )) + && !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW7) + && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW7) )) || pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) { v93 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX); @@ -545,7 +512,7 @@ else pRenderer->RasterLine2D(v54, screenCenterY - (int)v97, (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X, - screenCenterY - (int)v97, Color16(0xFFu, 0xFFu, 0xFFu)); + screenCenterY - (int)v97, Color16(0xFF, 0xFF, 0xFF)); } } } diff -r 160e12614310 -r 28afacb08f76 GUI/UI/Books/UINotesBooks.cpp --- a/GUI/UI/Books/UINotesBooks.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/GUI/UI/Books/UINotesBooks.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -188,7 +188,7 @@ else//press() { change_flag = true; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_POTION_RECEPIE; pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); } @@ -208,7 +208,7 @@ else { change_flag = true; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_STAT_HINT; pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); } @@ -228,7 +228,7 @@ else { change_flag = true; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_OBELISK; pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); } @@ -248,7 +248,7 @@ else { change_flag = true; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_SEER; pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); } @@ -268,7 +268,7 @@ else { change_flag = true; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_MISC; pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); } @@ -288,7 +288,7 @@ else { change_flag = true; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_TEACHER; pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); } diff -r 160e12614310 -r 28afacb08f76 GUI/UI/UIHouses.cpp --- a/GUI/UI/UIHouses.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/GUI/UI/UIHouses.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -987,8 +987,8 @@ //----- (004B1E92) -------------------------------------------------------- void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound) { - if ( pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId ) - pAudioPlayer->PlaySound((SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId + 300)), + if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId ) + pAudioPlayer->PlaySound((SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId + 300)), 806, 0, -1, 0, 0, 0, 0); } diff -r 160e12614310 -r 28afacb08f76 GUI/UI/UIMainMenu.cpp --- a/GUI/UI/UIMainMenu.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/GUI/UI/UIMainMenu.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -257,8 +257,11 @@ pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; //dword_A74C88 = 0;//??? , - pAudioPlayer->PlayMusicTrack(MUSIC_Credits); + if ( use_music_folder ) + PlayAudio(L"Music\\15.mp3"); + else + pAudioPlayer->PlayMusicTrack(MUSIC_Credits); mm6title_texture.Load("mm6title.pcx", 0); cred_texturet = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); pFile = pEvents_LOD->FindContainer("credits.txt", 0); @@ -332,6 +335,8 @@ } } while ( GetCurrentMenuID() == MENU_CREDITSPROC ); + if ( use_music_folder ) + alSourceStop(mSourceID); pAudioPlayer->_4AA258(1); free(cred_texturet); free(pFontQuick); diff -r 160e12614310 -r 28afacb08f76 GUI/UI/UIPartyCreation.cpp --- a/GUI/UI/UIPartyCreation.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/GUI/UI/UIPartyCreation.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -20,6 +20,7 @@ #include "..\../Engine/texts.h" #include "..\../Engine/mm7_data.h" +#include "..\../Engine/MMT.h" @@ -392,7 +393,10 @@ pMessageQueue_50CBD0->Flush(); - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); + if ( use_music_folder ) + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + else + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; diff -r 160e12614310 -r 28afacb08f76 GUI/UI/UIPopup.cpp --- a/GUI/UI/UIPopup.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/GUI/UI/UIPopup.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -1858,7 +1858,7 @@ { pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 11 + 10, DMGT_FIRE); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Explosion, 0, 0, -1, 0, 0, 0, 0); pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); v39.z = pParty->vPosition.z + pParty->sEyelevel; v39.x = pParty->vPosition.x; @@ -1883,7 +1883,7 @@ pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 71 + 30, DMGT_FIRE); pPlayers[uActiveCharacter]->ItemsEnchant(1); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Explosion, 0, 0, -1, 0, 0, 0, 0); pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); v39.z = pParty->vPosition.z + pParty->sEyelevel; @@ -1909,7 +1909,7 @@ pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 201 + 50, DMGT_FIRE); pPlayers[uActiveCharacter]->ItemsEnchant(5); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Explosion, 0, 0, -1, 0, 0, 0, 0); pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); @@ -1936,7 +1936,7 @@ pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); pPlayers[uActiveCharacter]->SetCondition(Condition_Eradicated, 0); pPlayers[uActiveCharacter]->ItemsEnchant(0); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Explosion, 0, 0, -1, 0, 0, 0, 0); pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); diff -r 160e12614310 -r 28afacb08f76 GUI/UI/UiGame.cpp --- a/GUI/UI/UiGame.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/GUI/UI/UiGame.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -1848,7 +1848,8 @@ { if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && (pIndoor->pFaces[pOutline->uFace1ID].Clickable() || pIndoor->pFaces[pOutline->uFace2ID].Clickable()) && - (pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace1ID].uFaceExtraID].uEventID || pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace2ID].uFaceExtraID].uEventID)) + (pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace1ID].uFaceExtraID].uEventID + || pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace2ID].uFaceExtraID].uEventID)) { if (uNumBlueFacesInBLVMinimap < 49) pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; @@ -1866,7 +1867,8 @@ } continue; } - if (pIndoor->pFaces[pOutline->uFace1ID].uAttributes & FACE_UNKNOW4 || pIndoor->pFaces[pOutline->uFace2ID].uAttributes & FACE_UNKNOW4) + if (pIndoor->pFaces[pOutline->uFace1ID].uAttributes & FACE_UNKNOW7 + || pIndoor->pFaces[pOutline->uFace2ID].uAttributes & FACE_UNKNOW7) { pOutline->uFlags = pOutline->uFlags | 1; pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); @@ -1909,19 +1911,19 @@ unsigned int rotate = pParty->sRotationY & stru_5C6E00->uDoublePiMask; if ( (signed int)rotate <= 1920 ) arrow_idx = 6; - if ( (signed int)rotate < 1664 ) + else if ( (signed int)rotate < 1664 ) arrow_idx = 5; - if ( (signed int)rotate <= 1408 ) + else if ( (signed int)rotate <= 1408 ) arrow_idx = 4; - if ( (signed int)rotate < 1152 ) + else if ( (signed int)rotate < 1152 ) arrow_idx = 3; - if ( (signed int)rotate <= 896 ) + else if ( (signed int)rotate <= 896 ) arrow_idx = 2; - if ( (signed int)rotate < 640 ) + else if ( (signed int)rotate < 640 ) arrow_idx = 1; - if ( (signed int)rotate <= 384 ) + else if ( (signed int)rotate <= 384 ) arrow_idx = 0; - if ( (signed int)rotate < 128 || (signed int)rotate > 1920 ) + else if ( (signed int)rotate < 128 || (signed int)rotate > 1920 ) arrow_idx = 7; pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx]));// diff -r 160e12614310 -r 28afacb08f76 Media/Audio/AudioPlayer.cpp --- a/Media/Audio/AudioPlayer.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Media/Audio/AudioPlayer.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -3,6 +3,8 @@ #include #define _CRT_SECURE_NO_WARNINGS +#include + #include #include "Engine/ZlibWrapper.h" @@ -28,6 +30,7 @@ #include "Media/Video/Bink_Smacker.h" #include "Engine/MM7.h" +#include "Engine/MMT.h" PCMWAVEFORMAT pcmWaveFormat; @@ -84,8 +87,12 @@ { for ( uint i = 1; i < pSoundList->sNumSounds; ++i ) { + //if ( i == 41 ) + //__debugbreak(); sprintf(pSoundName, "%s", pSL_Sounds[i].pSoundName); pSoundDesc = &pSoundList->pSL_Sounds[i]; + //if ( pSL_Sounds[i].uSoundID == 75 ) + //__debugbreak(); if ( pSoundList->pSL_Sounds[i].eType != SOUND_DESC_SYSTEM ) continue; pSoundList->pSL_Sounds[i].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)-1, pSL_Sounds[i].uSoundID); // Ritor result crash exe file @@ -422,17 +429,42 @@ fclose(File); return 1; } - +//char wchar_t +bool char2wchar_t(char *str1, wchar_t *str2) +{ + std::wstringstream st; + st << str1; + return !(st >> str2).fail(); +}; //----- (004AA13F) -------------------------------------------------------- void AudioPlayer::PlayMusicTrack(MusicID eTrack) { - if (!bNoSound && bPlayerReady && hAILRedbook && uMusicVolimeMultiplier) + char string[256]; + wchar_t *wStr = new wchar_t; + if (!bNoSound && bPlayerReady && uMusicVolimeMultiplier) { - AIL_redbook_stop(hAILRedbook); - AIL_redbook_set_volume(hAILRedbook, (signed)pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); - AIL_redbook_track_info(hAILRedbook, eTrack, &uCurrentMusicTrackStartMS, &uCurrentMusicTrackEndMS); - AIL_redbook_play(hAILRedbook, uCurrentMusicTrackStartMS + 1, uCurrentMusicTrackEndMS); - uCurrentMusicTrackLength = ((uCurrentMusicTrackEndMS - uCurrentMusicTrackStartMS) * 128) / 1000; + if ( use_music_folder ) + { + alSourceStop(mSourceID); + sprintf(string, "Music\\%d.mp3", eTrack); + if (!FileExists(string)) + { + Log::Warning(L"File 14.mp3 in Music\\ folder not found"); + return; + } + char2wchar_t(string,wStr); + PlayAudio(wStr); + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + delete [] wStr; + } + else if ( hAILRedbook ) + { + AIL_redbook_stop(hAILRedbook); + AIL_redbook_set_volume(hAILRedbook, (signed)pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); + AIL_redbook_track_info(hAILRedbook, eTrack, &uCurrentMusicTrackStartMS, &uCurrentMusicTrackEndMS); + AIL_redbook_play(hAILRedbook, uCurrentMusicTrackStartMS + 1, uCurrentMusicTrackEndMS); + uCurrentMusicTrackLength = ((uCurrentMusicTrackEndMS - uCurrentMusicTrackStartMS) * 128) / 1000; + } } } @@ -532,10 +564,7 @@ int v52; // eax@104 float v53; // ST0C_4@106 float v54; // ST04_4@106 -// SoundDesc *pSoundDesc; // edx@107 -// SpriteObject *pLayingItem3; // eax@114 signed int v62; // esi@133 -// int v68; // eax@143 unsigned int v86; // [sp+14h] [bp-60h]@84 RenderVertexSoft pRenderVertexSoft; // [sp+24h] [bp-50h]@1 int v90; // [sp+58h] [bp-1Ch]@68 @@ -606,11 +635,7 @@ if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done ) { AIL_init_sample(pMixerChannels[j].hSample); - char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id]; - //if (sound_data_id == 0) p = p + 4;//for RIFF - //if ( eSoundID == 75 )// Ritor1: include +7 for pSounds[20] - //p = p + 7; - AIL_set_sample_file(pMixerChannels[j].hSample, p, -1); + AIL_set_sample_file(pMixerChannels[j].hSample, pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id]->pData, -1); if ( sample_volume == 10000 ) sample_volume = uMasterVolume; if (uVolume) @@ -654,30 +679,25 @@ FreeChannel(&pMixerChannels[13]); }*/ AIL_init_sample(pMixerChannels[13].hSample); - char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id]; - if (sound_data_id == 0) - p = p + 4;//for RIFF - if ( eSoundID == 75 )// Ritor1: include +7 for pSounds[20] - p = p + 7; - AIL_set_sample_file(pMixerChannels[13].hSample, p, -1); - if ( sample_volume == 10000 ) - sample_volume = uMasterVolume; - if (uVolume) - sample_volume = uVolume; - AIL_set_sample_volume(pMixerChannels[13].hSample, sample_volume); - int object_type = PID_TYPE(pid), - object_id = PID_ID(pid); - if (uNumRepeats) - AIL_set_sample_loop_count(pMixerChannels[13].hSample, uNumRepeats - 1); - pMixerChannels[13].uSourceTrackIdx = sound_id; - pMixerChannels[13].source_pid = pid; - pMixerChannels[13].uSourceTrackID = eSoundID; - int rval = AIL_start_sample(pMixerChannels[13].hSample);//no sound chest close - if ( sPlaybackRate ) - AIL_set_sample_playback_rate(pMixerChannels[13].hSample, sPlaybackRate); - if (object_type == OBJECT_Player) - AIL_sample_ms_position(pMixerChannels[13].hSample, &sLastTrackLengthMS, 0); - return; + AIL_set_sample_file(pMixerChannels[13].hSample, pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id]->pData, -1); + if ( sample_volume == 10000 ) + sample_volume = uMasterVolume; + if (uVolume) + sample_volume = uVolume; + AIL_set_sample_volume(pMixerChannels[13].hSample, sample_volume); + int object_type = PID_TYPE(pid), + object_id = PID_ID(pid); + if (uNumRepeats) + AIL_set_sample_loop_count(pMixerChannels[13].hSample, uNumRepeats - 1); + pMixerChannels[13].uSourceTrackIdx = sound_id; + pMixerChannels[13].source_pid = pid; + pMixerChannels[13].uSourceTrackID = eSoundID; + int rval = AIL_start_sample(pMixerChannels[13].hSample);//no sound chest close + if ( sPlaybackRate ) + AIL_set_sample_playback_rate(pMixerChannels[13].hSample, sPlaybackRate); + if (object_type == OBJECT_Player) + AIL_sample_ms_position(pMixerChannels[13].hSample, &sLastTrackLengthMS, 0); + return; } else if (pid < 0) // exclusive sounds - no override (close chest) { @@ -699,9 +719,8 @@ { AIL_init_sample(pMixerChannels[j].hSample); char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id]; - if (sound_data_id == 0) p = p + 4;//for RIFF - if ( eSoundID == 75 )// Ritor1: include +7 for pSounds[20] - p = p + 7; + if (sound_data_id == 0) + p = p + 4;//for RIFF AIL_set_sample_file(pMixerChannels[j].hSample, p, -1); if ( sample_volume == 10000 ) sample_volume = uMasterVolume; @@ -2230,13 +2249,13 @@ } pAudioPlayer->sRedbookVolume = AIL_redbook_volume(hAILRedbook); pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); - //unsigned __int64 t = (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f); - if ( bPlayerReady && hAILRedbook ) - //AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f)); - AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f) >> 32); - //int v = AIL_redbook_volume(pAudioPlayer->hAILRedbook); - //if (v) - //__debugbreak(); + if ( bPlayerReady ) + { + if ( use_music_folder ) + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + else if ( hAILRedbook ) + AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f) >> 32); + } LoadAudioSnd(); } @@ -2711,13 +2730,9 @@ { pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize = pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize; if ( pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize ) - { ReadFile(pAudioPlayer->hAudioSnd, pOutBuff->pData, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize, &NumberOfBytesRead, 0);// Ritor1: pSounds[20] - } else - { MessageBoxW(nullptr, L"Can't load sound file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Sound.cpp:448", 0); - } } else { @@ -2726,9 +2741,18 @@ zlib::MemUnzip(pOutBuff->pData, &pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize, (const void *)uID, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize); free((void *)uID); } + if ( pOutBuff ) { pOutBuff->uDataSize = pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize; + + if ( uID == SOUND_StartMainChoice02 )//Ritor1: code included (BUG) + { + char *p = (char *)pOutBuff->pData; + p = p+7; + memcpy(&pOutBuff->pData, p, NumberOfBytesRead - 7); + pOutBuff->uDataSize = NumberOfBytesRead - 7; + } uLastLoadedSoundID = 0; if ( pSounds[0].pSoundData ) { diff -r 160e12614310 -r 28afacb08f76 Media/Audio/AudioPlayer.h --- a/Media/Audio/AudioPlayer.h Thu Oct 02 19:33:01 2014 +0600 +++ b/Media/Audio/AudioPlayer.h Thu Oct 02 19:33:11 2014 +0600 @@ -75,22 +75,29 @@ { SOUND_Invalid = 0, SOUND_EnteringAHouse = 6, - SOUND_7 = 7, - SOUND_8 = 0x8, - SOUND_24 = 24, + SOUND_WoodDRClose = 7, + SOUND_Explosion = 0x8, + SOUND_20 = 0x14, + SOUND_21 = 0x15, + SOUND_23 = 0x17, + SOUND_24 = 0x18, SOUND_error = 27, + SOUND_47 = 0x2F, + SOUND_48 = 0x30, + SOUND_50 = 50, SOUND_RunAlongWater = 63, SOUND_RunAlong3DModel = 64, SOUND_Button = 66, SOUND_67 = 67, SOUND_71 = 71, - SOUND_Button2 = 75, + SOUND_StartMainChoice02 = 75, SOUND_78 = 78, SOUND_80 = 80, SOUND_81 = 81, SOUND_83 = 83, SOUND_84 = 84, SOUND_85 = 85, + SOUND_89 = 89, SOUND_WalkAlongWater = 102, SOUND_WalkAlong3DModel = 103, SOUND_Arcomage_LoseResources = 0x78, @@ -111,14 +118,26 @@ SOUND_PlayGryphonheartsTrumpet = 135, // 87 SOUND_GoldReceived = 0xC8, SOUND_203 = 203, + SOUND_204 = 204, SOUND_206 = 206, SOUND_207 = 207, SOUND_OpenChest = 208, SOUND_PlayerCantCastSpell = 0xD1, + SOUND_210 = 0xD2, SOUND_EatApple = 211, // D3 + SOUND_215 = 0xD7, SOUND_Bell = 0xD9, + SOUND_shurch = 0xDA, //218 + SOUND_219 = 0xDB, + SOUND_221 = 0xDD, + SOUND_222 = 0xDE, + SOUND_224 = 0xE0, + SOUND_225 = 0xE1, + SOUND_226 = 0xE2, + SOUND_227 = 0xE3, SOUND_OpenBook = 230, SOUND_CloseBook = 231, + SOUND_hf445a = 0x169C, SOUND_11090 = 11090, SOUND_12040 = 12040, SOUND_Arena_Welcome = 14060, @@ -241,6 +260,17 @@ SOUND_DESC_LOCK = 0x4, }; +struct TSearchRec +{ +int Time; +int Size; +int Attr; +char Name[32]; +int ExcludeAttr; +int FindHandle; +_WIN32_FIND_DATAA FindData; +} ; + /* 326 */ enum SOUND_DESC_FLAGS { diff -r 160e12614310 -r 28afacb08f76 Media/MediaPlayer.cpp --- a/Media/MediaPlayer.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/Media/MediaPlayer.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -19,6 +19,7 @@ #include "Engine/Timer.h" #include "Engine/Graphics/Render.h" #include "Engine/Game.h" +#include "Engine/MMT.h" #pragma comment(lib, "Version.lib") @@ -369,7 +370,11 @@ } if (!decoded) + { log("Cannot decode audio frame in one piece\n"); + break; + } + } while (!decoded); switch (dec_ctx->codec_id) @@ -1058,8 +1063,10 @@ if (!this->bPlaying_Movie) { pEventTimer->Pause(); - if (pAudioPlayer->hAILRedbook) - AIL_redbook_pause(pAudioPlayer->hAILRedbook); + if ( use_music_folder ) + alSourcePause(mSourceID); + else if (pAudioPlayer->hAILRedbook) + AIL_redbook_pause(pAudioPlayer->hAILRedbook); bStopBeforeSchedule = false; bFirstFrame = false; @@ -1076,7 +1083,9 @@ { //Prepare(); pEventTimer->Pause(); - if (pAudioPlayer->hAILRedbook) + if ( use_music_folder ) + alSourcePause(mSourceID); + else if (pAudioPlayer->hAILRedbook) AIL_redbook_pause(pAudioPlayer->hAILRedbook); bStopBeforeSchedule = false; @@ -1352,12 +1361,20 @@ Sleep(1500); // let the copyright window stay for a while #endif - if (!bNoSound && pAudioPlayer->hAILRedbook ) + if (!bNoSound ) { - pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0)); - AIL_redbook_stop(pAudioPlayer->hAILRedbook); - AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &uTrackStartMS, &uTrackEndMS); - AIL_redbook_play(pAudioPlayer->hAILRedbook, uTrackStartMS + 1, uTrackEndMS); + if ( use_music_folder ) + { + PlayAudio(L"Music\\14.mp3"); + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + } + else if ( pAudioPlayer->hAILRedbook ) + { + pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0)); + AIL_redbook_stop(pAudioPlayer->hAILRedbook); + AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &uTrackStartMS, &uTrackEndMS); + AIL_redbook_play(pAudioPlayer->hAILRedbook, uTrackStartMS + 1, uTrackEndMS); + } } bGameoverLoop = false; } @@ -1368,8 +1385,13 @@ bPlaying_Movie = false; uMovieType = 0; memset(pCurrentMovieName, 0, 0x40); - if ( pAudioPlayer->hAILRedbook && !bGameoverLoop ) - AIL_redbook_resume(pAudioPlayer->hAILRedbook); + if ( !bGameoverLoop && pMediaPlayer->current_movie_width == 460) + { + if ( use_music_folder ) + alSourcePlay(mSourceID); + else if ( pAudioPlayer->hAILRedbook ) + AIL_redbook_resume(pAudioPlayer->hAILRedbook); + } pEventTimer->Resume(); pMovie_Track->Release(); diff -r 160e12614310 -r 28afacb08f76 OSWindow.cpp --- a/OSWindow.cpp Thu Oct 02 19:33:01 2014 +0600 +++ b/OSWindow.cpp Thu Oct 02 19:33:11 2014 +0600 @@ -322,8 +322,13 @@ //BackToHouseMenu(); } } - if ( pAudioPlayer->hAILRedbook && !bGameoverLoop && !pMovie_Track)//!pVideoPlayer->pSmackerMovie ) - AIL_redbook_resume(pAudioPlayer->hAILRedbook); + if ( !bGameoverLoop && !pMovie_Track )//continue an audio track + { + if ( use_music_folder ) + alSourcePlay(mSourceID); + else if ( pAudioPlayer->hAILRedbook )//!pVideoPlayer->pSmackerMovie ) + AIL_redbook_resume(pAudioPlayer->hAILRedbook); + } } } else @@ -348,7 +353,9 @@ if (pAudioPlayer != nullptr) { pAudioPlayer->StopChannels(-1, -1);// - if ( pAudioPlayer->hAILRedbook ) + if ( use_music_folder ) + alSourcePause(mSourceID); + else if ( pAudioPlayer->hAILRedbook ) AIL_redbook_pause(pAudioPlayer->hAILRedbook); } }