changeset 2543:b6140dfeac27

GameOver h/cpp
author a.parshin
date Sun, 10 May 2015 03:21:14 +0200
parents bacf9809126a
children c674d547cc7c
files Build/Visual Studio 2013/World of Might and Magic.vcxproj Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters Engine/Engine.cpp Engine/Engine.h Engine/ErrorHandling.h Engine/Graphics/DecalBuilder.cpp Engine/Graphics/Indoor.cpp Engine/Graphics/IndoorCameraD3D.cpp Engine/Graphics/IndoorCameraD3D.h Engine/Graphics/LightmapBuilder.cpp Engine/Graphics/Outdoor.cpp Engine/Graphics/ParticleEngine.cpp Engine/Graphics/Render.cpp Engine/Graphics/Vis.cpp Engine/Graphics/stru10.cpp Engine/Objects/Actor.cpp Engine/Objects/Player.cpp Engine/Objects/Player.h Engine/Spells/CastSpellInfo.cpp Engine/mm7_data.cpp Engine/mm7_data.h GUI/GUIWindow.cpp GUI/GUIWindow.h GUI/UI/UIHouses.cpp GUI/UI/UIPartyCreation.cpp GUI/UI/UIRest.cpp Game/Game.cpp Game/GameOver.cpp Game/GameOver.h Media/Audio/AudioPlayer.cpp OSWindow.cpp _deleted.cpp stru6.cpp
diffstat 33 files changed, 923 insertions(+), 924 deletions(-) [+]
line wrap: on
line diff
--- a/Build/Visual Studio 2013/World of Might and Magic.vcxproj	Sun May 10 02:04:52 2015 +0200
+++ b/Build/Visual Studio 2013/World of Might and Magic.vcxproj	Sun May 10 03:21:14 2015 +0200
@@ -152,6 +152,7 @@
     <ClCompile Include="..\..\Engine\VectorTypes.cpp" />
     <ClCompile Include="..\..\Engine\ZlibWrapper.cpp" />
     <ClCompile Include="..\..\Game\Game.cpp" />
+    <ClCompile Include="..\..\Game\GameOver.cpp" />
     <ClCompile Include="..\..\Game\MainMenu.cpp" />
     <ClCompile Include="..\..\GUI\GUIButton.cpp" />
     <ClCompile Include="..\..\GUI\GUIFont.cpp" />
@@ -325,6 +326,7 @@
     <ClInclude Include="..\..\Engine\VectorTypes.h" />
     <ClInclude Include="..\..\Engine\ZlibWrapper.h" />
     <ClInclude Include="..\..\Game\Game.h" />
+    <ClInclude Include="..\..\Game\GameOver.h" />
     <ClInclude Include="..\..\Game\MainMenu.h" />
     <ClInclude Include="..\..\GUI\GUIButton.h" />
     <ClInclude Include="..\..\GUI\GUIFont.h" />
--- a/Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters	Sun May 10 02:04:52 2015 +0200
+++ b/Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters	Sun May 10 03:21:14 2015 +0200
@@ -580,6 +580,9 @@
     <ClCompile Include="..\..\Engine\Engine.cpp">
       <Filter>Engine</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\Game\GameOver.cpp">
+      <Filter>Game</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\lib\libavcodec\avcodec.h">
@@ -1330,6 +1333,9 @@
     <ClInclude Include="..\..\Game\MainMenu.h">
       <Filter>Game</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\Game\GameOver.h">
+      <Filter>Game</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\lib\OpenAL\lib\x86\avcodec-55.def">
--- a/Engine/Engine.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Engine.cpp	Sun May 10 03:21:14 2015 +0200
@@ -68,6 +68,7 @@
 #include "GUI/NewUI\MainMenu.h"
 
 #include "Game/Game.h"
+#include "Game/MainMenu.h"
 
 #include <direct.h>
 
@@ -164,11 +165,11 @@
     if (pParty->_497FC5_check_party_perception_against_level())
         uFlags2 |= 2;
 
-    pEngine->pIndoorCameraD3D->sRotationX = pParty->sRotationX;
-    pEngine->pIndoorCameraD3D->sRotationY = pParty->sRotationY;
-    pEngine->pIndoorCameraD3D->vPartyPos.x = pParty->vPosition.x - pParty->y_rotation_granularity * cosf(2 * pi_double * pParty->sRotationY / 2048.0);
-    pEngine->pIndoorCameraD3D->vPartyPos.y = pParty->vPosition.y - pParty->y_rotation_granularity * sinf(2 * pi_double * pParty->sRotationY / 2048.0);
-    pEngine->pIndoorCameraD3D->vPartyPos.z = pParty->vPosition.z + pParty->sEyelevel;//193, but real 353
+    pIndoorCameraD3D->sRotationX = pParty->sRotationX;
+    pIndoorCameraD3D->sRotationY = pParty->sRotationY;
+    pIndoorCameraD3D->vPartyPos.x = pParty->vPosition.x - pParty->y_rotation_granularity * cosf(2 * pi_double * pParty->sRotationY / 2048.0);
+    pIndoorCameraD3D->vPartyPos.y = pParty->vPosition.y - pParty->y_rotation_granularity * sinf(2 * pi_double * pParty->sRotationY / 2048.0);
+    pIndoorCameraD3D->vPartyPos.z = pParty->vPosition.z + pParty->sEyelevel;//193, but real 353
 
     //pIndoorCamera->Initialize2();
     pIndoorCameraD3D->CalculateRotations(pParty->sRotationX, pParty->sRotationY);
@@ -440,7 +441,7 @@
     {
         v11 = &vis_face_filter;
         v10 = &vis_sprite_filter_2;
-        depth = pEngine->pIndoorCameraD3D->GetPickDepth();
+        depth = pIndoorCameraD3D->GetPickDepth();
     }
     else
     {
@@ -1858,7 +1859,7 @@
                     break;
                 assert(false && "Invalid game state");
             }
-            if (GetCurrentMenuID() == MENU_CREDITS)
+            else if (GetCurrentMenuID() == MENU_CREDITS)
             {
                 if (use_music_folder)
                     alSourceStop(mSourceID);
@@ -1870,34 +1871,31 @@
                 MainMenuUI_Credits_Loop();
                 break;
             }
-            if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
+            else if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
             {
                 uGameState = GAME_STATE_PLAYING;
                 Game_Loop();
             }
-            else
+            else if (GetCurrentMenuID() == MENU_DebugBLVLevel)
             {
-                if (GetCurrentMenuID() == MENU_DebugBLVLevel)
+                pMouse->ChangeActivation(0);
+                pParty->Reset();
+                pParty->CreateDefaultParty(1);
+
+                __debugbreak();
+                /*extern void CreateDefaultBLVLevel();
+                CreateDefaultBLVLevel();
+
+                OPENFILENAMEA ofn;
+                if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) )
                 {
-                    pMouse->ChangeActivation(0);
-                    pParty->Reset();
-                    pParty->CreateDefaultParty(1);
-
-                    __debugbreak();
-                    /*extern void CreateDefaultBLVLevel();
-                    CreateDefaultBLVLevel();
-
-                    OPENFILENAMEA ofn;
-                    if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) )
-                    {
-                    pMouse->ChangeActivation(1);
-                    break;
-                    }
-                    _chdir("..\\");
-                    strcpy(pCurrentMapName, ofn.lpstrFileTitle);*/
-                    pMouse->ChangeActivation(1);
-                    Game_Loop();
+                pMouse->ChangeActivation(1);
+                break;
                 }
+                _chdir("..\\");
+                strcpy(pCurrentMapName, ofn.lpstrFileTitle);*/
+                pMouse->ChangeActivation(1);
+                Game_Loop();
             }
             if (uGameState == GAME_STATE_LOADING_GAME)
             {
@@ -2000,9 +1998,9 @@
     pODMRenderParams->bNoSky = GetPrivateProfileIntW(L"outdoor", L"nosky", 0, pIniFilename);
     pODMRenderParams->bDoNotRenderDecorations = GetPrivateProfileIntW(L"render", L"nodecorations", 0, pIniFilename);
     pODMRenderParams->outdoor_no_wavy_water = GetPrivateProfileIntW(L"outdoor", L"nowavywater", 0, pIniFilename);
-    outdoor_grid_band_1 = GetPrivateProfileIntW(L"outdoor", L"gridband1", 10, pIniFilename);
-    outdoor_grid_band_2 = GetPrivateProfileIntW(L"outdoor", L"gridband2", 15, pIniFilename);
-    outdoor_grid_band_3 = GetPrivateProfileIntW(L"outdoor", L"gridband3", 25, pIniFilename);
+    //outdoor_grid_band_1 = GetPrivateProfileIntW(L"outdoor", L"gridband1", 10, pIniFilename);
+    //outdoor_grid_band_2 = GetPrivateProfileIntW(L"outdoor", L"gridband2", 15, pIniFilename);
+    //outdoor_grid_band_3 = GetPrivateProfileIntW(L"outdoor", L"gridband3", 25, pIniFilename);
     pODMRenderParams->terrain_gamma = GetPrivateProfileIntW(L"outdoor", L"ter_gamma", 0, pIniFilename);
     pODMRenderParams->building_gamme = GetPrivateProfileIntW(L"outdoor", L"bld_gamma", 0, pIniFilename);
     pODMRenderParams->shading_dist_shade = GetPrivateProfileIntW(L"shading", L"dist_shade", 2048, pIniFilename);
@@ -2072,12 +2070,13 @@
         pODMRenderParams->outdoor_no_wavy_water = 0;
         //_47F4D3_initialize_terrain_bezier_stuff(outdoor_grid_band_1, outdoor_grid_band_2, outdoor_grid_band_3);
         {
-            pODMRenderParams->outdoor_grid_band_3 = outdoor_grid_band_3;
-            pODMRenderParams->uPickDepth = outdoor_grid_band_3 * 512;
+            pODMRenderParams->outdoor_grid_band_3 = 25;//outdoor_grid_band_3;
+            pODMRenderParams->uPickDepth = 25 * 512;//outdoor_grid_band_3 * 512;
         }
     }
     else
         LOBYTE(viewparams->field_20) = 0;
+
     pParty->uFlags |= 2;
     viewparams->uSomeY = viewparams->uScreen_topL_Y;
     viewparams->uSomeX = viewparams->uScreen_topL_X;
@@ -2101,180 +2100,7 @@
     viewparams->_443365();
     PlayLevelMusic();
 }
-// 6BE35C: using guessed type int uLevel_StartingPointType;
-
-
-
-//----- (004BF91E) --------------------------------------------------------
-unsigned int GameOverMenu(void *ecx0)
-{
-    const char *v1; // eax@2
-    unsigned int result; // eax@3
-    const char *v6; // eax@10
-    const char *v7; // edx@10
-    const char *v8; // ecx@12
-    const char *v9; // eax@14
-    unsigned int v10; // eax@25
-    GUIWindow pWindow; // [sp+34h] [bp-9Ch]@1
-    unsigned int v14; // [sp+A4h] [bp-2Ch]@5
-    void *v15; // [sp+A8h] [bp-28h]@1
-    const char *pInString; // [sp+ACh] [bp-24h]@5
-    unsigned int v17; // [sp+B0h] [bp-20h]@5
-    unsigned int v18; // [sp+B4h] [bp-1Ch]@5
-    unsigned int v19; // [sp+B8h] [bp-18h]@5
-    int v20; // [sp+BCh] [bp-14h]@7
-    GUIFont *pFont; // [sp+C4h] [bp-Ch]@1
-    unsigned __int64 v23; // [sp+C8h] [bp-8h]@5
-    MSG msg;
-
-    v15 = ecx0;
-
-    RGBTexture _this; // [sp+Ch] [bp-C4h]@1
-    //RGBTexture::RGBTexture(&this);
-
-    dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_4000;
-    bGameoverLoop = 1;
-    pMediaPlayer->bStopBeforeSchedule = 0;
-    pAudioPlayer->StopChannels(-1, -1);
-    pRenderer->BeginScene();
-    pRenderer->ClearBlack();
-    pRenderer->EndScene();
-    pRenderer->Present();
-    //pMediaPlayer->pResetflag = 0;
-    _449B57_test_bit(pParty->_quest_bits, 99);
-    _this.Load("winbg.pcx", 2);
-    pRenderer->BeginScene();
-    pRenderer->DrawTextureRGB(0, 0, &_this);
-    pRenderer->EndScene();
-    free(_this.pPixels);
-    _this.pPixels = 0;
-    window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0);
-    pWindow.uFrameX = 75;
-    pWindow.uFrameY = 60;
-    pWindow.uFrameWidth = 469;
-    pWindow.uFrameHeight = 338;
-    pWindow.uFrameZ = 543;
-    pWindow.uFrameW = 397;
-    pFont = LoadFont("endgame.fnt", "FONTPAL", NULL);
-    if (pParty->IsPartyGood())
-        v1 = pGlobalTXT_LocalizationStrings[675];//"Splendid job!  With the activation of the Gate, a thousand worlds lie at your feet.  Perhaps on one of them you will find the Ancients themselves, and return with the fruits their great civilization has to offer your world and your kingdom."
-    else
-    {
-        result = pParty->IsPartyEvil();
-        if (!(short)result)
-            return result;
-        v1 = pGlobalTXT_LocalizationStrings[676];//"Brilliant!  The completion of the Heavenly Forge has provided enough Ancient weapons to crush all resistance to your plans.  Soon the world will bow to your every whim!  Still, you can't help but wonder what was beyond the Gate the other side was trying so hard to build."
-    }
-    pInString = v1;
-    v23 = pParty->uTimePlayed - 138240;
-    v19 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24;
-    v14 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C / 0xC;
-    v18 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C % 0xC;
-    v17 = v19 % 0x1C;
-    if (!v19)
-        v19 = 1;
-    pRenderer->BeginScene();
-    pWindow.DrawTitleText(pFont, 1, 0x23, 1, pGlobalTXT_LocalizationStrings[9], 3);//Congratulations!
-    v23 = 0i64;
-    v20 = 0;
-    for (uint i = 0; i < 4; i++)
-    {
-        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[129], pParty->pPlayers[i].pName, pParty->pPlayers[i].GetBaseLevel(), pClassNames[pParty->pPlayers[i].classType]);//%s the Level %u %s
-        pWindow.DrawTitleText(pFont, 1, i * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46, 1, pTmpBuf.data(), 3);
-        v23 += pParty->pPlayers[i].uExperience;//__PAIR__(*(int *)(i - 4), *(int *)(i - 8));
-    }
-    v23 = (signed __int64)v23 / v19;
-    v6 = FitTextInAWindow(pInString, pFont, &pWindow, 0xC, 0);
-    pWindow.DrawTitleText(pFont, 1, 5 * (LOBYTE(pFont->uFontHeight) + 11), 1, v6, 0);
-    strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[37]);//Total Time:
-
-    v7 = pGlobalTXT_LocalizationStrings[56];
-    if (v17 != 1)
-        v7 = pGlobalTXT_LocalizationStrings[57];
-
-    v8 = pGlobalTXT_LocalizationStrings[146];//Month
-    if (v18 != 1)
-        v8 = pGlobalTXT_LocalizationStrings[148];//Months
-
-    v9 = pGlobalTXT_LocalizationStrings[245];
-    if (v14 != 1)
-        v9 = pGlobalTXT_LocalizationStrings[132];
-
-    sprintf(pTmpBuf2.data(), " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
-    strcat(pTmpBuf.data(), pTmpBuf2.data());
-    pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1, pTmpBuf.data(), 3);
-    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23);
-    pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight, 1, pTmpBuf.data(), 3);
-    dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
-    pRenderer->EndScene();
-    pRenderer->Present();
-    //if ( pRenderer->pRenderD3D )
-    pRenderer->pBeforePresentFunction();
-    pRenderer->SaveWinnersCertificate("MM7_Win.Pcx");
-    free(pFont);
-    window_SpeakInHouse->Release();
-    window_SpeakInHouse = 0;
-    if (v15 == (void *)2)
-        result = pMessageQueue_50CBD0->uNumMessages;
-    else
-    {
-        LODWORD(v23) = GetTickCount() + 5000;
-        while ((unsigned int)v23 > GetTickCount())
-            ;
-        while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
-        {
-            if (msg.message == WM_QUIT)
-                Engine_DeinitializeAndTerminate(0);
-            TranslateMessage(&msg);
-            DispatchMessage(&msg);
-        }
-        if (pMessageQueue_50CBD0->uNumMessages)
-        {
-            LOBYTE(v10) = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-            pMessageQueue_50CBD0->uNumMessages = v10;
-        }
-        pKeyActionMap->ResetKeys();
-        pKeyActionMap->uLastKeyPressed = 0;
-        do
-        {
-            while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
-            {
-                if (msg.message == WM_QUIT)
-                    Engine_DeinitializeAndTerminate(0);
-                TranslateMessage(&msg);
-                DispatchMessage(&msg);
-            }
-        } while (!pKeyActionMap->uLastKeyPressed);
-        result = pMessageQueue_50CBD0->uNumMessages;
-        if (pMessageQueue_50CBD0->uNumMessages)
-        {
-            result = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-            pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-        }
-    }
-    if (v15)
-    {
-        /*if ( (signed int)result < 40 )
-        {
-        pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit;
-        }*/
-        pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Quit, 1, 0);
-    }
-    else
-    {
-        pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ShowFinalWindow, 1, 0);
-        /*if ( (signed int)result < 40 )
-        {
-        pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5;
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
-        result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
-        *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
-        ++pMessageQueue_50CBD0->uNumMessages;
-        }*/
-    }
-    bGameoverLoop = 0;
-    return result;
-}
+
 
 //----- (00464479) --------------------------------------------------------
 void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows()
@@ -2428,11 +2254,11 @@
 
     pGameLoadingUI_ProgressBar->Progress();
 
-    pEngine->pIndoorCameraD3D->vPartyPos.x = 0;
-    pEngine->pIndoorCameraD3D->vPartyPos.y = 0;
-    pEngine->pIndoorCameraD3D->vPartyPos.z = 100;
-    pEngine->pIndoorCameraD3D->sRotationX = 0;
-    pEngine->pIndoorCameraD3D->sRotationY = 0;
+    pIndoorCameraD3D->vPartyPos.x = 0;
+    pIndoorCameraD3D->vPartyPos.y = 0;
+    pIndoorCameraD3D->vPartyPos.z = 100;
+    pIndoorCameraD3D->sRotationX = 0;
+    pIndoorCameraD3D->sRotationY = 0;
     viewparams->bRedrawGameUI = true;
     uLevel_StartingPointType = MapStartPoint_Party;
     pSprites_LOD->_461397();
--- a/Engine/Engine.h	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Engine.h	Sun May 10 03:21:14 2015 +0200
@@ -131,7 +131,7 @@
     //----- (0042EB6A) --------------------------------------------------------
     struct stru6 *GetStru6() { return this->pStru6Instance; }
     //----- (0042EB71) --------------------------------------------------------
-    struct IndoorCameraD3D *GetIndoorCamera() { return this->pIndoorCameraD3D; }
+    //struct IndoorCameraD3D *GetIndoorCamera() { return this->pIndoorCameraD3D; }
 
 
     //void ( ***vdestructor_ptr)(Game *, bool);
@@ -174,7 +174,7 @@
     LightmapBuilder *pLightmapBuilder;
     Vis *pVisInstance;
     stru6 *pStru6Instance;
-    IndoorCameraD3D *pIndoorCameraD3D;
+    void *__depricated5;//IndoorCameraD3D *pIndoorCameraD3D;
     stru9 *pStru9Instance;
     stru10 *pStru10Instance;
     void/*stru11*/ *pStru11Instance;
@@ -215,8 +215,6 @@
 void MM7Initialization();
 
 void __fastcall PrepareToLoadODM(unsigned int bLoading, struct ODMRenderParams *a2);
-void MainMenu_Loop();
-unsigned int GameOverMenu(void *ecx0);
 void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
 void _461103_load_level_sub();
 void  InitializeTurnBasedAnimations(void *);
--- a/Engine/ErrorHandling.h	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/ErrorHandling.h	Sun May 10 03:21:14 2015 +0200
@@ -1,5 +1,6 @@
+#pragma once
 #define _CRT_NON_CONFORMING_SWPRINTFS
-#pragma once
+#define _CRT_SECURE_NO_WARNINGS
 
 #define Error(format, ...)      do {Error_impl_(__FILE__, __FUNCTION__, __LINE__, format, __VA_ARGS__); __debugbreak(); exit(0); } while (0)
 #define Assert(condition, ...)  Assert_impl_(__FILE__, __FUNCTION__, __LINE__, condition, #condition,  __VA_ARGS__)
--- a/Engine/Graphics/DecalBuilder.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Graphics/DecalBuilder.cpp	Sun May 10 03:21:14 2015 +0200
@@ -138,7 +138,7 @@
 		++a6;
       }
     v16 = a4;
-    if ( pEngine->pIndoorCameraD3D->_437376(a4, static_AE4F90, (unsigned int *)&a5) == 1 )
+    if ( pIndoorCameraD3D->_437376(a4, static_AE4F90, (unsigned int *)&a5) == 1 )
     {
       if ( !a5 )
         return 0;
@@ -156,7 +156,7 @@
   //LODWORD(v36) = (DWORD)&static_AE4F60.field_10;
   static_AE4F60.field_4.z = v16->face_plane.vNormal.z;
   static_AE4F60.dist = v16->face_plane.dist;
-  if ( !pEngine->pIndoorCameraD3D->GetFacetOrientation(v16->polygonType, &static_AE4F60.field_4,
+  if ( !pIndoorCameraD3D->GetFacetOrientation(v16->polygonType, &static_AE4F60.field_4,
      &static_AE4F60.field_10, &static_AE4F60.field_1C) )
       MessageBoxW(nullptr, L"Error: Failed to get the facet orientation", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:101", 0);
   
@@ -285,8 +285,8 @@
     if ( !decal->uNumVertices )
       return 1;
 
-    pEngine->pIndoorCameraD3D->ViewTransform(decal->pVertices, (unsigned int)decal->uNumVertices);
-    pEngine->pIndoorCameraD3D->Project(decal->pVertices, decal->uNumVertices, 0);
+    pIndoorCameraD3D->ViewTransform(decal->pVertices, (unsigned int)decal->uNumVertices);
+    pIndoorCameraD3D->Project(decal->pVertices, decal->uNumVertices, 0);
     if ( !(uClipFlags & 1) )
     {
       ++this->field_308008;
@@ -302,13 +302,13 @@
     {
       if ( uClipFlags & 2 )
       {
-        pEngine->pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(decal->pVertices, decal->uNumVertices, this->pVertices, &a8b);
-        pEngine->pIndoorCameraD3D->_437143(a8b, decal->pVertices, this->pVertices, (signed int *)&decal->uNumVertices);
+        pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(decal->pVertices, decal->uNumVertices, this->pVertices, &a8b);
+        pIndoorCameraD3D->_437143(a8b, decal->pVertices, this->pVertices, (signed int *)&decal->uNumVertices);
       }
       else if ( uClipFlags & 4 )
       {
-        pEngine->pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(decal->pVertices, decal->uNumVertices, this->pVertices, &a8b);
-        pEngine->pIndoorCameraD3D->_437143(a8b, decal->pVertices, this->pVertices, (signed int *)&decal->uNumVertices);
+        pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(decal->pVertices, decal->uNumVertices, this->pVertices, &a8b);
+        pIndoorCameraD3D->_437143(a8b, decal->pVertices, this->pVertices, (signed int *)&decal->uNumVertices);
       }
       else
         MessageBoxA(nullptr, "Undefined clip flag specified", "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:258", 0);
@@ -483,10 +483,10 @@
 		else
 			MessageBoxW(nullptr, L"Uknown strip type detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:434", 0);
         //v21 = uStripType;
-        //v13 = pEngine->pIndoorCameraD3D->GetPolygonMinZ(v8, uStripType);
+        //v13 = pIndoorCameraD3D->GetPolygonMinZ(v8, uStripType);
         //v21 = uStripType;
-        v28 = pEngine->pIndoorCameraD3D->GetPolygonMinZ(a5, uStripType);
-        v26 = pEngine->pIndoorCameraD3D->GetPolygonMaxZ(a5, uStripType);
+        v28 = pIndoorCameraD3D->GetPolygonMinZ(a5, uStripType);
+        v26 = pIndoorCameraD3D->GetPolygonMaxZ(a5, uStripType);
 		if ( a3 - pBloodsplatContainer->std__vector_pBloodsplats[i].radius < pBloodsplatContainer->std__vector_pBloodsplats[i].x &&
 			v31 + pBloodsplatContainer->std__vector_pBloodsplats[i].radius > pBloodsplatContainer->std__vector_pBloodsplats[i].x &&
 			v30 - pBloodsplatContainer->std__vector_pBloodsplats[i].radius < pBloodsplatContainer->std__vector_pBloodsplats[i].y &&
@@ -558,7 +558,7 @@
 void DecalBuilder::DrawDecalDebugOutlines()
 {
   for(int i = 0; i < std__vector_pDecals_size; i++)
-	pEngine->pIndoorCameraD3D->debug_outline_sw(std__vector_pDecals[i].pVertices, std__vector_pDecals[i].uNumVertices, 0xC86400u, 0.0);
+	pIndoorCameraD3D->debug_outline_sw(std__vector_pDecals[i].pVertices, std__vector_pDecals[i].uNumVertices, 0xC86400u, 0.0);
 }
 
 //----- (0040E4C2) --------------------------------------------------------
--- a/Engine/Graphics/Indoor.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Graphics/Indoor.cpp	Sun May 10 03:21:14 2015 +0200
@@ -109,9 +109,9 @@
     //LOBYTE(v1) = _4E94D0_light_type;
     //v4 = pParty->flt_TorchlightColorR + 6.7553994e15;
     //v3 = pParty->flt_TorchlightColorG + 6.7553994e15;
-    pMobileLightsStack->AddLight(pEngine->pIndoorCameraD3D->vPartyPos.x,
-                                 pEngine->pIndoorCameraD3D->vPartyPos.y,
-                                 pEngine->pIndoorCameraD3D->vPartyPos.z,
+    pMobileLightsStack->AddLight(pIndoorCameraD3D->vPartyPos.x,
+                                 pIndoorCameraD3D->vPartyPos.y,
+                                 pIndoorCameraD3D->vPartyPos.z,
                                  pBLVRenderParams->uPartySectorID,
                                  v5,
                                  floorf(pParty->flt_TorchlightColorR + 0.5f),
@@ -142,11 +142,11 @@
 
   this->field_0_timer_ = pEventTimer->uTotalGameTimeElapsed;
 
-  pEngine->pIndoorCameraD3D->debug_flags = 0;
+  pIndoorCameraD3D->debug_flags = 0;
   if (viewparams->draw_sw_outlines)
-    pEngine->pIndoorCameraD3D->debug_flags |= BLV_RENDER_DRAW_SW_OUTLINES;
+    pIndoorCameraD3D->debug_flags |= BLV_RENDER_DRAW_SW_OUTLINES;
   if (viewparams->draw_d3d_outlines)
-    pEngine->pIndoorCameraD3D->debug_flags |= BLV_RENDER_DRAW_D3D_OUTLINES;
+    pIndoorCameraD3D->debug_flags |= BLV_RENDER_DRAW_D3D_OUTLINES;
 
   //v2 = a2;
   //this->field_0_timer_ = a2->field_0_timer;
@@ -159,9 +159,9 @@
   //this->sPartyRotY = a2->sRotationY;
   //v6 = this->vPartyPos.x;
   //this->sPartyRotX = a2->sRotationX;
-  v7 = pIndoor->GetSector(pEngine->pIndoorCameraD3D->vPartyPos.x,
-                          pEngine->pIndoorCameraD3D->vPartyPos.y,
-                          pEngine->pIndoorCameraD3D->vPartyPos.z);
+  v7 = pIndoor->GetSector(pIndoorCameraD3D->vPartyPos.x,
+                          pIndoorCameraD3D->vPartyPos.y,
+                          pIndoorCameraD3D->vPartyPos.z);
   this->uPartySectorID = v7;
   if ( !v7 )
   {
@@ -175,14 +175,14 @@
   }
   //if ( pRenderer->pRenderD3D )
   {
-    //this->sCosineY = stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationY);
-    //this->sSineY = stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationY);
-    //this->sCosineNegX = stru_5C6E00->Cos(-pEngine->pIndoorCameraD3D->sRotationX);
-    //this->sSineNegX = stru_5C6E00->Sin(-pEngine->pIndoorCameraD3D->sRotationX);
-    //this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)pEngine->pIndoorCameraD3D->sRotationY * 0.00048828125);
-    //this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)pEngine->pIndoorCameraD3D->sRotationY * 0.00048828125);
-    //this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-pEngine->pIndoorCameraD3D->sRotationX * 0.00048828125);
-    //this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-pEngine->pIndoorCameraD3D->sRotationX * 0.00048828125);
+    //this->sCosineY = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationY);
+    //this->sSineY = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationY);
+    //this->sCosineNegX = stru_5C6E00->Cos(-pIndoorCameraD3D->sRotationX);
+    //this->sSineNegX = stru_5C6E00->Sin(-pIndoorCameraD3D->sRotationX);
+    //this->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)pIndoorCameraD3D->sRotationY * 0.00048828125);
+    //this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)pIndoorCameraD3D->sRotationY * 0.00048828125);
+    //this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-pIndoorCameraD3D->sRotationX * 0.00048828125);
+    //this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-pIndoorCameraD3D->sRotationX * 0.00048828125);
     this->field_64 = pViewport->field_of_view;
     
     this->uViewportX = pViewport->uScreen_TL_X;
@@ -428,7 +428,7 @@
   if (!pFace->GetTexture())
     return;
 
-  if (!pEngine->pIndoorCameraD3D->IsCulled(pFace))
+  if (!pIndoorCameraD3D->IsCulled(pFace))
   {
     uNumVerticesa = pFace->uNumVertices;
     for (uint i = 0; i < pFace->uNumVertices; ++i)
@@ -443,8 +443,8 @@
     if (!pVertices ||
         (pEngine->pStru9Instance->_498377(pPortalBounding, 4, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) )
     {
-      if (pEngine->pIndoorCameraD3D->CalcPortalShape(static_vertices_F7C228, &uNumVerticesa,
-                     static_vertices_F7B628, pEngine->pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa )
+      if (pIndoorCameraD3D->CalcPortalShape(static_vertices_F7C228, &uNumVerticesa,
+                     static_vertices_F7B628, pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa )
       {
         a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel);
         v17 = (248 - (SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel) << 3))
@@ -453,8 +453,8 @@
         sub_4B0E07(uFaceID);
         pEngine->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID);
         pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID);
-        pEngine->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28);
-        pEngine->pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0);
+        pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28);
+        pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0);
         pEngine->pLightmapBuilder->std__vector_000004_size = 0;
         if (stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0)
         {
@@ -557,16 +557,16 @@
   if (nodes[node_id].uFaceID == uFaceID)
     return;
   if (!node_id &&
-      pEngine->pIndoorCameraD3D->vPartyPos.x >= pFace->pBounding.x1 - 16 &&  // we are probably standing at the portal plane
-      pEngine->pIndoorCameraD3D->vPartyPos.x <= pFace->pBounding.x2 + 16 &&
-      pEngine->pIndoorCameraD3D->vPartyPos.y >= pFace->pBounding.y1 - 16 &&
-      pEngine->pIndoorCameraD3D->vPartyPos.y <= pFace->pBounding.y2 + 16 &&
-      pEngine->pIndoorCameraD3D->vPartyPos.z >= pFace->pBounding.z1 - 16 &&
-      pEngine->pIndoorCameraD3D->vPartyPos.z <= pFace->pBounding.z2 + 16 )
+      pIndoorCameraD3D->vPartyPos.x >= pFace->pBounding.x1 - 16 &&  // we are probably standing at the portal plane
+      pIndoorCameraD3D->vPartyPos.x <= pFace->pBounding.x2 + 16 &&
+      pIndoorCameraD3D->vPartyPos.y >= pFace->pBounding.y1 - 16 &&
+      pIndoorCameraD3D->vPartyPos.y <= pFace->pBounding.y2 + 16 &&
+      pIndoorCameraD3D->vPartyPos.z >= pFace->pBounding.z1 - 16 &&
+      pIndoorCameraD3D->vPartyPos.z <= pFace->pBounding.z2 + 16 )
   {
-    if ( abs(pFace->pFacePlane_old.dist + pEngine->pIndoorCameraD3D->vPartyPos.x * pFace->pFacePlane_old.vNormal.x
-                                        + pEngine->pIndoorCameraD3D->vPartyPos.y * pFace->pFacePlane_old.vNormal.y
-                                        + pEngine->pIndoorCameraD3D->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane
+    if ( abs(pFace->pFacePlane_old.dist + pIndoorCameraD3D->vPartyPos.x * pFace->pFacePlane_old.vNormal.x
+                                        + pIndoorCameraD3D->vPartyPos.y * pFace->pFacePlane_old.vNormal.y
+                                        + pIndoorCameraD3D->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane
     {
       pTransitionSector = pFace->uSectorID;
       if ( nodes[0].uSectorID == pTransitionSector )  // draw back sector
@@ -584,9 +584,9 @@
     }
   }
 
-  v9 = pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pEngine->pIndoorCameraD3D->vPartyPos.x)
-     + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pEngine->pIndoorCameraD3D->vPartyPos.y)
-     + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pEngine->pIndoorCameraD3D->vPartyPos.z);
+  v9 = pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pIndoorCameraD3D->vPartyPos.x)
+     + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pIndoorCameraD3D->vPartyPos.y)
+     + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pIndoorCameraD3D->vPartyPos.z);
   if (nodes[node_id].uSectorID != pFace->uSectorID)
     v9 = -v9;
   if (v9 >= 0)
@@ -646,7 +646,7 @@
       }
 
       unsigned int pNewNumVertices = pFace->uNumVertices;
-      pEngine->pIndoorCameraD3D->CalcPortalShape(static_subAddFaceToRenderList_d3d_stru_F7AA08, &pNewNumVertices,
+      pIndoorCameraD3D->CalcPortalShape(static_subAddFaceToRenderList_d3d_stru_F7AA08, &pNewNumVertices,
                                                static_subAddFaceToRenderList_d3d_stru_F79E08, nodes[node_id].std__vector_0007AC, 4, 0, 0);
 
       v29 = pEngine->pStru10Instance->_49C5DA(pFace, static_subAddFaceToRenderList_d3d_stru_F79E08, &pNewNumVertices,
@@ -659,9 +659,9 @@
       nodes[num_nodes].viewing_portal_id = uFaceID;
       AddBspNodeToRenderList(++num_nodes - 1);
     }
-    if (pEngine->pIndoorCameraD3D->debug_flags & BLV_RENDER_DRAW_SW_OUTLINES)
-      pEngine->pIndoorCameraD3D->PrepareAndDrawDebugOutline(pFace, 0x1E1EFF);
-    //pEngine->pIndoorCameraD3D->DebugDrawPortal(pFace);
+    if (pIndoorCameraD3D->debug_flags & BLV_RENDER_DRAW_SW_OUTLINES)
+      pIndoorCameraD3D->PrepareAndDrawDebugOutline(pFace, 0x1E1EFF);
+    //pIndoorCameraD3D->DebugDrawPortal(pFace);
   }
 }
 
@@ -3413,7 +3413,7 @@
     if (pActors[i].uAIState == Removed || pActors[i].uAIState == Disabled)
       continue;
 
-    v4 = stru_5C6E00->Atan2(pActors[i].vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x, pActors[i].vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
+    v4 = stru_5C6E00->Atan2(pActors[i].vPosition.x - pIndoorCameraD3D->vPartyPos.x, pActors[i].vPosition.y - pIndoorCameraD3D->vPartyPos.y);
     v6 = ((signed int)(pActors[i].uYawAngle + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7;
     v8 = pActors[i].uCurrentActionTime;
     if ( pParty->bTurnBasedModeOn )
@@ -3452,10 +3452,10 @@
     {
       if ( pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] == pActors[i].uSectorID )
       {
-        if ( !pEngine->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pActors[i].vPosition.x, pActors[i].vPosition.y, pActors[i].vPosition.z, &x, &y, &z, 1)
+        if ( !pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pActors[i].vPosition.x, pActors[i].vPosition.y, pActors[i].vPosition.z, &x, &y, &z, 1)
           || abs(x) < abs(y) )
           continue;
-        pEngine->pIndoorCameraD3D->Project(x, y, z, &v43, &a6);
+        pIndoorCameraD3D->Project(x, y, z, &v43, &a6);
         if (uNumBillboardsToDraw >= 500)
           break;
         ++uNumBillboardsToDraw;
@@ -3473,8 +3473,8 @@
         }
         else
         {*/
-          pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x = pEngine->pIndoorCameraD3D->fov_x;
-          pBillboardRenderList[uNumBillboardsToDraw - 1].fov_y = pEngine->pIndoorCameraD3D->fov_y;
+          pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x = pIndoorCameraD3D->fov_x;
+          pBillboardRenderList[uNumBillboardsToDraw - 1].fov_y = pIndoorCameraD3D->fov_y;
           LODWORD(v18) = 0;
           HIDWORD(v18) = floorf(pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x + 0.5f);
           pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat = fixpoint_mul(v9->scale, v18 / x);
@@ -3549,8 +3549,8 @@
           {
             v4 = pSpriteFrameTable->GetFrame(pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uSpriteID, pSpriteObjects[i].uSpriteFrameID);
             a6 = v4->uGlowRadius * pSpriteObjects[i].field_22_glow_radius_multiplier;
-            v6 = stru_5C6E00->Atan2(pSpriteObjects[i].vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x,
-                                    pSpriteObjects[i].vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
+            v6 = stru_5C6E00->Atan2(pSpriteObjects[i].vPosition.x - pIndoorCameraD3D->vPartyPos.x,
+                                    pSpriteObjects[i].vPosition.y - pIndoorCameraD3D->vPartyPos.y);
             LOWORD(v7) = pSpriteObjects[i].uFacing;
             v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7;
             pBillboardRenderList[uNumBillboardsToDraw].HwSpriteID = v4->pHwSpriteIDs[v9];
@@ -3575,10 +3575,10 @@
                                                     pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uParticleTrailColorG,
                                                     pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uParticleTrailColorB, _4E94D3_light_type);
             }
-            if ( pEngine->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pSpriteObjects[i].vPosition.x, pSpriteObjects[i].vPosition.y,
+            if ( pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pSpriteObjects[i].vPosition.x, pSpriteObjects[i].vPosition.y,
                                                                                     pSpriteObjects[i].vPosition.z, &x, &y, &z, 1) )
             {
-              pEngine->pIndoorCameraD3D->Project(x, y, z, &v36, &v35);
+              pIndoorCameraD3D->Project(x, y, z, &v36, &v35);
 
               assert(uNumBillboardsToDraw < 500);
               //if ( (signed int)uNumBillboardsToDraw >= 500 )
@@ -3590,8 +3590,8 @@
               pBillboardRenderList[uNumBillboardsToDraw - 1].uIndoorSectorID = pSpriteObjects[i].uSectorID;
               //if ( pRenderer->pRenderD3D )
               {
-                pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x = pEngine->pIndoorCameraD3D->fov_x;
-                pBillboardRenderList[uNumBillboardsToDraw - 1].fov_y = pEngine->pIndoorCameraD3D->fov_y;
+                pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x = pIndoorCameraD3D->fov_x;
+                pBillboardRenderList[uNumBillboardsToDraw - 1].fov_y = pIndoorCameraD3D->fov_y;
                 LODWORD(v18) = 0;
                 HIDWORD(v18) = (int)floorf(pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x + 0.5f);
                 pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat = fixpoint_mul(v4->scale, v18 / x);
@@ -3679,9 +3679,9 @@
     pNode = &pIndoor->pNodes[uFirstNode];
     pFace = &pIndoor->pFaces[pSector->pFaceIDs[pNode->uCoplanarOffset]];
     v5 = pFace->pFacePlane_old.dist +
-         pEngine->pIndoorCameraD3D->vPartyPos.x * pFace->pFacePlane_old.vNormal.x +
-         pEngine->pIndoorCameraD3D->vPartyPos.y * pFace->pFacePlane_old.vNormal.y +
-         pEngine->pIndoorCameraD3D->vPartyPos.z * pFace->pFacePlane_old.vNormal.z;//plane equation
+         pIndoorCameraD3D->vPartyPos.x * pFace->pFacePlane_old.vNormal.x +
+         pIndoorCameraD3D->vPartyPos.y * pFace->pFacePlane_old.vNormal.y +
+         pIndoorCameraD3D->vPartyPos.z * pFace->pFacePlane_old.vNormal.z;//plane equation
     if (pFace->Portal() && pFace->uSectorID != node->uSectorID )
       v5 = -v5;
     //v11 = v5 > 0;
@@ -3754,8 +3754,8 @@
     return;
 
   v8 = pLevelDecorations[uDecorationID].field_10_y_rot + ((signed int)stru_5C6E00->uIntegerPi >> 3)
-     - stru_5C6E00->Atan2(pLevelDecorations[uDecorationID].vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x,
-                          pLevelDecorations[uDecorationID].vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
+     - stru_5C6E00->Atan2(pLevelDecorations[uDecorationID].vPosition.x - pIndoorCameraD3D->vPartyPos.x,
+                          pLevelDecorations[uDecorationID].vPosition.y - pIndoorCameraD3D->vPartyPos.y);
   v9 = ((signed int)(stru_5C6E00->uIntegerPi + v8) >> 8) & 7;
   v37 = pBLVRenderParams->field_0_timer_;
   if (pParty->bTurnBasedModeOn)
@@ -3771,13 +3771,13 @@
     LOBYTE(v30) = v30 | 0x80;
   if ( (256 << v9) & v11->uFlags )
     v30 |= 4;
-  if ( pEngine->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pLevelDecorations[uDecorationID].vPosition.x,
+  if ( pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pLevelDecorations[uDecorationID].vPosition.x,
                                                                           pLevelDecorations[uDecorationID].vPosition.y,
                                                                           pLevelDecorations[uDecorationID].vPosition.z, &x, &y, &z, 1) )
   {
     if ( abs(x) >= abs(y) )
     {
-      pEngine->pIndoorCameraD3D->Project(x, y, z, &a5, &a6);
+      pIndoorCameraD3D->Project(x, y, z, &a5, &a6);
 
       assert(uNumBillboardsToDraw < 500);
 
@@ -3796,8 +3796,8 @@
       }
       else
       {*/
-        pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x = pEngine->pIndoorCameraD3D->fov_x;
-        pBillboardRenderList[uNumBillboardsToDraw - 1].fov_y = pEngine->pIndoorCameraD3D->fov_y;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x = pIndoorCameraD3D->fov_x;
+        pBillboardRenderList[uNumBillboardsToDraw - 1].fov_y = pIndoorCameraD3D->fov_y;
         LODWORD(v20) = 0;
         HIDWORD(v20) = floorf(pBillboardRenderList[uNumBillboardsToDraw - 1].fov_x + 0.5f);
         pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat = fixpoint_mul(v11->scale, v20 / x);
@@ -3881,30 +3881,30 @@
   int v28; // [sp+1Ch] [bp-Ch]@1
   int v29; // [sp+24h] [bp-4h]@1
 
-  v8 = stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationY);
-  v29 = stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationY);
-  v28 = stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationX);
-  v9 = stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationX);
+  v8 = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationY);
+  v29 = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationY);
+  v28 = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationX);
+  v9 = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationX);
   //v11 = -pBLVRenderParams->vPartyPos.y;
   //v26 = -pBLVRenderParams->vPartyPos.x;
   //v27 = v9;
   //v12 = -pBLVRenderParams->vPartyPos.z;
-  if (pEngine->pIndoorCameraD3D->sRotationX)
+  if (pIndoorCameraD3D->sRotationX)
   {
-    v16 = v8 * -pEngine->pIndoorCameraD3D->vPartyPos.x + v29 * -pEngine->pIndoorCameraD3D->vPartyPos.y;
-    v17 = -65536 * pEngine->pIndoorCameraD3D->vPartyPos.z;
-    this->field_0_party_dir_x = fixpoint_mul(v16, v28) + fixpoint_mul((-pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, v9);
-    this->field_4_party_dir_y = v8 * -pEngine->pIndoorCameraD3D->vPartyPos.y - v29 * -pEngine->pIndoorCameraD3D->vPartyPos.x;
+    v16 = v8 * -pIndoorCameraD3D->vPartyPos.x + v29 * -pIndoorCameraD3D->vPartyPos.y;
+    v17 = -65536 * pIndoorCameraD3D->vPartyPos.z;
+    this->field_0_party_dir_x = fixpoint_mul(v16, v28) + fixpoint_mul((-pIndoorCameraD3D->vPartyPos.z) << 16, v9);
+    this->field_4_party_dir_y = v8 * -pIndoorCameraD3D->vPartyPos.y - v29 * -pIndoorCameraD3D->vPartyPos.x;
     this->field_8_party_dir_z = fixpoint_mul(v17, v28) - fixpoint_mul(v16, v9);
   }
   else
   {
-    this->field_0_party_dir_x = v8 * -pEngine->pIndoorCameraD3D->vPartyPos.x + v29 * -pEngine->pIndoorCameraD3D->vPartyPos.y;
-    this->field_4_party_dir_y = v8 * -pEngine->pIndoorCameraD3D->vPartyPos.y - v29 * -pEngine->pIndoorCameraD3D->vPartyPos.x;
-    this->field_8_party_dir_z = (-pEngine->pIndoorCameraD3D->vPartyPos.z) << 16;
+    this->field_0_party_dir_x = v8 * -pIndoorCameraD3D->vPartyPos.x + v29 * -pIndoorCameraD3D->vPartyPos.y;
+    this->field_4_party_dir_y = v8 * -pIndoorCameraD3D->vPartyPos.y - v29 * -pIndoorCameraD3D->vPartyPos.x;
+    this->field_8_party_dir_z = (-pIndoorCameraD3D->vPartyPos.z) << 16;
   }
 
-  if (pEngine->pIndoorCameraD3D->sRotationX)
+  if (pIndoorCameraD3D->sRotationX)
   {
     v19 = fixpoint_mul(a2, v8) + fixpoint_mul(a3, v29);
 
@@ -3919,7 +3919,7 @@
     this->viewing_angle_from_west_east = a4;
   }
 
-  if (pEngine->pIndoorCameraD3D->sRotationX)
+  if (pIndoorCameraD3D->sRotationX)
   {
     v21 = fixpoint_mul(a5, v8) + fixpoint_mul(a6, v29);
 
@@ -4843,9 +4843,9 @@
   memset(&PortalFace, 0, sizeof(stru367));
 
   //get direction the face(îïðåäåëåíèå íàïðàâëåííîñòè ôåéñà)*********************************************************************************
-  if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pEngine->pIndoorCameraD3D->vPartyPos.x)
-     + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pEngine->pIndoorCameraD3D->vPartyPos.y)
-     + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pEngine->pIndoorCameraD3D->vPartyPos.z) < 0 )
+  if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pIndoorCameraD3D->vPartyPos.x)
+     + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pIndoorCameraD3D->vPartyPos.y)
+     + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pIndoorCameraD3D->vPartyPos.z) < 0 )
   {
     PortalFace.direction = true;
   }
@@ -4878,7 +4878,7 @@
   {
     for (uint i = 0; i < pFace->uNumVertices; ++i)
     {
-      pEngine->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pIndoor->pVertices[pFace->pVertexIDs[i]].x,
+      pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(pIndoor->pVertices[pFace->pVertexIDs[i]].x,
                                                                      pIndoor->pVertices[pFace->pVertexIDs[i]].y,
                                                                      pIndoor->pVertices[pFace->pVertexIDs[i]].z,
         &PortalFace._view_transformed_z[i + 3], &PortalFace._view_transformed_x[i + 3], &PortalFace._view_transformed_y[i + 3], 0);
@@ -5246,23 +5246,23 @@
   float v13; // [sp+Ch] [bp-4h]@2
   float v14; // [sp+Ch] [bp-4h]@6
 
-  if (pEngine->pIndoorCameraD3D->sRotationX)
+  if (pIndoorCameraD3D->sRotationX)
   {
     v13 = a1->vWorldPosition.x - (double)pParty->vPosition.x;
     v11 = a1->vWorldPosition.y - (double)pParty->vPosition.y;
     v4 = a1->vWorldPosition.z - (double)pParty->vPosition.z;
     //if ( pRenderer->pRenderD3D )
     //{
-      v5 = v11 * pEngine->pIndoorCameraD3D->fRotationYSine + v13 * pEngine->pIndoorCameraD3D->fRotationYCosine;
-      a1->vWorldViewPosition.y = v13 * pEngine->pIndoorCameraD3D->fRotationYSine - v11 * pEngine->pIndoorCameraD3D->fRotationYCosine;
+      v5 = v11 * pIndoorCameraD3D->fRotationYSine + v13 * pIndoorCameraD3D->fRotationYCosine;
+      a1->vWorldViewPosition.y = v13 * pIndoorCameraD3D->fRotationYSine - v11 * pIndoorCameraD3D->fRotationYCosine;
     /*}
     else
     {
       v5 = v13 * pBLVRenderParams->fCosineY - v11 * pBLVRenderParams->fSineY;
       a1->vWorldViewPosition.y = v13 * pBLVRenderParams->fSineY + v11 * pBLVRenderParams->fCosineY;
     }*/
-    a1->vWorldViewPosition.x = v5 * pEngine->pIndoorCameraD3D->fRotationXCosine - v4 * pEngine->pIndoorCameraD3D->fRotationXSine;
-    a1->vWorldViewPosition.z = v5 * pEngine->pIndoorCameraD3D->fRotationXSine + v4 * pEngine->pIndoorCameraD3D->fRotationXCosine;
+    a1->vWorldViewPosition.x = v5 * pIndoorCameraD3D->fRotationXCosine - v4 * pIndoorCameraD3D->fRotationXSine;
+    a1->vWorldViewPosition.z = v5 * pIndoorCameraD3D->fRotationXSine + v4 * pIndoorCameraD3D->fRotationXCosine;
   }
   else
   {
@@ -5271,8 +5271,8 @@
     a1->vWorldViewPosition.z = a1->vWorldPosition.z - (double)pParty->vPosition.z;
     //if ( pRenderer->pRenderD3D )
     //{
-      a1->vWorldViewPosition.x = v12 * pEngine->pIndoorCameraD3D->fRotationYSine + v14 * pEngine->pIndoorCameraD3D->fRotationYCosine;
-      a1->vWorldViewPosition.y = v14 * pEngine->pIndoorCameraD3D->fRotationYSine - v12 * pEngine->pIndoorCameraD3D->fRotationYCosine;
+      a1->vWorldViewPosition.x = v12 * pIndoorCameraD3D->fRotationYSine + v14 * pIndoorCameraD3D->fRotationYCosine;
+      a1->vWorldViewPosition.y = v14 * pIndoorCameraD3D->fRotationYSine - v12 * pIndoorCameraD3D->fRotationYCosine;
     /*}
     else
     {
--- a/Engine/Graphics/IndoorCameraD3D.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Graphics/IndoorCameraD3D.cpp	Sun May 10 03:21:14 2015 +0200
@@ -19,6 +19,7 @@
   return viewport_width * 0.5 / tan(angle_degree / 2 * 0.01745329) + 0.5;
 }
 
+IndoorCameraD3D *pIndoorCameraD3D = new IndoorCameraD3D;
 
 
 //----- (004361EF) --------------------------------------------------------
@@ -109,33 +110,33 @@
 //  int a2b; // [sp+18h] [bp+Ch]@5
   int a3a; // [sp+1Ch] [bp+10h]@5
 
-  to_x = x - pEngine->pIndoorCameraD3D->vPartyPos.x;
-  to_y = y - pEngine->pIndoorCameraD3D->vPartyPos.y;
-  if (pEngine->pIndoorCameraD3D->sRotationX)
+  to_x = x - pIndoorCameraD3D->vPartyPos.x;
+  to_y = y - pIndoorCameraD3D->vPartyPos.y;
+  if (pIndoorCameraD3D->sRotationX)
   {
-    to_z = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16;
+    to_z = (z - pIndoorCameraD3D->vPartyPos.z) << 16;
     //if ( pRenderer->pRenderD3D )
     //{
-      v14 = (unsigned __int64)(to_x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y)
-          + (unsigned __int64)(to_y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y);
-      v9 = (unsigned __int64)(to_x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y)
-         - (unsigned __int64)(to_y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y);
+      v14 = (unsigned __int64)(to_x * (signed __int64)pIndoorCameraD3D->int_cosine_y)
+          + (unsigned __int64)(to_y * (signed __int64)pIndoorCameraD3D->int_sine_y);
+      v9 = (unsigned __int64)(to_x * (signed __int64)pIndoorCameraD3D->int_sine_y)
+         - (unsigned __int64)(to_y * (signed __int64)pIndoorCameraD3D->int_cosine_y);
     //}
-    a3a = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16;
-    *pOutX = fixpoint_mul(v14, pEngine->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(to_z, pEngine->pIndoorCameraD3D->int_sine_x);
+    a3a = (z - pIndoorCameraD3D->vPartyPos.z) << 16;
+    *pOutX = fixpoint_mul(v14, pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(to_z, pIndoorCameraD3D->int_sine_x);
     *pOutZ = v9;
-    *pOutY = fixpoint_mul(v14, pEngine->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(a3a, pEngine->pIndoorCameraD3D->int_cosine_x);
+    *pOutY = fixpoint_mul(v14, pIndoorCameraD3D->int_sine_x) + fixpoint_mul(a3a, pIndoorCameraD3D->int_cosine_x);
   }
   else
   {
-    *pOutY = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16;
+    *pOutY = (z - pIndoorCameraD3D->vPartyPos.z) << 16;
     //if ( pRenderer->pRenderD3D )
     //{
       //v10 = pOutX;
-      *pOutX = (unsigned __int64)(to_x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y)
-             + (unsigned __int64)(to_y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y);
-      *pOutZ = (unsigned __int64)(to_x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y)
-             - (unsigned __int64)(to_y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y);
+      *pOutX = (unsigned __int64)(to_x * (signed __int64)pIndoorCameraD3D->int_cosine_y)
+             + (unsigned __int64)(to_y * (signed __int64)pIndoorCameraD3D->int_sine_y);
+      *pOutZ = (unsigned __int64)(to_x * (signed __int64)pIndoorCameraD3D->int_sine_y)
+             - (unsigned __int64)(to_y * (signed __int64)pIndoorCameraD3D->int_cosine_y);
     //}
   }
   if (!bDoNotShow)
@@ -179,7 +180,7 @@
 
     //v4 = uNumVertices;
     //v7 = pIndoorCamera->fRotationXSine;
-    if (pEngine->pIndoorCameraD3D->sRotationX)
+    if (pIndoorCameraD3D->sRotationX)
     {
 
         //_EAX = a1a;
@@ -226,9 +227,9 @@
                                          // 4[pIndoorCamera->fRotationYSine]
                                          // 5[pIndoorCamera->fRotationYCosine]
             }*/
-            st0 = sin_y * (a1a[i].vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
-            st1 = cos_y * (a1a[i].vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
-            st2 = (a1a[i].vWorldPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z);
+            st0 = sin_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y);
+            st1 = cos_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y);
+            st2 = (a1a[i].vWorldPosition.z - pIndoorCameraD3D->vPartyPos.z);
           }
           if (false)//else
           {
@@ -294,9 +295,9 @@
                                          // 4[pIndoorCamera->fRotationYSine]
                                          // 5[pIndoorCamera->fRotationYCosine]
             }*/
-            st0 = cos_y * (a1a[i].vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y) + sin_y * (a1a[i].vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x);
-            st1 = cos_y * (a1a[i].vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) - sin_y * (a1a[i].vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
-            st2 = (a1a[i].vWorldPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z);
+            st0 = cos_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y) + sin_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x);
+            st1 = cos_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) - sin_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y);
+            st2 = (a1a[i].vWorldPosition.z - pIndoorCameraD3D->vPartyPos.z);
           }
 
           a1a[i].vWorldViewPosition.x = st1*cos_x - st2*sin_x;
@@ -360,9 +361,9 @@
               fstp    dword ptr [eax+10h]
               fstp    dword ptr [eax+14h]
             }*/
-            a1a[i].vWorldViewPosition.x = cos_y * (a1a[i].vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
-            a1a[i].vWorldViewPosition.y = sin_y * (a1a[i].vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
-            a1a[i].vWorldViewPosition.z = (a1a[i].vWorldPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z);
+            a1a[i].vWorldViewPosition.x = cos_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y);
+            a1a[i].vWorldViewPosition.y = sin_y * (a1a[i].vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y);
+            a1a[i].vWorldViewPosition.z = (a1a[i].vWorldPosition.z - pIndoorCameraD3D->vPartyPos.z);
           }
           if (false)//else
           {
@@ -411,13 +412,13 @@
   v8 = fRotationXCosine;
   result = fRotationXSine;
   v7 = fRotationXSine;
-  vCamToVertexX = a1->vWorldPosition.x - (double)pEngine->pIndoorCameraD3D->vPartyPos.x;
-  vCamToVertexY = a1->vWorldPosition.y - (double)pEngine->pIndoorCameraD3D->vPartyPos.y;
-  vCamToVertexZ = a1->vWorldPosition.z - (double)pEngine->pIndoorCameraD3D->vPartyPos.z;
+  vCamToVertexX = a1->vWorldPosition.x - (double)pIndoorCameraD3D->vPartyPos.x;
+  vCamToVertexY = a1->vWorldPosition.y - (double)pIndoorCameraD3D->vPartyPos.y;
+  vCamToVertexZ = a1->vWorldPosition.z - (double)pIndoorCameraD3D->vPartyPos.z;
   v3 = fRotationYCosine;
   v4 = fRotationYSine;
   v5 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
-  if (pEngine->pIndoorCameraD3D->sRotationX)
+  if (pIndoorCameraD3D->sRotationX)
   {
     v6 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
     a1->vWorldViewPosition.x = v5 * fRotationXCosine + fRotationXSine * vCamToVertexZ;
@@ -504,9 +505,9 @@
     return false;
 
   //really strange cull; dot(to_cam, normal) < 0 means we see the BACK face, not font %_%
-  if ( (a2->vWorldPosition.z - (double)pEngine->pIndoorCameraD3D->vPartyPos.z) * (double)pFace->pFacePlane_old.vNormal.z
-     + (a2->vWorldPosition.y - (double)pEngine->pIndoorCameraD3D->vPartyPos.y) * (double)pFace->pFacePlane_old.vNormal.y
-     + (a2->vWorldPosition.x - (double)pEngine->pIndoorCameraD3D->vPartyPos.x) * (double)pFace->pFacePlane_old.vNormal.x < 0.0)
+  if ( (a2->vWorldPosition.z - (double)pIndoorCameraD3D->vPartyPos.z) * (double)pFace->pFacePlane_old.vNormal.z
+     + (a2->vWorldPosition.y - (double)pIndoorCameraD3D->vPartyPos.y) * (double)pFace->pFacePlane_old.vNormal.y
+     + (a2->vWorldPosition.x - (double)pIndoorCameraD3D->vPartyPos.x) * (double)pFace->pFacePlane_old.vNormal.x < 0.0)
     return false;
 
   return true;
@@ -768,9 +769,9 @@
   double v4; // st7@1
   IndoorCameraD3D_Vec3 v8; // [sp+8h] [bp-1Ch]@1
 
-  v8.x = (double)pEngine->pIndoorCameraD3D->vPartyPos.x;
-  v8.y = (double)pEngine->pIndoorCameraD3D->vPartyPos.y;
-  v8.z = (double)pEngine->pIndoorCameraD3D->vPartyPos.z;
+  v8.x = (double)pIndoorCameraD3D->vPartyPos.x;
+  v8.y = (double)pIndoorCameraD3D->vPartyPos.y;
+  v8.z = (double)pIndoorCameraD3D->vPartyPos.z;
   Vec3Transform(a1, a2);
 
   v4 = v8.x * a2->x + v8.y * a2->y + v8.z * a2->z;
@@ -841,9 +842,9 @@
   memcpy(&a2[*pOutNumVertices + 1], &a2[1], sizeof(a2[*pOutNumVertices + 1]));
 
   if ( (signed int)*pOutNumVertices <= 3
-    || (((v18.vWorldPosition.z - (double)pEngine->pIndoorCameraD3D->vPartyPos.z) * thisa->face_plane.vNormal.z
-       + (v18.vWorldPosition.y - (double)pEngine->pIndoorCameraD3D->vPartyPos.y) * thisa->face_plane.vNormal.y
-       + (v18.vWorldPosition.x - (double)pEngine->pIndoorCameraD3D->vPartyPos.x) * thisa->face_plane.vNormal.x < 0.0) ? (v6 = 1.0) : (v6 = -1.0),
+    || (((v18.vWorldPosition.z - (double)pIndoorCameraD3D->vPartyPos.z) * thisa->face_plane.vNormal.z
+       + (v18.vWorldPosition.y - (double)pIndoorCameraD3D->vPartyPos.y) * thisa->face_plane.vNormal.y
+       + (v18.vWorldPosition.x - (double)pIndoorCameraD3D->vPartyPos.x) * thisa->face_plane.vNormal.x < 0.0) ? (v6 = 1.0) : (v6 = -1.0),
         (signed int)*pOutNumVertices <= 0) )
     return 0;
 
@@ -1360,19 +1361,19 @@
     fRotationXSine = sin((pi_double + pi_double) * (double)-sRotationX / 2048.0);
     fRotationXCosine = cos((pi_double + pi_double) * (double)-sRotationX / 2048.0);
 
-    int_sine_y   = stru_5C6E00->Sin( pEngine->pIndoorCameraD3D->sRotationY);
-    int_cosine_y = stru_5C6E00->Cos( pEngine->pIndoorCameraD3D->sRotationY);
-    int_sine_x   = stru_5C6E00->Sin(-pEngine->pIndoorCameraD3D->sRotationX);
-    int_cosine_x = stru_5C6E00->Cos(-pEngine->pIndoorCameraD3D->sRotationX);
+    int_sine_y   = stru_5C6E00->Sin( pIndoorCameraD3D->sRotationY);
+    int_cosine_y = stru_5C6E00->Cos( pIndoorCameraD3D->sRotationY);
+    int_sine_x   = stru_5C6E00->Sin(-pIndoorCameraD3D->sRotationX);
+    int_cosine_x = stru_5C6E00->Cos(-pIndoorCameraD3D->sRotationX);
   }
   else
   {
     fRotationXSine = sin((pi_double + pi_double) * (double)sRotationX / 2048.0);
     fRotationXCosine = cos((pi_double + pi_double) * (double)sRotationX / 2048.0);
 
-    int_sine_y   = stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationY);
-    int_cosine_y = stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationY);
-    int_sine_x   = stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationX);
-    int_cosine_x = stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationX);
+    int_sine_y   = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationY);
+    int_cosine_y = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationY);
+    int_sine_x   = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationX);
+    int_cosine_x = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationX);
   }
 }
\ No newline at end of file
--- a/Engine/Graphics/IndoorCameraD3D.h	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Graphics/IndoorCameraD3D.h	Sun May 10 03:21:14 2015 +0200
@@ -251,4 +251,6 @@
   int        int_cosine_x;     // moved  from 157 struct ODMRenderParams::28
                                // merged from 162 struct BLVRenderParams::28
 };
-#pragma pack(pop)
\ No newline at end of file
+#pragma pack(pop)
+
+extern IndoorCameraD3D *pIndoorCameraD3D;
\ No newline at end of file
--- a/Engine/Graphics/LightmapBuilder.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Graphics/LightmapBuilder.cpp	Sun May 10 03:21:14 2015 +0200
@@ -124,8 +124,8 @@
     }
   }
 
-  minz = pEngine->pIndoorCameraD3D->GetPolygonMinZ(a1, uStripType);
-  maxz = pEngine->pIndoorCameraD3D->GetPolygonMaxZ(a1, uStripType);
+  minz = pIndoorCameraD3D->GetPolygonMinZ(a1, uStripType);
+  maxz = pIndoorCameraD3D->GetPolygonMaxZ(a1, uStripType);
 
   float bounding_x1 = tX_0 - (float)pLight->uRadius; //13 976 - 128 = 13848.0
   float bounding_y1 = tY_0 - (float)pLight->uRadius; // 3 800 - 128 = 3672.0
@@ -564,7 +564,7 @@
     for (uint i = 0; i < uNumVertices; ++i)
       memcpy(&static_69B140[i], a5 + i, sizeof(RenderVertexSoft));
 
-    if (pEngine->pIndoorCameraD3D->_437376(a3, static_69B140, &uNumVertices) == 1)
+    if (pIndoorCameraD3D->_437376(a3, static_69B140, &uNumVertices) == 1)
     {
       if ( !uNumVertices )
         return false;
@@ -577,7 +577,7 @@
   static_69B110.field_4.y = a3->face_plane.vNormal.y;
   static_69B110.field_4.z = a3->face_plane.vNormal.z;
   static_69B110.dist = a3->face_plane.dist;
-  if (!pEngine->pIndoorCameraD3D->GetFacetOrientation(a3->polygonType, &static_69B110.field_4,
+  if (!pIndoorCameraD3D->GetFacetOrientation(a3->polygonType, &static_69B110.field_4,
           &static_69B110.field_10, &static_69B110.field_1C))
   {
     MessageBoxW(nullptr, L"Error: Failed to get the facet orientation", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:119", 0);
@@ -730,8 +730,8 @@
   if ( v45 != uNumVertices && v45 > 0 )
     _45C4B9(uNumVertices, a9, lightmap);
 
-  pEngine->pIndoorCameraD3D->ViewTransform(lightmap->pVertices, lightmap->NumVertices);
-  pEngine->pIndoorCameraD3D->Project(lightmap->pVertices, lightmap->NumVertices, 0);
+  pIndoorCameraD3D->ViewTransform(lightmap->pVertices, lightmap->NumVertices);
+  pIndoorCameraD3D->Project(lightmap->pVertices, lightmap->NumVertices, 0);
 
   unsigned int _a4 = 0;
   if ( !(uClipFlag & 1) )
@@ -740,13 +740,13 @@
   {
     if ( uClipFlag & 2 )
     {
-      pEngine->pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(lightmap->pVertices, lightmap->NumVertices, field_3C8C34, &_a4);
-      pEngine->pIndoorCameraD3D->_437143(_a4, lightmap->pVertices, field_3C8C34, &lightmap->NumVertices);
+      pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(lightmap->pVertices, lightmap->NumVertices, field_3C8C34, &_a4);
+      pIndoorCameraD3D->_437143(_a4, lightmap->pVertices, field_3C8C34, &lightmap->NumVertices);
     }
     else if ( uClipFlag & 4 )
     {
-      pEngine->pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(lightmap->pVertices, lightmap->NumVertices, field_3C8C34, &_a4);
-      pEngine->pIndoorCameraD3D->_437143(_a4, lightmap->pVertices, field_3C8C34, &lightmap->NumVertices);
+      pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(lightmap->pVertices, lightmap->NumVertices, field_3C8C34, &_a4);
+      pIndoorCameraD3D->_437143(_a4, lightmap->pVertices, field_3C8C34, &lightmap->NumVertices);
     }
     else
       MessageBoxW(nullptr, L"Undefined clip flag specified", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:330", 0);
@@ -906,10 +906,10 @@
   {
     float v18;
     if (fabs(z_bias) < 1e-5)
-      v18 = 1.0 - 1.0 / ((1.0f / pEngine->pIndoorCameraD3D->GetShadingDistMist()) * pLightmap->pVertices[i].vWorldViewPosition.x * 1000.0);
+      v18 = 1.0 - 1.0 / ((1.0f / pIndoorCameraD3D->GetShadingDistMist()) * pLightmap->pVertices[i].vWorldViewPosition.x * 1000.0);
 	else
     {
-      v18 = 1.0 - 1.0 / ((1.0f / pEngine->pIndoorCameraD3D->GetShadingDistMist()) * pLightmap->pVertices[i].vWorldViewPosition.x * 1000.0) - z_bias;
+      v18 = 1.0 - 1.0 / ((1.0f / pIndoorCameraD3D->GetShadingDistMist()) * pLightmap->pVertices[i].vWorldViewPosition.x * 1000.0) - z_bias;
       if (v18 < 0.000099999997)
         v18 = 0.000099999997;
     }
@@ -1218,9 +1218,9 @@
   bool a2a; // [sp+20h] [bp+8h]@6
 
   __debugbreak();//Not used?
-  result = (bool)pEngine->pIndoorCameraD3D;
+  result = (bool)pIndoorCameraD3D;
   v3 = this;
-  thisa = pEngine->pIndoorCameraD3D;
+  thisa = pIndoorCameraD3D;
   if ( bit_one_for_list1__bit_two_for_list2 & 1 )
   {
     v7 = 0;
@@ -1229,7 +1229,7 @@
       v4 = this->std__vector_000004[0].pVertices;
       do
       {
-        pEngine->pIndoorCameraD3D->debug_outline_sw(v4, *((unsigned int *)v4 - 1), 0xFF00u, 0.0);
+        pIndoorCameraD3D->debug_outline_sw(v4, *((unsigned int *)v4 - 1), 0xFF00u, 0.0);
         ++v7;
         v4 = (RenderVertexSoft *)((char *)v4 + 3100);
         result = v7;
@@ -1245,7 +1245,7 @@
       v5 = v3->std__vector_183808[0].pVertices;
       do
       {
-        pEngine->pIndoorCameraD3D->debug_outline_sw(v5, *((unsigned int *)v5 - 1), 0xC04000u, 0.00019999999);
+        pIndoorCameraD3D->debug_outline_sw(v5, *((unsigned int *)v5 - 1), 0xC04000u, 0.00019999999);
         ++a2a;
         v5 = (RenderVertexSoft *)((char *)v5 + 3100);
         result = a2a;
--- a/Engine/Graphics/Outdoor.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Graphics/Outdoor.cpp	Sun May 10 03:21:14 2015 +0200
@@ -83,9 +83,9 @@
 void OutdoorLocation::ExecDraw(unsigned int bRedraw)
 {
 
-  pEngine->pIndoorCameraD3D->debug_flags = 0;
+  pIndoorCameraD3D->debug_flags = 0;
   if (viewparams->draw_d3d_outlines)
-    pEngine->pIndoorCameraD3D->debug_flags |= ODM_RENDER_DRAW_D3D_OUTLINES;
+    pIndoorCameraD3D->debug_flags |= ODM_RENDER_DRAW_D3D_OUTLINES;
 
   if (bRedraw || true/*pRenderer->pRenderD3D*/)
   {
@@ -104,7 +104,7 @@
   if ( pParty->uCurrentMinute != pOutdoor->uLastSunlightUpdateMinute )
     pOutdoor->UpdateSunlightVectors();
   pOutdoor->UpdateFog();
-  //pEngine->pIndoorCameraD3D->sr_Reset_list_0037C();
+  //pIndoorCameraD3D->sr_Reset_list_0037C();
 
   //if (pRenderer->pRenderD3D) // d3d - redraw always
   {
@@ -132,7 +132,7 @@
   /*if ( !pRenderer->pRenderD3D )
   {
     pRenderer->ExecOutdoorDrawSW();
-    pEngine->pIndoorCameraD3D->sr_438240_draw_lits();
+    pIndoorCameraD3D->sr_438240_draw_lits();
   }*/
   pEngine->PushStationaryLights(-1);
   pEngine->PrepareBloodsplats();
@@ -622,9 +622,9 @@
     currVertex--;
   }
 
-  if ( ((double)pEngine->pIndoorCameraD3D->vPartyPos.x - a2->vWorldPosition.x) * v26
-    + ((double)pEngine->pIndoorCameraD3D->vPartyPos.z - a2->vWorldPosition.z) * v25
-    + ((double)pEngine->pIndoorCameraD3D->vPartyPos.y - a2->vWorldPosition.y) * v24 > 0.0 )
+  if ( ((double)pIndoorCameraD3D->vPartyPos.x - a2->vWorldPosition.x) * v26
+    + ((double)pIndoorCameraD3D->vPartyPos.z - a2->vWorldPosition.z) * v25
+    + ((double)pIndoorCameraD3D->vPartyPos.y - a2->vWorldPosition.y) * v24 > 0.0 )
   {
 
     v19 = a2[1].vWorldViewPosition.x - a2->vWorldViewPosition.x;
@@ -2445,8 +2445,8 @@
             z = pActors[i].vPosition.z;
         }
       }
-      v8 = stru_5C6E00->Atan2(pActors[i].vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x,
-                              pActors[i].vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
+      v8 = stru_5C6E00->Atan2(pActors[i].vPosition.x - pIndoorCameraD3D->vPartyPos.x,
+                              pActors[i].vPosition.y - pIndoorCameraD3D->vPartyPos.y);
 	  LOWORD(v9) = pActors[i].uYawAngle;
       v41 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v9 - v8) >> 8) & 7;
       if ( pParty->bTurnBasedModeOn )
@@ -2485,34 +2485,34 @@
         //LOBYTE(v16) = _4E94D3_light_type;
         pMobileLightsStack->AddLight(x, y, z, 0, v15->uGlowRadius, 0xFFu, 0xFFu, 0xFFu, _4E94D3_light_type);
       }
-      v17 = (x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16;
-      if (pEngine->pIndoorCameraD3D->sRotationX)
+      v17 = (x - pIndoorCameraD3D->vPartyPos.x) << 16;
+      if (pIndoorCameraD3D->sRotationX)
       {
-        v18 = (y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16;
-        v47 = (fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v18, pEngine->pIndoorCameraD3D->int_sine_y));
-        v50 = fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_sine_y);
-        v53 = fixpoint_mul(v18, pEngine->pIndoorCameraD3D->int_cosine_y);
-        v44 = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16;
-        v19 = (fixpoint_mul(v44, pEngine->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pEngine->pIndoorCameraD3D->int_cosine_x));
-        X = fixpoint_mul(v44, pEngine->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pEngine->pIndoorCameraD3D->int_cosine_x);
+        v18 = (y - pIndoorCameraD3D->vPartyPos.y) << 16;
+        v47 = (fixpoint_mul(v17, pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v18, pIndoorCameraD3D->int_sine_y));
+        v50 = fixpoint_mul(v17, pIndoorCameraD3D->int_sine_y);
+        v53 = fixpoint_mul(v18, pIndoorCameraD3D->int_cosine_y);
+        v44 = (z - pIndoorCameraD3D->vPartyPos.z) << 16;
+        v19 = (fixpoint_mul(v44, pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pIndoorCameraD3D->int_cosine_x));
+        X = fixpoint_mul(v44, pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pIndoorCameraD3D->int_cosine_x);
         if ( v19 < 262144 || v19 > pODMRenderParams->shading_dist_mist << 16 )
           continue;
         v20 = v53 - v50;
         v42 = v53 - v50;
-        v21 = (fixpoint_mul(v44, pEngine->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v47, pEngine->pIndoorCameraD3D->int_sine_x));
+        v21 = (fixpoint_mul(v44, pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v47, pIndoorCameraD3D->int_sine_x));
       }
       else
       {
-        v48 = (y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16;
-        v51 = fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_cosine_y);
-        v22 = fixpoint_mul(v48, pEngine->pIndoorCameraD3D->int_sine_y);
+        v48 = (y - pIndoorCameraD3D->vPartyPos.y) << 16;
+        v51 = fixpoint_mul(v17, pIndoorCameraD3D->int_cosine_y);
+        v22 = fixpoint_mul(v48, pIndoorCameraD3D->int_sine_y);
         X = v22 + v51;
         if ( v22 + v51 < 262144 || v22 + v51 > pODMRenderParams->shading_dist_mist << 16 )
           continue;
-        v23 = fixpoint_mul(((x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16), pEngine->pIndoorCameraD3D->int_sine_y);
-        v20 = fixpoint_mul(v48, pEngine->pIndoorCameraD3D->int_cosine_y) - v23;
-        v42 = fixpoint_mul(v48, pEngine->pIndoorCameraD3D->int_cosine_y) - v23;
-        v21 = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16;
+        v23 = fixpoint_mul(((x - pIndoorCameraD3D->vPartyPos.x) << 16), pIndoorCameraD3D->int_sine_y);
+        v20 = fixpoint_mul(v48, pIndoorCameraD3D->int_cosine_y) - v23;
+        v42 = fixpoint_mul(v48, pIndoorCameraD3D->int_cosine_y) - v23;
+        v21 = (z - pIndoorCameraD3D->vPartyPos.z) << 16;
       }
       v45 = v21;
       v24 = abs(v20);
@@ -4538,8 +4538,8 @@
 	strcpy(Source, &pFilename[v7]);
 	strcpy(pOutdoor->pLevelFilename, Source);
 	pWeather->Initialize();
-	pEngine->pIndoorCameraD3D->sRotationY = pParty->sRotationY;
-	pEngine->pIndoorCameraD3D->sRotationX = pParty->sRotationX;
+	pIndoorCameraD3D->sRotationY = pParty->sRotationY;
+	pIndoorCameraD3D->sRotationX = pParty->sRotationX;
 	//pODMRenderParams->RotationToInts();
 	pOutdoor->UpdateSunlightVectors();
 
--- a/Engine/Graphics/ParticleEngine.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Graphics/ParticleEngine.cpp	Sun May 10 03:21:14 2015 +0200
@@ -308,7 +308,7 @@
   z_int_ = floorf(pParticle->z + 0.5f);
   /*if ( !pRenderer->pRenderD3D )
   {
-    if (pEngine->pIndoorCameraD3D->sRotationX)
+    if (pIndoorCameraD3D->sRotationX)
     {
       if (pParticle->type & ParticleType_Line)
       {
@@ -316,22 +316,22 @@
         int _uParticleID = (int)(floorf(pParticle->_x + 0.5f) - pBLVRenderParams->vPartyPos.x) << 16;
         //v12 = pParticle->_y + 6.7553994e15;
         y = (int)(floorf(pParticle->_y + 0.5f) - pBLVRenderParams->vPartyPos.y) << 16;
-        z = (unsigned __int64)(y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
-        HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16)
+        z = (unsigned __int64)(y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+        HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
                     - z;
-        a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
+        a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
         //v13 = pParticle->_z + 6.7553994e15;
         _uParticleID = (int)(floorf(pParticle->_z + 0.5f) - pBLVRenderParams->vPartyPos.z) << 16;
-        z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16)
-          - ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16);
+        z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
+          - ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16);
         v14 = z;
-        HIDWORD(v13) = (unsigned __int64)(SHIDWORD(a5) * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16;
-        HIDWORD(a5) = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16;
+        HIDWORD(v13) = (unsigned __int64)(SHIDWORD(a5) * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
+        HIDWORD(a5) = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16;
         //LODWORD(v15) = pBLVRenderParams->field_40 << 16;
         //HIDWORD(v15) = pBLVRenderParams->field_40 >> 16;
         //v16 = v15 / z;
         v16 = fixpoint_div(pBLVRenderParams->field_40, z);
-        v17 = (unsigned __int64)(y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16;
+        v17 = (unsigned __int64)(y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16;
         pParticle->_screenspace_scale = v16;
         _uParticleID = (unsigned __int64)(v16 * (signed __int64)(a6 + v17)) >> 16;
         LODWORD(v18) = pBLVRenderParams->uViewportCenterX
@@ -346,20 +346,20 @@
       }
       int _uParticleID = (x_int - pBLVRenderParams->vPartyPos.x) << 16;
       y = (y_int_ - pBLVRenderParams->vPartyPos.y) << 16;
-      HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16)
-                  - ((unsigned __int64)(y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16);
-      a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
-      z_int_4 = (unsigned __int64)(y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16;
+      HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+                  - ((unsigned __int64)(y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
+      a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+      z_int_4 = (unsigned __int64)(y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16;
       _uParticleID = (z_int_ - pBLVRenderParams->vPartyPos.z) << 16;
-      v21 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16;
-      v22 = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16) - v21;
-      z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16) - v21;
+      v21 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
+      v22 = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16) - v21;
+      z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16) - v21;
       if ( v22 < (signed int)0x40000u || v22 > (signed int)0x1F400000u )
         return 0;
       v23 = a6 + z_int_4;
       a2 = a6 + z_int_4;
-      v24 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16)
-          + ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16);
+      v24 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
+          + ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16);
     }
     else
     {
@@ -369,17 +369,17 @@
         int _uParticleID = ((int)floorf(pParticle->_x + 0.5f) - pBLVRenderParams->vPartyPos.x) << 16;
         //v26 = pParticle->_y + 6.7553994e15;
         y = ((int)floorf(pParticle->_y + 0.5f) - pBLVRenderParams->vPartyPos.y) << 16;
-        auto _hiword_v25 = (__int64)(y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
-        v27 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16) - _hiword_v25;
-        z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16) - _hiword_v25;
-        v28 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
+        auto _hiword_v25 = (__int64)(y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+        v27 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - _hiword_v25;
+        z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - _hiword_v25;
+        v28 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
         //a5 = pParticle->_z + 6.7553994e15;
         v29 = ((int)floorf(pParticle->_z + 0.5f) - pBLVRenderParams->vPartyPos.z) << 16;
         //LODWORD(v30) = pBLVRenderParams->field_40 << 16;
         //HIDWORD(v30) = pBLVRenderParams->field_40 >> 16;
         //v31 = v30 / z;
         v31 = fixpoint_div(pBLVRenderParams->field_40, z);
-        v32 = (unsigned __int64)(y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16;
+        v32 = (unsigned __int64)(y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16;
         pParticle->_screenspace_scale = v31;
         _uParticleID = (unsigned __int64)(v31 * (signed __int64)(v28 + v32)) >> 16;
         LODWORD(v33) = pBLVRenderParams->uViewportCenterX - ((signed int)((unsigned __int64)(v31 * (signed __int64)(v28 + v32)) >> 16) >> 16);
@@ -391,15 +391,15 @@
       }
       int _uParticleID = (x_int - pBLVRenderParams->vPartyPos.x) << 16;
       y = (y_int_ - pBLVRenderParams->vPartyPos.y) << 16;
-      v36 = (unsigned __int64)(y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
-      v22 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16) - v36;
-      z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16) - v36;
+      v36 = (unsigned __int64)(y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+      v22 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - v36;
+      z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - v36;
       if ( v22 < 262144 || v22 > 524288000 )
         return 0;
-      v37 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
-      _uParticleID = (unsigned __int64)(y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16;
-      v23 = v37 + ((unsigned __int64)(y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
-      a2 = v37 + ((unsigned __int64)(y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
+      v37 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+      _uParticleID = (unsigned __int64)(y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16;
+      v23 = v37 + ((unsigned __int64)(y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+      a2 = v37 + ((unsigned __int64)(y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
       v24 = (z_int_ - pBLVRenderParams->vPartyPos.z) << 16;
     }
     int _uParticleID = abs(v23);
@@ -426,7 +426,7 @@
   }*/
 
   int x;
-  if ( !pEngine->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(
+  if ( !pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(
           x_int,
           y_int_,
           z_int_,
@@ -435,10 +435,10 @@
           &z,
           1) )
     return false;
-  pEngine->pIndoorCameraD3D->Project(x, y, z, &pParticle->uScreenSpaceX, &pParticle->uScreenSpaceY);
-  pParticle->flt_5C = pEngine->pIndoorCameraD3D->fov_x;
+  pIndoorCameraD3D->Project(x, y, z, &pParticle->uScreenSpaceX, &pParticle->uScreenSpaceY);
+  pParticle->flt_5C = pIndoorCameraD3D->fov_x;
   //v4 = pParticle->flt_5C;
-  pParticle->flt_60 = pEngine->pIndoorCameraD3D->fov_y;
+  pParticle->flt_60 = pIndoorCameraD3D->fov_y;
   //v5 = v4 + 6.7553994e15;
   LODWORD(v6) = 0;
   HIDWORD(v6) = floorf(pParticle->flt_5C + 0.5f);
@@ -472,10 +472,10 @@
   int v45; // [sp+40h] [bp-10h]@5
   int X_4; // [sp+48h] [bp-8h]@5
 
-  v3 = stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationX);
-  v44 = stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationX);
-  v4 = stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationY);
-  v5 = stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationY);
+  v3 = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationX);
+  v44 = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationX);
+  v4 = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationY);
+  v5 = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationY);
 
   if (pParticles[uID].type == ParticleType_Invalid)
     return false;
@@ -484,30 +484,30 @@
   {
     if (pParticles[uID].type & ParticleType_Line)
     {
-      v11 = fixpoint_sub_unknown(pParticles[uID].x - pEngine->pIndoorCameraD3D->vPartyPos.x, v4)
-          + fixpoint_sub_unknown(pParticles[uID].y - pEngine->pIndoorCameraD3D->vPartyPos.y, v5);
-      long long _hidword_v12 = fixpoint_mul(v11, v3) + fixpoint_sub_unknown(pParticles[uID].z - pEngine->pIndoorCameraD3D->vPartyPos.z, v44);
+      v11 = fixpoint_sub_unknown(pParticles[uID].x - pIndoorCameraD3D->vPartyPos.x, v4)
+          + fixpoint_sub_unknown(pParticles[uID].y - pIndoorCameraD3D->vPartyPos.y, v5);
+      long long _hidword_v12 = fixpoint_mul(v11, v3) + fixpoint_sub_unknown(pParticles[uID].z - pIndoorCameraD3D->vPartyPos.z, v44);
       LODWORD(v13) = 0;
       HIDWORD(v13) = SLOWORD(pODMRenderParams->int_fov_rad);
       pParticles[uID]._screenspace_scale = v13 / _hidword_v12;
       pParticles[uID].uScreenSpaceX = pViewport->uScreenCenterX
                                     - ((signed int)fixpoint_mul(pParticles[uID]._screenspace_scale, (fixpoint_sub_unknown(pParticles[uID].y
-                                    - pEngine->pIndoorCameraD3D->vPartyPos.y, v4)
-                                    - fixpoint_sub_unknown(pParticles[uID].x - pEngine->pIndoorCameraD3D->vPartyPos.x, v5))) >> 16);
+                                    - pIndoorCameraD3D->vPartyPos.y, v4)
+                                    - fixpoint_sub_unknown(pParticles[uID].x - pIndoorCameraD3D->vPartyPos.x, v5))) >> 16);
       pParticles[uID].uScreenSpaceY = pViewport->uScreenCenterY
                                     - ((signed int)fixpoint_mul(pParticles[uID]._screenspace_scale, (fixpoint_sub_unknown(pParticles[uID].z
-                                    - pEngine->pIndoorCameraD3D->vPartyPos.z, v3)
+                                    - pIndoorCameraD3D->vPartyPos.z, v3)
                                     - fixpoint_mul(v11, v44))) >> 16);
       pParticles[uID].sZValue = _hidword_v12;
     }
-    v45 = fixpoint_sub_unknown(pParticles[uID].x - pEngine->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_sub_unknown(pParticles[uID].y
-                                                 - pEngine->pIndoorCameraD3D->vPartyPos.y, v5);
-    X_4 = fixpoint_sub_unknown(pParticles[uID].z - pEngine->pIndoorCameraD3D->vPartyPos.z, v44) + fixpoint_mul(v45, v3);
+    v45 = fixpoint_sub_unknown(pParticles[uID].x - pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_sub_unknown(pParticles[uID].y
+                                                 - pIndoorCameraD3D->vPartyPos.y, v5);
+    X_4 = fixpoint_sub_unknown(pParticles[uID].z - pIndoorCameraD3D->vPartyPos.z, v44) + fixpoint_mul(v45, v3);
     if ( X_4 < 0x40000 )
       return 0;
-    v16 = fixpoint_sub_unknown(pParticles[uID].y - pEngine->pIndoorCameraD3D->vPartyPos.y, v4)
-        - fixpoint_sub_unknown(pParticles[uID].x - pEngine->pIndoorCameraD3D->vPartyPos.x, v5);
-    v17 = fixpoint_sub_unknown(pParticles[uID].z - pEngine->pIndoorCameraD3D->vPartyPos.z, v3) - fixpoint_mul(v45, v44);
+    v16 = fixpoint_sub_unknown(pParticles[uID].y - pIndoorCameraD3D->vPartyPos.y, v4)
+        - fixpoint_sub_unknown(pParticles[uID].x - pIndoorCameraD3D->vPartyPos.x, v5);
+    v17 = fixpoint_sub_unknown(pParticles[uID].z - pIndoorCameraD3D->vPartyPos.z, v3) - fixpoint_mul(v45, v44);
   }
   else
   {
@@ -515,23 +515,23 @@
     {
       LODWORD(v22) = 0;
       HIDWORD(v22) = SLOWORD(pODMRenderParams->int_fov_rad);
-      long long _var_123 = fixpoint_sub_unknown(pParticles[uID].x - pEngine->pIndoorCameraD3D->vPartyPos.x, v4)
-                         + fixpoint_sub_unknown(pParticles[uID].y - pEngine->pIndoorCameraD3D->vPartyPos.y, v5);
+      long long _var_123 = fixpoint_sub_unknown(pParticles[uID].x - pIndoorCameraD3D->vPartyPos.x, v4)
+                         + fixpoint_sub_unknown(pParticles[uID].y - pIndoorCameraD3D->vPartyPos.y, v5);
       pParticles[uID]._screenspace_scale = v22 / _var_123;
       pParticles[uID].uScreenSpaceX = pViewport->uScreenCenterX
                         - ((signed int)fixpoint_mul(pParticles[uID]._screenspace_scale, (fixpoint_sub_unknown(pParticles[uID].y
-                        - pEngine->pIndoorCameraD3D->vPartyPos.y, v4)
-                        - fixpoint_sub_unknown(pParticles[uID].x - pEngine->pIndoorCameraD3D->vPartyPos.x, v5))) >> 16);
+                        - pIndoorCameraD3D->vPartyPos.y, v4)
+                        - fixpoint_sub_unknown(pParticles[uID].x - pIndoorCameraD3D->vPartyPos.x, v5))) >> 16);
       pParticles[uID].uScreenSpaceY = pViewport->uScreenCenterY - (fixpoint_sub_unknown(pParticles[uID].z, pParticles[uID]._screenspace_scale) >> 16);
       pParticles[uID].sZValue = _var_123;
     }
-    v26 = fixpoint_sub_unknown(pParticles[uID].y - pEngine->pIndoorCameraD3D->vPartyPos.y, v5);
-    X_4 = v26 + fixpoint_sub_unknown(pParticles[uID].x - pEngine->pIndoorCameraD3D->vPartyPos.x, v4);
+    v26 = fixpoint_sub_unknown(pParticles[uID].y - pIndoorCameraD3D->vPartyPos.y, v5);
+    X_4 = v26 + fixpoint_sub_unknown(pParticles[uID].x - pIndoorCameraD3D->vPartyPos.x, v4);
     if ( X_4 < 0x40000 || X_4 > (pODMRenderParams->uPickDepth - 1000) << 16 )
       return 0;
     v17 = pParticles[uID].z;
-    v16 = fixpoint_sub_unknown(pParticles[uID].y - pEngine->pIndoorCameraD3D->vPartyPos.y, v4)
-        - fixpoint_sub_unknown(pParticles[uID].x - pEngine->pIndoorCameraD3D->vPartyPos.x, v5);
+    v16 = fixpoint_sub_unknown(pParticles[uID].y - pIndoorCameraD3D->vPartyPos.y, v4)
+        - fixpoint_sub_unknown(pParticles[uID].x - pIndoorCameraD3D->vPartyPos.x, v5);
   }
   v40 = v17;
   v28 = abs(v16);
--- a/Engine/Graphics/Render.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Graphics/Render.cpp	Sun May 10 03:21:14 2015 +0200
@@ -259,12 +259,12 @@
       pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * blockScale;
       pTerrainVertices[z * 128 + x].vWorldPosition.y = (64 - (signed)z) * blockScale;
       pTerrainVertices[z * 128 + x].vWorldPosition.z = heightScale * pOutdoor->pTerrain.pHeightmap[z * 128 + x];
-      pEngine->pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1);
-      pEngine->pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0);
+      pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1);
+      pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0);
     }
   }
 //-------(Îòñå÷åíèå íåâèäèìîé ÷àñòè êàðòû)------------------------------------------------------------------------------------------
-  float direction = (float)(pEngine->pIndoorCameraD3D->sRotationY / 256);//direction of the camera(íàïðâëåíèå êàìåðû)
+  float direction = (float)(pIndoorCameraD3D->sRotationY / 256);//direction of the camera(íàïðâëåíèå êàìåðû)
   //0-East(B)
   //1-NorthEast(CB)
   //2-North(C)
@@ -612,7 +612,7 @@
       z = object->vPosition.z;
       frame = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID);
       a6 = frame->uGlowRadius * object->field_22_glow_radius_multiplier;
-      v6 = stru_5C6E00->Atan2(object->vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x, object->vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
+      v6 = stru_5C6E00->Atan2(object->vPosition.x - pIndoorCameraD3D->vPartyPos.x, object->vPosition.y - pIndoorCameraD3D->vPartyPos.y);
       //LOWORD(v7) = object->uFacing;
       //v8 = v36;
       v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7;
@@ -637,18 +637,18 @@
         //LOBYTE(v11) = _4E94D3_light_type;
         pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFF, 0xFF, 0xFF, _4E94D3_light_type);
       }
-      if (pEngine->pIndoorCameraD3D->sRotationX)
-      {
-        v30 = fixpoint_mul((x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16, pEngine->pIndoorCameraD3D->int_cosine_y)
-            + fixpoint_mul((y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16, pEngine->pIndoorCameraD3D->int_sine_y);
-        v37 = fixpoint_mul((x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16, pEngine->pIndoorCameraD3D->int_sine_y);
-        v42 = fixpoint_mul((z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, pEngine->pIndoorCameraD3D->int_sine_x)
-            + fixpoint_mul(v30, pEngine->pIndoorCameraD3D->int_cosine_x);
+      if (pIndoorCameraD3D->sRotationX)
+      {
+        v30 = fixpoint_mul((x - pIndoorCameraD3D->vPartyPos.x) << 16, pIndoorCameraD3D->int_cosine_y)
+            + fixpoint_mul((y - pIndoorCameraD3D->vPartyPos.y) << 16, pIndoorCameraD3D->int_sine_y);
+        v37 = fixpoint_mul((x - pIndoorCameraD3D->vPartyPos.x) << 16, pIndoorCameraD3D->int_sine_y);
+        v42 = fixpoint_mul((z - pIndoorCameraD3D->vPartyPos.z) << 16, pIndoorCameraD3D->int_sine_x)
+            + fixpoint_mul(v30, pIndoorCameraD3D->int_cosine_x);
         if ( v42 >= 0x40000 && v42 <= pODMRenderParams->shading_dist_mist << 16 )
         {
-          v17 = fixpoint_mul((y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16, pEngine->pIndoorCameraD3D->int_cosine_y) - v37;
-          v18 = fixpoint_mul((z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, pEngine->pIndoorCameraD3D->int_cosine_x)
-              - fixpoint_mul(v30, pEngine->pIndoorCameraD3D->int_sine_x);
+          v17 = fixpoint_mul((y - pIndoorCameraD3D->vPartyPos.y) << 16, pIndoorCameraD3D->int_cosine_y) - v37;
+          v18 = fixpoint_mul((z - pIndoorCameraD3D->vPartyPos.z) << 16, pIndoorCameraD3D->int_cosine_x)
+              - fixpoint_mul(v30, pIndoorCameraD3D->int_sine_x);
           if ( abs(v42) >= abs(v17) )
           {
             LODWORD(v23) = 0;
@@ -689,13 +689,13 @@
       }
       else
       {
-        v42 = fixpoint_mul((y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16, pEngine->pIndoorCameraD3D->int_sine_y)
-            + fixpoint_mul((x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16, pEngine->pIndoorCameraD3D->int_cosine_y);
+        v42 = fixpoint_mul((y - pIndoorCameraD3D->vPartyPos.y) << 16, pIndoorCameraD3D->int_sine_y)
+            + fixpoint_mul((x - pIndoorCameraD3D->vPartyPos.x) << 16, pIndoorCameraD3D->int_cosine_y);
         if ( v42 >= 0x40000 && v42 <= pODMRenderParams->shading_dist_mist << 16 )
         {
-          v17 = fixpoint_mul((y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16, pEngine->pIndoorCameraD3D->int_cosine_y)
-              - fixpoint_mul(((x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16), pEngine->pIndoorCameraD3D->int_sine_y);
-          v18 = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16;
+          v17 = fixpoint_mul((y - pIndoorCameraD3D->vPartyPos.y) << 16, pIndoorCameraD3D->int_cosine_y)
+              - fixpoint_mul(((x - pIndoorCameraD3D->vPartyPos.x) << 16), pIndoorCameraD3D->int_sine_y);
+          v18 = (z - pIndoorCameraD3D->vPartyPos.z) << 16;
           if ( abs(v42) >= abs(v17) )
           {
             LODWORD(v23) = 0;
@@ -1025,8 +1025,8 @@
           #pragma endregion
           //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7);
 
-          v10 = (unsigned __int16 *)stru_5C6E00->Atan2(pLevelDecorations[i].vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x,
-                                                       pLevelDecorations[i].vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
+          v10 = (unsigned __int16 *)stru_5C6E00->Atan2(pLevelDecorations[i].vPosition.x - pIndoorCameraD3D->vPartyPos.x,
+                                                       pLevelDecorations[i].vPosition.y - pIndoorCameraD3D->vPartyPos.y);
           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;
@@ -1057,18 +1057,18 @@
                                              frame->uGlowRadius, r, g, b_, _4E94D0_light_type);
           }//for light
 
-          v17 = (pLevelDecorations[i].vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16;
-          if (pEngine->pIndoorCameraD3D->sRotationX)
+          v17 = (pLevelDecorations[i].vPosition.x - pIndoorCameraD3D->vPartyPos.x) << 16;
+          if (pIndoorCameraD3D->sRotationX)
           {
-            v40 = (pLevelDecorations[i].vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16;
-            v18 = fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v40, pEngine->pIndoorCameraD3D->int_sine_y);
-            v41 = fixpoint_mul((pLevelDecorations[i].vPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, pEngine->pIndoorCameraD3D->int_sine_x);
-            v19 = fixpoint_mul(v18, pEngine->pIndoorCameraD3D->int_cosine_x);
-            v20 = v19 + fixpoint_mul((pLevelDecorations[i].vPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, pEngine->pIndoorCameraD3D->int_sine_x);
+            v40 = (pLevelDecorations[i].vPosition.y - pIndoorCameraD3D->vPartyPos.y) << 16;
+            v18 = fixpoint_mul(v17, pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v40, pIndoorCameraD3D->int_sine_y);
+            v41 = fixpoint_mul((pLevelDecorations[i].vPosition.z - pIndoorCameraD3D->vPartyPos.z) << 16, pIndoorCameraD3D->int_sine_x);
+            v19 = fixpoint_mul(v18, pIndoorCameraD3D->int_cosine_x);
+            v20 = v19 + fixpoint_mul((pLevelDecorations[i].vPosition.z - pIndoorCameraD3D->vPartyPos.z) << 16, pIndoorCameraD3D->int_sine_x);
             if ( v20 >= 0x40000 && v20 <= pODMRenderParams->shading_dist_mist << 16 )
             {
-              v21 = fixpoint_mul(v40, pEngine->pIndoorCameraD3D->int_cosine_y) - fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_sine_y);
-              v22 = fixpoint_mul((pLevelDecorations[i].vPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, pEngine->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v18, pEngine->pIndoorCameraD3D->int_sine_x);
+              v21 = fixpoint_mul(v40, pIndoorCameraD3D->int_cosine_y) - fixpoint_mul(v17, pIndoorCameraD3D->int_sine_y);
+              v22 = fixpoint_mul((pLevelDecorations[i].vPosition.z - pIndoorCameraD3D->vPartyPos.z) << 16, pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v18, pIndoorCameraD3D->int_sine_x);
               if ( 2 * abs(v20) >= abs(v21) )
               {
                 LODWORD(v24) = 0;
@@ -1116,13 +1116,13 @@
           }
           else
           {
-            v42 = (pLevelDecorations[i].vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16;
-            v40 = (pLevelDecorations[i].vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16;
-            v20 = fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v40, pEngine->pIndoorCameraD3D->int_sine_y);
+            v42 = (pLevelDecorations[i].vPosition.x - pIndoorCameraD3D->vPartyPos.x) << 16;
+            v40 = (pLevelDecorations[i].vPosition.y - pIndoorCameraD3D->vPartyPos.y) << 16;
+            v20 = fixpoint_mul(v17, pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v40, pIndoorCameraD3D->int_sine_y);
             if ( v20 >= 0x40000 && v20 <= pODMRenderParams->shading_dist_mist << 16 )
             {
-              v21 = fixpoint_mul(v40, pEngine->pIndoorCameraD3D->int_cosine_y) - fixpoint_mul(v42, pEngine->pIndoorCameraD3D->int_sine_y);
-              v22 = (pLevelDecorations[i].vPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16;
+              v21 = fixpoint_mul(v40, pIndoorCameraD3D->int_cosine_y) - fixpoint_mul(v42, pIndoorCameraD3D->int_sine_y);
+              v22 = (pLevelDecorations[i].vPosition.z - pIndoorCameraD3D->vPartyPos.z) << 16;
               v42 = v22;
               if ( 2 * abs(v20) >= abs(v21) )
               {
@@ -4745,8 +4745,8 @@
     }
 
     //if (pIndoorCamera->flags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES || pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES)
-    if (pEngine->pIndoorCameraD3D->debug_flags & ODM_RENDER_DRAW_TERRAIN_OUTLINES)
-      pEngine->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0);
+    if (pIndoorCameraD3D->debug_flags & ODM_RENDER_DRAW_TERRAIN_OUTLINES)
+      pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0);
   }
 // 4A26BC: could not find valid save-restore pair for esi
 // 4D864C: using guessed type char byte_4D864C;
@@ -4870,8 +4870,8 @@
   //for floor and wall(for example Selesta)-------------------
   if (pFace->uPolygonType == POLYGON_InBetweenFloorAndWall || pFace->uPolygonType == POLYGON_Floor)
   {
-    int v69 = (GetTickCount() / 32) - pEngine->pIndoorCameraD3D->vPartyPos.x;
-    int v55 = (GetTickCount() / 32) + pEngine->pIndoorCameraD3D->vPartyPos.y;
+    int v69 = (GetTickCount() / 32) - pIndoorCameraD3D->vPartyPos.x;
+    int v55 = (GetTickCount() / 32) + pIndoorCameraD3D->vPartyPos.y;
     for (uint i = 0; i < uNumVertices; ++i)
     {
       array_507D30[i].u = (v69 + array_507D30[i].u) * 0.25f;
@@ -4881,16 +4881,16 @@
     return;
   }
 //---------------------------------------
-  v70 = (signed __int64)((double)(pBLVRenderParams->fov_rad_fixpoint * pEngine->pIndoorCameraD3D->vPartyPos.z)//179
+  v70 = (signed __int64)((double)(pBLVRenderParams->fov_rad_fixpoint * pIndoorCameraD3D->vPartyPos.z)//179
                        / (((double)pBLVRenderParams->fov_rad_fixpoint + 16192.0)
                         * 65536.0)
                        + (double)pBLVRenderParams->uViewportCenterY);
-  v5 = (double)pEngine->pIndoorCameraD3D->sRotationX * 0.0030664064;//0
+  v5 = (double)pIndoorCameraD3D->sRotationX * 0.0030664064;//0
   v6 = (signed __int64)((double)pBLVRenderParams->uViewportCenterY//183
                       - (double)pBLVRenderParams->fov_rad_fixpoint
                       / ((cos(v5) * 16192.0 + 0.0000001)
                        * 65535.0)
-                      * (sin(v5) * -16192.0 - (double)pEngine->pIndoorCameraD3D->vPartyPos.z));
+                      * (sin(v5) * -16192.0 - (double)pIndoorCameraD3D->vPartyPos.z));
 
   stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0);
   pSkyPolygon.Create_48607B(&stru_8019C8);
@@ -4903,9 +4903,9 @@
   pSkyPolygon.dimming_level = 0;
   pSkyPolygon.uNumVertices = uNumVertices;
 
-  pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationX + 16);
+  pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pIndoorCameraD3D->sRotationX + 16);
   pSkyPolygon.v_18.y = 0;
-  pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationX + 16);
+  pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pIndoorCameraD3D->sRotationX + 16);
 
   memcpy(&array_507D30[uNumVertices], array_507D30, sizeof(array_507D30[uNumVertices]));
   pSkyPolygon.field_24 = 0x2000000;
@@ -8499,7 +8499,7 @@
               {
                 if ( pOutdoor->pBModels[model_id].pVertices.pVertices[pOutdoor->pBModels[model_id].pFaces[face_id].pVertexIDs[0]].z == array_73D150[i - 1].vWorldPosition.z )
                   ++v53;
-                pEngine->pIndoorCameraD3D->ViewTransform(&array_73D150[i - 1], 1);
+                pIndoorCameraD3D->ViewTransform(&array_73D150[i - 1], 1);
                 if ( array_73D150[i - 1].vWorldViewPosition.x < 8.0 || array_73D150[i - 1].vWorldViewPosition.x > pODMRenderParams->shading_dist_mist )
                 {
                   if ( array_73D150[i - 1].vWorldViewPosition.x >= 8.0 )
@@ -8508,7 +8508,7 @@
                     v50 = 1;
                 }
                 else
-                  pEngine->pIndoorCameraD3D->Project(&array_73D150[i - 1], 1, 0);
+                  pIndoorCameraD3D->Project(&array_73D150[i - 1], 1, 0);
               }
             }
             if ( v53 == pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices )
@@ -8624,16 +8624,16 @@
   int v38; // [sp+158h] [bp-Ch]@1
   int v39; // [sp+15Ch] [bp-8h]@4
 
-  v30 = (signed __int64)((double)(pODMRenderParams->int_fov_rad * pEngine->pIndoorCameraD3D->vPartyPos.z)
+  v30 = (signed __int64)((double)(pODMRenderParams->int_fov_rad * pIndoorCameraD3D->vPartyPos.z)
                        / ((double)pODMRenderParams->int_fov_rad + 8192.0)
                        + (double)(pViewport->uScreenCenterY));
-  v34 = cos((double)pEngine->pIndoorCameraD3D->sRotationX * 0.0030664064) * 0x2000;//(double)pODMRenderParams->shading_dist_mist, 8192
+  v34 = cos((double)pIndoorCameraD3D->sRotationX * 0.0030664064) * 0x2000;//(double)pODMRenderParams->shading_dist_mist, 8192
   v38 = (signed __int64)((double)(pViewport->uScreenCenterY)
                        - (double)pODMRenderParams->int_fov_rad
                        / (v34 + 0.0000001)
-                       * (sin((double)pEngine->pIndoorCameraD3D->sRotationX * 0.0030664064)
+                       * (sin((double)pIndoorCameraD3D->sRotationX * 0.0030664064)
                         * (double)-0x2000//(double)pODMRenderParams->shading_dist_mist
-                        - (double)pEngine->pIndoorCameraD3D->vPartyPos.z));
+                        - (double)pIndoorCameraD3D->vPartyPos.z));
   pSkyPolygon.Create_48607B(&stru_8019C8);//çàïîëíÿåòñÿ ptr_38
   pSkyPolygon.ptr_38->_48694B_frustum_sky();
 
@@ -8647,9 +8647,9 @@
     pSkyPolygon.dimming_level = 0;
     pSkyPolygon.uNumVertices = 4;
   //centering(öåíòðóåì)-----------------------------------------------------------------
-    pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationX + 16);
+    pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pIndoorCameraD3D->sRotationX + 16);
     pSkyPolygon.v_18.y = 0;
-    pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationX + 16);
+    pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pIndoorCameraD3D->sRotationX + 16);
   
   //sky wiew position(ïîëîæåíèå íåáà íà ýêðàíå)------------------------------------------
   //                X
@@ -8888,7 +8888,7 @@
 
   ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE));
   ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE));
-  ErrD3D(pRenderD3D->pDevice->SetTexture(0, pEngine->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03")));
+  ErrD3D(pRenderD3D->pDevice->SetTexture(0, pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03")));
   ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
   ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE));
 }
@@ -8918,7 +8918,7 @@
   ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE));
   ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE));
   ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE));
-  ErrD3D(pRenderD3D->pDevice->SetTexture(0, pEngine->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03")));
+  ErrD3D(pRenderD3D->pDevice->SetTexture(0, pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03")));
   ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
   ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE));
 }
@@ -9009,7 +9009,7 @@
   ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE));
   ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE));
 
-  ErrD3D(pRenderD3D->pDevice->SetTexture(0, pEngine->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("hwsplat04")));
+  ErrD3D(pRenderD3D->pDevice->SetTexture(0, pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("hwsplat04")));
 }
 
 
@@ -9064,10 +9064,10 @@
 
     float v15;
     if (fabs(z_bias) < 1e-5)
-      v15 = 1.0 - 1.0 / ((1.0f / pEngine->pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0);
+      v15 = 1.0 - 1.0 / ((1.0f / pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0);
     else
     {
-      v15 = 1.0 - 1.0 / ((1.0f / pEngine->pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0) - z_bias;
+      v15 = 1.0 - 1.0 / ((1.0f / pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0) - z_bias;
       if (v15 < 0.000099999997)
         v15 = 0.000099999997;
     }
@@ -10513,13 +10513,13 @@
 	int angle; // [sp+24h] [bp-8h]@1
 
 	angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 / 2;
-	v3 = pOutdoor->pBModels[uModelID].vBoundingCenter.x - pEngine->pIndoorCameraD3D->vPartyPos.x;
-	v4 = pOutdoor->pBModels[uModelID].vBoundingCenter.y - pEngine->pIndoorCameraD3D->vPartyPos.y;
-	stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationX);
-	v17 = v3 * stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationY) + v4 * stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationY);
-	if (pEngine->pIndoorCameraD3D->sRotationX)
-		v17 = fixpoint_mul(v17, stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationX));
-	v19 = v4 * stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationY) - v3 * stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationY);
+	v3 = pOutdoor->pBModels[uModelID].vBoundingCenter.x - pIndoorCameraD3D->vPartyPos.x;
+	v4 = pOutdoor->pBModels[uModelID].vBoundingCenter.y - pIndoorCameraD3D->vPartyPos.y;
+	stru_5C6E00->Sin(pIndoorCameraD3D->sRotationX);
+	v17 = v3 * stru_5C6E00->Cos(pIndoorCameraD3D->sRotationY) + v4 * stru_5C6E00->Sin(pIndoorCameraD3D->sRotationY);
+	if (pIndoorCameraD3D->sRotationX)
+		v17 = fixpoint_mul(v17, stru_5C6E00->Cos(pIndoorCameraD3D->sRotationX));
+	v19 = v4 * stru_5C6E00->Cos(pIndoorCameraD3D->sRotationY) - v3 * stru_5C6E00->Sin(pIndoorCameraD3D->sRotationY);
 	v9 = int_get_vector_length(abs(v3), abs(v4), 0);
 	//v10 = v14 * 188;
 	//v22 = v9;
@@ -11116,29 +11116,29 @@
 	int v25; // [sp+18h] [bp-10h]@1
 	int v27; // [sp+24h] [bp-4h]@1
 
-	v25 = pEngine->pIndoorCameraD3D->int_cosine_x;
-	v7 = pEngine->pIndoorCameraD3D->int_sine_y;
-	v27 = pEngine->pIndoorCameraD3D->int_sine_x;
+	v25 = pIndoorCameraD3D->int_cosine_x;
+	v7 = pIndoorCameraD3D->int_sine_y;
+	v27 = pIndoorCameraD3D->int_sine_x;
 	//v8 = -pIndoorCamera->pos.y;
-	v9 = pEngine->pIndoorCameraD3D->int_cosine_y;
+	v9 = pIndoorCameraD3D->int_cosine_y;
 	//v26 = -pIndoorCamera->pos.z;
-	v11 = pEngine->pIndoorCameraD3D->int_cosine_y * -pEngine->pIndoorCameraD3D->vPartyPos.x + pEngine->pIndoorCameraD3D->int_sine_y * -pEngine->pIndoorCameraD3D->vPartyPos.y;
-	v24 = pEngine->pIndoorCameraD3D->int_cosine_y * -pEngine->pIndoorCameraD3D->vPartyPos.y - pEngine->pIndoorCameraD3D->int_sine_y * -pEngine->pIndoorCameraD3D->vPartyPos.x;
-	if (pEngine->pIndoorCameraD3D->sRotationX)
+	v11 = pIndoorCameraD3D->int_cosine_y * -pIndoorCameraD3D->vPartyPos.x + pIndoorCameraD3D->int_sine_y * -pIndoorCameraD3D->vPartyPos.y;
+	v24 = pIndoorCameraD3D->int_cosine_y * -pIndoorCameraD3D->vPartyPos.y - pIndoorCameraD3D->int_sine_y * -pIndoorCameraD3D->vPartyPos.x;
+	if (pIndoorCameraD3D->sRotationX)
 	{
-		this->field_0_party_dir_x = fixpoint_mul(v11, pEngine->pIndoorCameraD3D->int_cosine_x) +
-			fixpoint_mul((-pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, pEngine->pIndoorCameraD3D->int_sine_x);
+		this->field_0_party_dir_x = fixpoint_mul(v11, pIndoorCameraD3D->int_cosine_x) +
+			fixpoint_mul((-pIndoorCameraD3D->vPartyPos.z) << 16, pIndoorCameraD3D->int_sine_x);
 		this->field_4_party_dir_y = v24;
-		this->field_8_party_dir_z = fixpoint_mul((-pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_mul(v11, v27);
+		this->field_8_party_dir_z = fixpoint_mul((-pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_mul(v11, v27);
 	}
 	else
 	{
 		this->field_0_party_dir_x = v11;
 		this->field_4_party_dir_y = v24;
-		this->field_8_party_dir_z = (-pEngine->pIndoorCameraD3D->vPartyPos.z) << 16;
+		this->field_8_party_dir_z = (-pIndoorCameraD3D->vPartyPos.z) << 16;
 	}
 
-	if (pEngine->pIndoorCameraD3D->sRotationX)
+	if (pIndoorCameraD3D->sRotationX)
 	{
 		v17 = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7);
 
@@ -11153,7 +11153,7 @@
 		this->viewing_angle_from_west_east = a4;
 	}
 
-	if (pEngine->pIndoorCameraD3D->sRotationX)
+	if (pIndoorCameraD3D->sRotationX)
 	{
 		v19 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7);
 
--- a/Engine/Graphics/Vis.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Graphics/Vis.cpp	Sun May 10 03:21:14 2015 +0200
@@ -72,8 +72,8 @@
   }
   else assert(false);
 
-  pEngine->pIndoorCameraD3D->ViewTransform(static_DetermineFacetIntersection_array_F8F200, face->uNumVertices);
-  pEngine->pIndoorCameraD3D->Project(static_DetermineFacetIntersection_array_F8F200, face->uNumVertices, 1);
+  pIndoorCameraD3D->ViewTransform(static_DetermineFacetIntersection_array_F8F200, face->uNumVertices);
+  pIndoorCameraD3D->Project(static_DetermineFacetIntersection_array_F8F200, face->uNumVertices, 1);
 
   SortVectors_x(static_DetermineFacetIntersection_array_F8F200, 0, face->uNumVertices - 1);
   if (static_DetermineFacetIntersection_array_F8F200[0].vWorldViewPosition.x > pick_depth)
@@ -294,11 +294,11 @@
         BLVFace* face = &pIndoor->pFaces[pFaceID];
         if ( is_part_of_selection(face, filter) )
         {
-          if ( !pEngine->pIndoorCameraD3D->IsCulled(face) )
+          if ( !pIndoorCameraD3D->IsCulled(face) )
           {
             if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, face, 0xFFFFFFFFu) )
             {
-              pEngine->pIndoorCameraD3D->ViewTransform(&a1, 1);
+              pIndoorCameraD3D->ViewTransform(&a1, 1);
               v9 = fixpoint_from_float(/*v8, */a1.vWorldViewPosition.x);
               LOWORD(v9) = 0;
               v15 = (void *)((PID(OBJECT_BModel,pFaceID)) + v9);
@@ -350,7 +350,7 @@
         RenderVertexSoft intersection;
         if (Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &intersection, &blv_face, i))
         {
-          pEngine->pIndoorCameraD3D->ViewTransform(&intersection, 1);
+          pIndoorCameraD3D->ViewTransform(&intersection, 1);
           int v13 = fixpoint_from_float(/*v12, */intersection.vWorldViewPosition.x);
           v13 &= 0xFFFF0000;
           v13 += PID(OBJECT_BModel, j | (i << 6));
@@ -777,7 +777,7 @@
   if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
   {
     //if ( pRenderer->pRenderD3D )
-      v3 = pEngine->pIndoorCameraD3D->fov;
+      v3 = pIndoorCameraD3D->fov;
     //else
     //  v3 = pIndoorCamera->fov_rad;
   }
@@ -796,7 +796,7 @@
   if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
   {
     //if ( pRenderer->pRenderD3D )
-      v3 = pEngine->pIndoorCameraD3D->fov;
+      v3 = pIndoorCameraD3D->fov;
     //else
     //  v3 = pIndoorCamera->fov_rad;
   }
@@ -819,16 +819,16 @@
   int outz; // [sp+94h] [bp-Ch]@1
   int outy; // [sp+98h] [bp-8h]@1
   
-  pRotY = pEngine->pIndoorCameraD3D->sRotationY + UnprojectX(fMouseX);
-  pRotX = pEngine->pIndoorCameraD3D->sRotationX + UnprojectY(fMouseY);
+  pRotY = pIndoorCameraD3D->sRotationY + UnprojectX(fMouseX);
+  pRotX = pIndoorCameraD3D->sRotationX + UnprojectY(fMouseY);
 
-  pStartR.z = pEngine->pIndoorCameraD3D->vPartyPos.z;
-  pStartR.x = pEngine->pIndoorCameraD3D->vPartyPos.x;
-  pStartR.y = pEngine->pIndoorCameraD3D->vPartyPos.y;
+  pStartR.z = pIndoorCameraD3D->vPartyPos.z;
+  pStartR.x = pIndoorCameraD3D->vPartyPos.x;
+  pStartR.y = pIndoorCameraD3D->vPartyPos.y;
 
-  v11[1].vWorldPosition.x = (double)pEngine->pIndoorCameraD3D->vPartyPos.x;
-  v11[1].vWorldPosition.y = (double)pEngine->pIndoorCameraD3D->vPartyPos.y;
-  v11[1].vWorldPosition.z = (double)pEngine->pIndoorCameraD3D->vPartyPos.z;
+  v11[1].vWorldPosition.x = (double)pIndoorCameraD3D->vPartyPos.x;
+  v11[1].vWorldPosition.y = (double)pIndoorCameraD3D->vPartyPos.y;
+  v11[1].vWorldPosition.z = (double)pIndoorCameraD3D->vPartyPos.z;
 
   pDepth = fixpoint_from_float(fPickDepth);
   Vec3_int_::Rotate(pDepth, pRotY, pRotX, pStartR, &outx, &outy, &outz);
@@ -1509,7 +1509,7 @@
       if ( pFaceID < (signed int)pIndoor->uNumFaces )
       {
         pFace = &pIndoor->pFaces[pFaceID];
-        if ( !pEngine->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[pFaceID]) )
+        if ( !pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[pFaceID]) )
         {
           if ( is_part_of_selection(pFace, filter) )
           {
--- a/Engine/Graphics/stru10.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Graphics/stru10.cpp	Sun May 10 03:21:14 2015 +0200
@@ -241,7 +241,7 @@
 
   //_ESI = a3;
   //v31 = this;
-  //v6 = pEngine->pIndoorCameraD3D;
+  //v6 = pIndoorCameraD3D;
   //v7 = a3->uPolygonType;
 
   a1.x = 0.0f;
@@ -669,9 +669,9 @@
   RenderVertexSoft v25; // [sp+10h] [bp-90h]@20
   memcpy(&v25, pOutBounding, sizeof(RenderVertexSoft));
 
-  float _dp = (v25.vWorldPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) * a1.x +
-              (v25.vWorldPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y) * a1.y +
-              (v25.vWorldPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z) * a1.z;
+  float _dp = (v25.vWorldPosition.x - pIndoorCameraD3D->vPartyPos.x) * a1.x +
+              (v25.vWorldPosition.y - pIndoorCameraD3D->vPartyPos.y) * a1.y +
+              (v25.vWorldPosition.z - pIndoorCameraD3D->vPartyPos.z) * a1.z;
   if (fabs(_dp) < 1e-6f)
   {
     memcpy(&v25, &pOutBounding[1], sizeof(RenderVertexSoft));
@@ -690,17 +690,17 @@
           v26.vWorldPosition.y = pParty->vPosition.y;
           v26.vWorldPosition.z = pParty->vPosition.z + pParty->sEyelevel;             // frustum
 
-          pEngine->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFF0000u, &pOutBounding[0], 0xFF0000u, 0, 0);
-          pEngine->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFF00u, &pOutBounding[1], 0xFF00u, 0, 0);
-          pEngine->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFFu, &pOutBounding[2], 0xFFu, 0, 0);
-          pEngine->pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFFFFFFu, &pOutBounding[3], 0xFFFFFFu, 0, 0);
+          pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFF0000u, &pOutBounding[0], 0xFF0000u, 0, 0);
+          pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFF00u, &pOutBounding[1], 0xFF00u, 0, 0);
+          pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFFu, &pOutBounding[2], 0xFFu, 0, 0);
+          pIndoorCameraD3D->do_draw_debug_line_sw(&v26, 0xFFFFFFu, &pOutBounding[3], 0xFFFFFFu, 0, 0);
           bDoNotDrawPortalFrustum = true;
         }
-        pEngine->pIndoorCameraD3D->debug_outline_sw(pOutBounding, uNumVertices, 0x1EFF1Eu, 0.00019999999);    // bounding
+        pIndoorCameraD3D->debug_outline_sw(pOutBounding, uNumVertices, 0x1EFF1Eu, 0.00019999999);    // bounding
       }
     //}
 
-    //pEngine->pIndoorCameraD3D->debug_outline_sw(pFaceLimits,  4, 0xFFF14040, 0.000099999997);     // limits
+    //pIndoorCameraD3D->debug_outline_sw(pFaceLimits,  4, 0xFFF14040, 0.000099999997);     // limits
 
   /*if ( byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
   {
@@ -709,7 +709,7 @@
     v26.vWorldPosition.y = face_center_y;
     v26.vWorldPosition.z = face_center_z;
 
-    pEngine->pIndoorCameraD3D->do_draw_debug_line_sw(pFaceLimits, 0xFF00u, &v26, 0xFF0000u, 0, 0);  
+    pIndoorCameraD3D->do_draw_debug_line_sw(pFaceLimits, 0xFF00u, &v26, 0xFF0000u, 0, 0);  
   }*/
 
 
@@ -729,7 +729,7 @@
         v26.vWorldPosition.z = face_center_z + a1.z * 400.0f;
 
         if ( draw_portals_loops )
-          pEngine->pIndoorCameraD3D->do_draw_debug_line_sw(&v25, -1, &v26, 0xFFFF00u, 0, 0);
+          pIndoorCameraD3D->do_draw_debug_line_sw(&v25, -1, &v26, 0xFFFF00u, 0, 0);
       }
   //}
 
@@ -757,7 +757,7 @@
   _49CE9E(pFace, pVertices, *pNumVertices, pLimits);
 
   //if ( byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
-  //  pEngine->pIndoorCameraD3D->debug_outline_sw(a4a, 4u, 0xFF1E1Eu, 0.000099999997);
+  //  pIndoorCameraD3D->debug_outline_sw(a4a, 4u, 0xFF1E1Eu, 0.000099999997);
   if (CalcFaceBounding(pFace, pLimits, 4, pOutBounding))
     return _49C720(pOutBounding, a5);
   return false;
@@ -771,7 +771,7 @@
 
   CalcPolygonLimits(pFace, pLimits);//îïðåäåëåíèå ãðàíèö ïîðòàëà
   //if ( byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
- //   pEngine->pIndoorCameraD3D->debug_outline_sw(pLimits, 4, 0xFF1E1E, 0.000099999997);
+ //   pIndoorCameraD3D->debug_outline_sw(pLimits, 4, 0xFF1E1E, 0.000099999997);
   if (CalcFaceBounding(pFace, pLimits, 4, pOutBounding))
     return _49C720(pOutBounding, pPortalDataFrustum) != 0;
   return false;
@@ -783,9 +783,9 @@
 char stru10::_49C720(RenderVertexSoft *pFaceBounding, IndoorCameraD3D_Vec4 *pPortalDataFrustum)
 {
   Vec3_float_ pRayStart; // [sp+4h] [bp-34h]@1
-  pRayStart.x = (double)pEngine->pIndoorCameraD3D->vPartyPos.x;
-  pRayStart.y = (double)pEngine->pIndoorCameraD3D->vPartyPos.y;
-  pRayStart.z = (double)pEngine->pIndoorCameraD3D->vPartyPos.z;
+  pRayStart.x = (double)pIndoorCameraD3D->vPartyPos.x;
+  pRayStart.y = (double)pIndoorCameraD3D->vPartyPos.y;
+  pRayStart.z = (double)pIndoorCameraD3D->vPartyPos.z;
 
   if (FindFaceNormal(&pFaceBounding[0], &pFaceBounding[1], &pRayStart, &pPortalDataFrustum[0]) &&
       FindFaceNormal(&pFaceBounding[1], &pFaceBounding[2], &pRayStart, &pPortalDataFrustum[1]) &&
--- a/Engine/Objects/Actor.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Objects/Actor.cpp	Sun May 10 03:21:14 2015 +0200
@@ -1903,7 +1903,7 @@
 
   actor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[actor->pSpriteIDs[ANIM_Bored]].uAnimLength;
 
-  v7 = stru_5C6E00->Atan2(actor->vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x, actor->vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
+  v7 = stru_5C6E00->Atan2(actor->vPosition.x - pIndoorCameraD3D->vPartyPos.x, actor->vPosition.y - pIndoorCameraD3D->vPartyPos.y);
   v9 = stru_5C6E00->uIntegerPi + actor->uYawAngle + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v7;
 
   if ( v9 & 0x700 )      // turned away - just stand
--- a/Engine/Objects/Player.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Objects/Player.cpp	Sun May 10 03:21:14 2015 +0200
@@ -4678,7 +4678,7 @@
     {
       pMouse->RemoveHoldingItem();
       pMessageQueue_50C9E8->AddGUIMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1);
-      if ( current_screen_type && pGUIWindow_CurrentMenu
+      if (current_screen_type != SCREEN_GAME && pGUIWindow_CurrentMenu
         && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null))
       {
         pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
--- a/Engine/Objects/Player.h	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Objects/Player.h	Sun May 10 03:21:14 2015 +0200
@@ -54,6 +54,7 @@
   SPEECH_10 = 10,
   SPEECH_11 = 11,
   SPEECH_12 = 12,
+  SPEECH_CantRestHere = 13,
   SPEECH_14 = 14,
   SPEECH_NoRoom = 15,  // when placing to inventory
   SPEECH_DO_POTION_FINE = 16,
--- a/Engine/Spells/CastSpellInfo.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/Spells/CastSpellInfo.cpp	Sun May 10 03:21:14 2015 +0200
@@ -3130,8 +3130,8 @@
       {
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pEngine->GetIndoorCamera();
-        int mon_num = pRenderer->_46À6ÀÑ_GetActorsInViewport((signed __int64)pEngine->pIndoorCameraD3D->GetPickDepth());
+
+        int mon_num = pRenderer->_46À6ÀÑ_GetActorsInViewport((signed __int64)pIndoorCameraD3D->GetPickDepth());
         v707.x = 0;
         v707.y = 0;
         v707.z = 0;
--- a/Engine/mm7_data.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/mm7_data.cpp	Sun May 10 03:21:14 2015 +0200
@@ -974,9 +974,6 @@
 int day_fogrange_1; // weak
 int day_fogrange_2; // weak
 struct TileTable *pTileTable; // idb
-int outdoor_grid_band_1; // idb
-int outdoor_grid_band_2; // idb
-int outdoor_grid_band_3; // idb
 std::array<char, 777> pDefaultSkyTexture; // idb
 std::array<char, 16> byte_6BE124_cfg_textures_DefaultGroundTexture; // idb
 int _6BE134_odm_main_tile_group; // weak
--- a/Engine/mm7_data.h	Sun May 10 02:04:52 2015 +0200
+++ b/Engine/mm7_data.h	Sun May 10 03:21:14 2015 +0200
@@ -638,9 +638,6 @@
 extern int day_fogrange_1; // weak
 extern int day_fogrange_2; // weak
 extern struct TileTable *pTileTable; // idb
-extern int outdoor_grid_band_1; // idb
-extern int outdoor_grid_band_2; // idb
-extern int outdoor_grid_band_3; // idb
 extern std::array<char, 777> pDefaultSkyTexture; // idb
 extern std::array<char, 16> byte_6BE124_cfg_textures_DefaultGroundTexture; // idb
 extern int _6BE134_odm_main_tile_group; // weak
--- a/GUI/GUIWindow.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/GUI/GUIWindow.cpp	Sun May 10 03:21:14 2015 +0200
@@ -274,7 +274,7 @@
 		if ( bFlipOnExit )
 		{
           pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi + pParty->sRotationY);
-          pEngine->pIndoorCameraD3D->sRotationY = pParty->sRotationY;
+          pIndoorCameraD3D->sRotationY = pParty->sRotationY;
 		}
 		pParty->uFlags |= 2u;
 		break;
--- a/GUI/GUIWindow.h	Sun May 10 02:04:52 2015 +0200
+++ b/GUI/GUIWindow.h	Sun May 10 03:21:14 2015 +0200
@@ -585,7 +585,8 @@
 
 
 // rest ui
-void RestUI_Load();
+void PrepareToLoadRestUI();
+GUIWindow *RestUI_Load();
 void RestUI_Draw();
 
 
--- a/GUI/UI/UIHouses.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/GUI/UI/UIHouses.cpp	Sun May 10 03:21:14 2015 +0200
@@ -34,6 +34,9 @@
 #include "../../Engine/Graphics/Level/Decoration.h"
 
 #include "..\../Engine/stru159.h"
+
+#include "Game/GameOver.h"
+
 int uHouse_ExitPic; // weak
 
 int dword_591080; // weak
@@ -774,36 +777,36 @@
 //----- (0044622E) --------------------------------------------------------
 bool EnterHouse(enum HOUSE_ID uHouseID)
 {
-	signed int uOpenTime; // eax@5
-	signed int uCloseTime; // esi@5
-//	unsigned int v5; // esi@5
-//	int v6; // edx@5
-	signed int am_pm_flag_open; // ecx@10
-	signed int am_pm_flag_close; // eax@10
-//	int v9; // esi@10
-//	int v11; // ecx@17
-//	unsigned int v12; // kr00_4@25
-//	int v14; // eax@25
-	unsigned int v17; // eax@37
-	signed int v18; // edi@37
-	signed int v19; // edi@41
-	char pContainer[40]; // [sp+Ch] [bp-30h]@32
-//	unsigned int v24; // [sp+34h] [bp-8h]@5
+    signed int uOpenTime; // eax@5
+    signed int uCloseTime; // esi@5
+    //	unsigned int v5; // esi@5
+    //	int v6; // edx@5
+    signed int am_pm_flag_open; // ecx@10
+    signed int am_pm_flag_close; // eax@10
+    //	int v9; // esi@10
+    //	int v11; // ecx@17
+    //	unsigned int v12; // kr00_4@25
+    //	int v14; // eax@25
+    unsigned int v17; // eax@37
+    signed int v18; // edi@37
+    signed int v19; // edi@41
+    char pContainer[40]; // [sp+Ch] [bp-30h]@32
+    //	unsigned int v24; // [sp+34h] [bp-8h]@5
 
-	GameUI_Footer_TimedString[0] = 0;
-	pFooterString[0] = 0;
-	ShowStatusBarString("", 2);
-	if ( pMessageQueue_50CBD0->uNumMessages )
-		pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-	viewparams->bRedrawGameUI = 1;
-	uDialogueType = 0;
-	pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
-	pKeyActionMap->ResetKeys();
-	if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601)
-		{
-		GameOverMenu(0);
-		return 0;
-		}
+    GameUI_Footer_TimedString[0] = 0;
+    pFooterString[0] = 0;
+    ShowStatusBarString("", 2);
+    if (pMessageQueue_50CBD0->uNumMessages)
+        pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+    viewparams->bRedrawGameUI = 1;
+    uDialogueType = 0;
+    pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
+    pKeyActionMap->ResetKeys();
+    if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601)
+    {
+        GameOver_Loop(0);
+        return 0;
+    }
 	uOpenTime = p2DEvents[uHouseID - 1].uOpenTime;
 	uCloseTime = p2DEvents[uHouseID - 1].uCloseTime;
 	current_npc_text = 0;
@@ -1563,7 +1566,7 @@
         }
         else
         {
-          pEngine->pIndoorCameraD3D->sRotationY = 0;
+          pIndoorCameraD3D->sRotationY = 0;
 
           pParty->uFlags |= 2u;
           pParty->vPosition.x = pTravel->arrival_x;
@@ -3408,6 +3411,6 @@
       window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3, 0x33, "", 0);
       window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4, 0x34, "", 0);
     }
-    bGameoverLoop = 0;
+    bGameoverLoop = false;
   }
 }
--- a/GUI/UI/UIPartyCreation.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/GUI/UI/UIPartyCreation.cpp	Sun May 10 03:21:14 2015 +0200
@@ -567,25 +567,6 @@
   {
     uMouseX = pMouse->GetCursorPos(&v25)->x;
     uMouseY = pMouse->GetCursorPos(&v25)->y;
-    //pControlsHead = pGUIWindow_CurrentMenu->pControlsHead;
-
-    //does nothing actually
-    /*if ( pControlsHead != (GUIButton *)v1 )
-    {
-      pNumMessage = pMessageQueue_50CBD0->uNumMessages;
-      do
-      {
-        if ( uMouseX >= (signed int)pControlsHead->uX && uMouseX <= (signed int)pControlsHead->uZ 
-            && uMouseY >= (signed int)pControlsHead->uY && uMouseY <= (signed int)pControlsHead->uW )//mouse movement
-        {
-          pControlParam = pControlsHead->uControlParam;
-          pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)pControlsHead->field_1C, pControlParam, 0);
-          v1 = 0;
-        }
-        pControlsHead = pControlsHead->pNext;
-      }
-      while ( pControlsHead != (GUIButton *)v1 );
-    }*/
 
     while ( PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE) )
     {
--- a/GUI/UI/UIRest.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/GUI/UI/UIRest.cpp	Sun May 10 03:21:14 2015 +0200
@@ -18,49 +18,50 @@
 
 
 
-//----- (0041F6C1) --------------------------------------------------------
-void RestUI_Load()
+void PrepareToLoadRestUI()
 {
-  if ( !dword_506F14 )
-    pAudioPlayer->StopChannels(-1, -1);
-  if ( current_screen_type != SCREEN_GAME)
-  {
-    pGUIWindow_CurrentMenu->Release();
-    current_screen_type = SCREEN_GAME;
-    viewparams->bRedrawGameUI = true;
-  }
-  pEventTimer->Pause();
-  if ( dword_506F14 != 2 )
-    GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0);
-  _506F18_num_minutes_to_sleep = 0;
-  dword_506F14 = 0;
-  uRestUI_FoodRequiredToRest = 2;
-  if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-    uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
-  if ( PartyHasDragon() )
-  {
-    for ( uint i = 0; i < 4; ++i )
+    if (!_506F14_resting_stage)
+        pAudioPlayer->StopChannels(-1, -1);
+    if (current_screen_type != SCREEN_GAME)
+    {
+        pGUIWindow_CurrentMenu->Release();
+        current_screen_type = SCREEN_GAME;
+        viewparams->bRedrawGameUI = true;
+    }
+    pEventTimer->Pause();
+    if (_506F14_resting_stage != 2)
+        GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0);
+    _506F18_num_minutes_to_sleep = 0;
+    _506F14_resting_stage = 0;
+    uRestUI_FoodRequiredToRest = 2;
+    if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
+        uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
+    if (PartyHasDragon())
     {
-      if (pParty->pPlayers[i].classType == PLAYER_CLASS_WARLOCK)
-        ++uRestUI_FoodRequiredToRest;
+        for (uint i = 0; i < 4; ++i)
+        {
+            if (pParty->pPlayers[i].classType == PLAYER_CLASS_WARLOCK)
+                ++uRestUI_FoodRequiredToRest;
+        }
     }
-  }
-  if ( CheckHiredNPCSpeciality(Porter) )
-    --uRestUI_FoodRequiredToRest;
-  if ( CheckHiredNPCSpeciality(QuarterMaster) )
-    uRestUI_FoodRequiredToRest -= 2;
-  if ( CheckHiredNPCSpeciality(Gypsy) )
-    --uRestUI_FoodRequiredToRest;
-  if ( uRestUI_FoodRequiredToRest < 1 )
-    uRestUI_FoodRequiredToRest = 1;
-  if ( !_stricmp(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) )//Çàìîê Õàðìîíäåéë
-    uRestUI_FoodRequiredToRest = 0;
+    if (CheckHiredNPCSpeciality(Porter))
+        --uRestUI_FoodRequiredToRest;
+    if (CheckHiredNPCSpeciality(QuarterMaster))
+        uRestUI_FoodRequiredToRest -= 2;
+    if (CheckHiredNPCSpeciality(Gypsy))
+        --uRestUI_FoodRequiredToRest;
+    if (uRestUI_FoodRequiredToRest < 1)
+        uRestUI_FoodRequiredToRest = 1;
+    if (!_stricmp(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98))//Çàìîê Õàðìîíäåéë
+        uRestUI_FoodRequiredToRest = 0;
 
-  ++pIcons_LOD->uTexturePacksCount;
-  if ( !pIcons_LOD->uNumPrevLoadedFiles )
-    pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-
-  current_screen_type = SCREEN_REST;
+    ++pIcons_LOD->uTexturePacksCount;
+    if (!pIcons_LOD->uNumPrevLoadedFiles)
+        pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
+}
+//----- (0041F6C1) --------------------------------------------------------
+GUIWindow *RestUI_Load()
+{
   _507CD4_RestUI_hourglass_anim_controller = 0;
   uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE);
   uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE);
@@ -68,13 +69,17 @@
   uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE);
   uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE);
   uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE);
+
   OutdoorLocation::LoadActualSkyFrame();
-  pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Rest, 0, 0);
-  pButton_RestUI_Exit          = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest,       0,   0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0);
-  pButton_RestUI_Main          = pGUIWindow_CurrentMenu->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour,      0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0);
-  pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0);
-  pButton_RestUI_Wait1Hour     = pGUIWindow_CurrentMenu->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour,      0, 'H', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0);
-  pButton_RestUI_Wait5Minutes  = pGUIWindow_CurrentMenu->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes,   0, 'M', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0);
+
+  auto wnd = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Rest, 0, 0);
+  pButton_RestUI_Exit =          wnd->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0);
+  pButton_RestUI_Main =          wnd->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0);
+  pButton_RestUI_WaitUntilDawn = wnd->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0);
+  pButton_RestUI_Wait1Hour =     wnd->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 'H', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0);
+  pButton_RestUI_Wait5Minutes =  wnd->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 'M', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0);
+
+  return wnd;
 }
 
 //----- (0041FA01) --------------------------------------------------------
@@ -161,7 +166,7 @@
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193));
     sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear);//Ãîä
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193));
-    if ( dword_506F14 )
+    if ( _506F14_resting_stage )
       Party::Sleep6Hours();
   }
   else
--- a/Game/Game.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Game/Game.cpp	Sun May 10 03:21:14 2015 +0200
@@ -994,7 +994,7 @@
                                     pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
                                     break;
                                 case SCREEN_REST://close rest screen
-                                    if (dword_506F14)
+                                    if (_506F14_resting_stage)
                                     {
                                         Rest(_506F18_num_minutes_to_sleep);
                                         pParty->pPlayers[3].SetAsleep(false);
@@ -1014,7 +1014,7 @@
                                         pOutdoor->UpdateFog();
                                     }
                                     _506F18_num_minutes_to_sleep = 0;
-                                    dword_506F14 = 0;
+                                    _506F14_resting_stage = 0;
                                     if (pGUIWindow_Settings)
                                     {
                                         if (current_screen_type == SCREEN_CHARACTERS)
@@ -1832,13 +1832,7 @@
                                 *((int *)v67 + 17) = 1;
                             else
                                 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u);
-                            /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-                            {
-                            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-                            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0;
-                            *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-                            ++pMessageQueue_50CBD0->uNumMessages;
-                            }*/
+
                             pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
                             continue;
                         }
@@ -2104,7 +2098,7 @@
                 continue;
             case UIMSG_1C:
                 __debugbreak();
-                if (!uActiveCharacter || current_screen_type)
+                if (!uActiveCharacter || current_screen_type != SCREEN_GAME)
                     continue;
                 ptr_507BC8 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_68, uMessageParam, 0);
                 current_screen_type = SCREEN_19;
@@ -2149,7 +2143,7 @@
                 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]);// "Exit Rest"
                 continue;
             case UIMSG_Wait5Minutes:
-                if (dword_506F14 == 2)
+                if (_506F14_resting_stage == 2)
                 {
                     ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
                     pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
@@ -2157,11 +2151,11 @@
                 }
                 GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2,
                     (int)pButton_RestUI_Wait5Minutes, pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes"
-                dword_506F14 = 1;
+                _506F14_resting_stage = 1;
                 _506F18_num_minutes_to_sleep = 5;
                 continue;
             case UIMSG_Wait1Hour:
-                if (dword_506F14 == 2)
+                if (_506F14_resting_stage == 2)
                 {
                     ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
                     pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
@@ -2169,17 +2163,21 @@
                 }
                 GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2,
                     (int)pButton_RestUI_Wait1Hour, pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour"
-                dword_506F14 = 1;
+                _506F14_resting_stage = 1;
                 _506F18_num_minutes_to_sleep = 60;
                 continue;
             case UIMSG_RentRoom:
-                dword_506F14 = 2;
-                RestUI_Load();
+                _506F14_resting_stage = 2;
+
+                PrepareToLoadRestUI();
+                current_screen_type = SCREEN_REST;
+                pGUIWindow_CurrentMenu = RestUI_Load();
+
                 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute;
                 _506F18_num_minutes_to_sleep = v86;
                 if (uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116) // 107 = Emerald Isle tavern
                     _506F18_num_minutes_to_sleep = v86 + 12 * 60;
-                dword_506F14 = 2;
+                _506F14_resting_stage = 2;
                 pParty->RestAndHeal();
                 pParty->days_played_without_rest = 0;
                 pParty->pPlayers[3].SetAsleep(1);
@@ -2189,7 +2187,7 @@
                 continue;
             case UIMSG_RestWindow:
                 DoThatMessageThing();
-                if (current_screen_type)
+                if (current_screen_type != SCREEN_GAME)
                     continue;
                 if (CheckActors_proximity())
                 {
@@ -2214,7 +2212,9 @@
                 }
                 if (!(pParty->uFlags & 0x88))
                 {
-                    RestUI_Load();
+                    PrepareToLoadRestUI();
+                    current_screen_type = SCREEN_REST;
+                    pGUIWindow_CurrentMenu = RestUI_Load();
                     continue;
                 }
                 if (pParty->bTurnBasedModeOn == 1)
@@ -2225,13 +2225,13 @@
                 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!"
                 if (pParty->uFlags & 0x88)
                     v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
-                ShowStatusBarString(v88, 2u);
+                ShowStatusBarString(v88, 2);
                 if (!uActiveCharacter)
                     continue;
-                pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
+                pPlayers[uActiveCharacter]->PlaySound(SPEECH_CantRestHere, 0);
                 continue;
             case UIMSG_Rest8Hour:
-                if (dword_506F14)
+                if (_506F14_resting_stage != 0)
                 {
                     ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
                     pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
@@ -2239,9 +2239,9 @@
                 }
                 if (pParty->uNumFoodRations < uRestUI_FoodRequiredToRest)
                 {
-                    ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2u);// "You don't have enough food to rest"
+                    ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2);// "You don't have enough food to rest"
                     if (uActiveCharacter && pPlayers[uActiveCharacter]->CanAct())
-                        pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_108, 0);
+                        pPlayers[uActiveCharacter]->PlaySound(SPEECH_108, 0);
                 }
                 else
                 {
@@ -2271,14 +2271,8 @@
                             v95 = rand();
                             Rest(v95 % 6 + 60);
                             _506F18_num_minutes_to_sleep = 0;
-                            dword_506F14 = 0;
-                            /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-                            {
-                            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-                            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-                            *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-                            ++pMessageQueue_50CBD0->uNumMessages;
-                            }*/
+                            _506F14_resting_stage = 0;
+  
                             pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
                             ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!"
                             pAudioPlayer->PlaySound(SOUND_encounter, 0, 0, -1, 0, 0, 0, 0);
@@ -2287,7 +2281,7 @@
                     }
                     Party::TakeFood(uRestUI_FoodRequiredToRest);
                     _506F18_num_minutes_to_sleep = 480;
-                    dword_506F14 = 2;
+                    _506F14_resting_stage = 2;
                     pParty->RestAndHeal();
                     pParty->days_played_without_rest = 0;
                     pParty->pPlayers[3].SetAsleep(1);
@@ -2297,7 +2291,7 @@
                 }
                 continue;
             case UIMSG_AlreadyResting:
-                if (dword_506F14 == 2)
+                if (_506F14_resting_stage == 2)
                 {
                     ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
                     pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
@@ -2306,7 +2300,7 @@
                 GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2,
                     (int)pButton_RestUI_WaitUntilDawn, pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn"
                 v97 = _494820_training_time(pParty->uCurrentHour);
-                dword_506F14 = 1;
+                _506F14_resting_stage = 1;
                 _506F18_num_minutes_to_sleep = 60 * v97 - pParty->uCurrentMinute;
                 continue;
             case UIMSG_HintSelectRemoveQuickSpellBtn:
@@ -2515,7 +2509,7 @@
                     pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179);
                 continue;
             case UIMSG_GameMenuButton:
-                if (current_screen_type)
+                if (current_screen_type != SCREEN_GAME)
                 {
                     pGUIWindow_CurrentMenu->Release();
                     pEventTimer->Resume();
@@ -2770,9 +2764,8 @@
                     ++pMessageQueue_50CBD0->uNumMessages;
                     continue;
                     }*/
-                    continue;
                 }
-                if (pMessageQueue_50CBD0->pMessages[0].field_8)
+                else if (pMessageQueue_50CBD0->pMessages[0].field_8)
                 {
                     pMessageQueue_50CBD0->uNumMessages = 1;
                     pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0);
@@ -2783,20 +2776,22 @@
                     //goto LABEL_771;
                     *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
                     ++pMessageQueue_50CBD0->uNumMessages;*/
-                    continue;
                 }
-                v115 = 0;
-                pMessageQueue_50CBD0->uNumMessages = 0;
-                pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0);
-                /*if ( (signed int)v115 < 40 )
-                //goto LABEL_769;
+                else
                 {
-                pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen;
-                pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-                *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-                ++pMessageQueue_50CBD0->uNumMessages;
-                continue;
-                }*/
+                    v115 = 0;
+                    pMessageQueue_50CBD0->uNumMessages = 0;
+                    pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0);
+                    /*if ( (signed int)v115 < 40 )
+                    //goto LABEL_769;
+                    {
+                    pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen;
+                    pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
+                    *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
+                    ++pMessageQueue_50CBD0->uNumMessages;
+                    continue;
+                    }*/
+                }
                 continue;
             case UIMSG_MouseLeftClickInScreen://ñðàáàòûâàåò ïðè íàæàòèè íà ïðàâóþ êíîïêó ìûøè ïîñëå UIMSG_MouseLeftClickInGame
                 DoThatMessageThing();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Game/GameOver.cpp	Sun May 10 03:21:14 2015 +0200
@@ -0,0 +1,180 @@
+#include "Engine/Engine.h"
+#include "Engine/Timer.h"
+#include "Engine/texts.h"
+#include "Engine/Party.h"
+#include "Engine/LOD.h"
+#include "Engine/SaveLoad.h"
+#include "Engine/Graphics/IRender.h"
+#include "Engine/Graphics/Viewport.h"
+
+#include "IO/Mouse.h"
+#include "IO/Keyboard.h"
+
+#include "Media/Audio/AudioPlayer.h"
+
+#include "GUI/GUIWindow.h"
+#include "GUI/GUIButton.h"
+#include "GUI/GUIFont.h"
+#include "GUI/UI/UIPartyCreation.h"
+
+
+//----- (004BF91E) --------------------------------------------------------
+void GameOver_Loop(int v15)
+{
+    const char *v1; // eax@2
+    unsigned int result; // eax@3
+    const char *v6; // eax@10
+    const char *v7; // edx@10
+    const char *v8; // ecx@12
+    const char *v9; // eax@14
+    unsigned int v10; // eax@25
+    GUIWindow pWindow; // [sp+34h] [bp-9Ch]@1
+    unsigned int v14; // [sp+A4h] [bp-2Ch]@5
+    const char *pInString; // [sp+ACh] [bp-24h]@5
+    unsigned int v17; // [sp+B0h] [bp-20h]@5
+    unsigned int v18; // [sp+B4h] [bp-1Ch]@5
+    unsigned int v19; // [sp+B8h] [bp-18h]@5
+    int v20; // [sp+BCh] [bp-14h]@7
+    GUIFont *pFont; // [sp+C4h] [bp-Ch]@1
+    unsigned __int64 v23; // [sp+C8h] [bp-8h]@5
+    MSG msg;
+
+    RGBTexture _this; // [sp+Ch] [bp-C4h]@1
+    //RGBTexture::RGBTexture(&this);
+
+    dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_4000;
+    bGameoverLoop = true;
+    pMediaPlayer->bStopBeforeSchedule = 0;
+    pAudioPlayer->StopChannels(-1, -1);
+    pRenderer->BeginScene();
+    pRenderer->ClearBlack();
+    pRenderer->EndScene();
+    pRenderer->Present();
+    //pMediaPlayer->pResetflag = 0;
+    _449B57_test_bit(pParty->_quest_bits, 99);
+    _this.Load("winbg.pcx", 2);
+    pRenderer->BeginScene();
+    pRenderer->DrawTextureRGB(0, 0, &_this);
+    pRenderer->EndScene();
+    free(_this.pPixels);
+    _this.pPixels = 0;
+    window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0);
+    pWindow.uFrameX = 75;
+    pWindow.uFrameY = 60;
+    pWindow.uFrameWidth = 469;
+    pWindow.uFrameHeight = 338;
+    pWindow.uFrameZ = 543;
+    pWindow.uFrameW = 397;
+    pFont = LoadFont("endgame.fnt", "FONTPAL", NULL);
+    if (pParty->IsPartyGood())
+        v1 = pGlobalTXT_LocalizationStrings[675];//"Splendid job!  With the activation of the Gate, a thousand worlds lie at your feet.  Perhaps on one of them you will find the Ancients themselves, and return with the fruits their great civilization has to offer your world and your kingdom."
+    else if (pParty->IsPartyEvil())
+        v1 = pGlobalTXT_LocalizationStrings[676];//"Brilliant!  The completion of the Heavenly Forge has provided enough Ancient weapons to crush all resistance to your plans.  Soon the world will bow to your every whim!  Still, you can't help but wonder what was beyond the Gate the other side was trying so hard to build."
+    else return;
+    pInString = v1;
+    v23 = pParty->uTimePlayed - 138240;
+    v19 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24;
+    v14 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C / 0xC;
+    v18 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C % 0xC;
+    v17 = v19 % 0x1C;
+    if (!v19)
+        v19 = 1;
+    pRenderer->BeginScene();
+    pWindow.DrawTitleText(pFont, 1, 0x23, 1, pGlobalTXT_LocalizationStrings[9], 3);//Congratulations!
+    v23 = 0i64;
+    v20 = 0;
+    for (uint i = 0; i < 4; i++)
+    {
+        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[129], pParty->pPlayers[i].pName, pParty->pPlayers[i].GetBaseLevel(), pClassNames[pParty->pPlayers[i].classType]);//%s the Level %u %s
+        pWindow.DrawTitleText(pFont, 1, i * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46, 1, pTmpBuf.data(), 3);
+        v23 += pParty->pPlayers[i].uExperience;//__PAIR__(*(int *)(i - 4), *(int *)(i - 8));
+    }
+    v23 = (signed __int64)v23 / v19;
+    v6 = FitTextInAWindow(pInString, pFont, &pWindow, 0xC, 0);
+    pWindow.DrawTitleText(pFont, 1, 5 * (LOBYTE(pFont->uFontHeight) + 11), 1, v6, 0);
+    strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[37]);//Total Time:
+
+    v7 = pGlobalTXT_LocalizationStrings[56];
+    if (v17 != 1)
+        v7 = pGlobalTXT_LocalizationStrings[57];
+
+    v8 = pGlobalTXT_LocalizationStrings[146];//Month
+    if (v18 != 1)
+        v8 = pGlobalTXT_LocalizationStrings[148];//Months
+
+    v9 = pGlobalTXT_LocalizationStrings[245];
+    if (v14 != 1)
+        v9 = pGlobalTXT_LocalizationStrings[132];
+
+    sprintf(pTmpBuf2.data(), " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
+    strcat(pTmpBuf.data(), pTmpBuf2.data());
+    pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1, pTmpBuf.data(), 3);
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23);
+    pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight, 1, pTmpBuf.data(), 3);
+    dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
+    pRenderer->EndScene();
+    pRenderer->Present();
+    //if ( pRenderer->pRenderD3D )
+    pRenderer->pBeforePresentFunction();
+    pRenderer->SaveWinnersCertificate("MM7_Win.Pcx");
+    free(pFont);
+    window_SpeakInHouse->Release();
+    window_SpeakInHouse = 0;
+    if (v15 == 2)
+        result = pMessageQueue_50CBD0->uNumMessages;
+    else
+    {
+        LODWORD(v23) = GetTickCount() + 5000;
+        while ((unsigned int)v23 > GetTickCount())
+            ;
+        while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+        {
+            if (msg.message == WM_QUIT)
+                Engine_DeinitializeAndTerminate(0);
+            TranslateMessage(&msg);
+            DispatchMessage(&msg);
+        }
+        if (pMessageQueue_50CBD0->uNumMessages)
+        {
+            LOBYTE(v10) = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+            pMessageQueue_50CBD0->uNumMessages = v10;
+        }
+        pKeyActionMap->ResetKeys();
+        pKeyActionMap->uLastKeyPressed = 0;
+        do
+        {
+            while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+            {
+                if (msg.message == WM_QUIT)
+                    Engine_DeinitializeAndTerminate(0);
+                TranslateMessage(&msg);
+                DispatchMessage(&msg);
+            }
+        } while (!pKeyActionMap->uLastKeyPressed);
+        if (pMessageQueue_50CBD0->uNumMessages)
+        {
+            pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+        }
+    }
+    if (v15)
+    {
+        /*if ( (signed int)result < 40 )
+        {
+        pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit;
+        }*/
+        pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Quit, 1, 0);
+    }
+    else
+    {
+        pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ShowFinalWindow, 1, 0);
+        /*if ( (signed int)result < 40 )
+        {
+        pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5;
+        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
+        result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
+        *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
+        ++pMessageQueue_50CBD0->uNumMessages;
+        }*/
+    }
+    bGameoverLoop = false;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Game/GameOver.h	Sun May 10 03:21:14 2015 +0200
@@ -0,0 +1,3 @@
+#pragma once
+
+void GameOver_Loop(int);
\ No newline at end of file
--- a/Media/Audio/AudioPlayer.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/Media/Audio/AudioPlayer.cpp	Sun May 10 03:21:14 2015 +0200
@@ -1204,7 +1204,7 @@
   if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
     sub_4AAEA6_transform(&pRenderVertexSoft);
   else
-    pEngine->pIndoorCameraD3D->ViewTransform(&pRenderVertexSoft, 1);
+    pIndoorCameraD3D->ViewTransform(&pRenderVertexSoft, 1);
   if ( pid )
   {
     if ( pid != -1 )
@@ -1337,7 +1337,7 @@
 		  }
 //LABEL_103:
 		  if ( uCurrentlyLoadedLevelType != LEVEL_Indoor )
-            pEngine->pIndoorCameraD3D->ViewTransform(&pRenderVertexSoft, 1);
+            pIndoorCameraD3D->ViewTransform(&pRenderVertexSoft, 1);
 //LABEL_104:
           AIL_start_3D_sample(*(int *)v42);
           AIL_set_3D_sample_float_distances(*(int **)v42, 100.0, 20.0, 100.0, 20.0);
@@ -1501,11 +1501,11 @@
             a1.vWorldPosition.z = v13->vPosition.z;
             if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
             {
-              v16 = pEngine->pIndoorCameraD3D->fRotationXCosine;
-              v17 = pEngine->pIndoorCameraD3D->fRotationXSine;
-              v55 = pEngine->pIndoorCameraD3D->fRotationYCosine;
-              v56 = pEngine->pIndoorCameraD3D->fRotationYSine;
-              if (pEngine->pIndoorCameraD3D->sRotationX)
+              v16 = pIndoorCameraD3D->fRotationXCosine;
+              v17 = pIndoorCameraD3D->fRotationXSine;
+              v55 = pIndoorCameraD3D->fRotationYCosine;
+              v56 = pIndoorCameraD3D->fRotationYSine;
+              if (pIndoorCameraD3D->sRotationX)
               {
                 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
                 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
@@ -1543,7 +1543,7 @@
               }
             }
             else
-              pEngine->pIndoorCameraD3D->ViewTransform(&a1, 1);
+              pIndoorCameraD3D->ViewTransform(&a1, 1);
             v58 = a1.vWorldViewPosition.y * -0.012207031;
             v22 = a1.vWorldViewPosition.x * 0.012207031;
             *(float *)&uNumRepeats = v22;
@@ -1572,11 +1572,11 @@
             a1.vWorldPosition.z = v11;
             if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
             {
-              v16 = pEngine->pIndoorCameraD3D->fRotationXCosine;
-              v17 = pEngine->pIndoorCameraD3D->fRotationXSine;
-              v55 = pEngine->pIndoorCameraD3D->fRotationYCosine;
-              v56 = pEngine->pIndoorCameraD3D->fRotationYSine;
-              if (pEngine->pIndoorCameraD3D->sRotationX)
+              v16 = pIndoorCameraD3D->fRotationXCosine;
+              v17 = pIndoorCameraD3D->fRotationXSine;
+              v55 = pIndoorCameraD3D->fRotationYCosine;
+              v56 = pIndoorCameraD3D->fRotationYSine;
+              if (pIndoorCameraD3D->sRotationX)
               {
                 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
                 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
@@ -1614,7 +1614,7 @@
               }
             }
             else
-              pEngine->pIndoorCameraD3D->ViewTransform(&a1, 1);
+              pIndoorCameraD3D->ViewTransform(&a1, 1);
             v58 = a1.vWorldViewPosition.y * -0.012207031;
             v22 = a1.vWorldViewPosition.x * 0.012207031;
             *(float *)&uNumRepeats = v22;
@@ -1646,11 +1646,11 @@
         a1.vWorldPosition.z = v11;
         if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
         {
-          v16 = pEngine->pIndoorCameraD3D->fRotationXCosine;
-          v17 = pEngine->pIndoorCameraD3D->fRotationXSine;
-          v55 = pEngine->pIndoorCameraD3D->fRotationYCosine;
-          v56 = pEngine->pIndoorCameraD3D->fRotationYSine;
-          if (pEngine->pIndoorCameraD3D->sRotationX)
+          v16 = pIndoorCameraD3D->fRotationXCosine;
+          v17 = pIndoorCameraD3D->fRotationXSine;
+          v55 = pIndoorCameraD3D->fRotationYCosine;
+          v56 = pIndoorCameraD3D->fRotationYSine;
+          if (pIndoorCameraD3D->sRotationX)
           {
             v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
             *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
@@ -1688,7 +1688,7 @@
           }
         }
         else
-          pEngine->pIndoorCameraD3D->ViewTransform(&a1, 1);
+          pIndoorCameraD3D->ViewTransform(&a1, 1);
         v58 = a1.vWorldViewPosition.y * -0.012207031;
         v22 = a1.vWorldViewPosition.x * 0.012207031;
         *(float *)&uNumRepeats = v22;
@@ -1711,7 +1711,7 @@
       }
       if ( uCurrentlyLoadedLevelType != LEVEL_Indoor )//==1
       {
-        pEngine->pIndoorCameraD3D->ViewTransform(&a1, 1);
+        pIndoorCameraD3D->ViewTransform(&a1, 1);
         v58 = a1.vWorldViewPosition.y * -0.012207031;
         v22 = a1.vWorldViewPosition.x * 0.012207031;
         *(float *)&uNumRepeats = v22;
@@ -1744,11 +1744,11 @@
         a1.vWorldPosition.z = v11;
         if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
         {
-          v16 = pEngine->pIndoorCameraD3D->fRotationXCosine;
-          v17 = pEngine->pIndoorCameraD3D->fRotationXSine;
-          v55 = pEngine->pIndoorCameraD3D->fRotationYCosine;
-          v56 = pEngine->pIndoorCameraD3D->fRotationYSine;
-          if (pEngine->pIndoorCameraD3D->sRotationX)
+          v16 = pIndoorCameraD3D->fRotationXCosine;
+          v17 = pIndoorCameraD3D->fRotationXSine;
+          v55 = pIndoorCameraD3D->fRotationYCosine;
+          v56 = pIndoorCameraD3D->fRotationYSine;
+          if (pIndoorCameraD3D->sRotationX)
           {
             v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
             *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
@@ -1786,7 +1786,7 @@
           }
         }
         else
-          pEngine->pIndoorCameraD3D->ViewTransform(&a1, 1);
+          pIndoorCameraD3D->ViewTransform(&a1, 1);
         v58 = a1.vWorldViewPosition.y * -0.012207031;
         v22 = a1.vWorldViewPosition.x * 0.012207031;
         *(float *)&uNumRepeats = v22;
--- a/OSWindow.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/OSWindow.cpp	Sun May 10 03:21:14 2015 +0200
@@ -64,7 +64,7 @@
   pMouse->SetMouseClick(x, y);
 
   if (pEngine)
-    pEngine->PickMouse(pEngine->pIndoorCameraD3D->GetPickDepth(), x, y, 0, &vis_sprite_filter_2, &vis_door_filter);
+    pEngine->PickMouse(pIndoorCameraD3D->GetPickDepth(), x, y, 0, &vis_sprite_filter_2, &vis_door_filter);
 
   UI_OnMouseRightClick(0);
   return true;
@@ -191,7 +191,7 @@
     /*case WM_MBUTTONDOWN:
       if (pRenderer->pRenderD3D && pEngine)
       {
-        pEngine->PickMouse(pEngine->pIndoorCameraD3D->GetPickDepth(), LOWORD(lParam), HIWORD(lParam), 1, &vis_sprite_filter_3, &vis_face_filter);
+        pEngine->PickMouse(pIndoorCameraD3D->GetPickDepth(), LOWORD(lParam), HIWORD(lParam), 1, &vis_sprite_filter_3, &vis_face_filter);
       }
       return false;*/
 
--- a/_deleted.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/_deleted.cpp	Sun May 10 03:21:14 2015 +0200
@@ -1185,8 +1185,8 @@
   v28 = v3->sTextureDeltaU << 16;
   v35 = v3->sTextureDeltaV << 16;
   v10 = v2->field_8;
-  v29 = pEngine->pIndoorCameraD3D->int_sine_y;
-  v32 = pEngine->pIndoorCameraD3D->int_cosine_y;
+  v29 = pIndoorCameraD3D->int_sine_y;
+  v32 = pIndoorCameraD3D->int_cosine_y;
   a1.field_28 = v2->field_C;
   v11 = v3->field_24;
   v37 = pODMRenderParams->int_fov_rad_inv * (pViewport->uScreenCenterX - v10);
@@ -1437,7 +1437,7 @@
             *((float *)v9 - 1) = v11;
             if ( *(float *)&v84 == v11 )
               ++v82;
-            pEngine->pIndoorCameraD3D->ViewTransform((RenderVertexSoft *)(v9 - 12), 1u);
+            pIndoorCameraD3D->ViewTransform((RenderVertexSoft *)(v9 - 12), 1u);
             if ( *(float *)v9 < 8.0 || (double)pODMRenderParams->shading_dist_mist < *(float *)v9 )
             {
               if ( *(float *)v9 >= 8.0 )
@@ -1447,7 +1447,7 @@
             }
             else
             {
-              pEngine->pIndoorCameraD3D->Project((RenderVertexSoft *)(v9 - 12), 1u, 0);
+              pIndoorCameraD3D->Project((RenderVertexSoft *)(v9 - 12), 1u, 0);
             }
             v81 += 2;
             v9 += 48;
@@ -2334,8 +2334,8 @@
     v8 = v3->ptr_38;
     v42 = ((unsigned __int64)(v3->ptr_38->field_14 * (signed __int64)v7) >> 16) + v8->field_C;
     v40 = ((unsigned __int64)(v8->field_20 * (signed __int64)v7) >> 16) + v3->ptr_38->field_18;
-    v38 = pEngine->pIndoorCameraD3D->int_sine_y;
-    HIDWORD(v35) = pEngine->pIndoorCameraD3D->int_cosine_y;
+    v38 = pIndoorCameraD3D->int_sine_y;
+    HIDWORD(v35) = pIndoorCameraD3D->int_cosine_y;
     v45 = v4->field_C;
     v9 = ((unsigned __int64)(v3->v_18.z * (signed __int64)v7) >> 16) + v3->v_18.x;
     v10 = 65536 / SLODWORD(v35) * (pViewport->uScreenCenterX - v4->field_8);
@@ -8796,78 +8796,78 @@
   stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22;
   if ( pBLVRenderParams->sPartyRotX )
   {
-    v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
-    v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16) - v74;
-    X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16;
-    stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16) - X;
+    v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - v74;
+    X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
+    stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16) - X;
     stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16)
+                                                     * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
                                  + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16)
+                                                     * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
                                  + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16);
-    v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
-    v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16) - v70;
-    v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16;
-    stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16) - v70;
-    stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16);
-    v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
-    v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16) - v70;
-    X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
-    v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16;
-    v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16;
-    stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16) - v70;
-    stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16);
-    v74 = pEngine->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y
-        - pEngine->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x;
-    v11 = -(pEngine->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y
-          + pEngine->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x);
+                                                     * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
+    v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - v70;
+    v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
+    stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16) - v70;
+    stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
+                         + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
+    v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16) - v70;
+    X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16;
+    v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
+    stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16) - v70;
+    stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
+                         + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
+    v74 = pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y
+        - pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x;
+    v11 = -(pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y
+          + pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x);
     v73 = -65536 * pBLVRenderParams->vPartyPos.z;
-    v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16;
-    v12 = ((unsigned __int64)(v74 * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16) - v70;
-    v69 = (unsigned __int64)(v74 * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16;
+    v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
+    v12 = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16) - v70;
+    v69 = (unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16;
     v13 = pBLVRenderParams->vPartyPos.y;
-    v70 = ((unsigned __int64)(v74 * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16)
-        + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16);
+    v70 = ((unsigned __int64)(v74 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
+        + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
     v14 = pBLVRenderParams->vPartyPos.x;
   }
   else
   {
-    v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
+    v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
     stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16)
+                                                     * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
                                  - v70;
     stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z;
     stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16)
+                                                     * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
                                  + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
-    v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
-    stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16)
+                                                     * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
                          - v70;
     stru_F8AD28.field_6C = stru_F8AD28.vec_14.z;
-    stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
-    v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
-    stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16)
+    stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
+    stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
                          - v70;
-    v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
+    v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16;
     v14 = pBLVRenderParams->vPartyPos.x;
     stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z;
     v13 = pBLVRenderParams->vPartyPos.y;
-    stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
-    v12 = pEngine->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y
-        - pEngine->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x;
-    v11 = -(pEngine->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y
-          + pEngine->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x);
+    stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    v12 = pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y
+        - pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x;
+    v11 = -(pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y
+          + pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x);
     v70 = -65536 * pBLVRenderParams->vPartyPos.z;
   }
   stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x;
@@ -9222,74 +9222,74 @@
   stru_F8AD28.uDefaultAmbientLightLevel = 0;
   if ( pBLVRenderParams->sPartyRotX )
   {
-    v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16)
-       - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16);
-    stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16)
+    v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+       - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
+    stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
                                  - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16);
+                                                     * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16);
     stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16)
+                                                     * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
                                  + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16)
+                                                     * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
                                  + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16);
-    v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16)
-       - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16);
-    stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16)
-                         - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16);
-    stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16);
-    v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16)
-       - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16);
-    stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16)
-                         - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16);
-    stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16);
-    v3 = -(pEngine->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y
-         + pEngine->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x);
-    v4 = pEngine->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y
-       - pEngine->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x;
-    v5 = ((unsigned __int64)(v4 * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16)
-       - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16);
+                                                     * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
+    v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+       - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
+    stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
+                         - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16);
+    stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
+                         + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
+    v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+       - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
+    stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
+                         - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16);
+    stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16)
+                         + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16);
+    v3 = -(pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y
+         + pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x);
+    v4 = pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y
+       - pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x;
+    v5 = ((unsigned __int64)(v4 * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
+       - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16);
     v6 = pBLVRenderParams->vPartyPos.z;
-    v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_x) >> 16)
-       + ((unsigned __int64)(v4 * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_x) >> 16);
+    v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pIndoorCameraD3D->int_cosine_x) >> 16)
+       + ((unsigned __int64)(v4 * (signed __int64)pIndoorCameraD3D->int_sine_x) >> 16);
     v8 = pBLVRenderParams->vPartyPos.y;
     v9 = pBLVRenderParams->vPartyPos.x;
   }
   else
   {
     stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16)
+                                                     * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
                                  - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16);
+                                                     * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
     stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z;
     stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16)
+                                                     * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
                                  + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
-                                                     * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16)
-                         - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16);
+                                                     * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+                         - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
     stru_F8AD28.field_6C = stru_F8AD28.vec_14.z;
-    stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
-    stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16)
-                         - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16);
+    stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
+    stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16)
+                         - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16);
     v8 = pBLVRenderParams->vPartyPos.y;
-    stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pEngine->pIndoorCameraD3D->int_sine_y) >> 16)
-                         + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16);
+    stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pIndoorCameraD3D->int_sine_y) >> 16)
+                         + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16);
     stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z;
     v9 = pBLVRenderParams->vPartyPos.x;
-    v5 = pEngine->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y
-       - pEngine->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x;
+    v5 = pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.y
+       - pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.x;
     v6 = pBLVRenderParams->vPartyPos.z;
-    v3 = -(pEngine->pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y
-         + pEngine->pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x);
+    v3 = -(pIndoorCameraD3D->int_cosine_y * pBLVRenderParams->vPartyPos.y
+         + pIndoorCameraD3D->int_sine_y * pBLVRenderParams->vPartyPos.x);
     v7 = -65536 * pBLVRenderParams->vPartyPos.z;
   }
   stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x;
@@ -9475,8 +9475,8 @@
               v45 = v14->field_4 >> 3;
               v44 = v16 >> 3;
               v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3;
-              v52 = (unsigned __int64)(v17 * (signed __int64)-pEngine->pIndoorCameraD3D->int_sine_y) >> 16;
-              v53 = (unsigned __int64)(v17 * (signed __int64)pEngine->pIndoorCameraD3D->int_cosine_y) >> 16;
+              v52 = (unsigned __int64)(v17 * (signed __int64)-pIndoorCameraD3D->int_sine_y) >> 16;
+              v53 = (unsigned __int64)(v17 * (signed __int64)pIndoorCameraD3D->int_cosine_y) >> 16;
               v18 = v14->field_28;
               v19 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13);
               LOWORD(v18) = 0;
@@ -11817,10 +11817,10 @@
 //----- (0048600E) --------------------------------------------------------
 void ODMRenderParams::RotationToInts()
 {
-  camera_rotation_y_int_sine   = stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationY);
-  camera_rotation_y_int_cosine = stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationY);
-  camera_rotation_x_int_sine   = stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationX);
-  camera_rotation_x_int_cosine = stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationX);
+  camera_rotation_y_int_sine   = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationY);
+  camera_rotation_y_int_cosine = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationY);
+  camera_rotation_x_int_sine   = stru_5C6E00->Sin(pIndoorCameraD3D->sRotationX);
+  camera_rotation_x_int_cosine = stru_5C6E00->Cos(pIndoorCameraD3D->sRotationX);
 }
 //----- (004A169E) --------------------------------------------------------
 bool Render::UsingDirect3D()
@@ -12347,7 +12347,7 @@
 
       if (pEngine)
       {
-        pEngine->PickMouse(pEngine->pIndoorCameraD3D->GetPickDepth(), LOWORD(lParam), HIWORD(lParam), 0, &vis_sprite_filter_2, &vis_door_filter);
+        pEngine->PickMouse(pIndoorCameraD3D->GetPickDepth(), LOWORD(lParam), HIWORD(lParam), 0, &vis_sprite_filter_2, &vis_door_filter);
       }
 
       UI_OnMouseRightClick(0);
@@ -12411,7 +12411,7 @@
       pMouse->SetMouseClick(LOWORD(lParam), HIWORD(lParam));
 
       if (pEngine)
-        pEngine->PickMouse(pEngine->pIndoorCameraD3D->GetPickDepth(), LOWORD(lParam), HIWORD(lParam), false, &vis_sprite_filter_2, &vis_door_filter);
+        pEngine->PickMouse(pIndoorCameraD3D->GetPickDepth(), LOWORD(lParam), HIWORD(lParam), false, &vis_sprite_filter_2, &vis_door_filter);
 
       UI_OnMouseRightClick(0);
       return DefWindowProcW(hWnd, uMsg, wParam, lParam);
@@ -12420,7 +12420,7 @@
     case WM_MBUTTONDOWN:
       if (pRenderer->pRenderD3D && pEngine)
       {
-        pEngine->PickMouse(pEngine->pIndoorCameraD3D->GetPickDepth(), LOWORD(lParam), HIWORD(lParam), 1, &vis_sprite_filter_3, &vis_face_filter);
+        pEngine->PickMouse(pIndoorCameraD3D->GetPickDepth(), LOWORD(lParam), HIWORD(lParam), 1, &vis_sprite_filter_3, &vis_face_filter);
       }
 
       return DefWindowProcW(hWnd, uMsg, wParam, lParam);
@@ -13104,16 +13104,16 @@
     if ( uFaceID == *((short *)v5 + 2982) )
       return;
     if (!node_id
-      && pEngine->pIndoorCameraD3D->vPartyPos.x >= v4->pBounding.x1 - 16
-      && pEngine->pIndoorCameraD3D->vPartyPos.x <= v4->pBounding.x2 + 16
-      && pEngine->pIndoorCameraD3D->vPartyPos.y >= v4->pBounding.y1 - 16
-      && pEngine->pIndoorCameraD3D->vPartyPos.y <= v4->pBounding.y2 + 16
-      && pEngine->pIndoorCameraD3D->vPartyPos.z >= v4->pBounding.z1 - 16
-      && pEngine->pIndoorCameraD3D->vPartyPos.z <= v4->pBounding.z2 + 16 )
-    {
-      if ( abs(v4->pFacePlane_old.dist + pEngine->pIndoorCameraD3D->vPartyPos.x * v4->pFacePlane_old.vNormal.x
-                                       + pEngine->pIndoorCameraD3D->vPartyPos.y * v4->pFacePlane_old.vNormal.y
-                                       + pEngine->pIndoorCameraD3D->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 )
+      && pIndoorCameraD3D->vPartyPos.x >= v4->pBounding.x1 - 16
+      && pIndoorCameraD3D->vPartyPos.x <= v4->pBounding.x2 + 16
+      && pIndoorCameraD3D->vPartyPos.y >= v4->pBounding.y1 - 16
+      && pIndoorCameraD3D->vPartyPos.y <= v4->pBounding.y2 + 16
+      && pIndoorCameraD3D->vPartyPos.z >= v4->pBounding.z1 - 16
+      && pIndoorCameraD3D->vPartyPos.z <= v4->pBounding.z2 + 16 )
+    {
+      if ( abs(v4->pFacePlane_old.dist + pIndoorCameraD3D->vPartyPos.x * v4->pFacePlane_old.vNormal.x
+                                       + pIndoorCameraD3D->vPartyPos.y * v4->pFacePlane_old.vNormal.y
+                                       + pIndoorCameraD3D->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 )
       {
         v6 = v21->uSectorID;
         if ( v3->nodes[0].uSectorID == v6 )
@@ -13136,9 +13136,9 @@
       v5 = v20;
     }
     v8 = &pIndoor->pVertices[*v4->pVertexIDs];
-    v9 = v4->pFacePlane_old.vNormal.x * (v8->x - pEngine->pIndoorCameraD3D->vPartyPos.x)
-       + v4->pFacePlane_old.vNormal.y * (v8->y - pEngine->pIndoorCameraD3D->vPartyPos.y)
-       + v4->pFacePlane_old.vNormal.z * (v8->z - pEngine->pIndoorCameraD3D->vPartyPos.z);
+    v9 = v4->pFacePlane_old.vNormal.x * (v8->x - pIndoorCameraD3D->vPartyPos.x)
+       + v4->pFacePlane_old.vNormal.y * (v8->y - pIndoorCameraD3D->vPartyPos.y)
+       + v4->pFacePlane_old.vNormal.z * (v8->z - pIndoorCameraD3D->vPartyPos.z);
     if ( *((short *)v5 + 2004) != v4->uSectorID )
       v9 = -v9;
     if ( v9 < 0 )
@@ -13399,8 +13399,8 @@
   int v125; // [sp+6Ch] [bp-8h]@9
   int v126; // [sp+70h] [bp-4h]@9
 
-  v105 = pEngine->pIndoorCameraD3D->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2);//2
-  pDirectionIndicator1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pEngine->pIndoorCameraD3D->sRotationY);//1536
+  v105 = pIndoorCameraD3D->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2);//2
+  pDirectionIndicator1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCameraD3D->sRotationY);//1536
   pDirectionIndicator2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1);//512
   v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16;//88
   v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16;// 66
@@ -13959,7 +13959,7 @@
       if ( terrain_76D7C8[i] <= 0 )
         terrain_76D7C8[i] = -terrain_76D7C8[i];
       uEndZ = terrain_76D7C8[i] + 2;
-      //pIndoorCameraD3D_3 = pEngine->pIndoorCameraD3D;
+      //pIndoorCameraD3D_3 = pIndoorCameraD3D;
       //uEndZ = v75;
       //pIndoorCameraD3D_4 = pIndoorCameraD3D_3;
       uStartZ = terrain_76DBC8[i] - 2;
@@ -14023,7 +14023,7 @@
       //v90 = terrain_76D5C8[i];
       if ( terrain_76D5C8[i] <= 0 )
         terrain_76D5C8[i] = -terrain_76D5C8[i];
-      pIndoorCameraD3D_4 = pEngine->pIndoorCameraD3D;
+      pIndoorCameraD3D_4 = pIndoorCameraD3D;
       v107 = terrain_76D5C8[i] + 2;
       if ( terrain_76D9C8[i] - 2 < terrain_76D5C8[i] + 2 )
       {
@@ -14313,8 +14313,8 @@
           a5 = 4;
           if ( byte_4D864C && pEngine->uFlags & 0x80 )
           {
-            thisa = pEngine->pIndoorCameraD3D;
-            if ( pEngine->pIndoorCameraD3D->_4371C3(array_50AC10, &a5, 0) == 1 && !a5 )
+            thisa = pIndoorCameraD3D;
+            if ( pIndoorCameraD3D->_4371C3(array_50AC10, &a5, 0) == 1 && !a5 )
               goto LABEL_162;
             thisa->ViewTransform(array_50AC10, a5);
             thisa->Project(array_50AC10, a5, 0);
@@ -14454,8 +14454,8 @@
       uNumVertices = 3;
       if ( byte_4D864C && pEngine->uFlags & 0x80 )
       {
-        thisb = pEngine->pIndoorCameraD3D;
-        if ( pEngine->pIndoorCameraD3D->_4371C3(array_50AC10, &uNumVertices, 0) == 1 && !uNumVertices )
+        thisb = pIndoorCameraD3D;
+        if ( pIndoorCameraD3D->_4371C3(array_50AC10, &uNumVertices, 0) == 1 && !uNumVertices )
         {
 //LABEL_77:
           --pODMRenderParams->uNumPolygons;
@@ -14577,8 +14577,8 @@
       v100 = 3;
       if ( byte_4D864C && pEngine->uFlags & 0x80 )
       {
-        thisc = pEngine->pIndoorCameraD3D;
-        if ( pEngine->pIndoorCameraD3D->_4371C3(array_50AC10, (unsigned int *)&v100, 0) == 1 && !v100 )
+        thisc = pIndoorCameraD3D;
+        if ( pIndoorCameraD3D->_4371C3(array_50AC10, (unsigned int *)&v100, 0) == 1 && !v100 )
           //goto LABEL_126;
         {
           --pODMRenderParams->uNumPolygons;
--- a/stru6.cpp	Sun May 10 02:04:52 2015 +0200
+++ b/stru6.cpp	Sun May 10 03:21:14 2015 +0200
@@ -221,19 +221,19 @@
     v[1].vWorldPosition.x = p->dstX;
     v[1].vWorldPosition.y = p->dstY;
     v[1].vWorldPosition.z = p->dstZ;
-    pEngine->pIndoorCameraD3D->ViewTransform(v, 2);
+    pIndoorCameraD3D->ViewTransform(v, 2);
 
     sr_42620A(v);
 
-    pEngine->pIndoorCameraD3D->Project(v, 2, 0);
+    pIndoorCameraD3D->Project(v, 2, 0);
 
     if (p->uTextureID != -1)
       v12 = pBitmaps_LOD->pHardwareTextures[p->uTextureID];
     else
       v12 = 0;
 
-    v10 = pEngine->pIndoorCameraD3D->fov_x / v[1].vWorldViewPosition.x * 20.0;
-    v11 = pEngine->pIndoorCameraD3D->fov_x / v[0].vWorldViewPosition.x * 20.0;
+    v10 = pIndoorCameraD3D->fov_x / v[1].vWorldViewPosition.x * 20.0;
+    v11 = pIndoorCameraD3D->fov_x / v[0].vWorldViewPosition.x * 20.0;
     pRenderer->DrawProjectile(
         v[0].vWorldViewProjX,
         v[0].vWorldViewProjY,
@@ -1954,14 +1954,14 @@
 				v4 = *(float *)(v3 - 4);
 				LODWORD(v37) = *(int *)v3;
 				LODWORD(v36) = *(int *)(v3 + 4);
-				if (pEngine->pIndoorCameraD3D->sRotationX)
+				if (pIndoorCameraD3D->sRotationX)
 				{
-					v5 = v4 - (double)pEngine->pIndoorCameraD3D->vPartyPos.x;
-					v6 = v37 - (double)pEngine->pIndoorCameraD3D->vPartyPos.y;
+					v5 = v4 - (double)pIndoorCameraD3D->vPartyPos.x;
+					v6 = v37 - (double)pIndoorCameraD3D->vPartyPos.y;
 					//if ( pRenderer->pRenderD3D )
 					//{
-					v41 = pEngine->pIndoorCameraD3D->fRotationYSine * v6 + pEngine->pIndoorCameraD3D->fRotationYCosine * v5;
-					v7 = pEngine->pIndoorCameraD3D->fRotationYSine * v5 - pEngine->pIndoorCameraD3D->fRotationYCosine * v6;
+					v41 = pIndoorCameraD3D->fRotationYSine * v6 + pIndoorCameraD3D->fRotationYCosine * v5;
+					v7 = pIndoorCameraD3D->fRotationYSine * v5 - pIndoorCameraD3D->fRotationYCosine * v6;
 					/*}
 					else
 					{
@@ -1969,26 +1969,26 @@
 					v7 = pBLVRenderParams->fSineY * v5 + pBLVRenderParams->fCosineY * v6;
 					}*/
 					v8 = v7;
-					v9 = v36 - (double)pEngine->pIndoorCameraD3D->vPartyPos.z;
-					v10 = pEngine->pIndoorCameraD3D->fRotationXCosine * v41 - pEngine->pIndoorCameraD3D->fRotationXSine * v9;
+					v9 = v36 - (double)pIndoorCameraD3D->vPartyPos.z;
+					v10 = pIndoorCameraD3D->fRotationXCosine * v41 - pIndoorCameraD3D->fRotationXSine * v9;
 					v11 = v8;
-					v12 = pEngine->pIndoorCameraD3D->fRotationXCosine * v9 + pEngine->pIndoorCameraD3D->fRotationXSine * v41;
+					v12 = pIndoorCameraD3D->fRotationXCosine * v9 + pIndoorCameraD3D->fRotationXSine * v41;
 				}
 				else
 				{
-					v42 = v4 - (double)pEngine->pIndoorCameraD3D->vPartyPos.x;
-					v39 = v37 - (double)pEngine->pIndoorCameraD3D->vPartyPos.y;
+					v42 = v4 - (double)pIndoorCameraD3D->vPartyPos.x;
+					v39 = v37 - (double)pIndoorCameraD3D->vPartyPos.y;
 					//if ( pRenderer->pRenderD3D )
 					//{
-					v10 = pEngine->pIndoorCameraD3D->fRotationYSine * v39 + pEngine->pIndoorCameraD3D->fRotationYCosine * v42;
-					v11 = pEngine->pIndoorCameraD3D->fRotationYSine * v42 - pEngine->pIndoorCameraD3D->fRotationYCosine * v39;
+					v10 = pIndoorCameraD3D->fRotationYSine * v39 + pIndoorCameraD3D->fRotationYCosine * v42;
+					v11 = pIndoorCameraD3D->fRotationYSine * v42 - pIndoorCameraD3D->fRotationYCosine * v39;
 					/*}
 					else
 					{
 					v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39;
 					v11 = pBLVRenderParams->fSineY * v42 + pBLVRenderParams->fCosineY * v39;
 					}*/
-					v12 = v36 - (double)pEngine->pIndoorCameraD3D->vPartyPos.z;
+					v12 = v36 - (double)pIndoorCameraD3D->vPartyPos.z;
 				}
 				v13 = v12;
 				//++v2;
@@ -2008,29 +2008,29 @@
 		//do
 		for (v31 = 3; v31; --v31)
 		{
-			v40 = (double)stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationX) * 0.0000152587890625;
-			v32 = (double)stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationX) * 0.0000152587890625;
-			v34 = (double)stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationY) * 0.0000152587890625;
-			v33 = (double)stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationY) * 0.0000152587890625;
+			v40 = (double)stru_5C6E00->Cos(pIndoorCameraD3D->sRotationX) * 0.0000152587890625;
+			v32 = (double)stru_5C6E00->Sin(pIndoorCameraD3D->sRotationX) * 0.0000152587890625;
+			v34 = (double)stru_5C6E00->Cos(pIndoorCameraD3D->sRotationY) * 0.0000152587890625;
+			v33 = (double)stru_5C6E00->Sin(pIndoorCameraD3D->sRotationY) * 0.0000152587890625;
 			//v16 = stru_5C6E00->Sin(pODMRenderParams->rotation_y);
 			LODWORD(v38) = *(int *)v15;
 			//UNDEF(v17);
-			v20 = *((float *)v15 - 1) - (double)pEngine->pIndoorCameraD3D->vPartyPos.x;
+			v20 = *((float *)v15 - 1) - (double)pIndoorCameraD3D->vPartyPos.x;
 			//if ( v19 | v18 )
-			if (pEngine->pIndoorCameraD3D->vPartyPos.x == 0)
+			if (pIndoorCameraD3D->vPartyPos.x == 0)
 			{
 				v27 = v20;
 				LODWORD(v35) = *((int *)v15 + 1);
-				v28 = v38 - (double)pEngine->pIndoorCameraD3D->vPartyPos.y;
+				v28 = v38 - (double)pIndoorCameraD3D->vPartyPos.y;
 				v25 = v33 * v28 + v34 * v27;
 				v26 = v34 * v28 - v33 * v27;
 			}
 			else
 			{
 				v21 = v20;
-				v22 = v38 - (double)pEngine->pIndoorCameraD3D->vPartyPos.y;
+				v22 = v38 - (double)pIndoorCameraD3D->vPartyPos.y;
 				v23 = v33 * v22 + v34 * v21;
-				v24 = *((float *)v15 + 1) - (double)pEngine->pIndoorCameraD3D->vPartyPos.z;
+				v24 = *((float *)v15 + 1) - (double)pIndoorCameraD3D->vPartyPos.z;
 				v25 = v32 * v24 + v40 * v23;
 				v26 = v34 * v22 - v33 * v21;
 				v35 = v40 * v24 - v32 * v23;
@@ -2125,7 +2125,7 @@
 			v6 = (double)pBLVRenderParams->fov_rad_fixpoint * 0.000015258789 / this->field_B4[i * 4];
 			//if ( pRenderer->pRenderD3D )
 			{
-				pEngine->pIndoorCameraD3D->Project(round_to_int(this->field_B4[i * 4]), round_to_int(this->field_B4[i * 4 + 1]), round_to_int(this->field_B4[i * 4 + 2]),
+				pIndoorCameraD3D->Project(round_to_int(this->field_B4[i * 4]), round_to_int(this->field_B4[i * 4 + 1]), round_to_int(this->field_B4[i * 4 + 2]),
 					&a5, &a6);
 				this->field_B4[i * 4 + 16] = (double)a5;
 				this->field_B4[i * 4 + 17] = (double)a6;