# HG changeset patch # User Ritor1 # Date 1412229151 -21600 # Node ID 491f0babd563c5573875d914bb699946a7a243fd # Parent 6dcc6e8dd0416c6f82fb620c0cbc51a7db68036b use_music_folder diff -r 6dcc6e8dd041 -r 491f0babd563 Arcomage/Arcomage.cpp --- a/Arcomage/Arcomage.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Arcomage/Arcomage.cpp Thu Oct 02 11:52:31 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 6dcc6e8dd041 -r 491f0babd563 Engine/Game.cpp --- a/Engine/Game.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/Game.cpp Thu Oct 02 11:52:31 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 ) { @@ -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 @@ -4756,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; @@ -4962,11 +4974,11 @@ pEventTimer->Initialize(); window = OSWindow::Create(L"Might and Magic® Trilogy", game_width, game_height);//Create game window - //bool use_d3d11 = false; - //if (use_d3d11) - //pRenderer = RenderD3D11::Create(); - //else - pRenderer = Render::Create();//Create DirectX + bool use_d3d11 = false; + if (use_d3d11) + pRenderer = RenderD3D11::Create(); + else + pRenderer = Render::Create();//Create DirectX if (!pRenderer) { Log::Warning(L"Render creation failed"); @@ -5382,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) -------------------------------------------------------- @@ -5477,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); @@ -5508,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) { @@ -5561,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 6dcc6e8dd041 -r 491f0babd563 Engine/Graphics/DecalBuilder.cpp --- a/Engine/Graphics/DecalBuilder.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/Graphics/DecalBuilder.cpp Thu Oct 02 11:52:31 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 6dcc6e8dd041 -r 491f0babd563 Engine/Graphics/Indoor.cpp --- a/Engine/Graphics/Indoor.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/Graphics/Indoor.cpp Thu Oct 02 11:52:31 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; diff -r 6dcc6e8dd041 -r 491f0babd563 Engine/Graphics/Indoor.h --- a/Engine/Graphics/Indoor.h Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/Graphics/Indoor.h Thu Oct 02 11:52:31 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 6dcc6e8dd041 -r 491f0babd563 Engine/Graphics/LightmapBuilder.cpp --- a/Engine/Graphics/LightmapBuilder.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/Graphics/LightmapBuilder.cpp Thu Oct 02 11:52:31 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 6dcc6e8dd041 -r 491f0babd563 Engine/Graphics/Outdoor.cpp --- a/Engine/Graphics/Outdoor.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/Graphics/Outdoor.cpp Thu Oct 02 11:52:31 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 6dcc6e8dd041 -r 491f0babd563 Engine/Graphics/Render.cpp --- a/Engine/Graphics/Render.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/Graphics/Render.cpp Thu Oct 02 11:52:31 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 6dcc6e8dd041 -r 491f0babd563 Engine/Graphics/RenderD3D11.cpp --- a/Engine/Graphics/RenderD3D11.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/Graphics/RenderD3D11.cpp Thu Oct 02 11:52:31 2014 +0600 @@ -1,4 +1,4 @@ -/*#include +#include #include // _com_error #include "../ErrorHandling.h" @@ -231,7 +231,7 @@ unsigned int device_flags = 0;//D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT; #ifndef NODEBUG - device_flags |= 0*//*D3D11_CREATE_DEVICE_DEBUG | D3D11_CREATE_DEVICE_DEBUGGABLE*//*; + device_flags |= 0/*D3D11_CREATE_DEVICE_DEBUG | D3D11_CREATE_DEVICE_DEBUGGABLE*/; #endif HRESULT (__stdcall *dll_D3D11CreateDeviceAndSwapChain)(IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, UINT Flags, CONST D3D_FEATURE_LEVEL* pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, IDXGISwapChain** ppSwapChain, ID3D11Device** ppDevice, D3D_FEATURE_LEVEL* pFeatureLevel, ID3D11DeviceContext** ppImmediateContext); @@ -242,7 +242,7 @@ { MessageBoxA(nullptr, "Received Direct3D 9 or lower", "", 0); __debugbreak(); - }*/ + } /*if (fullscreen) { extern void ChangeResolution(int new_dith, int new_height, int new_bpp); @@ -253,7 +253,7 @@ } ErrorD3D(pSwapChain->SetFullscreenState(fullscreen, nullptr));*/ - /* + ID3D11Texture2D *pSwapChainSurface; { ErrorD3D(pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void **)&pSwapChainSurface)); @@ -322,4 +322,4 @@ d3dc->RSSetViewports(1, &viewport); return true; -}*/ \ No newline at end of file +} \ No newline at end of file diff -r 6dcc6e8dd041 -r 491f0babd563 Engine/Graphics/RenderD3D11.h --- a/Engine/Graphics/RenderD3D11.h Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/Graphics/RenderD3D11.h Thu Oct 02 11:52:31 2014 +0600 @@ -1,4 +1,4 @@ -/*#pragma once +#pragma once #include #include @@ -170,4 +170,3 @@ ID3D11RenderTargetView *primary_srv; ID3D11DepthStencilView *depth_srv; }; -*/ \ No newline at end of file diff -r 6dcc6e8dd041 -r 491f0babd563 Engine/Graphics/Sprites.cpp --- a/Engine/Graphics/Sprites.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/Graphics/Sprites.cpp Thu Oct 02 11:52:31 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 6dcc6e8dd041 -r 491f0babd563 Engine/MMT.cpp --- a/Engine/MMT.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/MMT.cpp Thu Oct 02 11:52:31 2014 +0600 @@ -84,10 +84,18 @@ { 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 ) + { + 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; @@ -346,7 +354,6 @@ { do { - pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, &pParam2); switch (pUIMessageType) diff -r 6dcc6e8dd041 -r 491f0babd563 Engine/MMT.h --- a/Engine/MMT.h Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/MMT.h Thu Oct 02 11:52:31 2014 +0600 @@ -6,4 +6,5 @@ void DrawMMTCopyrightWindow(); extern bool use_MMT; +extern bool use_music_folder; extern bool for_refactoring; \ No newline at end of file diff -r 6dcc6e8dd041 -r 491f0babd563 Engine/SaveLoad.cpp --- a/Engine/SaveLoad.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Engine/SaveLoad.cpp Thu Oct 02 11:52:31 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 6dcc6e8dd041 -r 491f0babd563 GUI/UI/Books/UIMapBook.cpp --- a/GUI/UI/Books/UIMapBook.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/GUI/UI/Books/UIMapBook.cpp Thu Oct 02 11:52:31 2014 +0600 @@ -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 6dcc6e8dd041 -r 491f0babd563 GUI/UI/UIMainMenu.cpp --- a/GUI/UI/UIMainMenu.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/GUI/UI/UIMainMenu.cpp Thu Oct 02 11:52:31 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 6dcc6e8dd041 -r 491f0babd563 GUI/UI/UIPartyCreation.cpp --- a/GUI/UI/UIPartyCreation.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/GUI/UI/UIPartyCreation.cpp Thu Oct 02 11:52:31 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 6dcc6e8dd041 -r 491f0babd563 GUI/UI/UiGame.cpp --- a/GUI/UI/UiGame.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/GUI/UI/UiGame.cpp Thu Oct 02 11:52:31 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 6dcc6e8dd041 -r 491f0babd563 Media/Audio/AudioPlayer.cpp --- a/Media/Audio/AudioPlayer.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Media/Audio/AudioPlayer.cpp Thu Oct 02 11:52:31 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; @@ -426,17 +429,36 @@ 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); + char2wchar_t(string,wStr); + PlayAudio(wStr); + alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); + } + 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; + } } } @@ -2221,13 +2243,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(); } diff -r 6dcc6e8dd041 -r 491f0babd563 Media/MediaPlayer.cpp --- a/Media/MediaPlayer.cpp Thu Sep 25 10:40:16 2014 +0600 +++ b/Media/MediaPlayer.cpp Thu Oct 02 11:52:31 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) @@ -1352,12 +1357,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; }