changeset 2358:23192f5b41d4

Merge
author Ritor1
date Thu, 10 Apr 2014 17:35:26 +0600
parents 44c91cec72ad (current diff) a574a80e7012 (diff)
children 5b9fb75b6f54
files AudioPlayer.cpp Game.cpp Render.cpp SaveLoad.cpp
diffstat 54 files changed, 765 insertions(+), 643 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/Actor.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -4716,4 +4716,268 @@
   for ( uint i = 0; i < ai_arrays_size; i++ )
     pActors[ai_near_actors_ids[i]].uAttributes |= 0x400;
   return ai_arrays_size;
+}
+
+
+//----- (004070EF) --------------------------------------------------------
+bool __fastcall sub_4070EF_prolly_detect_player(unsigned int uObjID, unsigned int uObj2ID)
+{
+  signed int v2; // eax@1
+//  int v5; // ecx@2
+  int obj1_sector; // eax@4
+  float v8; // ST24_4@5
+//  double v9; // ST18_8@5
+//  int v11; // ecx@6
+  signed int v12; // eax@7
+//  int v13; // esi@7
+//  int v14; // esi@8
+//  int v15; // esi@9
+  int obj2_z; // edi@11
+  int obj2_x; // esi@11
+  int obj2_sector; // eax@13
+  float v20; // ST24_4@14
+//  double v21; // ST18_8@14
+  int dist_x; // ebx@16
+  signed int dist_3d; // ecx@16
+  int v25; // eax@18
+  BLVFace *v29; // ebx@32
+  Vec3_short_ *v30; // esi@32
+  int v31; // eax@32
+  int v32; // ST50_4@44
+  int v33; // ST54_4@44
+  int v34; // eax@44
+  signed int v38; // esi@45
+//  signed __int64 v40; // qtt@50
+  __int16 next_sector; // bx@58
+//  int v43; // [sp-8h] [bp-70h]@11
+//  int v44; // [sp-4h] [bp-6Ch]@11
+  int v47; // [sp+18h] [bp-50h]@20
+  int v48; // [sp+1Ch] [bp-4Ch]@20
+  int v49; // [sp+20h] [bp-48h]@20
+  int dist_z; // [sp+24h] [bp-44h]@16
+  signed int higher_z; // [sp+24h] [bp-44h]@27
+  signed int lower_z; // [sp+28h] [bp-40h]@26
+  signed int higher_y; // [sp+2Ch] [bp-3Ch]@23
+  signed int lower_y; // [sp+30h] [bp-38h]@22
+  signed int higher_x; // [sp+34h] [bp-34h]@21
+  signed int lower_x; // [sp+38h] [bp-30h]@20
+  signed int sectors_visited; // [sp+3Ch] [bp-2Ch]@28
+  int v58; // [sp+44h] [bp-24h]@50
+  int v59; // [sp+48h] [bp-20h]@44
+  int obj2_y; // [sp+50h] [bp-18h]@11
+  int obj1_x; // [sp+58h] [bp-10h]@4
+  int obj1_y; // [sp+5Ch] [bp-Ch]@4
+  int obj1_z; // [sp+60h] [bp-8h]@4
+  int current_sector; // [sp+64h] [bp-4h]@7
+  int dist_y;
+  int v70;
+
+  v2 = PID_ID(uObjID);
+  switch( PID_TYPE(uObjID) )
+  {
+	case OBJECT_Decoration:
+      obj1_x = pLevelDecorations[v2].vPosition.x;
+      obj1_y = pLevelDecorations[v2].vPosition.y;
+      obj1_z = pLevelDecorations[v2].vPosition.z;
+      obj1_sector = pIndoor->GetSector(obj1_x, obj1_y, obj1_z);
+	  break;
+	case OBJECT_Actor:
+      obj1_x = pActors[v2].vPosition.x;
+      obj1_y = pActors[v2].vPosition.y;
+      v8 = (double)pActors[v2].uActorHeight * 0.69999999;
+      //v9 = v8 + 6.7553994e15;
+      //obj1_z = LODWORD(v9) + pActors[v2].vPosition.z;
+	  obj1_z = (int)v8 + pActors[v2].vPosition.z;
+      obj1_sector = pActors[v2].uSectorID;
+	  break;
+	case OBJECT_Item:
+      obj1_x = pSpriteObjects[v2].vPosition.x;
+      obj1_y = pSpriteObjects[v2].vPosition.y;
+      obj1_z = pSpriteObjects[v2].vPosition.z;
+      obj1_sector = pSpriteObjects[v2].uSectorID;
+	  break;
+	default:
+	  return 0;
+  }
+  v12 = PID_ID(uObj2ID);
+  switch( PID_TYPE(uObj2ID) )
+  {
+    case OBJECT_Decoration:
+      obj2_z = pLevelDecorations[v12].vPosition.z;
+      obj2_x = pLevelDecorations[v12].vPosition.x;
+      obj2_y = pLevelDecorations[v12].vPosition.y;
+	  obj2_sector = pIndoor->GetSector(obj2_x, obj2_y, obj2_z);
+	  break;
+	case OBJECT_Player:
+      obj2_x = pParty->vPosition.x;
+      obj2_z = pParty->sEyelevel + pParty->vPosition.z;
+      obj2_y = pParty->vPosition.y;
+	  obj2_sector = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z);
+      break;
+	case OBJECT_Actor:
+      obj2_y = pActors[v12].vPosition.y;
+      obj2_x = pActors[v12].vPosition.x;
+      v20 = (double)pActors[v12].uActorHeight * 0.69999999;
+      //v21 = v20 + 6.7553994e15;
+      //obj2_z = LODWORD(v21) + pActors[v12].vPosition.z;
+	  obj2_z = (int)v20 + pActors[v12].vPosition.z;
+      obj2_sector = pActors[v12].uSectorID;
+	  break;
+	case OBJECT_Item:
+      obj2_x = pSpriteObjects[v12].vPosition.x;
+      obj2_z = pSpriteObjects[v12].vPosition.z;
+      obj2_y = pSpriteObjects[v12].vPosition.y;
+      obj2_sector = pSpriteObjects[v12].uSectorID;
+	  break;
+	default:
+	  return 0;
+  }
+  dist_x = obj2_x - obj1_x;
+  dist_z = obj2_z - obj1_z;
+  dist_y = obj2_y - obj1_y;
+  dist_3d = integer_sqrt(dist_x * dist_x + dist_y * dist_y + dist_z * dist_z);
+  //range check
+  if ( dist_3d > 5120 )
+    return 0;
+  if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
+    return 1;
+  v25 = 65536;
+  if ( dist_3d )
+    v25 = 65536 / dist_3d;
+  v49 = dist_x * v25;
+  v47 = dist_z * v25;
+  v48 = dist_y * v25;
+  if ( obj1_x < obj2_x )
+  {
+	lower_x = obj1_x;
+    higher_x = obj2_x;
+  }
+  else
+  {
+    lower_x = obj2_x;
+    higher_x = obj1_x;
+  }
+  if ( obj1_y < obj2_y )
+  {
+	lower_y = obj1_y;
+    higher_y = obj2_y;
+  }
+  else
+  {
+    lower_y = obj2_y;
+    higher_y = obj1_y;
+  }
+  if ( obj1_z < obj2_z )
+  {
+	lower_z = obj1_z;
+    higher_z = obj2_z;
+  }
+  else
+  {
+    lower_z = obj2_z;
+    higher_z = obj1_z;
+  }
+  sectors_visited = 0;
+  //monster in same sector with player
+  if ( obj1_sector == obj2_sector )
+      return 1;
+  //search starts from monster
+  current_sector = obj1_sector;
+  for( int current_portal = 0; current_portal < pIndoor->pSectors[current_sector].uNumPortals; current_portal++ )
+  {
+	v29 = &pIndoor->pFaces[pIndoor->pSectors[current_sector].pPortals[current_portal]];
+	v30 = &pIndoor->pVertices[*v29->pVertexIDs];
+	v31 = v29->pFacePlane_old.vNormal.z * (v30->z - obj1_z)
+		+ v29->pFacePlane_old.vNormal.y * (v30->y - obj1_y)
+		+ v29->pFacePlane_old.vNormal.x * (v30->x - obj1_x);
+
+	if ( current_sector != v29->uSectorID )
+		v31 = -v31;
+
+	if ( v31 >= 0 && v30->x != obj1_x && v30->y != obj1_y && v30->z != obj1_z)
+		continue;
+
+	if(	lower_x > v29->pBounding.x2
+		|| higher_x < v29->pBounding.x1
+		|| lower_y > v29->pBounding.y2
+		|| higher_y < v29->pBounding.y1
+		|| lower_z > v29->pBounding.z2
+		|| higher_z < v29->pBounding.z1 )
+	{
+		continue;
+	}
+	  
+	v32 = fixpoint_mul(v29->pFacePlane_old.vNormal.x,v49);
+	v33 = fixpoint_mul(v29->pFacePlane_old.vNormal.z,v47);
+	v34 = fixpoint_mul(v29->pFacePlane_old.vNormal.y,v48);
+	v59 = v32 + v33 + v34;
+	if ( v59 )
+	{
+		v70 = v29->pFacePlane_old.dist 
+			+ obj1_z * v29->pFacePlane_old.vNormal.z 
+			+ obj1_x * v29->pFacePlane_old.vNormal.x 
+			+ obj1_y * v29->pFacePlane_old.vNormal.y;
+		v38 = -v70;
+
+		// if ( v59 <= 0 ^ v70 <= 0 )
+		
+		/* TEMPORARY
+		if ( v59 <= 0 && v70 <= 0 )
+		{
+			continue;
+		}
+		if ( !(v59 <= 0 && v70 <= 0) )
+		{
+			continue;
+		}
+		*/
+
+		if( abs(v38) >> 14 > abs(v59) )
+			continue;
+
+		v58 = fixpoint_div(v38,v59);
+
+		if( v58 < 0 )
+          continue;
+
+		if(!sub_4075DB(obj1_x + ((fixpoint_mul(v49,v58) + 32768) >> 16), obj1_y + ((fixpoint_mul(v48,v58) + 32768) >> 16),
+				obj1_z + ((fixpoint_mul(v47,v58) + 32768) >> 16), v29) )
+		{
+			continue;
+		}
+
+		//if there is no next sector turn back
+		if ( v29->uSectorID == current_sector )
+			next_sector = v29->uBackSectorID;
+		else
+			next_sector = v29->uSectorID;
+
+		//no more portals, quit
+		if ( next_sector == current_sector )
+          break;
+
+		++sectors_visited;
+		current_sector = next_sector;
+
+		//found player, quit
+		if ( next_sector == obj2_sector )
+			return 1;
+
+		current_sector = next_sector;
+
+		//did we hit limit for portals?
+		//does the next room have portals?
+		if ( sectors_visited < 30 && pIndoor->pSectors[current_sector].uNumPortals > 0)
+		{
+				current_portal=-1;
+				continue;
+		}
+		else
+			break;
+	}
+  }
+  //did we stop in the sector where player is?
+  if ( current_sector != obj2_sector )
+    return 0;
+  return 1;
 }
\ No newline at end of file
--- a/Actor.h	Thu Apr 10 17:35:10 2014 +0600
+++ b/Actor.h	Thu Apr 10 17:35:26 2014 +0600
@@ -302,4 +302,5 @@
 bool CheckActors_proximity();
 int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb
 void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3);
-void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle);
\ No newline at end of file
+void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle);
+bool __fastcall sub_4070EF_prolly_detect_player(unsigned int uObjID, unsigned int uObj2ID);
--- a/AudioPlayer.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/AudioPlayer.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1,7 +1,7 @@
 #define _CRT_SECURE_NO_WARNINGS
 
-#include "mm7_unsorted_subs.h"
 #include <string>
+#include "ZlibWrapper.h"
 
 #include "mm7_data.h"
 #include "VideoPlayer.h"
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj	Thu Apr 10 17:35:10 2014 +0600
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj	Thu Apr 10 17:35:26 2014 +0600
@@ -247,6 +247,7 @@
     <ClCompile Include="..\..\Viewport.cpp" />
     <ClCompile Include="..\..\Vis.cpp" />
     <ClCompile Include="..\..\Weather.cpp" />
+    <ClCompile Include="..\..\ZlibWrapper.cpp" />
     <ClCompile Include="..\..\_deleted.cpp" />
   </ItemGroup>
   <ItemGroup>
@@ -271,6 +272,7 @@
     <ClInclude Include="..\..\FrameTableInc.h" />
     <ClInclude Include="..\..\Game.h" />
     <ClInclude Include="..\..\GammaControl.h" />
+    <ClInclude Include="..\..\GUIButton.h" />
     <ClInclude Include="..\..\GUIFont.h" />
     <ClInclude Include="..\..\GUIProgressBar.h" />
     <ClInclude Include="..\..\GUIWindow.h" />
@@ -478,13 +480,29 @@
     <ClInclude Include="..\..\TileFrameTable.h" />
     <ClInclude Include="..\..\Timer.h" />
     <ClInclude Include="..\..\TurnEngine.h" />
+    <ClInclude Include="..\..\UI\Books\UIMapBook.h" />
+    <ClInclude Include="..\..\UI\Books\UINotesBooks.h" />
+    <ClInclude Include="..\..\UI\Books\UISpellBook.h" />
     <ClInclude Include="..\..\UI\UIBooks.h" />
+    <ClInclude Include="..\..\UI\UICharacter.h" />
+    <ClInclude Include="..\..\UI\UIGame.h" />
+    <ClInclude Include="..\..\UI\UIGuilds.h" />
     <ClInclude Include="..\..\UI\UIHouses.h" />
+    <ClInclude Include="..\..\UI\UIMainMenu.h" />
+    <ClInclude Include="..\..\UI\UIMsgProc.h" />
+    <ClInclude Include="..\..\UI\UIOptions.h" />
+    <ClInclude Include="..\..\UI\UIPartyCreation.h" />
+    <ClInclude Include="..\..\UI\UIPopup.h" />
+    <ClInclude Include="..\..\UI\UIRest.h" />
+    <ClInclude Include="..\..\UI\UISaveLoad.h" />
+    <ClInclude Include="..\..\UI\UIShops.h" />
+    <ClInclude Include="..\..\UI\UITransition.h" />
     <ClInclude Include="..\..\VectorTypes.h" />
     <ClInclude Include="..\..\VideoPlayer.h" />
     <ClInclude Include="..\..\Viewport.h" />
     <ClInclude Include="..\..\Vis.h" />
     <ClInclude Include="..\..\Weather.h" />
+    <ClInclude Include="..\..\ZlibWrapper.h" />
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\lib\legacy_dx\d3dvec.inl" />
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters	Thu Apr 10 17:35:10 2014 +0600
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters	Thu Apr 10 17:35:26 2014 +0600
@@ -387,6 +387,7 @@
     <ClCompile Include="..\..\MediaPlayer.cpp" />
     <ClCompile Include="..\..\OurMath.cpp" />
     <ClCompile Include="..\..\Registry.cpp" />
+    <ClCompile Include="..\..\ZlibWrapper.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\Level\Decoration.h" />
@@ -914,6 +915,53 @@
     <ClInclude Include="..\..\OpenALSoundProvider.h" />
     <ClInclude Include="..\..\stuff.h" />
     <ClInclude Include="..\..\Registry.h" />
+    <ClInclude Include="..\..\UI\UIGame.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\UICharacter.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\UIGuilds.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\UIMainMenu.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\UIMsgProc.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\UIOptions.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\UIPartyCreation.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\UIPopup.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\UIRest.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\UISaveLoad.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\UIShops.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\UITransition.h">
+      <Filter>UI</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\Books\UINotesBooks.h">
+      <Filter>UI\Books</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\Books\UISpellBook.h">
+      <Filter>UI\Books</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\UI\Books\UIMapBook.h">
+      <Filter>UI\Books</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\GUIButton.h" />
+    <ClInclude Include="..\..\ZlibWrapper.h" />
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\Player.swig" />
--- a/CastSpellInfo.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/CastSpellInfo.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -27,6 +27,7 @@
 #include "LOD.h"
 #include "Level/Decoration.h"
 #include "mm7_unsorted_subs.h"
+#include "UI\UIPartyCreation.h"
 
 const size_t CastSpellInfoCount = 10;
 std::array<CastSpellInfo, CastSpellInfoCount> pCastSpellInfo;
--- a/GUIButton.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/GUIButton.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1,4 +1,5 @@
 #define _CRT_SECURE_NO_WARNINGS
+#include "GUIButton.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GUIButton.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,3 @@
+#pragma once
+void CreateButtonInColumn(int a1, unsigned int a2);
+void UI_CreateEndConversationButton();
\ No newline at end of file
--- a/GUIWindow.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/GUIWindow.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -2555,4 +2555,11 @@
     pMessages[uNumMessages].param = param;
     pMessages[uNumMessages++].field_8 = a4;
   }
-}
\ No newline at end of file
+}
+
+//----- (004637E0) --------------------------------------------------------
+char  sub_4637E0_is_there_popup_onscreen()
+{
+  return dword_507BF0_is_there_popup_onscreen == 1;
+}
+// 507BF0: using guessed type int dword_507BF0_is_there_popup_onscreen;
\ No newline at end of file
--- a/GUIWindow.h	Thu Apr 10 17:35:10 2014 +0600
+++ b/GUIWindow.h	Thu Apr 10 17:35:26 2014 +0600
@@ -613,6 +613,9 @@
 void free_book_subwindow();
 void CreateScrollWindow();
 void OnPaperdollLeftClick();
+void DrawJoinGuildWindow(int pEventCode);
+void  DialogueEnding();
+char sub_4637E0_is_there_popup_onscreen();
 
 
 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue);
--- a/Game.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/Game.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -44,6 +44,8 @@
 #include "Level/Decoration.h"
 #include "PaletteManager.h"
 #include "UI\UIHouses.h"
+#include "UI\UIShops.h"
+#include "UI\UIPartyCreation.h"
 #include "SaveLoad.h"
 #include "SpriteObject.h"
 #include "mm7.h"
@@ -51,6 +53,7 @@
 #include "Registry.h"
 #include "Chest.h"
 
+#include "UI\UIGame.h"
 
 
 
--- a/Indoor.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/Indoor.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1,5 +1,6 @@
 #define _CRT_SECURE_NO_WARNINGS
 #include "ErrorHandling.h"
+#include "ZlibWrapper.h"
 #include "mm7_unsorted_subs.h"
 #include "LightmapBuilder.h"
 #include "DecalBuilder.h"
@@ -6288,4 +6289,16 @@
     pIndoor->pDoors[door_id].uTimeSinceTriggered = 15360;
   }
   return;
+}
+
+
+//----- (004088E9) --------------------------------------------------------
+int __fastcall sub_4088E9(int x1, int y1, int x2, int y2, int x3, int y3)
+{
+  signed int result; // eax@1
+
+  result = integer_sqrt(abs(x2 - x1) * abs(x2 - x1) + abs(y2 - y1) * abs(y2 - y1));
+  if ( result )
+    result = abs(((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / result);
+  return result;
 }
\ No newline at end of file
--- a/Indoor.h	Thu Apr 10 17:35:10 2014 +0600
+++ b/Indoor.h	Thu Apr 10 17:35:26 2014 +0600
@@ -553,3 +553,6 @@
 void UpdateActors_BLV();
 void BLV_ProcessPartyActions();
 void Door_switch_animation(unsigned int uDoorID, int a2); // idb: sub_449A49
+int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6);
+void __fastcall PrepareDrawLists_BLV();
+void PrepareToLoadBLV(unsigned int bLoading);
--- a/Items.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/Items.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1,6 +1,8 @@
 #define _CRT_SECURE_NO_WARNINGS
 #include <stdlib.h>
 #include <string>
+#include "UI\UIHouses.h"
+#include "GUIButton.h"
 #include "mm7_unsorted_subs.h"
 #include "ErrorHandling.h"
 
@@ -461,7 +463,7 @@
 			pSpecialEnchantmentsSumm[i]+=pSpecialEnchantments[j].to_item_apply[i];
 		}
 
-	Initialize2DA();
+	InitializeBuildingResidents();
 
 	pItemsTXT_Raw = NULL;
 	pItemsTXT_Raw = (char*) pEvents_LOD->LoadRaw("items.txt", 0);
--- a/LOD.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/LOD.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -5,9 +5,9 @@
 #include "PaletteManager.h"
 #include "Viewport.h"
 #include "mm7_data.h"
+#include "ZlibWrapper.h"
 
 #include "mm7_data.h"
-#include "mm7_unsorted_subs.h"
 
 #include "Sprites.h"
 
--- a/Outdoor.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/Outdoor.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -37,6 +37,7 @@
 #include "GUIWindow.h"
 #include "Level/Decoration.h"
 #include "OurMath.h"
+#include "ZlibWrapper.h"
 
 MapStartPoint uLevel_StartingPointType; // weak
 
@@ -4348,4 +4349,18 @@
   }
   pFaceID = 0;
   return ceiling_height_level[v22];// íåò íèêàêîé ïðåãðàäû
+}
+
+
+//----- (00464839) --------------------------------------------------------
+char Is_out15odm_underwater()
+{
+  return _stricmp(pCurrentMapName, "out15.odm") == 0;
+}
+
+//----- (00464851) --------------------------------------------------------
+void SetUnderwaterFog()
+{
+  day_fogrange_1 = 50;
+  day_fogrange_2 = 5000;
 }
\ No newline at end of file
--- a/Outdoor.h	Thu Apr 10 17:35:10 2014 +0600
+++ b/Outdoor.h	Thu Apr 10 17:35:26 2014 +0600
@@ -253,6 +253,8 @@
 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out);
 void UpdateActors_ODM();
 void ODM_ProcessPartyActions();
+char Is_out15odm_underwater();
+void SetUnderwaterFog();
 
 
 
--- a/Party.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/Party.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1191,4 +1191,24 @@
     }
   }
   return affectedCount;
-}
\ No newline at end of file
+}
+
+//----- (00444D80) --------------------------------------------------------
+int GetTravelTime()
+{
+  signed int new_travel_time; // esi@1
+
+  new_travel_time = uDefaultTravelTime_ByFoot;
+  if ( CheckHiredNPCSpeciality(Guide) )
+    --new_travel_time;
+  if ( CheckHiredNPCSpeciality(Tracker) )
+    new_travel_time -= 2;
+  if ( CheckHiredNPCSpeciality(Pathfinder) )
+    new_travel_time -= 3;
+  if ( CheckHiredNPCSpeciality(Explorer) )
+    --new_travel_time;
+  if ( new_travel_time < 1 )
+    new_travel_time = 1;
+  return new_travel_time;
+}
+// 6BD07C: using guessed type int uDefaultTravelTime_ByFoot;
\ No newline at end of file
--- a/Party.h	Thu Apr 10 17:35:10 2014 +0600
+++ b/Party.h	Thu Apr 10 17:35:26 2014 +0600
@@ -327,3 +327,4 @@
 bool TestPartyQuestBit(PARTY_QUEST_BITS bit);
 void __fastcall Rest(unsigned int uHoursToSleep);
 void RestAndHeal(__int64 uNumMinutes); // idb
+int GetTravelTime();
--- a/Player.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/Player.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -33,6 +33,7 @@
 #include "DecalBuilder.h"
 #include "CastSpellInfo.h"
 #include "OurMath.h"
+#include "UI\UIPartyCreation.h"
 
 
 
@@ -8167,4 +8168,18 @@
   if (id != -1)
     AttackerInfo.Add(PID(OBJECT_Item, id), a5, SLOWORD(a1a.vPosition.x), SLOWORD(a1a.vPosition.y),
     SLOWORD(a1a.vPosition.z), 0, 0);
+}
+
+//----- (00458244) --------------------------------------------------------
+unsigned int SkillToMastery( unsigned int skill_value )
+{
+  switch (skill_value & 0x1C0)
+  {
+  case 0x100: return 4;     // Grandmaster
+  case 0x80:  return 3;     // Master
+  case 0x40:  return 2;     // Expert
+  case 0x00:  return 1;     // Normal
+  }
+  assert(false);
+  return 0;
 }
\ No newline at end of file
--- a/Player.h	Thu Apr 10 17:35:10 2014 +0600
+++ b/Player.h	Thu Apr 10 17:35:26 2014 +0600
@@ -851,5 +851,6 @@
 bool  ShouldLoadTexturesForRaceAndGender(unsigned int _this);
 int PlayerCreation_GetUnspentAttributePointCount();
 int CycleCharacter(bool backwards);
+unsigned int SkillToMastery(unsigned int skill_value);
 
 extern NZIArray<struct Player *, 5> pPlayers;
\ No newline at end of file
--- a/Render.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/Render.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1,5 +1,6 @@
 #define _CRT_SECURE_NO_WARNINGS
 #include "mm7_unsorted_subs.h"
+#include "ZlibWrapper.h"
 #include "ErrorHandling.h"
 
 #include "Render.h"
--- a/SaveLoad.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/SaveLoad.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -3,6 +3,7 @@
 #include <direct.h>
 #include "mm7_unsorted_subs.h"
 #include "ErrorHandling.h"
+#include "ZlibWrapper.h"
 
 #include "SaveLoad.h"
 #include "BSPModel.h"
--- a/SpriteObject.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/SpriteObject.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1,4 +1,5 @@
 #define _CRT_SECURE_NO_WARNINGS
+#include "Sprites.h"
 #include "BSPModel.h"
 #include "SpriteObject.h"
 #include "Party.h"
--- a/Sprites.h	Thu Apr 10 17:35:10 2014 +0600
+++ b/Sprites.h	Thu Apr 10 17:35:26 2014 +0600
@@ -82,6 +82,7 @@
 
 
 
+void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2);
 
 
 extern struct SpriteFrameTable *pSpriteFrameTable;
\ No newline at end of file
--- a/Texture.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/Texture.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -7,9 +7,9 @@
 #include "PaletteManager.h"
 #include "Render.h"
 #include "ErrorHandling.h"
+#include "ZlibWrapper.h"
 
 #include "mm7_data.h"
-#include "mm7_unsorted_subs.h"
 
 
 
--- a/UI/Books/UIMapBook.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/UI/Books/UIMapBook.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1,4 +1,5 @@
 #define _CRT_SECURE_NO_WARNINGS
+#include "UIMapBook.h"
 #include "..\..\Events.h"
 #include "..\..\mm7_unsorted_subs.h"
 #include "..\..\MM7.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/Books/UIMapBook.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,3 @@
+
+void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074); // idb
+const char *GetMapBookHintText();//sub_444564
\ No newline at end of file
--- a/UI/UICharacter.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/UI/UICharacter.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1,5 +1,6 @@
 #define _CRT_SECURE_NO_WARNINGS
 #include <algorithm> 
+#include "UICharacter.h"
 #include "..\mm7_unsorted_subs.h"
 #include "..\MM7.h"
 #include "..\MapInfo.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/UICharacter.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,4 @@
+#pragma once
+void CharacterUI_LoadPaperdollTextures();
+void WetsuitOn(unsigned int uPlayerID); // idb
+void WetsuitOff(unsigned int uPlayerID);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/UIGame.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,3 @@
+#pragma once
+void GameUI_WritePointedObjectStatusString();
+void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/UIGuilds.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,2 @@
+#pragma once
+void SpellBookGenerator();
\ No newline at end of file
--- a/UI/UIHouses.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/UI/UIHouses.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1,4 +1,8 @@
 #define _CRT_SECURE_NO_WARNINGS
+#include "UIGuilds.h"
+#include "UIPartyCreation.h"
+#include "UIShops.h"
+#include "..\GUIButton.h"
 #include "..\mm7_unsorted_subs.h"
 #include "..\SaveLoad.h"
 #include "..\Texture.h"
@@ -3068,4 +3072,233 @@
   jail_dialogue_window.uFrameZ = 334;
   jail_dialogue_window.DrawTitleText(pFontArrus, 0, (310 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[672], &jail_dialogue_window, 0, 0)) / 2 + 18,
      Color16(0xFFu, 0xFFu, 0x9Bu), pGlobalTXT_LocalizationStrings[672], 3);//"Çà ìíîãî÷èñëåííûå ïðåñòóïëåíèÿ è çëîäåÿíèÿ âû áûëè ïðèãîâîðåíû ê îäíîìó ãîäó çàêëþ÷åíèÿ."
+}
+
+
+//----- (00443801) --------------------------------------------------------
+void InitializeBuildingResidents()
+{
+
+  int i;
+  char* test_string;
+  unsigned char c;
+  bool break_loop;
+  unsigned int temp_str_len;
+  char* tmp_pos;
+  int decode_step;
+
+  if ( p2DEventsTXT_Raw )
+    free(p2DEventsTXT_Raw);
+  p2DEventsTXT_Raw = NULL;
+  p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0);
+  strtok(p2DEventsTXT_Raw, "\r");
+  strtok(NULL, "\r");
+
+  for (i=0;i<525;++i)
+  {
+    test_string = strtok(NULL, "\r") + 1;
+    break_loop = false;
+    decode_step=0;
+    do 
+    {
+      c = *(unsigned char*)test_string;
+      temp_str_len = 0;
+      while((c!='\t')&&(c>0))
+      {
+        ++temp_str_len;
+        c=test_string[temp_str_len];
+      }		
+      tmp_pos=test_string+temp_str_len;
+      if (*tmp_pos == 0)
+        break_loop = true;
+      *tmp_pos = 0;
+      if (temp_str_len)
+      {
+        switch (decode_step)
+        {
+        case 2:
+          {
+            if ( !_strnicmp(test_string, "wea", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_WeaponShop;
+              break;
+            }
+            if ( !_strnicmp(test_string, "arm", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_ArmorShop;
+              break;
+            }
+            if ( !_strnicmp(test_string, "mag", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_MagicShop;
+              break;
+            }
+            if ( !_strnicmp(test_string, "alc", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_AlchemistShop;
+              break;
+            }
+            if ( !_strnicmp(test_string, "sta", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_Stables;
+              break;
+            }
+            if ( !_strnicmp(test_string, "boa", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_Boats;
+              break;
+            }
+            if ( !_strnicmp(test_string, "tem", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_Temple;
+              break;
+            }
+            if ( !_strnicmp(test_string, "tra", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_Training;
+              break;
+            }
+            if ( !_strnicmp(test_string, "tow", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_TownHall;
+              break;
+            }
+
+            if ( !_strnicmp(test_string, "tav", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_Tavern;
+              break;
+            }
+            if ( !_strnicmp(test_string, "ban", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_Bank;
+              break;
+            }
+            if ( !_strnicmp(test_string, "fir", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_FireGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "air", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_AirGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "wat", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_WaterGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "ear", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_EarthGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "spi", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_SpiritGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "min", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_MindGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "bod", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_BodyGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "lig", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_LightGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "dar", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_DarkGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "ele", 3) ) // "Element Guild" from mm6
+            {
+              p2DEvents[i].uType = BuildingType_ElementalGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "sel", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_SelfGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "mir", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_16;
+              break;
+            }
+            if ( !_strnicmp(test_string, "mer", 3) ) // "Merc Guild" from mm6
+            {
+              p2DEvents[i].uType = BuildingType_TownHall;
+              break;
+            }
+            p2DEvents[i].uType = BuildingType_18;
+          }
+          break;
+
+        case 4:
+          p2DEvents[i].uAnimationID = atoi(test_string);
+          break;
+        case 5:
+          p2DEvents[i].pName = RemoveQuotes(test_string);
+          break;
+        case 6:
+          p2DEvents[i].pProprieterName = RemoveQuotes(test_string);
+          break;
+        case 7:
+          p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string);
+          break;
+        case 8:
+          p2DEvents[i].field_14 = atoi(test_string);
+          break;
+        case 9:
+          p2DEvents[i]._state = atoi(test_string);
+          break;
+        case 10:
+          p2DEvents[i]._rep = atoi(test_string);
+          break;
+        case 11:
+          p2DEvents[i]._per = atoi(test_string);
+          break;
+        case 12:
+          p2DEvents[i].fPriceMultiplier = atof(test_string);
+          break;
+        case 13:
+          p2DEvents[i].flt_24 = atof(test_string);
+          break;
+        case 15:
+          p2DEvents[i].field_1C = atoi(test_string);
+          break;
+        case 18:
+          p2DEvents[i].uOpenTime = atoi(test_string);
+          break;
+        case 19:
+          p2DEvents[i].uCloseTime = atoi(test_string);
+          break;
+        case 20:
+          p2DEvents[i].uExitPicID = atoi(test_string);
+          break;
+        case 21:
+          p2DEvents[i].uExitMapID = atoi(test_string);
+          break;
+        case 22:
+          p2DEvents[i]._quest_related = atoi(test_string);
+          break;
+        case 23:
+          p2DEvents[i].pEnterText = RemoveQuotes(test_string);
+          break;
+        }
+      }
+      ++decode_step;
+      test_string=tmp_pos+1;
+    } while ((decode_step<24)&&!break_loop);
+  }
+
 }
\ No newline at end of file
--- a/UI/UIHouses.h	Thu Apr 10 17:35:10 2014 +0600
+++ b/UI/UIHouses.h	Thu Apr 10 17:35:26 2014 +0600
@@ -133,11 +133,16 @@
 void  WeaponShopDialog();
 void  AlchemistDialog();
 void  ArmorShopDialog();
+void SimpleHouseDialog();
+void __fastcall OnSelectShopDialogueOption(signed int uMessageParam);
+void PrepareHouse(enum HOUSE_ID house); // idb
+bool EnterHouse(enum HOUSE_ID uHouseID);
 
 
 void InitializaDialogueOptions_Tavern(BuildingType type); // idb
 void InitializaDialogueOptions_Shops(BuildingType type);
 void InitializaDialogueOptions(BuildingType type);
+void InitializeBuildingResidents();
 
 extern int uHouse_ExitPic; // weak
 extern int dword_591080; // weak
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/UIMainMenu.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,1 @@
+#pragma once
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/UIMsgProc.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,1 @@
+#pragma once
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/UIOptions.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,1 @@
+#pragma once
\ No newline at end of file
--- a/UI/UIPartyCreation.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/UI/UIPartyCreation.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1,4 +1,5 @@
 #define _CRT_SECURE_NO_WARNINGS
+#include "UIPartyCreation.h"
 #include "..\mm7_unsorted_subs.h"
 #include "..\Mouse.h"
 #include "..\Keyboard.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/UIPartyCreation.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,8 @@
+#pragma once
+bool PlayerCreation_Choose4Skills();
+void LoadPlayerPortraintsAndVoices();
+void ReloadPlayerPortraits(int player_id, int face_id);
+void PlayerCreationUI_Draw();
+void PlayerCreationUI_Initialize();
+void DeleteCCharFont();
+bool PlayerCreationUI_Loop();
--- a/UI/UIPopup.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/UI/UIPopup.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1,4 +1,7 @@
 #define _CRT_SECURE_NO_WARNINGS
+#include "UIPopup.h"
+#include "Books\UIMapBook.h"
+#include "UIShops.h"
 #include "..\MM7.h"
 #include "..\mm7_unsorted_subs.h"
 
@@ -2005,3 +2008,28 @@
   return;
 }
 
+
+//----- (0045828B) --------------------------------------------------------
+unsigned int __fastcall GetSpellColor(signed int a1)
+{
+  if ( a1 == 0 )
+    return Color16(0, 0, 0);
+  if ( a1 < 12 )
+    return Color16(255, 85, 0);
+  if ( a1 < 23 )
+    return Color16(150, 212, 255);
+  if ( a1 < 34 )
+    return Color16(0, 128, 255);
+  if ( a1 < 45 )
+    return Color16(128, 128, 128);
+  if ( a1 < 56 )
+    return Color16(225, 225, 225);
+  if ( a1 < 67 )
+    return Color16(235, 15, 255);
+  if ( a1 < 78 )
+    return Color16(255, 128, 0);
+  if ( a1 < 89 )
+    return Color16(255, 255, 155);
+  if ( a1 < 100 )
+    return Color16(192, 192, 240);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/UIPopup.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,3 @@
+#pragma once
+
+unsigned int __fastcall GetSpellColor(signed int a1);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/UIRest.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,1 @@
+#pragma once
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/UISaveLoad.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,1 @@
+#pragma once
\ No newline at end of file
--- a/UI/UIShops.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/UI/UIShops.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -1,4 +1,5 @@
 #define _CRT_SECURE_NO_WARNINGS
+#include "UIShops.h"
 #include "..\mm7_unsorted_subs.h"
 #include "..\Items.h"
 #include "..\GUIWindow.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/UIShops.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,5 @@
+#pragma once
+void UIShop_Buy_Identify_Repair();
+void sub_4B1523_showSpellbookInfo(int spellItemId);
+void ShowPopupShopItem();
+void GetHouseGoodbyeSpeech();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI/UITransition.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,1 @@
+#pragma once
\ No newline at end of file
--- a/UI/UiGame.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/UI/UiGame.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -34,6 +34,7 @@
 #include "..\OurMath.h"
 #include "..\Level/Decoration.h"
 #include "..\Chest.h"
+#include "UIGame.h"
 
 
 int uTextureID_GameUI_CharSelectionFrame; // 50C98C
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ZlibWrapper.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,18 @@
+
+namespace zlib
+{
+#include "lib\zlib\zlib.h"
+  int MemUnzip(void *dest, unsigned int *destLen, const void *source, unsigned int sourceLen)
+  {
+    //return uncompress((zlib::Bytef *)dest, (zlib::uLongf *)destLen, (zlib::Bytef *)source, sourceLen);
+    return uncompress((Bytef *)dest, (uLongf *)destLen, (Bytef *)source, sourceLen);
+    return 0;
+  }
+
+  int MemZip(void *dest, unsigned int *destLen, void *source, unsigned int sourceLen)
+  {
+    //return compress((zlib::Bytef *)dest, (zlib::uLongf *)destLen, (zlib::Bytef *)source, sourceLen);
+    return compress((Bytef *)dest, (uLongf *)destLen, (Bytef *)source, sourceLen);
+    return 0;
+  }
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ZlibWrapper.h	Thu Apr 10 17:35:26 2014 +0600
@@ -0,0 +1,7 @@
+#pragma once
+
+namespace zlib
+{
+  int MemZip(void *dest, unsigned int *destLen, void *source, unsigned int sourceLen);
+  int MemUnzip(void *dest, unsigned int *destLen, const void *source, unsigned int sourceLen);
+};
\ No newline at end of file
--- a/mm7_2.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/mm7_2.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -2,6 +2,8 @@
 #include <io.h>
 #include <direct.h>
 #include "mm7_unsorted_subs.h"
+#include "UI\UIPartyCreation.h"
+#include "GUIButton.h"
 
 
 #include "mm7_data.h"
@@ -1934,44 +1936,7 @@
   }
 }
 
-//----- (00458244) --------------------------------------------------------
-unsigned int SkillToMastery( unsigned int skill_value )
-{
-  switch (skill_value & 0x1C0)
-  {
-    case 0x100: return 4;     // Grandmaster
-    case 0x80:  return 3;     // Master
-    case 0x40:  return 2;     // Expert
-    case 0x00:  return 1;     // Normal
-  }
-  assert(false);
-  return 0;
-}
-
-//----- (0045828B) --------------------------------------------------------
-unsigned int __fastcall GetSpellColor(signed int a1)
-{
-  if ( a1 == 0 )
-    return Color16(0, 0, 0);
-  if ( a1 < 12 )
-    return Color16(255, 85, 0);
-  if ( a1 < 23 )
-    return Color16(150, 212, 255);
-  if ( a1 < 34 )
-    return Color16(0, 128, 255);
-  if ( a1 < 45 )
-    return Color16(128, 128, 128);
-  if ( a1 < 56 )
-    return Color16(225, 225, 225);
-  if ( a1 < 67 )
-    return Color16(235, 15, 255);
-  if ( a1 < 78 )
-    return Color16(255, 128, 0);
-  if ( a1 < 89 )
-    return Color16(255, 255, 155);
-  if ( a1 < 100 )
-    return Color16(192, 192, 240);
-}
+
 
 //----- (004610AA) --------------------------------------------------------
 void __fastcall PrepareToLoadODM(unsigned int bLoading, ODMRenderParams *a2)
@@ -2383,18 +2348,6 @@
   pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame);
 }
 
-//----- (00464839) --------------------------------------------------------
-char Is_out15odm_underwater()
-{
-  return _stricmp(pCurrentMapName, "out15.odm") == 0;
-}
-
-//----- (00464851) --------------------------------------------------------
-void SetUnderwaterFog()
-{
-  day_fogrange_1 = 50;
-  day_fogrange_2 = 5000;
-}
 
 //----- (00464866) --------------------------------------------------------
 void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box)
@@ -3433,12 +3386,6 @@
   return 1;
 }
 
-//----- (004637E0) --------------------------------------------------------
-char  sub_4637E0_is_there_popup_onscreen()
-{
-  return dword_507BF0_is_there_popup_onscreen == 1;
-}
-// 507BF0: using guessed type int dword_507BF0_is_there_popup_onscreen;
 
 //----- (00466082) --------------------------------------------------------
 void MM6_Initialize(const wchar_t *pIniFilename)
--- a/mm7_3.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/mm7_3.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -3390,233 +3390,6 @@
   return result;
 }
 
-//----- (00443801) --------------------------------------------------------
-void Initialize2DA()
-{
- 
-  int i;
-	char* test_string;
-	unsigned char c;
-	bool break_loop;
-	unsigned int temp_str_len;
-	char* tmp_pos;
-	int decode_step;
-
-	if ( p2DEventsTXT_Raw )
-		free(p2DEventsTXT_Raw);
-	p2DEventsTXT_Raw = NULL;
-	p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0);
-	strtok(p2DEventsTXT_Raw, "\r");
-	strtok(NULL, "\r");
-
-	for (i=0;i<525;++i)
-		{
-		test_string = strtok(NULL, "\r") + 1;
-		break_loop = false;
-		decode_step=0;
-		do 
-			{
-			c = *(unsigned char*)test_string;
-			temp_str_len = 0;
-			while((c!='\t')&&(c>0))
-				{
-				++temp_str_len;
-				c=test_string[temp_str_len];
-				}		
-			tmp_pos=test_string+temp_str_len;
-			if (*tmp_pos == 0)
-				break_loop = true;
-			*tmp_pos = 0;
-			if (temp_str_len)
-				{
-				switch (decode_step)
-					{
-				case 2:
-					{
-					if ( !_strnicmp(test_string, "wea", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_WeaponShop;
-						break;
-						}
-					if ( !_strnicmp(test_string, "arm", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_ArmorShop;
-						break;
-						}
-					if ( !_strnicmp(test_string, "mag", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_MagicShop;
-						break;
-						}
-					if ( !_strnicmp(test_string, "alc", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_AlchemistShop;
-						break;
-						}
-					if ( !_strnicmp(test_string, "sta", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_Stables;
-						break;
-						}
-					if ( !_strnicmp(test_string, "boa", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_Boats;
-						break;
-						}
-					if ( !_strnicmp(test_string, "tem", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_Temple;
-						break;
-						}
-					if ( !_strnicmp(test_string, "tra", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_Training;
-						break;
-						}
-					if ( !_strnicmp(test_string, "tow", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_TownHall;
-						break;
-						}
-
-					if ( !_strnicmp(test_string, "tav", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_Tavern;
-						break;
-						}
-					if ( !_strnicmp(test_string, "ban", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_Bank;
-						break;
-						}
-					if ( !_strnicmp(test_string, "fir", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_FireGuild;
-						break;
-						}
-					if ( !_strnicmp(test_string, "air", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_AirGuild;
-						break;
-						}
-					if ( !_strnicmp(test_string, "wat", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_WaterGuild;
-						break;
-						}
-					if ( !_strnicmp(test_string, "ear", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_EarthGuild;
-						break;
-						}
-					if ( !_strnicmp(test_string, "spi", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_SpiritGuild;
-						break;
-						}
-					if ( !_strnicmp(test_string, "min", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_MindGuild;
-						break;
-						}
-					if ( !_strnicmp(test_string, "bod", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_BodyGuild;
-						break;
-						}
-					if ( !_strnicmp(test_string, "lig", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_LightGuild;
-						break;
-						}
-					if ( !_strnicmp(test_string, "dar", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_DarkGuild;
-						break;
-						}
-					if ( !_strnicmp(test_string, "ele", 3) ) // "Element Guild" from mm6
-						{
-						p2DEvents[i].uType = BuildingType_ElementalGuild;
-						break;
-						}
-					if ( !_strnicmp(test_string, "sel", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_SelfGuild;
-						break;
-						}
-					if ( !_strnicmp(test_string, "mir", 3) )
-						{
-						p2DEvents[i].uType = BuildingType_16;
-						break;
-						}
-					if ( !_strnicmp(test_string, "mer", 3) ) // "Merc Guild" from mm6
-						{
-						p2DEvents[i].uType = BuildingType_TownHall;
-						break;
-						}
-					p2DEvents[i].uType = BuildingType_18;
-					}
-					break;
-
-				case 4:
-					p2DEvents[i].uAnimationID = atoi(test_string);
-					break;
-				case 5:
-					p2DEvents[i].pName = RemoveQuotes(test_string);
-					break;
-				case 6:
-					p2DEvents[i].pProprieterName = RemoveQuotes(test_string);
-					break;
-				case 7:
-					p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string);
-					break;
-				case 8:
-					p2DEvents[i].field_14 = atoi(test_string);
-					break;
-				case 9:
-					p2DEvents[i]._state = atoi(test_string);
-					break;
-				case 10:
-					p2DEvents[i]._rep = atoi(test_string);
-					break;
-				case 11:
-					p2DEvents[i]._per = atoi(test_string);
-					break;
-				case 12:
-					p2DEvents[i].fPriceMultiplier = atof(test_string);
-					break;
-				case 13:
-					p2DEvents[i].flt_24 = atof(test_string);
-					break;
-				case 15:
-					p2DEvents[i].field_1C = atoi(test_string);
-					break;
-				case 18:
-					p2DEvents[i].uOpenTime = atoi(test_string);
-					break;
-				case 19:
-					p2DEvents[i].uCloseTime = atoi(test_string);
-					break;
-				case 20:
-					p2DEvents[i].uExitPicID = atoi(test_string);
-					break;
-				case 21:
-					p2DEvents[i].uExitMapID = atoi(test_string);
-					break;
-				case 22:
-					p2DEvents[i]._quest_related = atoi(test_string);
-					break;
-				case 23:
-					p2DEvents[i].pEnterText = RemoveQuotes(test_string);
-					break;
-					}
-				}
-			++decode_step;
-			test_string=tmp_pos+1;
-			} while ((decode_step<24)&&!break_loop);
-		}
-
-}
 
 //----- (00443E31) --------------------------------------------------------
 void LoadLevel_InitializeLevelStr()
@@ -3816,25 +3589,6 @@
     LoadLevel_InitializeLevelStr();
 }
 
-//----- (00444D80) --------------------------------------------------------
-int GetTravelTime()
-{
-  signed int new_travel_time; // esi@1
-
-  new_travel_time = uDefaultTravelTime_ByFoot;
-  if ( CheckHiredNPCSpeciality(Guide) )
-    --new_travel_time;
-  if ( CheckHiredNPCSpeciality(Tracker) )
-    new_travel_time -= 2;
-  if ( CheckHiredNPCSpeciality(Pathfinder) )
-    new_travel_time -= 3;
-  if ( CheckHiredNPCSpeciality(Explorer) )
-    --new_travel_time;
-  if ( new_travel_time < 1 )
-    new_travel_time = 1;
-  return new_travel_time;
-}
-// 6BD07C: using guessed type int uDefaultTravelTime_ByFoot;
 
 //----- (004451A8) --------------------------------------------------------
 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4)
--- a/mm7_5.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/mm7_5.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -477,268 +477,6 @@
 }
 
 
-//----- (004070EF) --------------------------------------------------------
-bool __fastcall sub_4070EF_prolly_detect_player(unsigned int uObjID, unsigned int uObj2ID)
-{
-  signed int v2; // eax@1
-//  int v5; // ecx@2
-  int obj1_sector; // eax@4
-  float v8; // ST24_4@5
-//  double v9; // ST18_8@5
-//  int v11; // ecx@6
-  signed int v12; // eax@7
-//  int v13; // esi@7
-//  int v14; // esi@8
-//  int v15; // esi@9
-  int obj2_z; // edi@11
-  int obj2_x; // esi@11
-  int obj2_sector; // eax@13
-  float v20; // ST24_4@14
-//  double v21; // ST18_8@14
-  int dist_x; // ebx@16
-  signed int dist_3d; // ecx@16
-  int v25; // eax@18
-  BLVFace *v29; // ebx@32
-  Vec3_short_ *v30; // esi@32
-  int v31; // eax@32
-  int v32; // ST50_4@44
-  int v33; // ST54_4@44
-  int v34; // eax@44
-  signed int v38; // esi@45
-//  signed __int64 v40; // qtt@50
-  __int16 next_sector; // bx@58
-//  int v43; // [sp-8h] [bp-70h]@11
-//  int v44; // [sp-4h] [bp-6Ch]@11
-  int v47; // [sp+18h] [bp-50h]@20
-  int v48; // [sp+1Ch] [bp-4Ch]@20
-  int v49; // [sp+20h] [bp-48h]@20
-  int dist_z; // [sp+24h] [bp-44h]@16
-  signed int higher_z; // [sp+24h] [bp-44h]@27
-  signed int lower_z; // [sp+28h] [bp-40h]@26
-  signed int higher_y; // [sp+2Ch] [bp-3Ch]@23
-  signed int lower_y; // [sp+30h] [bp-38h]@22
-  signed int higher_x; // [sp+34h] [bp-34h]@21
-  signed int lower_x; // [sp+38h] [bp-30h]@20
-  signed int sectors_visited; // [sp+3Ch] [bp-2Ch]@28
-  int v58; // [sp+44h] [bp-24h]@50
-  int v59; // [sp+48h] [bp-20h]@44
-  int obj2_y; // [sp+50h] [bp-18h]@11
-  int obj1_x; // [sp+58h] [bp-10h]@4
-  int obj1_y; // [sp+5Ch] [bp-Ch]@4
-  int obj1_z; // [sp+60h] [bp-8h]@4
-  int current_sector; // [sp+64h] [bp-4h]@7
-  int dist_y;
-  int v70;
-
-  v2 = PID_ID(uObjID);
-  switch( PID_TYPE(uObjID) )
-  {
-	case OBJECT_Decoration:
-      obj1_x = pLevelDecorations[v2].vPosition.x;
-      obj1_y = pLevelDecorations[v2].vPosition.y;
-      obj1_z = pLevelDecorations[v2].vPosition.z;
-      obj1_sector = pIndoor->GetSector(obj1_x, obj1_y, obj1_z);
-	  break;
-	case OBJECT_Actor:
-      obj1_x = pActors[v2].vPosition.x;
-      obj1_y = pActors[v2].vPosition.y;
-      v8 = (double)pActors[v2].uActorHeight * 0.69999999;
-      //v9 = v8 + 6.7553994e15;
-      //obj1_z = LODWORD(v9) + pActors[v2].vPosition.z;
-	  obj1_z = (int)v8 + pActors[v2].vPosition.z;
-      obj1_sector = pActors[v2].uSectorID;
-	  break;
-	case OBJECT_Item:
-      obj1_x = pSpriteObjects[v2].vPosition.x;
-      obj1_y = pSpriteObjects[v2].vPosition.y;
-      obj1_z = pSpriteObjects[v2].vPosition.z;
-      obj1_sector = pSpriteObjects[v2].uSectorID;
-	  break;
-	default:
-	  return 0;
-  }
-  v12 = PID_ID(uObj2ID);
-  switch( PID_TYPE(uObj2ID) )
-  {
-    case OBJECT_Decoration:
-      obj2_z = pLevelDecorations[v12].vPosition.z;
-      obj2_x = pLevelDecorations[v12].vPosition.x;
-      obj2_y = pLevelDecorations[v12].vPosition.y;
-	  obj2_sector = pIndoor->GetSector(obj2_x, obj2_y, obj2_z);
-	  break;
-	case OBJECT_Player:
-      obj2_x = pParty->vPosition.x;
-      obj2_z = pParty->sEyelevel + pParty->vPosition.z;
-      obj2_y = pParty->vPosition.y;
-	  obj2_sector = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z);
-      break;
-	case OBJECT_Actor:
-      obj2_y = pActors[v12].vPosition.y;
-      obj2_x = pActors[v12].vPosition.x;
-      v20 = (double)pActors[v12].uActorHeight * 0.69999999;
-      //v21 = v20 + 6.7553994e15;
-      //obj2_z = LODWORD(v21) + pActors[v12].vPosition.z;
-	  obj2_z = (int)v20 + pActors[v12].vPosition.z;
-      obj2_sector = pActors[v12].uSectorID;
-	  break;
-	case OBJECT_Item:
-      obj2_x = pSpriteObjects[v12].vPosition.x;
-      obj2_z = pSpriteObjects[v12].vPosition.z;
-      obj2_y = pSpriteObjects[v12].vPosition.y;
-      obj2_sector = pSpriteObjects[v12].uSectorID;
-	  break;
-	default:
-	  return 0;
-  }
-  dist_x = obj2_x - obj1_x;
-  dist_z = obj2_z - obj1_z;
-  dist_y = obj2_y - obj1_y;
-  dist_3d = integer_sqrt(dist_x * dist_x + dist_y * dist_y + dist_z * dist_z);
-  //range check
-  if ( dist_3d > 5120 )
-    return 0;
-  if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-    return 1;
-  v25 = 65536;
-  if ( dist_3d )
-    v25 = 65536 / dist_3d;
-  v49 = dist_x * v25;
-  v47 = dist_z * v25;
-  v48 = dist_y * v25;
-  if ( obj1_x < obj2_x )
-  {
-	lower_x = obj1_x;
-    higher_x = obj2_x;
-  }
-  else
-  {
-    lower_x = obj2_x;
-    higher_x = obj1_x;
-  }
-  if ( obj1_y < obj2_y )
-  {
-	lower_y = obj1_y;
-    higher_y = obj2_y;
-  }
-  else
-  {
-    lower_y = obj2_y;
-    higher_y = obj1_y;
-  }
-  if ( obj1_z < obj2_z )
-  {
-	lower_z = obj1_z;
-    higher_z = obj2_z;
-  }
-  else
-  {
-    lower_z = obj2_z;
-    higher_z = obj1_z;
-  }
-  sectors_visited = 0;
-  //monster in same sector with player
-  if ( obj1_sector == obj2_sector )
-      return 1;
-  //search starts from monster
-  current_sector = obj1_sector;
-  for( int current_portal = 0; current_portal < pIndoor->pSectors[current_sector].uNumPortals; current_portal++ )
-  {
-	v29 = &pIndoor->pFaces[pIndoor->pSectors[current_sector].pPortals[current_portal]];
-	v30 = &pIndoor->pVertices[*v29->pVertexIDs];
-	v31 = v29->pFacePlane_old.vNormal.z * (v30->z - obj1_z)
-		+ v29->pFacePlane_old.vNormal.y * (v30->y - obj1_y)
-		+ v29->pFacePlane_old.vNormal.x * (v30->x - obj1_x);
-
-	if ( current_sector != v29->uSectorID )
-		v31 = -v31;
-
-	if ( v31 >= 0 && v30->x != obj1_x && v30->y != obj1_y && v30->z != obj1_z)
-		continue;
-
-	if(	lower_x > v29->pBounding.x2
-		|| higher_x < v29->pBounding.x1
-		|| lower_y > v29->pBounding.y2
-		|| higher_y < v29->pBounding.y1
-		|| lower_z > v29->pBounding.z2
-		|| higher_z < v29->pBounding.z1 )
-	{
-		continue;
-	}
-	  
-	v32 = fixpoint_mul(v29->pFacePlane_old.vNormal.x,v49);
-	v33 = fixpoint_mul(v29->pFacePlane_old.vNormal.z,v47);
-	v34 = fixpoint_mul(v29->pFacePlane_old.vNormal.y,v48);
-	v59 = v32 + v33 + v34;
-	if ( v59 )
-	{
-		v70 = v29->pFacePlane_old.dist 
-			+ obj1_z * v29->pFacePlane_old.vNormal.z 
-			+ obj1_x * v29->pFacePlane_old.vNormal.x 
-			+ obj1_y * v29->pFacePlane_old.vNormal.y;
-		v38 = -v70;
-
-		// if ( v59 <= 0 ^ v70 <= 0 )
-		
-		/* TEMPORARY
-		if ( v59 <= 0 && v70 <= 0 )
-		{
-			continue;
-		}
-		if ( !(v59 <= 0 && v70 <= 0) )
-		{
-			continue;
-		}
-		*/
-
-		if( abs(v38) >> 14 > abs(v59) )
-			continue;
-
-		v58 = fixpoint_div(v38,v59);
-
-		if( v58 < 0 )
-          continue;
-
-		if(!sub_4075DB(obj1_x + ((fixpoint_mul(v49,v58) + 32768) >> 16), obj1_y + ((fixpoint_mul(v48,v58) + 32768) >> 16),
-				obj1_z + ((fixpoint_mul(v47,v58) + 32768) >> 16), v29) )
-		{
-			continue;
-		}
-
-		//if there is no next sector turn back
-		if ( v29->uSectorID == current_sector )
-			next_sector = v29->uBackSectorID;
-		else
-			next_sector = v29->uSectorID;
-
-		//no more portals, quit
-		if ( next_sector == current_sector )
-          break;
-
-		++sectors_visited;
-		current_sector = next_sector;
-
-		//found player, quit
-		if ( next_sector == obj2_sector )
-			return 1;
-
-		current_sector = next_sector;
-
-		//did we hit limit for portals?
-		//does the next room have portals?
-		if ( sectors_visited < 30 && pIndoor->pSectors[current_sector].uNumPortals > 0)
-		{
-				current_portal=-1;
-				continue;
-		}
-		else
-			break;
-	}
-  }
-  //did we stop in the sector where player is?
-  if ( current_sector != obj2_sector )
-    return 0;
-  return 1;
-}
 
 //----- (004075DB) --------------------------------------------------------
 bool __fastcall sub_4075DB(int x, int y, int z, BLVFace *face)
@@ -890,16 +628,6 @@
 
 }
 
-//----- (004088E9) --------------------------------------------------------
-int __fastcall sub_4088E9(int x1, int y1, int x2, int y2, int x3, int y3)
-{
-  signed int result; // eax@1
-
-  result = integer_sqrt(abs(x2 - x1) * abs(x2 - x1) + abs(y2 - y1) * abs(y2 - y1));
-  if ( result )
-    result = abs(((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / result);
-  return result;
-}
 
 //----- (0040F82D) --------------------------------------------------------
 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue)
--- a/mm7_data.cpp	Thu Apr 10 17:35:10 2014 +0600
+++ b/mm7_data.cpp	Thu Apr 10 17:35:26 2014 +0600
@@ -294,23 +294,6 @@
 
 
 
-namespace zlib
-{
-  #include "lib\zlib\zlib.h"
-  int MemUnzip(void *dest, unsigned int *destLen, const void *source, unsigned int sourceLen)
-  {
-    //return uncompress((zlib::Bytef *)dest, (zlib::uLongf *)destLen, (zlib::Bytef *)source, sourceLen);
-    return uncompress((Bytef *)dest, (uLongf *)destLen, (Bytef *)source, sourceLen);
-    return 0;
-  }
-
-  int MemZip(void *dest, unsigned int *destLen, void *source, unsigned int sourceLen)
-  {
-    //return compress((zlib::Bytef *)dest, (zlib::uLongf *)destLen, (zlib::Bytef *)source, sourceLen);
-    return compress((Bytef *)dest, (uLongf *)destLen, (Bytef *)source, sourceLen);
-    return 0;
-  }
-};
 
 #include "stru314.h"
 #include "stru367.h"
--- a/mm7_unsorted_subs.h	Thu Apr 10 17:35:10 2014 +0600
+++ b/mm7_unsorted_subs.h	Thu Apr 10 17:35:26 2014 +0600
@@ -14,13 +14,9 @@
 //void ShowMM7IntroVideo_and_LoadingScreen();
 unsigned int GameOverMenu(void *ecx0);
 
-bool __fastcall sub_4070EF_prolly_detect_player(unsigned int uObjID, unsigned int uObj2ID);
 bool __fastcall sub_4075DB(int a1, int a2, int a3, struct BLVFace *face);
 bool __fastcall sub_4077F1(int a1, int a2, int a3, struct ODMFace *face, struct BSPVertexBuffer *a5);
 bool __fastcall sub_407A1C(int x, int z, int y, struct Vec3_int_ v); // idb
-int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6);
-void GameUI_WritePointedObjectStatusString();
-void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb
 void reset_some_strus_flt_2Cs();
 void  InitializeTurnBasedAnimations(void *);
 double get_shading_dist_mist();
@@ -28,37 +24,23 @@
 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2); // idb
 double __fastcall sub_43AE12(signed int a1);
 void ItemDamageFromActor(unsigned int uObjID, unsigned int uActorID, struct Vec3_int_ *pVelocity);
-void CharacterUI_LoadPaperdollTextures();
-void WetsuitOn(unsigned int uPlayerID); // idb
-void WetsuitOff(unsigned int uPlayerID);
-void __fastcall PrepareDrawLists_BLV();
 void FindBillboardsLightLevels_BLV();
 int __fastcall _43F55F_get_billboard_light_level(struct RenderBillboard *a1, int uBaseLightLevel);
 int __fastcall _43F5C8_get_point_light_level_with_respect_to_lights(unsigned int uBaseLightLevel, int uSectorID, float x, float y, float z);
 bool _44100D_should_alter_right_panel();
 __int16 __fastcall sub_441A4E(int a1);
-void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074); // idb
-void Initialize2DA();
 void LoadLevel_InitializeLevelStr();
 void OnMapLeave();
 void OnMapLoad();
 void Level_LoadEvtAndStr(const char *pLevelName);
-const char *GetMapBookHintText();//sub_444564
-int GetTravelTime();
 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4);
-unsigned int SkillToMastery(unsigned int skill_value);
-unsigned int __fastcall GetSpellColor(signed int a1);
-void PrepareToLoadBLV(unsigned int bLoading);
 void __fastcall PrepareToLoadODM(unsigned int bLoading, struct ODMRenderParams *a2);
 void _461103_load_level_sub();
 void MainMenu_Loop();
-char sub_4637E0_is_there_popup_onscreen();
 void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
 void PrepareWorld(unsigned int _0_box_loading_1_fullscreen);
 void Game_DeinitializeAndTerminate(int exitCode); // idb
 void FinalInitialization();
-char Is_out15odm_underwater();
-void SetUnderwaterFog();
 void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box);
 bool __fastcall CheckMM7CD(char c);
 void SecondaryInitialization();
@@ -70,21 +52,14 @@
 enum MENU_STATE GetCurrentMenuID();
 void OracleDialogue();
 const char * _4B254D_SkillMasteryTeacher(int trainerInfo);
-void SimpleHouseDialog();
-void CreateButtonInColumn(int a1, unsigned int a2);
 void sub_4B3E1E();
-void DrawJoinGuildWindow(int pEventCode);
 void _4B3FE5_training_dialogue(int a4);
 void __fastcall DrawTextAtStatusBar(const char *Str, int a5);
 __int64 GetExperienceRequiredForLevel(int a1);
 void CheckBountyRespawnAndAward();
 void Arena_SelectionFightLevel();
 void ArenaFight();
-void SpellBookGenerator();
-void UI_CreateEndConversationButton();
-void __fastcall OnSelectShopDialogueOption(signed int uMessageParam);
 int HouseDialogPressCloseBtn();
-void UIShop_Buy_Identify_Repair();
 bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused);
 void ODM_LoadAndInitialize(const char *pLevelFilename, struct ODMRenderParams *thisa);
 unsigned int GetLevelFogColor();
@@ -99,9 +74,6 @@
 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *a3, int a4);
 void sub_487DA9();
 double GetFogDensityByTime(struct OutdoorLocation *_this);
-bool PlayerCreation_Choose4Skills();
-void LoadPlayerPortraintsAndVoices();
-void ReloadPlayerPortraits(int player_id, int face_id);
 void sub_491E3A();
 void _493938_regenerate();
 void init_summoned_item(struct stru351_summoned_item *_this, __int64 duration);
@@ -109,21 +81,13 @@
 unsigned int __fastcall _494820_training_time(unsigned int a1);
 const char *GetReputationString(signed int a1);
 char *BuildDialogueString(const char *lpsz, unsigned __int8 uPlayerID, struct ItemGen *a3, char *a4, int a5, __int64 *a6);
-void PlayerCreationUI_Draw();
-void PlayerCreationUI_Initialize();
-void DeleteCCharFont();
-bool PlayerCreationUI_Loop();
 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim);
 void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd);
-void sub_4B1523_showSpellbookInfo(int spellItemId);
-void ShowPopupShopItem();
-void GetHouseGoodbyeSpeech();
 unsigned int GetGravityStrength();
 void UpdateUserInput_and_MapSpecificStuff();
 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2);
 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID);
 void _46E0B2_collide_against_decorations();
-void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2);
 int _46E44E_collide_against_faces_and_portals(unsigned int b1); // idb
 int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0);
 int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID); // idb
@@ -139,9 +103,6 @@
 bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, struct BLVFace *a4);
 bool __fastcall sub_475F30(int *a1, struct BLVFace *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9);
 void sub_4452BB();
-void  DialogueEnding();
-void PrepareHouse(enum HOUSE_ID house); // idb
-bool EnterHouse(enum HOUSE_ID uHouseID);
 bool sub_4465DF_check_season(int a1);
 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename);
 void __fastcall SetDecorationSprite(uint16_t uCog, bool bHide, const char *pFileName); // idb
@@ -169,9 +130,3 @@
     *p++ = value;
 }
 
-
-namespace zlib
-{
-  int MemZip(void *dest, unsigned int *destLen, void *source, unsigned int sourceLen);
-  int MemUnzip(void *dest, unsigned int *destLen, const void *source, unsigned int sourceLen);
-};
\ No newline at end of file