# HG changeset patch # User Ritor1 # Date 1404494316 -21600 # Node ID 33659ef7fbacd695736fd4c3101aee3c95bf1bbf # Parent c4d286e4bb80857fb7aee050673df3724ae63165# Parent eba7123e4a2d83f6266f577ff5f8c047b9db83d4 Слияние diff -r c4d286e4bb80 -r 33659ef7fbac Arcomage.cpp --- a/Arcomage.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/Arcomage.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -1109,7 +1109,7 @@ pArcomageGame->pSprites.Release(); pArcomageGame->bGameInProgress = false; viewparams->bRedrawGameUI = true; - if ( pMovie ) + if ( pMovie_Track ) pVideoPlayer->_4BF5B2(); for( int i = 0; i < 12; ++i ) pSoundList->UnloadSound(am_sounds[i], 1); diff -r c4d286e4bb80 -r 33659ef7fbac Build/Visual Studio 2010/World of Might and Magic.vcxproj --- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj Fri Jul 04 23:17:24 2014 +0600 +++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj Fri Jul 04 23:18:36 2014 +0600 @@ -468,7 +468,6 @@ - diff -r c4d286e4bb80 -r 33659ef7fbac Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters --- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Fri Jul 04 23:17:24 2014 +0600 +++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Fri Jul 04 23:18:36 2014 +0600 @@ -66,7 +66,6 @@ - diff -r c4d286e4bb80 -r 33659ef7fbac GUIWindow.cpp --- a/GUIWindow.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/GUIWindow.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -1870,8 +1870,8 @@ if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) { ptr_507BD0->DrawMessageBox(0); - ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); - v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); + ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); + v31 = pFontCreate->GetLineWidth(pKeyActionMap->pPressedKeysBuffer); ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate); continue; } @@ -1897,7 +1897,7 @@ { pWindow->DrawMessageBox(0); pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); - pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); + pWindow->DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); if ( !pKeyActionMap->field_204 ) { ItemGen2.Reset(); @@ -1905,7 +1905,7 @@ pEventTimer->Resume(); pCurrentScreen = 0; viewparams->bRedrawGameUI = true; - v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + v26 = atoi(pKeyActionMap->pPressedKeysBuffer); if ( v26 > 0 ) { if ( v26 < 800 ) @@ -2088,7 +2088,7 @@ { pWindow->DrawMessageBox(0); pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); - pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); + pWindow->DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); if ( !pKeyActionMap->field_204 ) { ItemGen2.Reset(); @@ -2096,7 +2096,7 @@ pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; - v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + v39 = atoi(pKeyActionMap->pPressedKeysBuffer); if ( v39 > 0 ) { if ( v39 < 800 ) diff -r c4d286e4bb80 -r 33659ef7fbac Game.cpp --- a/Game.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/Game.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -96,7 +96,7 @@ pIndoorCameraD3D->CreateWorldMatrixAndSomeStuff(); pIndoorCameraD3D->_4374E8_ProllyBuildFrustrum(); - if ( pMovie ) + if ( pMovie_Track ) { /*if ( !pRenderer->pRenderD3D ) { @@ -166,7 +166,7 @@ GameUI_Footer_2(); viewparams->bRedrawGameUI = false; } - if (!pMovie)//!pVideoPlayer->pSmackerMovie) + if (!pMovie_Track)//!pVideoPlayer->pSmackerMovie) { GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, true);//redraw = pParty->uFlags & 2); if (v4) @@ -190,7 +190,7 @@ GameUI_DrawCharacterSelectionFrame(); if ( _44100D_should_alter_right_panel() ) GameUI_DrawRightPanel(); - if ( !pMovie ) + if ( !pMovie_Track ) { pStru6Instance->DrawPlayerBuffAnims(); pOtherOverlayList->DrawTurnBasedIcon(v4); @@ -425,7 +425,7 @@ pNPCStats->pNewNPCData[i].uFlags &= 0xFFFFFF7Fu; } pVideoPlayer->PlayDeathMovie(); - if ( pMovie ) + if ( pMovie_Track ) pVideoPlayer->Unload(); SaveGame(0, 0); ++pParty->uNumDeaths; @@ -1513,9 +1513,9 @@ else { pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); - if ( strcmp((const char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pGlobalTXT_LocalizationStrings[72]) )// "Empty" - strcpy((char *)pKeyActionMap->pPressedKeysBuffer, (const char *)&pSavegameHeader[uLoadGameUI_SelectedSlot]); - pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); + if ( strcmp(pSavegameHeader[uLoadGameUI_SelectedSlot].pName, pGlobalTXT_LocalizationStrings[72]) )// "Empty" + strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); + pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer); } continue; case UIMSG_LoadGame: @@ -1530,7 +1530,7 @@ if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) { pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); - strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer); + strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pKeyActionMap->pPressedKeysBuffer); } DoSavegame(uLoadGameUI_SelectedSlot); stru_506E40.Release(); @@ -3068,7 +3068,7 @@ continue; for ( thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg ) { - if ( !_stricmp((const char *)pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName) ) + if ( !_stricmp(pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName) ) pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg; } } @@ -3269,7 +3269,7 @@ case UIMSG_DD: __debugbreak(); sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer); - memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); + memcpy(&v216, txt_file_frametable_parser(pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); if ( v216.uPropCount == 1 ) { pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2); @@ -3284,7 +3284,7 @@ thish = 0; do { - if ( !_stricmp((const char *)&pGames_LOD->pSubIndices[thish], Str2) ) + if ( !_stricmp(pGames_LOD->pSubIndices[thish].pFilename, Str2) ) break; ++thish; pNPCData3 = (NPCData *)((char *)pNPCData3 + 1); @@ -3292,7 +3292,7 @@ while ( (signed int)pNPCData3 < (signed int)pNPCData4 ); if ( (signed int)pNPCData3 < (signed int)pNPCData4 ) { - strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); + strcpy(pCurrentMapName, pGames_LOD->pSubIndices[(int)pNPCData3].pFilename); dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; uGameState = GAME_STATE_CHANGE_LOCATION; OnMapLeave(); @@ -4431,8 +4431,8 @@ { //typing in the line pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); - strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); - pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); + strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); + pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer); } break; case UIMSG_SaveLoadBtn: diff -r c4d286e4bb80 -r 33659ef7fbac Indoor.cpp --- a/Indoor.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/Indoor.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -3817,7 +3817,7 @@ { for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i) //Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]); - pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[i]); + pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[i]);//\recursion } /*else { @@ -4139,7 +4139,7 @@ this->viewing_angle_from_north_south, this->field_8_party_dir_z); } //----- (00407A1C) -------------------------------------------------------- -bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v) +bool __fastcall sub_407A1C(int x, int y, int z, Vec3_int_ v) { unsigned int v4; // esi@1 int dist_y; // edi@2 @@ -4152,18 +4152,15 @@ int v18; // ST38_4@25 int v19; // eax@25 char v20; // zf@25 - int v21; // ebx@25 + signed int v21; // ebx@25 signed int v23; // edi@26 int v24; // ST34_4@30 - Vec3_int_ v27; // ST08_12@37 - Vec3_int_ v28; // ST08_12@37 signed int v32; // ecx@37 int v33; // eax@37 int v35; // eax@39 ODMFace *odm_face; // esi@54 - int v40; // ebx@60 + signed int v40; // ebx@60 signed int v42; // edi@61 - Vec3_int_ v45; // ST08_12@73 signed int v49; // ecx@73 int v50; // eax@73 int v51; // edx@75 @@ -4174,32 +4171,24 @@ int v63; // ST34_4@98 int v64; // ST30_4@98 int v65; // eax@98 - int v66; // ebx@98 + signed int v66; // ebx@98 signed int v68; // edi@99 int v69; // ST2C_4@103 - Vec3_int_ v72; // ST08_12@111 signed int v77; // ecx@111 int v78; // eax@111 int v79; // edx@113 int v80; // ecx@113 int v81; // eax@113 int v87; // ecx@128 - int v91; // ebx@136 + signed int v91; // ebx@136 signed int v93; // edi@137 Vec3_int_ v97; // [sp-18h] [bp-94h]@1 - int v98; // [sp-Ch] [bp-88h]@88 - int v99; // [sp-Ch] [bp-88h]@126 - int v100; // [sp-8h] [bp-84h]@88 - int v101; // [sp-8h] [bp-84h]@126 - int v102; // [sp-4h] [bp-80h]@88 - int v103; // [sp-4h] [bp-80h]@126 int v107; // [sp+10h] [bp-6Ch]@98 int v108; // [sp+10h] [bp-6Ch]@104 int v109; // [sp+18h] [bp-64h]@25 int v110; // [sp+18h] [bp-64h]@31 signed int v113; // [sp+20h] [bp-5Ch]@1 signed int v114; // [sp+24h] [bp-58h]@1 - unsigned int a4_8; // [sp+30h] [bp-4Ch]@1 int v119; // [sp+34h] [bp-48h]@75 int v120; // [sp+34h] [bp-48h]@113 int v121; // [sp+38h] [bp-44h]@4 @@ -4257,20 +4246,19 @@ //__debugbreak(); - v4 = stru_5C6E00->Atan2(v.x - x, v.y - z); + v4 = stru_5C6E00->Atan2(v.x - x, v.y - y); + + v113 = 0; v114 = 0; - v97.z = y; + + v97.z = z; v97.x = x; - v97.y = z; - v113 = 0; - a4_8 = stru_5C6E00->Atan2(v.x - x, v.y - z); + v97.y = y; + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) { Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &sX, &sY, &sZ); - v45.z = v.z; - v45.x = v.x; - v45.y = v.y; - Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v45, &outx, &outy, &outz); + Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v, &outx, &outy, &outz); dist_y = outy - sY; dist_z = outz - sZ; dist_x = outx - sX; @@ -4296,17 +4284,12 @@ { if ( a5b ) { - v102 = sZ; - v100 = sY; - v98 = sX; + v59 = pIndoor->GetSector(sX, sY, sZ); } else { - v102 = outz; - v100 = outy; - v98 = outx; + v59 = pIndoor->GetSector(outx, outy, outz); } - v59 = pIndoor->GetSector(v98, v100, v102); //v60 = pIndoor->pSectors; //v61 = 116 * v59; //i = 116 * v59; @@ -4318,14 +4301,14 @@ v63 = fixpoint_mul(v143, face->pFacePlane_old.vNormal.x); v64 = fixpoint_mul(v53, face->pFacePlane_old.vNormal.z); v65 = fixpoint_mul(v52, face->pFacePlane_old.vNormal.y); - v20 = v63 + v64 + v65; + v20 = v63 + v64 + v65 == 0; v66 = v63 + v64 + v65; v107 = v63 + v64 + v65; if ( face->Portal() || v119 > face->pBounding.x2 || v123 < face->pBounding.x1 || v127 > face->pBounding.y2 || v131 < face->pBounding.y1 || v135 > face->pBounding.z2 || v139 < face->pBounding.z1 - || !v20 ) + || v20 ) continue; v68 = -(face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x + sY * face->pFacePlane_old.vNormal.y @@ -4369,11 +4352,8 @@ } } - v72.z = y; - v72.x = x; - v72.y = z; - Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &sX, &sY, &sZ); - Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v, &outx, &outy, &outz); + Vec3_int_::Rotate(32, v4 - stru_5C6E00->uIntegerHalfPi, 0, v97, &sX, &sY, &sZ); + Vec3_int_::Rotate(32, v4 - stru_5C6E00->uIntegerHalfPi, 0, v, &outx, &outy, &outz); dist_y = outy - sY; dist_z = outz - sZ; dist_x = outx - sX; @@ -4401,41 +4381,27 @@ return !v114 || !v113; if ( a5c ) { - v103 = sZ; - v101 = sY; - v99 = sX; + v87 = pIndoor->GetSector(sX, sY, sZ); } else { - v103 = outz; - v101 = outy; - v99 = outx; + v87 = pIndoor->GetSector(outx, outy, outz); } - v87 = pIndoor->GetSector(v99, v101, v103); - //v88 = pIndoor->pSectors; - //v89 = 116 * v87; - - //v112 = v89; - //if ( *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) - //+ 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 ) - //{ - //while ( 1 ) for ( v162 = 0; v162 < pIndoor->pSectors[v87].uNumFaces; v162++) { face = &pIndoor->pFaces[pIndoor->pSectors[v87].pFaceIDs[v162]]; yb = fixpoint_mul(v144, face->pFacePlane_old.vNormal.x); v_4b = fixpoint_mul(v80, face->pFacePlane_old.vNormal.y); vf = fixpoint_mul(v81, face->pFacePlane_old.vNormal.z); - v20 = yb + vf + v_4b; + v20 = yb + vf + v_4b == 0; v91 = yb + vf + v_4b; vc = yb + vf + v_4b; if ( face->Portal() || v120 > face->pBounding.x2 || v124 < face->pBounding.x1 || v128 > face->pBounding.y2 || v132 < face->pBounding.y1 || v136 > face->pBounding.z2 || v140 < face->pBounding.z1 - || !v20 ) + || v20 ) continue; - //v92 = sZ * face->pFacePlane_old.vNormal.z; v93 = -(face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x + sY * face->pFacePlane_old.vNormal.y + sZ * face->pFacePlane_old.vNormal.z); @@ -4458,10 +4424,6 @@ + sZ * face->pFacePlane_old.vNormal.z)) >> 14; if ( v_4c <= abs(v91) ) { - //LODWORD(v94) = v93 << 16; - //HIDWORD(v94) = v93 >> 16; - //v95 = v94 / vc; - //vd = v94 / vc; vd = fixpoint_div(v93, vc); if ( vd >= 0 ) { @@ -4513,13 +4475,13 @@ v17 = fixpoint_mul(v125, odm_face->pFacePlane.vNormal.x); v18 = fixpoint_mul(v121, odm_face->pFacePlane.vNormal.y); v19 = fixpoint_mul(v12, odm_face->pFacePlane.vNormal.z); - v20 = v17 + v18 + v19; + v20 = v17 + v18 + v19 == 0; v21 = v17 + v18 + v19; v109 = v17 + v18 + v19; if ( v149 > odm_face->pBoundingBox.x2 || v145 < odm_face->pBoundingBox.x1 || v141 > odm_face->pBoundingBox.y2 || v137 < odm_face->pBoundingBox.y1 || v133 > odm_face->pBoundingBox.z2 || v129 < odm_face->pBoundingBox.z1 - || !v20 ) + || v20 ) continue; v23 = -(odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x + sY * odm_face->pFacePlane.vNormal.y @@ -4543,10 +4505,6 @@ + sZ * odm_face->pFacePlane.vNormal.z)) >> 14; if ( v24 <= abs(v21) ) { - //LODWORD(v25) = v23 << 16; - //HIDWORD(v25) = v23 >> 16; - //v26 = v25 / v109; - //v110 = v25 / v109; v110 = fixpoint_div(v23, v109); if ( v110 >= 0 ) { @@ -4565,14 +4523,8 @@ } } - v27.z = y; - v27.x = x; - v27.y = z; - Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &sX, &sY, &sZ); - v28.z = v.z; - v28.x = v.x; - v28.y = v.y; - Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &outz); + Vec3_int_::Rotate(32, v4 - stru_5C6E00->uIntegerHalfPi, 0, v97, &sX, &sY, &sZ); + Vec3_int_::Rotate(32, v4 - stru_5C6E00->uIntegerHalfPi, 0, v, &outx, &outy, &outz); dist_y = outy - sY; dist_z = outz - sZ; dist_x = outx - sX; diff -r c4d286e4bb80 -r 33659ef7fbac Keyboard.h --- a/Keyboard.h Fri Jul 04 23:17:24 2014 +0600 +++ b/Keyboard.h Fri Jul 04 23:18:36 2014 +0600 @@ -67,7 +67,7 @@ unsigned int pVirtualKeyCodesMapping[30]; KeyToggleType pToggleTypes[30]; int max_input_string_len; - unsigned __int8 pPressedKeysBuffer[257]; + __int8 pPressedKeysBuffer[257]; unsigned __int8 uNumKeysPressed; char field_202; char field_203; diff -r c4d286e4bb80 -r 33659ef7fbac LOD.cpp --- a/LOD.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/LOD.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -1862,7 +1862,7 @@ v9 = v4; do { - result = _stricmp((const char *)pContainerName, (const char *)&v10->pSubIndices[v9]); + result = _stricmp(pContainerName, v10->pSubIndices[v9].pFilename); if ( !result ) goto LABEL_21; ++v7; @@ -1886,7 +1886,7 @@ v8 = v4; while ( 1 ) { - result = _stricmp((const char *)pContainerName, (const char *)&v10->pSubIndices[v8]); + result = _stricmp(pContainerName, v10->pSubIndices[v8].pFilename); if ( !result ) break; ++v7; @@ -1919,7 +1919,7 @@ } else { - while ( _stricmp((const char *)pContainer, (const char *)&this_dup->pSubIndices[i]) ) + while ( _stricmp(pContainer, this_dup->pSubIndices[i].pFilename) ) { ++i_dup; ++i; diff -r c4d286e4bb80 -r 33659ef7fbac MediaPlayer.cpp --- a/MediaPlayer.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/MediaPlayer.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -20,13 +20,15 @@ #include "stuff.h" #include "OpenALSoundProvider.h" +#include "Log.h" + #include "MediaPlayer.h" #include "Log.h" using namespace Media; Media::MPlayer *pMediaPlayer; -Media::IMovie *pMovie; -Media::ITrack *pTrack; +Media::IMovie *pMovie_Track; +Media::ITrack *pAudio_Track; Movie *movie; int mSourceID; @@ -190,8 +192,9 @@ if (dec_ctx) { // Close the codec - // + // avcodec_close(dec_ctx); + Log::Warning(L"close decoder context file\n"); dec_ctx = nullptr; } } @@ -203,10 +206,9 @@ AVCodecContext *dec_ctx; }; -struct AVAudioStream: public AVStreamWrapper +struct AVAudioStream: public AVStreamWrapper// AVAudioStreem AVStreemWrapper { - inline AVAudioStream(): - AVStreamWrapper() + inline AVAudioStream():AVStreamWrapper() { this->bytes_per_sample = 0; this->bytes_per_second = 0; @@ -218,8 +220,7 @@ struct AVVideoStream: public AVStreamWrapper { - inline AVVideoStream(): - AVStreamWrapper() + inline AVVideoStream(): AVStreamWrapper() { this->frames_per_second = 0.0; } @@ -655,10 +656,10 @@ return true; } -class Track: public Media::ITrack +class Track: public Media::ITrack// Media::ITrack { public: - inline Track() + inline Track()// { this->format_ctx = nullptr; this->audio_num_samples = 0; @@ -674,8 +675,9 @@ audio.Release(); if (format_ctx) { - // + // av_close_input_file(format_ctx); + Log::Warning(L"close audio format context file\n"); format_ctx = nullptr; } } @@ -760,10 +762,10 @@ OpenALSoundProvider::TrackBuffer *device_buffer; }; -class Movie: public Media::IMovie +class Movie: public Media::IMovie// Media::IMovie { public: - inline Movie() + inline Movie()// { this->movie_filename[0] = 0; this->width = 0; @@ -780,9 +782,9 @@ memset(last_resampled_frame_linesize, 0, sizeof(last_resampled_frame_linesize)); decoding_packet = nullptr; - ioBuffer = nullptr; - format_ctx = nullptr; - avioContext = nullptr; + ioBuffer = nullptr; + format_ctx = nullptr; + avioContext = nullptr; } inline void Release() @@ -800,6 +802,7 @@ // Close the video file // ( ) av_close_input_file(format_ctx); + Log::Warning(L"close video format context file\n"); format_ctx = nullptr; } if(avioContext) @@ -882,7 +885,6 @@ decoding_frame = avcodec_alloc_frame(); audio_data_in_device = provider->CreateStreamingTrack16(audio.dec_ctx->channels, audio.dec_ctx->sample_rate, 2); - return true; } fprintf(stderr, "ffmpeg: Unable to find stream info\n"); @@ -1038,21 +1040,25 @@ ITrack *MPlayer::LoadTrack(const wchar_t *filename) // mp3 { - auto track = new Track; - if (!track->LoadAudio(filename)) + auto audio_track = new Track; + Log::Warning(L"allocation dynamic memory for audio_track\n"); + if (!audio_track->LoadAudio(filename)) { - delete track; - track = nullptr; + delete audio_track; + Log::Warning(L"delete dynamic memory for audio_track\n"); + audio_track = nullptr; } - return track; + return audio_track; } IMovie *MPlayer::LoadMovie(const wchar_t *filename, int width, int height, int cache_ms) // { movie = new Movie; + Log::Warning(L"allocation dynamic memory for movie\n"); if (!movie->Load(filename, width, height, cache_ms)) { delete movie; + Log::Warning(L"delete dynamic memory for movie\n"); movie = nullptr; } return movie; @@ -1061,11 +1067,13 @@ IMovie *MPlayer::LoadMovieFromLOD(HANDLE h, int readFunction(void*, uint8_t*, int), int64_t seekFunction(void*, int64_t, int), int width, int height) { movie = new Movie; + Log::Warning(L"allocation dynamic memory for movie\n"); if (movie) { if (movie->LoadFromLOD(h, readFunction, seekFunction, width, height)) - return movie; + return movie; delete movie; + Log::Warning(L"delete dynamic memory for movie\n"); } return nullptr; } @@ -1102,30 +1110,37 @@ if (!provider) { provider = new OpenALSoundProvider; + Log::Warning(L"allocation dynamic memory for provider\n"); provider->Initialize(); } } MPlayer::~MPlayer() { + delete provider; + Log::Warning(L"delete dynamic memory for provider\n"); } void PlayAudio(const wchar_t * pFilename) { - pTrack = pMediaPlayer->LoadTrack(pFilename); - pTrack->Play(); + pAudio_Track = pMediaPlayer->LoadTrack(pFilename); + pAudio_Track->Play(); + delete pAudio_Track; + Log::Warning(L"delete dynamic memory for pAudio_Track\n"); + pAudio_Track = nullptr; } void PlayMovie(const wchar_t * pFilename) { - Media::IMovie *track = pMediaPlayer->LoadMovie(pFilename, 640, 480, 0); - track->Play(); + Media::IMovie *Movie_track = pMediaPlayer->LoadMovie(pFilename, 640, 480, 0); + Movie_track->Play(); } void MovieRelease() { movie->Release(); delete movie; + Log::Warning(L"delete dynamic memory for movie\n"); movie = nullptr; } diff -r c4d286e4bb80 -r 33659ef7fbac MediaPlayer.h --- a/MediaPlayer.h Fri Jul 04 23:17:24 2014 +0600 +++ b/MediaPlayer.h Fri Jul 04 23:18:36 2014 +0600 @@ -1,25 +1,25 @@ #pragma once -namespace Media // Media +namespace Media { - class ITrack // + class ITrack { public: - virtual void Play(bool loop = false) = 0; + virtual void Play(bool loop = false) = 0; }; - class IMovie // + class IMovie + { + public: + virtual void Play() = 0; + virtual void GetNextFrame(double dt, void *target_surface) = 0; + }; + + class MPlayer { public: - virtual void Play() = 0; - virtual void GetNextFrame(double dt, void *target_surface) = 0; - }; - - class MPlayer // - { - public: - MPlayer();// - virtual ~MPlayer();// + MPlayer(); + virtual ~MPlayer(); ITrack *LoadTrack(const wchar_t *name); IMovie *LoadMovie(const wchar_t *name, int width, int height, int cache_ms); @@ -28,8 +28,8 @@ }; extern Media::MPlayer *pMediaPlayer; -extern Media::IMovie *pMovie; -extern Media::ITrack *pTrack; +extern Media::IMovie *pMovie_Track; +extern Media::ITrack *pAudio_Track; extern class Movie *movie; extern bool end_current_file; diff -r c4d286e4bb80 -r 33659ef7fbac OSWindow.cpp --- a/OSWindow.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/OSWindow.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -316,14 +316,14 @@ pMiscTimer->Resume(); viewparams->bRedrawGameUI = true; - if ( pMovie)//pVideoPlayer->pSmackerMovie ) + if ( pMovie_Track)//pVideoPlayer->pSmackerMovie ) { pRenderer->RestoreFrontBuffer(); pRenderer->RestoreBackBuffer(); //pVideoPlayer->_4BF5B2(); } } - if ( pAudioPlayer->hAILRedbook && !bGameoverLoop && !pMovie)//!pVideoPlayer->pSmackerMovie ) + if ( pAudioPlayer->hAILRedbook && !bGameoverLoop && !pMovie_Track)//!pVideoPlayer->pSmackerMovie ) AIL_redbook_resume(pAudioPlayer->hAILRedbook); } } @@ -332,7 +332,7 @@ if (!(dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)) { dword_4E98BC_bApplicationActive = 0; - if ( pMovie//(pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) + if ( pMovie_Track//(pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) && pVideoPlayer->bPlayingMovie ) pVideoPlayer->bStopBeforeSchedule = 1; diff -r c4d286e4bb80 -r 33659ef7fbac Outdoor.cpp --- a/Outdoor.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/Outdoor.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -271,7 +271,7 @@ } //----- (00488F5C) -------------------------------------------------------- -bool OutdoorLocation::Initialize(const char *pFilename, int File, size_t uRespawnInterval, int thisa) +bool OutdoorLocation::Initialize(const char *pFilename, int File, size_t uRespawnInterval, int *thisa) { OutdoorLocation *v5; // esi@1 bool result; // eax@2 @@ -1070,7 +1070,7 @@ } //----- (0047D0A6) -------------------------------------------------------- -bool OutdoorLocation::Load(const char *pFilename, ODMFace *File, size_t pNumItems, int thisa)// +bool OutdoorLocation::Load(const char *pFilename, ODMFace *File, size_t pNumItems, int *thisa)// { //OutdoorLocation *pOutdoorLocation; // esi@1 /*bool result; // eax@9 @@ -1945,7 +1945,7 @@ if (Str2 == 0) ++ddm.uNumRespawns; v108 = 0; - *(int *)thisa = 1; + *thisa = 1; v39 = pGames_LOD->FindContainer(Str, 0); fread(&header, 0x10, 1u, v39); //pFilename = (char *)header.uCompressedSize; @@ -1971,7 +1971,7 @@ goto LABEL_120; } - *(int *)thisa = 0; + *thisa = 0; LABEL_120: //v108 = (int)".odm"; //v83 = strlen(pContainer); @@ -1984,7 +1984,7 @@ pGameLoadingUI_ProgressBar->Progress(); - if ( *(int *)thisa ) + if ( *thisa ) { memcpy(uFullyRevealedCellOnMap, Dst, 0x3C8u); memcpy(uPartiallyRevealedCellOnMap, Src, 0x3C8u); diff -r c4d286e4bb80 -r 33659ef7fbac Outdoor.h --- a/Outdoor.h Fri Jul 04 23:17:24 2014 +0600 +++ b/Outdoor.h Fri Jul 04 23:18:36 2014 +0600 @@ -138,7 +138,7 @@ void PrepareActorsDrawList(); void CreateDebugLocation(); void Release(); - bool Load(const char *pFilename, ODMFace *File, size_t a4, int thisa); + bool Load(const char *pFilename, ODMFace *File, size_t a4, int *thisa); int GetTileIdByTileMapId(signed int a2); unsigned int DoGetTileTexture(signed int uX, signed int uZ); int _47ED83(signed int a2, signed int a3); @@ -158,7 +158,7 @@ int GetSomeOtherTileInfo(int sX, int sY); unsigned int GetTileTexture(int sX, int sZ); int GetHeightOnTerrain(int sX, int sZ); - bool Initialize(const char *pFilename, int File, size_t uRespawnInterval, int thisa); + bool Initialize(const char *pFilename, int File, size_t uRespawnInterval, int *thisa); //bool Release2(); bool GetTravelDestination(signed int sPartyX, signed int sPartyZ, char *pOut, signed int a5); void MessWithLUN(); diff -r c4d286e4bb80 -r 33659ef7fbac Render.cpp --- a/Render.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/Render.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -9001,7 +9001,7 @@ && pCurrentScreen != SCREEN_CHANGE_LOCATION ) { if (pCurrentScreen == SCREEN_INPUT_BLV) - return pMovie;//pSmackerMovie != 0; + return pMovie_Track;//pSmackerMovie != 0; if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) return true; } diff -r c4d286e4bb80 -r 33659ef7fbac SaveLoad.cpp --- a/SaveLoad.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/SaveLoad.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -569,7 +569,7 @@ FILE *file; // eax@7 void *pSave; // [sp+170h] [bp-8h]@3 - if ( pMovie ) + if ( pMovie_Track ) pVideoPlayer->Unload(); pSave = malloc(1000000); pNew_LOD->CloseWriteFile(); diff -r c4d286e4bb80 -r 33659ef7fbac UI/Books/UINotesBooks.cpp --- a/UI/Books/UINotesBooks.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/UI/Books/UINotesBooks.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -405,7 +405,7 @@ journal_window.uFrameZ = game_viewport_z; journal_window.uFrameW = game_viewport_w; if ( pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle ) - journal_window.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, (const char *)pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle, 3); + journal_window.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle, 3); } //for other text @@ -441,7 +441,7 @@ pDialogueString = BuildDialogueString(pStorylineText->StoreLine[ achieved_awards[books_primary_item_per_page]].pText, uActiveCharacter - 1, 0, 0, 0, &pParty->PartyTimes.HistoryEventTimes[index]); pStringOnPage = pAutonoteFont->GetPageTop(pDialogueString, &journal_window, 1, (unsigned __int8)Journal_limitation_factor[books_primary_item_per_page]); - journal_window.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, (const char *)pStringOnPage, 0, + journal_window.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, pStringOnPage, 0, journal_window.uFrameY + journal_window.uFrameHeight, ui_book_journal_text_shadow); ++num_achieved_awards; } diff -r c4d286e4bb80 -r 33659ef7fbac UI/UIHouses.cpp --- a/UI/UIHouses.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/UI/UIHouses.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -1721,14 +1721,14 @@ { sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay" "How Much?" townHall_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - townHall_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); - townHall_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); + townHall_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), pKeyActionMap->pPressedKeysBuffer, 3); + townHall_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth(pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); return; } if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { - v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); - v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + v1 = atoi(pKeyActionMap->pPressedKeysBuffer); + v2 = atoi(pKeyActionMap->pPressedKeysBuffer); if ( v1 <= 0 ) { pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); @@ -1795,13 +1795,13 @@ { sprintf(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[60], pGlobalTXT_LocalizationStrings[112]);//"" "?" bank_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); - bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); + bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), pKeyActionMap->pPressedKeysBuffer, 3); + bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth(pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); return; } if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { - entered_sum = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + entered_sum = atoi(pKeyActionMap->pPressedKeysBuffer); takes_sum = entered_sum; if ( !entered_sum ) { @@ -1837,14 +1837,14 @@ { sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[244], pGlobalTXT_LocalizationStrings[112]);//"" "?" bank_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); - bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); + bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), pKeyActionMap->pPressedKeysBuffer, 3); + bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth(pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); return; } if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - entered_sum = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + entered_sum = atoi(pKeyActionMap->pPressedKeysBuffer); takes_sum = entered_sum; if ( entered_sum ) { @@ -2183,14 +2183,14 @@ { pButton = pDialogueWindow->GetControl(pItemNum); pButton->uY = all_text_height + v54; - pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); + pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); pButton->uHeight = pTextHeight; v54 = pButton->uY + pTextHeight - 1; pButton->uW = v54; pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); ++pNumString; } } diff -r c4d286e4bb80 -r 33659ef7fbac UI/UIPartyCreation.cpp --- a/UI/UIPartyCreation.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/UI/UIPartyCreation.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -154,19 +154,19 @@ switch ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 ) { case WINDOW_INPUT_IN_PROGRESS://press name panel - v17 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, 159 * (int)pGUIWindow_CurrentMenu->ptr_1C + 18, 124, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 120, 1); + v17 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, 159 * (int)pGUIWindow_CurrentMenu->ptr_1C + 18, 124, 0, pKeyActionMap->pPressedKeysBuffer, 120, 1); pGUIWindow_CurrentMenu->DrawFlashingInputCursor(159 * (unsigned int)pGUIWindow_CurrentMenu->ptr_1C + v17 + 20, 124, pFontCreate); break; case WINDOW_INPUT_CONFIRMED: // press enter pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; v126 = 0; - for ( int i = 0; i < strlen((const char *)pKeyActionMap->pPressedKeysBuffer); ++i )//edit name + for ( int i = 0; i < strlen(pKeyActionMap->pPressedKeysBuffer); ++i )//edit name { if ( pKeyActionMap->pPressedKeysBuffer[i] == ' ' ) ++v126; } - if ( strlen((const char *)pKeyActionMap->pPressedKeysBuffer) && v126 != strlen((const char *)pKeyActionMap->pPressedKeysBuffer) ) - strcpy(pParty->pPlayers[i].pName, (const char *)pKeyActionMap->pPressedKeysBuffer); + if ( strlen(pKeyActionMap->pPressedKeysBuffer) && v126 != strlen(pKeyActionMap->pPressedKeysBuffer) ) + strcpy(pParty->pPlayers[i].pName, pKeyActionMap->pPressedKeysBuffer); pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, pParty->pPlayers[i].pName, 130, 0); pParty->pPlayers[i].field_1988[27] = 1; break; diff -r c4d286e4bb80 -r 33659ef7fbac UI/UISaveLoad.cpp --- a/UI/UISaveLoad.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/UI/UISaveLoad.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -95,7 +95,7 @@ if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, (const char *)pKeyActionMap->pPressedKeysBuffer); + strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, pKeyActionMap->pPressedKeysBuffer); pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0); } else @@ -108,7 +108,7 @@ pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[135]) + 25, 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);// pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, pFontSmallnum->AlignText_Center(186, - (const char *)pSavegameHeader.data() + 100 * uLoadGameUI_SelectedSlot) + 25, 0x106, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0); + pSavegameHeader[uLoadGameUI_SelectedSlot].pName) + 25, 0x106, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0); pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]) + 25, 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);//", " } diff -r c4d286e4bb80 -r 33659ef7fbac UI/UIShops.cpp --- a/UI/UIShops.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/UI/UIShops.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -61,13 +61,13 @@ { pButton = pDialogueWindow->GetControl(i); pButton->uY = v103 + v19; - pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); - v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v19 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; pButton->uW = v19; pColorText = Color16(0xE1u, 0xCDu, 0x23u); if ( pDialogueWindow->pCurrentPosActiveItem != i ) pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); ++pNumString; } } @@ -263,13 +263,13 @@ { pButton = pDialogueWindow->GetControl(i); pButton->uY = v103 + v19; - pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); - v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v19 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; pButton->uW = v19; pColorText = Color16(0xE1u, 0xCDu, 0x23u); if ( pDialogueWindow->pCurrentPosActiveItem != i ) pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); ++pNumString; } break; @@ -733,13 +733,13 @@ { pButton = pDialogueWindow->GetControl(i); pButton->uY = v18 + v105; - pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); - v105 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v105 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; pButton->uW = v105; pColorText = Color16(0xE1u, 0xCDu, 0x23u); if ( pDialogueWindow->pCurrentPosActiveItem != i ) pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); ++pNumString; } } @@ -982,13 +982,13 @@ { pButton = pDialogueWindow->GetControl(i); pButton->uY = v18 + v105; - pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); - v105 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v105 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; pButton->uW = v105; pColorText = Color16(0xE1u, 0xCDu, 0x23u); if ( pDialogueWindow->pCurrentPosActiveItem != i ) pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); ++pNumString; } return; diff -r c4d286e4bb80 -r 33659ef7fbac UI/UITransition.cpp --- a/UI/UITransition.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/UI/UITransition.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -178,7 +178,7 @@ pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u)); pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); map_id = pMapStats->GetMapInfo(pCurrentMapName); - if ( (pMovie || v9) && *dword_591164_teleport_map_name != ' ' ) + if ( (pMovie_Track || v9) && *dword_591164_teleport_map_name != ' ' ) map_id = pMapStats->GetMapInfo(dword_591164_teleport_map_name); transition_window.uFrameX = 493; transition_window.uFrameWidth = 126; diff -r c4d286e4bb80 -r 33659ef7fbac UI/UiGame.cpp --- a/UI/UiGame.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/UI/UiGame.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -660,7 +660,7 @@ if ( pGUIWindow2->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - strcpy(GameUI_Footer_TimedString.data(), (const char *)pKeyActionMap->pPressedKeysBuffer); + strcpy(GameUI_Footer_TimedString.data(), pKeyActionMap->pPressedKeysBuffer); sub_4452BB(); return; } diff -r c4d286e4bb80 -r 33659ef7fbac VideoPlayer.cpp --- a/VideoPlayer.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/VideoPlayer.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -144,7 +144,7 @@ auto image = new char[client_width * client_height * 4]; - pMovie->GetNextFrame(dt, image); // + pMovie_Track->GetNextFrame(dt, image); // if (end_current_file)// ? break; @@ -254,13 +254,14 @@ AIL_redbook_resume(pAudioPlayer->hAILRedbook); pEventTimer->Resume(); - delete pMovie; - pMovie = nullptr; + delete pMovie_Track; + Log::Warning(L"delete dynamic memory for pMovie_Track\n"); + pMovie_Track = nullptr; } void VideoPlayer::_inlined_in_463149() { - if (pMovie) + if (pMovie_Track) { pRenderer->BeginScene(); pMouse->DrawCursorToTarget(); @@ -282,8 +283,9 @@ MovieRelease(); SetFilePointer(hVidFile, uOffset, nullptr, FILE_BEGIN); - pMovie = nullptr; - pMovie = pMediaPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, width, height); + pMovie_Track = nullptr; + Log::Warning(L"reload pMovie_Track"); + pMovie_Track = pMediaPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, width, height); end_current_file = false; } //else @@ -296,7 +298,7 @@ auto image = new char[current_movie_width * current_movie_height * 4]; - pMovie->GetNextFrame(dt, image); + pMovie_Track->GetNextFrame(dt, image); int image_array[460 * 344];//game_viewport_width * game_viewport_height if (image) @@ -347,7 +349,7 @@ //----- (004BF3F9) -------------------------------------------------------- bool VideoPlayer::AnyMovieLoaded() { - return pMovie;// pSmackerMovie || pBinkMovie; + return pMovie_Track;// pSmackerMovie || pBinkMovie; } //----- (004BF411) -------------------------------------------------------- @@ -395,7 +397,7 @@ } }*/ pMouse->_469E24(); - if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !pMovie)//!this->pSmackerMovie ) + if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !pMovie_Track)//!this->pSmackerMovie ) { bGameoverLoop = true; HouseDialogPressCloseBtn(); @@ -449,7 +451,8 @@ bStopBeforeSchedule = false; pResetflag = 0; pMediaPlayer = new Media::MPlayer;// - pMovie = nullptr; + Log::Warning(L"allocation dynamic memory for pMediaPlayer\n"); + pMovie_Track = nullptr; //pBinkMovie = nullptr; } @@ -529,6 +532,6 @@ client_height = rc_client.bottom - rc_client.top; - pMovie = pMediaPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, client_width, client_height); + pMovie_Track = pMediaPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, client_width, client_height); } diff -r c4d286e4bb80 -r 33659ef7fbac mm7_2.cpp --- a/mm7_2.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/mm7_2.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -2361,7 +2361,7 @@ { sCurrentMenuID = uMenu; - Log::Warning(L"CurrentMenu = %s", MENU_STATE_to_string(uMenu)); + Log::Warning(L"CurrentMenu = %s \n", MENU_STATE_to_string(uMenu)); } //----- (00466CA0) -------------------------------------------------------- diff -r c4d286e4bb80 -r 33659ef7fbac mm7_3.cpp --- a/mm7_3.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/mm7_3.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -2650,13 +2650,14 @@ const char *pFilename; // [sp+84h] [bp-Ch]@1 //unsigned int v12; // [sp+88h] [bp-8h]@12 //int v13; // [sp+8Ch] [bp-4h]@11 + int v; pFilename = pLevelFilename; //thisa->AllocSoftwareDrawBuffers(); pODMRenderParams->Initialize(); pWeather->bRenderSnow = false; pRenderer->ClearZBuffer(0, 479); - thisa = (ODMRenderParams *)1; + //thisa = (ODMRenderParams *)1; GetAlertStatus(); if ( _A750D8_player_speech_timer ) _A750D8_player_speech_timer = 0; @@ -2668,14 +2669,14 @@ v3 = v4->uRespawnIntervalDays; } else - v4 = (MapInfo *)thisa; + v4 = (MapInfo *)1; day_attrib &= ~DAY_ATTRIB_FOG; dword_6BE13C_uCurrentlyLoadedLocationID = v2; pOutdoor->Initialize( pFilename, (unsigned int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 0x3C / 0x3C / 0x18 + 1, v3, - (int)&thisa); + &v); if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) ) { Actor::InitializeActors(); @@ -2684,8 +2685,8 @@ dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000; //v5 = 0; if ( !v2 ) - thisa = 0; - if ( thisa == (ODMRenderParams *)1 ) + v = 0; + if ( v == 1 ) { //v13 = 0; for (uint i = 0; i < pOutdoor->uNumSpawnPoints; ++i) diff -r c4d286e4bb80 -r 33659ef7fbac mm7_5.cpp --- a/mm7_5.cpp Fri Jul 04 23:17:24 2014 +0600 +++ b/mm7_5.cpp Fri Jul 04 23:18:36 2014 +0600 @@ -114,7 +114,7 @@ v15 = pActors[target_id].vPosition.y - AttackerInfo.pYs[attacker_id]; a1 = pActors[target_id].vPosition.x - AttackerInfo.pXs[attacker_id]; v44 = pActors[target_id].vPosition.z; - v19 = AttackerInfo.pYs[attacker_id] + pActors[target_id].uActorRadius; + v19 = AttackerInfo.field_324[attacker_id] + pActors[target_id].uActorRadius; v48 = v15; if ( a1 * a1 + v15 * v15 + (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id]) * (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id]) < (unsigned int)(v19 * v19) ) @@ -167,7 +167,7 @@ v48 = pActors[actorID].vPosition.y - AttackerInfo.pYs[attacker_id]; v44 = pActors[actorID].vPosition.z; v32 = (pActors[actorID].uActorHeight / 2) - AttackerInfo.pZs[attacker_id]; - v33 = pActors[actorID].uActorRadius + AttackerInfo.pYs[attacker_id]; + v33 = pActors[actorID].uActorRadius + AttackerInfo.field_324[attacker_id]; if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) { attacker_coord.x = AttackerInfo.pXs[attacker_id];