# HG changeset patch # User Grumpy7 # Date 1382682166 25200 # Node ID c193d289f0a5b0f6d54ca8e339c8c26961eb6a8e # Parent e8d329651a2aadfcd33b99a14dc78869c8f898e5# Parent b0d96beedc80404b004d368e14380054b2288f58 Merge diff -r e8d329651a2a -r c193d289f0a5 Actor.cpp --- a/Actor.cpp Thu Oct 24 23:21:05 2013 -0700 +++ b/Actor.cpp Thu Oct 24 23:22:46 2013 -0700 @@ -4056,3 +4056,63 @@ else return 0; } +//----- (0042F4DA) -------------------------------------------------------- +bool CheckActors_proximity() +{ + signed int distance; // edi@1 + int for_x; // ebx@5 + int for_y; // [sp+Ch] [bp-10h]@5 + int for_z; // [sp+10h] [bp-Ch]@5 + int v3; // eax@5 + int v4; // ebx@5 + unsigned int v5; // ecx@5 + int v6; // edx@6 + unsigned int v7; // edx@8 + unsigned int v8; // edx@10 + + + distance = 5120; + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) + distance = 2560; + + if ( (signed int)uNumActors <= 0 ) + return false; + for ( uint i = 0; i < (signed int)uNumActors; ++i ) + { + for_x = abs(pActors[i].vInitialPosition.x - pParty->vPosition.x); + for_y = abs(pActors[i].vInitialPosition.y - pParty->vPosition.y); + for_z = abs(pActors[i].vInitialPosition.z - pParty->vPosition.z); + v3 = for_x; + v4 = for_y; + v5 = for_z; + if ( v3 < for_y ) + { + v6 = v3; + v3 = for_y; + v4 = v6; + } + if ( v3 < for_z ) + { + v7 = v3; + v3 = for_z; + v5 = v7; + } + if ( v4 < (signed int)v5 ) + { + v8 = v5; + v5 = v4; + v4 = v8; + } + if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < distance ) + { + if ( pActors[i].uAIState != Dead ) + { + if ( pActors[i].uAIState != Dying && pActors[i].uAIState != Removed + && pActors[i].uAIState != Disabled && pActors[i].uAIState != Summoned + && (BYTE2(pActors[i].uAttributes) & 8 || pActors[i].GetActorsRelation(0) ) ) + return true; + } + } + } + return false; +} diff -r e8d329651a2a -r c193d289f0a5 Actor.h --- a/Actor.h Thu Oct 24 23:21:05 2013 -0700 +++ b/Actor.h Thu Oct 24 23:22:46 2013 -0700 @@ -298,3 +298,5 @@ extern std::array pActors; extern size_t uNumActors; + +bool CheckActors_proximity(); \ No newline at end of file diff -r e8d329651a2a -r c193d289f0a5 Build/Visual Studio 2010/World of Might and Magic.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Build/Visual Studio 2010/World of Might and Magic.sln Thu Oct 24 23:22:46 2013 -0700 @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "World of Might and Magic", "World of Might and Magic.vcxproj", "{5DA49362-EF43-4753-85DC-88CC41F26764}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5DA49362-EF43-4753-85DC-88CC41F26764}.Debug|Win32.ActiveCfg = Debug|Win32 + {5DA49362-EF43-4753-85DC-88CC41F26764}.Debug|Win32.Build.0 = Debug|Win32 + {5DA49362-EF43-4753-85DC-88CC41F26764}.Release|Win32.ActiveCfg = Release|Win32 + {5DA49362-EF43-4753-85DC-88CC41F26764}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r e8d329651a2a -r c193d289f0a5 Build/Visual Studio 2010/World of Might and Magic.vcxproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj Thu Oct 24 23:22:46 2013 -0700 @@ -0,0 +1,378 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {5DA49362-EF43-4753-85DC-88CC41F26764} + Win32Proj + WorldofMightandMagic + + + + Application + true + v100 + Unicode + + + Application + false + v110 + true + Unicode + + + + + + + + + + + + + true + $(Configuration)\ + $(WoMM_MM7_INSTALL_DIR)\ + false + + + false + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(IntDir)%(Directory) + ProgramDatabase + + + Windows + true + ..\..\lib\legacy_dx\lib\ddraw.lib;..\..\lib\legacy_dx\lib\dxguid.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r e8d329651a2a -r c193d289f0a5 Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Thu Oct 24 23:22:46 2013 -0700 @@ -0,0 +1,419 @@ + + + + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + lib\legacy_dx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + + + + + + UI + + + Level + + + + + + NewUI + + + NewUI\Core + + + + + {674d5845-1afa-4bb4-b0f9-e59bdcf6bf46} + + + {7f786ac2-aa3f-48a5-81ef-d5bcf2ee57bf} + + + {2c8eede3-bdcb-4411-b5e3-86c1c48e8351} + + + {d3dc8b56-9b77-4b4f-adae-767b4576537d} + + + {e97134e5-029e-4065-bcd8-a4a00333b990} + + + {5fd52edd-099a-407a-b897-6a369c82b64f} + + + {161ab378-81a8-4a60-8b20-691a826dbb7d} + + + {5905ea57-e631-40d3-9139-94e4ec73c51f} + + + + + lib\legacy_dx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + lib\zlib + + + + + + + + + + + + + + + + + + + + + + + UI + + + UI + + + UI + + + UI + + + UI + + + UI + + + UI + + + UI + + + UI + + + UI + + + UI + + + UI + + + UI + + + UI + + + UI\Books + + + UI\Books + + + UI\Books + + + + + Level + + + + + NewUI + + + + + + \ No newline at end of file diff -r e8d329651a2a -r c193d289f0a5 Build/Visual Studio 2010/World of Might and Magic.vcxproj.user --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj.user Thu Oct 24 23:22:46 2013 -0700 @@ -0,0 +1,9 @@ + + + + $(OutDir) + WindowsLocalDebugger + -novideo, -nomarg + $(OutDir)$(TargetName)$(TargetExt) + + \ No newline at end of file diff -r e8d329651a2a -r c193d289f0a5 Build/Visual Studio 2012/World of Might and Magic.sln --- a/Build/Visual Studio 2012/World of Might and Magic.sln Thu Oct 24 23:21:05 2013 -0700 +++ b/Build/Visual Studio 2012/World of Might and Magic.sln Thu Oct 24 23:22:46 2013 -0700 @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "World of Might and Magic", "World of Might and Magic.vcxproj", "{5DA49362-EF43-4753-85DC-88CC41F26764}" diff -r e8d329651a2a -r c193d289f0a5 Build/Visual Studio 2012/World of Might and Magic.vcxproj diff -r e8d329651a2a -r c193d289f0a5 Build/init_win.bat --- a/Build/init_win.bat Thu Oct 24 23:21:05 2013 -0700 +++ b/Build/init_win.bat Thu Oct 24 23:22:46 2013 -0700 @@ -1,6 +1,5 @@ @echo off -set _mm7_install_dir=E:\g\mm collection\MM_VII - +set _mm7_install_dir=C:\Program Files\Buka\MMCollection\MM_VII @@ -37,10 +36,10 @@ :win_xp echo Win XP -reg add HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment /f /v "WoMM_MM7_INSTALL_DIR" /t REG_SZ /d "%_mm7_install_dir%" +reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v "WoMM_MM7_INSTALL_DIR" /t REG_SZ /d "%_mm7_install_dir%" -reg query HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment /v "WoMM_MM7_INSTALL_DIR" +reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v "WoMM_MM7_INSTALL_DIR" goto end :win_vista diff -r e8d329651a2a -r c193d289f0a5 Game.cpp --- a/Game.cpp Thu Oct 24 23:21:05 2013 -0700 +++ b/Game.cpp Thu Oct 24 23:22:46 2013 -0700 @@ -3618,7 +3618,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; if ( pCurrentScreen ) continue; - if ( _42F4DA_check_actor_proximity() ) + if ( CheckActors_proximity() ) { if ( pParty->bTurnBasedModeOn == 1 ) { diff -r e8d329651a2a -r c193d289f0a5 Render.cpp --- a/Render.cpp Thu Oct 24 23:21:05 2013 -0700 +++ b/Render.cpp Thu Oct 24 23:22:46 2013 -0700 @@ -4964,43 +4964,30 @@ //----- (004A2ED5) -------------------------------------------------------- void Render::DrawIndoorSkyPolygon(signed int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture) { - signed int v4; // edi@2 int v5; // eax@3 - int v6; // edx@5 - RenderVertexD3D3 *v7; // eax@6 - RenderVertexSoft *v8; // ecx@6 - //double v9; // st6@7 - //int v10; // ebx@7 - //int v11; // ebx@7 if ( this->uNumD3DSceneBegins ) { - v4 = uNumVertices; if ( uNumVertices >= 3 ) { ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); v5 = 31 - (pSkyPolygon->dimming_level & 0x1F); if ( v5 < pOutdoor->max_terrain_dimming_level ) v5 = pOutdoor->max_terrain_dimming_level; - v6 = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8); - for (uint i = 0; i < uNumVertices; ++i) - { - d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; - d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; - d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / array_507D30[i].vWorldViewPosition.y; - d3d_vertex_buffer[i].rhw = array_507D30[i]._rhw; - d3d_vertex_buffer[i].diffuse = v6; - d3d_vertex_buffer[i].specular = 0; - d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u; - d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v; - } - + for (uint i = 0; i < uNumVertices; ++i) + { + d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; + d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; + d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / array_507D30[i].vWorldViewPosition.y; + d3d_vertex_buffer[i].rhw = array_507D30[i]._rhw; + d3d_vertex_buffer[i].diffuse = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8); + d3d_vertex_buffer[i].specular = 0; + d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u; + d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v; + } ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture)); - ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, - D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - d3d_vertex_buffer, - uNumVertices, - 28)); + ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, + d3d_vertex_buffer, uNumVertices, 28)); } } } diff -r e8d329651a2a -r c193d289f0a5 mm7_6.cpp --- a/mm7_6.cpp Thu Oct 24 23:21:05 2013 -0700 +++ b/mm7_6.cpp Thu Oct 24 23:22:46 2013 -0700 @@ -1072,84 +1072,6 @@ pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); } -//----- (0042F4DA) -------------------------------------------------------- -int _42F4DA_check_actor_proximity() -{ - signed int v0; // edi@1 - Actor *v1; // esi@4 - int v2; // ebx@5 - int v3; // eax@5 - int v4; // ebx@5 - unsigned int v5; // ecx@5 - int v6; // edx@6 - unsigned int v7; // edx@8 - unsigned int v8; // edx@10 - __int16 v9; // ax@12 - signed int result; // eax@20 - int v11; // [sp+Ch] [bp-10h]@5 - int v12; // [sp+10h] [bp-Ch]@5 - signed int v13; // [sp+14h] [bp-8h]@3 - - v0 = 5120; - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - v0 = 2560; - v13 = 0; - if ( (signed int)uNumActors <= 0 ) - { - result = 0; - } - else - { - v1 = pActors.data(); - while ( 1 ) - { - v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); - v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); - v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); - v3 = v2; - v4 = v11; - v5 = v12; - if ( v3 < v11 ) - { - v6 = v3; - v3 = v11; - v4 = v6; - } - if ( v3 < v12 ) - { - v7 = v3; - v3 = v12; - v5 = v7; - } - if ( v4 < (signed int)v5 ) - { - v8 = v5; - v5 = v4; - v4 = v8; - } - if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) - { - v9 = v1->uAIState; - if ( v1->uAIState != 5 ) - { - if ( v9 != 4 - && v9 != 11 - && v9 != 19 - && v9 != 17 - && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) - break; - } - } - ++v13; - ++v1; - if ( v13 >= (signed int)uNumActors ) - return 0; - } - result = 1; - } - return result; -} - //----- (0042F7EB) -------------------------------------------------------- bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9) { diff -r e8d329651a2a -r c193d289f0a5 mm7_data.h --- a/mm7_data.h Thu Oct 24 23:21:05 2013 -0700 +++ b/mm7_data.h Thu Oct 24 23:22:46 2013 -0700 @@ -1097,7 +1097,6 @@ void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6); void _42ECB5_PlayerAttacksActor(); void InitializeTurnBasedAnimations(void *); -int _42F4DA_check_actor_proximity(); bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9); void __fastcall sub_42F960_create_object(int x, int y, int z); // idb void CompactLayingItemsList();