changeset 2348:4100fb5c4913

Created header files for UI cpp files
author Grumpy7
date Wed, 09 Apr 2014 21:22:06 +0200
parents d57505d3c70c
children 7ebc07cd6c53
files Actor.cpp Actor.h Build/Visual Studio 2012/World of Might and Magic.vcxproj Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Game.cpp Indoor.cpp Indoor.h UI/Books/UIMapBook.h UI/Books/UINotesBooks.h UI/Books/UISpellBook.h UI/UICharacter.cpp UI/UICharacter.h UI/UIGame.h UI/UIGuilds.h UI/UIMainMenu.h UI/UIMsgProc.h UI/UIOptions.h UI/UIPartyCreation.h UI/UIPopup.h UI/UIRest.h UI/UISaveLoad.h UI/UIShops.h UI/UITransition.h UI/UiGame.cpp mm7_5.cpp mm7_unsorted_subs.h
diffstat 13 files changed, 350 insertions(+), 281 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Tue Apr 08 17:39:59 2014 +0600
+++ b/Actor.cpp	Wed Apr 09 21:22:06 2014 +0200
@@ -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	Tue Apr 08 17:39:59 2014 +0600
+++ b/Actor.h	Wed Apr 09 21:22:06 2014 +0200
@@ -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/Build/Visual Studio 2012/World of Might and Magic.vcxproj	Tue Apr 08 17:39:59 2014 +0600
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj	Wed Apr 09 21:22:06 2014 +0200
@@ -478,8 +478,23 @@
     <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" />
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters	Tue Apr 08 17:39:59 2014 +0600
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters	Wed Apr 09 21:22:06 2014 +0200
@@ -914,6 +914,51 @@
     <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>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\Player.swig" />
--- a/Game.cpp	Tue Apr 08 17:39:59 2014 +0600
+++ b/Game.cpp	Wed Apr 09 21:22:06 2014 +0200
@@ -51,6 +51,7 @@
 #include "Registry.h"
 #include "Chest.h"
 
+#include "UI\UIGame.h"
 
 
 
--- a/Indoor.cpp	Tue Apr 08 17:39:59 2014 +0600
+++ b/Indoor.cpp	Wed Apr 09 21:22:06 2014 +0200
@@ -6288,4 +6288,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	Tue Apr 08 17:39:59 2014 +0600
+++ b/Indoor.h	Wed Apr 09 21:22:06 2014 +0200
@@ -553,3 +553,5 @@
 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();
--- a/UI/UICharacter.cpp	Tue Apr 08 17:39:59 2014 +0600
+++ b/UI/UICharacter.cpp	Wed Apr 09 21:22:06 2014 +0200
@@ -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	Wed Apr 09 21:22:06 2014 +0200
@@ -0,0 +1,4 @@
+
+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	Wed Apr 09 21:22:06 2014 +0200
@@ -0,0 +1,3 @@
+
+void GameUI_WritePointedObjectStatusString();
+void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb
\ No newline at end of file
--- a/UI/UiGame.cpp	Tue Apr 08 17:39:59 2014 +0600
+++ b/UI/UiGame.cpp	Wed Apr 09 21:22:06 2014 +0200
@@ -34,6 +34,7 @@
 #include "..\OurMath.h"
 #include "..\Level/Decoration.h"
 #include "..\Chest.h"
+#include "UIGame.h"
 
 
 int uTextureID_GameUI_CharSelectionFrame; // 50C98C
--- a/mm7_5.cpp	Tue Apr 08 17:39:59 2014 +0600
+++ b/mm7_5.cpp	Wed Apr 09 21:22:06 2014 +0200
@@ -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_unsorted_subs.h	Tue Apr 08 17:39:59 2014 +0600
+++ b/mm7_unsorted_subs.h	Wed Apr 09 21:22:06 2014 +0200
@@ -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,10 +24,6 @@
 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);