changeset 1264:6bc88137a019

Merge
author Gloval
date Thu, 13 Jun 2013 00:56:22 +0400
parents 73269755dd89 (current diff) 0aeac0b9ca30 (diff)
children 71ebff35c428
files Arcomage.cpp mm7_3.cpp mm7_5.cpp mm7_data.cpp mm7_data.h
diffstat 46 files changed, 214 insertions(+), 192 deletions(-) [+]
line wrap: on
line diff
--- a/Allocator.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Allocator.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -4,7 +4,6 @@
 
 #include <string.h>
 #include <stdio.h>
-#include "OSAPI.h"
 
 #include "Allocator.h"
 
--- a/Arcomage.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Arcomage.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -20,6 +20,7 @@
 #include "VectorTypes.h"
 #include "texts.h"
 #include <windef.h>
+#include "mm7_data.h"
 
 
 
--- a/AudioPlayer.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/AudioPlayer.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -7,6 +7,7 @@
 
 #include "stru11.h"
 
+#include "mm7_data.h"
 #include "VideoPlayer.h"
 #include "AudioPlayer.h"
 #include "Allocator.h"
--- a/CShow.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/CShow.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -2,6 +2,7 @@
 
 #include "CShow.h"
 
+#include "mm7_data.h"
 #include "VideoPlayer.h"
 #include "Mouse.h"
 
--- a/Events.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Events.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -5,6 +5,8 @@
 #include <assert.h>
 #include <stdlib.h>
 
+#include "Texture.h"
+#include "mm7_data.h"
 #include "VideoPlayer.h"
 #include "Mouse.h"
 
--- a/GUIButton.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/GUIButton.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -1,7 +1,6 @@
 #include "GUIWindow.h"
 #include "GUIFont.h"
 
-#include "mm7_data.h"
 
 
 
--- a/GUIProgressBar.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/GUIProgressBar.h	Thu Jun 13 00:56:22 2013 +0400
@@ -41,9 +41,9 @@
   RGBTexture field_68;
   RGBTexture field_90;
   RGBTexture field_B8;
-  Texture field_E0;
-  Texture pBardata;
-  Texture pLoadingProgress;
+  struct Texture field_E0;
+  struct Texture pBardata;
+  struct Texture pLoadingProgress;
 };
 #pragma pack(pop)
 
--- a/GUIWindow.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/GUIWindow.h	Thu Jun 13 00:56:22 2013 +0400
@@ -325,7 +325,7 @@
   }
 
   GUIButton *CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, int a6, int a7, 
-	                      UIMessageType msg, unsigned int msg_param, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...);
+	                      UIMessageType msg, unsigned int msg_param, unsigned __int8 uHotkey, const char *pName, struct Texture *pTextures, ...);
   void DrawFlashingInputCursor(signed int a3, int a4, struct GUIFont *a2);
   int DrawTextInRect(GUIFont *a2, unsigned int uX, unsigned int uY, unsigned int uColor, const char *Str1, int Source, int a8);
   void DrawText(GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor);
--- a/Game.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Game.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -38,6 +38,8 @@
 #include "texts.h"
 #include "GUIFont.h"
 #include "Log.h"
+#include "Lights.h"
+#include "mm7_data.h"
 
 //#include "MM7.h"
 
--- a/Indoor.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Indoor.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -33,6 +33,7 @@
 #include "PaletteManager.h"
 #include "MapInfo.h"
 #include "IndoorCamera.h"
+#include "Lights.h"
 
 #include "mm7_data.h"
 #include "MM7.h"
--- a/Indoor.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/Indoor.h	Thu Jun 13 00:56:22 2013 +0400
@@ -1,6 +1,7 @@
 #pragma once
 #include "VectorTypes.h"
 #include "Weather.h"
+#include "Indoor_stuff.h"
 
 
 
@@ -128,17 +129,6 @@
 
 
 
-/*  291 */
-enum PolygonType : __int8
-{
-  POLYGON_Invalid = 0x0,
-  POLYGON_VerticalWall = 0x1,
-  POLYGON_unk = 0x2,
-  POLYGON_Floor = 0x3,
-  POLYGON_InBetweenFloorAndWall = 0x4,
-  POLYGON_Ceiling = 0x5,
-  POLYGON_InBetweenCeilingAndWall = 0x6,
-};
 
 /*   90 */
 #pragma pack(push, 1)
@@ -576,5 +566,3 @@
 
 
 
-
-#include "Indoor_stuff.h"
\ No newline at end of file
--- a/Indoor_stuff.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/Indoor_stuff.h	Thu Jun 13 00:56:22 2013 +0400
@@ -370,6 +370,17 @@
 extern stru337 stru_F81018;
 
 
+/*  291 */
+enum PolygonType : __int8
+{
+  POLYGON_Invalid = 0x0,
+  POLYGON_VerticalWall = 0x1,
+  POLYGON_unk = 0x2,
+  POLYGON_Floor = 0x3,
+  POLYGON_InBetweenFloorAndWall = 0x4,
+  POLYGON_Ceiling = 0x5,
+  POLYGON_InBetweenCeilingAndWall = 0x6,
+};
 
 
 /*  147 */
--- a/Keyboard.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Keyboard.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -2,7 +2,6 @@
 #define _CRT_SECURE_NO_WARNINGS
 #endif
 
-#include "OSAPI.h"
 
 #include "Keyboard.h"
 #include "GUIWindow.h"
--- a/LOD.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/LOD.h	Thu Jun 13 00:56:22 2013 +0400
@@ -150,13 +150,13 @@
   bool LoadIconsOrEvents(const char *pLODFilename);
   void ReleaseAll();
   unsigned int LoadTexture(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT);
-  Texture *LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT);
-  int LoadTextureFromLOD(Texture *pOutTex, const char *pContainer, enum TEXTURE_TYPE eTextureType);
-  int ReloadTexture(Texture *pDst, const char *pContainer, int mode);
+  struct Texture *LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT);
+  int LoadTextureFromLOD(struct Texture *pOutTex, const char *pContainer, enum TEXTURE_TYPE eTextureType);
+  int ReloadTexture(struct Texture *pDst, const char *pContainer, int mode);
   void ReleaseHardwareTextures();
   void ReleaseLostHardwareTextures();
   void _410423_move_textures_to_device();
-  int _410522(Texture *pDst, const char *pContainer, unsigned int uTextureType);
+  int _410522(struct Texture *pDst, const char *pContainer, unsigned int uTextureType);
   void SetupPalettes(unsigned int uTargetRBits, unsigned int uTargetGBits, unsigned int uTargetBBits);
   void ReleaseAll2();
   void _4114F2();
@@ -165,7 +165,7 @@
   void _inlined_sub1();
   void _inlined_sub2();
 
-  inline Texture *GetTexture(int idx)
+  inline struct Texture *GetTexture(int idx)
   {
     assert(idx < 1000);
     if (idx == -1) return nullptr; // we need to return dummy texture here
--- a/LightmapBuilder.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/LightmapBuilder.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -5,6 +5,7 @@
 #include "Log.h"
 
 #include "OutdoorCamera.h"
+#include "Lights.h"
 
 #include "mm7_data.h"
 
--- a/LightmapBuilder.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/LightmapBuilder.h	Thu Jun 13 00:56:22 2013 +0400
@@ -1,8 +1,9 @@
 #pragma once
 #include <vector>
 #include "Render.h"
-#include "Lights.h"
 
+struct LightsStack_StationaryLight_;
+struct LightsStack_MobileLight_;
 
 /*  115 */
 #pragma pack(push, 1)
--- a/LightsStack.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/LightsStack.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -1,7 +1,6 @@
 #include <string>
 #include "Lights.h"
 
-#include "mm7_data.h"
 
 //----- (00467D88) --------------------------------------------------------
 bool LightsStack_MobileLight_::AddLight(__int16 x, __int16 y, __int16 z, __int16 uSectorID, int uRadius, unsigned __int8 r, unsigned __int8 g, unsigned __int8 b, char uLightType)
--- a/Math.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/Math.h	Thu Jun 13 00:56:22 2013 +0400
@@ -2,6 +2,9 @@
 #include <cassert>
 #include <limits>
 #include <float.h>
+#include <cmath>
+#include <cstdlib>
+#include <ciso646>
 
 
 /*  186 */
@@ -35,9 +38,6 @@
 #define ROUNDING_EPSILON 0.0000001
 #endif
 
-#include <cmath>
-#include <cstdlib>
-#include <ciso646>
 
 template <typename FloatType>
 int bankersRounding(
--- a/Mouse.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Mouse.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -2,9 +2,9 @@
 #define _CRT_SECURE_NO_WARNINGS
 #endif
 
-#include "OSAPI.h"
 
-#include "VideoPlayer.h"
+#include "Texture.h"
+#include "mm7_data.h"
 #include "Render.h"
 #include "Mouse.h"
 #include "Items.h"
--- a/Outdoor.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Outdoor.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -30,6 +30,7 @@
 
 #include "mm7_data.h"
 #include "MM7.h"
+#include "Lights.h"
 
 
 #include "MapInfo.h"
--- a/Outdoor.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/Outdoor.h	Thu Jun 13 00:56:22 2013 +0400
@@ -2,8 +2,7 @@
 
 #include "Indoor.h"
 #include "TileFrameTable.h"
-#include "Weather.h"
-#include "BSPModel.h"
+#include "Outdoor_stuff.h"
 
 #define DAY_ATTRIB_FOG  1
 
@@ -273,5 +272,3 @@
 
 
 
-
-#include "Outdoor_stuff.h"
\ No newline at end of file
--- a/Outdoor_stuff.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/Outdoor_stuff.h	Thu Jun 13 00:56:22 2013 +0400
@@ -32,7 +32,7 @@
   __int16 field_32;
   int field_34;
   struct stru149 *ptr_38;
-  Texture *pTexture;
+  struct Texture *pTexture;
   struct Span *prolly_head;
   struct Span *prolly_tail;
   int **ptr_48;
--- a/Party.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/Party.h	Thu Jun 13 00:56:22 2013 +0400
@@ -1,7 +1,6 @@
 #pragma once
 #include "Player.h"
 #include "NPC.h"
-#include "Spells.h"
 #include "VectorTypes.h"
 
 
--- a/Player.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Player.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -7,7 +7,6 @@
 #include "stru6.h"
 
 
-#include "OSAPI.h"
 #include "Player.h"
 #include "PlayerFrameTable.h"
 #include "AudioPlayer.h"
--- a/Random.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Random.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -1,8 +1,7 @@
 #include <math.h>
 
 #include "Random.h"
-
-#include "mm7_data.h"
+#include "Math.h"
 
 
 
@@ -50,13 +49,11 @@
   double v3; // ST04_8@1
   int floored_random; // ecx@1
 
-  v1 = this;
   v2 = GetRandom() * (double)this->range;
-  v3 = v2 + 6.7553994e15;
-  floored_random = LODWORD(v3);
-  if ( SLODWORD(v3) >= v1->range )
-    floored_random = v1->range;
-  return floored_random + v1->min;
+  floored_random = bankersRounding(v2);
+  if ( floored_random >= this->range )
+    floored_random = this->range;
+  return floored_random + this->min;
 }
 
 //----- (004BE65D) --------------------------------------------------------
--- a/Render.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Render.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -36,6 +36,7 @@
 #include "texts.h"
 #include "mm7_data.h"
 #include "MM7.h"
+#include "Lights.h"
 
 #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib")
 #pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib")
--- a/Render.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/Render.h	Thu Jun 13 00:56:22 2013 +0400
@@ -323,7 +323,7 @@
   void DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders);
   void DrawSkyPolygon(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *pTexture);
   void _4A2ED5(signed int a2, stru148 *a3, IDirect3DTexture2 *pHwTex);
-  void DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8);
+  void DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, struct Texture *pTex, int uPackedID, unsigned int uColor, int a8);
   void MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
   void MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
   void TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard);
@@ -340,20 +340,20 @@
   void ResetTextureClipRect();
   void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4);
   void _4A5D33(unsigned int a2, unsigned int a3, int a4, int a5, RGBTexture *pTexture);
-  void DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4);
-  void ZBuffer_Fill_2(signed int a2, signed int a3, Texture *pTexture, int a5);
-  void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, Texture *pTexture, int zVal);
-  void DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture);
-  void _4A63E6(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8);
-  void _4A65CC(unsigned int x, unsigned int y, Texture *a4, Texture *a5, int a6, int a7, int a8);
-  void DrawTransparentRedShade(unsigned int a2, unsigned int a3, Texture *a4);
-  void DrawTransparentGreenShade(signed int a2, signed int a3, Texture *pTexture);
-  void _4A6A68(unsigned int a2, unsigned int a3, Texture *a4, __int16 height);
+  void DrawTextureIndexed(unsigned int uX, unsigned int uY, struct Texture *a4);
+  void ZBuffer_Fill_2(signed int a2, signed int a3, struct Texture *pTexture, int a5);
+  void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, struct Texture *pTexture, int zVal);
+  void DrawTextureTransparent(unsigned int uX, unsigned int uY, struct Texture *pTexture);
+  void _4A63E6(unsigned int a2, unsigned int a3, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8);
+  void _4A65CC(unsigned int x, unsigned int y, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8);
+  void DrawTransparentRedShade(unsigned int a2, unsigned int a3, struct Texture *a4);
+  void DrawTransparentGreenShade(signed int a2, signed int a3, struct Texture *pTexture);
+  void _4A6A68(unsigned int a2, unsigned int a3, struct Texture *a4, __int16 height);
   void DrawTextPalette(int x, int y, int a4, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8);
   void DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor);
   void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16);
   int _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, unsigned __int16 *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7);
-  void _4A6E7E(unsigned int a2, unsigned int a3, Texture *a4);
+  void _4A6E7E(unsigned int a2, unsigned int a3, struct Texture *a4);
   char DrawBuildingsD3D();
   struct BSPModel *DrawBuildingsSW();
   int OnOutdoorRedrawSW();
--- a/Texture.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Texture.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -192,6 +192,8 @@
 unsigned int uTextureID_BACKDOLL; // weak
 unsigned int uTextureID_BACKHAND; // weak
 
+stru355 stru_4E82A4 = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000};
+stru355 stru_4EFCBC = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000};
 
 Texture pTex_F7CE30;
 
--- a/Texture.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/Texture.h	Thu Jun 13 00:56:22 2013 +0400
@@ -125,51 +125,49 @@
 
 
 
-
-
 extern std::array<struct RGBTexture, 45> pSavegameThumbnails;
-extern std::array<Texture *, 2> pTexture_LloydBeacons;
-extern Texture *pTexture_50635C;
-extern Texture *pTexture_506368;
-extern Texture *pTexture_50636C;
-extern Texture *pTexture_506370;
-extern Texture *pTexture_506374;
-extern Texture *pTexture_506378;
-extern Texture *pTexture_50637C;
-extern Texture *pTexture_506380;
-extern Texture *pTexture_506384;
-extern Texture *pTexture_506388;
-extern Texture *pTexture_50638C;
-extern Texture *pTexture_506390;
-extern Texture *pTexture_506394;
-extern Texture *pTex_tab_an_7a__zoot_off;
-extern Texture *pTex_tab_an_6a__zoom_off;
-extern Texture *pTex_tab_an_7b__zoot_on;
-extern Texture *pTex_tab_an_6b__zoom_on;
-extern std::array<Texture *, 6> pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit
+extern std::array<struct Texture *, 2> pTexture_LloydBeacons;
+extern struct Texture *pTexture_50635C;
+extern struct Texture *pTexture_506368;
+extern struct Texture *pTexture_50636C;
+extern struct Texture *pTexture_506370;
+extern struct Texture *pTexture_506374;
+extern struct Texture *pTexture_506378;
+extern struct Texture *pTexture_50637C;
+extern struct Texture *pTexture_506380;
+extern struct Texture *pTexture_506384;
+extern struct Texture *pTexture_506388;
+extern struct Texture *pTexture_50638C;
+extern struct Texture *pTexture_506390;
+extern struct Texture *pTexture_506394;
+extern struct Texture *pTex_tab_an_7a__zoot_off;
+extern struct Texture *pTex_tab_an_6a__zoom_off;
+extern struct Texture *pTex_tab_an_7b__zoot_on;
+extern struct Texture *pTex_tab_an_6b__zoom_on;
+extern std::array<struct Texture *, 6> pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit
 
-extern std::array<Texture *, 12> dword_5063D8;
-extern std::array<Texture *, 12> dword_506408;
-extern Texture *pTexture_50643C; // idb
-extern Texture *ptr_506440;
-extern Texture *pTexture_506444;
-extern Texture *pTexture_506448; // idb
-extern std::array<std::array<Texture *, 2>, 9> pTextures_tabs;
-extern Texture *pTexture_mapbordr; // idb
-extern Texture *pTexture_pagemask; // idb
-extern std::array<Texture *, 9> pSpellBookPagesTextr;
-extern Texture *pSpellBookPagesTextr_9;
-extern Texture *pSpellBookPagesTextr_10;
-extern Texture *pSpellBookPagesTextr_11;
-extern Texture *pSpellBookPagesTextr_12;
-extern Texture *pSpellBookPagesTextr_13;
-extern Texture *pTexture_AutonotesBook;
-extern Texture *pTexture_CurrentBook;
-extern Texture *pTex_moon_new;
-extern Texture *pTex_moon_4;
-extern Texture *pTex_moon_2;
-extern Texture *pTex_moon_2_2;
-extern Texture *pTex_moon_ful;
+extern std::array<struct Texture *, 12> dword_5063D8;
+extern std::array<struct Texture *, 12> dword_506408;
+extern struct Texture *pTexture_50643C; // idb
+extern struct Texture *ptr_506440;
+extern struct Texture *pTexture_506444;
+extern struct Texture *pTexture_506448; // idb
+extern std::array<std::array<struct Texture *, 2>, 9> pTextures_tabs;
+extern struct Texture *pTexture_mapbordr; // idb
+extern struct Texture *pTexture_pagemask; // idb
+extern std::array<struct Texture *, 9> pSpellBookPagesTextr;
+extern struct Texture *pSpellBookPagesTextr_9;
+extern struct Texture *pSpellBookPagesTextr_10;
+extern struct Texture *pSpellBookPagesTextr_11;
+extern struct Texture *pSpellBookPagesTextr_12;
+extern struct Texture *pSpellBookPagesTextr_13;
+extern struct Texture *pTexture_AutonotesBook;
+extern struct Texture *pTexture_CurrentBook;
+extern struct Texture *pTex_moon_new;
+extern struct Texture *pTex_moon_4;
+extern struct Texture *pTex_moon_2;
+extern struct Texture *pTex_moon_2_2;
+extern struct Texture *pTex_moon_ful;
 
 
 
@@ -211,16 +209,16 @@
 extern unsigned int uTextureID_BUTTMAKE;
 extern unsigned int uTextureID_BUTTYES2;
 extern unsigned int uTextureID_x_ok_u;
-extern std::array<Texture *, 22> pPlayerPortraits;
-extern std::array<Texture *, 9> pTexture_IC_KNIGHT;
-extern Texture *pTexture_MAKESKY;
-extern Texture *pTexture_MAKETOP;
-extern std::array<Texture *, 20> pTextures_arrowr;
-extern std::array<Texture *, 20> pTextures_arrowl;
-extern Texture *pTexture_presleft;
-extern Texture *pTexture_pressrigh;
-extern Texture *pTexture_buttminu;
-extern Texture *pTexture_buttplus;
+extern std::array<struct Texture *, 22> pPlayerPortraits;
+extern std::array<struct Texture *, 9> pTexture_IC_KNIGHT;
+extern struct Texture *pTexture_MAKESKY;
+extern struct Texture *pTexture_MAKETOP;
+extern std::array<struct Texture *, 20> pTextures_arrowr;
+extern std::array<struct Texture *, 20> pTextures_arrowl;
+extern struct Texture *pTexture_presleft;
+extern struct Texture *pTexture_pressrigh;
+extern struct Texture *pTexture_buttminu;
+extern struct Texture *pTexture_buttplus;
 extern unsigned int uTextureID_Quit1;
 extern unsigned int uTextureID_Resume1;
 extern unsigned int uTextureID_Controls1;
@@ -269,9 +267,9 @@
 extern unsigned int uTextureID_right_panel_loop; // weak
 
 
-extern Texture *pTexture_Leather;
-extern Texture *pTexture_RestUI_CurrentSkyFrame; // idb
-extern Texture *pTexture_RestUI_CurrentHourglassFrame; // idb
+extern struct Texture *pTexture_Leather;
+extern struct Texture *pTexture_RestUI_CurrentSkyFrame; // idb
+extern struct Texture *pTexture_RestUI_CurrentHourglassFrame; // idb
 
 
 extern std::array<unsigned int, 5> uTextureID_Optkb;
@@ -315,12 +313,13 @@
 extern unsigned int uTextureID_BACKHAND; // weak
 
 
-extern Texture pTex_F7CE30;
+extern struct Texture pTex_F7CE30;
 
 
 extern RGBTexture stru_5773C4; // idb
 
-
+extern struct stru355 stru_4E82A4;// = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000};  moved to texture.h
+extern struct stru355 stru_4EFCBC;// = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000};  moved to texture.h
 
 
 
@@ -347,15 +346,15 @@
 struct stru350
 {
   stru350 *_450DDE();
-  bool _450DF1(const stru355 *p1, const stru355 *p2);
+  bool _450DF1(const struct stru355 *p1, const struct stru355 *p2);
   unsigned int _450F55(int a2);
   int _450FB1(int a2);
   int sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch,
                                      unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch,
                                      int a9, int a10);
 
-  stru355 field_0;
-  stru355 field_20;
+  struct stru355 field_0;
+  struct stru355 field_20;
   int field_40;
   int field_44;
   int field_48;
--- a/Time.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Time.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -1,10 +1,9 @@
-#include "OSAPI.h"
 
 #include "Time.h"
 #include "Keyboard.h"
 #include "Log.h"
 
-#include "mm7_data.h"
+#include "OSAPI.h"
 
 
 
--- a/UIHouses.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/UIHouses.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -2,6 +2,8 @@
 #define _CRT_SECURE_NO_WARNINGS
 #endif
 
+#include "Texture.h"
+#include "mm7_data.h"
 #include "UIHouses.h"
 #include "Party.h"
 #include "texts.h"
--- a/UITransition.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/UITransition.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -5,6 +5,7 @@
 #include <assert.h>
 #include <io.h>
 
+#include "mm7_data.h"
 #include "VideoPlayer.h"
 #include "MapInfo.h"
 #include "GUIWindow.h"
--- a/UiGame.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/UiGame.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -4,6 +4,7 @@
 
 #include <assert.h>
 
+#include "Texture.h"
 #include "MM7.h"
 
 #include "Mouse.h"
@@ -31,6 +32,7 @@
 #include "TurnEngine.h"
 #include "texts.h"
 #include "UIHouses.h"
+#include "BSPModel.h"
 
 
 
--- a/VideoPlayer.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/VideoPlayer.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -2,10 +2,10 @@
 #define _CRT_SECURE_NO_WARNINGS
 #endif
 
-#include "OSAPI.h"
 
 #include "Bink_Smacker.h"
 
+#include "mm7_data.h"
 #include "CShow.h"
 #include "Mouse.h"
 
@@ -1171,4 +1171,17 @@
   bStopBeforeSchedule = 0;
   pResetflag = 0;
   pGame->pCShow->PlayMovie(MOVIE_Death, 1);
-}
\ No newline at end of file
+}
+
+//----- (004BE6F5) --------------------------------------------------------
+VideoPlayer::VideoPlayer() :
+  field_54(0),
+  pBinkMovie(nullptr), pBinkBuffer(nullptr),
+  pSmackerMovie(nullptr), pSmackerBuffer(nullptr), pSmackMovieBlit(nullptr)
+{
+  //RGBTexture::RGBTexture(&pVideoPlayer->pVideoFrame);
+  bStopBeforeSchedule = false;
+  pResetflag = 0;
+  byte_F8BC0C = 0;
+  //pBinkMovie = nullptr;
+}
--- a/VideoPlayer.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/VideoPlayer.h	Thu Jun 13 00:56:22 2013 +0400
@@ -1,7 +1,7 @@
 #pragma once
 #include "OSAPI.h"
+#include "Texture.h"
 
-#include "mm7_data.h"
 
 
 
@@ -112,18 +112,7 @@
 #pragma pack(push, 1)
 struct VideoPlayer
 {
-  //----- (004BE6F5) --------------------------------------------------------
-  inline VideoPlayer():
-    field_54(0),
-    pBinkMovie(nullptr), pBinkBuffer(nullptr),
-    pSmackerMovie(nullptr), pSmackerBuffer(nullptr), pSmackMovieBlit(nullptr)
-  {
-    //RGBTexture::RGBTexture(&pVideoPlayer->pVideoFrame);
-    bStopBeforeSchedule = false;
-    pResetflag = 0;
-    byte_F8BC0C = 0;
-    //pBinkMovie = nullptr;
-  }
+  VideoPlayer();
   //----- (004BECBD) --------------------------------------------------------
   virtual ~VideoPlayer()
   {
--- a/Vis.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Vis.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -2,6 +2,7 @@
 
 #include "Vis.h"
 #include "Outdoor.h"
+#include "BSPModel.h"
 #include "Game.h"
 #include "Actor.h"
 #include "IndoorCamera.h"
--- a/Weather.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/Weather.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -4,7 +4,7 @@
 #include "Viewport.h"
 #include "Render.h"
 
-#include "mm7_data.h"
+#include "mm7_data.h"   ////TODO: remove this once LOWORD/HIWRD stuff is refactored
 
 
 
--- a/mm7_1.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/mm7_1.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -11,6 +11,8 @@
 //#include <defs.h>
 #include <assert.h>
 
+#include "Texture.h"
+#include "mm7_data.h"
 #include "VideoPlayer.h"
 #include "BSPModel.h"
 #include "Mouse.h"
--- a/mm7_2.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/mm7_2.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -8,6 +8,8 @@
 #include <windows.h>
 
 
+#include "Texture.h"
+#include "mm7_data.h"
 #include "VideoPlayer.h"
 #include "Sprites.h"
 #include "BSPModel.h"
@@ -64,6 +66,7 @@
 #include "UIHouses.h"
 #include "texts.h"
 #include "MM7.h"
+#include "Lights.h"
 
 //----- (004BB756) --------------------------------------------------------
 signed int __fastcall sub_4BB756(signed int a1)
@@ -7259,7 +7262,7 @@
   if (!bNoSound)
     pAudioPlayer->Initialize(hWnd);
 
-  pVideoPlayer = new VideoPlayer;
+  pVideoPlayer = new VideoPlayer();
   pVideoPlayer->Initialize();
 
   dword_6BE364_game_settings_1 |= 0x4000;
--- a/mm7_3.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/mm7_3.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -5,7 +5,8 @@
 #include <assert.h>
 
 
-#include "VideoPlayer.h"
+#include "Texture.h"
+#include "mm7_data.h"
 #include "Sprites.h"
 #include "BSPModel.h"
 #include "OutdoorCamera.h"
@@ -46,6 +47,7 @@
 #include "stru298.h"
 #include "texts.h"
 #include "Log.h"
+#include "Lights.h"
 
 #include "MM7.h"
 
--- a/mm7_4.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/mm7_4.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -4,6 +4,8 @@
 
 #include <assert.h>
 
+#include "Texture.h"
+#include "mm7_data.h"
 #include "VideoPlayer.h"
 #include "Sprites.h"
 #include "BSPModel.h"
@@ -43,6 +45,7 @@
 #include "texts.h"
 #include "Log.h"
 #include "UIHouses.h"
+#include "Lights.h"
 
 //----- (0046CC4B) --------------------------------------------------------
 void __cdecl check_event_triggers()
--- a/mm7_5.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/mm7_5.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -4,6 +4,8 @@
 
 #include <assert.h>
 
+#include "Texture.h"
+#include "mm7_data.h"
 #include "VideoPlayer.h"
 #include "Sprites.h"
 #include "MapInfo.h"
@@ -46,6 +48,8 @@
 #include "texts.h"
 #include "Log.h"
 #include "UIHouses.h"
+#include "Lights.h"
+#include "Lights.h"
 
 //----- (004304E7) --------------------------------------------------------
 void __cdecl GameUI_MsgProc()
@@ -3625,6 +3629,50 @@
   this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z;
 }
 
+//----- (00438526) --------------------------------------------------------
+stru11::stru11()
+{
+  stru11 *v1; // esi@1
+  signed int v2; // eax@1
+  char *v3; // edx@1
+
+  v1 = this;
+  v2 = 0;
+  this->cpuid_00000000_eax_numops = 0;
+  this->cpuid_00000001_eax = 0;
+  this->cpuid_00000001_edx = 0;
+  this->field_38 = 0;
+  this->field_3C = 0;
+  this->cpuid_80000000_edx = 0;
+  this->cpuid_80000001_eax = 0;
+  this->cpuid_80000001_edx = 0;
+  this->cpuid_80000005_ebx = 0;
+  this->cpuid_80000005_ecx = 0;
+  this->cpuid_80000005_edx = 0;
+  this->cpuid_80000006_ecx = 0;
+  this->field_AC = 0;
+  this->uProcessorManufacturer = 0;
+  LOBYTE(this->cpuid_80000002_registers2[0]) = 0;
+  v3 = (char *)&this->cpuid_00000002_eax;
+  do
+  {
+    if ( v2 < 3 )
+      *((int *)v3 - 9) = 0;
+    if ( v2 < 4 )
+      *(int *)v3 = 0;
+    if ( v2 < 12 )
+      *((int *)v3 + 17) = 0;
+    if ( v2 < 13 )
+      this->pCPUString[v2] = 0;
+    if ( v2 < 30 )
+      *((char *)this->field_40 + v2) = 0;
+    *((char *)&this->cpuid_80000002_registers2[0] + v2++ + 1) = 0;
+    v3 += 4;
+  }
+  while ( v2 < 48 );
+  CheckCPU();
+}
+
 //----- (004385B5) --------------------------------------------------------
 void stru11::CheckCPU()
 {
--- a/mm7_data.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/mm7_data.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -570,8 +570,6 @@
 int bWinNT4_0; // weak
 std::array<__int16, 11> word_4E8152 = {0, 0, 0, 90, 8, 2, 70, 20, 10, 50, 30};
 
-stru355 stru_4E82A4 = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000};
-stru355 stru_4EFCBC = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000};
 char byte_4E94D0 = 5; // weak
 char byte_4E94D1 = 9; // weak
 char _4E94D2_light_type = 6; // weak
@@ -912,8 +910,8 @@
 __int64 qword_506350; // weak
 char byte_506360; // weak
 int dword_506364; // weak
-Texture *dword_506404[12]; // weak
-Texture *dword_50640C[12]; // weak
+//Texture *dword_506404[12]; // weak
+//Texture *dword_50640C[12]; // weak
 unsigned int uExitCancelTextureId;
 int dword_50651C; // weak
 int dword_506528; // weak
--- a/mm7_data.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/mm7_data.h	Thu Jun 13 00:56:22 2013 +0400
@@ -3,9 +3,11 @@
 #include "VectorTypes.h"
 #include "OSAPI.h"
 #include <array>
+#include "Items.h"    //TODO: remove this once sub_467E7F_EquipBody if moved to a class or something
 typedef char _UNKNOWN;
 
 
+
 typedef unsigned int uint;
 
 
@@ -463,9 +465,8 @@
 extern int bWinNT4_0; // weak
 extern std::array<__int16, 11> word_4E8152;
 extern std::array< std::array<char, 14>, 7> byte_4E8168;
-#include "Texture.h"
-extern stru355 stru_4E82A4;// = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000};
-extern stru355 stru_4EFCBC;// = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000};
+//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 _4E94D2_light_type; // weak
 extern char byte_4E94D3; // weak
@@ -549,7 +550,7 @@
 extern __int64 qword_506350; // weak
 extern char byte_506360; // weak
 extern int dword_506364; // weak
-extern Texture *dword_50640C[]; // weak
+//extern Texture *dword_50640C[]; // weak
 extern unsigned int uExitCancelTextureId;
 extern int dword_50651C; // weak
 extern int dword_506528; // weak
@@ -1108,7 +1109,7 @@
 int loc_40E4FC(); // weak
 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue);
 
-void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue);
+void __fastcall ZBuffer_DoFill(int *pZBuffer, struct Texture *pTex, int uZValue);
 void __fastcall sub_40F92A(int *pZBuffer, struct Texture *a2, int a3); // idb
 void __cdecl SetMoonPhaseNames();
 signed int __fastcall sub_410D99_get_map_index(int a1);
@@ -1343,7 +1344,6 @@
 enum MENU_STATE GetCurrentMenuID();
 void *__thiscall output_debug_string(void *_this, std::string a2, const char *a3, int a4);
 std::string *__fastcall _4678E2_make_error_string(std::string *a1, int line, std::string file);
-#include "Items.h"
 void sub_467E7F_EquipBody(ITEM_EQUIP_TYPE uEquipType); // idb
 void  CreateMsgScrollWindow(signed int mscroll_id);
 void __cdecl free_book_subwindow();
--- a/stru11.h	Thu Jun 13 00:53:51 2013 +0400
+++ b/stru11.h	Thu Jun 13 00:56:22 2013 +0400
@@ -1,54 +1,12 @@
 #pragma once
 
 
-#include "mm7_data.h"
 /*  128 */
 #pragma pack(push, 1)
 struct stru11
 {
-  //----- (00438526) --------------------------------------------------------
-  stru11()
-  {
-  stru11 *v1; // esi@1
-  signed int v2; // eax@1
-  char *v3; // edx@1
 
-  v1 = this;
-  v2 = 0;
-  this->cpuid_00000000_eax_numops = 0;
-  this->cpuid_00000001_eax = 0;
-  this->cpuid_00000001_edx = 0;
-  this->field_38 = 0;
-  this->field_3C = 0;
-  this->cpuid_80000000_edx = 0;
-  this->cpuid_80000001_eax = 0;
-  this->cpuid_80000001_edx = 0;
-  this->cpuid_80000005_ebx = 0;
-  this->cpuid_80000005_ecx = 0;
-  this->cpuid_80000005_edx = 0;
-  this->cpuid_80000006_ecx = 0;
-  this->field_AC = 0;
-  this->uProcessorManufacturer = 0;
-  LOBYTE(this->cpuid_80000002_registers2[0]) = 0;
-  v3 = (char *)&this->cpuid_00000002_eax;
-  do
-  {
-    if ( v2 < 3 )
-      *((int *)v3 - 9) = 0;
-    if ( v2 < 4 )
-      *(int *)v3 = 0;
-    if ( v2 < 12 )
-      *((int *)v3 + 17) = 0;
-    if ( v2 < 13 )
-      this->pCPUString[v2] = 0;
-    if ( v2 < 30 )
-      *((char *)this->field_40 + v2) = 0;
-    *((char *)&this->cpuid_80000002_registers2[0] + v2++ + 1) = 0;
-    v3 += 4;
-  }
-  while ( v2 < 48 );
-  CheckCPU();
-  }
+  stru11();
 
   void CheckCPU();
   void RunCPUID();
--- a/stru6.cpp	Thu Jun 13 00:53:51 2013 +0400
+++ b/stru6.cpp	Thu Jun 13 00:56:22 2013 +0400
@@ -20,6 +20,7 @@
 #include "Overlays.h"
 #include "stru160.h"
 #include "Math.h"
+#include "Lights.h"
 
 #include "MM7.h"