changeset 2154:9bd7522cdbbb

Render decoupling. Unsorted variables cleaning.
author Nomad
date Thu, 09 Jan 2014 14:36:48 +0200
parents d28d3c006077
children 0a1438c16c2b
files Actor.cpp Arcomage.cpp AudioPlayer.cpp CastSpellInfo.cpp Game.cpp GammaControl.cpp GammaControl.h Indoor.cpp IndoorCameraD3D.cpp Indoor_stuff.h Keyboard.cpp LOD.cpp LOD.h Level/Decoration.h LightmapBuilder.cpp Mouse.cpp OSWindow.cpp Outdoor.cpp Overlays.cpp ParticleEngine.cpp Party.cpp Player.cpp Render.cpp Render.h SaveLoad.cpp UI/UICharacter.cpp UI/UIOptions.cpp UI/UIPopup.cpp VideoPlayer.cpp Viewport.cpp _deleted.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_data.cpp mm7_data.h mm7_unsorted_subs.h stru6.cpp stru6.h
diffstat 39 files changed, 861 insertions(+), 1221 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/Actor.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -41,7 +41,7 @@
 stru319 stru_50C198; // idb
 
 
-std::array<uint, 5> dword_4DF380_hostilityRanges = {0,1024,2560,5120,10240};
+std::array<uint, 5> _4DF380_hostilityRanges = {0, 1024, 2560, 5120, 10240};
 
 
 
@@ -2467,7 +2467,7 @@
 		}
 		if ( thisActor->pMonsterInfo.uHostilityType )
 		  v10 = pMonsterStats->pInfos[thisActor->pMonsterInfo.uID].uHostilityType;
-		v11 = dword_4DF380_hostilityRanges[v10];
+		v11 = _4DF380_hostilityRanges[v10];
 		v23 = abs(thisActor->vPosition.x - actor->vPosition.x);
 		v27 = abs(thisActor->vPosition.y - actor->vPosition.y);
 		v12 = abs(thisActor->vPosition.z - actor->vPosition.z);
@@ -2499,9 +2499,9 @@
     if ( v14 != 0 )
     {
       if ( !thisActor->pMonsterInfo.uHostilityType )
-        v15 = dword_4DF380_hostilityRanges[v14];
+        v15 = _4DF380_hostilityRanges[v14];
       else
-        v15 = dword_4DF380_hostilityRanges[4];
+        v15 = _4DF380_hostilityRanges[4];
       v16 = abs(thisActor->vPosition.x - pParty->vPosition.x);
       v28 = abs(thisActor->vPosition.y - pParty->vPosition.y);
       v17 = abs(thisActor->vPosition.z - pParty->vPosition.z);
@@ -3851,7 +3851,7 @@
   {
     if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 )
     {
-      if ( pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
+      if ( /*pRenderer->pRenderD3D &&*/ pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
       {
         v33 = byte_4D864C && pGame->uFlags & 0x80000 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius;
         pDecalBuilder->AddBloodsplat((float)pMonster->vPosition.x, (float)pMonster->vPosition.y, (float)pMonster->vPosition.z, 1.0, 0.0, 0.0, (float)v33, 0, 0);
--- a/Arcomage.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/Arcomage.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -53,10 +53,8 @@
 void GameResultsApply();
 
 void am_DrawText(int a1, const char *pText, POINT *pXY);
-void  am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb
-void __fastcall Blt_Chroma(RECT  *pSrcXYZW, POINT *pTargetXY, int a3, int a4);
-void  Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3);
-void  am_EndScene();
+void am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb
+void am_EndScene();
 void DrawRect(RECT *pXYZW, unsigned __int16 uColor, char bSolidFill);
 void DrawSquare( POINT *pTargetXY, unsigned __int16 uColor );
 void DrawPixel(POINT *pTargetXY, unsigned __int16 uColor);
@@ -171,6 +169,7 @@
 bool am_gameover; // 004FAA2C
 char byte_4FAA2D; // weak
 
+int am_default_starting_player = 0; // 505890
 int current_player_num; // 004FAA6C
 char need_to_discard_card; // 04FAA77
 
@@ -466,7 +465,7 @@
 
   pRenderer->BeginScene();
   pArcomageGame->pBlit_Copy_pixels = pPixels;
-  Blt_Copy(&pSrcRect, &pTargetPoint, 2);
+  pRenderer->am_Blt_Copy(&pSrcRect, &pTargetPoint, 2);
   pRenderer->EndScene();
   pArcomageGame->pBlit_Copy_pixels = 0;
 }
@@ -616,7 +615,7 @@
 }
 
 //----- (0040D7EC) --------------------------------------------------------
-void __fastcall Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode)
+void Render::am_Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode)
 {
 
 unsigned __int16 *pSrc; // eax@2
@@ -630,7 +629,7 @@
 int uSrcPitch; // [sp+1Ch] [bp-8h]@5
 
 
-if ( !pRenderer->uNumSceneBegins )
+if ( !uNumSceneBegins )
     return;
 if ( !pArcomageGame->pBlit_Copy_pixels )
     return;
@@ -655,8 +654,8 @@
 uSrcPitch = uSrcTotalWidth;
 
 src_surf_pos = &pSrc[pSrcRect->left + uSrcPitch * pSrcRect->top];
-v10 = 0xFFu >> (8 - (unsigned __int8)pRenderer->uTargetBBits);
-v21 = (pRenderer->uTargetGBits != 6 ? 0x31EF : 0x7BEF);
+v10 = 0xFFu >> (8 - (unsigned __int8)uTargetBBits);
+v21 = (uTargetGBits != 6 ? 0x31EF : 0x7BEF);
 
 
 if ( blend_mode == 2 )
@@ -667,7 +666,7 @@
             for (int j=0; j< src_width; ++j)
                 {
                 if ( *src_surf_pos != v10 )
-                  pRenderer->WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, *src_surf_pos);
+                  WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, *src_surf_pos);
                     //*dest_surf_pos = *src_surf_pos;
                 //++dest_surf_pos;
                 ++src_surf_pos;
@@ -684,7 +683,7 @@
         for (int j=0; j< src_width; ++j)
             {
             if ( *src_surf_pos != v10 )
-              pRenderer->WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, (v21 & (pRenderer->ReadPixel16(pTargetPoint->x + j, pTargetPoint->y + i) >> 1)) + (v21 & (*src_surf_pos >> 1)));
+              WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, (v21 & (ReadPixel16(pTargetPoint->x + j, pTargetPoint->y + i) >> 1)) + (v21 & (*src_surf_pos >> 1)));
                 //*dest_surf_pos = (v21 & (*dest_surf_pos >> 1)) + (v21 & (*src_surf_pos >> 1));
             //++dest_surf_pos;
             ++src_surf_pos;
@@ -697,7 +696,7 @@
 }
 
 //----- (0040D9B1) --------------------------------------------------------
-void Blt_Copy( RECT *pSrcRect, POINT *pTargetPoint, int blend_mode )
+void Render::am_Blt_Copy( RECT *pSrcRect, POINT *pTargetPoint, int blend_mode )
     {
 
     unsigned __int16 *pSrc; // eax@2
@@ -709,7 +708,7 @@
     __int32 src_height; // [sp+18h] [bp-Ch]@3
     int uSrcPitch; // [sp+1Ch] [bp-8h]@5
 
-    if ( !pRenderer->uNumSceneBegins )
+    if ( !uNumSceneBegins )
         return;
     if ( !pArcomageGame->pBlit_Copy_pixels )
         return;
@@ -734,7 +733,7 @@
     uSrcPitch = uSrcTotalWidth;
 
     src_surf_pos = &pSrc[pSrcRect->left + uSrcPitch * pSrcRect->top];
-    v21 = (pRenderer->uTargetGBits != 6 ? 0x31EF : 0x7BEF);
+    v21 = (uTargetGBits != 6 ? 0x31EF : 0x7BEF);
 
     if ( blend_mode == 2 )
         {
@@ -743,7 +742,7 @@
             {
             for (int j=0; j< src_width; ++j)
                 { 
-                  pRenderer->WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, *src_surf_pos);
+                  WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, *src_surf_pos);
                 //*dest_surf_pos = *src_surf_pos;
                 //++dest_surf_pos;
                 ++src_surf_pos;
@@ -761,7 +760,7 @@
                 {
                  //*dest_surf_pos = (v21 & (*dest_surf_pos >> 1)) + (v21 & (*src_surf_pos >> 1));
                 //++dest_surf_pos;
-                  pRenderer->WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, (v21 & (pRenderer->ReadPixel16(pTargetPoint->x + j, pTargetPoint->y + i) >> 1)) + (v21 & (*src_surf_pos >> 1)));
+                  WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, (v21 & (ReadPixel16(pTargetPoint->x + j, pTargetPoint->y + i) >> 1)) + (v21 & (*src_surf_pos >> 1)));
                 ++src_surf_pos;
                 }
             src_surf_pos+=uSrcPitch;
@@ -771,7 +770,7 @@
 }
 
 //----- (0040DB10) --------------------------------------------------------
-void  am_EndScene()
+void am_EndScene()
 {
   pRenderer->EndScene();
   pArcomageGame->pBlit_Copy_pixels = NULL;
@@ -1303,7 +1302,7 @@
   signed int i; // ecx@13
   signed int card_dispenser_counter; // eax@13
 
-  current_player_num = dword_505890;
+  current_player_num = am_default_starting_player;
   SetStartConditions();
   for(i=0; i<2; ++i )
   {
@@ -1812,7 +1811,7 @@
       pSrcXYZW.top = 0;
       pSrcXYZW.bottom = 480;
       am_BeginScene(pArcomageGame->pBackgroundPixels, -1, 1);
-      Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+      pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
       am_EndScene();
       DrawGameUI(animation_stage);
       pRenderer->Present();
@@ -1895,11 +1894,11 @@
 
   pTargetXY.x = 8;
   pTargetXY.y = 56;
-  Blt_Copy(&pSrcRect, &pTargetXY, 2);
+  pRenderer->am_Blt_Copy(&pSrcRect, &pTargetXY, 2);
 
   pTargetXY.x = 555;
   pTargetXY.y = 56;
-  Blt_Copy(&pSrcRect, &pTargetXY, 2);
+  pRenderer->am_Blt_Copy(&pSrcRect, &pTargetXY, 2);
 
   //players name rectangle
   pSrcRect.left   = 283;
@@ -1908,11 +1907,11 @@
   pSrcRect.bottom = 190;
   pTargetXY.x = 8;
   pTargetXY.y = 13;
-  Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
+  pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
 
   pTargetXY.x = 555;
   pTargetXY.y = 13;
-  Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
+  pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
 
   //tower height rectangle
   pSrcRect.left   = 234;
@@ -1921,11 +1920,11 @@
   pSrcRect.bottom = 190;
   pTargetXY.x = 100;
   pTargetXY.y = 296;
-  Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
+  pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
 
   pTargetXY.x = 492;
   pTargetXY.y = 296;
-  Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
+  pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
 
   //wall height rectangle
   pSrcRect.left   = 192; 
@@ -1934,11 +1933,11 @@
   pSrcRect.bottom = 190;
   pTargetXY.x = 168;
   pTargetXY.y = 296;
-  Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
+  pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
 
   pTargetXY.x = 430;
   pTargetXY.y = 296;
-  Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
+  pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
 }
 
 //----- (0040AC5F) --------------------------------------------------------
@@ -2099,7 +2098,7 @@
       pSrcRect.left = v7 - 864;
       pSrcRect.top = 190;
       pSrcRect.bottom = 207;
-      Blt_Chroma(&pSrcRect, &pTargetPoint, pArcomageGame->field_54, 1);
+      pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetPoint, pArcomageGame->field_54, 1);
       pTargetPoint.x += 22;
     }
   }
@@ -2132,7 +2131,7 @@
             pSrcRect.right = v7 - 357;
             pSrcRect.top = 128;
             pSrcRect.bottom = 138;
-            Blt_Copy(&pSrcRect, &pTargetPoint, 2);
+            pRenderer->am_Blt_Copy(&pSrcRect, &pTargetPoint, 2);
             pTargetPoint.x += 13;
             }
         }
@@ -2166,7 +2165,7 @@
             pSrcRect.right = v7 - 357;
             pSrcRect.top = 138;
             pSrcRect.bottom = 148;
-            Blt_Copy(&pSrcRect, &pTargetPoint, 2);
+            pRenderer->am_Blt_Copy(&pSrcRect, &pTargetPoint, 2);
             pTargetPoint.x += 13;
             }
         }
@@ -2200,7 +2199,7 @@
             pSrcRect.right = v7 - 357;
             pSrcRect.top = 148;
             pSrcRect.bottom = 158;
-            Blt_Copy(&pSrcRect, &pTargetPoint, 2);
+            pRenderer->am_Blt_Copy(&pSrcRect, &pTargetPoint, 2);
             pTargetPoint.x += 13;
             }
         }
@@ -2227,7 +2226,7 @@
 pSrcXYZW.bottom = tower_top;
 pTargetXY.x = 102;
 pTargetXY.y = 297 - tower_top;
-Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
 
 pSrcXYZW.top = 0;
 pSrcXYZW.left = 384;
@@ -2235,7 +2234,7 @@
 pSrcXYZW.bottom = 94;
 pTargetXY.y = 203 - tower_top;
 pTargetXY.x = 91;
-Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
+pRenderer->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
 
 
 tower_height = am_Players[1].tower_height;
@@ -2249,7 +2248,7 @@
 
 pTargetXY.x = 494;
 pTargetXY.y = 297 - tower_top;
-Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
 //draw tower up cone
 pSrcXYZW.left   = 384;
 pSrcXYZW.right  = 452;
@@ -2258,7 +2257,7 @@
 
 pTargetXY.x = 483;
 pTargetXY.y = 203 - tower_top;
-Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
+pRenderer->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
  
 }
 // 4E1884: using guessed type int dword_4E1884;
@@ -2290,7 +2289,7 @@
 pSrcXYZW.bottom = v1;
 pTargetXY.x = 177;
 pTargetXY.y = 297 - v1;
-Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
+pRenderer->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
  }
 
 v3 = am_Players[1].wall_height;
@@ -2308,7 +2307,7 @@
 pSrcXYZW.bottom = v4;
 pTargetXY.x = 439;
 pTargetXY.y =  297 - v4;
-Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
+pRenderer->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
         }
 }
 
@@ -2370,16 +2369,16 @@
             pSrcXYZW.right = 288;
             pSrcXYZW.top = 0;
             pSrcXYZW.bottom = 128;
-            Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+            pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
             goto LABEL_13;
             }
         pArcomageGame->GetCardRect(v7, &pSrcXYZW);
         if ( !CanCardBePlayed(current_player_num, v2) )
             {
-            Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
+            pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
             goto LABEL_13;
             }
-        Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+        pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
 
         }
 LABEL_13:
@@ -2401,7 +2400,7 @@
         if ( shown_cards[v11].uCardId != -1 )
             {
             pArcomageGame->GetCardRect(shown_cards[v11].uCardId, &pSrcXYZW);
-            Blt_Copy(&pSrcXYZW, &shown_cards[v11].field_18_point, 0);
+            pRenderer->am_Blt_Copy(&pSrcXYZW, &shown_cards[v11].field_18_point, 0);
             }
         if ( shown_cards[v11].field_4 != 0 )
             {
@@ -2411,7 +2410,7 @@
             pSrcXYZW.right  = 916;
             pSrcXYZW.top    = 200;
             pSrcXYZW.bottom = 216;
-            Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
+            pRenderer->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
             }
         }
     else if ( amuint_4FAA34 <= 0 )
@@ -2436,7 +2435,7 @@
             shown_cards[v11].field_18_point.x += shown_cards[v11].field_10_xplus;
             shown_cards[v11].field_18_point.y += shown_cards[v11].field_14_y_plus;
             pArcomageGame->GetCardRect(shown_cards[v11].uCardId, &pSrcXYZW);
-            Blt_Copy(&pSrcXYZW, &shown_cards[v11].field_18_point, 0);
+            pRenderer->am_Blt_Copy(&pSrcXYZW, &shown_cards[v11].field_18_point, 0);
             }
         }
     }
@@ -2449,7 +2448,7 @@
     pSrcXYZW.bottom = 128;
     pTargetXY.x     = 120;
     pTargetXY.y     = 18;
-    Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
+    pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
 
 }
 
@@ -2515,7 +2514,7 @@
         pSrcXYZW.top = 0;
         pSrcXYZW.right = 288;
         pSrcXYZW.bottom = 128;
-        Blt_Copy(&pSrcXYZW, &am_uint_4FAA44_blt_xy, 2);
+        pRenderer->am_Blt_Copy(&pSrcXYZW, &am_uint_4FAA44_blt_xy, 2);
         }
     else
         {
@@ -2527,7 +2526,7 @@
     pSrcXYZW.bottom = 128;
     am_uint_4FAA44_blt_xy.x += amuint_4FAA3C_blt_xy.x;
     am_uint_4FAA44_blt_xy.y += amuint_4FAA3C_blt_xy.y;
-    Blt_Copy(&pSrcXYZW, &am_uint_4FAA44_blt_xy, 2);
+    pRenderer->am_Blt_Copy(&pSrcXYZW, &am_uint_4FAA44_blt_xy, 2);
     if ( !amuint_4FAA38 )
         {
         
@@ -2569,7 +2568,7 @@
 //LABEL_20:
             pTargetXY.x = shown_cards[v8].field_8.x;
             pTargetXY.y = shown_cards[v8].field_8.y;
-            Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
+            pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
             uCardID = -1;
             }
         }
@@ -2578,7 +2577,7 @@
         pArcomageGame->GetCardRect(uCardID, &pSrcXYZW);
         amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x;
         amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y;
-        Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 0);
+        pRenderer->am_Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 0);
         }
     }
 
@@ -2590,7 +2589,7 @@
         pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
         amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x;
         amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y;
-        Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 2);
+        pRenderer->am_Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 2);
         return;
         }
     if ( v15 == 15.0 )
@@ -2599,7 +2598,7 @@
         pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
         pTargetXY.x = 272;
         pTargetXY.y = 173;
-        Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+        pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
         return;
         }
     if ( v15 == 5.0 )
@@ -2617,7 +2616,7 @@
             pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
             pTargetXY.x = 272;
             pTargetXY.y = 173;
-            Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+            pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
             return;
         }
     if ( v15 >= 5.0 )
@@ -2632,7 +2631,7 @@
             pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
             amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x;
             amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y;
-            Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 0);
+            pRenderer->am_Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 0);
             return;
             }
         }
@@ -2642,7 +2641,7 @@
         pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
         pTargetXY.x = 272;
         pTargetXY.y = 173;
-        Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+        pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
         return;
         }
 
@@ -2657,7 +2656,7 @@
         }
         pTargetXY.x = shown_cards[v19].field_8.x;
     pTargetXY.y = shown_cards[v19].field_8.y;
-    Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
+    pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
     played_card_id = -1;
     }
 }
@@ -3986,7 +3985,7 @@
   pXYZW.top = 0;
   pXYZW.bottom = 480;
   am_BeginScene(pArcomageGame->pBackgroundPixels, -1, 1);
-  Blt_Copy(&pXYZW, &pXY, 2);
+  pRenderer->am_Blt_Copy(&pXYZW, &pXY, 2);
   am_EndScene();
   pRenderer->Present();
   ArcomageGame::LoadSprites();
@@ -4087,7 +4086,7 @@
 void DrawSquare( POINT *pTargetXY, unsigned __int16 uColor )
 {
     pRenderer->BeginScene();
-    if ( pRenderer->uNumSceneBegins )
+    //if ( uNumSceneBegins )
     {
       pRenderer->WritePixel16(pTargetXY->x,     pTargetXY->y, uColor);
       pRenderer->WritePixel16(pTargetXY->x + 1, pTargetXY->y, uColor);
@@ -4110,7 +4109,7 @@
 void DrawPixel( POINT *pTargetXY, unsigned __int16 uColor )
 {
     pRenderer->BeginScene();
-    if ( pRenderer->uNumSceneBegins )
+    //if ( pRenderer->uNumSceneBegins )
         {
           pRenderer->WritePixel16(pTargetXY->x, pTargetXY->y, uColor);
         /*int xVal = pTargetXY->x;
--- a/AudioPlayer.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/AudioPlayer.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -1588,16 +1588,16 @@
                 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
                 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
                 v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z;
-                if ( pRenderer->pRenderD3D )
+                //if ( pRenderer->pRenderD3D )
                 {
                   v19 = *(float *)&uNumRepeats * v56 + v58 * v55;
                   v20 = v58 * v56 - *(float *)&uNumRepeats * v55;
                 }
-                else
+                /*else
                 {
                   v19 = v58 * v55 - *(float *)&uNumRepeats * v56;
                   v20 = v58 * v56 + *(float *)&uNumRepeats * v55;
-                }
+                }*/
                 a1.vWorldViewPosition.x = v19 * v16 - v18 * v17;
                 a1.vWorldViewPosition.y = v20;
                 a1.vWorldViewPosition.z = v19 * v17 + v18 * v16;
@@ -1606,16 +1606,16 @@
               {
                 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
                 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
-                if ( pRenderer->pRenderD3D )
+                //if ( pRenderer->pRenderD3D )
                 {
                   a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55;
                   v21 = v58 * v56 - *(float *)&uNumRepeats * v55;
                 }
-                else
+                /*else
                 {
                   a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56;
                   v21 = v58 * v56 + *(float *)&uNumRepeats * v55;
-                }
+                }*/
                 a1.vWorldViewPosition.y = v21;
                 a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z;
               }
@@ -1659,16 +1659,16 @@
                 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
                 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
                 v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z;
-                if ( pRenderer->pRenderD3D )
+                //if ( pRenderer->pRenderD3D )
                 {
                   v19 = *(float *)&uNumRepeats * v56 + v58 * v55;
                   v20 = v58 * v56 - *(float *)&uNumRepeats * v55;
                 }
-                else
+                /*else
                 {
                   v19 = v58 * v55 - *(float *)&uNumRepeats * v56;
                   v20 = v58 * v56 + *(float *)&uNumRepeats * v55;
-                }
+                }*/
                 a1.vWorldViewPosition.x = v19 * v16 - v18 * v17;
                 a1.vWorldViewPosition.y = v20;
                 a1.vWorldViewPosition.z = v19 * v17 + v18 * v16;
@@ -1677,16 +1677,16 @@
               {
                 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
                 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
-                if ( pRenderer->pRenderD3D )
+                //if ( pRenderer->pRenderD3D )
                 {
                   a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55;
                   v21 = v58 * v56 - *(float *)&uNumRepeats * v55;
                 }
-                else
+                /*else
                 {
                   a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56;
                   v21 = v58 * v56 + *(float *)&uNumRepeats * v55;
-                }
+                }*/
                 a1.vWorldViewPosition.y = v21;
                 a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z;
               }
@@ -1733,16 +1733,16 @@
             v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
             *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
             v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z;
-            if ( pRenderer->pRenderD3D )
+            //if ( pRenderer->pRenderD3D )
             {
               v19 = *(float *)&uNumRepeats * v56 + v58 * v55;
               v20 = v58 * v56 - *(float *)&uNumRepeats * v55;
             }
-            else
+            /*else
             {
               v19 = v58 * v55 - *(float *)&uNumRepeats * v56;
               v20 = v58 * v56 + *(float *)&uNumRepeats * v55;
-            }
+            }*/
             a1.vWorldViewPosition.x = v19 * v16 - v18 * v17;
             a1.vWorldViewPosition.y = v20;
             a1.vWorldViewPosition.z = v19 * v17 + v18 * v16;
@@ -1751,16 +1751,16 @@
           {
             v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
             *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
-            if ( pRenderer->pRenderD3D )
+            //if ( pRenderer->pRenderD3D )
             {
               a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55;
               v21 = v58 * v56 - *(float *)&uNumRepeats * v55;
             }
-            else
+            /*else
             {
               a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56;
               v21 = v58 * v56 + *(float *)&uNumRepeats * v55;
-            }
+            }*/
             a1.vWorldViewPosition.y = v21;
             a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z;
           }
@@ -1831,16 +1831,16 @@
             v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
             *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
             v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z;
-            if ( pRenderer->pRenderD3D )
+            //if ( pRenderer->pRenderD3D )
             {
               v19 = *(float *)&uNumRepeats * v56 + v58 * v55;
               v20 = v58 * v56 - *(float *)&uNumRepeats * v55;
             }
-            else
+            /*else
             {
               v19 = v58 * v55 - *(float *)&uNumRepeats * v56;
               v20 = v58 * v56 + *(float *)&uNumRepeats * v55;
-            }
+            }*/
             a1.vWorldViewPosition.x = v19 * v16 - v18 * v17;
             a1.vWorldViewPosition.y = v20;
             a1.vWorldViewPosition.z = v19 * v17 + v18 * v16;
@@ -1849,16 +1849,16 @@
           {
             v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
             *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
-            if ( pRenderer->pRenderD3D )
+            //if ( pRenderer->pRenderD3D )
             {
               a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55;
               v21 = v58 * v56 - *(float *)&uNumRepeats * v55;
             }
-            else
+            /*else
             {
               a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56;
               v21 = v58 * v56 + *(float *)&uNumRepeats * v55;
-            }
+            }*/
             a1.vWorldViewPosition.y = v21;
             a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z;
           }
--- a/CastSpellInfo.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/CastSpellInfo.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -1046,7 +1046,7 @@
 
 			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
 
-			pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0);
+			pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)v733 * 4.2666669), v731, amount, 0, 0);
 			LODWORD(v727) = 1;
 			break;
 		}
@@ -1237,7 +1237,7 @@
 					pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
 					pSpellSprite.vPosition.x = v112->vPosition.x;
 					pSpellSprite.vPosition.y = v112->vPosition.y;
-					pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548);
+					pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)v112->uActorHeight * -0.8);
 					pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2);
 					v122 = pSpellSprite.Create(0, 0, 0, 0);
 					DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701);
@@ -1442,7 +1442,7 @@
 					v162 = dword_50BF30[a2];
 					pSpellSprite.vPosition.x = pActors[v162].vPosition.x;
 					pSpellSprite.vPosition.y = pActors[v162].vPosition.y;
-					pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548);
+					pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * -0.8);
 					pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
 					v164 = pSpellSprite.Create(0, 0, 0, 0);
 					v165 = a2;
@@ -2415,7 +2415,7 @@
 				{
 					pSpellSprite.vPosition.x = v369->vPosition.x;
 					pSpellSprite.vPosition.y = v369->vPosition.y;
-					pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548);
+					pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * -0.8);
 
 					pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
 					pSpellSprite.Create(0, 0, 0, 0);
@@ -2885,7 +2885,7 @@
 					break;
 				pSpellSprite.vPosition.x = v433->vPosition.x;
 				pSpellSprite.vPosition.y = v433->vPosition.y;
-				pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548);
+				pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * -0.8);
 
 				pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
 				pSpellSprite.Create(0, 0, 0, 0);
@@ -3276,7 +3276,7 @@
 				v507 = dword_50BF30[a2];
 				pSpellSprite.vPosition.x = pActors[v507].vPosition.x;
 				pSpellSprite.vPosition.y = pActors[v507].vPosition.y;
-				pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548);
+				pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * -0.8);
 				pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
 				v509 = pSpellSprite.Create(0, 0, 0, 0);
 				DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], &v688);
@@ -3286,7 +3286,7 @@
 				pActor = &pActors[dword_50BF30[a2]];
 				pSpellSprite.vPosition.x = pActor->vPosition.x;
 				pSpellSprite.vPosition.y = pActor->vPosition.y;
-				pSpellSprite.vPosition.z = pActor->vPosition.z - (unsigned int)(signed __int64)((double)pActor->uActorHeight * unk_4D8548);
+				pSpellSprite.vPosition.z = pActor->vPosition.z - (unsigned int)(signed __int64)((double)pActor->uActorHeight * -0.8);
 				pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
 				pSpellSprite.Create(0, 0, 0, 0);
 				for (int i = 0; i < 22; ++i)
@@ -3397,7 +3397,7 @@
 					v533 = dword_50BF30[a2];
 					pSpellSprite.vPosition.x = pActors[v533].vPosition.x;
 					pSpellSprite.vPosition.y = pActors[v533].vPosition.y;
-					pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548);
+					pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * -0.8);
 					pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
 					v535 = pSpellSprite.Create(0, 0, 0, 0);
 					v536 = a2;
@@ -3603,7 +3603,7 @@
 			pSpellSprite.vPosition.x = *(short *)(v721 + 142);
 			pSpellSprite.vPosition.y = *(short *)(v721 + 144);
 			v732 = *(short *)(v721 + 138);
-			pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
+			pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * -0.8);
 			pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577);
 			pSpellSprite.Create(0, 0, 0, 0);
 			if ( *(char *)(v581 + 52) > amount )
@@ -3936,7 +3936,7 @@
 					pSpellSprite.vPosition.x = pActors[v625].vPosition.x;
 					pSpellSprite.vPosition.y = pActors[v625].vPosition.y;
 					//v732 = pActors[v625].uActorHeight;
-					pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548);
+					pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * -0.8);
 					pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
 					v627 = pSpellSprite.Create(0, 0, 0, 0);
 					v628 = a2;
--- a/Game.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/Game.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -93,12 +93,12 @@
 
   if ( pVideoPlayer->AnyMovieLoaded() )
   {
-    if ( !pRenderer->pRenderD3D )
+    /*if ( !pRenderer->pRenderD3D )
     {
 		pRenderer->BeginSceneD3D();
 		pMouse->DrawCursorToTarget();
 		pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
-	}
+	}*/
   }
   else
   {
@@ -115,11 +115,11 @@
     pParty->sPrevEyelevel = pParty->sEyelevel;
     pRenderer->BeginSceneD3D();
 
-    if ( !pRenderer->pRenderD3D )
-      pMouse->DrawCursorToTarget();
+    //if ( !pRenderer->pRenderD3D )
+      //pMouse->DrawCursorToTarget();
     if ( !PauseGameDrawing() || viewparams->field_48 == 1 )
     {
-      if ( pRenderer->pRenderD3D )
+      //if ( pRenderer->pRenderD3D )
       {
         float v2 = (double)(((signed int)pMiscTimer->uTotalGameTimeElapsed >> 2) & 0x1F) * 0.032258064 * 6.0;
         //v3 = v2 + 6.7553994e15;
@@ -133,7 +133,7 @@
         pOutdoor->Draw();
       else Error("Invalid level type: %u", uCurrentlyLoadedLevelType);
 
-      if (pRenderer->pRenderD3D)
+      //if (pRenderer->pRenderD3D)
       {
         pDecalBuilder->DrawBloodsplats();
         pGame->pLightmapBuilder->DrawLightmapsType(2);
@@ -147,7 +147,7 @@
 
 
   pRenderer->BeginScene();
-  if (pRenderer->pRenderD3D)
+  //if (pRenderer->pRenderD3D)
     pMouse->DrawCursorToTarget();
   if (pOtherOverlayList->bRedraw)
     viewparams->bRedrawGameUI = true;
@@ -168,7 +168,7 @@
     GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, true);//redraw = pParty->uFlags & 2);
     if (v4)
     {
-      if ( !PauseGameDrawing() && pRenderer->pRenderD3D) // clear game viewport with transparent color
+      if ( !PauseGameDrawing() /*&& pRenderer->pRenderD3D*/) // clear game viewport with transparent color
         pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pViewport->uViewportBR_X - pViewport->uViewportTL_X,
                                 pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1,
                                 pRenderer->uTargetGMask | pRenderer->uTargetBMask);
@@ -318,7 +318,7 @@
     // uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
     pCurrentScreen = SCREEN_GAME;
 
-    if ( pRenderer->pRenderD3D )
+    //if ( pRenderer->pRenderD3D )
       pGame->pVisInstance->_4C1A02();
 
     bool game_finished = false;
@@ -554,10 +554,10 @@
            pLight->vRGBColor.x,
            pLight->vRGBColor.y,
            pLight->vRGBColor.z,
-           byte_4E94D0);
+           _4E94D0_light_type);
       }
 }
-// 4E94D0: using guessed type char byte_4E94D0;
+// 4E94D0: using guessed type char _4E94D0_light_type;
 
 //----- (0044F0FD) --------------------------------------------------------
 void Game::_44F0FD()
@@ -648,18 +648,18 @@
 
     if ( uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
       pStru10Instance->bDoNotDrawPortalFrustum = false;
-    if ( pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor)
+    if ( /*pRenderer->pRenderD3D &&*/ uCurrentlyLoadedLevelType == LEVEL_Outdoor)
     {
       v5 = GetLevelFogColor();
       pRenderer->uFogColor = v5 & 0xFFFFFF;
     }
     if (uFlags & 0x0400)
       uFlags2 |= 0x01;
-    if ( !pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor && pMobileLightsStack->uNumLightsActive )
+    /*if ( !pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor && pMobileLightsStack->uNumLightsActive )
     {
       uFlags2 |= 0x01;
       field_E10 = qword_5C6DF0;
-    }
+    }*/
     v6 = qword_5C6DF0 - field_E10;
     if ( qword_5C6DF0 - field_E10 == 1 )
       uFlags2 |= v6;
@@ -1032,8 +1032,8 @@
 //----- (0044EA5E) --------------------------------------------------------
 bool Game::PickMouse(float fPickDepth, unsigned int uMouseX, unsigned int uMouseY, bool bOutline, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter)
 {
-  if (pCurrentScreen != SCREEN_GAME|| !pRenderer->pRenderD3D)
-    return false;
+  /*if (pCurrentScreen != SCREEN_GAME|| !pRenderer->pRenderD3D)
+    return false;*/
 
   if (!pVisInstance)
   {
@@ -1059,7 +1059,7 @@
 //----- (0044EB12) --------------------------------------------------------
 bool Game::PickKeyboard(bool bOutline, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter)
 {
-  if (pCurrentScreen == SCREEN_GAME && pVisInstance && pRenderer->pRenderD3D)
+  if (pCurrentScreen == SCREEN_GAME && pVisInstance /*&& pRenderer->pRenderD3D*/)
   {
     bool r = pVisInstance->PickKeyboard(&pVisInstance->default_list, sprite_filter, face_filter);
 
@@ -1350,7 +1350,7 @@
   char a1[64]; // [sp+1F8h] [bp-404h]@467
   char Str2[128]; // [sp+238h] [bp-3C4h]@527
   Actor actor; // [sp+2B8h] [bp-344h]@4
-  unsigned short* screenshot;
+  //unsigned short* screenshot;
 
   dword_50CDC8 = 0;
   if ( !pEventTimer->bPaused )
@@ -1788,7 +1788,7 @@
           if ( !pRenderer->bWindowMode )
           {
             //v0 = 1;
-            if ( GammaController::IsGammaSupported() )
+            if ( pRenderer->IsGammaSupported() )
             {
               pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C20), 0);
               pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C24), 0);
@@ -2059,10 +2059,9 @@
               uMessageParam = 1;
               break;
             case SCREEN_HOUSE:
-              if ( !dword_50CDC8 && !dword_5C35C8 )
+              if ( !dword_50CDC8 )
               {
                 CloseWindowBackground();
-                dword_5C35C8 = 0;
                 uMessageParam = 1;
                 break;
               }
@@ -2264,14 +2263,9 @@
                         WriteWindowsRegistryInt("Tinting", pRenderer->bTinting);
                         WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pGame->uFlags2) >> 5) & 1);
                       }
-                      if ( pRenderer->bWindowMode )
-                        {
-                          stru_506E40.Release();
-                          break;
-                        }
-                      //v30 = uGammaPos;
-                      //v31 = "GammaPos";
-                      WriteWindowsRegistryInt("GammaPos", uGammaPos);
+                      if ( !pRenderer->bWindowMode )
+                        WriteWindowsRegistryInt("GammaPos", uGammaPos);
+
                       stru_506E40.Release();
                       break;
 
@@ -2349,7 +2343,6 @@
                       }
                       _506F18_num_minutes_to_sleep = 0;
                       dword_506F14 = 0;
-                      dword_507B94 = 1;
                       if ( pGUIWindow_Settings )
                       {
                         if ( pCurrentScreen == SCREEN_CHARACTERS )
@@ -2640,11 +2633,11 @@
                              pIcons_LOD->GetTexture(uTextureID_Resume1), 0);
               pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(6, 1, 0, 0);
               viewparams->field_48 = 1;
+
               stru_506E40.Release();
-              screenshot = MakeScreenshot(155, 117);
-              pRenderer->SavePCXImage("gamma.pcx", screenshot, 155, 117);
-              free(screenshot);
+              pRenderer->SaveScreenshot("gamma.pcx", 155, 117);
               stru_506E40.LoadPCXFile("gamma.pcx", 0);
+
               continue;
             }
             pGUIWindow_Settings->Release();
@@ -3133,7 +3126,7 @@
           else
           {
             sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1);
-            SaveScreenshot(a1);
+            pRenderer->SaveScreenshot(a1, 92, 68);
             LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1);
             pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime = pParty->uTimePlayed + (signed __int64)((double)(qword_506350 << 7) * 0.033333335);
             pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X = pParty->vPosition.x;
@@ -3438,16 +3431,16 @@
           continue;
         case UIMSG_CastSpell_Monster_Improvement:
         case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm, 
-          if ( pRenderer->pRenderD3D )
+          //if ( pRenderer->pRenderD3D )
           {
             v81 = pGame->pVisInstance->get_picked_object_zbuf_val();
           }
-          else
+          /*else
           {
             uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v206);
             pPoint2 = pMouse->GetCursorPos(&v201);
             v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]];
-          }
+          }*/
           v83 = v81;
           v44 = (unsigned __int16)v81;
           v84 = v83 >> 16;
@@ -3912,11 +3905,11 @@
             pCurrentScreen = SCREEN_GAME;
             viewparams->bRedrawGameUI = 1;
           }
+
           stru_506E40.Release();
-          screenshot = MakeScreenshot(155, 117);
-          pRenderer->SavePCXImage("gamma.pcx", screenshot, 155, 117);
-          free(screenshot);
+          pRenderer->SaveScreenshot("gamma.pcx", 155, 117);
           stru_506E40.LoadPCXFile("gamma.pcx", 0);
+
           GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton, (int)pBtn_GameSettings, 0);
 //LABEL_453:
           /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
@@ -4138,13 +4131,13 @@
           pPlayers[uActiveCharacter]->OnInventoryLeftClick();
           continue;
         case UIMSG_MouseLeftClickInGame:
-          if ( !pRenderer->pRenderD3D )
+          /*if ( !pRenderer->pRenderD3D )
           {
             if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
             OnGameViewportClick();
             continue;
-          }
+          }*/
           v115 = pMessageQueue_50CBD0->uNumMessages;
           if ( !pMessageQueue_50CBD0->uNumMessages )
           {
@@ -4193,16 +4186,16 @@
           continue;
         case UIMSG_F:
 			__debugbreak();
-          if ( pRenderer->pRenderD3D )
+          //if ( pRenderer->pRenderD3D )
           {
             LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val();
           }
-          else
+          /*else
           {
             uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209);
             pPoint3 = pMouse->GetCursorPos(&v204);
             v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]];
-          }
+          }*/
           pButton2 = (GUIButton *)(unsigned __int16)v116;
           GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0);
           continue;
--- a/GammaControl.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/GammaControl.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -126,24 +126,6 @@
 }
 
 
-//----- (0044F2B2) --------------------------------------------------------
-bool GammaController::IsGammaSupported()
-{
-  bool result; // eax@3
-  HRESULT v1; // eax@4
-
-  //if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
-  {
-    DDCAPS halCaps; // [sp+0h] [bp-180h]@4
-    memset(&halCaps, 0, sizeof(DDCAPS));
-    halCaps.dwSize = sizeof(DDCAPS);
-
-    ErrD3D(pRenderer->pDirectDraw4->GetCaps(&halCaps, 0));
-    return (halCaps.dwCaps2 >> 17) & 1;
-  }
-  /*else
-    return false;*/
-}
 
 
 
@@ -174,7 +156,7 @@
     v4->Release();
     *v3 = 0;
   }
-  if ( IsGammaSupported() )
+  if ( pRenderer->IsGammaSupported() )
   {
     ErrD3D(a2->QueryInterface(IID_IDirectDrawGammaControl, (LPVOID *)v3));
     GetRamp();
--- a/GammaControl.h	Thu Jan 09 02:34:20 2014 +0200
+++ b/GammaControl.h	Thu Jan 09 14:36:48 2014 +0200
@@ -18,9 +18,6 @@
 
   /*protected*/void InitializeFromSurface(struct IDirectDrawSurface4 *a2);
 
-  static bool IsGammaSupported();
-
-
 
 
   void ( ***vdestructor_ptr)(GammaController *, bool);
--- a/Indoor.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/Indoor.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -119,7 +119,7 @@
     v5 = 800;
     if (pParty->TorchlightActive())
       v5 *= pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower;
-    //LOBYTE(v1) = byte_4E94D0;
+    //LOBYTE(v1) = _4E94D0_light_type;
     //v4 = pParty->flt_TorchlightColorR + 6.7553994e15;
     //v3 = pParty->flt_TorchlightColorG + 6.7553994e15;
     pMobileLightsStack->AddLight(pGame->pIndoorCameraD3D->vPartyPos.x,
@@ -130,7 +130,7 @@
                                  floorf(pParty->flt_TorchlightColorR + 0.5f),
                                  floorf(pParty->flt_TorchlightColorG + 0.5f),
                                  floorf(pParty->flt_TorchlightColorB + 0.5f),
-                                 byte_4E94D0);
+                                 _4E94D0_light_type);
   }
   PrepareBspRenderList_BLV();
   PrepareItemsRenderList_BLV();
@@ -223,7 +223,7 @@
     this->vPartyPos.y = pParty->vPosition.y;*/
     this->uPartySectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
   }
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
   {
     //this->sCosineY = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY);
     //this->sSineY = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY);
@@ -245,10 +245,10 @@
     this->uViewportCenterX = (uViewportZ + uViewportX) / 2;
     this->uViewportCenterY = (uViewportY + uViewportW) / 2;
   }
-  else
+  /*else
   {
     __debugbreak(); // no sw
-    /*this->sCosineY = stru_5C6E00->Cos(-this->sPartyRotY);
+    this->sCosineY = stru_5C6E00->Cos(-this->sPartyRotY);
     this->sSineY = stru_5C6E00->Sin(-this->sPartyRotY);
     this->sCosineNegX = stru_5C6E00->Cos(-this->sPartyRotX);
     this->sSineNegX = stru_5C6E00->Sin(-this->sPartyRotX);
@@ -271,8 +271,8 @@
     v29 = v25;
     v26 = this->field_64;
     this->uViewportCenterX = (signed int)(v24 + v23) >> 1;
-    this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);*/
-  }
+    this->uViewportCenterY = this->uViewportW - ((unsigned __int64)(v26 * (signed __int64)v29) >> 16);
+  }*/
   //v27 = (unsigned int)(signed __int64)((double)this->uViewportWidth * 0.5
   //                                             / tan((double)(v2->fov_deg >> 1) * 0.01745329)
   //                                             + 0.5) << 16;
@@ -414,7 +414,7 @@
   {
     PrepareDrawLists_BLV();
     if (pBLVRenderParams->uPartySectorID)
-      IndoorLocation::ExecDraw(pRenderer->pRenderD3D != 0);
+      IndoorLocation::ExecDraw(true/*pRenderer->pRenderD3D != 0*/);
     pRenderer->DrawBillboardList_BLV();
   }
 
@@ -792,147 +792,6 @@
 }
 
 
-//----- (004AFB86) --------------------------------------------------------
-void BspRenderer::AddFaceToRenderList_sw(unsigned int node_id, unsigned int uFaceID)
-{
-  BspRenderer *v3; // ebx@1
-  BLVFace *v4; // eax@1
-  char *v5; // ecx@2
-  unsigned __int16 v6; // ax@11
-  int v7; // ecx@13
-  Vec3_short_ *v8; // esi@16
-  int v9; // edx@16
-  signed int v10; // eax@19
-  signed int v11; // edi@20
-  signed int v12; // ecx@20
-  signed int v13; // esi@20
-  int v14; // edx@21
-  int v15; // edx@25
-  unsigned __int16 v16; // ax@35
-  signed int v17; // eax@37
-  int v18; // eax@38
-  signed int v19; // [sp+Ch] [bp-14h]@19
-  char *v20; // [sp+14h] [bp-Ch]@2
-  BLVFace *v21; // [sp+18h] [bp-8h]@1
-  signed int v22; // [sp+1Ch] [bp-4h]@20
-  signed int v23; // [sp+28h] [bp+8h]@20
-
-  v3 = this;
-  v4 = &pIndoor->pFaces[uFaceID];
-  v21 = v4;
-  if (v4->Portal())
-  {
-    v5 = (char *)this + 2252 * node_id;
-    v20 = v5;
-    if ( uFaceID == *((short *)v5 + 2982) )
-      return;
-    if (!node_id
-      && pGame->pIndoorCameraD3D->vPartyPos.x >= v4->pBounding.x1 - 16
-      && pGame->pIndoorCameraD3D->vPartyPos.x <= v4->pBounding.x2 + 16
-      && pGame->pIndoorCameraD3D->vPartyPos.y >= v4->pBounding.y1 - 16
-      && pGame->pIndoorCameraD3D->vPartyPos.y <= v4->pBounding.y2 + 16
-      && pGame->pIndoorCameraD3D->vPartyPos.z >= v4->pBounding.z1 - 16
-      && pGame->pIndoorCameraD3D->vPartyPos.z <= v4->pBounding.z2 + 16 )
-    {
-      if ( abs(v4->pFacePlane_old.dist + pGame->pIndoorCameraD3D->vPartyPos.x * v4->pFacePlane_old.vNormal.x
-                                       + pGame->pIndoorCameraD3D->vPartyPos.y * v4->pFacePlane_old.vNormal.y
-                                       + pGame->pIndoorCameraD3D->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 )
-      {
-        v6 = v21->uSectorID;
-        if ( v3->nodes[0].uSectorID == v6 )
-          v6 = v21->uBackSectorID;
-        v3->nodes[v3->num_nodes].uSectorID = v6;
-        v3->nodes[v3->num_nodes].uFaceID = uFaceID;
-        v3->nodes[v3->num_nodes].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
-        v3->nodes[v3->num_nodes].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
-        v3->nodes[v3->num_nodes].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
-        v3->nodes[v3->num_nodes].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
-        v3->nodes[v3->num_nodes++].PortalScreenData.GetViewportData(
-          SLOWORD(pBLVRenderParams->uViewportX),
-          pBLVRenderParams->uViewportY,
-          SLOWORD(pBLVRenderParams->uViewportZ),
-          pBLVRenderParams->uViewportW);
-        v7 = v3->num_nodes - 1;
-        goto LABEL_14;
-      }
-      v4 = v21;
-      v5 = v20;
-    }
-    v8 = &pIndoor->pVertices[*v4->pVertexIDs];
-    v9 = v4->pFacePlane_old.vNormal.x * (v8->x - pGame->pIndoorCameraD3D->vPartyPos.x)
-       + v4->pFacePlane_old.vNormal.y * (v8->y - pGame->pIndoorCameraD3D->vPartyPos.y)
-       + v4->pFacePlane_old.vNormal.z * (v8->z - pGame->pIndoorCameraD3D->vPartyPos.z);
-    if ( *((short *)v5 + 2004) != v4->uSectorID )
-      v9 = -v9;
-    if ( v9 < 0 )
-    {
-      v10 = GetPortalScreenCoord(uFaceID);
-      v19 = v10;
-      if ( v10 )
-      {
-        v11 = PortalFace._screen_space_x[0];
-        v12 = PortalFace._screen_space_y[0];
-        v23 = PortalFace._screen_space_x[0];
-        v13 = 1;
-        v22 = PortalFace._screen_space_y[0];
-        if ( v10 > 1 )
-        {
-          do
-          {
-            v14 = PortalFace._screen_space_x[v13];
-            if ( v14 < v23 )
-              v23 = PortalFace._screen_space_x[v13];
-            if ( v14 > v11 )
-              v11 = PortalFace._screen_space_x[v13];
-            v15 = PortalFace._screen_space_y[v13];
-            if ( v15 < v22 )
-              v22 = PortalFace._screen_space_y[v13];
-            if ( v15 > v12 )
-              v12 = PortalFace._screen_space_y[v13];
-            v10 = v19;
-            ++v13;
-          }
-          while ( v13 < v19 );
-        }
-        if ( v11 >= *((short *)v20 + 2005)
-          && v23 <= *((short *)v20 + 2007)
-          && v12 >= *((short *)v20 + 2006)
-          && v22 <= *((short *)v20 + 2008)
-          && PortalFrustrum(v10, &v3->nodes[v3->num_nodes].PortalScreenData, (BspRenderer_PortalViewportData *)(v20 + 4020), uFaceID) )
-        {
-          v16 = v21->uSectorID;
-          if ( *((short *)v20 + 2004) == v16 )
-            v16 = v21->uBackSectorID;
-          v3->nodes[v3->num_nodes].uSectorID = v16;
-          v3->nodes[v3->num_nodes].uFaceID = uFaceID;
-          v3->nodes[v3->num_nodes].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
-          v3->nodes[v3->num_nodes].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
-          v3->nodes[v3->num_nodes].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
-          v3->nodes[v3->num_nodes].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
-          v17 = v3->num_nodes;
-          if ( v17 < 150 )
-          {
-            v18 = v17 + 1;
-            v3->num_nodes = v18;
-            v7 = v18 - 1;
-LABEL_14:
-            AddBspNodeToRenderList(v7);
-            return;
-          }
-        }
-      }
-    }
-  }
-  else
-  {
-    if (num_faces < 1000)
-    {
-      faces[num_faces].uFaceID = uFaceID;
-      faces[num_faces++].uNodeID = node_id;
-    }
-  }
-}
-
 //----- (004AE5BA) --------------------------------------------------------
 Texture *BLVFace::GetTexture()
 {
@@ -2783,10 +2642,10 @@
         HIDWORD(v27) = face->pFacePlane_old.dist >> 16;
         face->zCalc3 = -v27 / face->pFacePlane_old.vNormal.z;
       }
-      if ( face->uAttributes & FACE_TEXTURE_FLOW || pRenderer->pRenderD3D )
+      //if ( face->uAttributes & FACE_TEXTURE_FLOW || pRenderer->pRenderD3D )
         face->_get_normals(&v70, &v67);
       v28 = &pIndoor->pFaceExtras[face->uFaceExtraID];
-      if ( !pRenderer->pRenderD3D )
+      /*if ( !pRenderer->pRenderD3D )
       {
         if ( !(face->uAttributes & FACE_TEXTURE_FLOW) )
           continue;
@@ -2801,7 +2660,7 @@
         v31 = (v85 + v83 + v84) * (signed __int64)v29;
         v32 = v31 >> 16;
         goto LABEL_58;
-      }
+      }*/
       v28->sTextureDeltaU = 0;
       v28->sTextureDeltaV = 0;
       v34 = &pIndoor->pVertices[face->pVertexIDs[0]];
@@ -3557,7 +3416,7 @@
               r,
               g,
               b,
-              byte_4E94D0);
+              _4E94D0_light_type);
           }
         }
       }
@@ -4258,7 +4117,7 @@
       v41 |= 4u;
     if ( v10->uGlowRadius )
     {
-      //LOBYTE(v11) = byte_4E94D3;
+      //LOBYTE(v11) = _4E94D3_light_type;
       pMobileLightsStack->AddLight(
         a1a,
         a2,
@@ -4268,7 +4127,7 @@
         0xFFu,
         0xFFu,
         0xFFu,
-        byte_4E94D3);
+        _4E94D3_light_type);
     }
     v12 = 0;
     if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 )
@@ -4289,11 +4148,11 @@
     ++uNumBillboardsToDraw;
     ++uNumSpritesDrawnThisFrame;
     p->uAttributes |= 8u;
-    v29 = pRenderer->pRenderD3D == 0;
+    //v29 = pRenderer->pRenderD3D == 0;
     v0->uHwSpriteID = v10->pHwSpriteIDs[v32];
     v0->uPalette = v10->uPaletteIndex;
     v0->uIndoorSectorID = a5;
-    if ( v29 )
+    /*if ( v29 )
     {
       LODWORD(v20) = pBLVRenderParams->fov_rad_fixpoint << 16;
       HIDWORD(v20) = pBLVRenderParams->fov_rad_fixpoint >> 16;
@@ -4301,7 +4160,7 @@
       v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16;
       a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16;
     }
-    else
+    else*/
     {
       //v14 = &pGame->pIndoorCameraD3D;
       v0->fov_x = pGame->pIndoorCameraD3D->fov_x;
@@ -4450,7 +4309,7 @@
               v34 |= 4u;
             if ( a6 )
             {
-              LOBYTE(v11) = byte_4E94D3;
+              LOBYTE(v11) = _4E94D3_light_type;
               pMobileLightsStack->AddLight(
                 a1,
                 a2,
@@ -4460,7 +4319,7 @@
                 v1->uParticleTrailColorR,
                 v1->uParticleTrailColorG,
                 v1->uParticleTrailColorB,
-                byte_4E94D3);
+                _4E94D3_light_type);
             }
             if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV(
                    a1,
@@ -4482,7 +4341,7 @@
               //v12 = pRenderer->pRenderD3D == 0;
               v3->uPalette = v24->uPaletteIndex;
               v3->uIndoorSectorID = p->uSectorID;
-              if ( pRenderer->pRenderD3D )
+              //if ( pRenderer->pRenderD3D )
               {
                 v3->fov_x = pGame->pIndoorCameraD3D->fov_x;
                 v3->fov_y = pGame->pIndoorCameraD3D->fov_y;
@@ -4492,15 +4351,15 @@
                 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v18) >> 16;
                 v31 = (unsigned __int64)(v24->scale * v18) >> 16;
               }
-              else
+              /*else
               {
                 __debugbreak(); // sw rendering
-                /*LODWORD(v19) = pBLVRenderParams->field_40 << 16;
+                LODWORD(v19) = pBLVRenderParams->field_40 << 16;
                 HIDWORD(v19) = pBLVRenderParams->field_40 >> 16;
                 v20 = v19 / x;
                 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v19 / x) >> 16;
-                v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16;*/
-              }
+                v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16;
+              }*/
               //HIWORD(v21) = HIWORD(x);
               //LOWORD(v21) = 0;
               v3->_screenspace_y_scaler_packedfloat = v31;
@@ -4519,11 +4378,11 @@
               //v3->sZValue = v21 + v23;
               v3->actual_z = HIWORD(x);
               v3->object_pid = PID(OBJECT_Item,i);
-              if (p->uAttributes & 0x20)
+              /*if (p->uAttributes & 0x20)
               {
                 if ( !pRenderer->pRenderD3D )
                   v3->sZValue = 0;
-              }
+              }*/
             }
           }
         }
@@ -4537,17 +4396,17 @@
   BLVSector *pSector; // esi@1
 
   pSector = &pIndoor->pSectors[pBspRenderer->nodes[node_id].uSectorID];
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
   {
     for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i)
       //Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]);
       pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[i]);
   }
-  else
+  /*else
   {
     for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i)
       pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[i]);
-  }
+  }*/
   if ( pSector->field_0 & 0x10 )
     sub_4406BC(node_id, pSector->uFirstBSPNode);
 }
@@ -4594,16 +4453,16 @@
 
     //Log::Warning(L"Node %u: %X to %X (%hX)", uFirstNode, v7, v8, v2->pFaceIDs[v7]);
     
-    if ( pRenderer->pRenderD3D )
+    //if ( pRenderer->pRenderD3D )
     {
       while ( v7 < v8 )
         pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[v7++]);
     }
-    else
+    /*else
     {
       while ( v7 < v8 )
         pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[v7++]);
-    }
+    }*/
     v9 = v5 > 0 ? pNode->uFront : pNode->uBack;
     if ( v9 == -1 )
       break;
@@ -4718,11 +4577,11 @@
 
               ++uNumBillboardsToDraw;
               ++uNumDecorationsDrawnThisFrame;
-              v16 = pRenderer->pRenderD3D == 0;
+              //v16 = pRenderer->pRenderD3D == 0;
               v15->uHwSpriteID = v12->pHwSpriteIDs[v9];
               v15->uPalette = v12->uPaletteIndex;
               v15->uIndoorSectorID = uSectorID;
-              if ( v16 )
+              /*if ( v16 )
               {
                 LODWORD(v21) = pBLVRenderParams->fov_rad_fixpoint << 16;
                 HIDWORD(v21) = pBLVRenderParams->fov_rad_fixpoint >> 16;
@@ -4732,7 +4591,7 @@
                 v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v21 / x) >> 16;
                 v37 = (unsigned __int64)(v12->scale * (signed __int64)v37) >> 16;
               }
-              else
+              else*/
               {
                 v17 = &pGame->pIndoorCameraD3D;
                 v15->fov_x = pGame->pIndoorCameraD3D->fov_x;
@@ -6523,7 +6382,7 @@
   PortalFace._screen_space_x[bottom_num_vertices] = PortalFace._screen_space_x[0];
   PortalFace._screen_space_y[bottom_num_vertices] = PortalFace._screen_space_y[0];
 //check for software(ïðîâåðêà äëÿ ñîôòâàð)
-  if ( !pRenderer->pRenderD3D && bottom_num_vertices > 3 )
+  /*if ( !pRenderer->pRenderD3D && bottom_num_vertices > 3 )
   {
     PortalFace._screen_space_x[bottom_num_vertices + 1] = PortalFace._screen_space_x[1];
     PortalFace._screen_space_y[bottom_num_vertices + 1] = PortalFace._screen_space_y[1];
@@ -6569,7 +6428,7 @@
     }
     PortalFace._screen_space_x[bottom_num_vertices] = PortalFace._screen_space_x[0];
     PortalFace._screen_space_y[bottom_num_vertices] = PortalFace._screen_space_y[0];
-  }
+  }*/
   return bottom_num_vertices;
 }
 
--- a/IndoorCameraD3D.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/IndoorCameraD3D.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -233,7 +233,7 @@
     for (uint i = 0; i < uNumVertices; ++i)
     {
           float st0, st1, st2;
-          if ( pRenderer->pRenderD3D )
+          //if ( pRenderer->pRenderD3D )
           {
             /*__asm
             {
@@ -277,7 +277,7 @@
             st1 = cos_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) + sin_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
             st2 = (a1a[i].vWorldPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z);
           }
-          else
+          if (false)//else
           {
             /*__asm
             {
@@ -355,7 +355,7 @@
     {
       for (uint i = 0; i < uNumVertices; ++i)
       {
-          if ( pRenderer->pRenderD3D )
+          //if ( pRenderer->pRenderD3D )
           {
             /*__asm
             {
@@ -411,7 +411,7 @@
             a1a[i].vWorldViewPosition.y = sin_y * (a1a[i].vWorldPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) - cos_y * (a1a[i].vWorldPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
             a1a[i].vWorldViewPosition.z = (a1a[i].vWorldPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z);
           }
-          else
+          if (false)//else
           {
             __debugbreak();
             /*__asm
@@ -563,7 +563,7 @@
 void IndoorCameraD3D::do_draw_debug_line_d3d(const RenderVertexD3D3 *pLineBegin, signed int sDiffuseBegin, const RenderVertexD3D3 *pLineEnd, signed int sDiffuseEnd, float z_stuff)
 {
   double v6; // st7@2
-  IDirect3DDevice3 *v7; // eax@2
+  //IDirect3DDevice3 *v7; // eax@2
   HRESULT v8; // eax@2
   std::string v9; // [sp-18h] [bp-60h]@3
   const char *v10; // [sp-Ch] [bp-54h]@2
@@ -571,7 +571,7 @@
   int v12; // [sp-4h] [bp-4Ch]@2
   RenderVertexD3D3 v13[2]; // [sp+8h] [bp-40h]@2
 
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
   {
     v6 = 0.001 - z_stuff;
     memcpy(v13, pLineBegin, 0x20u);
@@ -581,7 +581,7 @@
     v12 = 0;
     v13[0].diffuse = sDiffuseBegin;
     v13[1].diffuse = sDiffuseEnd;
-    v7 = pRenderer->pRenderD3D->pDevice;
+    //v7 = pRenderer->pRenderD3D->pDevice;
     v11 = 0;
     //v10 = (const char *)v7;
     ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, nullptr));
@@ -592,10 +592,6 @@
            2,
            16));
   }
-  else
-  {
-    MessageBoxW(nullptr, L"draw_debug_line() not implemented for SW rendering", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Core3D.cpp:1415", 0);
-  }
 }
 
 //----- (00437AB5) --------------------------------------------------------
@@ -622,7 +618,7 @@
   IndoorCameraD3D *v25; // [sp+7C8h] [bp-4h]@1
 
   v25 = this;
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
   {
     v7 = (char *)&pVertices[0].flt_2C;
     v8 = 20;
@@ -708,8 +704,6 @@
       goto LABEL_11;
     }
   }
-  else
-    MessageBoxW(nullptr, L"draw_debug_line() not implemented for SW rendering", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Core3D.cpp:1383", 0);
 }
 
 //----- (00437A55) --------------------------------------------------------
@@ -1544,7 +1538,7 @@
   float a2a; // [sp+18h] [bp+8h]@2
   float a2b; // [sp+18h] [bp+8h]@2
 
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
   {
     v6 = 1.0 / (double)x;
     a2a = (double)y * fov * v6 + screenCenterX;
--- a/Indoor_stuff.h	Thu Jan 09 02:34:20 2014 +0200
+++ b/Indoor_stuff.h	Thu Jan 09 14:36:48 2014 +0200
@@ -90,7 +90,7 @@
     uNumVisibleNotEmptySectors = 0;
   }
 
-  void AddFaceToRenderList_sw(unsigned int node_id, unsigned int uFaceID);
+  //void AddFaceToRenderList_sw(unsigned int node_id, unsigned int uFaceID);
   void AddFaceToRenderList_d3d(unsigned int node_id, unsigned int uFaceID);
   void MakeVisibleSectorList();
   //void DrawFaceOutlines();
--- a/Keyboard.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/Keyboard.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -973,7 +973,7 @@
   int *v21; // [sp+18h] [bp-8h]@7
   int v22; // [sp+1Ch] [bp-4h]@4
 
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
   {
     pGame->PickKeyboard(GetAsyncKeyState(VK_CONTROL) & 0x8001, &vis_sprite_filter_3, &vis_door_filter);
     int pid = pGame->pVisInstance->get_picked_object_zbuf_val();
@@ -984,7 +984,7 @@
 
   
   // software render stuff following
-
+  /*
   static int dword_720660[100]; // 720660
   static int dword_7207F0[100]; // 7207F0
 
@@ -1086,5 +1086,5 @@
     LOBYTE(v1) = DoInteractionWithTopmostZObject(dword_720660[j] & 0xFFFF, v16);
     if ( !(char)v1 )
       break;
-  }
+  }*/
 }
--- a/LOD.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/LOD.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -233,7 +233,7 @@
     int i, sprite_indx;
 
     //find if already loaded
-    if ( pRenderer->pRenderD3D )
+    //if ( pRenderer->pRenderD3D )
         {
         for (i=0; i<uNumLoadedSprites;++i)
             {
@@ -241,20 +241,20 @@
                 return i;
             } 
         }
-    else
+    /*else
         {
         for (i=0; i<uNumLoadedSprites;++i)
             {
             if (!(_stricmp(pSpriteHeaders[i].pName, pContainerName)))
                 return i;
             } 
-        }
+        }*/
 
     if (uNumLoadedSprites >= 1500 )
         return -1;
     //if not loaded - load from file   
 
-    if ( pRenderer->pRenderD3D && field_ECAC )
+    //if ( pRenderer->pRenderD3D && can_load_hardware_sprites )
         {
         if ( !pHardwareSprites )
             {
@@ -281,7 +281,7 @@
         pSpriteHeaders[uNumLoadedSprites].uWidth = temp_sprite_hdr.uWidth;
         pSpriteHeaders[uNumLoadedSprites].uHeight = temp_sprite_hdr.uHeight;
         }
-    else
+    /*else
         {
         sprite_indx = LoadSpriteFromFile( &pSpriteHeaders[uNumLoadedSprites], pContainerName);
         pSpriteHeaders[uNumLoadedSprites].word_1A = 0;
@@ -306,9 +306,9 @@
                 return -1;
             pSpriteHeaders[uNumLoadedSprites].uPaletteId = pPaletteManager->LoadPalette(pSpriteHeaders[uNumLoadedSprites].uPaletteId);
             }
-        }
+        }*/
 
-    if ( pRenderer->pRenderD3D )
+    //if ( pRenderer->pRenderD3D )
         {
         pHardwareSprites[uNumLoadedSprites].pName = (const char *)malloc(20);
         strcpy((char *)pHardwareSprites[uNumLoadedSprites].pName, pContainerName);
@@ -1284,7 +1284,7 @@
   field_ECA4 = 0;
   field_ECA0 = 0;
   pHardwareSprites = 0;
-  field_ECAC = 0;
+  //can_load_hardware_sprites = 0;
   field_ECB4 = 0;
   uNumLoadedSprites = 0;
 }
@@ -1366,7 +1366,7 @@
   v1->dword_11B80 = 0;
   v1->uNumLoadedFiles = 0;
   v1->dword_011BA4 = 0;
-  v1->dword_011BA8 = 0;
+  //v1->can_load_hardware_sprites = 0;
   v1->pHardwareSurfaces = 0;
   v1->pHardwareTextures = 0;
   v1->ptr_011BB4 = 0;
@@ -2582,7 +2582,7 @@
   v8 = pOutTex;
   fread(pOutTex, 1u, 0x30u, pFile);
   strcpy(v8->pName, pContainer);
-  if (pRenderer->pRenderD3D && v8->pBits & 2 && dword_011BA8)
+  if (/*pRenderer->pRenderD3D &&*/ v8->pBits & 2)
   {
     if (!pHardwareSurfaces || !pHardwareTextures)
     {
--- a/LOD.h	Thu Jan 09 02:34:20 2014 +0200
+++ b/LOD.h	Thu Jan 09 14:36:48 2014 +0200
@@ -215,7 +215,7 @@
   int uTexturePacksCount;
   int pFacesLock;
   int dword_011BA4;
-  int dword_011BA8;
+  //int can_load_hardware_sprites;
   struct IDirectDrawSurface **pHardwareSurfaces;
   struct IDirect3DTexture2 **pHardwareTextures;
   char *ptr_011BB4;
@@ -299,7 +299,7 @@
   int field_ECA0;
   int field_ECA4;
   int field_ECA8;
-  int field_ECAC;
+  //int can_load_hardware_sprites;
   Sprite *pHardwareSprites;
   int field_ECB4;
 };
--- a/Level/Decoration.h	Thu Jan 09 02:34:20 2014 +0200
+++ b/Level/Decoration.h	Thu Jan 09 14:36:48 2014 +0200
@@ -42,5 +42,5 @@
 
 extern std::array<LevelDecoration, 3000> pLevelDecorations;
 extern size_t uNumLevelDecorations;
-extern LevelDecoration* activeLevelDecoration;
+extern LevelDecoration* activeLevelDecoration; // 5C3420
 #pragma pack(pop)
--- a/LightmapBuilder.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/LightmapBuilder.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -587,7 +587,7 @@
 
     BLVLightMM7* pLight = &pIndoor->pLights[pSector->pLights[i]];
     if (~pLight->uAtributes & 0x08)
-      ApplyLight_BLV((StationaryLight *)pLight, pFace, &uFaceID, false, &byte_4E94D0);
+      ApplyLight_BLV((StationaryLight *)pLight, pFace, &uFaceID, false, &_4E94D0_light_type);
   }
 
   for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i)
@@ -595,7 +595,7 @@
     if (uNumLightsApplied >= 20)
       break;
 
-    ApplyLight_BLV(pStationaryLightsStack->pLights + i, pFace, &uNumLightsApplied, false, &byte_4E94D0);
+    ApplyLight_BLV(pStationaryLightsStack->pLights + i, pFace, &uNumLightsApplied, false, &_4E94D0_light_type);
   }
 
   stru_F8AD28.uNumLightsApplied = uNumLightsApplied;
@@ -1004,7 +1004,7 @@
     stru_F8AD28._blv_lights_types[*pSlot] = pLight->uLightType;
     //v13 = pRenderer->pRenderD3D;
     v14 = stru_F8AD28._blv_lights_types[*pSlot];
-    if ( pRenderer->pRenderD3D && v12 && v14 & 4 )
+    if ( /*pRenderer->pRenderD3D &&*/ v12 && v14 & 4 )
       v14 = _4E94D2_light_type;
     stru_F8AD28._blv_lights_types[*pSlot] = v14;
     result = 4 * *pSlot;
@@ -1155,7 +1155,7 @@
   unsigned int *v53; // esi@18
   int v54; // eax@18
   unsigned int v55; // ebx@18
-  RenderD3D *v56; // ecx@18
+  //RenderD3D *v56; // ecx@18
   char v57; // dl@18
   std::string v58; // [sp-18h] [bp-38h]@10
   const char *v59; // [sp-8h] [bp-28h]@10
@@ -1290,13 +1290,13 @@
   v55 = pRenderer->bUsingSpecular;
   stru_F8AD28._blv_lights_light_dot_faces[*v53] = v54;
   stru_F8AD28._blv_lights_types[*v53] = v8->uLightType;
-  v56 = pRenderer->pRenderD3D;
+  //v56 = pRenderer->pRenderD3D;
   v57 = stru_F8AD28._blv_lights_types[*v53];
-  if ( pRenderer->pRenderD3D && v55 && v57 & 4 )
+  if ( /*pRenderer->pRenderD3D &&*/ v55 && v57 & 4 )
     v57 = _4E94D2_light_type;
   stru_F8AD28._blv_lights_types[*v53] = v57;
   result = 4 * *v53;
-  if ( v56 && v55 )
+  if ( /*v56 &&*/ v55 )
   {
     if ( stru_F8AD28._blv_lights_types[*v53] & 4 )
     {
--- a/Mouse.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/Mouse.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -563,10 +563,10 @@
     return;
   }
   y = pY;
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
     v5 = pGame->pVisInstance->get_picked_object_zbuf_val();
-  else
-    v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
+  /*else
+    v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];*/
 
   uint type = PID_TYPE((unsigned __int16)v5);
   if (type == OBJECT_Actor && uActiveCharacter && v5 < 0x2000000
--- a/OSWindow.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/OSWindow.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -321,8 +321,6 @@
 			  && pVideoPlayer->bPlayingMovie )
             pVideoPlayer->bStopBeforeSchedule = 1;
 
-          if (/*pRenderer->bUserDirect3D && */pRenderer->uAcquiredDirect3DDevice == 1)
-            SetWindowPos(api_handle, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u);
           ClipCursor(0);
           dword_6BE364_game_settings_1 |= GAME_SETTINGS_APP_INACTIVE;
           if ( pEventTimer->bPaused )
@@ -343,11 +341,6 @@
 
     case WM_SETFOCUS:
       dword_4E98BC_bApplicationActive = 0;
-      if (pRenderer)
-      {
-        if (/*pRenderer->bUserDirect3D && */pRenderer->uAcquiredDirect3DDevice == 1)
-          SetWindowPos(api_handle, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u);
-      }
       ClipCursor(0);
       return false;
 
@@ -356,28 +349,25 @@
       return false;
 
     case WM_PAINT:
-      if (pRenderer)
-      {
-        if ( !GetUpdateRect(api_handle, 0, 0) || !dword_4E98BC_bApplicationActive && !pRenderer->bWindowMode )
-          return *result = 0, true;
-      }
       if (!api_handle || !pRenderer)
         return false;
+
+      if ( !GetUpdateRect(api_handle, 0, 0) || !dword_4E98BC_bApplicationActive && !pRenderer->bWindowMode )
+        return *result = 0, true;
+
       PAINTSTRUCT Paint;
       BeginPaint(api_handle, &Paint);
       if ( pArcomageGame->bGameInProgress )
       {
         pArcomageGame->field_F9 = 1;
       }
-      else
+      if (pRenderer->AreRenderSurfacesOk())
       {
-        if (/*!pRenderer->pRenderD3D && !pRenderer->UsingDirect3D() ||*/ !AreRenderSurfacesOk())
-        {
-          EndPaint(api_handle, &Paint);
-          return *result = 0, true;
-        }
+        pRenderer->Present();
+        //EndPaint(api_handle, &Paint);
+        //return *result = 0, true;
       }
-      pRenderer->Present();
+
       EndPaint(api_handle, &Paint);
       return *result = 0, true;
 
--- a/Outdoor.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/Outdoor.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -1022,9 +1022,9 @@
   int g_mask = 0x7E0;
   int b_mask = 0x1F;
 
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
     result = 0;
-  else
+  /*else
   {
     __debugbreak();
     v5 = PaletteManager::Get_Dark_or_Red_LUT(a2, 0, 1);
@@ -1076,10 +1076,9 @@
       ++v15;
     }
     while ( v15 < 256 );
-  }
+  }*/
   return result;
 }
-// 47CB57: using guessed type char var_124[256];
 
 //----- (0047CCE2) --------------------------------------------------------
 bool OutdoorLocationTerrain::ZeroLandscape()
@@ -2970,8 +2969,8 @@
         v62 |= 4u;
       if ( v15->uGlowRadius )
       {
-        //LOBYTE(v16) = byte_4E94D3;
-        pMobileLightsStack->AddLight(x, y, z, 0, v15->uGlowRadius, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3);
+        //LOBYTE(v16) = _4E94D3_light_type;
+        pMobileLightsStack->AddLight(x, y, z, 0, v15->uGlowRadius, 0xFFu, 0xFFu, 0xFFu, _4E94D3_light_type);
       }
       v17 = (x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16;
       if (pGame->pIndoorCameraD3D->sRotationX)
--- a/Overlays.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/Overlays.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -135,10 +135,10 @@
   v4 = pIconsFrameTable->GetFrame(v5, v6);
 LABEL_14:
   v7 = &pIcons_LOD->pTextures[*((short *)v4 + 15)];
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
     pRenderer->DrawTextureIndexed(0x18Au, 0x120u, v7);
-  else
-    pRenderer->DrawTextureTransparent(0x18Au, 0x120u, v7);
+  /*else
+    pRenderer->DrawTextureTransparent(0x18Au, 0x120u, v7);*/
   result = dword_50C994;
   if ( dword_50C994 < dword_50C998_turnbased_icon_1A )
   {
--- a/ParticleEngine.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/ParticleEngine.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -140,7 +140,7 @@
   else
     DrawParticles_ODM();
 
-  if (pRenderer->pRenderD3D)
+  //if (pRenderer->pRenderD3D)
   {
     if (pLines.uNumLines)
     {
@@ -759,10 +759,10 @@
     if (particle->type == ParticleType_Invalid || !ViewProject_TrueIfStillVisible_ODM(i))
       continue;
 
-        if ( !pRenderer->pRenderD3D )
+        /*if ( !pRenderer->pRenderD3D )
         {
           __debugbreak();
-          /*v10 = 13 * particle->_screenspace_scale >> 16;
+          v10 = 13 * particle->_screenspace_scale >> 16;
           if ( v10 > 30 )
             v10 = 30;
           v11 = particle->uScreenSpaceX - (v10 >> 1);
@@ -777,9 +777,9 @@
           else
           {
             pRenderer->MakeParticleBillboardAndPush_BLV_Software(v11, v12, particle->sZValue, particle->uLightColor_bgr, v10);
-          }*/
+          }
         }
-        //else
+        else*/
 
           //v8 = *(_DWORD *)(v7 - 82);
           if (particle->type & ParticleType_Diffuse)
--- a/Party.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/Party.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -837,7 +837,7 @@
   pParty->uCurrentMonth = v5 % 0xC;
   pParty->uCurrentYear = v5 / 0xC + game_starting_year;
   pParty->RestAndHeal();
-  dword_507B94 = 1;
+
   for (int i = 0; i < 4; i++)
   {
     pParty->pPlayers[i].uTimeToRecovery = 0;
--- a/Player.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/Player.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -4681,7 +4681,7 @@
       pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
       return;
     }
-    dword_50C9AC = 1;
+
     scroll_id = pParty->pPickedItem.uItemID - 299;
     if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura
     {
@@ -7367,7 +7367,7 @@
             }
             else
             {
-              if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS)
+              if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS)
               {
                 int splatRadius = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius;
                 pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)splatRadius, 0, 0);
@@ -7559,7 +7559,7 @@
               }
               else
               {
-                if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
+                if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
                 {
                   int splatRadius = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius;
                   pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)splatRadius, 0, 0);
--- a/Render.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/Render.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -80,7 +80,7 @@
 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut); // idb
 
 //----- (0049E79F) --------------------------------------------------------
-bool CheckTextureStages()
+bool Render::CheckTextureStages()
 {
   bool v0; // edi@1
   IDirectDrawSurface4 *pSurface2; // [sp+Ch] [bp-14h]@1
@@ -90,30 +90,30 @@
   IDirect3DTexture2 *pTexture1; // [sp+1Ch] [bp-4h]@1
 
   v0 = false;
-  pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface1, &pTexture1, true, false, 32u);
-  pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface2, &pTexture2, true, false, 32u);
-
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture1));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 2u));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 1u));
-
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture2));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 1u));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 7u));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG1, 2u));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG2, 1u));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MAGFILTER, 2u));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MINFILTER, 2u));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MIPFILTER, 1u));
-
-  if ( !pRenderer->pRenderD3D->pDevice->ValidateDevice(&v4) && v4 == 1 )
+  pRenderD3D->CreateTexture(64u, 64u, &pSurface1, &pTexture1, true, false, 32u);
+  pRenderD3D->CreateTexture(64u, 64u, &pSurface2, &pTexture2, true, false, 32u);
+
+  ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture1));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 2));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 1));
+
+  ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture2));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 1));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 7));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG1, 2));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG2, 1));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MAGFILTER, 2));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MINFILTER, 2));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MIPFILTER, 1));
+
+  if ( !pRenderD3D->pDevice->ValidateDevice(&v4) && v4 == 1 )
     v0 = true;
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 1u));
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 1u));
   pTexture1->Release();
   pTexture2->Release();
   pSurface1->Release();
@@ -200,28 +200,9 @@
 }
 
 //----- (004A16A5) --------------------------------------------------------
-bool AreRenderSurfacesOk()
-{
-  char v0; // zf@4
-  bool result; // eax@8
-
-  if (!pRenderer)
-    return true;
-
-  {
-    if ( !pRenderer->pBackBuffer4 )
-      goto LABEL_9;
-    v0 = pRenderer->pFrontBuffer4 == 0;
-  }
-
-  if ( !v0 )
-  {
-    LOBYTE(result) = 1;
-    return result;
-  }
-LABEL_9:
-  LOBYTE(result) = 0;
-  return result;
+bool Render::AreRenderSurfacesOk()
+{
+  return pFrontBuffer4 && pBackBuffer4;
 }
 
 
@@ -614,8 +595,8 @@
               LOBYTE(v46) = v46 | 0x80;
             if ( a6 )
             {
-              //LOBYTE(v11) = byte_4E94D3;
-              pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3);
+              //LOBYTE(v11) = _4E94D3_light_type;
+              pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, _4E94D3_light_type);
             }
             v12 = (x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16;
             if (pGame->pIndoorCameraD3D->sRotationX)
@@ -1113,7 +1094,7 @@
               v14,
               v15,
               v16,
-              byte_4E94D0);
+              _4E94D0_light_type);
           }
           v17 = (decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16;
           if (pGame->pIndoorCameraD3D->sRotationX)
@@ -1716,20 +1697,20 @@
   }
   else
   {
-    if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & 0x10) )
+    if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & D3DPBLENDCAPS_SRCALPHA) )
       v1 = 2;
-    if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & 2) )
+    if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & D3DPBLENDCAPS_ONE) )
       v1 |= 4u;
-    if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & 1) )
+    if ( !(halCaps.dpcTriCaps.dwSrcBlendCaps & D3DPBLENDCAPS_ZERO) )
       v1 |= 8u;
-    if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & 0x20) )
+    if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & D3DPBLENDCAPS_INVSRCALPHA) )
       v1 |= 0x10u;
-    if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & 2) )
+    if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & D3DPBLENDCAPS_ONE) )
       v1 |= 0x20u;
-    if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & 4) )
+    if ( !(halCaps.dpcTriCaps.dwDestBlendCaps & D3DPBLENDCAPS_SRCCOLOR) )
       v1 |= 0x40u;
-    if ( halCaps.dpcTriCaps.dwTextureCaps & 0x20 )
-      LOBYTE(v1) = v1 | 0x80;
+    if ( halCaps.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_SQUAREONLY )
+      v1 |= 0x80;
     result = v1;
   }
   return result;
@@ -2119,7 +2100,7 @@
   this->pDirectDraw4 = 0;
   this->pFrontBuffer4 = 0;
   this->pBackBuffer4 = 0;
-  this->pColorKeySurface4 = 0;
+  //this->pColorKeySurface4 = 0;
   //this->pDirectDraw2 = 0;
   //this->pFrontBuffer2 = 0;
   //this->pBackBuffer2 = 0;
@@ -2127,25 +2108,25 @@
   //RenderHWLContainer::RenderHWLContainer(&this->pD3DBitmaps);
   //RenderHWLContainer::RenderHWLContainer(&v1->pD3DSprites);
   v1->bWindowMode = 1;
-  v1->field_40054 = 0;
-  v1->field_10 = 640;
-  v1->field_14 = 480;
-  v1->field_40030 = 0;
-  v1->field_4002C = 0;
+  //v1->field_40054 = 0;
+  //v1->field_10 = 640;
+  //v1->field_14 = 480;
+  //v1->field_40030 = 0;
+  //v1->field_4002C = 0;
   v1->pActiveZBuffer = 0;
   v1->pDefaultZBuffer = 0;
   v1->raster_clip_y = 0;
   v1->raster_clip_x = 0;
   v1->raster_clip_z = 639;
   v1->raster_clip_w = 479;
-  v1->field_4003C = (int)&unk_4EED80;
-  v1->field_40040 = dword_4EED78;
+  //v1->field_4003C = 0x004EED80;
+  //v1->field_40040 = dword_4EED78;
   v1->uClipZ = 640;
-  v1->field_40044 = 2;
-  v1->field_40048 = 6;
+  //v1->field_40044 = 2;
+  //v1->field_40048 = 6;
   v1->pFrontBuffer4 = 0;
   v1->pBackBuffer4 = 0;
-  v1->pColorKeySurface4 = 0;
+  //v1->pColorKeySurface4 = 0;
   v1->pDirectDraw4 = 0;
   v1->pRenderD3D = 0;
   v1->uNumSceneBegins = 0;
@@ -2160,7 +2141,7 @@
   //v1->bColorKeySupported = 0;
   v1->bRequiredTextureStagesAvailable = 0;
   v1->bTinting = 1;
-  LOBYTE(v1->field_103668) = 0;
+  //LOBYTE(v1->field_103668) = 0;
   uNumBillboardsToDraw = 0;
   bFogEnabled = false;
 
@@ -2195,13 +2176,13 @@
 //----- (0049ECC4) --------------------------------------------------------
 void Render::ClearBlack()
 {
-  if (pRenderD3D)
+  //if (pRenderD3D)
   {
     if (using_software_screen_buffer)
       pRenderD3D->ClearTarget(true, 0, false, 0.0);
   }
-  else
-    memset(pRenderer->pTargetSurface, 0, 4 * (field_10 * field_14 / 2));
+  //else
+    //memset(pRenderer->pTargetSurface, 0, 4 * (field_10 * field_14 / 2));
 }
 
 //----- (0049ED18) --------------------------------------------------------
@@ -2267,9 +2248,9 @@
     File = fopen(Filename, "wb");
     if ( File )
     {
-      pitch = this->field_10;
-      if ( this->field_10 & 1 )
-        pitch = this->field_10 + 1;
+      pitch = this->GetRenderWidth();
+      if ( pitch & 1 )
+        pitch = pitch + 1;
       if ( this->pRenderD3D )
       {
         memset(&Dst, 0, 0x7C);
@@ -2285,9 +2266,9 @@
         surface = pRenderer->pTargetSurface;
         v5 = pRenderer->uTargetSurfacePitch;
       }
-      header1.right = this->field_10 - 1;
+      header1.right = GetRenderWidth() - 1;
       header1.left = 0;
-      header1.bottom = this->field_14 - 1;
+      header1.bottom = this->GetRenderHeight() - 1;
       header1.up = 0;
       header2.pitch = pitch;
       memset(color_map, 0, sizeof(color_map));
@@ -2318,20 +2299,20 @@
       fwrite(&header2.pitch, 2, 1, pOutFile);
       fwrite(&header2.palette_info, 2, 1, pOutFile);
       fwrite(v15, 0x3Au, 1, pOutFile);
-      lineRGB = (char *)malloc(3 * this->field_10 + 6);
-      if ( this->field_14 > 0 )
+      lineRGB = (char *)malloc(3 * GetRenderWidth() + 6);
+      if ( this->GetRenderHeight() > 0 )
       {
         image_width = 3 * pitch;
         //v24 = 2 * v5;
         v8 = (unsigned short *)surface;
-        for ( int y = 0; y < this->field_14; y++ )
+        for ( int y = 0; y < this->GetRenderHeight(); y++ )
         {
           line_picture_data = v8;
-          if ( this->field_10 > 0 )
+          if ( GetRenderWidth() > 0 )
           {
             lineG = (char *)lineRGB + pitch;
             lineB = (char *)lineRGB + 2 * pitch;
-            for ( uint x = 0; x < this->field_10; x++ )
+            for ( uint x = 0; x < this->GetRenderWidth(); x++ )
             {
 			  int p = *line_picture_data; //0x2818
               int for_rad = (pRenderer->uTargetGBits + pRenderer->uTargetBBits );//16 = 8 + 8
@@ -2435,14 +2416,16 @@
 
   if ( !this->pRenderD3D || this->using_software_screen_buffer )
   {
-    ++dword_4EFA84;
+    static int _4EFA84_num_winners_certificates = 0;
+    ++_4EFA84_num_winners_certificates;
+
     File = fopen(a1, "wb");
     if ( File )
     {
-      v25 = this->field_10;
-      pitch = this->field_10;
-      if ( this->field_10 & 1 )
-        pitch = this->field_10 + 1;
+      v25 = this->GetRenderWidth();
+      pitch = v25;
+      if ( pitch & 1 )
+        pitch = pitch + 1;
       if ( this->pRenderD3D )
       {
         memset(&Dst, 0, 0x7C);
@@ -2458,9 +2441,9 @@
         surface = pRenderer->pTargetSurface;
         v6 = pRenderer->uTargetSurfacePitch;
       }
-      v33 = this->field_10 - 1;
+      v33 = this->GetRenderWidth() - 1;
       v31 = 0;
-      v34 = (short)this->field_14 - 1;
+      v34 = (short)this->GetRenderHeight() - 1;
       v32 = 0;
       v39 = pitch;
       memset(&color_map, 0, sizeof(color_map));
@@ -2492,11 +2475,11 @@
       fwrite(&v40, 2, 1, File);
       fwrite(&v16, 0x3A, 1, File);
       lineRGB = (char *)malloc(3 * (v25 + 2));
-      if ( (signed int)this->field_14 > 0 )
+      if ( (signed int)this->GetRenderHeight() > 0 )
       {
         image_width = 3 * pitch;
         v9 = (unsigned short *)surface;
-        for ( uint j = 0; j < this->field_14; j++)
+        for ( uint j = 0; j < this->GetRenderHeight(); j++)
         {
           a1 = (const char *)v9;
           if ( v25 > 0 )
@@ -2543,7 +2526,6 @@
     }
   }
 }
-// 4EFA84: using guessed type int dword_4EFA84;
 
 //----- (0049F5A2) --------------------------------------------------------
 void Render::PackPCXpicture( unsigned short* picture_data, int wight, int heidth, void *data_buff, int max_buff_size,unsigned int* packed_size )
@@ -2812,13 +2794,13 @@
 //----- (0049FBCD) --------------------------------------------------------
 void Render::ClearTarget(unsigned int uColor)
 {
-  if (pRenderD3D)
+  //if (pRenderD3D)
   {
     if (using_software_screen_buffer)
       pRenderD3D->ClearTarget(true, uColor, false, 0.0);
   }
-  else
-    memset32(pTargetSurface, uColor, field_10 * field_14 / 2);
+  //else
+    //memset32(pTargetSurface, uColor, field_10 * field_14 / 2);
 }
 
 //----- (0049FC23) --------------------------------------------------------
@@ -2877,7 +2859,7 @@
 }
 
 //----- (0049FD3A) --------------------------------------------------------
-void Render::_49FD3A()
+void Render::_49FD3A_fullscreen()
 {
   Render *v2; // esi@1
   IDirectDrawSurface4 *v3; // eax@6
@@ -2942,7 +2924,7 @@
       pRenderD3D->Present(0);
       pRenderD3D->ClearTarget(true, 0, false, 1.0);
     }
-    v1->pColorKeySurface4 = 0;
+    //v1->pColorKeySurface4 = 0;
     v1->pBackBuffer4 = 0;
     v1->pFrontBuffer4 = 0;
     v1->pDirectDraw4 = 0;
@@ -3106,8 +3088,8 @@
 
   if ( !pRenderer->uNumSceneBegins )
   {
-    if ( pRenderer->using_software_screen_buffer )
-    {
+    //if ( pRenderer->using_software_screen_buffer )
+    //{
       memset(&Dst, 0, 0x7Cu);
       Dst.dwSize = 124;
       if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
@@ -3238,18 +3220,10 @@
           }
         }*/
       }
-    }
-  }
-}
-
-
-
-
-//----- (0049FFD7) --------------------------------------------------------
-void Render::CreateSomeTexture()
-{
-  pRenderD3D->CreateTexture(64, 64, &pSurface, &pTexture, true, false, 32);
-}
+    //}
+  }
+}
+
 
 //----- (0049FFFB) --------------------------------------------------------
 bool Render::InitializeFullscreen()
@@ -3286,7 +3260,7 @@
 
   //v2 = this;
   this->using_software_screen_buffer = 0;
-  this->pColorKeySurface4 = 0;
+  //this->pColorKeySurface4 = 0;
   this->pBackBuffer4 = 0;
   this->pFrontBuffer4 = 0;
   this->pDirectDraw4 = 0;
@@ -3314,14 +3288,12 @@
     if ( v7[v6].bIsDeviceCompatible )
     {
       v8 = pRenderD3D->CreateDevice(v6, /*0*/true, window);
-      uAcquiredDirect3DDevice = uDesiredDirect3DDevice;
     }
     else
     {
       if ( v7[1].bIsDeviceCompatible )
       {
         v8 = pRenderD3D->CreateDevice(1, /*0*/true, window);
-        uAcquiredDirect3DDevice = 1;
       }
       else
       {
@@ -3329,7 +3301,6 @@
           Error("There aren't any D3D devices to create.");
 
         v8 = pRenderD3D->CreateDevice(0, /*0*/true, window);
-        uAcquiredDirect3DDevice = 1;
       }
     }
     if ( !v8 )
@@ -3360,7 +3331,7 @@
         pRenderD3D->Release();
         delete pRenderD3D;
       }
-      pColorKeySurface4 = 0;
+      //pColorKeySurface4 = 0;
       pRenderD3D = 0;
       pBackBuffer4 = 0;
       pFrontBuffer4 = 0;
@@ -3380,7 +3351,7 @@
       pDirectDraw4 = 0;
       Error("Direct3D renderer:  The device doesn't support non-square textures.");
     }
-    LOBYTE(field_10365C) = ~(unsigned __int8)(v10 >> 6) & 1;
+    //LOBYTE(field_10365C) = ~(unsigned __int8)(v10 >> 6) & 1;
     bRequiredTextureStagesAvailable = CheckTextureStages();
     memset(&halCaps, 0, 0xFCu);
     halCaps.dwSize = 252;
@@ -3398,24 +3369,23 @@
     uMaxDeviceTextureDim = v14;
     if ( (unsigned int)v13 < 4 )
       uMinDeviceTextureDim = 4;
-    CreateSomeTexture();
     v15 = 1;
     ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, true));
     ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true));
-    ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2u));
+    ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2));
     ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SPECULARENABLE, false));
     ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, false));
     ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE, false));
-    ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1u));
-    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u));
-    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u));
-    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 3u));
-    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, 2u));
+    ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1));
+    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2));
+    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2));
+    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 3));
+    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, 2));
     ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, 0));
-    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, 2u));
-    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u));
+    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, 2));
+    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2));
     ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG2, 0));
-    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 4u));
+    ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 4));
   //}
   ddpfPrimarySuface.dwSize = 32;
   GetTargetPixelFormat(&ddpfPrimarySuface);
@@ -3509,7 +3479,7 @@
   pViewport->SetFOV(flt_6BE3A0 * 65536.0f);
   using_software_screen_buffer = 0;
   Release();
-  pColorKeySurface4 = 0;
+  //pColorKeySurface4 = 0;
   pBackBuffer4 = 0;
   pFrontBuffer4 = 0;
   pDirectDraw4 = 0;
@@ -3544,7 +3514,6 @@
         uDesiredDirect3DDevice != 1 )
     {
       v7 = pRenderD3D->CreateDevice(uDesiredDirect3DDevice, true, window);
-      uAcquiredDirect3DDevice = uDesiredDirect3DDevice;
     }
     else
     {
@@ -3552,13 +3521,12 @@
         Error("There aren't any D3D devices to init.");
 
       v7 = pRenderD3D->CreateDevice(0, true, window);
-      uAcquiredDirect3DDevice = 0;
     }
     if ( !v7 )
       Error("D3Drend->Init failed.");
 
     //v8 = pRenderD3D;
-    pColorKeySurface4 = 0;
+    //pColorKeySurface4 = 0;
     pBackBuffer4 = pRenderD3D->pBackBuffer;
     pFrontBuffer4 = pRenderD3D->pFrontBuffer;
     pDirectDraw4 = pRenderD3D->pHost;
@@ -3583,14 +3551,14 @@
         pRenderD3D->Release();
         delete pRenderD3D;
       }
-      pColorKeySurface4 = 0;
+      //pColorKeySurface4 = 0;
       pRenderD3D = 0;
       pBackBuffer4 = 0;
       pFrontBuffer4 = 0;
       pDirectDraw4 = 0;
       Error("Direct3D renderer:  The device doesn't support the necessary alpha blending modes.");
     }
-    if ( (v9 & 0x80u) != 0 )
+    if (v9 & 0x80)
     {
       if (pRenderD3D)
       {
@@ -3603,7 +3571,7 @@
       pDirectDraw4 = 0;
       Error("Direct3D renderer:  The device doesn't support non-square textures.");
     }
-    LOBYTE(field_10365C) = ~(unsigned __int8)(v9 >> 6) & 1;
+    //LOBYTE(field_10365C) = ~(unsigned __int8)(v9 >> 6) & 1;
     bRequiredTextureStagesAvailable = CheckTextureStages();
     memset(&halCaps, 0, 0xFCu);
     halCaps.dwSize = 252;
@@ -3619,7 +3587,6 @@
     if ( (unsigned int)halCaps.dwMaxTextureWidth < halCaps.dwMaxTextureHeight )
       v13 = halCaps.dwMaxTextureHeight;
     uMaxDeviceTextureDim = v13;
-    CreateSomeTexture();
     ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, 1u));
     ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u));
     ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2u));
@@ -3715,6 +3682,26 @@
       goto LABEL_45;
 }
 
+
+//----- (0044F2B2) --------------------------------------------------------
+bool Render::IsGammaSupported()
+{
+  bool result; // eax@3
+  HRESULT v1; // eax@4
+
+  //if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
+  {
+    DDCAPS halCaps; // [sp+0h] [bp-180h]@4
+    memset(&halCaps, 0, sizeof(DDCAPS));
+    halCaps.dwSize = sizeof(DDCAPS);
+
+    ErrD3D(pDirectDraw4->GetCaps(&halCaps, 0));
+    return (halCaps.dwCaps2 >> 17) & 1;
+  }
+  /*else
+    return false;*/
+}
+
 //----- (004A0BEE) --------------------------------------------------------
 void Render::RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor)
 {
@@ -4194,7 +4181,7 @@
 void Render::CreateDirectDrawPrimarySurface()
 {
   Render *v1; // esi@1
-  int v2; // ebx@3
+  //int v2; // ebx@3
   IDirectDraw2 *v3; // eax@3
   HRESULT v4; // eax@3
   IDirectDrawSurface *pFrontBuffer; // eax@3
@@ -4216,8 +4203,8 @@
   //if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
       //pVersion->pVersionInfo.dwMajorVersion != 4 )
   {
-    v2 = 0;
-    this->field_4004C = 1;
+    //v2 = 0;
+    //this->field_4004C = 1;
     memset(&ddsd2, 0, 0x7Cu);
     v7 = v1->pDirectDraw4;
     ddsd2.dwBackBufferCount = 1;
@@ -4258,8 +4245,8 @@
     v17.dwCaps = 4;
   ErrD3D(pFrontBuffer->GetAttachedSurface((DDSCAPS *)&v17, ppBackBuffer));//  hr = this->pFrontBuffer->GetAttachedSurface(&ddsCaps2, ppBackBuffer);
   //CheckHRESULT(&thisa, v11, (const char *)v10, v9, (unsigned int)ppBackBuffer);
-  v1->field_40030 = v2;
-  v1->field_18_locked_pitch = v2;
+  //v1->field_40030 = v2;
+  //v1->field_18_locked_pitch = v2;
 }
 
 //----- (004A14F4) --------------------------------------------------------
@@ -4518,7 +4505,7 @@
 {
   if (!uNumD3DSceneBegins++)
   {
-    if (pRenderD3D)
+    //if (pRenderD3D)
     {
       pRenderD3D->ClearTarget(true, 0x00F08020, true, 1.0);
       pRenderer->uNumBillboardsToDraw = 0;
@@ -4542,14 +4529,14 @@
         bUsingSpecular = 0;
       }
     }
-    else
+    /*else
     {
       LockRenderSurface((void **)&pTargetSurface, &uTargetSurfacePitch);
       if (pTargetSurface)
         field_18_locked_pitch = uTargetSurfacePitch;
       else
         --uNumD3DSceneBegins;
-    }
+    }*/
   }
 }
 
@@ -6469,10 +6456,10 @@
       if ( !this->pTargetSurface )
       {
         LockRenderSurface((void **)&this->pTargetSurface, &this->uTargetSurfacePitch);
-        if ( this->pTargetSurface )
+        /*if ( this->pTargetSurface )
         {
           this->field_18_locked_pitch = this->uTargetSurfacePitch;
-        }
+        }*/
         --this->uNumSceneBegins;
       }
     }
@@ -6502,7 +6489,7 @@
       {
         this->pTargetSurface = 0;
         this->uTargetSurfacePitch = 0;
-        this->field_18_locked_pitch = 0;
+        //this->field_18_locked_pitch = 0;
         UnlockBackBuffer();
       }
     }
@@ -8351,7 +8338,7 @@
     ModalWindow(pGlobalTXT_LocalizationStrings[62], UIMSG_0);// "Might and Magic VII requires your desktop to be in 16bit (32k or 65k) Color mode in order to operate in a window."
     return;
   }*/
-  if ( pRenderer->bWindowMode || !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible )
+  if ( pRenderer->bWindowMode || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible )
   {
     if ( pEventTimer->bPaused )
       dword_6BE364_game_settings_1 |= GAME_SETTINGS_0800;
@@ -9239,4 +9226,172 @@
       return true;
   }
   return false;
-}
\ No newline at end of file
+}
+
+
+//----- (0045E03A) --------------------------------------------------------
+unsigned short *Render::MakeScreenshot(signed int width, signed int height)
+{
+  unsigned __int16 *v3; // ebx@1
+  int v4; // edx@7
+  unsigned __int8 v5; // cf@9
+  unsigned int v6; // ecx@9
+  unsigned __int16 *v7; // edi@9
+  int j; // ecx@9
+  unsigned int screen_x; // qax@18
+  HRESULT v14; // eax@21
+  int v15; // edi@29
+  signed __int64 v16; // qax@30
+  signed int v17; // edx@34
+  unsigned __int16 *v18; // edi@36
+  int k; // ecx@36
+  DDSURFACEDESC2 Dst; // [sp+4h] [bp-A0h]@6
+  unsigned __int16 *pPixels; // [sp+80h] [bp-24h]@1
+  float interval_x; // [sp+84h] [bp-20h]@1
+  unsigned __int16 *_this; // [sp+88h] [bp-1Ch]@21
+  float interval_y; // [sp+8Ch] [bp-18h]@1
+  unsigned int screen_y; // [sp+90h] [bp-14h]@17
+  int v28; // [sp+98h] [bp-Ch]@16
+  int v29; // [sp+9Ch] [bp-8h]@15
+
+  interval_x = game_viewport_width / (double)width;
+  interval_y = game_viewport_height / (double)height;
+
+  pPixels = (unsigned __int16 *)malloc(2 * height * width);
+  memset(pPixels, 0 , 2 * height * width);
+
+  v3 = pPixels;
+
+    BeginSceneD3D();
+
+    if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
+      pIndoor->Draw();
+    else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
+      pOutdoor->Draw();
+
+    DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
+    memset(&Dst, 0, 0x7C);
+    Dst.dwSize = sizeof(Dst);
+
+    if ( LockSurface_DDraw4(pBackBuffer4, &Dst, DDLOCK_WAIT) )
+    {
+      for (uint y = 0; y < height; ++y)
+      {
+        for (uint x = 0; x < width; ++x)
+        {
+          //*v3 = pRenderer->ReadPixel16((int)(x* interval_x + 8.0), (int)(y * interval_y + 8.0));//screen_data[screen_y + (int)(x* interval_x + 8.0)];
+
+          if (Dst.ddpfPixelFormat.dwRGBBitCount == 32)
+          {
+            auto p = (unsigned __int32 *)Dst.lpSurface + (int)(x * interval_x + 8.0) + y/* (int)(y * interval_y + 8.0)*/ * Dst.lPitch;
+            *v3 = Color16((*p >> 16) & 255, (*p >> 8) & 255, *p & 255);
+          }
+          else if (Dst.ddpfPixelFormat.dwRGBBitCount == 16)
+          {
+            auto p = (unsigned __int16 *)Dst.lpSurface + (int)(x * interval_x + 8.0) + y * Dst.lPitch;
+            *v3 = *p;
+          }
+          else __debugbreak();
+          ++v3;
+        }
+      }
+      ErrD3D(pBackBuffer4->Unlock(0));
+    }
+    else
+    {
+      __debugbreak(); // unrefactored - black screenshot
+      v4 = height;
+      if ( height > 0 )
+      {
+        do
+        {
+          if ( width > 0 )
+          {
+            v5 = width & 1;
+            v6 = (unsigned int)width >> 1;
+            memset(v3, 0, 4 * ((unsigned int)width >> 1));
+            v7 = &v3[2 * v6];
+            for ( j = v5; j; --j )
+            {
+              *v7 = 0;
+              ++v7;
+            }
+            v3 += width;
+          }
+          --v4;
+        }
+        while ( v4 );
+      }
+    }
+
+    
+  /*if (!pRenderer->pRenderD3D)
+  {
+    pRenderer->BeginScene();
+    if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
+    {
+      pIndoor->Draw();
+    }
+    else
+    {
+      if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
+        pOutdoor->Draw();
+    }
+    _this = pRenderer->pTargetSurface;
+    v26 = pRenderer->uTargetSurfacePitch;
+    if ( pRenderer->pTargetSurface )
+    {
+      if ( height > 0 )
+      {
+        for ( v29 = 0; v29 < height; ++v29 )
+        {
+          if ( width > 0 )
+          {
+            v15 = v26 * (unsigned __int64)(signed __int64)((double)v29 * v25 + 8.0);
+            for ( v28 = 0; v28 < width; v28++ )
+            {
+              *v3 = _this[v15 + (int)(signed __int64)((double)v28 * v23 + 8.0)];
+              ++v3;
+            }
+          }
+        }
+      }
+    }
+    else
+    {
+      if ( height > 0 )
+      {
+        for ( v17 = height; v17; --v17 )
+        {
+          if ( width > 0 )
+          {
+            memset(v3, 0, 4 * ((unsigned int)width >> 1));
+            v18 = &v3[2 * ((unsigned int)width >> 1)];
+            for ( k = width & 1; k; --k )
+            {
+              *v18 = 0;
+              ++v18;
+            }
+            v3 += width;
+          }
+        }
+      }
+    }
+    pRenderer->EndScene();
+  }*/
+  return pPixels;
+}
+//----- (0045E26C) --------------------------------------------------------
+void Render::SaveScreenshot(const char *pFilename, unsigned int width, unsigned int height)
+{
+  auto pixels = pRenderer->MakeScreenshot(width, height);
+  pRenderer->SavePCXImage(pFilename, pixels, width, height);
+  free(pixels);
+}
+
+void Render::PackScreenshot(unsigned int width, unsigned int height, void *data, unsigned int data_size, unsigned int *out_screenshot_size)
+{
+  auto pixels = pRenderer->MakeScreenshot(150, 112);
+  pRenderer->PackPCXpicture(pixels, 150, 112, data, 1000000, out_screenshot_size);
+  free(pixels);
+}
--- a/Render.h	Thu Jan 09 02:34:20 2014 +0200
+++ b/Render.h	Thu Jan 09 14:36:48 2014 +0200
@@ -294,10 +294,9 @@
   void ClearTarget(unsigned int uColor);
   void Release2();
   void Present();
-  void _49FD3A();
+  void _49FD3A_fullscreen();
   void CreateZBuffer();
   void Release();
-  void CreateSomeTexture();
   bool InitializeFullscreen();
   bool SwitchToWindow();
   void RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor);
@@ -381,98 +380,107 @@
   void ChangeBetweenWinFullscreenModes();
   void DrawBillboardList_BLV();
   void __cdecl sub_4A19B0();
+  bool AreRenderSurfacesOk();
+  bool IsGammaSupported();
+  void SaveScreenshot(const char *pFilename, unsigned int width, unsigned int height);
+  void PackScreenshot(unsigned int width, unsigned int height, void *out_data, unsigned int data_size, unsigned int *screenshot_size);
 
+  void am_Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3);
+  void am_Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode);
 
+  protected:
   //unsigned int bUserDirect3D;
   //unsigned int bStartInWindow;
   unsigned int uDesiredDirect3DDevice;
-  unsigned int uAcquiredDirect3DDevice;
-  int field_10;
-  int field_14;
-  int field_18_locked_pitch;
-  int raster_clip_x;
-  int raster_clip_y;    // clipping rect for raster ops
-  int raster_clip_z;    //    like RasterLine2D for (mini)map
-  int raster_clip_w;
-  __int16 unused_2C[65536];
-  __int16 unused_2002C[65536];
-  int field_4002C;
-  int field_40030;
+  //unsigned int uAcquiredDirect3DDevice;
+  //int field_10;
+  //int field_14;
+  //int field_18_locked_pitch;
+  public: int raster_clip_x;
+  public: int raster_clip_y;    // clipping rect for raster ops
+  public: int raster_clip_z;    //    like RasterLine2D for (mini)map
+  public: int raster_clip_w;
+  //__int16 unused_2C[65536];
+  //__int16 unused_2002C[65536];
+  //int field_4002C;
+  //int field_40030;
   int *pActiveZBuffer;
   int *pDefaultZBuffer;
-  int field_4003C;
-  int field_40040;
-  int field_40044;
-  int field_40048;
-  int field_4004C;
+  //int field_4003C;
+  //int field_40040;
+  //int field_40044;
+  //int field_40048;
+  //int field_4004C;
   //HWND hWnd;
   OSWindow *window;
-  int field_40054;
+  //int field_40054;
   unsigned int bWindowMode;
-  int field_4005C[11];
-  RenderD3D *pRenderD3D;
-  IDirectDraw4 *pDirectDraw4;
-  IDirectDrawSurface4 *pFrontBuffer4;
-  IDirectDrawSurface4 *pBackBuffer4;
-  IDirectDrawSurface4 *pColorKeySurface4;
+  //int field_4005C[11];
+  public: RenderD3D *pRenderD3D;
+  public: IDirectDraw4 *pDirectDraw4;
+  public: IDirectDrawSurface4 *pFrontBuffer4;
+  public: IDirectDrawSurface4 *pBackBuffer4;
+  //IDirectDrawSurface4 *pColorKeySurface4;
   //IDirectDraw2 *pDirectDraw2;
   //IDirectDrawSurface2 *pFrontBuffer2;
   //IDirectDrawSurface2 *pBackBuffer2;
   //IDirectDrawSurface2 *pSomeSurface2;
-  DDPIXELFORMAT ddpfPrimarySuface;
-  unsigned int uTargetRBits;
-  unsigned int uTargetGBits;
-  unsigned int uTargetBBits;
-  unsigned int uTargetRMask;
-  unsigned int uTargetGMask;
-  unsigned int uTargetBMask;
-  unsigned int uNumSceneBegins;
-  unsigned __int32 *pTargetSurface_unaligned;
-  void             *pTargetSurface;
-  unsigned int uTargetSurfacePitch;
-  unsigned int uClipY;
-  unsigned int uClipX;
-  unsigned int uClipW;
-  unsigned int uClipZ;
-  unsigned int bClip;
+  protected: DDPIXELFORMAT ddpfPrimarySuface;
+  public: unsigned int uTargetRBits;
+  public: unsigned int uTargetGBits;
+  public: unsigned int uTargetBBits;
+  public: unsigned int uTargetRMask;
+  public: unsigned int uTargetGMask;
+  public: unsigned int uTargetBMask;
+  protected: unsigned int uNumSceneBegins;
+  protected: unsigned __int32 *pTargetSurface_unaligned;
+  public: void             *pTargetSurface;
+  public: unsigned int uTargetSurfacePitch;
+  public: unsigned int uClipY;
+  public: unsigned int uClipX;
+  public: unsigned int uClipW;
+  public: unsigned int uClipZ;
+  public: unsigned int bClip;
   //unsigned int bColorKeySupported;
-  unsigned int uNumD3DSceneBegins;
-  int using_software_screen_buffer;
-  RenderHWLContainer pD3DBitmaps;
-  RenderHWLContainer pD3DSprites;
-  unsigned int bUseColoredLights;
-  unsigned int bRequiredTextureStagesAvailable;
-  unsigned int bTinting;
-  unsigned int uLevelOfDetail;
-  unsigned int uMaxDeviceTextureDim;
-  unsigned int uMinDeviceTextureDim;
-  int field_10365C;
-  unsigned int bUsingSpecular;
-  uint32_t uFogColor;
-  int field_103668;
-  unsigned int pHDWaterBitmapIDs[7];
-  char field_103688[32];
-  int hd_water_current_frame;
-  int hd_water_tile_id;
-  IDirectDrawSurface4 *pSurface;
-  IDirect3DTexture2 *pTexture;
+  protected: unsigned int uNumD3DSceneBegins;
+  protected: int using_software_screen_buffer;
+  protected: RenderHWLContainer pD3DBitmaps;
+  protected: RenderHWLContainer pD3DSprites;
+  public: unsigned int bUseColoredLights;
+  protected: unsigned int bRequiredTextureStagesAvailable;
+  public: unsigned int bTinting;
+  protected: unsigned int uLevelOfDetail;
+  protected: unsigned int uMaxDeviceTextureDim;
+  protected: unsigned int uMinDeviceTextureDim;
+  //int field_10365C;
+  public: unsigned int bUsingSpecular;
+  public: uint32_t uFogColor;
+  //int field_103668;
+  public: unsigned int pHDWaterBitmapIDs[7];
+  //char field_103688[32];
+  public: int hd_water_current_frame;
+  public: int hd_water_tile_id;
+  //protected: IDirectDrawSurface4 *pSurface;
+  //protected: IDirect3DTexture2 *pTexture;
   //int field_1036B8;
   //int _gpu_memory_used;
-  void ( *pBeforePresentFunction)();
-  int field_1036C4;
-  uint32_t bFogEnabled;
-  int field_1036CC;
-  RenderBillboardD3D pBillboardRenderListD3D[1000];
-  unsigned int uNumBillboardsToDraw;
-  int field_129834;
+  public: void ( *pBeforePresentFunction)();
+  //int field_1036C4;
+  public: uint32_t bFogEnabled;
+  //int field_1036CC;
+  public: RenderBillboardD3D pBillboardRenderListD3D[1000];
+  public: unsigned int uNumBillboardsToDraw;
+  //int field_129834;
   //unsigned int uCurrentlyLockedSurfacePitch;
   //unsigned __int16 *pCurrentlyLockedSurfaceDataPtr;
   //void             *pCurrentlyLockedSoftSurface;
 
   protected:
-  void DoRenderBillboards_D3D();
-  void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1);
-  void DrawBorderTiles(struct Polygon *poly);
+    void DoRenderBillboards_D3D();
+    void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1);
+    void DrawBorderTiles(struct Polygon *poly);
+    unsigned short *MakeScreenshot(signed int width, signed int height);
+    bool CheckTextureStages();
 
   public:
   inline void WritePixel16(int x, int y, unsigned __int16 color)
@@ -509,12 +517,16 @@
   inline void ToggleTint()          {bTinting = !bTinting;}
   inline void ToggleColoredLights() {bUseColoredLights = !bUseColoredLights;}
 
+  inline unsigned int GetRenderWidth() {return window->GetWidth();}
+  inline unsigned int GetRenderHeight() {return window->GetHeight();}
+
   inline void Sub01()
   {
     if (pRenderD3D && !bWindowMode)
-      _49FD3A();
+      _49FD3A_fullscreen();
   }
 
+  friend void Present_NoColorKey();
 
   //int windowed_mode_width;
   //int windowed_mode_height;
--- a/SaveLoad.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/SaveLoad.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -229,7 +229,7 @@
 //----- (0045F469) --------------------------------------------------------
 void SaveGame( bool IsAutoSAve, bool NotSaveWorld )
 {
-  unsigned short *pScreenshot; // edi@5
+  //unsigned short *pScreenshot; // edi@5
   int text_pos; // eax@6
   FILE *pLLoidFile; // edi@24
   char* compressed_buf; // edi@30
@@ -278,10 +278,10 @@
     pIndoor->stru1.uLastVisitDay = pParty->uTimePlayed;
   else
     pOutdoor->loc_time.uLastVisitDay = pParty->uTimePlayed;
-  pScreenshot = MakeScreenshot(150, 112);
+
+  pRenderer->PackScreenshot(150, 112, uncompressed_buff, 1000000, &pLodDirectory.uDataSize);
   strcpy(pLodDirectory.pFilename, "image.pcx");
-  pRenderer->PackPCXpicture(pScreenshot, 150, 112, uncompressed_buff, 1000000, &pLodDirectory.uDataSize);
-  free(pScreenshot);
+
   if (pCurrentScreen == SCREEN_SAVEGAME)
   {
     pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave));
@@ -556,7 +556,7 @@
   viewparams->bRedrawGameUI = 1;
   for (uint i = 0; i < 45; i++)
     pSavegameThumbnails[i].Release();
-  //while ( (signed int)v3 < (signed int)&unk_6A0758 );
+
   if ( bNotArena )
     pNew_LOD->_4621A7();
   else
@@ -665,166 +665,4 @@
   }
   free(pSave);
 }
-//----- (0045E03A) --------------------------------------------------------
-unsigned short *MakeScreenshot( signed int width, signed int height )
-{
-  unsigned __int16 *v3; // ebx@1
-  int v4; // edx@7
-  unsigned __int8 v5; // cf@9
-  unsigned int v6; // ecx@9
-  unsigned __int16 *v7; // edi@9
-  int j; // ecx@9
-  unsigned int screen_x; // qax@18
-  HRESULT v14; // eax@21
-  int v15; // edi@29
-  signed __int64 v16; // qax@30
-  signed int v17; // edx@34
-  unsigned __int16 *v18; // edi@36
-  int k; // ecx@36
-  DDSURFACEDESC2 Dst; // [sp+4h] [bp-A0h]@6
-  unsigned __int16 *pPixels; // [sp+80h] [bp-24h]@1
-  float interval_x; // [sp+84h] [bp-20h]@1
-  unsigned __int16 *_this; // [sp+88h] [bp-1Ch]@21
-  float interval_y; // [sp+8Ch] [bp-18h]@1
-  unsigned int screen_y; // [sp+90h] [bp-14h]@17
-  int v28; // [sp+98h] [bp-Ch]@16
-  int v29; // [sp+9Ch] [bp-8h]@15
 
-  interval_x = game_viewport_width / (double)width;
-  interval_y = game_viewport_height / (double)height;
-
-  pPixels = (unsigned __int16 *)malloc(2 * height * width);
-  memset(pPixels, 0 , 2 * height * width);
-
-  v3 = pPixels;
-  if (!pRenderer->pRenderD3D)
-    __debugbreak();
-
-    pRenderer->BeginSceneD3D();
-
-    if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
-      pIndoor->Draw();
-    else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-      pOutdoor->Draw();
-
-    pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
-    memset(&Dst, 0, 0x7C);
-    Dst.dwSize = sizeof(Dst);
-
-    if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
-    {
-      for (uint y = 0; y < height; ++y)
-      {
-        for (uint x = 0; x < width; ++x)
-        {
-          //*v3 = pRenderer->ReadPixel16((int)(x* interval_x + 8.0), (int)(y * interval_y + 8.0));//screen_data[screen_y + (int)(x* interval_x + 8.0)];
-
-          if (Dst.ddpfPixelFormat.dwRGBBitCount == 32)
-          {
-            auto p = (unsigned __int32 *)Dst.lpSurface + (int)(x * interval_x + 8.0) + y/* (int)(y * interval_y + 8.0)*/ * Dst.lPitch;
-            *v3 = Color16((*p >> 16) & 255, (*p >> 8) & 255, *p & 255);
-          }
-          else if (Dst.ddpfPixelFormat.dwRGBBitCount == 16)
-          {
-            auto p = (unsigned __int16 *)Dst.lpSurface + (int)(x * interval_x + 8.0) + y * Dst.lPitch;
-            *v3 = *p;
-          }
-          else __debugbreak();
-          ++v3;
-        }
-      }
-      ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
-    }
-    else
-    {
-      __debugbreak(); // unrefactored
-      v4 = height;
-      if ( height > 0 )
-      {
-        do
-        {
-          if ( width > 0 )
-          {
-            v5 = width & 1;
-            v6 = (unsigned int)width >> 1;
-            memset(v3, 0, 4 * ((unsigned int)width >> 1));
-            v7 = &v3[2 * v6];
-            for ( j = v5; j; --j )
-            {
-              *v7 = 0;
-              ++v7;
-            }
-            v3 += width;
-          }
-          --v4;
-        }
-        while ( v4 );
-      }
-    }
-
-    
-  /*if (!pRenderer->pRenderD3D)
-  {
-    pRenderer->BeginScene();
-    if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-    {
-      pIndoor->Draw();
-    }
-    else
-    {
-      if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
-        pOutdoor->Draw();
-    }
-    _this = pRenderer->pTargetSurface;
-    v26 = pRenderer->uTargetSurfacePitch;
-    if ( pRenderer->pTargetSurface )
-    {
-      if ( height > 0 )
-      {
-        for ( v29 = 0; v29 < height; ++v29 )
-        {
-          if ( width > 0 )
-          {
-            v15 = v26 * (unsigned __int64)(signed __int64)((double)v29 * v25 + 8.0);
-            for ( v28 = 0; v28 < width; v28++ )
-            {
-              *v3 = _this[v15 + (int)(signed __int64)((double)v28 * v23 + 8.0)];
-              ++v3;
-            }
-          }
-        }
-      }
-    }
-    else
-    {
-      if ( height > 0 )
-      {
-        for ( v17 = height; v17; --v17 )
-        {
-          if ( width > 0 )
-          {
-            memset(v3, 0, 4 * ((unsigned int)width >> 1));
-            v18 = &v3[2 * ((unsigned int)width >> 1)];
-            for ( k = width & 1; k; --k )
-            {
-              *v18 = 0;
-              ++v18;
-            }
-            v3 += width;
-          }
-        }
-      }
-    }
-    pRenderer->EndScene();
-  }*/
-  return pPixels;
-}
-//----- (0045E26C) --------------------------------------------------------
-void  SaveScreenshot(const char *pFilename)
-{
-  unsigned short *screenshot; // esi@1
-
-  screenshot = MakeScreenshot(92, 68);
-  pRenderer->SavePCXImage(pFilename, screenshot, 92, 68);
-  free(screenshot);
-}
\ No newline at end of file
--- a/UI/UICharacter.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/UI/UICharacter.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -191,8 +191,8 @@
 //int paperdoll_array_51132C[165];
 unsigned int papredoll_dlaus[5];
 unsigned int papredoll_dlads[4];
-int papredoll_flying_feet[777]; // idb
-int paperdoll_boots_texture[4][6];//0x511638
+int papredoll_flying_feet[22]; // 005115E0
+int paperdoll_boots_texture[4][6];//511638
 int paperdoll_cloak_collar_texture[4][10]; // weak
 int paperdoll_cloak_texture[4][10];
 int paperdoll_helm_texture[2][16]; //511698
--- a/UI/UIOptions.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/UI/UIOptions.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -153,7 +153,7 @@
   GUIWindow msg_window; // [sp+8h] [bp-54h]@3
 
   pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(optvid_base_texture_id));//draw base texture
-  if ( !pRenderer->bWindowMode && GammaController::IsGammaSupported() )
+  if ( !pRenderer->bWindowMode && pRenderer->IsGammaSupported() )
   {
     pRenderer->DrawTextureIndexed(17 * uGammaPos + 42, 162, pIcons_LOD->GetTexture(pTextureIDs_GammaPositions[uGammaPos]));
     pRenderer->DrawTextureRGB(274, 169, &stru_506E40);//review_window
--- a/UI/UIPopup.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/UI/UIPopup.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -1434,12 +1434,12 @@
           v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
         if (PID_TYPE((unsigned __int16)v5) == OBJECT_Actor)
         {
-          if ( pRenderer->uNumSceneBegins )
+          /*if ( pRenderer->uNumSceneBegins )
           {
             popup_window.DrawMessageBox(1);
             MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window);
           }
-          else
+          else*/
           {
             pRenderer->BeginScene();
             popup_window.DrawMessageBox(1);
--- a/VideoPlayer.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/VideoPlayer.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -353,16 +353,16 @@
     OpenGlobalMovie(pName, 0, ScreenSizeFlag);
     bPlayingMovie = 1;
 	field_44 = v4;
-    if ( pRenderer->pRenderD3D )
+    //if ( pRenderer->pRenderD3D )
     {
       pRenderer->ClearTarget(0);
     }
-    else
+   /* else
     {
       pRenderer->BeginScene();
       pRenderer->ClearTarget(0);
       pRenderer->EndScene();
-    }
+    }*/
     pCurrentScreen = SCREEN_VIDEO;
 
 	auto hwnd = pVideoPlayer->window->GetApiHandle();
--- a/Viewport.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/Viewport.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -276,10 +276,10 @@
   int clickable_distance = 512;
 
   v1 = pMouse->GetCursorPos(&a2);
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
     v0 = pGame->pVisInstance->get_picked_object_zbuf_val();
-  else
-    v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[v1->y]];
+  //else
+  //  v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[v1->y]];
 
   if ( PID_TYPE(v0) == OBJECT_Item)
   {
--- a/_deleted.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/_deleted.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -14405,4 +14405,174 @@
   }
 }
 
+
+//----- (004A80DC) --------------------------------------------------------
+void stru6::_4A80DC_implosion_particle_sw(SpriteObject *a2)
+{
+  signed int v3; // ebx@1
+  Particle_sw local_0; // [sp+Ch] [bp-68h]@1
+
+  memset(&local_0, 0, 0x68u);
+  local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1;
+  local_0.uDiffuse = 0x7E7E7E;
+  local_0.timeToLive = (rand() & 0x7F) + 128;
+  local_0.uTextureID = uTextureID_effpar1;
+  v3 = 8;
+  local_0.flt_28 = 1.0;
+  do
+  {
+    local_0.x = pRnd->GetRandom() * 40.0 + (double)a2->vPosition.x - 20.0;
+    local_0.y = pRnd->GetRandom() * 40.0 + (double)a2->vPosition.y - 20.0;
+    local_0.z = (double)a2->vPosition.z;
+    local_0.r = pRnd->GetRandom() * 800.0 - 400.0;
+    local_0.g = pRnd->GetRandom() * 800.0 - 400.0;
+    local_0.b = pRnd->GetRandom() * 350.0 + 50.0;
+    pGame->pParticleEngine->AddParticle(&local_0);
+    --v3;
+  }
+  while ( v3 );
+}
+
+
+//----- (004AFB86) --------------------------------------------------------
+void BspRenderer::AddFaceToRenderList_sw(unsigned int node_id, unsigned int uFaceID)
+{
+  BspRenderer *v3; // ebx@1
+  BLVFace *v4; // eax@1
+  char *v5; // ecx@2
+  unsigned __int16 v6; // ax@11
+  int v7; // ecx@13
+  Vec3_short_ *v8; // esi@16
+  int v9; // edx@16
+  signed int v10; // eax@19
+  signed int v11; // edi@20
+  signed int v12; // ecx@20
+  signed int v13; // esi@20
+  int v14; // edx@21
+  int v15; // edx@25
+  unsigned __int16 v16; // ax@35
+  signed int v17; // eax@37
+  int v18; // eax@38
+  signed int v19; // [sp+Ch] [bp-14h]@19
+  char *v20; // [sp+14h] [bp-Ch]@2
+  BLVFace *v21; // [sp+18h] [bp-8h]@1
+  signed int v22; // [sp+1Ch] [bp-4h]@20
+  signed int v23; // [sp+28h] [bp+8h]@20
+
+  v3 = this;
+  v4 = &pIndoor->pFaces[uFaceID];
+  v21 = v4;
+  if (v4->Portal())
+  {
+    v5 = (char *)this + 2252 * node_id;
+    v20 = v5;
+    if ( uFaceID == *((short *)v5 + 2982) )
+      return;
+    if (!node_id
+      && pGame->pIndoorCameraD3D->vPartyPos.x >= v4->pBounding.x1 - 16
+      && pGame->pIndoorCameraD3D->vPartyPos.x <= v4->pBounding.x2 + 16
+      && pGame->pIndoorCameraD3D->vPartyPos.y >= v4->pBounding.y1 - 16
+      && pGame->pIndoorCameraD3D->vPartyPos.y <= v4->pBounding.y2 + 16
+      && pGame->pIndoorCameraD3D->vPartyPos.z >= v4->pBounding.z1 - 16
+      && pGame->pIndoorCameraD3D->vPartyPos.z <= v4->pBounding.z2 + 16 )
+    {
+      if ( abs(v4->pFacePlane_old.dist + pGame->pIndoorCameraD3D->vPartyPos.x * v4->pFacePlane_old.vNormal.x
+                                       + pGame->pIndoorCameraD3D->vPartyPos.y * v4->pFacePlane_old.vNormal.y
+                                       + pGame->pIndoorCameraD3D->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 )
+      {
+        v6 = v21->uSectorID;
+        if ( v3->nodes[0].uSectorID == v6 )
+          v6 = v21->uBackSectorID;
+        v3->nodes[v3->num_nodes].uSectorID = v6;
+        v3->nodes[v3->num_nodes].uFaceID = uFaceID;
+        v3->nodes[v3->num_nodes].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
+        v3->nodes[v3->num_nodes].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
+        v3->nodes[v3->num_nodes].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
+        v3->nodes[v3->num_nodes].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
+        v3->nodes[v3->num_nodes++].PortalScreenData.GetViewportData(
+          SLOWORD(pBLVRenderParams->uViewportX),
+          pBLVRenderParams->uViewportY,
+          SLOWORD(pBLVRenderParams->uViewportZ),
+          pBLVRenderParams->uViewportW);
+        v7 = v3->num_nodes - 1;
+        goto LABEL_14;
+      }
+      v4 = v21;
+      v5 = v20;
+    }
+    v8 = &pIndoor->pVertices[*v4->pVertexIDs];
+    v9 = v4->pFacePlane_old.vNormal.x * (v8->x - pGame->pIndoorCameraD3D->vPartyPos.x)
+       + v4->pFacePlane_old.vNormal.y * (v8->y - pGame->pIndoorCameraD3D->vPartyPos.y)
+       + v4->pFacePlane_old.vNormal.z * (v8->z - pGame->pIndoorCameraD3D->vPartyPos.z);
+    if ( *((short *)v5 + 2004) != v4->uSectorID )
+      v9 = -v9;
+    if ( v9 < 0 )
+    {
+      v10 = GetPortalScreenCoord(uFaceID);
+      v19 = v10;
+      if ( v10 )
+      {
+        v11 = PortalFace._screen_space_x[0];
+        v12 = PortalFace._screen_space_y[0];
+        v23 = PortalFace._screen_space_x[0];
+        v13 = 1;
+        v22 = PortalFace._screen_space_y[0];
+        if ( v10 > 1 )
+        {
+          do
+          {
+            v14 = PortalFace._screen_space_x[v13];
+            if ( v14 < v23 )
+              v23 = PortalFace._screen_space_x[v13];
+            if ( v14 > v11 )
+              v11 = PortalFace._screen_space_x[v13];
+            v15 = PortalFace._screen_space_y[v13];
+            if ( v15 < v22 )
+              v22 = PortalFace._screen_space_y[v13];
+            if ( v15 > v12 )
+              v12 = PortalFace._screen_space_y[v13];
+            v10 = v19;
+            ++v13;
+          }
+          while ( v13 < v19 );
+        }
+        if ( v11 >= *((short *)v20 + 2005)
+          && v23 <= *((short *)v20 + 2007)
+          && v12 >= *((short *)v20 + 2006)
+          && v22 <= *((short *)v20 + 2008)
+          && PortalFrustrum(v10, &v3->nodes[v3->num_nodes].PortalScreenData, (BspRenderer_PortalViewportData *)(v20 + 4020), uFaceID) )
+        {
+          v16 = v21->uSectorID;
+          if ( *((short *)v20 + 2004) == v16 )
+            v16 = v21->uBackSectorID;
+          v3->nodes[v3->num_nodes].uSectorID = v16;
+          v3->nodes[v3->num_nodes].uFaceID = uFaceID;
+          v3->nodes[v3->num_nodes].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
+          v3->nodes[v3->num_nodes].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
+          v3->nodes[v3->num_nodes].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
+          v3->nodes[v3->num_nodes].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
+          v17 = v3->num_nodes;
+          if ( v17 < 150 )
+          {
+            v18 = v17 + 1;
+            v3->num_nodes = v18;
+            v7 = v18 - 1;
+LABEL_14:
+            AddBspNodeToRenderList(v7);
+            return;
+          }
+        }
+      }
+    }
+  }
+  else
+  {
+    if (num_faces < 1000)
+    {
+      faces[num_faces].uFaceID = uFaceID;
+      faces[num_faces++].uNodeID = node_id;
+    }
+  }
+}
+
 */
\ No newline at end of file
--- a/mm7_2.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/mm7_2.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -396,7 +396,7 @@
 }
 
 //----- (004BC109) --------------------------------------------------------
-void  ArenaFight()
+void ArenaFight()
 {
   int v0; // edi@1
   char *v1; // eax@7
@@ -443,9 +443,11 @@
 
   pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
   pRenderer->BeginScene();
-  if ( pRenderer->pRenderD3D )
-    pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pViewport->uViewportBR_X - pViewport->uViewportTL_X,
-      pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, pRenderer->uTargetGMask | pRenderer->uTargetBMask);
+  //if ( pRenderer->pRenderD3D )
+    pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y,
+                            pViewport->uViewportBR_X - pViewport->uViewportTL_X,
+                            pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1,
+                            pRenderer->uTargetGMask | pRenderer->uTargetBMask);
 
   Texture* pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
   pRenderer->GetLeather(8, 352 - v0, pTex, pTex->uTextureHeight - v0);
@@ -3070,7 +3072,7 @@
 //----- (004646F0) --------------------------------------------------------
 void PrepareWorld(unsigned int _0_box_loading_1_fullscreen)
 {
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
     pGame->pVisInstance->_4C1A02();
   pEventTimer->Pause();
   pMiscTimer->Pause();
@@ -3929,7 +3931,7 @@
   pItemsTable = new ItemsTable;
   pItemsTable->Initialize();
 
-  pBitmaps_LOD->dword_011BA8 = 1;
+  //pBitmaps_LOD->can_load_hardware_sprites = 1;
   //pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
   pBitmaps_LOD->SetupPalettes(5, 6, 5);
   //pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
@@ -3939,7 +3941,7 @@
 
   pPaletteManager->SetMistColor(128, 128, 128);
   pPaletteManager->RecalculateAll();
-  pSprites_LOD->field_ECAC = 1;
+  //pSprites_LOD->can_load_hardware_sprites = 1;
   pObjectList->InitializeSprites();
   pOverlayList->InitializeSprites();
   if (!bNoSound)
@@ -4027,7 +4029,7 @@
   static_assert(sizeof(RenderBillboard) == 0x34, "Wrong type size");
   static_assert(sizeof(Texture) == 0x48, "Wrong type size");
   static_assert(sizeof(RGBTexture) == 0x28, "Wrong type size");
-  static_assert(sizeof(LODFile_IconsBitmaps) == 0x11BB8 + 4, "Wrong type size"); // + virtual dtor ptr
+  //static_assert(sizeof(LODFile_IconsBitmaps) == 0x11BB8 + 4, "Wrong type size"); // + virtual dtor ptr
   static_assert(sizeof(AudioPlayer) == 0xC84, "Wrong type size");
   static_assert(sizeof(SoundDesc) == 0x78, "Wrong type size");
   static_assert(sizeof(stru339_spell_sound) == 0xAFD8, "Wrong type size");
@@ -4566,11 +4568,11 @@
   int *v15; // [sp+10h] [bp-8h]@4
   int v16; // [sp+14h] [bp-4h]@3
 
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
   {
     result = _46A6AC_spell_render_d3d(a1, a2, a3);
   }
-  else
+  /*else
   {
     __debugbreak(); // SW render never called
     v16 = 0;
@@ -4617,7 +4619,7 @@
       }
     }
     result = v16;
-  }
+  }*/
   return result;
 }
 
--- a/mm7_3.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/mm7_3.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -2072,7 +2072,7 @@
     for(int i = 0; i < this->uNumVertices; i++)
     {
       v6 = (double)pBLVRenderParams->fov_rad_fixpoint * 0.000015258789 / this->field_B4[i*4];
-      if ( pRenderer->pRenderD3D )
+      //if ( pRenderer->pRenderD3D )
       {
         pGame->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);
@@ -2080,12 +2080,12 @@
         this->field_B4[i*4+17] = (double)a6;
         this->field_B4[i*4+18] = round_to_int(this->field_B4[i*4]);
       }
-      else
+      /*else
       {
         this->field_B4[i*4+16] = (double)pBLVRenderParams->uViewportCenterX - v6 * this->field_B4[i*4+1];
         this->field_B4[i*4+17] = (double)pBLVRenderParams->uViewportCenterY - v6 * this->field_B4[i*4+2];
         this->field_B4[i*4+18] = this->field_B4[i*4];
-      }
+      }*/
       this->field_B4[i*4+19] = this->field_B4[i*4+3];
       if ( (double)(signed int)pViewport->uViewportTL_X <= this->field_B4[i*4+16] && (double)(signed int)pViewport->uViewportBR_X > this->field_B4[i*4+16]
         && (double)(signed int)pViewport->uViewportTL_Y <= this->field_B4[i*4+17] && (double)(signed int)pViewport->uViewportBR_Y > this->field_B4[i*4+17] )
@@ -2355,9 +2355,9 @@
   skybox_width = xn_width;
   skybox_height = xn_height;
 
-  
-  if (!pRenderer->pRenderD3D->CreateTexture(skybox_width, skybox_height, &skybox_surface, &skybox_texture,
-                                            false, false, pRenderer->uMinDeviceTextureDim))
+  __debugbreak();
+  //if (!pRenderer->pRenderD3D->CreateTexture(skybox_width, skybox_height, &skybox_surface, &skybox_texture,
+                                            //false, false, pRenderer->uMinDeviceTextureDim))
     return false;
 
   return true;
@@ -3435,7 +3435,7 @@
   v10.sParentBillboardID = -1;
   v10.pTarget = pRenderer->pTargetSurface;
   v10.pTargetZ = pRenderer->pActiveZBuffer;
-  v10.uTargetPitch = pRenderer->field_10;
+  v10.uTargetPitch = pRenderer->GetRenderWidth();
   result = 0;
   v2 = a1;
   v10.uViewportX = 0;
@@ -4209,14 +4209,11 @@
 }
 
 //----- (00448B67) --------------------------------------------------------
-void OnTimer(int __unused)
+void OnTimer(int)
 {
   if (pEventTimer->bPaused)
     return;
   
-  if (__unused)
-    _5773C0_unused = 0;
-  
   long long v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128;
   if (!v13)
     return;
--- a/mm7_4.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/mm7_4.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -875,7 +875,7 @@
           break;
         }
       }
-      if ( !party_condition_flag || dword_5C35C0 )
+      if ( !party_condition_flag || _5C35C0_force_party_death )
         uGameState = GAME_STATE_PARTY_DIED;
     }
   }
--- a/mm7_data.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/mm7_data.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -336,16 +336,9 @@
 int pWindowList_at_506F50_minus1_indexing[1];
 int dword_4C9890[10]; // weak
 int dword_4C9920[16]; // weak
-_UNKNOWN unk_4D8548; // weak
 char byte_4D864C; // weak
 float flt_4D86CC = 1.0f; // weak
-int dword_4D86D8; // weak
-int dword_4DAFCC; // weak
-int (__stdcall *off_4DAFDC)(char); // weak
-char asc_4DB724[777]; // idb
-int dword_4DBD94; // weak
-//int dword_4DF390; // weak
-char Str2[777]; // idb
+int dword_4D86D8 = 0x40000000; // weak
 
 
 
@@ -355,97 +348,6 @@
 
 float flt_4D84E8 = 0.0f;
 
-char aIxf[4]; // idb
-_UNKNOWN unk_4E19FC; // weak
-char aD[777]; // idb
-char asc_4E1AB0[777]; // idb
-char aWb_0[777]; // idb
-char a24bitPcxOnly[777]; // idb
-char Mode[777]; // idb
-char a16bitPcx[777]; // idb
-char aUnableToLoadS[777]; // idb
-char aBitmaps[777]; // idb
-char aIcons[777]; // idb
-char aPending[777]; // idb
-char aCanTFindS[777]; // idb
-
-//std::array<char, 7> aSbwb00; // weak
-char aW[2]; // idb
-char aA[2]; // idb
-char aSD[777]; // idb
-char aSS03d03dS000S0[777]; // idb
-char aLuS[777]; // idb
-char aS_1[777]; // idb
-char aSbSc02d[777]; // idb
-char aSbSs02d[777]; // idb
-char aTabDb[777]; // idb
-char aTabDa[777]; // idb
-char aIbM6D[777]; // idb
-char aIbM6U[777]; // idb
-char aIbM5D[777]; // idb
-char aIbM5U[777]; // idb
-char aPagemask[777]; // idb
-char aBook[777]; // idb
-char aSpell_fnt[777]; // idb
-char aAutonote_fnt[777]; // idb
-char aBook2_fnt[777]; // idb
-char pFontFile[777]; // idb
-char aFontpal[777]; // idb
-char aMapbordr[777]; // idb
-char aLloydDD_pcx[777]; // idb
-char aDataLloydDD_pc[777]; // idb
-char aLb_bordr[777]; // idb
-char aTphell[777]; // idb
-char aTpheaven[777]; // idb
-char aTpisland[777]; // idb
-char aTpwarlock[777]; // idb
-char aTpelf[777]; // idb
-char aTpharmndy[777]; // idb
-char aTownport[777]; // idb
-char aSbquiknot[777]; // idb
-char aTabAn8a[777]; // idb
-char aTabAn8b[777]; // idb
-char aTabAn4a[777]; // idb
-char aTabAn4b[777]; // idb
-char aTabAn5a[777]; // idb
-char aTabAn5b[777]; // idb
-char aTabAn3a[777]; // idb
-char aTabAn3b[777]; // idb
-char aTabAn2a[777]; // idb
-char aTabAn2b[777]; // idb
-char aTabAn1a[777]; // idb
-char aTabAn1b[777]; // idb
-char aDivbar[777]; // idb
-char aSbautnot[777]; // idb
-char aTabwoff[777]; // idb
-char aTabwon[777]; // idb
-char aTabeoff[777]; // idb
-char aTabeon[777]; // idb
-char aTabsoff[777]; // idb
-char aTabson[777]; // idb
-char aTabnoff[777]; // idb
-char aTabnon[777]; // idb
-char aZootOff[777]; // idb
-char aZoomOff[777]; // idb
-char aZootOn[777]; // idb
-char aZoomOn[777]; // idb
-char aSbmap[777]; // idb
-char aMoon_ful[777]; // idb
-char aMoon_2[777]; // idb
-char aMoon_4[777]; // idb
-char aMoon_new[777]; // idb
-char aSbdateTime[777]; // idb
-char aTabAn7a[777]; // idb
-char aTabAn6a[777]; // idb
-char aTabAn7b[777]; // idb
-char aTabAn6b[777]; // idb
-char aSbplayrnot[777]; // idb
-char aPending_0[777]; // idb
-char aUnknown[8]; // weak
-char aS100110S[777]; // idb
-char aS100110D[777]; // idb
-char aS100110DS[777]; // idb
-char aS100110D02dSS[777]; // idb
 int pCurrentScreen = SCREEN_VIDEO; // 004E28F8
 unsigned int uGammaPos;
 std::array<int, 8> BtnTurnCoord = 
@@ -454,7 +356,6 @@
 }}; // weak
 std::array<__int16, 4> RightClickPortraitXmin={{0x14, 0x83, 0xF2, 0x165}};
 std::array<__int16, 4> RightClickPortraitXmax={{0x53, 0xC6, 0x138, 0x1A7}};
-void *off_4E2A12; // stat_string_control_button_count
 
 std::array<unsigned int, 4> pHealthBarPos = {{22, 137, 251, 366}};
 std::array<unsigned int, 4> pManaBarPos = {{102, 217, 331, 447}};
@@ -478,17 +379,11 @@
 const char *format_4E2DE8 = "\f%05d%s\f00000 - ";
 const char *format_4E2E00 = "%s\f%05u\xD\r180%s\n"; // idb
 const char *format_4E2E10 = "%s\f%05u\t110%d\f00000 / %d\n";
-__int16 word_4E3C66[777]; // idb
 int dword_4E455C; // weak
 std::array<int, 6> dword_4E4560;
 std::array<int, 6> dword_4E4578;
 std::array<int, 6> dword_4E4590;
 std::array<int, 6> dword_4E45A8;
-_UNKNOWN dword_4E49D4; // idb
-int dword_4E4A18[777]; // weak
-int dword_4E4A1C[777]; // weak
-int dword_4E4A40[777]; // weak
-int dword_4E4A44[777]; // weak
 std::array<float, 10> flt_4E4A80 =
 {
   0.050000001, 0.1,  0.30000001,  0.5,    0.60000002,
@@ -547,10 +442,9 @@
 
 std::array<__int16, 11> word_4E8152 = {0, 0, 0, 90, 8, 2, 70, 20, 10, 50, 30};
 
-char byte_4E94D0 = 5; // weak
-char byte_4E94D1 = 9; // weak
+char _4E94D0_light_type = 5; // weak
 char _4E94D2_light_type = 6; // weak
-char byte_4E94D3 = 10; // weak
+char _4E94D3_light_type = 10; // weak
 int dword_4E98BC_bApplicationActive; // weak
 //char *off_4EB080; // idb
 std::array<char*, 465> pTransitionStrings = {"", nullptr};  // 004EB080
@@ -777,11 +671,9 @@
  3, 0, 2, 0, 0, 1, 0, 4, 0, 2, 0, 0, 4, 4, 4, 4, 0, 0, 0, 4, 0, 4, 1, 2, 0, 3, 2, 1, 0, 0, 0, 0, 4, 0, 0, 3, 3,
  3, 0, 2, 0, 0, 1, 0, 4, 0, 2, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 1, 2, 0, 3, 2, 1, 0, 0, 0, 0, 4, 0, 0, 3, 3,
 }};
-_UNKNOWN unk_4EDF40; // weak
 std::array<unsigned int, 2> pHiredNPCsIconsOffsetsX = {489, 559};
 std::array<unsigned int, 2> pHiredNPCsIconsOffsetsY = {152, 152};
 std::array<int, 2> dword_4EE07C; // weak
-_UNKNOWN unk_4EE084; // weak
 std::array<__int16, 101> word_4EE088_sound_ids =
 {{
       0, 10000, 10010, 10020, 10030, 10040, 10050, 10060, 10070, 10080,
@@ -802,12 +694,7 @@
   47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 60
 }};
 
-int dword_4EED78; // weak
-_UNKNOWN unk_4EED80; // weak
 int ScreenshotFileNumber; // dword_4EFA80
-int dword_4EFA84; // weak
-void *off_4EFDB0; // weak
-int dword_4F031C[777]; // weak
 std::array<const char *, 19> off_4F03B8 =
 {{
   "",         "WEPNTABL", "ARMORY",   "MAGSHELF",
@@ -869,12 +756,6 @@
 					       4, 7, 10, 11,
 					       7, 11,
                  7, 11}};
-double dbl_4F2870; // weak
-int dword_4F288C; // weak
-double dbl_4F5372; // weak
-int dword_4F5428[777]; // weak
-int dword_4F542C[777]; // weak
-_UNKNOWN crtunk_4F54B8; // weak
 std::array<int, 500> ai_array_4F5E68;
 std::array<int, 500> ai_array_4F6638_actor_ids;
 std::array<int, 500> ai_near_actors_targets_pid;
@@ -883,16 +764,9 @@
 std::array<unsigned int, 500> ai_near_actors_ids;
 std::array<int, 182> dword_4F8580; // weak
 
-
-
-_UNKNOWN unk_4FAA20; // weak
 char byte_4FAA24; // weak
 //HWND dword_4FAA28; // idb
 
-
-
-
-int dword_505890; // weak
 std::array<unsigned int, 480> pSRZBufferLineOffsets;
 int areWeLoadingTexture; // weak
 std::array<char, 777> books_num_items_per_page; // weak
@@ -904,8 +778,6 @@
 __int64 qword_506350; // weak
 char byte_506360; // weak
 int dword_506364; // weak
-//Texture *dword_506404[12]; // weak
-//Texture *dword_50640C[12]; // weak
 unsigned int uExitCancelTextureId;
 int books_page_number; // weak
 int books_primary_item_per_page; // weak
@@ -961,7 +833,6 @@
 std::array<const char *, 7> aDayNames;
 std::array<const char *, 9> aSpellSchoolNames;
 std::array<const char *, 7> aAttributeNames;
-int dword_507B94; // weak
 unsigned int uActiveCharacter;
 int dword_507BF0_is_there_popup_onscreen; // weak
 int awards_scroll_bar_created; // weak
@@ -972,31 +843,11 @@
 std::array<int, 50> dword_50B570; // weak
 std::array<int, 50> dword_50B638; // weak
 stru367 PortalFace;
-/*int PortalFace.field_0; // weak
-int PortalFace.field_38[777]; // idb
-int PortalFace._view_transformed_ys[45];
-int PortalFace.field_128[777];
-int PortalFace._view_transformed_zs[45];
-int PortalFace.field_218[777];
-int PortalFace._view_transformed_xs[45];
-int PortalFace._screen_space_y[777];
-int PortalFace.field_3E4[777];
-int PortalFace.field_2F0[2]; // idb
-int PortalFace._ys[3 + 45];
-int PortalFace._ys2[48]; // idb
-int PortalFace._screen_space_x[777]; // idb
-int PortalFace.field_3D4[777]; // weak
-int PortalFace._xs[777]; // weak
-int dword_50BAE8[777]; // weak
-int PortalFace._xs2[3 + 45]; // weak
-int PortalFace._xs3[48]; // weak*/
 std::array<int, 100> dword_50BC10; // weak
 std::array<int, 100> dword_50BDA0; // weak
 std::array<int, 100> dword_50BF30; // weak
 char town_portal_caster_id; // weak
 int some_active_character; // weak
-//_UNKNOWN unk_50C190; // weak
-int dword_50C968; // weak
 std::array<unsigned int, 5> pIconIDs_Turn;
 unsigned int uIconID_TurnStop;
 unsigned int uIconID_TurnHour;
@@ -1007,7 +858,6 @@
 int uSpriteID_Spell11; // idb
 bool _50C9A0_IsEnchantingInProgress; // weak
 int _50C9A8_item_enchantment_timer = 0; // weak
-int dword_50C9AC; // weak
 int _50C9D0_AfterEnchClickEventId; // weak
 int _50C9D4_AfterEnchClickEventSecondParam; // weak
 int _50C9D8_AfterEnchClickEventTimeout; // weak
@@ -1016,7 +866,6 @@
 //int dword_50C9E8; // idb
 //int dword_50C9EC[120]; // weak
 int dword_50CDC8;
-int bProcessorIsNotIntel; // weak
 Vec3_int_ layingitem_vel_50FDFC;
 char pStartingMapName[32]; // idb
 std::array<unsigned __int8, 5> IsPlayerWearingWatersuit;
@@ -1031,7 +880,6 @@
 int dword_576E28; // weak
 int _576E2C_current_minimap_zoom; // weak
 __int64 _5773B8_event_timer; // weak
-int _5773C0_unused; // weak
 
 
 int dword_591084; // weak
@@ -1054,7 +902,6 @@
 struct Texture *pTexture_591428;
 struct Texture *pTexture_outside; // idb
 struct Texture *pTexture_Dialogue_Background;
-_UNKNOWN unk_597F10; // weak
 std::array<char, 2000> byte_5B0938;
 int EvtTargetObj; // 0x5B5920
 int _unused_5B5924_is_travel_ui_drawn = false; // 005B5924
@@ -1071,15 +918,13 @@
 signed int dword_5B65D0_dialogue_actor_npc_id; // weak
 int dword_5C3418; // weak
 int dword_5C341C; // weak
-int _5C3420_pDecoration;
 //std::array<char, 777> byte_5C3427; // weak
 std::array<char, 200> GameUI_Footer_TimedString;
 std::array<char, 200> pFooterString;
 unsigned int GameUI_Footer_TimeLeft;
 int bForceDrawFooter; // weak
-int dword_5C35C0; // weak
+int _5C35C0_force_party_death = false; // weak
 int bDialogueUI_InitializeActor_NPC_ID; // weak
-int dword_5C35C8; // weak
 char *p2DEventsTXT_Raw;
 
 int dword_5C35D4; // weak
@@ -1155,8 +1000,6 @@
 unsigned int uTextureID_save_up;
 unsigned int uTextureID_load_up;
 unsigned int uTextureID_loadsave;
-_UNKNOWN _69FBB4_ptr_iterator_end; // weak
-_UNKNOWN unk_6A0758; // weak
 int pSaveListPosition; // weak
 unsigned int uLoadGameUI_SelectedSlot;
 HWND hInsertCDWindow; // idb
--- a/mm7_data.h	Thu Jan 09 02:34:20 2014 +0200
+++ b/mm7_data.h	Thu Jan 09 14:36:48 2014 +0200
@@ -6,7 +6,7 @@
 #include <assert.h>
 #include "NZIArray.h"
 
-typedef char _UNKNOWN;
+//typedef char _UNKNOWN;
 typedef unsigned int uint;
 
 
@@ -299,120 +299,18 @@
 extern int pWindowList_at_506F50_minus1_indexing[1];
 extern int dword_4C9890[10]; // weak
 extern int dword_4C9920[16]; // weak
-extern _UNKNOWN unk_4D8548; // weak
 extern char byte_4D864C; // weak
 extern float flt_4D86CC; // weak
 extern int dword_4D86D8; // weak
-extern int dword_4DAFCC; // weak
-extern int (__stdcall *off_4DAFDC)(char); // weak
-extern char asc_4DB724[]; // idb
-extern int dword_4DBD94; // weak
-extern int dword_4DF390; // weak
-extern char Str2[]; // idb
 
 
 extern float flt_4D84E8;
 
-
-extern char aIxf[4]; // idb
-extern _UNKNOWN unk_4E19FC; // weak
-extern char aD[]; // idb
-extern char asc_4E1AB0[]; // idb
-extern char aWb_0[]; // idb
-extern char a24bitPcxOnly[]; // idb
-extern char Mode[]; // idb
-extern char a16bitPcx[]; // idb
-extern char aUnableToLoadS[]; // idb
-extern char aBitmaps[]; // idb
-extern char aIcons[]; // idb
-extern char aPending[]; // idb
-extern char aCanTFindS[]; // idb
-
-extern __int16 word_4E1D3A[]; // weak
-
-//extern std::array<char, 7> aSbwb00; // weak
-extern char aW[2]; // idb
-extern char aA[2]; // idb
-extern char aSD[]; // idb
-extern char aSS03d03dS000S0[]; // idb
-extern char aLuS[]; // idb
-extern char aS_1[]; // idb
-extern char aSbSc02d[]; // idb
-extern char aSbSs02d[]; // idb
-extern char aTabDb[]; // idb
-extern char aTabDa[]; // idb
-extern char aIbM6D[]; // idb
-extern char aIbM6U[]; // idb
-extern char aIbM5D[]; // idb
-extern char aIbM5U[]; // idb
-extern char aPagemask[]; // idb
-extern char aBook[]; // idb
-extern char aSpell_fnt[]; // idb
-extern char aAutonote_fnt[]; // idb
-extern char aBook2_fnt[]; // idb
-extern char pFontFile[]; // idb
-extern char aFontpal[]; // idb
-extern char aMapbordr[]; // idb
-extern char aLloydDD_pcx[]; // idb
-extern char aDataLloydDD_pc[]; // idb
-extern char aLb_bordr[]; // idb
-extern char aTphell[]; // idb
-extern char aTpheaven[]; // idb
-extern char aTpisland[]; // idb
-extern char aTpwarlock[]; // idb
-extern char aTpelf[]; // idb
-extern char aTpharmndy[]; // idb
-extern char aTownport[]; // idb
-extern char aSbquiknot[]; // idb
-extern char aTabAn8a[]; // idb
-extern char aTabAn8b[]; // idb
-extern char aTabAn4a[]; // idb
-extern char aTabAn4b[]; // idb
-extern char aTabAn5a[]; // idb
-extern char aTabAn5b[]; // idb
-extern char aTabAn3a[]; // idb
-extern char aTabAn3b[]; // idb
-extern char aTabAn2a[]; // idb
-extern char aTabAn2b[]; // idb
-extern char aTabAn1a[]; // idb
-extern char aTabAn1b[]; // idb
-extern char aDivbar[]; // idb
-extern char aSbautnot[]; // idb
-extern char aTabwoff[]; // idb
-extern char aTabwon[]; // idb
-extern char aTabeoff[]; // idb
-extern char aTabeon[]; // idb
-extern char aTabsoff[]; // idb
-extern char aTabson[]; // idb
-extern char aTabnoff[]; // idb
-extern char aTabnon[]; // idb
-extern char aZootOff[]; // idb
-extern char aZoomOff[]; // idb
-extern char aZootOn[]; // idb
-extern char aZoomOn[]; // idb
-extern char aSbmap[]; // idb
-extern char aMoon_ful[]; // idb
-extern char aMoon_2[]; // idb
-extern char aMoon_4[]; // idb
-extern char aMoon_new[]; // idb
-extern char aSbdateTime[]; // idb
-extern char aTabAn7a[]; // idb
-extern char aTabAn6a[]; // idb
-extern char aTabAn7b[]; // idb
-extern char aTabAn6b[]; // idb
-extern char aSbplayrnot[]; // idb
-extern char aPending_0[]; // idb
-extern char aUnknown[8]; // weak
-extern char aS100110S[]; // idb
-extern char aS100110D[]; // idb
-extern char aS100110DS[]; // idb
-extern char aS100110D02dSS[]; // idb
 extern int pCurrentScreen; // 004E28F8
 extern unsigned int uGammaPos;
 extern std::array<int, 8> BtnTurnCoord;
 extern std::array<__int16, 4> RightClickPortraitXmin;
 extern std::array<__int16, 4> RightClickPortraitXmax;
-extern void *off_4E2A12; // weak
 //extern int pArmorSkills[5];
 //extern int pWeaponSkills[9];
 //extern int pMiscSkills[12];
@@ -429,17 +327,11 @@
 extern const char *format_4E2DE8; // idb
 extern const char *format_4E2E00; // idb
 extern const char *format_4E2E10; // format text of resistance in Stats screen
-extern __int16 word_4E3C66[]; // idb
 extern int dword_4E455C; // weak
 extern std::array<int, 6> dword_4E4560;
 extern std::array<int, 6> dword_4E4578;
 extern std::array<int, 6> dword_4E4590;
 extern std::array<int, 6> dword_4E45A8;
-extern _UNKNOWN dword_4E49D4; // idb
-extern int dword_4E4A18[]; // weak
-extern int dword_4E4A1C[]; // weak
-extern int dword_4E4A40[]; // weak
-extern int dword_4E4A44[]; // weak
 extern std::array<float, 10> flt_4E4A80;
 
 extern std::array< std::array<int, 2>, 14> pPartySpellbuffsUI_XYs;
@@ -451,11 +343,9 @@
 extern std::array<const char *, 11> _4E6BDC_loc_names;
 extern std::array<__int16, 11> word_4E8152;
 extern std::array< std::array<char, 14>, 7> byte_4E8168;
-//extern stru355 stru_4E82A4;// = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000};  moved to texture.h
-//extern stru355 stru_4EFCBC;// = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000};  moved to texture.h
-extern char byte_4E94D0; // weak
+extern char _4E94D0_light_type; // weak
 extern char _4E94D2_light_type; // weak
-extern char byte_4E94D3; // weak
+extern char _4E94D3_light_type; // weak
 extern std::array<unsigned int, 2> saveload_dlg_xs;
 extern std::array<unsigned int, 2> saveload_dlg_ys;
 extern std::array<unsigned int, 2> saveload_dlg_zs;
@@ -464,27 +354,18 @@
 extern std::array<char*, 465> pTransitionStrings; // 4EB080
 extern std::array<int, 9> dword_4EC268; // weak
 extern std::array<int, 7> dword_4EC28C; // weak
-extern int dword_4EC2A8; // weak
-extern int dword_4EC2AC; // weak
 extern std::array<const char*, 25> pPlayerPortraitsNames;
 
 extern std::array< std::array<unsigned char, 25>, 48> byte_4ECF08;
 extern std::array<std::array<unsigned char, 8>, 110> SoundSetAction; // weak
 extern std::array<__int16, 4> pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing;
 extern std::array< std::array<char, 37>, 36> byte_4ED970_skill_learn_ability_by_class_table;
-extern _UNKNOWN unk_4EDF40; // weak
 extern std::array<unsigned int, 2> pHiredNPCsIconsOffsetsX;
 extern std::array<unsigned int, 2> pHiredNPCsIconsOffsetsY;
 extern std::array<int, 2> dword_4EE07C; // weak
-extern _UNKNOWN unk_4EE084; // weak
 extern std::array<__int16, 101> word_4EE088_sound_ids; // weak
 extern std::array<short, 28> word_4EE150;
-extern int dword_4EED78; // weak
-extern _UNKNOWN unk_4EED80; // weak
 extern int ScreenshotFileNumber; // dword_4EFA80
-extern int dword_4EFA84; // weak
-extern void *off_4EFDB0; // weak
-extern int dword_4F031C[]; // weak
 extern std::array<const char *, 19> off_4F03B8; // idb
 extern __int16 word_4F0576[]; // weak
 
@@ -495,12 +376,6 @@
 extern std::array<int, 11> price_for_membership; // weak
 extern std::array<Vec2_int_, 20> pMonsterArenaPlacements;
 extern std::array<__int16, 32> word_4F0F30; // weak
-extern double dbl_4F2870; // weak
-extern int dword_4F288C; // weak
-extern double dbl_4F5372; // weak
-extern int dword_4F5428[]; // weak
-extern int dword_4F542C[]; // weak
-extern _UNKNOWN crtunk_4F54B8; // weak
 extern std::array<int, 500> ai_array_4F5E68;
 extern std::array<int, 500> ai_array_4F6638_actor_ids;
 extern std::array<int, 500> ai_near_actors_targets_pid;
@@ -511,13 +386,9 @@
 extern int dword_4FA9B0[]; // weak
 extern int dword_4FA9B4[]; // weak
 
-extern _UNKNOWN unk_4FAA20; // weak
 extern char byte_4FAA24; // weak
 //extern HWND dword_4FAA28; // idb
 
-
-
-extern int dword_505890; // weak
 extern std::array<unsigned int, 480> pSRZBufferLineOffsets;
 extern int areWeLoadingTexture; // weak
 extern std::array<char, 777> books_num_items_per_page; // weak
@@ -586,7 +457,6 @@
 extern std::array<const char *, 7> aDayNames;
 extern std::array<const char *, 9> aSpellSchoolNames;
 extern std::array<const char *, 7> aAttributeNames;
-extern int dword_507B94; // weak
 extern unsigned int uActiveCharacter;
 extern int dword_507BF0_is_there_popup_onscreen; // weak
 extern int awards_scroll_bar_created; // weak
@@ -597,31 +467,11 @@
 extern std::array<int, 50> dword_50B570; // weak
 extern std::array<int, 50> dword_50B638; // weak
 extern struct stru367 PortalFace;
-/*extern int PortalFace.field_0; // weak
-extern int PortalFace.field_38[]; // idb
-extern int PortalFace._view_transformed_ys[];
-extern int PortalFace.field_128[];
-extern int PortalFace._view_transformed_zs[];
-extern int PortalFace.field_218[];
-extern int PortalFace._view_transformed_xs[];
-extern int PortalFace._screen_space_y[];
-extern int PortalFace.field_3E4[];
-extern int PortalFace.field_2F0[]; // idb
-extern int PortalFace._ys[];
-extern int PortalFace._ys2[]; // idb
-extern int PortalFace._screen_space_x[]; // idb
-extern int PortalFace.field_3D4[]; // weak
-extern int PortalFace._xs[]; // weak
-extern int dword_50BAE8[]; // weak
-extern int PortalFace._xs2[]; // weak
-extern int PortalFace._xs3[]; // weak*/
 extern std::array<int, 100> dword_50BC10; // weak
 extern std::array<int, 100> dword_50BDA0; // weak
 extern std::array<int, 100> dword_50BF30; // weak
 extern char town_portal_caster_id; // weak
 extern int some_active_character; // weak
-extern _UNKNOWN unk_50C190; // weak
-extern int dword_50C968; // weak
 extern std::array<unsigned int, 5> pIconIDs_Turn;
 extern unsigned int uIconID_TurnStop;
 extern unsigned int uIconID_TurnHour;
@@ -632,7 +482,6 @@
 extern int uSpriteID_Spell11; // idb
 extern bool _50C9A0_IsEnchantingInProgress; // weak
 extern int _50C9A8_item_enchantment_timer; // weak
-extern int dword_50C9AC; // weak
 extern int _50C9D0_AfterEnchClickEventId; // weak
 extern int _50C9D4_AfterEnchClickEventSecondParam; // weak
 extern int _50C9D8_AfterEnchClickEventTimeout; // weak
@@ -641,7 +490,6 @@
 //extern int dword_50C9E8; // idb
 //extern int dword_50C9EC[]; // 50C9EC
 extern int dword_50CDC8;
-extern int bProcessorIsNotIntel; // weak
 extern Vec3_int_ layingitem_vel_50FDFC;
 extern char pStartingMapName[32]; // idb
 extern std::array<unsigned __int8, 5> IsPlayerWearingWatersuit;
@@ -659,8 +507,6 @@
 extern int dword_576E28; // weak
 extern int _576E2C_current_minimap_zoom; // weak
 extern __int64 _5773B8_event_timer; // weak
-extern int _5773C0_unused; // weak
-
 
 extern int dword_591084; // weak
 extern struct Actor *pDialogue_SpeakingActor;
@@ -682,7 +528,6 @@
 extern struct Texture *pTexture_591428;
 extern struct Texture *pTexture_outside; // idb
 extern struct Texture *pTexture_Dialogue_Background;
-extern _UNKNOWN unk_597F10; // weak
 extern std::array<char, 2000> byte_5B0938;
 extern int EvtTargetObj; // weak
 extern int _unused_5B5924_is_travel_ui_drawn; // 005B5924
@@ -699,15 +544,13 @@
 extern int dword_5B65D0_dialogue_actor_npc_id; // weak
 extern int dword_5C3418; // weak
 extern int dword_5C341C; // weak
-extern int _5C3420_pDecoration;
 //extern std::array<char, 777> byte_5C3427; // weak
 extern std::array<char, 200> GameUI_Footer_TimedString;
 extern std::array<char, 200> pFooterString;
 extern unsigned int GameUI_Footer_TimeLeft;
 extern int bForceDrawFooter; // weak
-extern int dword_5C35C0; // weak
+extern int _5C35C0_force_party_death; // weak
 extern int bDialogueUI_InitializeActor_NPC_ID; // weak
-extern int dword_5C35C8; // weak
 extern char *p2DEventsTXT_Raw;
 
 extern int dword_5C35D4; // weak
@@ -782,8 +625,6 @@
 extern unsigned int uTextureID_save_up;
 extern unsigned int uTextureID_load_up;
 extern unsigned int uTextureID_loadsave;
-extern _UNKNOWN _69FBB4_ptr_iterator_end; // weak
-extern _UNKNOWN unk_6A0758; // weak
 extern int pSaveListPosition; // weak
 extern unsigned int uLoadGameUI_SelectedSlot;
 extern HWND hInsertCDWindow; // idb
--- a/mm7_unsorted_subs.h	Thu Jan 09 02:34:20 2014 +0200
+++ b/mm7_unsorted_subs.h	Thu Jan 09 14:36:48 2014 +0200
@@ -119,8 +119,6 @@
 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4);
 unsigned int SkillToMastery(unsigned int skill_value);
 unsigned int __fastcall GetSpellColor(signed int a1);
-unsigned short * MakeScreenshot(signed int width, signed int height);
-void SaveScreenshot(const char *pFilename);
 void __fastcall LoadGame(unsigned int uSlot); // idb
 void SaveGame(bool IsAutoSAve, bool NotSaveWorld);
 void __fastcall DoSavegame(unsigned int uSlot); // idb
@@ -215,8 +213,6 @@
 void DeleteCCharFont();
 bool PlayerCreationUI_Loop();
 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim);
-bool CheckTextureStages();
-bool AreRenderSurfacesOk();
 struct SoundHeader *FindSound_BinSearch(unsigned int uStart, unsigned int uEnd, const char *pName);
 struct SoundData *LoadSound(const char *pSoundName, struct SoundData *pOutBuff, unsigned int uID);
 int __fastcall sub_4AAEA6_transform(struct RenderVertexSoft *a1);
--- a/stru6.cpp	Thu Jan 09 02:34:20 2014 +0200
+++ b/stru6.cpp	Thu Jan 09 14:36:48 2014 +0200
@@ -397,8 +397,9 @@
   pStru1->_47829F_sphere_particle(v10, v9, v8, v7, v6);
 }
 
+
 //----- (004A77FD) --------------------------------------------------------
-void stru6::_4A77FD_implosion_particle(SpriteObject *a1)
+void stru6::_4A77FD_implosion_particle_d3d(SpriteObject *a1)
 {
   double v4; // st7@1
   double v5; // st7@2
@@ -497,9 +498,9 @@
            (uDiffuse & 0x00FF0000) >> 16,
            (uDiffuse & 0x0000FF00) >> 8,
            uDiffuse & 0x000000FF,
-           byte_4E94D3);
+           _4E94D3_light_type);
 }
-// 4E94D3: using guessed type char byte_4E94D3;
+// 4E94D3: using guessed type char _4E94D3_light_type;
 
 //----- (004A7A66) --------------------------------------------------------
 void stru6::_4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(SpriteObject *a1, unsigned int uDiffuse, unsigned int uTextureID, float a4)
@@ -781,33 +782,6 @@
   return fixpoint_from_float(v5);
 }
 
-//----- (004A80DC) --------------------------------------------------------
-void stru6::_4A80DC_some_stuff_sw(SpriteObject *a2)
-{
-  signed int v3; // ebx@1
-  Particle_sw local_0; // [sp+Ch] [bp-68h]@1
-
-  memset(&local_0, 0, 0x68u);
-  local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1;
-  local_0.uDiffuse = 0x7E7E7E;
-  local_0.timeToLive = (rand() & 0x7F) + 128;
-  local_0.uTextureID = uTextureID_effpar1;
-  v3 = 8;
-  local_0.flt_28 = 1.0;
-  do
-  {
-    local_0.x = pRnd->GetRandom() * 40.0 + (double)a2->vPosition.x - 20.0;
-    local_0.y = pRnd->GetRandom() * 40.0 + (double)a2->vPosition.y - 20.0;
-    local_0.z = (double)a2->vPosition.z;
-    local_0.r = pRnd->GetRandom() * 800.0 - 400.0;
-    local_0.g = pRnd->GetRandom() * 800.0 - 400.0;
-    local_0.b = pRnd->GetRandom() * 350.0 + 50.0;
-    pGame->pParticleEngine->AddParticle(&local_0);
-    --v3;
-  }
-  while ( v3 );
-}
-
 //----- (004A81CA) --------------------------------------------------------
 bool stru6::_4A81CA(SpriteObject *a2)
 {
@@ -898,7 +872,7 @@
     case 1051: // Fireball hit
     {
       AddMobileLight(a2, 0xFF3C1E, 256);
-      if (pRenderer->pRenderD3D)
+      //if (pRenderer->pRenderD3D)
       {
         result = PID_TYPE(a2->spell_caster_pid);
         if (PID_TYPE(a2->spell_caster_pid) != OBJECT_Actor &&
@@ -1074,8 +1048,8 @@
             if ( result )
               return false;
 //LABEL_63:
-            if ( !pRenderer->pRenderD3D )
-              return true;
+            //if ( !pRenderer->pRenderD3D )
+            //  return true;
             _4A78AE_sparks_spell(a2);
             AddMobileLight(a2, 0x64640F, 128);
             return false;
@@ -1098,10 +1072,10 @@
                 return false;
               if ( result <= 2081 )
               {
-                if ( pRenderer->pRenderD3D )
-                  _4A77FD_implosion_particle(a2);
-                else
-                  _4A80DC_some_stuff_sw(a2);
+                //if ( pRenderer->pRenderD3D )
+                  _4A77FD_implosion_particle_d3d(a2);
+                /*else
+                  _4A80DC_implosion_particle_sw(a2);*/
                 return false;
               }
               v9 = result == 2100;
@@ -1113,8 +1087,8 @@
             AddMobileLight(a2, 0xC8C814, 256);
             return false;
           }
-          if ( !pRenderer->pRenderD3D )
-            return true;
+          //if ( !pRenderer->pRenderD3D )
+          //  return true;
           memcpy(pContainer, "sp18h1", 7);
           pRnd->SetRange(1, 6);
           pContainer[5] = pRnd->GetInRange() + '0';
@@ -1159,8 +1133,8 @@
       }
       if ( result == 4000 )
       {
-        if ( !pRenderer->pRenderD3D )
-          return true;
+        //if ( !pRenderer->pRenderD3D )
+        //  return true;
         _4A7C07(a2);
         return false;
       }
@@ -1202,8 +1176,8 @@
             _4A75CC_single_spell_collision_particle(a2, 0xF00000, uTextureID_effpar1);
           return false;
         }
-            if ( !pRenderer->pRenderD3D )
-              return true;
+            //if ( !pRenderer->pRenderD3D )
+            //  return true;
             _4A78AE_sparks_spell(a2);
             AddMobileLight(a2, 0x64640F, 128);
             return false;
@@ -1323,8 +1297,8 @@
       return false;
     }
     AddMobileLight(a2, 0xFFFFFFu, 128);
-    if ( !pRenderer->pRenderD3D )
-      return true;
+    //if ( !pRenderer->pRenderD3D )
+    //  return true;
     AddProjectile(a2, 100, -1);
     return false;
   }
@@ -1475,7 +1449,6 @@
   const char *v19; // [sp+4h] [bp-E8h]@0
   int v20; // [sp+8h] [bp-E4h]@0
   unsigned int v21; // [sp+Ch] [bp-E0h]@0
-  RenderBillboardTransform_local0 vsr; // [sp+10h] [bp-DCh]@10
   RenderVertexD3D3 vd3d[4]; // [sp+60h] [bp-8Ch]@9
   int v24; // [sp+E0h] [bp-Ch]@10
   SpriteFrame *v70; // [sp+E4h] [bp-8h]@8
@@ -1511,7 +1484,7 @@
     v11 = v10->pHwSpriteIDs[0];
     v70 = v10;
     uAnimLength -= pEventTimer->uTimeElapsed;
-    if ( pRenderer->pRenderD3D )
+    //if ( pRenderer->pRenderD3D )
     {
       v12 = (double)(signed int)pViewport->uViewportTL_X;
       vd3d[0].pos.x = v12;
@@ -1569,7 +1542,7 @@
       pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE);
       pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_LESS);
     }
-    else
+    /*else
     {
       vsr.pTarget = pRenderer->pTargetSurface;
       vsr.sParentBillboardID = -1;
@@ -1595,7 +1568,7 @@
       vsr.uFlags = 0;
       if ( v11 >= 0 )
         pSprites_LOD->pSpriteHeaders[v11].DrawSprite_sw(&vsr, 1);
-    }
+    }*/
   }
 }
 
--- a/stru6.h	Thu Jan 09 02:34:20 2014 +0200
+++ b/stru6.h	Thu Jan 09 14:36:48 2014 +0200
@@ -122,7 +122,7 @@
   void _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(struct SpriteObject *a2, unsigned int uDiffuse, unsigned int uTextureID);
   void _4A75CC_single_spell_collision_particle(struct SpriteObject *a1, unsigned int uDiffuse, unsigned int uTextureID);
   void _4A7688_fireball_collision_particle(struct SpriteObject *a2);
-  void _4A77FD_implosion_particle(struct SpriteObject *a1);
+  void _4A77FD_implosion_particle_d3d(struct SpriteObject *a1);
   void _4A78AE_sparks_spell(struct SpriteObject *a1);
   void _4A7948_mind_blast_after_effect(struct SpriteObject *a1);
   bool AddMobileLight(struct SpriteObject *a1, unsigned int uDiffuse, int uRadius);
@@ -132,7 +132,7 @@
   void _4A7E89_sparkles_on_actor_after_it_casts_buff(struct Actor *pActor, unsigned int uDiffuse);
   void _4A7F74(int x, int y, int z);
   int _4A806F(struct Actor *pActor);
-  void _4A80DC_some_stuff_sw(struct SpriteObject *a2);
+  //void _4A80DC_implosion_particle_sw(struct SpriteObject *a2);
   bool _4A81CA(struct SpriteObject *a2);
   void SetPlayerBuffAnim(unsigned __int16 uSpellID, unsigned __int16 uPlayerID);
   void FadeScreen__like_Turn_Undead_and_mb_Armageddon(unsigned int uDiffuseColor, unsigned int uFadeTime);