changeset 2153:d28d3c006077

Some Render decoupling.
author Nomad
date Thu, 09 Jan 2014 02:34:20 +0200
parents d44b7775fc06
children 9bd7522cdbbb eaaaa50d34e9
files Actor.cpp Arcomage.cpp AudioPlayer.cpp Chest.cpp Events.cpp GUIFont.cpp GUIProgressBar.cpp GUIWindow.cpp Game.cpp Indoor.cpp Items.cpp Keyboard.cpp LOD.cpp LightmapBuilder.cpp Monsters.cpp Mouse.cpp NPC.cpp Outdoor.cpp Outdoor_stuff.h Overlays.cpp PaletteManager.cpp Party.cpp Player.cpp Render.cpp Render.h SaveLoad.cpp Spells.cpp Sprites.cpp StorylineTextTable.cpp Texture.cpp TileTable.cpp UI/Books/UIMapBook.cpp UI/Books/UINotesBooks.cpp UI/Books/UISpellBook.cpp UI/UIBooks.cpp UI/UICharacter.cpp UI/UIHouses.cpp UI/UIMainMenu.cpp UI/UIPartyCreation.cpp UI/UIPopup.cpp UI/UIRest.cpp UI/UISaveLoad.cpp UI/UITransition.cpp UI/UiGame.cpp VideoPlayer.cpp Weather.cpp _deleted.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp mm7_7.cpp mm7_data.cpp mm7_unsorted_subs.h mm7text_ru.cpp texts.cpp
diffstat 57 files changed, 148 insertions(+), 362 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Actor.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "mm7_data.h"
 #include "DecalBuilder.h"
 
@@ -48,6 +44,33 @@
 std::array<uint, 5> dword_4DF380_hostilityRanges = {0,1024,2560,5120,10240};
 
 
+
+
+//----- (0042FB5C) --------------------------------------------------------
+// True if monster should play attack animation when casting this spell.
+bool ShouldMonsterPlayAttackAnim(signed int spell_id)
+{
+  switch (spell_id)
+  {
+    case SPELL_FIRE_HASTE:
+    case SPELL_AIR_SHIELD:
+    case SPELL_EARTH_STONESKIN:
+    case SPELL_SPIRIT_BLESS:
+    case SPELL_SPIRIT_FATE:
+    case SPELL_SPIRIT_HEROISM:
+    case SPELL_BODY_HAMMERHANDS:
+    case SPELL_BODY_POWER_CURE:
+    case SPELL_LIGHT_DISPEL_MAGIC:
+    case SPELL_LIGHT_DAY_OF_PROTECTION:
+    case SPELL_LIGHT_HOUR_OF_POWER:
+    case SPELL_DARK_PAIN_REFLECTION:
+      return false;
+  }
+
+  return true;
+}
+
+
 //----- (0041AF52) --------------------------------------------------------
 void Actor::DrawHealthBar(Actor *actor, GUIWindow *window)
 {
@@ -1584,7 +1607,7 @@
     v3->vVelocity.z = 0;
     v3->vVelocity.y = 0;
     v3->vVelocity.x = 0;
-    if ( _42FB5C_check_spell(v3->pMonsterInfo.uSpell2ID) )
+    if ( ShouldMonsterPlayAttackAnim(v3->pMonsterInfo.uSpell2ID) )
     {
       v3->uCurrentActionLength = 64;
       v3->uCurrentActionTime = 0;
@@ -1669,7 +1692,7 @@
     v3->vVelocity.z = 0;
     v3->vVelocity.y = 0;
     v3->vVelocity.x = 0;
-    if ( _42FB5C_check_spell(v3->pMonsterInfo.uSpell1ID) )
+    if ( ShouldMonsterPlayAttackAnim(v3->pMonsterInfo.uSpell1ID) )
     {
       v3->uCurrentActionLength = 64;
       v3->uCurrentActionTime = 0;
--- a/Arcomage.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Arcomage.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <string>
 
 #include "Render.h"
--- a/AudioPlayer.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/AudioPlayer.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,6 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
 
 #include <string>
 
--- a/Chest.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Chest.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <stdio.h>
 
 #include "BSPModel.h"
--- a/Events.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Events.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <stdlib.h>
 
 #include "Weather.h"
@@ -1362,8 +1358,7 @@
         v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8);
         if ( _evt->v29 || _evt->v30 )
           {
-          if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode )
-            pRenderer->_49FD3A();
+            pRenderer->Sub01();
           TransitionUI_Load(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31);
           dword_5C3418 = uEventID;
           dword_5C341C = curr_seq_num + 1;
@@ -1480,8 +1475,7 @@
       case EVENT_SpeakInHouse:
         if ( EnterHouse((enum HOUSE_ID)EVT_DWORD(_evt->v5)))
           {
-          if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode )
-            pRenderer->_49FD3A();
+            pRenderer->Sub01();
           pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
           pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0);
           v104 = 187;
--- a/GUIFont.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/GUIFont.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <string>
 
 #include "LOD.h"
--- a/GUIProgressBar.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/GUIProgressBar.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "GUIProgressBar.h"
 #include "LOD.h"
 #include "Mouse.h"
@@ -182,11 +178,8 @@
   {
     if (pBardata.pLevelOfDetail0_prolly_alpha_mask)
     {
-      if (pRenderer->pRenderD3D)
-      {
-        if (!pRenderer->bWindowMode)
-          pRenderer->_49FD3A();
-      }
+            pRenderer->Sub01();
+
       pRenderer->DrawTextureIndexed(80, 122, &pBardata);//прогрессбар для данжей
       pRenderer->DrawTextureTransparent(100, 146, &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconID_TurnHour, 0)->uTextureID]);
       //pRenderer->FillRectFast(174, 164, floorf(((double)(113 * uProgressCurrent) / (double)uProgressMax) + 0.5f),//COERCE_UNSIGNED_INT64(v4 + 6.7553994e15),
--- a/GUIWindow.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/GUIWindow.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "GUIWindow.h"
 #include "GUIFont.h"
 #include "Party.h"
--- a/Game.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Game.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "Vis.h"
 #include "Weather.h"
 #include "LightmapBuilder.h"
@@ -1783,7 +1779,7 @@
           not_available_tinting_texture_id = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE);
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0);
           pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0);
-          if ( pRenderer->pRenderD3D )
+          //if ( pRenderer->pRenderD3D )
           {
             pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, "", 0);
             pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, "", 0);
@@ -1842,10 +1838,10 @@
           pGame->ToggleFlags2(0x20u);
           continue;
         case UIMSG_ToggleColoredLights:
-          pRenderer->bUseColoredLights = pRenderer->bUseColoredLights == 0;
+          pRenderer->ToggleColoredLights();
           continue;
         case UIMSG_ToggleTint:
-          pRenderer->bTinting = pRenderer->bTinting == 0;
+          pRenderer->ToggleTint();
           continue;
         case UIMSG_ChangeMusicVolume:  //громкость музыки
           if ( uMessageParam == 4 )//кнопка понижения
@@ -2262,7 +2258,7 @@
                       stru_506E40.Release();
                       break;
                     case SCREEN_VIDEO_OPTIONS:
-                      if ( pRenderer->pRenderD3D )
+                      //if ( pRenderer->pRenderD3D )
                       {
                         WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights);
                         WriteWindowsRegistryInt("Tinting", pRenderer->bTinting);
@@ -2864,14 +2860,14 @@
           viewparams->bRedrawGameUI = 1;
           continue;
         case UIMSG_CastSpell_Telekinesis:
-          if ( pRenderer->pRenderD3D )
+          //if ( pRenderer->pRenderD3D )
             LOWORD(v42) = pGame->pVisInstance->get_picked_object_zbuf_val();
-          else
+          /*else
           {
             uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210);
             pPoint = pMouse->GetCursorPos(&v208);
             v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]];
-          }
+          }*/
           v44 = (unsigned __int16)v42;
           v45 = PID_TYPE(v44);
           uNumSeconds = v44;
--- a/Indoor.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Indoor.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "LightmapBuilder.h"
 #include "DecalBuilder.h"
 #include "stru9.h"
@@ -3548,7 +3544,7 @@
             unsigned char r = 255,
                           g = 255,
                           b = 255;
-            if (pRenderer->pRenderD3D && pRenderer->bUseColoredLights)
+            if (/*pRenderer->pRenderD3D*/true && pRenderer->bUseColoredLights)
             {
               r = v17->uColoredLightRed;
               g = v17->uColoredLightGreen;
--- a/Items.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Items.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <stdlib.h>
 
 #include "Items.h"
--- a/Keyboard.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Keyboard.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,8 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
-
 #include "Keyboard.h"
 #include "GUIWindow.h"
 #include "Game.h"
--- a/LOD.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/LOD.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "LOD.h"
 #include "Render.h"
 #include "PaletteManager.h"
--- a/LightmapBuilder.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/LightmapBuilder.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -969,7 +969,7 @@
   int v10; // ecx@8
   int v11; // eax@11
   unsigned int v12; // ebx@11
-  RenderD3D *v13; // ecx@11
+  //RenderD3D *v13; // ecx@11
   char v14; // dl@11
 
   //__debugbreak();
@@ -1002,13 +1002,13 @@
     v12 = pRenderer->bUsingSpecular;
     stru_F8AD28._blv_lights_light_dot_faces[*pSlot] = v11;
     stru_F8AD28._blv_lights_types[*pSlot] = pLight->uLightType;
-    v13 = pRenderer->pRenderD3D;
+    //v13 = pRenderer->pRenderD3D;
     v14 = stru_F8AD28._blv_lights_types[*pSlot];
     if ( pRenderer->pRenderD3D && v12 && v14 & 4 )
       v14 = _4E94D2_light_type;
     stru_F8AD28._blv_lights_types[*pSlot] = v14;
     result = 4 * *pSlot;
-    if ( v13 && v12 )
+    if ( /*v13*/true && v12 )
     {
       if ( stru_F8AD28._blv_lights_types[*pSlot] & 4 )
       {
--- a/Monsters.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Monsters.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
--- a/Mouse.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Mouse.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,8 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
-
 #include "Texture.h"
 #include "mm7_data.h"
 #include "Render.h"
@@ -107,7 +102,7 @@
   else
   {*/
     GetCursorPos(&Point);
-    if ( pRenderer->bWindowMode )
+    //if ( pRenderer->bWindowMode )
       ScreenToClient(window->GetApiHandle(), &Point);
     result = Point.y;
     v2 = Point.x;
--- a/NPC.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/NPC.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "texts.h"
 #include "LOD.h"
 #include "Autonotes.h"
--- a/Outdoor.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Outdoor.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "stru6.h"
 #include "Weather.h"
 #include "Sprites.h"
@@ -93,7 +89,7 @@
   if (viewparams->draw_d3d_outlines)
     pGame->pIndoorCameraD3D->debug_flags |= ODM_RENDER_DRAW_D3D_OUTLINES;
 
-  if (bRedraw || pRenderer->pRenderD3D)
+  if (bRedraw || true/*pRenderer->pRenderD3D*/)
   {
     //pODMRenderParams->RotationToInts();
     sub_481ED9_MessWithODMRenderParams();
@@ -112,16 +108,15 @@
   pOutdoor->UpdateFog();
   //pGame->pIndoorCameraD3D->sr_Reset_list_0037C();
 
-  if (pRenderer->pRenderD3D) // d3d - redraw always
+  //if (pRenderer->pRenderD3D) // d3d - redraw always
   {
     pRenderer->DrawOutdoorSkyD3D();
     pRenderer->DrawBuildingsD3D();
     pRenderer->RenderTerrainD3D();
   }
-  else
+  /*else
   {
-    __debugbreak(); // no SW Rendering
-    /*if (!bRedraw)
+    if (!bRedraw)
       pRenderer->OnOutdoorRedrawSW();
     else
     {
@@ -129,8 +124,8 @@
       pRenderer->DrawBezierTerrain();
       sr_sub_486F92_MessWithEdgesAndSpans();
       pODMRenderParams->ApplyLightmapsSW();
-    }*/
-  }
+    }
+  }*/
 
 
   pMobileLightsStack->uNumLightsActive = 0;
@@ -149,7 +144,7 @@
     pOutdoor->UpdateDiscoveredArea(v5, v4, 1);
   }
   pGame->uFlags2 &= 0xFFFFFFFEu;
-  if (pRenderer->pRenderD3D && pRenderer->bUsingSpecular)
+  if (/*pRenderer->pRenderD3D*/true && pRenderer->bUsingSpecular)
     pGame->pLightmapBuilder->uFlags |= 1u;
   else
     pGame->pLightmapBuilder->uFlags &= 0xFFFFFFFEu;
--- a/Outdoor_stuff.h	Thu Jan 09 01:37:34 2014 +0200
+++ b/Outdoor_stuff.h	Thu Jan 09 02:34:20 2014 +0200
@@ -16,7 +16,6 @@
   }
 
   int _479295();
-  void DrawBorderTiles();
   //void _48276F_sr();
   void _normalize_v_18();
   void Create_48607B(struct stru149 *a2);
--- a/Overlays.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Overlays.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <stdlib.h>
 
 #include "Overlays.h"
--- a/PaletteManager.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/PaletteManager.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "PaletteManager.h"
 #include "Texture.h"
 #include "Game.h"
--- a/Party.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Party.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "Party.h"
 #include "MapInfo.h"
 #include "Timer.h"
--- a/Player.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Player.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "stru6.h"
 
 #include "Player.h"
--- a/Render.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Render.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,4 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
+#include "Render.h"
 #include "Outdoor_stuff.h"
 #include "VideoPlayer.h"
 #include "Sprites.h"
@@ -11,7 +8,6 @@
 #include "GUIWindow.h"
 #include "DecalBuilder.h"
 #include "ParticleEngine.h"
-#include "Render.h"
 #include "Outdoor.h"
 #include "Party.h"
 #include "LOD.h"
@@ -50,8 +46,6 @@
 
 RenderVertexD3D3 d3d_vertex_buffer[50];
 
-void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1);
-
 /*  384 */
 #pragma pack(push, 1)
 struct PCXHeader_1
@@ -406,7 +400,7 @@
 
       // for all shore tiles - draw a tile water under them since they're half-empty
       if (!_strnicmp(pBitmaps_LOD->pTextures[pTilePolygon->uTileBitmapID].pName, "wtrdr", 5))  // all shore tile filenames are wtrdrXXX
-        pTilePolygon->DrawBorderTiles();
+        DrawBorderTiles(pTilePolygon);
 
       pRenderer->DrawTerrainPolygon(pTilePolygon->uNumVertices, pTilePolygon, pBitmaps_LOD->pHardwareTextures[v6], transparent, true);
       }
@@ -421,6 +415,17 @@
 }
 
 
+//----- (004811A3) --------------------------------------------------------
+void Render::DrawBorderTiles(struct Polygon *poly)
+{
+  pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false);
+  DrawTerrainPolygon(poly->uNumVertices, poly,
+                     pBitmaps_LOD->pHardwareTextures[pHDWaterBitmapIDs[hd_water_current_frame]], false, true);
+
+  pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true);
+  //DrawTerrainPolygon(poly->uNumVertices, poly, pBitmaps_LOD->pHardwareTextures[poly->uTileBitmapID], true, true);
+}
+
 
 //----- (0047BACF) --------------------------------------------------------
 void Render::TransformBillboardsAndSetPalettesODM()
@@ -2156,8 +2161,6 @@
   v1->bRequiredTextureStagesAvailable = 0;
   v1->bTinting = 1;
   LOBYTE(v1->field_103668) = 0;
-  v1->field_1036B8 = 0;
-  v1->_gpu_memory_used = 0;
   uNumBillboardsToDraw = 0;
   bFogEnabled = false;
 
@@ -6393,7 +6396,6 @@
   sprite_texture = pD3DSprites.LoadTexture(pSprite->pName, pSprite->uPaletteID);
   if ( sprite_texture )
   {
-    _gpu_memory_used += 2 * sprite_texture->uWidth * sprite_texture->uHeight;
     pSprite->uAreaX = sprite_texture->uAreaX;
     pSprite->uAreaY = sprite_texture->uAreaY;
     pSprite->uBufferWidth = sprite_texture->uBufferWidth;
@@ -8656,12 +8658,12 @@
 }
 
 //----- (004A1C1E) --------------------------------------------------------
-void DoRenderBillboards_D3D()
-{
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE));
+void Render::DoRenderBillboards_D3D()
+{
+  ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP));
+  ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE));
+  ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE));
+  ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE));
   
   /*if (pRenderer->uNumBillboardsToDraw)
   {
@@ -8694,54 +8696,52 @@
 
   }*/
 
-  for (int i = pRenderer->uNumBillboardsToDraw - 1; i >= 0; --i)
-  {
-    if((int)pRenderer->pBillboardRenderListD3D[i].pTexture == 0xcdcdcdcd)
-      __debugbreak();//Ritor1: error
-    if (pRenderer->pBillboardRenderListD3D[i].uOpacity != RenderBillboardD3D::NoBlend)
-      SetBillboardBlendOptions(pRenderer->pBillboardRenderListD3D[i].uOpacity);
+  for (int i = uNumBillboardsToDraw - 1; i >= 0; --i)
+  {
+    if (pBillboardRenderListD3D[i].uOpacity != RenderBillboardD3D::NoBlend)
+      SetBillboardBlendOptions(pBillboardRenderListD3D[i].uOpacity);
     
 
-    pRenderer->pRenderD3D->pDevice->SetTexture(0, pRenderer->pBillboardRenderListD3D[i].pTexture);
-    ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
-                                                         D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-                                                         pRenderer->pBillboardRenderListD3D[i].pQuads, pRenderer->pBillboardRenderListD3D[i].uNumVertices,
-                                                         D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS));
-  }
-
-  if (pRenderer->bFogEnabled)
-  {
-    pRenderer->bFogEnabled = false;
-    ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE));
-    ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF));
-    ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0));
-  }
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO));
-  ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE));
+    pRenderD3D->pDevice->SetTexture(0, pBillboardRenderListD3D[i].pTexture);
+    ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
+                                              D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
+                                              pBillboardRenderListD3D[i].pQuads, pBillboardRenderListD3D[i].uNumVertices,
+                                              D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS));
+  }
+
+  if (bFogEnabled)
+  {
+    bFogEnabled = false;
+    ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE));
+    ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF));
+    ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0));
+  }
+  ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW));
+  ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE));
+  ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE));
+  ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
+  ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO));
+  ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE));
 }
 
 //----- (004A1DA8) --------------------------------------------------------
-void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1)
+void Render::SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1)
 {
   switch (a1)
   {
     case RenderBillboardD3D::Transparent:
     {
-      if (pRenderer->bFogEnabled)
-      {
-        pRenderer->bFogEnabled = false;
-        ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE));
-        ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF));
-        ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0));
-      }
-
-      ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA));
-      ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA));
-      ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE));
+      if (bFogEnabled)
+      {
+        bFogEnabled = false;
+        ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE));
+        ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF));
+        ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0));
+      }
+
+      ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA));
+      ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA));
+      ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE));
     }
     break;
 
@@ -8749,18 +8749,18 @@
     case RenderBillboardD3D::Opaque_2:
     case RenderBillboardD3D::Opaque_3:
     {
-      if (pRenderer->bUsingSpecular)
-      {
-        if (!pRenderer->bFogEnabled)
+      if (bUsingSpecular)
+      {
+        if (!bFogEnabled)
         {
-          pRenderer->bFogEnabled = true;
-          ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE));
+          bFogEnabled = true;
+          ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE));
         }
       }
 
-      ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
-      ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE));
-      ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE));
+      ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
+      ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE));
+      ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE));
     }
     break;
 
--- a/Render.h	Thu Jan 09 01:37:34 2014 +0200
+++ b/Render.h	Thu Jan 09 02:34:20 2014 +0200
@@ -382,6 +382,7 @@
   void DrawBillboardList_BLV();
   void __cdecl sub_4A19B0();
 
+
   //unsigned int bUserDirect3D;
   //unsigned int bStartInWindow;
   unsigned int uDesiredDirect3DDevice;
@@ -455,8 +456,8 @@
   int hd_water_tile_id;
   IDirectDrawSurface4 *pSurface;
   IDirect3DTexture2 *pTexture;
-  int field_1036B8;
-  int _gpu_memory_used;
+  //int field_1036B8;
+  //int _gpu_memory_used;
   void ( *pBeforePresentFunction)();
   int field_1036C4;
   uint32_t bFogEnabled;
@@ -468,6 +469,12 @@
   //unsigned __int16 *pCurrentlyLockedSurfaceDataPtr;
   //void             *pCurrentlyLockedSoftSurface;
 
+  protected:
+  void DoRenderBillboards_D3D();
+  void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1);
+  void DrawBorderTiles(struct Polygon *poly);
+
+  public:
   inline void WritePixel16(int x, int y, unsigned __int16 color)
   {
     if (ddpfPrimarySuface.dwRGBBitCount == 32)
@@ -499,6 +506,16 @@
   }
 
 
+  inline void ToggleTint()          {bTinting = !bTinting;}
+  inline void ToggleColoredLights() {bUseColoredLights = !bUseColoredLights;}
+
+  inline void Sub01()
+  {
+    if (pRenderD3D && !bWindowMode)
+      _49FD3A();
+  }
+
+
   //int windowed_mode_width;
   //int windowed_mode_height;
 };
--- a/SaveLoad.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/SaveLoad.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <io.h>
 #include <direct.h>
 
--- a/Spells.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Spells.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <stdlib.h>
 
 #include "Spells.h"
--- a/Sprites.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Sprites.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <string.h>
 #include <algorithm>
 
--- a/StorylineTextTable.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/StorylineTextTable.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <stdlib.h>
 #include <string.h>
 
--- a/Texture.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Texture.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <stdlib.h>
 
 #include "Texture.h"
--- a/TileTable.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/TileTable.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
--- a/UI/Books/UIMapBook.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/Books/UIMapBook.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "..\..\MM7.h"
 #include "..\..\Render.h"
 #include "..\..\Mouse.h"
--- a/UI/Books/UINotesBooks.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/Books/UINotesBooks.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "..\..\MM7.h"
 #include "..\..\Render.h"
 #include "..\..\Mouse.h"
--- a/UI/Books/UISpellBook.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/Books/UISpellBook.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "..\..\MM7.h"
 #include "..\..\Render.h"
 #include "..\..\Mouse.h"
--- a/UI/UIBooks.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/UIBooks.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "..\MM7.h"
 #include "UIBooks.h"
 #include "..\Render.h"
--- a/UI/UICharacter.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/UICharacter.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <algorithm> 
 #include "..\MM7.h"
 #include "..\MapInfo.h"
--- a/UI/UIHouses.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/UIHouses.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "..\Texture.h"
 #include "..\mm7_data.h"
 #include "UIHouses.h"
--- a/UI/UIMainMenu.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/UIMainMenu.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "..\Mouse.h"
 #include "..\Keyboard.h"
 
--- a/UI/UIPartyCreation.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/UIPartyCreation.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "..\Mouse.h"
 #include "..\Keyboard.h"
 
--- a/UI/UIPopup.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/UIPopup.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "..\MM7.h"
 
 #include "..\Mouse.h"
--- a/UI/UIRest.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/UIRest.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "..\GUIWindow.h"
 #include "..\GUIFont.h"
 #include "..\Party.h"
--- a/UI/UISaveLoad.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/UISaveLoad.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,8 +1,5 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
+#include <io.h>
 
-#include <io.h>
 #include "..\MM7.h"
 
 #include "..\Keyboard.h"
--- a/UI/UITransition.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/UITransition.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <io.h>
 
 #include "..\mm7_data.h"
--- a/UI/UiGame.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/UI/UiGame.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "..\Texture.h"
 #include "..\MM7.h"
 
--- a/VideoPlayer.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/VideoPlayer.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 
 #include "Bink_Smacker.h"
 
--- a/Weather.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/Weather.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -16,11 +16,9 @@
 //----- (004C2AA6) --------------------------------------------------------
 int Weather::DrawSnow()
 {
-  unsigned __int16 *v1; // edi@1
 
 //  if (!FORCE_16_BITS)
   //  __debugbreak(); // function expects 16bit target buffer, will fail otherwise
-  v1 = (unsigned __int16 *)pRenderer->pTargetSurface;
   for ( uint i = 0; i < 700; ++i )
   {
     int x = 2 * i;
--- a/_deleted.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/_deleted.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -12441,9 +12441,6 @@
   unsigned int bUseBigBuffer;
   void *pBigBufferAligned;
 };
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
 
 #include <string.h>
 #include <stdio.h>
--- a/mm7_2.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/mm7_2.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <io.h>
 #include <direct.h>
 
@@ -792,7 +788,7 @@
   dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
   pRenderer->EndScene();
   pRenderer->Present();
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
     pRenderer->pBeforePresentFunction();
   pRenderer->SaveWinnersCertificate("MM7_Win.Pcx");
   free(pFont);
@@ -3055,11 +3051,6 @@
   pBitmaps_LOD->ReleaseAll2();
   pSprites_LOD->DeleteSomeOtherSprites();
   pIcons_LOD->ReleaseAll2();
-  if (pRenderer->pRenderD3D)
-  {
-    pRenderer->field_1036B8 = 0;
-    pRenderer->_gpu_memory_used = 0;
-  }
 
   if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
     pIndoor->Release();
--- a/mm7_3.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/mm7_3.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "Weather.h"
 #include "Texture.h"
 #include "mm7_data.h"
@@ -3085,19 +3081,6 @@
 }
 
 
-//----- (004811A3) --------------------------------------------------------
-void Polygon::DrawBorderTiles()
-{
-  //__debugbreak();
-
-  pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false);
-  pRenderer->DrawTerrainPolygon(uNumVertices, this,
-    pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true);
-
-  pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true);
-  //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true);
-}
-
 
 //----- (00481ED9) --------------------------------------------------------
 void  sub_481ED9_MessWithODMRenderParams()
--- a/mm7_4.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/mm7_4.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "mm7_data.h"
 #include "mm7_unsorted_subs.h"
 #include "Texture.h"
--- a/mm7_5.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/mm7_5.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "MapInfo.h"
 #include "LightmapBuilder.h"
 #include "mm7.h"
--- a/mm7_6.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/mm7_6.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,11 +1,5 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "MM7.h"
 
-
-
 #include "Weather.h"
 #include "Sprites.h"
 #include "BSPModel.h"
@@ -520,11 +514,10 @@
   int i; // [sp+38h] [bp+Ch]@33
   signed int v32; // [sp+3Ch] [bp+10h]@32
 
-  //__debugbreak();//Ritor1
   v4 = 0;
   v5 = this;
   v24 = this;
-  if ( pRenderer->pRenderD3D )
+  //if ( pRenderer->pRenderD3D )
   {
     v6 = a3 != 0;
     if ( a4 )
@@ -534,7 +527,7 @@
       return (unsigned __int16)v7;
     else return 0;
   }
-  else
+  /*else // software impl
   {
     v30 = 0;
     if ( pRenderer->pActiveZBuffer )
@@ -635,31 +628,26 @@
       }
     }
   }
-  return 0;
+  return 0;*/
 }
 
 //----- (0042F3D6) --------------------------------------------------------
 void InitializeTurnBasedAnimations(void *_this)
 {
-  unsigned int *v1; // edi@1
+  for (unsigned int i = 0; i < pIconIDs_Turn.size(); ++i)
+  {
+    char icon_name[32];
+    sprintf(icon_name, "turn%u", i);
+    pIconIDs_Turn[i] = pIconsFrameTable->FindIcon("turn0");
+    pIconsFrameTable->InitializeAnimation(pIconIDs_Turn[i]);
+  }
 
-  pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0");
-  pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1");
-  pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2");
-  pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3");
-  pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4");
   uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop");
   uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour");
   uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart");
   uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1");
   uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11");
-  v1 = pIconIDs_Turn.data();
-  do
-  {
-    pIconsFrameTable->InitializeAnimation(*v1);
-    ++v1;
-  }
-  while ( (signed int)v1 < (signed int)&uIconID_TurnStop );
+
   pIconsFrameTable->InitializeAnimation(uIconID_TurnHour);
   pIconsFrameTable->InitializeAnimation(uIconID_TurnStop);
   pIconsFrameTable->InitializeAnimation(uIconID_TurnStart);
@@ -816,25 +804,6 @@
                SLOWORD(a1a.vPosition.z), 0, 0);
 }
 
-//----- (0042FB5C) --------------------------------------------------------
-bool _42FB5C_check_spell(signed int spell_id)
-{
-  if ( spell_id > 39 )
-  {
-    if ( spell_id == SPELL_SPIRIT_BLESS || spell_id == SPELL_SPIRIT_FATE || spell_id == SPELL_SPIRIT_HEROISM || spell_id == SPELL_BODY_HAMMERHANDS
-      || spell_id == SPELL_BODY_POWER_CURE ||spell_id == SPELL_LIGHT_DISPEL_MAGIC || spell_id == SPELL_LIGHT_DAY_OF_PROTECTION
-      || spell_id == SPELL_LIGHT_HOUR_OF_POWER || spell_id == SPELL_DARK_PAIN_REFLECTION)
-      return false;
-    return true;
-  }
-  if ( spell_id == SPELL_FIRE_FIRE_BOLT || spell_id == SPELL_FIRE_FIREBALL || spell_id == SPELL_FIRE_METEOR_SHOWER
-    || spell_id == SPELL_AIR_LIGHNING_BOLT || spell_id == SPELL_EARTH_BLADES )
-    return true;
-  if ( spell_id == SPELL_FIRE_HASTE || spell_id == SPELL_AIR_SHIELD || spell_id == SPELL_EARTH_STONESKIN )
-    return false;
-  return true;
-}
-
 //----- (0042FBDD) --------------------------------------------------------
 void  sub_42FBDD()
 {
--- a/mm7_7.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/mm7_7.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "mm7_data.h"
 #include "Render.h"
 #include "texts.h"
--- a/mm7_data.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/mm7_data.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include "mm7_data.h"
 
 #include "GUIWindow.h"
--- a/mm7_unsorted_subs.h	Thu Jan 09 01:37:34 2014 +0200
+++ b/mm7_unsorted_subs.h	Thu Jan 09 02:34:20 2014 +0200
@@ -75,7 +75,6 @@
 void __fastcall sub_42F960_create_object(int x, int y, int z); // idb
 void CompactLayingItemsList();
 void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6);
-bool _42FB5C_check_spell(signed int spell_id);
 void sub_42FBDD();
 void CloseWindowBackground();
 void ProcessInputActions();
@@ -218,7 +217,6 @@
 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim);
 bool CheckTextureStages();
 bool AreRenderSurfacesOk();
-void DoRenderBillboards_D3D();
 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/mm7text_ru.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/mm7text_ru.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,7 +1,3 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
--- a/texts.cpp	Thu Jan 09 01:37:34 2014 +0200
+++ b/texts.cpp	Thu Jan 09 02:34:20 2014 +0200
@@ -1,8 +1,5 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
+#include <string.h>
 
-#include <string.h>
 #include "LOD.h"
 #include "mm7_data.h"
 #include "texts.h"