# HG changeset patch
# User Grumpy7
# Date 1370308881 -7200
# Node ID 29a8defbad9e470ee86655e3aca6e973f0fcb930
# Parent  6b911d7e09a536629789387e306e517e953fd84b
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
removed double LOBYTE, LOWORD etd macro definitions
swprintf called with string size parameter
ErrD3D with too many params fix
1 or 2 other minor fixes

diff -r 6b911d7e09a5 -r 29a8defbad9e Actor.cpp
--- a/Actor.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Actor.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 
diff -r 6b911d7e09a5 -r 29a8defbad9e Allocator.cpp
--- a/Allocator.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Allocator.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <string.h>
 #include <stdio.h>
 #include "OSAPI.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e Arcomage.cpp
--- a/Arcomage.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Arcomage.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <string>
 #include <assert.h>
 
diff -r 6b911d7e09a5 -r 29a8defbad9e AudioPlayer.cpp
--- a/AudioPlayer.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/AudioPlayer.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <string>
 #include <assert.h>
 
diff -r 6b911d7e09a5 -r 29a8defbad9e Chest.cpp
--- a/Chest.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Chest.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <stdio.h>
 #include <assert.h>
 
diff -r 6b911d7e09a5 -r 29a8defbad9e Events.cpp
--- a/Events.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Events.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 #include <stdlib.h>
 
diff -r 6b911d7e09a5 -r 29a8defbad9e GUIFont.cpp
--- a/GUIFont.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/GUIFont.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <string>
 #include <assert.h>
 
diff -r 6b911d7e09a5 -r 29a8defbad9e GUIProgressBar.cpp
--- a/GUIProgressBar.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/GUIProgressBar.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "GUIProgressBar.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e GUIWindow.cpp
--- a/GUIWindow.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/GUIWindow.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include "GUIWindow.h"
 #include "GUIFont.h"
 #include "Party.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e Game.cpp
--- a/Game.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Game.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "Vis.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e Indoor.cpp
--- a/Indoor.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Indoor.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "LightmapBuilder.h"
@@ -1722,7 +1726,7 @@
   signed int v2; // esi@1
 
   for (uint i = 0; i < 11; ++i)
-    if (!strcmpi(Str1, _4E6BDC_loc_names[i]))
+    if (!_stricmp(Str1, _4E6BDC_loc_names[i]))
       return i + 1;
   return 0;
 }
@@ -2781,7 +2785,7 @@
   if (dword_6BE364_game_settings_1 & 0x2000 )
     _i = 29030400;
   bool _a = false;
-  if ( a3 - dlv.uLastRepawnDay >= _i && strcmpi(pCurrentMapName, "d29.dlv") )
+  if ( a3 - dlv.uLastRepawnDay >= _i && _stricmp(pCurrentMapName, "d29.dlv") )
     _a = true;
 
   //v154 = 875;
diff -r 6b911d7e09a5 -r 29a8defbad9e Items.cpp
--- a/Items.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Items.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <stdlib.h>
 #include <assert.h>
 
@@ -790,7 +794,7 @@
 						{
 						for(int ii=0; ii<24; ++ii)
 							{
-							if (stricmp(test_string,pEnchantments[ii].pBonusStat))
+							if (_stricmp(test_string,pEnchantments[ii].pBonusStat))
 								{
 								pItems[item_counter]._bonus_type=ii+1;
 								break;
@@ -800,7 +804,7 @@
 							{
 							for(int ii=0; ii<72; ++ii)
 								{
-								if (stricmp(test_string,pSpecialEnchantments[ii].pBonusStatement))
+								if (_stricmp(test_string,pSpecialEnchantments[ii].pBonusStatement))
 									{
 									pItems[item_counter]._additional_value=ii+1;
 									}
diff -r 6b911d7e09a5 -r 29a8defbad9e Keyboard.cpp
--- a/Keyboard.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Keyboard.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include "OSAPI.h"
 
 #include "Keyboard.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e LOD.cpp
--- a/LOD.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/LOD.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include "LOD.h"
 #include "Render.h"
 #include "Allocator.h"
@@ -2015,7 +2019,7 @@
   if (bLinearSearch)
   {
     for (uint i = 0; i < uNumSubDirs; ++i)
-      if (!strcmpi(pContainer_Name, pSubIndices[i].pFilename))
+      if (!_stricmp(pContainer_Name, pSubIndices[i].pFilename))
       {
         v4 = pSubIndices[i].uOfsetFromSubindicesStart;
         fseek(pFile, uOffsetToSubIndex + v4, SEEK_SET);
@@ -2640,9 +2644,9 @@
       ptr_011BB4 = new char[1000];
       memset(ptr_011BB4, 0, 1000);
     }
-    if (strnicmp(pContainer, "wtrdr", 5))//*v4 != 'w' || v4[1] != 't' || v4[2] != 'r' || v4[3] != 'd' || v4[4] != 'r' )
+    if (_strnicmp(pContainer, "wtrdr", 5))//*v4 != 'w' || v4[1] != 't' || v4[2] != 'r' || v4[3] != 'd' || v4[4] != 'r' )
     {
-      if (strnicmp(pContainer, "WtrTyl", 6))//if ( *v4 != 'W' || v4[1] != 't' || v4[2] != 'r' || v4[3] != 'T' || v4[4] != 'y' || v4[5] != 'l' )
+      if (_strnicmp(pContainer, "WtrTyl", 6))//if ( *v4 != 'W' || v4[1] != 't' || v4[2] != 'r' || v4[3] != 'T' || v4[4] != 'y' || v4[5] != 'l' )
       {
         v14 = uNumLoadedFiles;
       }
@@ -2899,7 +2903,7 @@
   areWeLoadingTexture = 1;
 
   for (uint i = 0; i < uNumLoadedFiles; ++i)
-    if (!strcmpi(pContainer, pTextures[i].pName))
+    if (!_stricmp(pContainer, pTextures[i].pName))
       return i;
 
 //  if (!uNumLoadedFiles)
diff -r 6b911d7e09a5 -r 29a8defbad9e MM7.h
--- a/MM7.h	Tue Jun 04 02:03:43 2013 +0200
+++ b/MM7.h	Tue Jun 04 03:21:21 2013 +0200
@@ -5,20 +5,6 @@
 #include <string>
 
 typedef unsigned int uint;
-#define LOWORD(a) (*((unsigned short *)&a))
-#define HIWORD(a) (*((unsigned short *)&a + 1))
-#define SHIWORD(a) (*((short *)&a + 1))
-
-#define LODWORD(a) (*((unsigned int *)&a))
-#define HIDWORD(a) (*((unsigned int *)&a + 1))
-#define SLODWORD(a) (*((int *)&a))
-#define SHIDWORD(a) (*((int *)&a + 1))
-
-#define LOBYTE(a) (*((unsigned char *)&a))
-#define HIBYTE(a) (*((unsigned char *)&a + sizeof(a) - 1))
-#define BYTE1(a) (*((unsigned char *)&a + 1))
-#define BYTE2(a) (*((unsigned char *)&a + 2))
-#define BYTE3(a) (*((unsigned char *)&a + 3))
 
 #define PID(type, id) (unsigned int)((((8 * (id))) | (type)) & 0xFFFF)  // packed id
 #define PID_TYPE(pid) (unsigned int)((pid) & 7)                         // extract type
diff -r 6b911d7e09a5 -r 29a8defbad9e Monsters.cpp
--- a/Monsters.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Monsters.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff -r 6b911d7e09a5 -r 29a8defbad9e Mouse.cpp
--- a/Mouse.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Mouse.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include "OSAPI.h"
 
 #include "VideoPlayer.h"
@@ -31,7 +35,7 @@
 void Mouse::RemoveHoldingItem()
 {
   pParty->pPickedItem.Reset();
-  if (strcmpi(pCurrentCursorName, "MICON2"))
+  if (_stricmp(pCurrentCursorName, "MICON2"))
     SetCursorBitmap("MICON1");
 }
 
diff -r 6b911d7e09a5 -r 29a8defbad9e NPC.cpp
--- a/NPC.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/NPC.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,4 +1,6 @@
-
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
 
 #include "Allocator.h"
 #include "texts.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e Outdoor.cpp
--- a/Outdoor.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Outdoor.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "stru6.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e Overlays.cpp
--- a/Overlays.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Overlays.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <stdlib.h>
 
 #include "Overlays.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e PaletteManager.cpp
--- a/PaletteManager.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/PaletteManager.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "PaletteManager.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e Party.cpp
--- a/Party.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Party.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "Party.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e Player.cpp
--- a/Player.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Player.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "stru6.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e Render.cpp
--- a/Render.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Render.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "VideoPlayer.h"
@@ -1831,7 +1835,7 @@
       assert(v6 < 1000); // many random crashes here
 
       // for all shore tiles - draw a tile water under them since they're half-empty
-      if (!strnicmp(pBitmaps_LOD->pTextures[v8->uTileBitmapID].pName, "wtrdr", 5))  // all shore tile filenames are wtrdrXXX
+      if (!_strnicmp(pBitmaps_LOD->pTextures[v8->uTileBitmapID].pName, "wtrdr", 5))  // all shore tile filenames are wtrdrXXX
       {
         pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE);  // no Z writing: the shore tile will be draw in the same place, so taking care about z-fighting
         pRenderer->DrawTerrainPolygon(v8->uNumVertices, v8, pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true);
@@ -6518,7 +6522,7 @@
 bool Render::LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags)
 {
   IDirectDrawSurface2 *v4; // esi@1
-  bool v5; // eax@1
+  HRESULT v5; // eax@1
   HRESULT v6; // eax@2
   int v7; // [sp-8h] [bp-10h]@8
   unsigned int v8; // [sp-4h] [bp-Ch]@8
@@ -10735,7 +10739,7 @@
   {
     auto i = idx1 + (idx2 - idx1) / 2;
 
-    auto res = strcmpi(pName, pSpriteNames[i]);
+    auto res = _stricmp(pName, pSpriteNames[i]);
     if (!res)
     {
       fseek(pFile, pSpriteOffsets[i], SEEK_SET);
diff -r 6b911d7e09a5 -r 29a8defbad9e SaveLoad.cpp
--- a/SaveLoad.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/SaveLoad.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <io.h>
 #include <direct.h>
 #include <assert.h>
diff -r 6b911d7e09a5 -r 29a8defbad9e Spells.cpp
--- a/Spells.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Spells.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <stdlib.h>
 
 #include "Spells.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e Sprites.cpp
--- a/Sprites.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Sprites.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <string.h>
 #include <algorithm>
 
diff -r 6b911d7e09a5 -r 29a8defbad9e StorylineTextTable.cpp
--- a/StorylineTextTable.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/StorylineTextTable.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 
diff -r 6b911d7e09a5 -r 29a8defbad9e Texture.cpp
--- a/Texture.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/Texture.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <stdlib.h>
 
 #include "Texture.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e TileTable.cpp
--- a/TileTable.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/TileTable.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include  <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
diff -r 6b911d7e09a5 -r 29a8defbad9e UIBooks.cpp
--- a/UIBooks.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/UIBooks.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "MM7.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e UICharacter.cpp
--- a/UICharacter.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/UICharacter.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include <algorithm> 
diff -r 6b911d7e09a5 -r 29a8defbad9e UIHouses.cpp
--- a/UIHouses.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/UIHouses.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include "UIHouses.h"
 #include "Party.h"
 #include "Player.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e UIMainMenu.cpp
--- a/UIMainMenu.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/UIMainMenu.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "MM7.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e UIPartyCreation.cpp
--- a/UIPartyCreation.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/UIPartyCreation.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "MM7.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e UIPopup.cpp
--- a/UIPopup.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/UIPopup.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "MM7.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e UIRest.cpp
--- a/UIRest.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/UIRest.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "MM7.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e UISaveLoad.cpp
--- a/UISaveLoad.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/UISaveLoad.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 #include <io.h>
 #include "MM7.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e UITransition.cpp
--- a/UITransition.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/UITransition.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 #include <io.h>
 
diff -r 6b911d7e09a5 -r 29a8defbad9e UiGame.cpp
--- a/UiGame.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/UiGame.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "MM7.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e VectorTypes.h
--- a/VectorTypes.h	Tue Jun 04 02:03:43 2013 +0200
+++ b/VectorTypes.h	Tue Jun 04 03:21:21 2013 +0200
@@ -1,5 +1,6 @@
 #pragma once
 
+
 typedef unsigned __int32 uint;
 
 #pragma pack(push, 1)
diff -r 6b911d7e09a5 -r 29a8defbad9e VideoPlayer.cpp
--- a/VideoPlayer.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/VideoPlayer.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include "OSAPI.h"
 
 #include "Bink_Smacker.h"
@@ -115,7 +119,7 @@
       v11.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
 
       auto hr = pRenderer->pDirectDraw4->CreateSurface(&v11, &v15, 0);
-      ErrD3D(hr, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:1476");
+      ErrD3D(hr);
     }
     v5->uWidth = v11.dwWidth;
     v5->uHeight = v11.dwHeight;
@@ -158,7 +162,7 @@
       Dst.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
 
       auto hr = pRenderer->pDirectDraw2->CreateSurface(&Dst, (LPDIRECTDRAWSURFACE *)&a2, 0);
-      ErrD3D(hr, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:1426");
+      ErrD3D(hr);
     }
     v5->uWidth = Dst.dwWidth;
     v5->uHeight = Dst.dwHeight;
@@ -868,7 +872,7 @@
   unsigned int v9; // [sp-4h] [bp-14h]@10
 
   for (uint i = 0; i < uNumMightVideoHeaders; ++i)
-    if (!strcmpi(pName, pMightVideoHeaders[i].pVideoName))
+    if (!_stricmp(pName, pMightVideoHeaders[i].pVideoName))
     {
       SetFilePointer(hMightVid, pMightVideoHeaders[i].uFileOffset, 0, FILE_BEGIN);
 
@@ -879,7 +883,7 @@
     }
 
   for (uint i = 0; i < uNumMagicVideoHeaders; ++i)
-    if (!strcmpi(pName, pMagicVideoHeaders[i].pVideoName))
+    if (!_stricmp(pName, pMagicVideoHeaders[i].pVideoName))
     {
       SetFilePointer(hMagicVid, pMagicVideoHeaders[i].uFileOffset, 0, FILE_BEGIN);
 
diff -r 6b911d7e09a5 -r 29a8defbad9e mm7_1.cpp
--- a/mm7_1.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/mm7_1.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 /* This file has been generated by the Hex-Rays decompiler.
    Copyright (c) 2007-2011 Hex-Rays <info@hex-rays.com>
 
diff -r 6b911d7e09a5 -r 29a8defbad9e mm7_2.cpp
--- a/mm7_2.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/mm7_2.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <io.h>
 #include <direct.h>
 #include <assert.h>
@@ -4257,7 +4261,7 @@
   assert(uNumMaps >= 2);
 
   for (uint i = 1; i < uNumMaps; ++i)
-    if (!strcmpi(pInfos[i].pFilename, Str2))
+    if (!_stricmp(pInfos[i].pFilename, Str2))
       return (MAP_TYPE)i;
 
   assert(false && "Map not found!");
@@ -5670,7 +5674,7 @@
   struct tagPAINTSTRUCT Paint; // [sp+24h] [bp-48h]@13
   int pXY[2]; // [sp+64h] [bp-8h]@261
   int a2; // [sp+7Ch] [bp+10h]@50
-
+  
   switch (Msg)
   {
     case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam);
@@ -7099,7 +7103,7 @@
 
 
   wchar_t pMagicPath[1024];
-  swprintf(pMagicPath, L"%C:\\anims\\magic7.vid", c);
+  swprintf(pMagicPath, wcslen(L"%C:\\anims\\magic7.vid"), L"%C:\\anims\\magic7.vid", c);
   if (GetFileAttributesW(pMagicPath) == -1)
     return false;
 
diff -r 6b911d7e09a5 -r 29a8defbad9e mm7_3.cpp
--- a/mm7_3.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/mm7_3.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 
@@ -5584,9 +5588,9 @@
   wchar_t xn_filename[1024], xp_filename[1024],
           yn_filename[1024], yp_filename[1024],
           zn_filename[1024], zp_filename[1024];
-  swprintf(xn_filename, L"%s_xn.tga", skybox_name); swprintf(xp_filename, L"%s_xp.tga", skybox_name);
-  swprintf(yn_filename, L"%s_yn.tga", skybox_name); swprintf(yp_filename, L"%s_yp.tga", skybox_name);
-  swprintf(zn_filename, L"%s_zn.tga", skybox_name); swprintf(zp_filename, L"%s_zp.tga", skybox_name);
+  swprintf(xn_filename, wcslen(L"%s_xn.tga"), L"%s_xn.tga", skybox_name); swprintf(xp_filename, wcslen(L"%s_xp.tga"), L"%s_xp.tga", skybox_name);
+  swprintf(yn_filename, wcslen(L"%s_yn.tga"), L"%s_yn.tga", skybox_name); swprintf(yp_filename, wcslen(L"%s_yp.tga"), L"%s_yp.tga", skybox_name);
+  swprintf(zn_filename, wcslen(L"%s_zn.tga"), L"%s_zn.tga", skybox_name); swprintf(zp_filename, wcslen(L"%s_zp.tga"), L"%s_zp.tga", skybox_name);
 
   int xn_width, xn_height;
   skybox_xn = LoadTgaTexture(xn_filename, &xn_width, &xn_height);
diff -r 6b911d7e09a5 -r 29a8defbad9e mm7_4.cpp
--- a/mm7_4.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/mm7_4.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "VideoPlayer.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e mm7_5.cpp
--- a/mm7_5.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/mm7_5.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <assert.h>
 
 #include "VideoPlayer.h"
diff -r 6b911d7e09a5 -r 29a8defbad9e mm7_6.cpp
--- a/mm7_6.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/mm7_6.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include "MM7.h"
 
 
@@ -6479,7 +6483,7 @@
 
 const wchar_t *UIMessage2String(UIMessageType msg)
 {
-  #define CASE(xxx) case xxx: _swprintf(b, L"%03X/%s", msg, L#xxx); return b;
+  #define CASE(xxx) case xxx: swprintf(b, wcslen(L"%03X/%s"), L"%03X/%s", msg, L#xxx); return b;
   static wchar_t b[256]; // bad for threads
   switch (msg)
   {
@@ -6570,7 +6574,7 @@
     CASE(UIMSG_ToggleColoredLights)
     CASE(UIMSG_ToggleTint)
     default:
-      _swprintf(b, L"UIMSG_%03X", msg); return b;
+      swprintf(b, wcslen(L"UIMSG_%03X") , L"UIMSG_%03X", msg); return b;
   };
   #undef CASE
 }
diff -r 6b911d7e09a5 -r 29a8defbad9e mm7_data.cpp
--- a/mm7_data.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/mm7_data.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include "mm7_data.h"
 
 #include "GUIWindow.h"
@@ -492,7 +496,7 @@
 unsigned int pHealthBarPos[4] = {22, 137, 251, 366};
 unsigned int pManaBarPos[4] = {102, 217, 331, 447};
 char _4E2B21_buff_spell_tooltip_colors[80];
-char monster_popup_y_offsets[88] =
+unsigned char monster_popup_y_offsets[88] =
 {
   236,  20,   0, 216,   0,   0,   0,   0,   0,   0, 206,
    20,   0, 246, 246, 236,  10, 246,   0,   0,   0, 236,
diff -r 6b911d7e09a5 -r 29a8defbad9e mm7_data.h
--- a/mm7_data.h	Tue Jun 04 02:03:43 2013 +0200
+++ b/mm7_data.h	Tue Jun 04 03:21:21 2013 +0200
@@ -88,6 +88,19 @@
 
 // Some convenience macros to make partial accesses nicer
 // first unsigned macros:
+#ifdef HIBYTE
+#undef HIBYTE
+#endif // HIBYTE
+#ifdef HIWORD
+#undef HIWORD
+#endif // HIWORD
+#ifdef LOBYTE
+#undef LOBYTE
+#endif // LOBYTE
+#ifdef LOWORD
+#undef LOWORD
+#endif // LOWORD
+
 #define LOBYTE(x)   (*((_BYTE*)&(x)))   // low byte
 #define LOWORD(x)   (*((_WORD*)&(x)))   // low word
 #define LODWORD(x)  (*((_DWORD*)&(x)))  // low dword
@@ -153,7 +166,6 @@
 
 
 
-
 // Generate a reference to pair of operands
 template<class T>  int16 __PAIR__( int8  high, T low) { return ((( int16)high) << sizeof(high)*8) | uint8(low); }
 template<class T>  int32 __PAIR__( int16 high, T low) { return ((( int32)high) << sizeof(high)*8) | uint16(low); }
@@ -433,7 +445,7 @@
 extern unsigned int pHealthBarPos[4];
 extern unsigned int pManaBarPos[4];
 extern char _4E2B21_buff_spell_tooltip_colors[80];
-extern char monster_popup_y_offsets[]; // weak
+extern unsigned char monster_popup_y_offsets[]; // weak
 extern unsigned char hourglass_icon_idx; // weak
 
 
diff -r 6b911d7e09a5 -r 29a8defbad9e mm7text_ru.cpp
--- a/mm7text_ru.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/mm7text_ru.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,7 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
diff -r 6b911d7e09a5 -r 29a8defbad9e texts.cpp
--- a/texts.cpp	Tue Jun 04 02:03:43 2013 +0200
+++ b/texts.cpp	Tue Jun 04 03:21:21 2013 +0200
@@ -1,3 +1,6 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
 
 #include <string.h>
 #include "Allocator.h"