changeset 1465:090ff42290c4

Слияние
author Ritor1
date Mon, 26 Aug 2013 10:39:24 +0600
parents b870630761df (current diff) 845907a747d3 (diff)
children ec79ee6d44ce
files UI/UICharacter.cpp
diffstat 69 files changed, 896 insertions(+), 1038 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/Actor.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -1955,7 +1955,7 @@
 
   v3 = &pActors[uActorID];
   //a2 = edx0;
-  v4 = v3->pMonsterInfo.uMovementType == 5;
+  v4 = v3->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY;
   v24 = uActorID;
   if ( v4 && v3->pMonsterInfo.uAIType == 1 )
   {
@@ -2084,8 +2084,8 @@
     {
       if ( pParty->uFine )
       {
-        if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)(*ppPlayers)->_guilds_member_bits, 1) )
-          _449B7E_toggle_bit((unsigned char *)(*ppPlayers)->_guilds_member_bits, 1, 1u);
+        if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)(*ppPlayers)->_achieved_awards_bits, 1) )
+          _449B7E_toggle_bit((unsigned char *)(*ppPlayers)->_achieved_awards_bits, 1, 1u);
       }
       ++ppPlayers;
     }
@@ -2419,7 +2419,7 @@
     v3->vVelocity.z = v10;
     v3->vVelocity.y = v10;
     v3->vVelocity.x = v10;
-    if ( sub_42FB5C(v16) )
+    if ( _42FB5C_check_spell(v16) )
     {
       v3->uCurrentActionLength = 64;
       v3->uCurrentActionTime = v10;
@@ -2525,7 +2525,7 @@
     v3->vVelocity.z = v10;
     v3->vVelocity.y = v10;
     v3->vVelocity.x = v10;
-    if ( sub_42FB5C(v16) )
+    if ( _42FB5C_check_spell(v16) )
     {
       v3->uCurrentActionLength = 64;
       v3->uCurrentActionTime = v10;
@@ -2736,8 +2736,8 @@
 }
 
 //----- (004032B2) --------------------------------------------------------
-void Actor::AI_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength)
-{
+void Actor::AI_RandomMove( unsigned int uActor_id, unsigned int uTarget_id, int radius, int uActionLength )
+    {
   unsigned int v4; // edi@1
   Actor *v5; // esi@1
   int v6; // ebx@1
@@ -2757,10 +2757,10 @@
 
   //v14 never filled, maybe it is passed to function but optimized away as local variable
 
-  uActorID = a1;
-  v4 = a1;
-  v5 = &pActors[a1];
-  v16 = a2;
+  uActorID = uActor_id;
+  v4 = uActor_id;
+  v5 = &pActors[uActor_id];
+  v16 = uTarget_id;
   v6 = v5->vInitialPosition.x - v5->vPosition.x;
   v7 = v5->vInitialPosition.x - v5->vPosition.x;
   y = v5->vInitialPosition.y - v5->vPosition.y;
@@ -2779,13 +2779,11 @@
   }
   if ( pActors[v4].pMonsterInfo.uMovementType == 3 && v19 < 128 )
   {
-    v13 = &v14;
-    v12 = 256;
-    Actor::AI_Stand(uActorID, v16, v12, v13);
+    Actor::AI_Stand(uActorID, uTarget_id, 256, &v14);
     return;
   }
   v15 = (rand() & 0xF) << 12;
-  v19 += (unsigned __int64)(v15 * (signed __int64)a3) >> 16;
+  v19 += (unsigned __int64)(v15 * (signed __int64)radius) >> 16;
   v9 = (stru_5C6E00->uIntegerDoublePi - 1) & stru_5C6E00->Atan2(v6, y);
   if ( rand() % 100 < 25 )
   {
@@ -2793,17 +2791,14 @@
     return;
   }
   v10 = v9 + rand() % 256 - 128;
-  if ( abs(v10 - v5->uYawAngle) > 256 && !(BYTE2(v5->uAttributes) & 0x20) )
+  if ( abs(v10 - v5->uYawAngle) > 256 && !(v5->uAttributes & 0x200000) )
   {
-    v13 = &v14;
-    v12 = 256;
-    Actor::AI_Stand(uActorID, v16, v12, v13);
+    Actor::AI_Stand(uActorID, uTarget_id, 256, &v14);
     return;
   }
-  v11 = v5->uMovementSpeed;
   v5->uYawAngle = v10;
-  if ( v11 )
-    v5->uCurrentActionLength = 32 * v19 / v11;
+  if ( v5->uMovementSpeed)
+    v5->uCurrentActionLength = 32 * v19 / v5->uMovementSpeed;
   else
     v5->uCurrentActionLength = 0;
   v5->uCurrentActionTime = 0;
@@ -2858,7 +2853,7 @@
       v10 = v5->vPos.z;
       v4->vInitialPosition.z = v10;
       LOBYTE(v5) = v5->uAction;
-      v4->pMonsterInfo.uMovementType = (unsigned __int8)v5;
+      v4->pMonsterInfo.uMovementType = MONSTER_MOVEMENT_TYPE_STAIONARY;
       if ( a3 == 1 )
       {
         v4->vPosition.x = v4->vInitialPosition.x;
@@ -4002,7 +3997,7 @@
   return result;
 }
 //----- (00401A91) --------------------------------------------------------
-void __cdecl UpdateActorAI()
+void  UpdateActorAI()
 {
 	//unsigned int v0; // esi@4
 	int v1; // eax@7
@@ -4417,7 +4412,7 @@
 			{
 				if ( (signed int)v36 >= 10240 )
 				{
-					Actor::AI_4032B2(actor_id, target_pid, 1024, 0);
+					Actor::AI_RandomMove(actor_id, target_pid, 1024, 0);
 				}
 				else
 				{
@@ -4433,7 +4428,7 @@
 
 				if ( pActor->pMonsterInfo.uAIType == 1 )
 				{
-					if ( pActor->pMonsterInfo.uMovementType == 5 )
+					if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
 					{
 						Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333),	&pDir);
 					}
@@ -4480,7 +4475,7 @@
 							{
 								Actor::AI_MissileAttack1(actor_id, target_pid, &pDir);
 							}
-							else if ( pActor->pMonsterInfo.uMovementType == 5 )
+							else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
 							{
 								v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 								v64 = (signed __int64)v47;
@@ -4506,7 +4501,7 @@
 							{
 								if ( v81 >= 1024 )
 								{
-									if ( pActor->pMonsterInfo.uMovementType == 5 )
+									if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
 									{
 										v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 										v64 = (signed __int64)v47;
@@ -4518,7 +4513,7 @@
 										Actor::AI_Pursue3(actor_id, target_pid, 0, &pDir);
 									}
 								}
-								else if ( pActor->pMonsterInfo.uMovementType == 5 )
+								else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
 								{
 									v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 									v64 = (signed __int64)v47;
@@ -4562,7 +4557,7 @@
 								else
 									Actor::AI_SpellAttack2(actor_id, target_pid, &pDir);
 							}
-							else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 )
+							else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
 							{
 								v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 								v64 = (signed __int64)v47;
@@ -4580,7 +4575,7 @@
 							{
 								if ( v81 >= 1024 )
 								{
-									if ( pActor->pMonsterInfo.uMovementType == 5 )
+									if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
 									{
 										v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 										v64 = (signed __int64)v47;
@@ -4591,7 +4586,7 @@
 										Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir);
 									}
 								}
-								else if ( pActor->pMonsterInfo.uMovementType == 5 )
+								else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
 								{
 									v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 									v64 = (signed __int64)v47;
@@ -4621,23 +4616,23 @@
 			
 			if ( pActor->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 )
 			{
-				if ( !pActor->pMonsterInfo.uMovementType )
+				if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_SHORT )
 				{
-					Actor::AI_4032B2(actor_id, 4, 1024, 0);
+					Actor::AI_RandomMove(actor_id, 4, 1024, 0);
 				}
 				else if ( pActor->pMonsterInfo.uMovementType == 1 )
 				{
-					Actor::AI_4032B2(actor_id, 4, 2560, 0);
+					Actor::AI_RandomMove(actor_id, 4, 2560, 0);
 				}
 				else if ( pActor->pMonsterInfo.uMovementType == 2 )
 				{
-					Actor::AI_4032B2(actor_id, 4, 5120, 0);
+					Actor::AI_RandomMove(actor_id, 4, 5120, 0);
 				}
 				else if ( pActor->pMonsterInfo.uMovementType == 4 )
 				{
-					Actor::AI_4032B2(actor_id, 4, 10240, 0);
+					Actor::AI_RandomMove(actor_id, 4, 10240, 0);
 				}
-				else if ( pActor->pMonsterInfo.uMovementType == 5 )
+				else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
 				{
 					v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0);
 					v58 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
@@ -4653,7 +4648,7 @@
 				{
 					if ( v81 >= 1024 )
 					{
-						if ( pActor->pMonsterInfo.uMovementType == 5 )
+						if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
 						{
 							v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 							v64 = (signed __int64)v47;
@@ -4664,7 +4659,7 @@
 							Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir);
 						}
 					}
-					else if ( pActor->pMonsterInfo.uMovementType == 5 )
+					else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
 					{
 						v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
 						v64 = (signed __int64)v47;
@@ -4690,7 +4685,7 @@
 			else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 )
 			{
 				v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333;
-				if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 )
+				if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
 				{
 					v64 = (signed __int64)v47;
 					Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
@@ -4752,7 +4747,7 @@
   return v5;
 }
 //----- (00408B54) --------------------------------------------------------
-unsigned int __fastcall SearchActorByID(unsigned int *pTotalActors, unsigned int a2)
+unsigned int SearchActorByID(unsigned int *pTotalActors, unsigned int a2)
 {
   unsigned int v2; // edi@1
   unsigned int *v3; // esi@1
@@ -4775,7 +4770,7 @@
   return v5;
 }
 //----- (00408AE7) --------------------------------------------------------
-unsigned int __fastcall SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup)
+unsigned int SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup)
 {
   unsigned int *v2; // esi@1
   signed int v3; // ebx@1
@@ -4814,7 +4809,7 @@
   return v9;
 }
 //----- (00408A7E) --------------------------------------------------------
-unsigned int __fastcall SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID)
+unsigned int SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID)
 {
   unsigned int *v2; // esi@1
   signed int v3; // ebx@1
@@ -4853,7 +4848,7 @@
   return v9;
 }
 //----- (00408A27) --------------------------------------------------------
-unsigned int __thiscall SearchAliveActors(unsigned int *pTotalActors)
+unsigned int SearchAliveActors(unsigned int *pTotalActors)
 {
   unsigned int *v1; // esi@1
   int v2; // eax@1
--- a/Actor.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/Actor.h	Mon Aug 26 10:39:24 2013 +0600
@@ -201,7 +201,7 @@
   static void AI_Bored(unsigned int uActorID, unsigned int uObjID, struct AIDirection *a4);
   static void AI_Stun(unsigned int uActorID, signed int edx0, int arg0);
   static char __fastcall _4031C1_update_job(unsigned int uActorID, signed int a2, int a3);
-  static void AI_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength);
+  static void AI_RandomMove(unsigned int uActor_id, unsigned int uTarget_id, int radius, int uActionLength);
   static void AI_MissileAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir);
   static void AI_MissileAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir);
   static void AI_SpellAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir);
--- a/Arcomage.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/Arcomage.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -58,10 +58,10 @@
 void GameResultsApply();
 
 void pPrimaryWindow_draws_text(int a1, const char *pText, POINT *pXY);
-void __thiscall am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb
+void  am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb
 void __fastcall Blt_Chroma(RECT  *pSrcXYZW, POINT *pTargetXY, int a3, int a4);
 void  Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3);
-void __cdecl am_EndScene();
+void  am_EndScene();
 void DrawRect(RECT *pXYZW, unsigned __int16 uColor, char bSolidFill);
 void SetPixel2sq( POINT *pTargetXY, unsigned __int16 uColor );
 void SetPixel(POINT *pTargetXY, unsigned __int16 uColor);
@@ -1272,9 +1272,6 @@
   GameResultsApply();
   if ( byte_4FAA2C )
   {
-   // v2 = retzero_sub_40DFA7((int)dword_4FAA28);
-   // v1 = 1000;
-   // dword_4FAA70 = v2 / 1000;
      dword_4FAA70 = 0;
   }
   else
@@ -3935,7 +3932,7 @@
    
     for (int i=0; i<4; ++i  )
     {
-      v11 = (char *)&pParty->pPlayers[i]._guilds_member_bits;
+      v11 = (char *)&pParty->pPlayers[i]._achieved_awards_bits;
       if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v11, 1) )
         _449B7E_toggle_bit((unsigned char *)v11, PLAYER_GUILD_BITS__ARCOMAGE_WIN, 1);
       
@@ -3949,7 +3946,7 @@
   {
   for (int i=0; i<4; ++i  )
       {
-      v12 = (char *)&pParty->pPlayers[i]._guilds_member_bits;
+      v12 = (char *)&pParty->pPlayers[i]._achieved_awards_bits;
       if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v12, 1) )
         _449B7E_toggle_bit((unsigned char *)v12, PLAYER_GUILD_BITS__ARCOMAGE_LOSE, 1);
     }
--- a/AudioPlayer.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/AudioPlayer.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -1308,7 +1308,7 @@
 }
 
 //----- (0040DEA5) --------------------------------------------------------
-void __cdecl AudioPlayer::MessWithChannels()
+void  AudioPlayer::MessWithChannels()
 {
   pAudioPlayer->StopChannels(-1, -1);
 }
@@ -2270,7 +2270,7 @@
 // 4ABF23: using guessed type int var_48[16];
 
 //----- (004ABFDB) --------------------------------------------------------
-void __cdecl PlayLevelMusic()
+void  PlayLevelMusic()
 {
   unsigned int v0; // eax@1
 
--- a/AudioPlayer.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/AudioPlayer.h	Mon Aug 26 10:39:24 2013 +0600
@@ -103,12 +103,16 @@
   SOUND_Arcomage_130 = 0x82,
   SOUND_Arcomage_131 = 0x83,
   SOUND_Arcomage_WallUpgrade = 0x84,
+  SOUND_PlayLute = 133, // 85
+  SOUND_PlayFaeriePipes = 134, // 86
+  SOUND_PlayGryphonheartsTrumpet = 135, // 87
   SOUND_GoldReceived = 0xC8,
   SOUND_203 = 203,
   SOUND_206 = 206,
   SOUND_207 = 207,
   SOUND_OpenChest = 208,
   SOUND_PlayerCantCastSpell = 0xD1,
+  SOUND_EatApple = 211, // D3
   SOUND_Bell = 0xD9,
   SOUND_OpenBook = 230,
   SOUND_CloseBook = 231,
@@ -171,7 +175,7 @@
   void SetMapEAX();
   int _4AC0A2();
   void PlayMusicTrack(enum MusicID eTrack);
-  void __cdecl MessWithChannels();
+  void  MessWithChannels();
 
 
   unsigned int bEAXSupported;
--- a/CShow.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/CShow.h	Mon Aug 26 10:39:24 2013 +0600
@@ -52,6 +52,6 @@
   void PlayMovie(MovieType eVideo, bool bShowMouseAfterPlayback);
 
 
-  void (__thiscall ***vdestructor_ptr)(CShow *, bool);
+  void ( ***vdestructor_ptr)(CShow *, bool);
 };
 #pragma pack(pop)*/
\ No newline at end of file
--- a/CastSpellInfo.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/CastSpellInfo.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -1346,9 +1346,9 @@
 			else
 			{
 				v155 = stru_5C6E00->Cos(pParty->sRotationY);
-				uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155);
+				uRequiredMana = pParty->vPosition.x + fixpoint_sub0(2048, v155);
 				v156 = stru_5C6E00->Sin(pParty->sRotationY);
-				LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156);
+				LODWORD(v727) = pParty->vPosition.y + fixpoint_sub0(2048, v156);
 				v154 = pParty->vPosition.z;
 			}
 			unsigned __int64 k = 0;
@@ -1414,7 +1414,7 @@
 			}
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
-			auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
+			auto _v726 = _46A6AC_spell_render((int)dword_50BF30.data(), 100, 4096);
 			v700.z = 0;
 			v700.y = 0;
 			v700.x = 0;
@@ -1653,9 +1653,9 @@
 			else
 			{
 				v212 = stru_5C6E00->Cos(pParty->sRotationY);
-				LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212);
+				LODWORD(v718) = pParty->vPosition.x + fixpoint_sub0(2048, v212);
 				v213 = stru_5C6E00->Sin(pParty->sRotationY);
-				v214 = sub_42EBBE(2048, v213);
+				v214 = fixpoint_sub0(2048, v213);
 				v211 = pParty->vPosition.z;
 				v713 = pParty->vPosition.y + v214;
 				v208 = LODWORD(v725);
@@ -2389,7 +2389,7 @@
 				LODWORD(v733) = 300 * v2 + 180;
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
-			auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
+			auto _v726 = _46A6AC_spell_render((int)dword_50BF30.data(), 100, 4096);
 			pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u);
 			++pSpellSprite.uType;
 			pSpellSprite.stru_24.Reset();
@@ -2859,7 +2859,7 @@
 				amount = 180 * v2;
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
-			auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
+			auto _v726 = _46A6AC_spell_render((int)dword_50BF30.data(), 100, 4096);
 			pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u);
 			++pSpellSprite.uType;
 			pSpellSprite.stru_24.Reset();
@@ -3248,7 +3248,7 @@
 				break;
 
 			pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u);
-			v505 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
+			v505 = _46A6AC_spell_render((int)dword_50BF30.data(), 100, 4096);
 			++pSpellSprite.uType;
 			//signed int _v733 = v505;
 			v688.x = 0;
@@ -3368,7 +3368,7 @@
 			}
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
-			v531 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
+			v531 = _46A6AC_spell_render((int)dword_50BF30.data(), 100, 4096);
 			++pSpellSprite.uType;
 			v694.x = 0;
 			v694.y = 0;
@@ -3905,7 +3905,7 @@
 				break;
 			pGame->GetIndoorCamera();
 			v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth();
-			signed int _v733 = sub_46A6AC((int)dword_50BF30.data(), 100, v623);
+			signed int _v733 = _46A6AC_spell_render((int)dword_50BF30.data(), 100, v623);
 			v707.x = 0;
 			v707.y = 0;
 			v707.z = 0;
--- a/Chest.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/Chest.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -198,7 +198,7 @@
 
 
 //----- (0042038D) --------------------------------------------------------
-void __cdecl ChestUI_WritePointedObjectStatusString()
+void  ChestUI_WritePointedObjectStatusString()
 {
   POINT *v0; // esi@2
   int v1; // ecx@2
@@ -282,7 +282,7 @@
             itemPixelPosY = chest_offs_y + 32 * (item_counter / chestHeghtCells) +
                 ((signed int)(((itemPixelHeght - 14) & 0xFFFFFFE0) + 32- item_texture->uTextureHeight ) /2);
             pRenderer->DrawTextureTransparent(  itemPixelPosX,   itemPixelPosY,  item_texture);
-            sub_40F92A(&v16[itemPixelPosX + pSRZBufferLineOffsets[itemPixelPosY]], item_texture, item_counter + 1);
+            ZBuffer_DoFill2(&v16[itemPixelPosX + pSRZBufferLineOffsets[itemPixelPosY]], item_texture, item_counter + 1);
             }
         }
     pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId));
@@ -791,7 +791,7 @@
 }
 // 506128: using guessed type int areWeLoadingTexture;
 //----- (00420E01) --------------------------------------------------------
-void __cdecl OnChestLeftClick()
+void  OnChestLeftClick()
 {
   int chest_id; // edi@1
   POINT *v1; // esi@2
--- a/DecalBuilder.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/DecalBuilder.h	Mon Aug 26 10:39:24 2013 +0600
@@ -15,14 +15,14 @@
   }
 
   //----- (0043B54C) --------------------------------------------------------
-  //void __thiscall Bloodsplat::vdtor(Bloodsplat *this, char a2)
+  //void  Bloodsplat::vdtor(Bloodsplat *this, char a2)
 
   //----- (0043B569) --------------------------------------------------------
   virtual ~Bloodsplat()
   {
   }
 
-  //void (__thiscall ***vdestructor_ptr)(Bloodsplat *, bool);
+  //void ( ***vdestructor_ptr)(Bloodsplat *, bool);
   float x;
   float y;
   float z;
@@ -49,8 +49,8 @@
     this->std__vector_pBloodsplats,
     40,
     64,
-    (void (__thiscall *)(void *))Bloodsplat::Bloodsplat,
-    (void (__thiscall *)(void *))Bloodsplat::dtor);
+    (void ( *)(void *))Bloodsplat::Bloodsplat,
+    (void ( *)(void *))Bloodsplat::dtor);
   v1->std__vector_pBloodsplats_size = 0;*/
     uNumBloodsplats = 0;
   }
@@ -66,7 +66,7 @@
   bool AddBloodsplat(float x, float y, float z, float radius, char r, char g, char b);
 
 
-  //void (__thiscall ***vdestructor_ptr)(BloodsplatContainer *, bool);
+  //void ( ***vdestructor_ptr)(BloodsplatContainer *, bool);
   Bloodsplat std__vector_pBloodsplats[64];
   unsigned int std__vector_pBloodsplats_size;
   int uNumBloodsplats;
@@ -107,13 +107,13 @@
   }
 
   //----- (0043B625) --------------------------------------------------------
-  //void __thiscall Decal::vdtor(Decal *this, bool a2)
+  //void  Decal::vdtor(Decal *this, bool a2)
   //----- (0043B641) --------------------------------------------------------
   virtual ~Decal()
   {
   }
 
-  //void (__thiscall ***vdestructor_ptr)(Decal *, bool);
+  //void ( ***vdestructor_ptr)(Decal *, bool);
   int uNumVertices;
   RenderVertexSoft pVertices[64];
   __int16 field_C08;
@@ -142,8 +142,8 @@
     this->std__vector_pDecals,
     3104,
     1024,
-    (void (__thiscall *)(void *))Decal::Decal,
-    (void (__thiscall *)(void *))Decal::dtor);*/
+    (void ( *)(void *))Decal::Decal,
+    (void ( *)(void *))Decal::dtor);*/
   v1->std__vector_pDecals_size = 0;
   v1->field_308008 = 0;
   v2 = (char *)&v1->pVertices[0].flt_2C;
@@ -176,7 +176,7 @@
 
 
 
-  //void (__thiscall ***vdestructor_ptr)(DecalBuilder *, bool);
+  //void ( ***vdestructor_ptr)(DecalBuilder *, bool);
   Decal std__vector_pDecals[1024];
   unsigned int std__vector_pDecals_size;
   int field_308008;
--- a/Events.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/Events.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -91,7 +91,7 @@
 	}
 
 //----- (00443DA1) --------------------------------------------------------
-void __cdecl Initialize_GlobalEVT()
+void  Initialize_GlobalEVT()
 {
 	struct raw_event_header
 		{ 
--- a/GUIButton.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/GUIButton.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -77,7 +77,7 @@
 struct GUIWindow *pGUIWindow_CurrentMenu;
 struct GUIWindow *ptr_507BD0;
 struct GUIWindow *pGUIWindow_Settings;
-struct GUIWindow *ptr_507BDC;
+struct GUIWindow *pModalWindow;
 struct GUIWindow *pGUIWindow_EscMessageWindow;
 struct GUIWindow *pBooksWindow;
 struct GUIWindow *pGUIWindow2;
@@ -182,13 +182,13 @@
      pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30,  1,  0, UIMSG_SelectShopDialogueOption,  control_id,  0,   "",   0);
 }
 //----- (00419379) --------------------------------------------------------
-void __cdecl sub_419379()
+void ReleaseAwardsScrollBar()
 {
   GUIButton *pButton; // esi@2
 
-  if ( dword_507CBC )
+  if ( awards_scroll_bar_created )
   {
-    dword_507CBC = 0;
+    awards_scroll_bar_created = false;
 	ptr_507BA4->Release();
     pBtn_Up->Release();
     pBtn_Down->Release();
@@ -208,13 +208,13 @@
   }
 }
 //----- (00419220) --------------------------------------------------------
-void __cdecl CreateAwardsScrollBar()
+void CreateAwardsScrollBar()
 {
   GUIButton *pButton; // eax@2
 
-  if ( !dword_507CBC )
+  if ( !awards_scroll_bar_created )
   {
-    dword_507CBC = 1;
+    awards_scroll_bar_created = 1;
     for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext )
     {
       if ( pButton->msg == UIMSG_InventoryLeftClick )
--- a/GUIWindow.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/GUIWindow.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -74,17 +74,6 @@
 
 
 
-
-//----- (004141CA) --------------------------------------------------------
-void ModalWindow( const char *pStrHint, int a4 )
-    {
-  pEventTimer->Pause();
-  dword_506F0C[0] = pCurrentScreen;
-  ptr_507BDC = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, a4, pStrHint);
-  pCurrentScreen = SCREEN_PRESS_ESCAPE_MESSAGE;
-}
-// 4E28F8: using guessed type int pCurrentScreen;
-
 // inlined
 //----- (mm6c::00420520) --------------------------------------------------
 void GUIMessageQueue::Flush()
@@ -293,7 +282,7 @@
 		{
 		pIcons_LOD->SyncLoadedFilesCount();
 		pCurrentScreen = pMainScreenNum;
-		pKeyActionMap->SetWindowInputStatus(3);
+		pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
 		break;
 		}
 	case WINDOW_HouseInterior:
@@ -1827,7 +1816,7 @@
   dialog_menu_id = HOUSE_DIALOGUE_OTHER;
 }
 //----- (0044603D) --------------------------------------------------------
-void __cdecl DialogueEnding()
+void  DialogueEnding()
 {
   sDialogue_SpeakingActorNPC_ID = 0;
   pDialogueWindow->Release();
@@ -1984,9 +1973,9 @@
         pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u));
         continue;
       }
-      case WINDOW_FinalWindow:
+      case WINDOW_ModalWindow:
       {
-        sub_41420D_press_esc();
+        ModalWindow_ShowHint();
         continue;
       }
       case WINDOW_50:
@@ -2278,12 +2267,27 @@
   Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
   Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3);
 }
+
+
+
+
+int modal_window_prev_screen;
+
+//----- (004141CA) --------------------------------------------------------
+void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message)
+{
+  pEventTimer->Pause();
+  modal_window_prev_screen = pCurrentScreen;
+  pModalWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ModalWindow, OnRelease_message, pStrHint);
+  pCurrentScreen = SCREEN_MODAL_WINDOW;
+}
+
 //----- (0041420D) --------------------------------------------------------
-void __cdecl sub_41420D_press_esc()
+void  ModalWindow_ShowHint()
 {
   GUIWindow pWindow; // [sp+4h] [bp-54h]@1
 
-  sprintf(pTmpBuf2.data(), "%s\n \n%s", ptr_507BDC->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape
+  sprintf(pTmpBuf2.data(), "%s\n \n%s", pModalWindow->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape
   pWindow.Hint = pTmpBuf2.data();
   pWindow.uFrameWidth = 400;
   pWindow.uFrameHeight = 100;
@@ -2295,16 +2299,14 @@
 }
 
 //----- (0041426F) --------------------------------------------------------
-void __cdecl sub_41426F()
+void ModalWindow_Release()
 {
-  GUIWindow *pWindow; // ecx@1
+  pMessageQueue_50CBD0->AddMessage((UIMessageType)pModalWindow->par1C, 0, 0);
 
-  pWindow = ptr_507BDC;
-  pMessageQueue_50CBD0->AddMessage((UIMessageType)ptr_507BDC->par1C, 0, 0);
+  pModalWindow->Release();
+  pModalWindow = nullptr;
 
-  pWindow->Release();
-  ptr_507BDC = 0;
-  pCurrentScreen = dword_506F0C[0];
+  pCurrentScreen = modal_window_prev_screen;
   pEventTimer->Resume();
 }
 
@@ -2369,7 +2371,7 @@
   }
 }
 //----- (00467F9F) --------------------------------------------------------
-void __cdecl free_book_subwindow()
+void  free_book_subwindow()
 {
   if ( pGUIWindow_ScrollWindow )
   {
--- a/GUIWindow.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/GUIWindow.h	Mon Aug 26 10:39:24 2013 +0600
@@ -158,7 +158,7 @@
   UIMSG_C2 = 192,
 
   UIMSG_OnCastTownPortal = 195,
-  UIMSG_C4 = 196,
+  UIMSG_OnFinalWindowClose = 196,
   UIMSG_ShowFinalWindow = 197,
   UIMSG_C6 = 198,
   UIMSG_C7 = 199,
@@ -222,7 +222,7 @@
   MENU_NAMEPANELESC = 7,
   MENU_CREDITSPROC = 8,
   MENU_LoadingProcInMainMenu = 9,
-  MENU_10 = 10,
+  MENU_DebugBLVLevel = 10,
   MENU_CREDITSCLOSE = 11,
 };
 
@@ -276,7 +276,7 @@
   WINDOW_CastSpell = 27,
   WINDOW_Scroll = 0x1E,
   WINDOW_CastSpell_InInventory = 31,
-  WINDOW_FinalWindow = 70,
+  WINDOW_ModalWindow = 70,
   WINDOW_50 = 80,
   WINDOW_59 = 89,
   WINDOW_PressedButton2 = 90,
@@ -398,7 +398,7 @@
   SCREEN_INPUT_BLV = 0x12,
   SCREEN_BRANCHLESS_NPC_DIALOG = 0x13,
   SCREEN_PARTY_CREATION = 0x15,
-  SCREEN_PRESS_ESCAPE_MESSAGE = 0x16,
+  SCREEN_MODAL_WINDOW = 0x16,
   SCREEN_CASTING = 0x17,
   SCREEN_19 = 0x19,
   SCREEN_KEYBOARD_OPTIONS = 0x1A,
@@ -464,7 +464,9 @@
 
 
 
-void ModalWindow(const char *pStrHint, int a4);
+void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message);
+void ModalWindow_ShowHint();
+void ModalWindow_Release();
 
 
 
@@ -549,7 +551,7 @@
 void InitializeBookTextures();
 void InitializeBookFonts();
 void DrawSpellBookContent(Player *player);
-unsigned int __cdecl DrawLloydBeaconsScreen();
+unsigned int  DrawLloydBeaconsScreen();
 void BookUI_DrawTownPortalMap();
 void LoadSpellbook(unsigned int uID); // idb
 void DrawSpellDescriptionPopup(int spell_index);
@@ -575,6 +577,15 @@
 
 
 
+void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight); // idb
+void DrawCopyrightWindow();
+void LoadFonts_and_DrawCopyrightWindow();
+void GUI_UpdateWindows();
+int GetConditionDrawColor(unsigned int uConditionIdx); // idb
+void FillAwardsData();
+void CreateAwardsScrollBar();
+void ReleaseAwardsScrollBar();
+
 
 
 
@@ -693,7 +704,7 @@
 extern struct GUIWindow *pGUIWindow_CurrentMenu;
 extern struct GUIWindow *ptr_507BD0;
 extern struct GUIWindow *pGUIWindow_Settings;
-extern struct GUIWindow *ptr_507BDC;
+extern struct GUIWindow *pModalWindow;
 extern struct GUIWindow *pGUIWindow_EscMessageWindow;
 extern struct GUIWindow *pBooksWindow;
 extern struct GUIWindow *pGUIWindow2;
@@ -738,6 +749,10 @@
 extern unsigned int ui_character_skillinfo_can_learn;
 extern unsigned int ui_character_skillinfo_can_learn_gm;
 extern unsigned int ui_character_skillinfo_cant_learn;
+extern unsigned int ui_character_condition_normal_color;
+extern unsigned int ui_character_condition_light_color;
+extern unsigned int ui_character_condition_moderate_color;
+extern unsigned int ui_character_condition_severe_color;
 extern std::array<unsigned int, 6> ui_character_award_color;
 extern unsigned int ui_game_minimap_outline_color;
 extern unsigned int ui_game_minimap_actor_friendly_color;
--- a/Game.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/Game.h	Mon Aug 26 10:39:24 2013 +0600
@@ -119,7 +119,7 @@
   struct IndoorCameraD3D *GetIndoorCamera() {return this->pIndoorCameraD3D;}
 
 
-  //void (__thiscall ***vdestructor_ptr)(Game *, bool);
+  //void ( ***vdestructor_ptr)(Game *, bool);
   Game__StationaryLight pStationaryLights[25];
   char field_2C0[1092];
   unsigned int uNumStationaryLights;
--- a/GammaControl.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/GammaControl.h	Mon Aug 26 10:39:24 2013 +0600
@@ -23,7 +23,7 @@
 
 
 
-  void (__thiscall ***vdestructor_ptr)(GammaController *, bool);
+  void ( ***vdestructor_ptr)(GammaController *, bool);
   IDirectDrawSurface4 *pSurface;
   IDirectDrawGammaControl *pGammaControl;
   DDGAMMARAMP pDefaultRamp;
--- a/Indoor.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/Indoor.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -2739,7 +2739,7 @@
 
 
 //----- (0046F228) --------------------------------------------------------
-void __cdecl BLV_UpdateDoors()
+void  BLV_UpdateDoors()
 {
   //int v0; // ebx@1
   //int v1; // edi@1
@@ -3162,7 +3162,7 @@
 // 6BE13C: using guessed type int dword_6BE13C_uCurrentlyLoadedLocationID;
 
 //----- (0046F90C) --------------------------------------------------------
-void __cdecl UpdateActors_BLV()
+void  UpdateActors_BLV()
 {
   Actor *v0; // esi@2
   unsigned __int16 v1; // ax@2
@@ -3637,7 +3637,7 @@
 
 
 //----- (00460A78) --------------------------------------------------------
-void __thiscall PrepareToLoadBLV(unsigned int bLoading)
+void  PrepareToLoadBLV(unsigned int bLoading)
 {
   unsigned int v1; // ebx@1
   unsigned int v2; // eax@8
@@ -4241,7 +4241,7 @@
   return result;
 }
 //----- (004016FA) --------------------------------------------------------
-int __cdecl MakeActorAIList_BLV()
+int  MakeActorAIList_BLV()
 {
   Actor *v0; // esi@2
   int v1; // eax@4
@@ -5441,6 +5441,8 @@
   int v_4c; // [sp+8Ch] [bp+10h]@141
   int v_8; // [sp+90h] [bp+14h]@53
 
+  __debugbreak();
+
   a4 = __PAIR__(z, x);
   v4 = stru_5C6E00->Atan2(v.x - x, v.y - z);
   v114 = 0;
@@ -6209,7 +6211,7 @@
   return 0;
 }
 //----- (0046BDF1) --------------------------------------------------------
-void __cdecl BLV_UpdateUserInputAndOther()
+void  BLV_UpdateUserInputAndOther()
 {
   UpdateObjects();
   BLV_ProcessPartyActions();
--- a/IndoorCameraD3D.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/IndoorCameraD3D.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -29,8 +29,8 @@
   /*_eh_vector_constructor_iterator_(v1->std__vector_000034_prolly_frustrum,
     24,
     6,
-    (void (__thiscall *)(void *))IndoorCameraD3D_Vec4::IndoorCameraD3D_Vec4,
-    (void (__thiscall *)(void *))IndoorCameraD3D_Vec4::dtor);*/
+    (void ( *)(void *))IndoorCameraD3D_Vec4::IndoorCameraD3D_Vec4,
+    (void ( *)(void *))IndoorCameraD3D_Vec4::dtor);*/
   //v2 = 0;//(double)pBLVRenderParams->vPartyPos.z;
   //v3 = 0;//(double)pBLVRenderParams->vPartyPos.y;
   //v4 = 0;//(double)pBLVRenderParams->vPartyPos.x;
@@ -87,7 +87,7 @@
     //  v10->mm7__vector_000004,
     //  48,
     //  64,
-    //  (int (__thiscall *)(int))IndoorCameraD3D_stru1::IndoorCameraD3D_stru1);
+    //  (int ( *)(int))IndoorCameraD3D_stru1::IndoorCameraD3D_stru1);
     //++v10;
     --v12;
   }
--- a/IndoorCameraD3D.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/IndoorCameraD3D.h	Mon Aug 26 10:39:24 2013 +0600
@@ -14,7 +14,7 @@
   //----- (004C039C) --------------------------------------------------------
   //void ~IndoorCameraD3D_Vec3() {}
 
-  //void (__thiscall ***vdestructor_ptr)(IndoorCameraD3D_Vec3 *, bool);
+  //void ( ***vdestructor_ptr)(IndoorCameraD3D_Vec3 *, bool);
 
   union
   {
@@ -161,7 +161,7 @@
 
   void DebugDrawPortal(struct BLVFace *pFace);
 
-  //void (__thiscall ***vdestructor_ptr)(IndoorCameraD3D *, bool);
+  //void ( ***vdestructor_ptr)(IndoorCameraD3D *, bool);
   IndoorCameraD3D_Vec3 field_4[3];
   //IndoorCameraD3D_Vec3 field_14;
   //IndoorCameraD3D_Vec3 field_24;
--- a/Indoor_stuff.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/Indoor_stuff.h	Mon Aug 26 10:39:24 2013 +0600
@@ -33,8 +33,8 @@
   inline BspRenderer_stru0()
   {
     //_eh_vector_constructor_iterator_(std__vector_0007AC, 24, 4,
-    //    (void (__thiscall *)(void *))IndoorCameraD3D_Vec4::IndoorCameraD3D_Vec4,
-    //    (void (__thiscall *)(void *))IndoorCameraD3D_Vec4::dtor);
+    //    (void ( *)(void *))IndoorCameraD3D_Vec4::IndoorCameraD3D_Vec4,
+    //    (void ( *)(void *))IndoorCameraD3D_Vec4::dtor);
     //for (int i = 0; i < 4; ++i)
     //  pVertices[i].flt_2C = 0.0f;
   }
@@ -80,8 +80,8 @@
   inline BspRenderer()
   {
    // _eh_vector_constructor_iterator_(field_FA8, 2252, 150,
-   //    (void (__thiscall *)(void *))stru170_stru0::stru170_stru0,
-   //    (void (__thiscall *)(void *))stru170_stru0::dtor);
+   //    (void ( *)(void *))stru170_stru0::stru170_stru0,
+   //    (void ( *)(void *))stru170_stru0::dtor);
     num_faces = 0;
     num_nodes = 0;
     uNumVisibleNotEmptySectors = 0;
@@ -355,7 +355,7 @@
   void GetFacePlane(struct ODMFace *pFace, struct BSPVertexBuffer *pVertices, struct Vec3_float_ *pOutNormal, float *pOutDist);
 
 
-  void (__thiscall ***vdestructor_ptr)(stru154 *, bool);
+  void ( ***vdestructor_ptr)(stru154 *, bool);
   Plane_float_ face_plane;
   PolygonType polygonType;
   char field_15;
--- a/Keyboard.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/Keyboard.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -191,8 +191,8 @@
           return 1;
         }
 LABEL_15:
-        v3 = 3;
-        goto LABEL_4;
+        pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
+        return 1;
       }
     }
     if ( !pKeyActionMap->uNumKeysPressed )
@@ -203,10 +203,9 @@
   pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2;
   ++pKeyActionMap->uNumKeysPressed;
   pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = 0;
+
 LABEL_3:
-  v3 = 2;
-LABEL_4:
-  pKeyActionMap->SetWindowInputStatus(v3);
+  pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CONFIRMED);
   return 1;
 }
 // 506E68: using guessed type int uGameMenuUI_CurentlySelectedKeyIdx;
--- a/Keyboard.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/Keyboard.h	Mon Aug 26 10:39:24 2013 +0600
@@ -86,7 +86,7 @@
   bool IsShiftHeld();
   void EnterCriticalSection();
 
-  void (__thiscall ***vdestructor_ptr)(Keyboard *, bool);
+  void ( ***vdestructor_ptr)(Keyboard *, bool);
   unsigned int bUsingAsynKeyboard;
 };
 #pragma pack(pop)
--- a/LOD.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/LOD.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -1283,8 +1283,8 @@
     v1->pSpriteHeaders,
     40,
     1500,
-    (void (__thiscall *)(void *))LODSprite::LODSprite,
-    (void (__thiscall *)(void *))LODSprite::dtor);*/
+    (void ( *)(void *))LODSprite::LODSprite,
+    (void ( *)(void *))LODSprite::dtor);*/
   field_ECA4 = 0;
   field_ECA0 = 0;
   pHardwareSprites = 0;
@@ -2947,7 +2947,7 @@
 }
 
 //----- (0046080D) --------------------------------------------------------
-void __cdecl sub_46080D()
+void  sub_46080D()
 {
   pAllocator->FreeChunk(ptr_6A0D08);
   ptr_6A0D08 = 0;
--- a/LightmapBuilder.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/LightmapBuilder.h	Mon Aug 26 10:39:24 2013 +0600
@@ -12,7 +12,7 @@
   Lightmap();
   virtual ~Lightmap() {}
 
-  //void (__thiscall ***vdestructor_ptr)(Lightmap *, bool);
+  //void ( ***vdestructor_ptr)(Lightmap *, bool);
   unsigned int uNumVertices;
   RenderVertexSoft pVertices[64];
   __int16 field_C08;
@@ -60,7 +60,7 @@
   bool ApplyLights(struct stru320 *a2, struct stru154 *a3, unsigned int uNumVertices, struct RenderVertexSoft *a5, struct IndoorCameraD3D_Vec4 *, char uClipFlag);
 
 
-  //void (__thiscall ***vdestructor_ptr)(LightmapBuilder *, bool);
+  //void ( ***vdestructor_ptr)(LightmapBuilder *, bool);
   //std::vector<Lightmap> std__vector_000004;
   //std::vector<Lightmap> std__vector_183808;
   Lightmap std__vector_000004[512];
--- a/Lights.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/Lights.h	Mon Aug 26 10:39:24 2013 +0600
@@ -98,7 +98,7 @@
 
 
 
-  //void (__thiscall ***vdestructor_ptr)(LightsStack_StationaryLight_ *, bool);
+  //void ( ***vdestructor_ptr)(LightsStack_StationaryLight_ *, bool);
   StationaryLight pLights[400];
   unsigned int uNumLightsActive;
 };
@@ -127,7 +127,7 @@
 
 
 
-  //void (__thiscall ***vdestructor_ptr)(LightsStack_MobileLight_ *, bool);
+  //void ( ***vdestructor_ptr)(LightsStack_MobileLight_ *, bool);
   MobileLight  pLights[400];
   unsigned int uNumLightsActive;
 };
--- a/MM7.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/MM7.h	Mon Aug 26 10:39:24 2013 +0600
@@ -22,7 +22,7 @@
   char ddraw_error(HRESULT hr, char *Str, size_t a3);
   char dinput_error(int a1, const char *Str, int a3);
 
-  void (__thiscall ***vdestructor_ptr)(CheckHRESULT_stru0 *, bool);
+  void ( ***vdestructor_ptr)(CheckHRESULT_stru0 *, bool);
 };
 #pragma pack(pop)*/
 
--- a/Monsters.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/Monsters.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -800,9 +800,9 @@
                     {
                     switch(tolower(test_string[0]))
                         {
-                    case 's': pInfos[curr_rec_num].uMovementType=0;// short
+                    case 's': pInfos[curr_rec_num].uMovementType=MONSTER_MOVEMENT_TYPE_SHORT;// short
                         if (tolower(test_string[1])!='h')
-                            pInfos[curr_rec_num].uMovementType=5; //stationary?
+                            pInfos[curr_rec_num].uMovementType=MONSTER_MOVEMENT_TYPE_STAIONARY; //stationary
                         break;  //short
                     case 'l': pInfos[curr_rec_num].uMovementType=2;  break; //long
                     case 'm': pInfos[curr_rec_num].uMovementType=1; break; //med
--- a/Monsters.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/Monsters.h	Mon Aug 26 10:39:24 2013 +0600
@@ -58,6 +58,17 @@
   MONSTER_SPECIAL_ABILITY_EXPLODE = 0x3,
 };
 
+enum MONSTER_MOVEMENT_TYPE
+    {
+    MONSTER_MOVEMENT_TYPE_SHORT   = 0x0,
+    MONSTER_MOVEMENT_TYPE_MEDIUM  = 0x1,
+    MONSTER_MOVEMENT_TYPE_LONG    = 0x2,
+    MONSTER_MOVEMENT_TYPE_GLOBAL  = 0x3,
+    MONSTER_MOVEMENT_TYPE_FREE    = 0x4,
+    MONSTER_MOVEMENT_TYPE_STAIONARY = 0x5,
+    };
+
+
 /*  336 */
 enum MONSTER_SUPERTYPE
 {
--- a/Mouse.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/Mouse.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -614,30 +614,6 @@
 }
 
 
-
-//----- (00417871) --------------------------------------------------------
-void __thiscall sub_417871(int *pXY)
-{
-  POINT v1; // [sp+0h] [bp-18h]@5
-  POINT a2; // [sp+8h] [bp-10h]@5
-  unsigned int pY; // [sp+10h] [bp-8h]@3
-  unsigned int pX; // [sp+14h] [bp-4h]@3
-
-  if ( !pRenderer->pRenderD3D )
-  {
-    if ( pXY )
-    {
-      pX = *pXY;
-      pY = pXY[1];
-    }
-    else
-    {
-      pMouse->GetClickPos(&pX, &pY);
-    }
-    pMouse->GetCursorPos(&a2);
-    pMouse->GetCursorPos(&v1);
-  }
-}
 //----- (0041CD4F) --------------------------------------------------------
 bool UI_OnKeyDown(unsigned int vkKey)
 {
--- a/Mouse.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/Mouse.h	Mon Aug 26 10:39:24 2013 +0600
@@ -32,7 +32,7 @@
   DeleteCriticalSection(&v1->csAsyncMouse);
   }
 
-  void (__thiscall ***vdestructor_ptr)(ThreadWard *, bool);
+  void ( ***vdestructor_ptr)(ThreadWard *, bool);
   _RTL_CRITICAL_SECTION csAsyncMouse;
   _RTL_CRITICAL_SECTION cs2;
   _RTL_CRITICAL_SECTION cs3;
--- a/NPC.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/NPC.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -903,7 +903,7 @@
 
 //----- (00476395) --------------------------------------------------------
 //0x26 Wizard eye at skill level 2
-bool __thiscall CheckHiredNPCSpeciality(unsigned int uProfession)
+bool  CheckHiredNPCSpeciality(unsigned int uProfession)
     {
 
     if ( bNoNPCHiring == 1 )
@@ -1142,7 +1142,7 @@
 	}
 
 //----- (00476750) --------------------------------------------------------
-void __cdecl InitializeAutonotes()
+void  InitializeAutonotes()
 	{
 	int i;
 	char* test_string;
@@ -1227,7 +1227,7 @@
 
 
 //----- (004768A9) --------------------------------------------------------
-void __cdecl InitializeQuests()
+void  InitializeQuests()
 	{
 	int i;
 	char* test_string;
@@ -1340,7 +1340,7 @@
   /*switch ( pEventNumber )
   {
     case 139:
-      sub_4B1ECE();
+      OracleDialogue();
       goto _return;
     case 311:
       sub_4BBA85_bounties();
@@ -1352,7 +1352,7 @@
       {
         if ( pEventNumber == 139 )
         {
-          sub_4B1ECE();
+          OracleDialogue();
         }
         else
         { 
@@ -1563,7 +1563,7 @@
   gold_transaction_amount = price_for_membership[pEventCode];
   if ( pPlayers[uActiveCharacter]->CanAct() )
   {
-    if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) )
+    if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, dword_F8B1AC_award_bit_number) )
     {
       return pNPCTopics[dialogue_base+13].pText;
     }
--- a/OSInfo.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/OSInfo.h	Mon Aug 26 10:39:24 2013 +0600
@@ -21,7 +21,7 @@
   }
 
 
-  //void (__thiscall ***vdestructor_ptr)(OSVersion *, bool);
+  //void ( ***vdestructor_ptr)(OSVersion *, bool);
   OSVERSIONINFOA pVersionInfo;
   int bInitialized;
 };
--- a/Outdoor.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/Outdoor.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -3546,7 +3546,7 @@
     pActors[ai_near_actors_ids[i]].uAttributes |= 0x0400;
 }
 //----- (0046BE0A) --------------------------------------------------------
-void __cdecl ODM_UpdateUserInputAndOther()
+void  ODM_UpdateUserInputAndOther()
 {
   bool v0; // eax@5
   char pOut[32]; // [sp+8h] [bp-20h]@5
@@ -3581,7 +3581,7 @@
   check_event_triggers();
 }
 //----- (0041F54A) --------------------------------------------------------
-void __cdecl LoadActualSkyFrame()
+void  LoadActualSkyFrame()
 {
   if ( pTexture_RestUI_CurrentSkyFrame )
     pTexture_RestUI_CurrentSkyFrame->Release();
--- a/Party.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/Party.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -1181,7 +1181,7 @@
   _494035_timed_effects__water_walking_damage__etc();
 }
 //----- (004B1BDB) --------------------------------------------------------
-void __stdcall RestAndHeal(__int64 uNumMinutes)
+void RestAndHeal(__int64 uNumMinutes)
 {
   signed __int64 v1; // ST2C_8@1
   signed __int64 v2; // qax@1
@@ -1218,7 +1218,7 @@
   pParty->UpdatePlayersAndHirelingsEmotions();
 }
 //----- (0041F5BE) --------------------------------------------------------
-void __cdecl Sleep6Hours()
+void  Sleep6Hours()
 {
   if ( _506F18_num_minutes_to_sleep < 6 )
   {
@@ -1264,7 +1264,7 @@
 }
 
 //----- (0047752B) --------------------------------------------------------
-int __cdecl GetPartyReputation()
+int  GetPartyReputation()
 {
   DDM_DLV_Header *v0; // ebx@1
   signed int v1; // esi@3
@@ -1427,7 +1427,7 @@
   pAudioPlayer->PlaySound(SOUND_GoldReceived, v2, v2, -1, v2, v2, v2, v2);
 }
 //----- (00421B2C) --------------------------------------------------------
-bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem()
+bool  sub_421B2C_PlaceInInventory_or_DropPickedItem()
 {
   unsigned int v0; // eax@2
   Texture *v1; // ebx@2
--- a/Player.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/Player.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -162,7 +162,7 @@
 
 
 //----- (00490913) --------------------------------------------------------
-signed int __cdecl PlayerCreation_GetUnspentAttributePointCount()
+int PlayerCreation_GetUnspentAttributePointCount()
 {
   signed int v0; // edi@1
   int raceId; // ebx@2
@@ -641,13 +641,13 @@
     switch ( uClass )
     {
       case 0x1Au:
-        return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 65));
+        return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 65));
       case 0x1Bu:
-        return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 67));
+        return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 67));
       case 0x22u:
-        return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 77));
+        return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 77));
       case 0x23u:
-        return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 79));
+        return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79));
         break;
       default:
         assert("Should not be able to get here" && false);
@@ -5406,7 +5406,7 @@
   uExperience = 251 + rand() % 100;
   uBirthYear = 1147 - rand() % 6;
   memset(pActiveSkills, 0, sizeof(pActiveSkills));
-  memset(_guilds_member_bits, 0, 64);
+  memset(_achieved_awards_bits, 0, 64);
   memset(&spellbook, 0, sizeof(PlayerSpells));
 
   for (uint i = 0; i < 37; ++i)
@@ -5635,7 +5635,7 @@
 }
 
 //----- (004905F5) --------------------------------------------------------
-//signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute)
+//signed int  PartyCreation_BtnPlusClick(Player *this, int eAttribute)
 void Player::IncreaseAttribute( int eAttribute )
 {
   int raceId; // eax@1
@@ -6287,9 +6287,9 @@
         return;
         }
     else
-        {
-        if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp
-            {
+    {
+      if (pParty->pPickedItem.uItemID == 616) //Genie Lamp
+      {
             thisa = pParty->uCurrentMonthWeek + 1;
             if ( pParty->uCurrentMonth >= 7 )
                 v74 = NULL;
@@ -6376,7 +6376,7 @@
                 }
             ShowStatusBarString(pTmpBuf.data(), 2u);
             pMouse->RemoveHoldingItem();
-            pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1);
+            pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
             v3->PlaySound(SPEECH_93, 0);
             pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
             if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 )
@@ -6397,36 +6397,35 @@
             return;
             }
         else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple
-            {
+        {
             Party::GiveFood(1u);
-            pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0);
-
-            }
+            pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0);
+        }
         else if ( pParty->pPickedItem.uItemID == 632 ) //Lute
                 {
-                pAudioPlayer->PlaySound((SoundID)133,  0, 0, -1, 0, 0, 0, 0);
+                pAudioPlayer->PlaySound(SOUND_PlayLute,  0, 0, -1, 0, 0, 0, 0);
                 return;
                 }
         else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes
                 {
-                pAudioPlayer->PlaySound((SoundID)134,  0, 0, -1, 0, 0, 0, 0);
+                pAudioPlayer->PlaySound(SOUND_PlayFaeriePipes,  0, 0, -1, 0, 0, 0, 0);
                 return;
                 }
         else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet
                 {
-                pAudioPlayer->PlaySound((SoundID)135,  0, 0, -1, 0, 0, 0, 0);
+                pAudioPlayer->PlaySound(SOUND_PlayGryphonheartsTrumpet,  0, 0, -1, 0, 0, 0, 0);
                 return;
                 }
         else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe
-                {
-                pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1);
-                v5 = PID(OBJECT_Player,player_num + 49);
+        {
+                pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
+                v5 = PID(OBJECT_Player, player_num + 49);
                 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0);
                 v3->AddVariable(VAR_NumSkillPoints, 2);
                 }
         else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle
                     {
-                    sub_44C28F_open_nwc_dungeon();
+                    TeleportToNWCDungeon();
                     return;
                     }
         else
@@ -6715,7 +6714,7 @@
           goto _j_cmp_against_arg;
         case VAR_Award:
           test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8;
-          our_bit_value = this->_guilds_member_bits[((signed __int16)pValue - 1) /8];
+          our_bit_value = this->_achieved_awards_bits[((signed __int16)pValue - 1) /8];
           if ( !((unsigned __int8)test_bit_value & our_bit_value) )
             return true;
           return false;
@@ -7177,7 +7176,7 @@
         return;
       case VAR_Award:
         if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & 
-			  pPlayers[currPlayerId + 1]->_guilds_member_bits[((signed __int16)var_value - 1)/ 8])
+			  pPlayers[currPlayerId + 1]->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8])
               //&& dword_723E80_award_related[2 * a3] )
 		    && pAwards[var_value].pText )
         {
@@ -7185,7 +7184,7 @@
           DrawPlayerBuffAnimBasedOnCondition(currPlayerId);
           PlaySoundBasedOnCondition(currPlayerId);
         }
-        _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, var_value, 1u);
+        _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, var_value, 1u);
         return;
       case VAR_Experience:
         this->uExperience = var_value;
@@ -7599,7 +7598,7 @@
               return;
             case VAR_Award:
               v13 = pPlayers[uPlayerIdx + 1];
-              if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) 
+              if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_achieved_awards_bits, val) 
              
 				&& pAwards[val].pText )
               {
@@ -7608,7 +7607,7 @@
                 v3 = 1;
                 v14->PlaySound(SPEECH_96, 0);
               }
-              v15 = (char *)v4->_guilds_member_bits;
+              v15 = (char *)v4->_achieved_awards_bits;
               goto LABEL_44;
             case VAR_Experience:
               v16 = __CFADD__(val, LODWORD(Dst->uExperience));
@@ -8234,7 +8233,7 @@
           this->sAgeModifier -= (signed __int16)pValue;
           return result;
         case VAR_Award:
-          _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0);
+          _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, (signed __int16)pValue, 0);
           return result;
         case VAR_Experience:
           v12 = (char *)&this->uExperience;
@@ -8683,14 +8682,14 @@
 
 
 //----- (0049387A) --------------------------------------------------------
-int CycleCharacter(unsigned int _this)
+int CycleCharacter(bool backwards)
 {
   signed int result; // eax@1
   signed int v2; // ecx@2
   signed int v3; // ecx@8
 
   result = uActiveCharacter;
-  if ( _this )
+  if ( backwards )
   {
     v2 = 0;
     while ( 1 )
@@ -8784,7 +8783,7 @@
   return false;
 }
 //----- (0043EDB9) --------------------------------------------------------
-bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1)
+bool  sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1)
 {
   unsigned int pNum; // ebp@1
   Player **pPlayer; // ebx@1
@@ -9371,7 +9370,7 @@
   }
 }
 //----- (00421EA6) --------------------------------------------------------
-void __cdecl OnInventoryLeftClick()
+void  OnInventoryLeftClick()
 {
   Player *v0; // ebx@1
   signed int v1; // eax@2
--- a/Player.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/Player.h	Mon Aug 26 10:39:24 2013 +0600
@@ -697,7 +697,7 @@
     };
     unsigned __int16 pActiveSkills[37];
   };
-  unsigned char _guilds_member_bits[64];
+  unsigned char _achieved_awards_bits[64];
   PlayerSpells spellbook;
   char field__1F5[2]; // used to be [31]
   int pure_luck_used;      
--- a/Render.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/Render.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -91,7 +91,7 @@
 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut); // idb
 
 //----- (0049E79F) --------------------------------------------------------
-bool __cdecl CheckTextureStages()
+bool  CheckTextureStages()
 {
   bool v0; // edi@1
   IDirectDrawSurface4 *pSurface2; // [sp+Ch] [bp-14h]@1
@@ -182,7 +182,7 @@
 }
 
 //----- (004A16A5) --------------------------------------------------------
-bool __cdecl AreRenderSurfacesOk()
+bool  AreRenderSurfacesOk()
 {
   char v0; // zf@4
   bool result; // eax@8
@@ -8378,7 +8378,7 @@
 
   if ( !pRenderer->bWindowMode && (dword_6BE364_game_settings_1 & 2) )
   {
-    ModalWindow(pGlobalTXT_LocalizationStrings[62], 0);// "Might and Magic VII requires your desktop to be in 16bit (32k or 65k) Color mode in order to operate in a window."
+    ModalWindow(pGlobalTXT_LocalizationStrings[62], UIMSG_0);// "Might and Magic VII requires your desktop to be in 16bit (32k or 65k) Color mode in order to operate in a window."
     return;
   }
   if ( pRenderer->bWindowMode || !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible )
@@ -8821,15 +8821,7 @@
   }
 }
 //----- (0040DF3D) --------------------------------------------------------
-void __cdecl CallRenderPresent()
+void CallRenderPresent()
 {
   pRenderer->Present();
 }
-
-
-
-//----- (0044EC20) --------------------------------------------------------
-/*bool RenderD3D::DoesRaiseExceptions()
-{
-  return true;
-}*/
\ No newline at end of file
--- a/Render.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/Render.h	Mon Aug 26 10:39:24 2013 +0600
@@ -445,7 +445,7 @@
   IDirect3DTexture2 *pTexture;
   int field_1036B8;
   int _gpu_memory_used;
-  void (__cdecl *pBeforePresentFunction)();
+  void ( *pBeforePresentFunction)();
   int field_1036C4;
   uint bFogEnabled;
   int field_1036CC;
--- a/SaveLoad.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/SaveLoad.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -836,7 +836,7 @@
   return pPixels;
 }
 //----- (0045E26C) --------------------------------------------------------
-void __thiscall SaveScreenshot(const char *pFilename)
+void  SaveScreenshot(const char *pFilename)
 {
   unsigned __int16 *v2; // esi@1
 
--- a/TurnEngine.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/TurnEngine.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -357,7 +357,7 @@
         }
     else if ( turn_stage == 2 )
         {
-        if ( field_18 == TE_FLAG_1)
+        if ( !(field_18 &TE_FLAG_1))
             {
             if ( turn_initiative == 100 )
                 {
@@ -375,7 +375,7 @@
         }
     else if ( turn_stage == 3 )
         {
-        if ( (uActionPointsLeft > 0) && (field_18 == TE_FLAG_8) )
+        if ( (uActionPointsLeft > 0) && (!(field_18 & TE_FLAG_8)) )
            ActorAIChooseNewTargets();
         else
             { 
@@ -625,18 +625,16 @@
     else
         uActiveCharacter = 0;
     viewparams->bRedrawGameUI = 1;
-    if (pQueue[0].actor_initiative > 0)
+
+    while ( (pQueue[0].actor_initiative > 0)&&(turn_initiative > 0) )
         {
-        while(turn_initiative > 0)
+        for (i=0; i<uActorQueueSize; ++i)
             {
-            for (i=0; i<uActorQueueSize; ++i)
-                {
-                --pQueue[i].actor_initiative;
-                if (pQueue[i].actor_initiative==0)
-                    pQueue[i].uActionLength=0;
-                }
-            --turn_initiative;
+            --pQueue[i].actor_initiative;
+            if (pQueue[i].actor_initiative==0)
+                pQueue[i].uActionLength=0;
             }
+        --turn_initiative;
         }
     }
 
@@ -1072,7 +1070,7 @@
             }
         else
             {
-             Actor::AI_4032B2(uActorID, a2a, 1024, 0);
+             Actor::AI_RandomMove(uActorID, a2a, 1024, 0);
              v29->AI_action_type = TE_AI_PURSUE;
             }         
     
@@ -1086,11 +1084,11 @@
         {
         if ( actor->pMonsterInfo.uAIType == 1 )
             {
-            if ( actor->pMonsterInfo.uMovementType == 5 )
+            if ( actor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
                 Actor::AI_Stand(uActorID, a2a, 32, 0);
             else
                 Actor::AI_Flee(uActorID, a2a, 32, 0);
-            v29->AI_action_type = 4;
+            v29->AI_action_type = TE_AI_FLEE;
             v29->uActionLength = actor->uCurrentActionLength;
             return 1;
             }
@@ -1099,11 +1097,11 @@
            
             if (((double)actor->pMonsterInfo.uHP * 0.2) > (double)actor->sCurrentHP && (v11 < 10240 ) )
                 {
-                if ( actor->pMonsterInfo.uMovementType == 5 )
+                if ( actor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
                     Actor::AI_Stand(uActorID, a2a, 32, 0);
                 else
                      Actor::AI_Flee(uActorID, a2a, 32, 0);
-                v29->AI_action_type = 4;
+                v29->AI_action_type = TE_AI_FLEE;
                 v29->uActionLength = actor->uCurrentActionLength;
                 return 1;
                 }
@@ -1113,11 +1111,11 @@
 
             if ( ((double)actor->pMonsterInfo.uHP * 0.1) > (double)actor->sCurrentHP && (v11 < 10240 ))
                 {
-                if ( actor->pMonsterInfo.uMovementType == 5 )
+                if ( actor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
                     Actor::AI_Stand(uActorID, a2a, 32, 0);
                 else
                      Actor::AI_Flee(uActorID, a2a, 32, 0);
-                v29->AI_action_type = 4;
+                v29->AI_action_type = TE_AI_FLEE;
                 v29->uActionLength = actor->uCurrentActionLength;
                 return 1;
                 }
@@ -1140,19 +1138,19 @@
         }
     switch(actor->pMonsterInfo.uMovementType)
         {
-        case 0: 
-            Actor::AI_4032B2(uActorID, a2a, 1024, 32);
+        case MONSTER_MOVEMENT_TYPE_SHORT: 
+            Actor::AI_RandomMove(uActorID, a2a, 1024, 32);
             break;
-        case 1:
-             Actor::AI_4032B2(uActorID, a2a, 2560, 32);
+        case MONSTER_MOVEMENT_TYPE_MEDIUM:
+             Actor::AI_RandomMove(uActorID, a2a, 2560, 32);
              break;
-         case 2:
-             Actor::AI_4032B2(uActorID, a2a, 5120, 32);
+         case MONSTER_MOVEMENT_TYPE_LONG:
+             Actor::AI_RandomMove(uActorID, a2a, 5120, 32);
              break;
-         case 4:
-             Actor::AI_4032B2(uActorID, a2a, 10240, 32);
+         case MONSTER_MOVEMENT_TYPE_FREE:
+             Actor::AI_RandomMove(uActorID, a2a, 10240, 32);
              break;
-         case 5:
+         case MONSTER_MOVEMENT_TYPE_STAIONARY:
              Actor::AI_Stand(uActorID, a2a, 32, 0);
               break;
          default:
--- a/TurnEngine.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/TurnEngine.h	Mon Aug 26 10:39:24 2013 +0600
@@ -82,7 +82,7 @@
   int uActionPointsLeft; //14
   int field_18;
   int pending_actions;
-  TurnBased_QueueElem pQueue[504]; //20
+  TurnBased_QueueElem pQueue[530]; //20
 };
 #pragma pack(pop)
 
--- a/UI/Books/UIMapBook.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/UI/Books/UIMapBook.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -78,7 +78,7 @@
 }
 
 //----- (00410DEC) --------------------------------------------------------
-unsigned int __cdecl DrawLloydBeaconsScreen()
+unsigned int  DrawLloydBeaconsScreen()
 {
   Player *pPlayer; // esi@1
   char *pText; // eax@1
--- a/UI/Books/UISpellBook.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/UI/Books/UISpellBook.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -97,7 +97,7 @@
   {
     for ( uint i = 1; i <= 11; ++i )
     {
-      if (player->_guilds_member_bits[(11 * player->lastOpenedSpellbookPage) + i + 63] )
+      if (player->_achieved_awards_bits[(11 * player->lastOpenedSpellbookPage) + i + 63] )
       {
         if ( SBPageSSpellsTextureList[i] != PendingTexture )
         {
--- a/UI/UICharacter.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/UI/UICharacter.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -43,6 +43,10 @@
 unsigned int ui_character_skillinfo_can_learn;
 unsigned int ui_character_skillinfo_can_learn_gm;
 unsigned int ui_character_skillinfo_cant_learn;
+unsigned int ui_character_condition_normal_color;
+unsigned int ui_character_condition_light_color;
+unsigned int ui_character_condition_moderate_color;
+unsigned int ui_character_condition_severe_color;
 std::array<unsigned int, 6> ui_character_award_color;
 
 unsigned int ui_game_minimap_outline_color;
@@ -107,6 +111,11 @@
   ui_character_skillinfo_can_learn = TargetColor(255, 255, 255);
   ui_character_skillinfo_can_learn_gm = TargetColor(255, 255, 0);
   ui_character_skillinfo_cant_learn = TargetColor(255, 0, 0);
+  
+  ui_character_condition_normal_color = TargetColor(255, 255, 255);
+  ui_character_condition_light_color = TargetColor(0, 255, 0);
+  ui_character_condition_moderate_color = TargetColor(225, 205, 35);
+  ui_character_condition_severe_color = TargetColor(255, 35, 0);
 
   ui_character_award_color[0] = TargetColor(248, 108, 160);
   ui_character_award_color[1] = TargetColor(112, 220, 248);
@@ -563,7 +572,7 @@
 //----- (0041A000) --------------------------------------------------------
 void CharacterUI_AwardsTab_Draw(Player *player)
 {
-  unsigned int result; // eax@1
+  int items_per_page; // eax@1
   char *v6; // ebx@15
   char Source[100]; // [sp+Ch] [bp-C4h]@1
   GUIWindow awards_window; // [sp+70h] [bp-60h]@1
@@ -575,7 +584,7 @@
   strcat(pTmpBuf.data(), "\f00000");
 
   pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0);
-  result = books_primary_item_per_page;
+  items_per_page = books_primary_item_per_page;
   awards_window.uFrameX = 12;
   awards_window.uFrameY = 48;
   awards_window.uFrameWidth = 424;
@@ -583,31 +592,31 @@
   awards_window.uFrameZ = 435;
   awards_window.uFrameW = 337;
   if (BtnDown_flag && num_achieved_awards + books_primary_item_per_page < full_num_items_in_book)
-    result = books_primary_item_per_page++ + 1;
-  if (BtnUp_flag && result)
+    items_per_page = books_primary_item_per_page++ + 1;
+  if (BtnUp_flag && items_per_page)
   {
-    --result;
-    books_primary_item_per_page = result;
+    --items_per_page;
+    books_primary_item_per_page = items_per_page;
   }
 
   if ( books_page_number < 0 )
   {
-    result += num_achieved_awards;
-    books_primary_item_per_page = result;
-    if ( (signed int)(num_achieved_awards + result) > full_num_items_in_book )
+    items_per_page += num_achieved_awards;
+    books_primary_item_per_page = items_per_page;
+    if ( (signed int)(num_achieved_awards + items_per_page) > full_num_items_in_book )
     {
-      result = full_num_items_in_book - num_achieved_awards;
-      books_primary_item_per_page = result;
+      items_per_page = full_num_items_in_book - num_achieved_awards;
+      books_primary_item_per_page = items_per_page;
     }
   }
   else if ( books_page_number > 0 )
   {
-    result -= num_achieved_awards;
-    books_primary_item_per_page = result;
-    if ( (result & 0x80000000u) != 0 )
+    items_per_page -= num_achieved_awards;
+    books_primary_item_per_page = items_per_page;
+    if ( items_per_page < 0 )
     {
-      result = 0;
-      books_primary_item_per_page = result;
+      items_per_page = 0;
+      books_primary_item_per_page = items_per_page;
     }
   }
   BtnDown_flag = 0;
@@ -615,7 +624,7 @@
   num_achieved_awards = 0;
   books_page_number = 0;
 
-  for ( int i = result; i < full_num_items_in_book; ++i)
+  for ( int i = items_per_page; i < full_num_items_in_book; ++i)
   {
     v6 = (char *)pAwards[achieved_awards[i]].pText;//(char *)dword_723E80_award_related[v20 / 4];
     pTmpBuf[0] = 0;
@@ -667,7 +676,7 @@
   {
     case WINDOW_CharacterWindow_Stats:                                // stats
       CharacterUI_ReleaseButtons();
-      sub_419379();
+      ReleaseAwardsScrollBar();
       CharacterUI_StatsTab_Draw(player);
       pRenderer->DrawTextureIndexed(pCharacterScreen_StatsBtn->uX,
                                     pCharacterScreen_StatsBtn->uY,
@@ -680,7 +689,7 @@
         CharacterUI_ReleaseButtons();
         CharacterUI_SkillsTab_CreateButtons();
       }
-      sub_419379();
+      ReleaseAwardsScrollBar();
       CharacterUI_SkillsTab_Draw(player);
       pRenderer->DrawTextureIndexed(pCharacterScreen_SkillsBtn->uX,
                                     pCharacterScreen_SkillsBtn->uY,
@@ -689,7 +698,7 @@
 
     case WINDOW_CharacterWindow_Awards:                                // awards
       CharacterUI_ReleaseButtons();
-      sub_419379();
+      ReleaseAwardsScrollBar();
       CreateAwardsScrollBar();
       CharacterUI_AwardsTab_Draw(player);
       pRenderer->DrawTextureIndexed(pCharacterScreen_AwardsBtn->uX,
@@ -699,7 +708,7 @@
 
     case WINDOW_CharacterWindow_Inventory:                             // inventory and other
       CharacterUI_ReleaseButtons();
-      sub_419379();
+      ReleaseAwardsScrollBar();
       CharacterUI_InventoryTab_Draw(player, false);
       pRenderer->DrawTextureIndexed(pCharacterScreen_InventoryBtn->uX,
                                     pCharacterScreen_InventoryBtn->uY,
@@ -2345,31 +2354,52 @@
 //----- (00419100) --------------------------------------------------------
 void FillAwardsData()
 {
-        auto pPlayer = pPlayers[uActiveCharacter];
+    Player* pPlayer = pPlayers[uActiveCharacter];
 
-        memset(achieved_awards.data(), 0, 4000);
-        num_achieved_awards = 0;
+    memset(achieved_awards.data(), 0, 4000);
+    num_achieved_awards = 0;
 
-        memset(pTmpBuf2.data(), 0, 0x7D0u);
-        BtnDown_flag = 0;
-        BtnUp_flag = 0;
-        books_page_number = 0;
-        books_primary_item_per_page = 0;
-        for (int i = 0; i < 105; ++i)
+    memset(pTmpBuf2.data(), 0, 0x7D0u);
+    BtnDown_flag = 0;
+    BtnUp_flag = 0;
+    books_page_number = 0;
+    books_primary_item_per_page = 0;
+    for (int i = 1; i < 105; ++i)
+    {
+        if ( _449B57_test_bit(pPlayer->_achieved_awards_bits, i) && pAwards[i].pText )
         {
-            if ( _449B57_test_bit(pPlayer->_guilds_member_bits, i) && pAwards[i].pText )
-            {
-                achieved_awards[num_achieved_awards++] = (AwardType)i;
-            }
+            achieved_awards[num_achieved_awards++] = (AwardType)i;
         }
-        full_num_items_in_book = num_achieved_awards;
-        num_achieved_awards = 0;
+    }
+    full_num_items_in_book = num_achieved_awards;
+    num_achieved_awards = 0;
+
+    //sort awards index 
 
-        //sort awards index 
-        if (full_num_items_in_book > 0)
+    if (full_num_items_in_book>0)
         {
-            std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort);
+            for (int i = 0; i< full_num_items_in_book; ++i)
+                achieved_awards[full_num_items_in_book+i] = (AwardType)(rand()%16);
+            for (int i = 1; i< full_num_items_in_book; ++i)
+                {
+                for (int j = i; j< full_num_items_in_book; ++j)
+                    {
+                    AwardType tmp;
+                    if (pAwards[achieved_awards[j]].uPriority < pAwards[achieved_awards[i]].uPriority)
+                        {
+                        tmp= achieved_awards[j];
+                        achieved_awards[j] = achieved_awards[i];
+                        achieved_awards[i] = tmp;
+                        }
+                    }
+                }
         }
+
+
+    //  if (full_num_items_in_book > 0)
+    /* {
+        std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort);
+    }*/
     }
 
 
@@ -2435,7 +2465,7 @@
         }
     }
 //----- (00468F8A) --------------------------------------------------------
-void __cdecl OnPaperdollLeftClick()
+void  OnPaperdollLeftClick()
 {
   int v1; // ecx@1
   unsigned int v2; // edi@1
--- a/UI/UIGuilds.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/UI/UIGuilds.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -191,7 +191,7 @@
     }
     return;
   }
-  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits,
+  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits,
             guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
   { //you must me member
     v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
--- a/UI/UIHouses.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/UI/UIHouses.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -762,7 +762,7 @@
 
 
 //----- (004B1784) --------------------------------------------------------
-bool __cdecl HouseUI_CheckIfPlayerCanInteract()
+bool  HouseUI_CheckIfPlayerCanInteract()
 {
   Player *pPlayer; // ebx@1
   bool result; // eax@2
@@ -829,7 +829,7 @@
 		pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
 	viewparams->bRedrawGameUI = 1;
 	uDialogueType = 0;
-	pKeyActionMap->SetWindowInputStatus(3);
+	pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
 	pKeyActionMap->ResetKeys();
 	if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601)
 		{
@@ -937,7 +937,7 @@
 			v19 = guild_mambership_flags[uHouseID - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE]; //guilds flags 
 			//v20 = uHouseID;
 			//if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
-			if(_449B57_test_bit(pPlayers[uActiveCharacter]->_guilds_member_bits,v19))
+			if(_449B57_test_bit(pPlayers[uActiveCharacter]->_achieved_awards_bits,v19))
             {
 				PlayHouseSound(uHouseID, HouseSound_Greeting_2);
 				return 1;
@@ -2061,7 +2061,7 @@
 */
 }
 //----- (004B6943) --------------------------------------------------------
-void __cdecl TravelByTransport()
+void  TravelByTransport()
 {
   GUIWindow *v0; // ebx@1
   Player *v1; // esi@1
@@ -2391,7 +2391,7 @@
 
 
 //----- (004B7911) --------------------------------------------------------
-void __cdecl TownHallDialog()
+void  TownHallDialog()
 {
   GUIWindow *v0; // eax@4
   int v1; // eax@10
@@ -2569,7 +2569,7 @@
 }
 
 //----- (004B7D7E) --------------------------------------------------------
-void __cdecl BankDialog()
+void  BankDialog()
 {
   GUIWindow *v0; // eax@4
   //int v1; // ecx@5
@@ -2711,7 +2711,7 @@
 // F8B19C: using guessed type int dword_F8B19C;
 
 //----- (004B8285) --------------------------------------------------------
-void __cdecl TavernDialog()
+void  TavernDialog()
 {
   int v0;
   int pItemNum;
@@ -4017,7 +4017,7 @@
     pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
     return; // void func
   }
-  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
+  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_achieved_awards_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
   {
     v24 = pNPCTopics[171].pText;
     v25 = v31;
--- a/UI/UIHouses.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/UI/UIHouses.h	Mon Aug 26 10:39:24 2013 +0600
@@ -124,15 +124,15 @@
 void  GuildDialog();
 void  sub_4B6478();
 bool __fastcall IsTravelAvailable(int a1);
-void __cdecl TravelByTransport();
+void  TravelByTransport();
 void TempleDialog();
-void __cdecl TownHallDialog();
-void __cdecl BankDialog();
-void __cdecl TavernDialog();
+void  TownHallDialog();
+void  BankDialog();
+void  TavernDialog();
 void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound); // idb
-void __cdecl WeaponShopDialog();
-void __cdecl AlchemistDialog();
-void __cdecl ArmorShopDialog();
+void  WeaponShopDialog();
+void  AlchemistDialog();
+void  ArmorShopDialog();
 
 
 void InitializaDialogueOptions_Tavern(BuildingType type); // idb
--- a/UI/UIPartyCreation.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/UI/UIPartyCreation.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -25,7 +25,7 @@
 
 
 //----- (004908DE) --------------------------------------------------------
-signed int __cdecl PlayerCreation_Chose4Skills()
+int PlayerCreation_Choose4Skills()
     {
     Player *v0; // esi@1
     signed int v1; // edx@2
@@ -59,7 +59,7 @@
 
 
 //----- (00491CB5) --------------------------------------------------------
-void __cdecl LoadPlayerPortraintsAndVoices()
+void  LoadPlayerPortraintsAndVoices()
     {
     //Texture **v0; // ebx@1
     //int v1; // eax@2
@@ -475,7 +475,7 @@
 }
 
 //----- (0049695A) --------------------------------------------------------
-void __cdecl PlayerCreationUI_Initialize()
+void  PlayerCreationUI_Initialize()
 {
   unsigned int v0; // ebx@5
   unsigned int v1; // eax@6
--- a/UI/UIPopup.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/UI/UIPopup.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -551,7 +551,7 @@
                 {
                 if ( (inspect_item->uAttributes & 8) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
                     {
-                    sub_493F79(&v67, inspect_item->uExpireTime - pParty->uTimePlayed);
+                    init_summoned_item(&v67, inspect_item->uExpireTime - pParty->uTimePlayed);
                     strcpy(pTmpBuf.data(), "Duration:");
                     Str = (char *)(v67.field_18_expire_year - game_starting_year);
                     if (v67.field_18_expire_year != 1168 )
@@ -1596,7 +1596,7 @@
     }
 
 //----- (00418083) --------------------------------------------------------
-void __cdecl CharacterUI_StatsTab_ShowHint()
+void  CharacterUI_StatsTab_ShowHint()
 {
   int pStringNum; // edi@1
   signed int pTextColor; // eax@15
@@ -1687,7 +1687,7 @@
       v15 = pPlayers[uActiveCharacter]->uLevel;
       do
       {
-        if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)sub_4B46F8(v15) )
+        if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)GetExperienceRequiredForLevel(v15) )
           break;
         ++v15;
       }
@@ -1696,7 +1696,7 @@
       pTmpBuf2[0] = 0;
       if ( v15 > pPlayers[uActiveCharacter]->uLevel )
         sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[147], v15);
-      v16 = sub_4B46F8(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience);
+      v16 = GetExperienceRequiredForLevel(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience);
       sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], v16, v15 + 1);
       strcat(pTmpBuf.data(), "\n");
       strcat(pTmpBuf.data(), pTmpBuf2.data());
@@ -1763,7 +1763,7 @@
 }
 
     //----- (00410B28) --------------------------------------------------------
-    void __thiscall DrawSpellDescriptionPopup(int spell_index)
+    void  DrawSpellDescriptionPopup(int spell_index)
         {
         Player *v1; // edi@1
         SpellInfo *v2; // esi@1
--- a/UI/UIShops.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/UI/UIShops.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -14,7 +14,7 @@
 #include "..\Viewport.h"
 
 //----- (004B910F) --------------------------------------------------------
-void __cdecl WeaponShopDialog()
+void  WeaponShopDialog()
 {
   int v0; // ebx@1
   int pNumActiveItem; // eax@6
@@ -183,7 +183,7 @@
           v49 += 30;
           v51 = 60 - ((signed int)v50->uTextureWidth >> 1);
           pRenderer->DrawTextureTransparent(v51 + pItemNum, v49, v50);
-          sub_40F92A(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
+          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
           v48 = v109;
         }
         pItemNum += 70;
@@ -376,7 +376,7 @@
           v53 = ItemsInShopTexture[(signed int)v109];
           v54 = 60 - ((signed int)v53->uTextureWidth >> 1);
           pRenderer->DrawTextureTransparent(v54 + pItemNum, word_F8B158[(signed int)v109] + 30, v53);
-          sub_40F92A(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
+          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
         }
         v109 = (const char **)((char *)v109 + 1);
         pItemNum += 70;
@@ -538,7 +538,7 @@
 }
 
 //----- (004BA928) --------------------------------------------------------
-void __cdecl ArmorShopDialog()
+void  ArmorShopDialog()
 {
   signed int v1; // esi@8
   unsigned int v2; // eax@10
@@ -1106,7 +1106,7 @@
   }
 }
 //----- (004B9CC6) --------------------------------------------------------
-void __cdecl AlchemistDialog()
+void  AlchemistDialog()
 {
   int v0;
   int pNumActiveItem; // eax@7
@@ -1287,7 +1287,7 @@
           else if ( (signed int)v48 < 18 )
             v48 = 18;
           pRenderer->DrawTextureTransparent(v48, v47, v46);
-          sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1);
+          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1);
         }
         ++v114;
       }
@@ -1317,7 +1317,7 @@
               v52 = 18;
           }
           pRenderer->DrawTextureTransparent(v52, v51, v50);
-          sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7);
+          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7);
         }
         ++v114;
       }
@@ -1489,7 +1489,7 @@
               v56 = 18;
           }
           pRenderer->DrawTextureTransparent(v56, v55, v54);
-          sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1);
+          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1);
         }
         ++v114;
       }
@@ -1519,7 +1519,7 @@
               v60 = 18;
           }
           pRenderer->DrawTextureTransparent(v60, v59, v58);
-          sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7);
+          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7);
         }
         ++v114;
       }
@@ -1857,7 +1857,7 @@
             v52 = 18;
         }
         pRenderer->DrawTextureTransparent(v52, v51, v50);
-        sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1);
+        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1);
         v49 = v122;
       }
       ++v49;
@@ -1887,7 +1887,7 @@
             v56 = 18;
         }
         pRenderer->DrawTextureTransparent(v56, v55, v54);
-        sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7);
+        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7);
       }
       ++v122;
     }
@@ -1987,7 +1987,7 @@
             v60 = 18;
         }
         pRenderer->DrawTextureTransparent(v60, v59, ItemsInShopTexture[v49]);
-        sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1);
+        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1);
         v49 = v122;
       }
       ++v49;
@@ -2018,7 +2018,7 @@
             v64 = 18;
         }
         pRenderer->DrawTextureTransparent(v64, v63, ItemsInShopTexture[v122 + 6]);
-        sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7);
+        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7);
       }
       ++v122;
     }
@@ -2293,7 +2293,7 @@
   return;
 }
 //----- (004BDB56) --------------------------------------------------------
-void __cdecl UIShop_Buy_Identify_Repair()
+void  UIShop_Buy_Identify_Repair()
 {
   int v8; // eax@15
   unsigned int pItemID; // esi@20
@@ -2582,7 +2582,7 @@
   }
 }
 //----- (004B1A2D) --------------------------------------------------------
-void __cdecl ShowPopupShopItem()
+void  ShowPopupShopItem()
 {
   POINT *v1; // esi@5
   unsigned int v2; // eax@5
@@ -2646,7 +2646,7 @@
   }
 }
 //----- (004B1D27) --------------------------------------------------------
-void __cdecl GetHouseGoodbyeSpeech()
+void  GetHouseGoodbyeSpeech()
 {
   signed int v2; // edi@10
   signed int v5; // edi@20
--- a/UI/UiGame.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/UI/UiGame.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -809,7 +809,7 @@
   }
   if ( pKeyActionMap->pPressedKeysBuffer[0] )
   {
-    pKeyActionMap->SetWindowInputStatus(0);
+    pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
     goto LABEL_15;
   }
 }
@@ -1458,7 +1458,7 @@
 
 
 //----- (00420EFF) --------------------------------------------------------
-void __cdecl GameUI_WritePointedObjectStatusString()
+void  GameUI_WritePointedObjectStatusString()
 {
   int v1; // ebx@6
   GUIWindow *pWindow; // edi@7
@@ -2767,7 +2767,7 @@
 }
 
 //----- (00441498) --------------------------------------------------------
-void __cdecl GameUI_DrawTorchlightAndWizardEye()
+void  GameUI_DrawTorchlightAndWizardEye()
     {
     if (pCurrentScreen == SCREEN_GAME
         || pCurrentScreen == SCREEN_MENU
@@ -2930,46 +2930,36 @@
 }
 
 //----- (00417939) --------------------------------------------------------
-signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx)
+int GetConditionDrawColor(unsigned int uConditionIdx)
 {
-  unsigned int v1; // ebx@1
-  signed int v2; // edi@1
-  unsigned int v3; // esi@1
-  unsigned int v4; // eax@1
-  unsigned int v6; // [sp+Ch] [bp-4h]@1
-
-  v1 = uConditionIdx;
-  v2 = 65535;
-  v3 = TargetColor(0xE1u, 0xCDu, 0x23u);
-  v6 = TargetColor(0xFFu, 0x23u, 0);
-  v4 = TargetColor(0, 0xFFu, 0);
-  switch ( v1 )
+  switch (uConditionIdx)
   {
-    case 0u:
-    case 1u:
-    case 3u:
-    case 4u:
-    case 5u:
-    case 6u:
-    case 7u:
-      v2 = v4;
-      break;
-    case 2u:
-    case 8u:
-    case 9u:
-    case 0xCu:
-    case 0xDu:
-      v2 = v3;
-      break;
-    case 0xAu:
-    case 0xBu:
-    case 0xEu:
-    case 0xFu:
-    case 0x10u:
-      v2 = v6;
-      break;
-    default:
-      return v2;
+    case Condition_Zombie:
+    case Condition_Good:
+      return ui_character_condition_normal_color;
+
+    case Condition_Cursed:
+    case Condition_Weak:
+    case Condition_Fear:
+    case Condition_Drunk:
+    case Condition_Insane:
+    case Condition_Poison1:
+    case Condition_Disease1:
+      return ui_character_condition_light_color;
+
+    case Condition_Sleep:
+    case Condition_Poison2:
+    case Condition_Disease2:
+    case Condition_Paralyzed:
+    case Condition_Unconcious:
+      return ui_character_condition_moderate_color;
+
+    case Condition_Poison3:
+    case Condition_Disease3:
+    case Condition_Dead:
+    case Condition_Pertified:
+    case Condition_Eradicated:
+      return ui_character_condition_severe_color;
   }
-  return v2;
+  assert(false && "Invalid condition");
 }
--- a/VideoPlayer.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/VideoPlayer.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -65,6 +65,8 @@
 
 
 
+bool BinkLockBuffer(struct _BINKBUF *_this);
+void BinkUnlockBuffer(struct _BINKBUF *_this);
 
 //----- (004BFE2D) --------------------------------------------------------
 _BINKBUF *VideoPlayer::CreateBinkBuffer(HWND hWindow, unsigned int uWidth, unsigned int uHeight, char a4)
@@ -293,7 +295,7 @@
   }
 }
 //----- (004BF794) --------------------------------------------------------
-void __cdecl ShowIntroVideo_and_LoadingScreen()
+void  ShowIntroVideo_and_LoadingScreen()
 {
   RGBTexture tex; // [sp+Ch] [bp-30h]@1
   unsigned int uTrackStartMS; // [sp+34h] [bp-8h]@8
--- a/VideoPlayer.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/VideoPlayer.h	Mon Aug 26 10:39:24 2013 +0600
@@ -104,7 +104,7 @@
 
 
 
-void __cdecl ShowIntroVideo_and_LoadingScreen();
+void  ShowIntroVideo_and_LoadingScreen();
 
 
 
--- a/Vis.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/Vis.h	Mon Aug 26 10:39:24 2013 +0600
@@ -70,7 +70,7 @@
     object_pool[uNumPointers++].sZValue = packed_zval;
   }
 
-  void (__thiscall ***vdestructor_ptr)(Vis_SelectionList *, bool);
+  void ( ***vdestructor_ptr)(Vis_SelectionList *, bool);
   Vis_ObjectInfo  object_pool[512];
   Vis_ObjectInfo *object_pointers[512];
   unsigned int    uNumPointers;
@@ -122,7 +122,7 @@
   bool SortByScreenSpaceX(struct RenderVertexSoft *pArray, int sLeft, int sRight);
   bool SortByScreenSpaceY(struct RenderVertexSoft *pArray, int sLeft, int sRight);
 
-  //void (__thiscall ***vdestructor_ptr)(Vis *, bool);
+  //void ( ***vdestructor_ptr)(Vis *, bool);
   Vis_SelectionList default_list;
   RenderVertexSoft  stru_200C;
   RenderVertexSoft  stru_203C;
--- a/_deleted.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/_deleted.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -71,7 +71,7 @@
 
   void _4898E6();
 
-  void (__thiscall *vdestructor_ptr)(stru12 *);
+  void ( *vdestructor_ptr)(stru12 *);
   int field_4[16];
   int field_44;
   int field_48;
@@ -5875,7 +5875,7 @@
 }
 
 //----- (00486F92) --------------------------------------------------------
-void __cdecl sr_sub_486F92_MessWithEdgesAndSpans()
+void  sr_sub_486F92_MessWithEdgesAndSpans()
 {
   Span *v0; // ebx@1
   int v1; // eax@2
@@ -9382,7 +9382,7 @@
 }
 
 //----- (00423B4A) --------------------------------------------------------
-void __cdecl sub_423B4A()
+void  sub_423B4A()
 {
   float *v0; // eax@1
   signed int v1; // ecx@1
@@ -10576,7 +10576,7 @@
 }
 
 //----- (004AF412) --------------------------------------------------------
-int __cdecl sr_4AF412()
+int  sr_4AF412()
 {
   int v0; // ST20_4@2
   int v1; // ST20_4@2
@@ -11023,7 +11023,7 @@
   return result;
 }
 //----- (004AC1C9) --------------------------------------------------------
-int __thiscall _4AC1C9_get_cpu_speed(unsigned int _this, Vec4_int_ *a2)
+int  _4AC1C9_get_cpu_speed(unsigned int _this, Vec4_int_ *a2)
 {
   unsigned int v2; // esi@1
   __int16 v3; // di@1
@@ -11097,7 +11097,7 @@
 
 
 //----- (004382BC) --------------------------------------------------------
-__int16 __thiscall _4382BC_get_cpu_speed_sub0(int _this)
+__int16  _4382BC_get_cpu_speed_sub0(int _this)
 {
   __int16 result; // ax@4
   __int16 v14; // sp@11
@@ -11158,7 +11158,7 @@
 
 
 //----- (0043847A) --------------------------------------------------------
-__int16 __cdecl _43847A_get_cpu_speed_sub1()
+__int16  _43847A_get_cpu_speed_sub1()
 {
   signed int v5; // eax@1
   char v12[12]; // [sp+Ch] [bp-28h]@1
@@ -11208,7 +11208,7 @@
 
 
 //----- (004383ED) --------------------------------------------------------
-int __cdecl _4383ED_get_cpu_speed_sub2()
+int  _4383ED_get_cpu_speed_sub2()
 {
   signed int v9; // eax@4
   int v16; // [sp-4h] [bp-38h]@0
@@ -11265,7 +11265,7 @@
 
 
 //----- (004AC4FD) --------------------------------------------------------
-Vec4_int_ *__thiscall _4AC4FD_get_cpu_clocks_rdtsc(int _this, Vec4_int_ *a1)
+Vec4_int_ * _4AC4FD_get_cpu_clocks_rdtsc(int _this, Vec4_int_ *a1)
 {
   int v2; // eax@1
   int v3; // eax@4
@@ -11348,7 +11348,7 @@
 
 
 //----- (004AC33A) --------------------------------------------------------
-Vec4_int_ *__thiscall _4AC33A_get_cpu_clocks_QPC(int _this, Vec4_int_ *a1)
+Vec4_int_ * _4AC33A_get_cpu_clocks_QPC(int _this, Vec4_int_ *a1)
 {
   int v2; // esi@1
   int v3; // ebx@1
@@ -11459,7 +11459,7 @@
 
 
 //----- (004AC277) --------------------------------------------------------
-Vec4_int_ *__thiscall _4AC277_get_cpu_speed_sub3(unsigned int _this, Vec4_int_ *a2)
+Vec4_int_ * _4AC277_get_cpu_speed_sub3(unsigned int _this, Vec4_int_ *a2)
 {
   signed int v2; // esi@1
   signed __int16 v4; // bx@3
@@ -11516,7 +11516,7 @@
 }
 
 //----- (004D714C) --------------------------------------------------------
-int __cdecl sr_sub_4D714C(stru315 *a1)
+int  sr_sub_4D714C(stru315 *a1)
 {
   stru315 *v1; // ebp@0
   stru315 *v2; // ebp@1
@@ -11724,7 +11724,7 @@
 }
 
 //----- (004D71F8) --------------------------------------------------------
-int __cdecl sr_sub_4D71F8(stru315 *a1)
+int  sr_sub_4D71F8(stru315 *a1)
 {
   stru315 *v1; // ebp@0
   stru315 *v2; // ebp@1
@@ -11808,7 +11808,7 @@
 }
 
 //----- (004D754B) --------------------------------------------------------
-void __cdecl sr_sub_4D754B(stru315 *a1, stru316 *a2)
+void  sr_sub_4D754B(stru315 *a1, stru316 *a2)
 {
   int v2; // ecx@1
   unsigned int v3; // eax@2
@@ -12017,7 +12017,7 @@
 }
 
 //----- (004D7630) --------------------------------------------------------
-void __cdecl sr_sub_4D7630(stru315 *a1, stru316 *a2)
+void  sr_sub_4D7630(stru315 *a1, stru316 *a2)
 {
   int v2; // ecx@1
   int v3; // eax@2
@@ -12075,7 +12075,7 @@
 }
 
 //----- (004D76ED) --------------------------------------------------------
-void __cdecl sr_sub_4D76ED(stru315 *a1, stru316 *a2)
+void  sr_sub_4D76ED(stru315 *a1, stru316 *a2)
 {
   int v2; // ecx@1
   unsigned int v3; // eax@2
@@ -12143,7 +12143,7 @@
 }
 
 //----- (004D77D2) --------------------------------------------------------
-void __cdecl sr_sub_4D77D2(stru315 *a1, stru316 *a2)
+void  sr_sub_4D77D2(stru315 *a1, stru316 *a2)
 {
   int v2; // ecx@1
   unsigned __int16 *v3; // ebx@2
@@ -12207,7 +12207,7 @@
   }
 }
 //----- (004D789A) --------------------------------------------------------
-void __cdecl sr_sub_4D789A(stru315 *a1, stru316 *a2)
+void  sr_sub_4D789A(stru315 *a1, stru316 *a2)
 {
   int v2; // ecx@1
   unsigned int v3; // eax@2
--- a/lib/legacy_dx/d3drmobj.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/lib/legacy_dx/d3drmobj.h	Mon Aug 26 10:39:24 2013 +0600
@@ -173,26 +173,26 @@
 DEFINE_GUID(IID_IDirect3DRMPicked2Array,    0x4516ec7b, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3);
 DEFINE_GUID(IID_IDirect3DRMClippedVisual,   0x5434e733, 0x6d66, 0x11d1, 0xbb, 0xb, 0x0, 0x0, 0xf8, 0x75, 0x86, 0x5a);
 
-typedef void (__cdecl *D3DRMOBJECTCALLBACK)(LPDIRECT3DRMOBJECT obj, LPVOID arg);
-typedef void (__cdecl *D3DRMFRAMEMOVECALLBACK)(LPDIRECT3DRMFRAME obj, LPVOID arg, D3DVALUE delta);
-typedef void (__cdecl *D3DRMFRAME3MOVECALLBACK)(LPDIRECT3DRMFRAME3 obj, LPVOID arg, D3DVALUE delta);
-typedef void (__cdecl *D3DRMUPDATECALLBACK)(LPDIRECT3DRMDEVICE obj, LPVOID arg, int, LPD3DRECT);
-typedef void (__cdecl *D3DRMDEVICE3UPDATECALLBACK)(LPDIRECT3DRMDEVICE3 obj, LPVOID arg, int, LPD3DRECT);
-typedef int (__cdecl *D3DRMUSERVISUALCALLBACK)
+typedef void ( *D3DRMOBJECTCALLBACK)(LPDIRECT3DRMOBJECT obj, LPVOID arg);
+typedef void ( *D3DRMFRAMEMOVECALLBACK)(LPDIRECT3DRMFRAME obj, LPVOID arg, D3DVALUE delta);
+typedef void ( *D3DRMFRAME3MOVECALLBACK)(LPDIRECT3DRMFRAME3 obj, LPVOID arg, D3DVALUE delta);
+typedef void ( *D3DRMUPDATECALLBACK)(LPDIRECT3DRMDEVICE obj, LPVOID arg, int, LPD3DRECT);
+typedef void ( *D3DRMDEVICE3UPDATECALLBACK)(LPDIRECT3DRMDEVICE3 obj, LPVOID arg, int, LPD3DRECT);
+typedef int ( *D3DRMUSERVISUALCALLBACK)
     (   LPDIRECT3DRMUSERVISUAL obj, LPVOID arg, D3DRMUSERVISUALREASON reason,
         LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view
     );
-typedef HRESULT (__cdecl *D3DRMLOADTEXTURECALLBACK)
+typedef HRESULT ( *D3DRMLOADTEXTURECALLBACK)
     (char *tex_name, void *arg, LPDIRECT3DRMTEXTURE *);
-typedef HRESULT (__cdecl *D3DRMLOADTEXTURE3CALLBACK)
+typedef HRESULT ( *D3DRMLOADTEXTURE3CALLBACK)
     (char *tex_name, void *arg, LPDIRECT3DRMTEXTURE3 *);
-typedef void (__cdecl *D3DRMLOADCALLBACK)
+typedef void ( *D3DRMLOADCALLBACK)
     (LPDIRECT3DRMOBJECT object, REFIID objectguid, LPVOID arg);
 
-typedef HRESULT (__cdecl *D3DRMDOWNSAMPLECALLBACK)
+typedef HRESULT ( *D3DRMDOWNSAMPLECALLBACK)
     (LPDIRECT3DRMTEXTURE3 lpDirect3DRMTexture, LPVOID pArg,
      LPDIRECTDRAWSURFACE pDDSSrc, LPDIRECTDRAWSURFACE pDDSDst);
-typedef HRESULT (__cdecl *D3DRMVALIDATIONCALLBACK)
+typedef HRESULT ( *D3DRMVALIDATIONCALLBACK)
     (LPDIRECT3DRMTEXTURE3 lpDirect3DRMTexture, LPVOID pArg,
      DWORD dwFlags, DWORD dwcRects, LPRECT pRects);
 
--- a/mm7_1.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/mm7_1.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -59,6 +59,8 @@
   return (((__int64)a1 << 16) * a2) >> 16;
 }
 
+
+//----- (0042EBBE) --------------------------------------------------------
 //----- (004453C0) mm6-----------------------------------------------------
 //----- (004A1760) mm6_chinese---------------------------------------------
 int fixpoint_sub0(int a1, int a2)
--- a/mm7_2.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/mm7_2.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -296,7 +296,7 @@
 }
 
 //----- (004BBCDD) --------------------------------------------------------
-void __cdecl sub_4BBCDD()
+void  sub_4BBCDD()
 {
   signed int v0; // ebp@3
   Actor *v1; // eax@4
@@ -387,7 +387,7 @@
 }
 
 //----- (004BC109) --------------------------------------------------------
-void __cdecl ArenaFight()
+void  ArenaFight()
 {
   int v0; // edi@1
   char *v1; // eax@7
@@ -598,7 +598,7 @@
 }
 
 //----- (004BD8B5) --------------------------------------------------------
-signed int __cdecl sub_4BD8B5()
+int sub_4BD8B5()
 {
   int v0; // eax@4
   int v1; // eax@29
@@ -607,7 +607,7 @@
 
   if ( pMessageQueue_50CBD0->uNumMessages )
     pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-  pKeyActionMap->SetWindowInputStatus(3);
+  pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
   pKeyActionMap->ResetKeys();
   activeLevelDecoration = NULL;
   current_npc_text = 0;
@@ -694,7 +694,7 @@
 }
 
 //----- (004BF91E) --------------------------------------------------------
-unsigned int __thiscall GameOverMenu(void *ecx0)
+unsigned int  GameOverMenu(void *ecx0)
 {
   char *v1; // eax@2
   unsigned int result; // eax@3
@@ -1578,7 +1578,7 @@
 }
 
 //----- (00450521) --------------------------------------------------------
-signed int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6)
+int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6)
 {
   int v6; // edi@1
   int v7; // esi@1
@@ -1962,7 +1962,7 @@
 // 5C6DF8: using guessed type int dword_5C6DF8;
 
 //----- (00450DA3) --------------------------------------------------------
-int __cdecl GetAlertStatus()
+int  GetAlertStatus()
 {
   int result; // eax@2
 
@@ -3034,7 +3034,7 @@
 // 6BE35C: using guessed type int uLevel_StartingPointType;
 
 //----- (00461103) --------------------------------------------------------
-void __cdecl sub_461103()
+void  _461103_load_level_sub()
 {
   //GUIProgressBar *v0; // ebx@1
   //signed int v1; // ebp@1
@@ -3188,7 +3188,7 @@
     uNumActors = 0;
   if ( dword_6BE368_debug_settings_2 & 8 )
     uNumLevelDecorations = 0;
-  sub_4613C4();
+  init_event_triggers();
 
   pGameLoadingUI_ProgressBar->Progress();
 
@@ -3206,38 +3206,15 @@
 }
 
 //----- (004613C4) --------------------------------------------------------
-int __cdecl sub_4613C4()
+void init_event_triggers()
 {
-  unsigned __int16 v0; // ax@1
-  size_t v1; // ecx@1
-  int v2; // esi@1
-  int result; // eax@1
-  LevelDecoration *v4; // edx@2
-  int v5; // edi@4
-
-  _6836C8_num_decorations_6807E8 = 0;
-  v0 = pDecorationList->GetDecorIdByName("Event Trigger");
-  v1 = uNumLevelDecorations;
-  v2 = (signed __int16)v0;
-  result = 0;
-  if ( (signed int)uNumLevelDecorations > 0 )
-  {
-    v4 = pLevelDecorations.data();
-    do
-    {
-      if ( v4->uDecorationDescID == v2 )
-      {
-        v5 = _6836C8_num_decorations_6807E8++;
-        _6807E8_level_decorations_ids[v5] = result;
-      }
-      ++result;
-      ++v4;
-    }
-    while ( result < (signed int)v1 );
-  }
-  return result;
+  uint id = pDecorationList->GetDecorIdByName("Event Trigger");
+  
+  num_event_triggers = 0;
+  for (uint i = 0; i < uNumLevelDecorations; ++i)
+    if (pLevelDecorations[i].uDecorationDescID == id)
+      event_triggers[num_event_triggers++] = i;
 }
-// 6836C8: using guessed type int 6836C8_num_decorations_6807E8;
 
 //----- (004621DA) --------------------------------------------------------
 int int_get_vector_length(signed int x, signed int y, signed int z)
@@ -3267,7 +3244,7 @@
 
 OPENFILENAMEA ofn;
 //----- (0046271C) --------------------------------------------------------
-void __cdecl crt_init_globals_46271C()
+void CreateDefaultBLVLevel()
 {
   ofn.lStructSize = 0x4Cu;
   ofn.hwndOwner = hWnd;
@@ -3378,7 +3355,7 @@
       }
       else
       {
-        if ( !ptr_507BDC )// ???
+        if ( !pModalWindow )// ???
         {
           pButton = pWindow->pControlsHead;
           for ( pButton = pWindow->pControlsHead; pButton; pButton = pButton->pNext )
@@ -3448,6 +3425,7 @@
   
   switch (Msg)
   {
+    case WM_SIZING:  return 1;
     case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam);
     case WM_CHAR:
     {
@@ -3456,6 +3434,14 @@
     }
     return DefWindowProcA(hWnd, Msg, wParam, lParam);
 
+
+    case WM_DEVICECHANGE:
+    {
+      if (wParam == 0x8000)          // CD or some device has been inserted - notify InsertCD dialog
+        PostMessageA(hInsertCDWindow, WM_USER + 1, 0, 0);
+      return 0;
+    }
+
     case WM_COMMAND:
     {
       switch (wParam)
@@ -3640,12 +3626,6 @@
   {
     switch ( Msg )
     {
-      case WM_DEVICECHANGE:
-        if ( wParam == 0x8000 )
-          PostMessageA(hInsertCDWindow, WM_CHOOSEFONT_GETLOGFONT, 0, 0);
-        return 0;
-      case WM_SIZING:
-        return 1;
       case WM_LBUTTONDOWN:
         if ( pArcomageGame->bGameInProgress )
         {
@@ -3763,7 +3743,6 @@
         if ( !pGame )
           //goto _def_wnd_proc;
           return DefWindowProcA(hWnd, Msg, wParam, lParam);
-        sub_417871(0);
         return DefWindowProcA(hWnd, Msg, wParam, lParam);
       case WM_MOUSEMOVE:
         if ( pArcomageGame->bGameInProgress )
@@ -3846,14 +3825,14 @@
       }
       if ( wParam >= VK_LEFT && wParam <= VK_DOWN )
       {
-        if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE )
+        if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_MODAL_WINDOW )
         {
           if ( !viewparams->field_4C )
             UI_OnKeyDown(wParam);
           return 0;
         }
       }
-      if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE )
+      if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_MODAL_WINDOW )
         return 0;
     }
 
@@ -4023,7 +4002,7 @@
 }
 
 //----- (00464479) --------------------------------------------------------
-void __cdecl ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows()
+void  ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows()
 {
   int v0; // esi@9
 
@@ -4056,11 +4035,8 @@
 }
 
 //----- (004646F0) --------------------------------------------------------
-void PrepareWorld(unsigned int this_)
+void PrepareWorld(unsigned int _0_box_loading_1_fullscreen)
 {
-  unsigned int v1; // ebx@1
-
-  v1 = this_;
   if ( pRenderer->pRenderD3D )
     pGame->pVisInstance->_4C1A02();
   pEventTimer->Pause();
@@ -4068,13 +4044,13 @@
   pParty->uFlags = 2;
   pCastSpellInfo.data()->_427D48(1);
   ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
-  DoPrepareWorld(0, (v1 == 0) + 1);
+  DoPrepareWorld(0, (_0_box_loading_1_fullscreen == 0) + 1);
   pMiscTimer->Resume();
   pEventTimer->Resume();
 }
 
 //----- (00464761) --------------------------------------------------------
-void __thiscall Game_DeinitializeAndTerminate(int exitCode)
+void  Game_DeinitializeAndTerminate(int exitCode)
 {
   int v1; // esi@1
   HANDLE v2; // eax@1
@@ -4109,22 +4085,22 @@
 // 6BE3A0: using guessed type float flt_6BE3A0;
 
 //----- (00464839) --------------------------------------------------------
-char __cdecl Is_out15odm_underwater()
+char  Is_out15odm_underwater()
 {
   return _stricmp(pCurrentMapName.data(), "out15.odm") == 0;
 }
 
 //----- (00464851) --------------------------------------------------------
-void __cdecl SetUnderwaterFog()
+void  SetUnderwaterFog()
 {
   day_fogrange_1 = 50;
   day_fogrange_2 = 5000;
 }
 
 //----- (00464866) --------------------------------------------------------
-void __fastcall DoPrepareWorld(unsigned int bLoading, int a2)
+void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box)
 {
-  int v2; // esi@1
+  //int v2; // esi@1
   char *v3; // eax@1
   //char *v4; // eax@1
   unsigned int v5; // eax@3
@@ -4133,11 +4109,11 @@
   char Str1[20]; // [sp+Ch] [bp-18h]@1
   unsigned int v9; // [sp+20h] [bp-4h]@1
 
-  v2 = a2;
   v9 = bLoading;
   ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
   pDecalBuilder->Reset(0);
-  pGameLoadingUI_ProgressBar->Initialize((GUIProgressBar::Type)v2);
+  pGameLoadingUI_ProgressBar->Initialize(_1_fullscreen_loading_2_box == 1 ? GUIProgressBar::TYPE_Fullscreen :
+                                                                            GUIProgressBar::TYPE_Box);
   strcpy(Str1, pCurrentMapName.data());
   v3 = strtok(Str1, ".");
   strcpy(Str1, v3);
@@ -4166,7 +4142,7 @@
   else
     PrepareToLoadBLV(v9);
   pAudioPlayer->SetMapEAX();
-  sub_461103();
+  _461103_load_level_sub();
   if ( !_stricmp(pCurrentMapName.data(), "d11.blv") || !_stricmp(pCurrentMapName.data(), "d10.blv") )
   {
     //spawning grounds & good analogue - no loot & exp from monsters
@@ -4181,7 +4157,7 @@
   bDialogueUI_InitializeActor_NPC_ID = 0;
   OnMapLoad();
   pGameLoadingUI_ProgressBar->Progress();
-memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D));
+  memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D));
   pGameLoadingUI_ProgressBar->Release();
   _flushall();
 }
@@ -5087,7 +5063,7 @@
 }
 
 //----- (00465D0B) --------------------------------------------------------
-void __cdecl SecondaryInitialization()
+void  SecondaryInitialization()
 {
   __int16 v4; // ax@4
   signed int v5; // esi@5
@@ -5456,13 +5432,16 @@
         }
         else
         {
-          if (GetCurrentMenuID() == MENU_10)
+          if (GetCurrentMenuID() == MENU_DebugBLVLevel)
 		  {
 			  pMouse->Activate(0);
 
 			  pParty->Reset();
 			  pParty->CreateDefaultParty(1);
-			  crt_init_globals_46271C();
+
+              extern void CreateDefaultBLVLevel();
+			  CreateDefaultBLVLevel();
+
 			  extern OPENFILENAMEA ofn;
 			  if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) )
 			  {
@@ -5509,7 +5488,7 @@
 }
 
 //----- (004637E0) --------------------------------------------------------
-char __cdecl sub_4637E0_is_there_popup_onscreen()
+char  sub_4637E0_is_there_popup_onscreen()
 {
   return dword_507BF0_is_there_popup_onscreen == 1;
 }
@@ -5659,7 +5638,7 @@
 }
 
 //----- (004666D5) --------------------------------------------------------
-void __cdecl MM7Initialization()
+void  MM7Initialization()
 {
   if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
   {
@@ -5705,7 +5684,7 @@
 }
 
 //----- (00466B8C) --------------------------------------------------------
-int __cdecl AbortWithError()
+int  AbortWithError()
 {
   if ( !aborting_app )
   {
@@ -5754,7 +5733,7 @@
     case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC";
     case MENU_CREDITSPROC:  return L"MENU_CREDITSPROC";
     case MENU_LoadingProcInMainMenu: return L"MENU_LoadingProcInMainMenu";
-    case MENU_10:           return L"MENU_10";
+    case MENU_DebugBLVLevel:           return L"MENU_DebugBLVLevel";
     case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE";
     default:                return L"unk";
   };
@@ -5772,12 +5751,9 @@
   return uCurrentMenuID;
 }
 
-// 720980: using guessed type int uTextureID_720980;
-
-// 4E28F8: using guessed type int pCurrentScreen;
 
 //----- (0046A6AC) --------------------------------------------------------
-int __fastcall sub_46A6AC(int a1, int a2, int a3)
+int __fastcall _46A6AC_spell_render(int a1, int a2, int a3)
 {
   int result; // eax@2
   unsigned int v4; // edx@3
@@ -5798,10 +5774,11 @@
   v14 = a1;
   if ( pRenderer->pRenderD3D )
   {
-    result = sub_46A7C8(a1, a2, a3);
+    result = _46A6AC_spell_render_d3d(a1, a2, a3);
   }
   else
   {
+    __debugbreak(); // SW render never called
     v16 = 0;
     v4 = viewparams->uScreen_topL_X;
     v12 = viewparams->uScreen_BttmR_X;
@@ -5860,7 +5837,7 @@
 }
 
 //----- (0046A7C8) --------------------------------------------------------
-int __fastcall sub_46A7C8(int a1, int a2, signed int a3)
+int __fastcall _46A6AC_spell_render_d3d(int a1, int a2, int a3)
 {
   unsigned int v3; // eax@2
   int v4; // ecx@2
@@ -5929,7 +5906,7 @@
 }
 
 //----- (0046A89E) --------------------------------------------------------
-int __fastcall sub_46A89E(int a1, int a2, signed int a3)
+int __fastcall _46A89E_immolation_effect(int a1, int a2, int a3)
 {
   signed int v3; // edi@1
   Actor *v4; // esi@2
@@ -6013,7 +5990,7 @@
 }
 
 //----- (0046A99B) --------------------------------------------------------
-int __cdecl sub_46A99B()
+int  sub_46A99B()
 {
   int v0; // ebx@1
   signed int v1; // ecx@1
@@ -6219,7 +6196,7 @@
 }
 
 //----- (0046BDA8) --------------------------------------------------------
-unsigned int __cdecl GetGravityStrength()
+unsigned int  GetGravityStrength()
 {
   int v0; // eax@1
 
@@ -6229,7 +6206,7 @@
 }
 
 //----- (0046BDC0) --------------------------------------------------------
-void __cdecl UpdateUserInput_and_MapSpecificStuff()
+void  UpdateUserInput_and_MapSpecificStuff()
 {
   if ( dword_6BE364_game_settings_1 & 0x80 )
   {
@@ -6766,7 +6743,7 @@
               v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
             v124 = 8 * v153;
             LOBYTE(v124) = v124 | 2;
-            v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1;
+            v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
             pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9);
             return 0;
           }
@@ -6823,7 +6800,7 @@
             v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
           v124 = 8 * v153;
           LOBYTE(v124) = v124 | 2;
-          v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1;
+          v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
           pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9);
           return 0;
         }
@@ -6924,7 +6901,7 @@
           v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
         v124 = 8 * v153;
         LOBYTE(v124) = v124 | 2;
-        v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1;
+        v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id-1] + 1;
         pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9);
         return 0;
       }
@@ -7058,7 +7035,7 @@
               v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
             v124 = 8 * v153;
             LOBYTE(v124) = v124 | 2;
-            v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1;
+            v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
             pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
             return 0;
           }
--- a/mm7_3.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/mm7_3.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -52,7 +52,7 @@
 #include "MM7.h"
 
 //----- (0046E44E) --------------------------------------------------------
-int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1)
+int  _46E44E_collide_against_faces_and_portals(unsigned int b1)
 {
   BLVSector *pSector; // edi@1
   signed int v2; // ebx@1
@@ -600,7 +600,7 @@
 }
 
 //----- (0046EF01) --------------------------------------------------------
-int __thiscall _46EF01_collision_chech_player(int a1)
+int  _46EF01_collision_chech_player(int a1)
 {
   int v1; // edx@1
   int result; // eax@1
@@ -673,7 +673,7 @@
 }
 
 //----- (0046F04E) --------------------------------------------------------
-signed int __cdecl _46F04E_collide_against_portals()
+int _46F04E_collide_against_portals()
 {
   BLVSector *v0; // ecx@1
   unsigned int v1; // eax@1
@@ -864,7 +864,7 @@
 }
 
 //----- (004706C6) --------------------------------------------------------
-void __cdecl UpdateActors_ODM()
+void  UpdateActors_ODM()
 {
   Actor *v0; // esi@2
   AIState uAIState; // ax@2
@@ -3348,7 +3348,7 @@
 }
 
 //----- (00475665) --------------------------------------------------------
-signed int __thiscall sub_475665(BLVFace *_this, int a2, __int16 a3)
+int sub_475665(BLVFace *_this, int a2, __int16 a3)
 {
   unsigned int v3; // eax@1
   Vec3_short_ *v4; // edx@3
@@ -4334,23 +4334,6 @@
   return v16;
 }
 
-//----- (004783FA) --------------------------------------------------------
-void __cdecl sub_4783FA_construct_global_73D150()
-{
-  char *v0; // eax@1
-  signed int v1; // ecx@1
-
-  v0 = (char *)&array_73D150[0].flt_2C;
-  v1 = 20;
-  do
-  {
-    *(float *)v0 = 0.0;
-    v0 += 48;
-    --v1;
-  }
-  while ( v1 );
-}
-
 //----- (0047840D) --------------------------------------------------------
 char Render::DrawBuildingsD3D()
 {
@@ -5816,7 +5799,7 @@
 }
 
 //----- (0047C4FC) --------------------------------------------------------
-signed int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5)
+int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5)
 {
   //int v5; // esi@1
   signed int v6; // edx@1
@@ -5970,13 +5953,13 @@
 }
 
 //----- (0047F469) --------------------------------------------------------
-int __stdcall GridCellToWorldPosX(int a1)
+int GridCellToWorldPosX(int a1)
 {
   return (a1 - 64) << 9;
 }
 
 //----- (0047F476) --------------------------------------------------------
-int __stdcall GridCellToWorldPosZ(int a1)
+int GridCellToWorldPosZ(int a1)
 {
   return (64 - a1) << 9;
 }
@@ -6010,7 +5993,7 @@
 }
 
 //----- (00481ED9) --------------------------------------------------------
-void __cdecl sub_481ED9_MessWithOutdoorCamera()
+void  sub_481ED9_MessWithOutdoorCamera()
 {
   stru_8019C8._48616B(65536, 0, 0, 0, 65536, 0);
   pOutdoorCamera->uNumPolygons = 0;
@@ -6189,18 +6172,12 @@
     return y_x1z1;
 }
 
-//----- (00482A90) --------------------------------------------------------
-signed int __cdecl const_1_0()
-{
-  return 1;
-}
-
 
 
 
 
 //----- (00485F53) --------------------------------------------------------
-void __thiscall sr_485F53(Vec2_int_ *v)
+void  sr_485F53(Vec2_int_ *v)
 {
   ++v->y;
   if ( v->y > 1000 )
@@ -6726,7 +6703,7 @@
 }
 
 //----- (00443F95) --------------------------------------------------------
-void __cdecl OnMapLeave()
+void  OnMapLeave()
 {
  _evt_raw *test_event;
   if ( uLevelEVT_NumEvents > 0 )
@@ -6917,7 +6894,7 @@
 }
 
 //----- (00444564) --------------------------------------------------------
-const char *__cdecl sub_444564()
+const char * sub_444564()
 {
   double v0; // st7@3
   int v1; // ebx@3
@@ -7047,7 +7024,7 @@
 }
 
 //----- (004452BB) --------------------------------------------------------
-void __cdecl sub_4452BB()
+void  sub_4452BB()
 {
   pGUIWindow2->Release();
   pGUIWindow2 = 0;
@@ -7436,7 +7413,7 @@
 }
 
 //----- (00448B45) --------------------------------------------------------
-void __thiscall GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide)
+void  GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide)
 {
   if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft )
     GameUI_Footer_TimeLeft = 0;
@@ -7797,32 +7774,29 @@
 }
 
 //----- (0044C28B) --------------------------------------------------------
-signed int __cdecl const_2()
+int const_2()
 {
   return 2;
 }
 
 //----- (0044C28F) --------------------------------------------------------
-bool __cdecl sub_44C28F_open_nwc_dungeon()
+bool TeleportToNWCDungeon()
 {
-  bool result; // eax@1
-
-  result = _stricmp("nwc.blv", pCurrentMapName.data());
-  if ( result )
-  {
-    _5B65A8_npcdata_uflags_or_other = 0;
-    _5B65AC_npcdata_fame_or_other = 0;
-    _5B65B0_npcdata_rep_or_other = 0;
-    _5B65B4_npcdata_loword_house_or_other = 0;
-    _5B65B8_npcdata_hiword_house_or_other = 0;
-    dword_5B65BC = 0;
-    dword_5B65C0 = 0;
-    pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
-    sub_44987B("nwc.blv", MapStartPoint_Party);
-    pCurrentScreen = SCREEN_GAME;
-    result = 1;
-  }
-  return result;
+  if (!_stricmp("nwc.blv", pCurrentMapName.data()))
+    return false;
+
+  _5B65A8_npcdata_uflags_or_other = 0;
+  _5B65AC_npcdata_fame_or_other = 0;
+  _5B65B0_npcdata_rep_or_other = 0;
+  _5B65B4_npcdata_loword_house_or_other = 0;
+  _5B65B8_npcdata_hiword_house_or_other = 0;
+  dword_5B65BC = 0;
+  dword_5B65C0 = 0;
+
+  pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
+  sub_44987B("nwc.blv", MapStartPoint_Party);
+  pCurrentScreen = SCREEN_GAME;
+  return true;
 }
 
 //----- (0044C2F4) --------------------------------------------------------
@@ -7890,7 +7864,7 @@
 }
 
 //----- (00401000) --------------------------------------------------------
-void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int))
+void mm7__vector_constructor(void *a1, int objSize, int numObjs, int ( *constructor)(int))
 {
   void *v4; // esi@2
   int v5; // edi@2
@@ -7909,10 +7883,6 @@
   }
 }
 
-// 4F75D8: using guessed type int ai_arrays_size;
-
-// 4F75D8: using guessed type int ai_arrays_size;
-
 //----- (0040261D) --------------------------------------------------------
 int stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8)
 {
--- a/mm7_4.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/mm7_4.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -47,7 +47,7 @@
 #include "Lights.h"
 
 //----- (0046CC4B) --------------------------------------------------------
-void __cdecl check_event_triggers()
+void check_event_triggers()
 {
   int v0; // eax@1
   LevelDecoration *v1; // esi@2
@@ -90,9 +90,9 @@
   signed int v38; // [sp+20h] [bp-4h]@24
 
   v0 = 0;
-  for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i )
+  for ( i = 0; i < num_event_triggers; ++i )
   {
-    v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]];
+    v1 = &pLevelDecorations[event_triggers[v0]];
     v2 = v1->field_18;
     v3 = v1->vPosition.y;
     v33 = v1->vPosition.x;
@@ -440,7 +440,7 @@
 }
 
 //----- (0046E0B2) --------------------------------------------------------
-void __cdecl _46E0B2_collide_against_decorations()
+void  _46E0B2_collide_against_decorations()
 {
   BLVSector *v0; // ebp@1
   LevelDecoration *v1; // edi@2
@@ -532,7 +532,7 @@
 }
 
 //----- (00487DA9) --------------------------------------------------------
-void __cdecl sub_487DA9()
+void  sub_487DA9()
 {
   for (int i = 0; i < 20000; ++i)
     array_77EC08[i].field_108 = 0;
@@ -597,7 +597,7 @@
 }
 
 //----- (00491E3A) --------------------------------------------------------
-void __cdecl sub_491E3A()
+void sub_491E3A()
 {
   Player *v0; // ebx@1
   signed int v1; // esi@3
@@ -698,7 +698,7 @@
 // 4ED498: using guessed type char byte_4ED498;
 
 //----- (00493938) --------------------------------------------------------
-int __cdecl _493938_regenerate()
+int  _493938_regenerate()
 {
   int v0; // edi@1
   signed __int64 v1; // qax@1
@@ -842,7 +842,7 @@
       a1.spell_caster_pid = v12;
       a1.uFacing = 0;
       a1.uSoundID = 0;
-      v13 = sub_46A89E((int)v41, 100, 307);
+      v13 = _46A89E_immolation_effect((int)v41, 100, 307);
       if ( v13 > 0 )
       {
         do
@@ -1070,7 +1070,7 @@
 }
 
 //----- (00493F79) --------------------------------------------------------
-void sub_493F79(stru351_summoned_item *_this, __int64 a2)
+void init_summoned_item(stru351_summoned_item *_this, __int64 duration)
 {
   signed __int64 v2; // ST2C_8@1
   signed __int64 v3; // qax@1
@@ -1078,7 +1078,7 @@
   unsigned __int64 v5; // qax@1
   unsigned int v6; // ebx@1
 
-  v2 = (signed __int64)((double)a2 * 0.234375);
+  v2 = (signed __int64)((double)duration * 0.234375);
   v3 = v2 / 60 / 60;
   //v4 = v3;
   v5 = (unsigned int)v3 / 0x18;
@@ -1885,8 +1885,7 @@
   dword_AE3370 = v3;
   return pNPCStats->pNPCNames[0][v11 + 2 * v3];
 }
-// AE336C: using guessed type int dword_AE336C;
-// AE3370: using guessed type int dword_AE3370;
+
 
 //----- (00495430) --------------------------------------------------------
 char * GetReputationString( signed int a1 )
@@ -2000,7 +1999,7 @@
           break;
         case 8:
           v63 = 0;
-          v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits;
+          v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits;
           for ( uint i = 0; i < 28; ++i )
           {
             if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) )
@@ -2241,7 +2240,7 @@
               i += 2;
               break;
             }
-            sub_493F79(&v56, *a6);
+            init_summoned_item(&v56, *a6);
             sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year);
             strcat(pTmpBuf2.data(), a1);
             dst = strlen(pTmpBuf2.data());
@@ -2272,7 +2271,7 @@
               i += 2;
               break;
             }
-            sub_493F79(&v56, pParty->field_3C._s_times[v17-51]);
+            init_summoned_item(&v56, pParty->field_3C._s_times[v17-51]);
             sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year);
             strcat(pTmpBuf2.data(), a1);
             dst = strlen(pTmpBuf2.data());
@@ -2615,7 +2614,7 @@
 }
 
 //----- (004A57E9) --------------------------------------------------------
-void __cdecl Present_ColorKey()
+void  Present_ColorKey()
 {
   HRESULT v0; // eax@3
   HRESULT v1; // eax@3
@@ -2927,7 +2926,7 @@
     if ( pParty->uFine )
     {
       //v10 = result->_guilds_member_bits;
-      result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1);
+      result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_achieved_awards_bits, 1);
       if ( !(short)result )
 		  __debugbreak();
         //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u);
@@ -2939,7 +2938,7 @@
 }
 
 //----- (004B1523) --------------------------------------------------------
-void __thiscall sub_4B1523(int *_this)
+void  sub_4B1523(int *_this)
 {
   int v1; // esi@1
   int v2; // edx@1
@@ -3009,7 +3008,7 @@
 }
 
 //----- (004B1ECE) --------------------------------------------------------
-void __cdecl sub_4B1ECE()
+void OracleDialogue()
 {
   __int16 *v0; // edi@1
   int v1; // ebx@3
@@ -3103,13 +3102,9 @@
 	  v9->uHolderPlayer = v5;
   }
 }
-// 4F08EC: using guessed type int dword_4F08EC[];
-// 722B3C: using guessed type int dword_722B3C;
-// 722B44: using guessed type int dword_722B44;
-// F8B1A8: using guessed type int dword_F8B1A8;
 
 //----- (004B254D) --------------------------------------------------------
-char *__thiscall _4B254D_SkillMasteryTeacher(int _this)
+char * _4B254D_SkillMasteryTeacher(int _this)
 {
   //Player *v1; // esi@1
   int v2; // edx@1
@@ -3485,7 +3480,7 @@
 }
 
 //----- (004B3E1E) --------------------------------------------------------
-void __cdecl sub_4B3E1E()
+void  sub_4B3E1E()
 {
   NPCData *v0; // ST40_4@1
   signed int v1; // edi@1
@@ -3506,7 +3501,6 @@
   pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1);
 }
 
-// F8B19C: using guessed type int dword_F8B19C;
 
 //----- (004B3FE5) --------------------------------------------------------
 void __fastcall sub_4B3FE5(int a4)
@@ -3544,13 +3538,13 @@
 }
 
 //----- (004B46F8) --------------------------------------------------------
-int __fastcall sub_4B46F8(int a1)
+__int64 GetExperienceRequiredForLevel(int level)
 {
-  int v1; // eax@1
+  __int64 v1; // eax@1
   int i; // edx@1
 
   v1 = 0;
-  for ( i = 0; i < a1; ++i )
+  for ( i = 0; i < level; ++i )
     v1 += i + 1;
   return 1000 * v1;
 }
@@ -3756,12 +3750,13 @@
 			switch ( npc_event_id )
 			{
 				case 139:
-					sub_4B1ECE();
+					OracleDialogue();
 					break;
 				case 311:
 					sub_4BBA85_bounties();
 					break;
 				case 399:
+                  __debugbreak(); // what kind of dialogue is that?
 					sub_4BBCDD();
 					break;
 				default:
--- a/mm7_5.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/mm7_5.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -51,7 +51,7 @@
 #include "Lights.h"
 
 //----- (004304E7) --------------------------------------------------------
-void __cdecl GameUI_MsgProc()
+void  GameUI_MsgProc()
 {
   //signed int v0; // edi@6
   //char *v1; // esi@6
@@ -890,7 +890,7 @@
             MM7Initialization();
             continue;
           }
-          ModalWindow(pNPCTopics[453].pText, 0);
+          ModalWindow(pNPCTopics[453].pText, UIMSG_0);
           continue;
         case UIMSG_GameMenu_ReturnToGame:
           pGUIWindow_CurrentMenu->Release();
@@ -983,7 +983,7 @@
               }
               break;
           }
-          if ( !ptr_507BDC )
+          if ( !pModalWindow )
           {
             pRenderer->ClearZBuffer(0, 479);
             viewparams->bRedrawGameUI = 1;
@@ -1392,7 +1392,7 @@
                       continue;
                     case SCREEN_CHARACTERS:
                       CharacterUI_ReleaseButtons();
-                      sub_419379();
+                      ReleaseAwardsScrollBar();
                       pIcons_LOD->RemoveTexturesPackFromTextureList();
                       if ( pGUIWindow_Settings )
                       {
@@ -1479,7 +1479,7 @@
                   continue;
                 }
                 CharacterUI_ReleaseButtons();
-                sub_419379();
+                ReleaseAwardsScrollBar();
                 pIcons_LOD->RemoveTexturesPackFromTextureList();
               }
               if ( pGUIWindow_Settings )
@@ -1565,7 +1565,7 @@
             back_to_game();
             continue;
           }
-          sub_41426F();
+          ModalWindow_Release();
           continue;
         case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel
           if ( uMessageParam )
@@ -1751,7 +1751,7 @@
             TeleportToStartingPoint(uLevel_StartingPointType);
             pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v213, 0);
             pParty->uFallStartY = pParty->vPosition.z;
-            sub_461103();
+            _461103_load_level_sub();
             pEventTimer->Resume();
             viewparams->bRedrawGameUI = 1;
             pCurrentScreen = SCREEN_GAME;
@@ -2249,13 +2249,14 @@
           sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer."
             pGlobalTXT_LocalizationStrings[118],// "We hope that you've enjoyed playing Might and Magic VII as much as we did making it. We have saved this screen as MM7_WIN.PCX in your MM7 directory. You can print it out as proof of your accomplishment."
             pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team."   
-          ModalWindow(pFinalMessage.data(), 196);
+          ModalWindow(pFinalMessage.data(), UIMSG_OnFinalWindowClose);
           uGameState = GAME_STATE_FINAL_WINDOW;
           continue;
-        case UIMSG_C4:
+        case UIMSG_OnFinalWindowClose:
 			__debugbreak();
           uGameState = GAME_STATE_PLAYING;
           strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2");
+          __debugbreak(); // missed break/continue?
         case UIMSG_DD:
 			__debugbreak();
           sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer);
@@ -2479,7 +2480,7 @@
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
           if ( pCurrentScreen )
             continue;
-          if ( sub_42F4DA() )
+          if ( _42F4DA_check_actor_proximity() )
           {
             if ( pParty->bTurnBasedModeOn == 1 )
             {
@@ -2885,13 +2886,13 @@
         case UIMSG_ClickStatsBtn:
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;
           CharacterUI_ReleaseButtons();
-          sub_419379();
+          ReleaseAwardsScrollBar();
           GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0);
           continue;
         case UIMSG_ClickSkillsBtn:
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101;
           CharacterUI_ReleaseButtons();
-          sub_419379();
+          ReleaseAwardsScrollBar();
           CharacterUI_SkillsTab_CreateButtons();
           GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0);
           continue;
@@ -2920,7 +2921,7 @@
           continue;
         case UIMSG_ClickInventoryBtn:
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
-          sub_419379();
+          ReleaseAwardsScrollBar();
           CharacterUI_ReleaseButtons();
           GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0);
           continue;
@@ -2928,7 +2929,7 @@
           GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0);
           continue;
         case UIMSG_ClickAwardsBtn:
-          sub_419379();
+          ReleaseAwardsScrollBar();
           CharacterUI_ReleaseButtons();
           CreateAwardsScrollBar();
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102;
@@ -3238,7 +3239,7 @@
 }
 
 //----- (004356FF) --------------------------------------------------------
-void __cdecl back_to_game()
+void  back_to_game()
 {
   dword_507BF0_is_there_popup_onscreen = 0;
   dword_4E455C = 1;
@@ -3251,7 +3252,7 @@
 }
 
 //----- (00435748) --------------------------------------------------------
-void __cdecl GUI_MainMenuMessageProc()
+void  GUI_MainMenuMessageProc()
 {
   Player *pPlayer; // ebx@2
   void *v3; // edi@21
@@ -3387,7 +3388,7 @@
           break;
         case UIMSG_PlayerCreationClickOK:
           GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0);
-          if ( PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Chose4Skills() )
+          if ( PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Choose4Skills() )
             GameUI_Footer_TimeLeft = GetTickCount() + 4000;
           else
             uGameState = GAME_STATE_STARTING_NEW_GAME;
@@ -3420,7 +3421,7 @@
           pMouse->SetCursorBitmap("MICON2");
           break;
         case UIMSG_3A:
-          SetCurrentMenuID(MENU_10);
+          SetCurrentMenuID(MENU_DebugBLVLevel);
           break;
         case UIMSG_LoadGame:
           if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot])
@@ -3479,12 +3480,12 @@
           break;
         case UIMSG_AE:
           GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0);
-          SetCurrentMenuID(MENU_10);
+          SetCurrentMenuID(MENU_DebugBLVLevel);
           break;
         case UIMSG_Escape:
-          if ( ptr_507BDC )
+          if ( pModalWindow )
           {
-            sub_41426F();
+            ModalWindow_Release();
             break;
           }
           if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) )
@@ -3579,7 +3580,7 @@
 }
 
 //----- (00436427) --------------------------------------------------------
-double __cdecl get_shading_dist_mist()
+double  get_shading_dist_mist()
 {
   if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
     return (double)pOutdoorCamera->shading_dist_mist;
@@ -4626,6 +4627,8 @@
   signed int a3a; // [sp+24h] [bp+8h]@14
   int a4a; // [sp+28h] [bp+Ch]@2
 
+  __debugbreak();
+
   v4 = a4;
   v5 = a4->uAttributes;
   if ( v5 & 0x100 )
@@ -4759,6 +4762,8 @@
   int a4a; // [sp+28h] [bp+Ch]@2
   signed int a5a; // [sp+2Ch] [bp+10h]@14
 
+  __debugbreak();
+
   v5 = a4;
   v6 = a4->uAttributes;
   v7 = 0;
@@ -4867,23 +4872,17 @@
 }
 
 //----- (004088E9) --------------------------------------------------------
-signed int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6)
+int __fastcall sub_4088E9(int x1, int y1, int x2, int y2, int x3, int y3)
 {
-  int v6; // esi@1
-  int v7; // edi@1
   int v8; // eax@1
   signed int result; // eax@1
-  int v10; // [sp+Ch] [bp-4h]@1
   int v11; // [sp+18h] [bp+8h]@1
 
-  v6 = a1;
-  v10 = a2;
-  v7 = a3 - a1;
-  v11 = abs(a3 - a1);
-  v8 = abs(a4 - v10);
+  v11 = abs(x2 - x1);
+  v8 = abs(y2 - y1);
   result = integer_sqrt(v11 * v11 + v8 * v8);
   if ( result )
-    result = abs((v7 * (v10 - a6) - (a4 - v10) * (v6 - a5)) / result);
+    result = abs(((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / result);
   return result;
 }
 
@@ -4895,13 +4894,6 @@
                            LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8));
 }
 
-//----- (0040DFA7) --------------------------------------------------------
-int __stdcall retzero_sub_40DFA7(int a1)
-{
-  return 0;
-}
-// 40DFA7: using guessed type int __stdcall retzero_sub_40DFA7(int);
-
 
 
 //----- (0040F82D) --------------------------------------------------------
@@ -4964,7 +4956,7 @@
 }
 
 //----- (0040F92A) --------------------------------------------------------
-void __fastcall sub_40F92A(int *pZBuffer, Texture *a2, int a3)
+void __fastcall ZBuffer_DoFill2(int *pZBuffer, Texture *a2, int a3)
 {
   Texture *v3; // esi@1
   void *v4; // eax@3
@@ -5005,7 +4997,7 @@
 }
 
 //----- (00410D99) --------------------------------------------------------
-signed int __fastcall sub_410D99_get_map_index(int a1)
+int __fastcall sub_410D99_get_map_index(int a1)
 {
   int v1; // edi@1
   signed int v2; // ebp@1
--- a/mm7_6.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/mm7_6.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -44,7 +44,7 @@
 
 
 //----- (00424EE0) --------------------------------------------------------
-signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID)
+int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID)
 {
   unsigned int v1; // edx@1
   double v2; // st7@1
@@ -209,78 +209,6 @@
   return result;
 }
 
-//----- (0042620A) --------------------------------------------------------
-bool sr_42620A(RenderVertexSoft *p)
-{
-  __int16 v1; // fps@1
-  unsigned __int8 v2; // c0@2
-  char v3; // c2@2
-  unsigned __int8 v4; // c3@2
-  bool result; // eax@2
-  unsigned __int8 v6; // c0@4
-  char v7; // c2@4
-  unsigned __int8 v8; // c3@4
-  unsigned __int8 v9; // c0@6
-  char v10; // c2@6
-  unsigned __int8 v11; // c3@6
-  double v12; // st6@7
-  float v13; // ST04_4@7
-  float v14; // ST00_4@7
-  double v15; // st7@7
-  double v16; // st6@8
-  float v17; // ST04_4@8
-  float v18; // ST00_4@8
-  double v19; // st7@8
-
-  //UNDEF(v1);
-  if ( p->vWorldViewPosition.x < 300.0
-    || (v2 = 300.0 < p[1].vWorldViewPosition.x,
-        v3 = 0,
-        v4 = 300.0 == p[1].vWorldViewPosition.x,
-        //BYTE1(result) = HIBYTE(v1),
-        !(v2 | v4)) )
-  {
-    if ( p->vWorldViewPosition.x < 300.0 )
-    {
-      v6 = 300.0 < p[1].vWorldViewPosition.x;
-      v7 = 0;
-      v8 = 300.0 == p[1].vWorldViewPosition.x;
-      //BYTE1(result) = HIBYTE(v1);
-      if ( !(v6 | v8) )
-      {
-        //LOBYTE(result) = 0;
-        return false;
-      }
-    }
-    v9 = 300.0 < p->vWorldViewPosition.x;
-    v10 = 0;
-    v11 = 300.0 == p->vWorldViewPosition.x;
-    //BYTE1(result) = HIBYTE(v1);
-    if ( v9 | v11 )
-    {
-      v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x);
-      v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16;
-      v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16;
-      v19 = 300.0 - p[1].vWorldViewPosition.x;
-      p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x;
-      p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y;
-      p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z;
-    }
-    else
-    {
-      v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x);
-      v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12;
-      v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12;
-      v15 = 300.0 - p->vWorldViewPosition.x;
-      p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x;
-      p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y;
-      p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z;
-    }
-  }
-  //LOBYTE(result) = 1;
-  return true;
-}
-
 //----- (004268E3) --------------------------------------------------------
 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor)
 {
@@ -313,16 +241,6 @@
   LOWORD(v2) = (a1 >> 5) & 0x7E0;
   return ((unsigned __int8)a1 >> 3) | v2 | v1;
 }
-//----- (00426947) --------------------------------------------------------
-void __cdecl sub_426947()
-{
-  stru_50C198.field_0 = 0;
-  dword_50C994 = 0;
-  dword_50C998_turnbased_icon_1A = 0;
-}
-// 50C968: using guessed type int dword_50C968;
-// 50C994: using guessed type int dword_50C994;
-// 50C998: using guessed type int dword_50C998_turnbased_icon_1A;
 
 //----- (00426A5A) --------------------------------------------------------
 void stru319::LootActor(Actor *pActor)
@@ -1137,12 +1055,6 @@
   }
 }
 
-//----- (0042EBBE) --------------------------------------------------------
-int __fastcall sub_42EBBE(int a1, int a2)
-{
-  return (unsigned __int64)(a2 * (signed __int64)a1) >> 16;
-}
-// 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int);
 
 //----- (0042EBDB) --------------------------------------------------------
 int stru193_math::Sin(int angle)
@@ -1549,7 +1461,7 @@
 }
 
 //----- (0042F4DA) --------------------------------------------------------
-signed int __cdecl sub_42F4DA()
+int _42F4DA_check_actor_proximity()
 {
   signed int v0; // edi@1
   Actor *v1; // esi@4
@@ -1837,7 +1749,7 @@
 }
 
 //----- (0042FB5C) --------------------------------------------------------
-bool __fastcall sub_42FB5C(signed int a1)
+bool _42FB5C_check_spell(signed int a1)
 {
   int v1; // ecx@3
   int v2; // ecx@4
@@ -1897,7 +1809,7 @@
 }
 
 //----- (0042FBDD) --------------------------------------------------------
-void __cdecl sub_42FBDD()
+void  sub_42FBDD()
 {
   pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
   pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]);
@@ -1905,7 +1817,7 @@
 }
 
 //----- (0042FC15) --------------------------------------------------------
-void __cdecl CloseWindowBackground()
+void  CloseWindowBackground()
 {
   pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0);
   pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]);
@@ -1913,7 +1825,7 @@
 }
 
 //----- (0042FC4E) --------------------------------------------------------
-void __cdecl ProcessInputActions()
+void  ProcessInputActions()
 {
   char v4; // al@9
   char v8; // bl@100
--- a/mm7_data.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/mm7_data.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -500,7 +500,11 @@
 int dword_4E4A1C[777]; // weak
 int dword_4E4A40[777]; // weak
 int dword_4E4A44[777]; // weak
-std::array<float, 10> flt_4E4A80;
+std::array<float, 10> flt_4E4A80 =
+{
+  0.050000001, 0.1,  0.30000001,  0.5,    0.60000002,
+  1.0,         6.0, 25.0,        50.0,  100.0
+};
 
 
 std::array< std::array<int, 2>, 14> pPartySpellbuffsUI_XYs =
@@ -924,7 +928,6 @@
 int uGameMenuUI_CurentlySelectedKeyIdx; // 506E68
 std::array<unsigned int, 27> pPrevVirtualCidesMapping;
 int KeyboardPageNum; // weak
-std::array<int, 777> dword_506F0C; // idb
 int uRestUI_FoodRequiredToRest;
 int dword_506F14; // weak
 int _506F18_num_minutes_to_sleep; // weak
@@ -957,7 +960,7 @@
 int dword_507B98_ctrl_pressed; // weak
 unsigned int uActiveCharacter;
 int dword_507BF0_is_there_popup_onscreen; // weak
-int dword_507CBC; // weak
+int awards_scroll_bar_created; // weak
 int dword_507CC0_activ_ch; // weak
 __int64 GameUI_RightPanel_BookFlashTimer; // weak
 int _507CD4_RestUI_hourglass_anim_controller; // weak
@@ -995,8 +998,8 @@
 unsigned int uIconID_TurnHour;
 int uIconID_CharacterFrame; // idb
 unsigned int uIconID_TurnStart;
-int dword_50C994; // weak
-int dword_50C998_turnbased_icon_1A; // weak
+int dword_50C994 = 0; // weak
+int dword_50C998_turnbased_icon_1A = 0; // weak
 int uSpriteID_Spell11; // idb
 _UNKNOWN unk_50C9A0; // weak
 int _50C9A8_item_enchantment_timer = 0; // weak
@@ -1137,8 +1140,8 @@
 
 std::array<int, 777> _6807B8_level_decorations_ids; // idb
 int _6807E0_num_decorations_with_sounds_6807B8; // weak
-std::array<int, 777> _6807E8_level_decorations_ids; // idb
-int _6836C8_num_decorations_6807E8; // weak
+std::array<int, 3000> event_triggers;     // 6807E8
+int                   num_event_triggers; // 6836C8
 std::array<int, 64> dword_69B010;
 float flt_69B138_dist; // weak
 char byte_69BD41_unused; // weak
@@ -1380,8 +1383,4 @@
 int dword_F93F20; // weak
 int dword_F93F70; // weak
 
-volatile bool initing;
-
-//int crt_F94004; // weak
-//int crtdword_F9400C; // weak
-FARPROC lpfn; // idb
\ No newline at end of file
+volatile bool initing;
\ No newline at end of file
--- a/mm7_data.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/mm7_data.h	Mon Aug 26 10:39:24 2013 +0600
@@ -570,7 +570,6 @@
 extern std::array<bool, 28> GameMenuUI_InvaligKeyBindingsFlags; // 506E6C
 extern std::array<unsigned int, 27> pPrevVirtualCidesMapping;
 extern int KeyboardPageNum; // weak
-extern std::array<int, 777> dword_506F0C; // idb
 extern int uRestUI_FoodRequiredToRest;
 extern int dword_506F14; // weak
 extern int _506F18_num_minutes_to_sleep; // weak
@@ -603,7 +602,7 @@
 extern int dword_507B98_ctrl_pressed; // weak
 extern unsigned int uActiveCharacter;
 extern int dword_507BF0_is_there_popup_onscreen; // weak
-extern int dword_507CBC; // weak
+extern int awards_scroll_bar_created; // weak
 extern int dword_507CC0_activ_ch; // weak
 extern __int64 GameUI_RightPanel_BookFlashTimer; // weak
 extern int _507CD4_RestUI_hourglass_anim_controller; // weak
@@ -784,8 +783,8 @@
 
 extern std::array<int, 777> _6807B8_level_decorations_ids; // idb
 extern int _6807E0_num_decorations_with_sounds_6807B8; // weak
-extern std::array<int, 777> _6807E8_level_decorations_ids; // idb
-extern int _6836C8_num_decorations_6807E8; // weak
+extern std::array<int, 3000> event_triggers; // 6807E8
+extern int                   num_event_triggers; // 6836C8
 extern std::array<int, 64> dword_69B010;
 extern float flt_69B138_dist; // weak
 extern char byte_69BD41_unused; // weak
@@ -1043,18 +1042,6 @@
 
 extern volatile bool initing; //ADDED
 
-//extern int crt_F94004; // weak
-//extern int crtdword_F9400C; // weak
-extern FARPROC lpfn; // idb
-//extern int crt_F944EC; // weak
-//extern int crtdword_F944F0; // weak
-//extern void *crt_F944F4; // idb
-//extern int crtdword_F944F8; // weak
-//extern LPVOID crt_lpMem; // idb
-//extern int crt_F94500; // weak
-//extern HANDLE crt_hHeap; // idb
-//extern int crt_F94508; // weak
-
 
 
 
@@ -1071,12 +1058,21 @@
 //-------------------------------------------------------------------------
 // Function declarations
 
-#define __thiscall __cdecl // Test compile in C mode
+
+void init_event_triggers();
+void check_event_triggers();
+
+
+
 
-void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int));
+void ShowIntroVideo_and_LoadingScreen();
+unsigned int GameOverMenu(void *ecx0);
+int __fastcall SpawnRandomTreasure(struct MapInfo *a1, struct SpawnPointMM7 *a2);
+void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, struct Vec3_int_ *pVelocity);
+
 void MakeActorAIList_ODM();
-int __cdecl MakeActorAIList_BLV();
-void __cdecl UpdateActorAI();
+int MakeActorAIList_BLV();
+void UpdateActorAI();
 bool __fastcall sub_4070EF_prolly_collide_objects(unsigned int uObjID, unsigned int uObj2ID);
 bool __fastcall sub_4075DB(int a1, int a2, int a3, struct BLVFace *a4);
 bool __fastcall sub_4077F1(int a1, int a2, int a3, struct ODMFace *a4, struct BSPVertexBuffer *a5);
@@ -1084,42 +1080,27 @@
 void InitializeActors();
 void InitializeSpriteObjects();
 int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6);
-unsigned int __thiscall SearchAliveActors(unsigned int *pTotalActors);
-unsigned int __fastcall SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID);
-unsigned int __fastcall SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup);
-unsigned int __fastcall SearchActorByID(unsigned int *pTotalActors, unsigned int a2);
-void  PrepareArcomage();
-
+unsigned int SearchAliveActors(unsigned int *pTotalActors);
+unsigned int SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID);
+unsigned int SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup);
+unsigned int SearchActorByID(unsigned int *pTotalActors, unsigned int a2);
+void PrepareArcomage();
 unsigned short TargetColor(unsigned __int16 r, unsigned __int16 g, unsigned __int16 b); // idb
-void __cdecl CallRenderPresent();
-void __thiscall DoBlt_Copy(unsigned __int16 *pPixels); // idb
-int __stdcall retzero_sub_40DFA7(int); // weak
-int loc_40E4FC(); // weak
+void CallRenderPresent();
+void DoBlt_Copy(unsigned __int16 *pPixels); // idb
 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue);
-
 void __fastcall ZBuffer_DoFill(int *pZBuffer, struct Texture *pTex, int uZValue);
-void __fastcall sub_40F92A(int *pZBuffer, struct Texture *a2, int a3); // idb
-void __cdecl SetMoonPhaseNames();
-signed int __fastcall sub_410D99_get_map_index(int a1);
+void __fastcall ZBuffer_DoFill2(int *pZBuffer, struct Texture *a2, int a3); // idb
+void SetMoonPhaseNames();
+int __fastcall sub_410D99_get_map_index(int a1);
 void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer);
 void SetAttributeNames();
 void uGameUIFontMain_initialize();
 void uGameUIFontShadow_initialize();
-void sub_41420D_press_esc();
-void sub_41426F();
-void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight); // idb
-void DrawCopyrightWindow();
-void LoadFonts_and_DrawCopyrightWindow();
-void GUI_UpdateWindows();
 void identify_item();
-void __thiscall sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(struct Vec2_int_ *_this);
+void sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(struct Vec2_int_ *_this);
 void UI_OnMouseLeftClick(int *pXY); // idb
-void __thiscall sub_417871(int *pXY);
 unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2);
-signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx); // idb
-void FillAwardsData();
-void CreateAwardsScrollBar();
-void sub_419379();
 unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels);
 struct GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey); // idb
 int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall);
@@ -1127,78 +1108,62 @@
 bool UI_OnKeyDown(unsigned int vkKey);
 void GameUI_DrawItemInfo(struct ItemGen* inspect_item); // idb
 void MonsterPopup_Draw(unsigned int uActorID, struct GUIWindow *edx0);
-void __cdecl nullsub_3(); // idb
-void __cdecl LoadActualSkyFrame();
-void __cdecl Sleep6Hours();
-void __cdecl ChestUI_WritePointedObjectStatusString();
-
+void LoadActualSkyFrame();
+void Sleep6Hours();
+void ChestUI_WritePointedObjectStatusString();
 void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal); // idb
 void OnChestLeftClick();
-void __cdecl GameUI_WritePointedObjectStatusString();
-//struct GUIWindow *__thiscall GetCastSpellInInventoryWindow(void *a4);
-bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem();
+void GameUI_WritePointedObjectStatusString();
+bool sub_421B2C_PlaceInInventory_or_DropPickedItem();
 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb
 void OnInventoryLeftClick();
 void OnGameViewportClick();
 bool PauseGameDrawing();
 void SetUserInterface(enum PartyAlignment alignment, bool bReplace);
-void __cdecl reset_some_strus_flt_2Cs();
+void reset_some_strus_flt_2Cs();
 int __fastcall GetPortalScreenCoord(unsigned int uFaceID);
-signed int __fastcall sr_424579(int uFaceID, struct stru320 *a2);
 bool PortalFrustrum(int pNumVertices, struct BspRenderer_PortalViewportData *a2, struct BspRenderer_PortalViewportData *near_portal, int uFaceID);
 int sr_424CD7(unsigned int uVertexID); // idb
-signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID); // idb
-signed int __fastcall sr_4250FE(unsigned int uVertexID); // idb
-bool sr_42620A(struct RenderVertexSoft *p);
+int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID); // idb
 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor); // idb
 int __fastcall _42690D_colors_cvt(unsigned int a1);
-void __cdecl sub_426947();
 void __fastcall GivePartyExp(unsigned int pEXPNum);
 bool __fastcall sub_427769_spell(unsigned int uSpellID);
 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6);
-int __fastcall sub_42EBBE(int, int); // weak
 void _42ECB5_PlayerAttacksActor();
-void __thiscall InitializeTurnBasedAnimations(void *);
-signed int __cdecl sub_42F4DA();
+void  InitializeTurnBasedAnimations(void *);
+int _42F4DA_check_actor_proximity();
 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9);
 void __fastcall sub_42F960_create_object(int x, int y, int z); // idb
 void CompactLayingItemsList();
-signed int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6);
-bool __fastcall sub_42FB5C(signed int a1);
-// int __cdecl crt_sub_42FBB7();
-// void __cdecl crt_construct_50CDB4();
-void __cdecl sub_42FBDD();
-void __cdecl CloseWindowBackground();
-void __cdecl ProcessInputActions();
-void __cdecl GameUI_MsgProc();
-void __cdecl back_to_game();
-void __cdecl GUI_MainMenuMessageProc();
-double __cdecl get_shading_dist_mist();
+int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6);
+bool _42FB5C_check_spell(signed int a1);
+void sub_42FBDD();
+void CloseWindowBackground();
+void ProcessInputActions();
+void GameUI_MsgProc();
+void back_to_game();
+void GUI_MainMenuMessageProc();
+double get_shading_dist_mist();
 void Vec3_short__to_RenderVertexSoft(struct RenderVertexSoft *_this, struct Vec3_short_ *a2);
-void __cdecl nullsub_4(); // idb
-void __cdecl nullsub_5(); // idb
-void __cdecl nullsub_6(); // idb
-void __cdecl area_of_effect__damage_evaluate();
+void area_of_effect__damage_evaluate();
 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, struct Vec3_int_ *pPos, unsigned int a4);
 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2); // idb
 double __fastcall sub_43AE12(signed int a1);
 int __fastcall _43AFE3_calc_spell_damage(int a1, int a2, signed int a3, int a4);
 void __fastcall sub_43B057(unsigned int uObjID, unsigned int uActorID, struct Vec3_int_ *pVelocity);
 void sub_43B1B0(signed int a1, unsigned int a2, struct Vec3_int_ *pVelocity, signed int a4);
-int __stdcall DirectInputKeyboard_enumerator_43B9B9(int, int); // weak
 void Software_ResetNewEdges();
-// int __cdecl crt_deconstruct_43B9E3();
-int __stdcall DirectInputMouse_enumerator(int, int); // weak
 void CharacterUI_LoadPaperdollTextures();
 int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder);
 bool _43ED6F_check_party_races(bool b);
-bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int _this);
+bool  sub_43EDB9_get_some_race_sex_relation_2(unsigned int _this);
 bool __fastcall Player_has_item(unsigned int uItemID, struct Player *pPlayer, char a3);
 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1);
-void  WetsuitOn(unsigned int uPlayerID); // idb
-void  WetsuitOff(unsigned int uPlayerID);
+void WetsuitOn(unsigned int uPlayerID); // idb
+void WetsuitOff(unsigned int uPlayerID);
 void __fastcall PrepareDrawLists_BLV(struct IndoorLocation_drawstru *_this);
-void __cdecl FindBillboardsLightLevels_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);
 void PrepareBspRenderList_BLV();
@@ -1212,199 +1177,110 @@
 __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 __cdecl OnMapLeave();
-void /*__usercall*/ OnMapLoad();
+void LoadLevel_InitializeLevelStr();
+void OnMapLeave();
+void OnMapLoad();
 void Level_LoadEvtAndStr(const char *pLevelName);
-const char *__cdecl sub_444564();
-char *__thiscall GetEventHintString(unsigned int uEventID); // idb
+const char *sub_444564();
+char *GetEventHintString(unsigned int uEventID); // idb
 int GetTravelTime();
 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4);
-void __cdecl sub_4452BB();
-const char *GetProfessionActionText(int a1);
-struct NPCData *__fastcall GetNPCData(signed int npcid);
-struct NPCData * GetNewNPCData(signed int npcid, int* npc_indx);
-int __fastcall GetGreetType(signed int SpeakingNPC_ID);
-void __cdecl DialogueEnding();
-void PrepareHouse(enum HOUSE_ID house); // idb
-bool  EnterHouse(enum HOUSE_ID uHouseID);
-int sub_4465DF_check_season(int a1);
-int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb
-// void __cdecl crt_construct_5773C4();
-int NPC_EventProcessor(int npc_event_id, int entry_line = 0);
-
-void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3);
-void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename);
-void __fastcall SetDecorationSprite(unsigned int uCog, int a2, const char *pFileName); // idb
-void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on);
-void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle);
-void __thiscall GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide); // idb
-void OnTimer(int);
-void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName);
-void __fastcall EventCastSpell(int spellnum, int uSkillLevel, int uSkill, int fromx, int fromy, int fromz, int tox, int toy, int toz);//sub_448DF8
-__int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2); // idb
-bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2);
-void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle); // idb
-void ShowStatusBarString(const char *pString, unsigned int uNumSeconds);
-void __cdecl ShowNothingHereStatus();
-signed int __cdecl const_2();
-bool __cdecl sub_44C28F_open_nwc_dungeon();
-// int __cdecl crt_deconstruct_44C42C();
-void SpawnEncounter(struct MapInfo *pMapInfo, struct SpawnPointMM7 *spawn, int a3, int a4, int a5);
-int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3);
-
-signed int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6);
-int __fastcall _45063B_spawn_some_monster(struct MapInfo *a1, int a2);
-void RespawnGlobalDecorations();
-bool __fastcall SpawnActor(unsigned int uMonsterID);
-int __cdecl GetAlertStatus();
-unsigned int __fastcall sub_452442(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4);
-int integer_sqrt(int val);
-int __fastcall MakeColorMaskFromBitDepth(int a1);
-void __fastcall fill_pixels_fast(unsigned int a1, unsigned __int16 *pPixels, unsigned int uNumPixels);
-int __fastcall GetDiceResult(unsigned int uNumDice, unsigned int uDiceSides); // idb
-inline int round(float x) { return (int)floor(x + 0.5f); }
-inline void __fastcall memset32(void *ptr, unsigned __int32 value, int count)
-{
-  auto p = (unsigned __int32 *)ptr;
-  for ( int i=0; i < count; i++ )
-    *p++ = value;
-}
-inline void __fastcall j_memset32(int a2, void *a1, unsigned int a3) {memset32(a1, a2, a3);}
-// int __cdecl crt_452B74();
-int __cdecl j_SetSomeItemsNames();
-
-
 int SkillToMastery(unsigned int skill_value);
 unsigned int __fastcall GetSpellColor(signed int a1);
-void *__thiscall unknown_vdtor_6(void *_this, bool a2);
 unsigned short * MakeScreenshot(signed int width, signed int height);
-void __thiscall SaveScreenshot(const char *pFilename);
+void SaveScreenshot(const char *pFilename);
 void __fastcall LoadGame(unsigned int uSlot); // idb
 void SaveGame(bool IsAutoSAve, bool NotSaveWorld);
 void __fastcall DoSavegame(unsigned int uSlot); // idb
-void __cdecl TryLoadLevelFromLOD();
-void __cdecl sub_46080D();
-bool __cdecl Initialize_GamesLOD_NewLOD();
+void TryLoadLevelFromLOD();
+void sub_46080D();
+bool Initialize_GamesLOD_NewLOD();
 void SaveNewGame();
-void __thiscall PrepareToLoadBLV(unsigned int bLoading);
+void PrepareToLoadBLV(unsigned int bLoading);
 void __fastcall PrepareToLoadODM(unsigned int bLoading, struct OutdoorCamera *a2);
-void __cdecl sub_461103();
-int __cdecl sub_4613C4();
+void _461103_load_level_sub();
 int int_get_vector_length(signed int x, signed int y, signed int z);
-int __cdecl sub_46224A();
-int __cdecl crt_init_globals_462620();
-void __cdecl crt_init_globals_462659();
-void __cdecl crt_init_globals_46269B();
-void __cdecl crt_init_globals_46271C();
-void __cdecl MainMenu_Loop();
-char __cdecl sub_4637E0_is_there_popup_onscreen();
-void __cdecl ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
-void __thiscall PrepareWorld(unsigned int _this);
-void __thiscall Game_DeinitializeAndTerminate(int exitCode); // idb
-void __cdecl FinalInitialization();
-char __cdecl Is_out15odm_underwater();
-void __cdecl SetUnderwaterFog();
-void __fastcall DoPrepareWorld(unsigned int bLoading, int a2);
+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);
 int __fastcall ReadWindowsRegistryInt(const char *pKey, int uDefValue); // idb
 void __fastcall WriteWindowsRegistryString(const char *pKey, const char *pString);
 void __fastcall ReadWindowsRegistryString(const char *pKeyName, char *pOutString, int uBufLen, const char *pDefaultValue);
 void __fastcall WriteWindowsRegistryInt(const char *pKey, int val);
 bool __fastcall CheckMM7CD(char c);
-int loc_465CC8(); // weak
-void __cdecl SecondaryInitialization();
-void __cdecl CreateAsyncMouse();
-void __cdecl CreateAsyncKeyboard();
-void __cdecl MM6_Initialize(const wchar_t *pIniFilename);
-void __cdecl MM7Initialization();
-int __cdecl AbortWithError();
+void SecondaryInitialization();
+void CreateAsyncMouse();
+void CreateAsyncKeyboard();
+void MM6_Initialize(const wchar_t *pIniFilename);
+void MM7Initialization();
+int AbortWithError();
 void Abortf(const char *Format, ...);
 void SetCurrentMenuID(enum MENU_STATE); // idb
 enum MENU_STATE GetCurrentMenuID();
-void *__thiscall output_debug_string(void *_this, std::string a2, const char *a3, int a4);
-std::string *__fastcall _4678E2_make_error_string(std::string *a1, int line, std::string file);
-void  CreateMsgScrollWindow(signed int mscroll_id);
-void __cdecl free_book_subwindow();
-void  CreateScrollWindow();
-void __cdecl OnPaperdollLeftClick();
+void CreateMsgScrollWindow(signed int mscroll_id);
+void free_book_subwindow();
+void CreateScrollWindow();
+void OnPaperdollLeftClick();
 void OnPressSpace();
 char __fastcall DoInteractionWithTopmostZObject(int a1, int a2);
-int __fastcall sub_46A6AC(int a1, int a2, int a3);
-int __fastcall sub_46A7C8(int a1, int a2, signed int a3);
-int __fastcall sub_46A89E(int a1, int a2, signed int a3);
-int __cdecl sub_46A99B();
-void *__thiscall unknown_libname_8(void *_this, char a2);
-unsigned int __cdecl GetGravityStrength();
-void __cdecl UpdateUserInput_and_MapSpecificStuff();
-void __cdecl BLV_UpdateUserInputAndOther();
-void __cdecl ODM_UpdateUserInputAndOther();
-bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2);
-void __cdecl check_event_triggers();
-int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID);
-int ODM_GetFloorLevel(int X, signed int Y, int Z, int, int *pOnWater, int *bmodel_pid, int bWaterWalk);
-int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4);
-void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out);
-unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID);
-int __fastcall _46DF1A_collide_against_actor(int, int); // weak
-void __cdecl _46E0B2_collide_against_decorations();
-void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2);
-int __thiscall _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
-void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this);
-int __thiscall _46EF01_collision_chech_player(int a1); // idb
-signed int __cdecl _46F04E_collide_against_portals();
-void BLV_UpdateDoors();
-void UpdateActors_BLV();
-void UpdateActors_ODM();
-void UpdateObjects();
-int collide_against_floor_approximate(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID); // idb
-void BLV_ProcessPartyActions();
-void ODM_ProcessPartyActions();
-bool __fastcall sub_47531C(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10);
-bool __fastcall sub_4754BF(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10, int a11);
-signed int __thiscall sub_475665(BLVFace *_this, int a2, __int16 a3);
-bool __fastcall sub_4759C9(BLVFace *a1, int a2, int a3, __int16 a4);
-bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, BLVFace *a4);
-bool __fastcall sub_475F30(int *a1, BLVFace *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9);
-
-int __cdecl GetPartyReputation();
-void __cdecl sub_4783FA_construct_global_73D150();
-void __cdecl loc_4789D4(); // idb
-void __cdecl loc_47907F(); // idb
+int GetPartyReputation();
+void OracleDialogue();
+void __fastcall ClickNPCTopic(signed int uMessageParam);
+char * _4B254D_SkillMasteryTeacher(int _this);
+const char *ContractSelectText(int pEventCode);
+void SimpleHouseAndBoatsDialog();
+void CreateButtonInColumn(int a1, unsigned int a2);
+void FillAviableSkillsToTeach(int _this);
+void sub_4B3E1E();
+void DrawJoinGuildWindow(int pEventCode);
+void __fastcall sub_4B3FE5(int a4);
+void NPCHireableDialogPrepare();
+void _4B4224_UpdateNPCTopics(int _this);
+void __fastcall DrawTextAtStatusBar(const char *Str, int a5);
+__int64 GetExperienceRequiredForLevel(int a1);
+const char *sub_4BBA85_bounties();
+void sub_4BBCDD();
+void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z); // idb
+void ArenaFight();
+void SpellBookGenerator();
+void UI_CreateEndConversationButton();
+void __fastcall OnSelectShopDialogueOption(signed int uMessageParam);
+int sub_4BD8B5();
+bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx);
+void UIShop_Buy_Identify_Repair();
 bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused);
-void __thiscall ODM_LoadAndInitialize(const char *pLevelFilename, struct OutdoorCamera *thisa);
+void ODM_LoadAndInitialize(const char *pLevelFilename, struct OutdoorCamera *thisa);
 unsigned int GetLevelFogColor();
 int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3);
-signed int __fastcall GetActorTintColor(int max_dim, int min_dim, float distance, int a4, struct RenderBillboard *a5);
+int __fastcall GetActorTintColor(int max_dim, int min_dim, float distance, int a4, struct RenderBillboard *a5);
 unsigned int WorldPosToGridCellX(int); // weak
 unsigned int WorldPosToGridCellZ(int); // weak
-int __stdcall GridCellToWorldPosX(int); // weak
-int __stdcall GridCellToWorldPosZ(int); // weak
-void __cdecl loc_48118F(); // idb
-void __cdecl loc_481199(); // idb
+int GridCellToWorldPosX(int); // weak
+int GridCellToWorldPosZ(int); // weak
 void ResetPolygons();
-void __cdecl sub_481ED9_MessWithOutdoorCamera();
+void sub_481ED9_MessWithOutdoorCamera();
 bool IsTerrainSlopeTooHigh(int pos_x, int pos_y);
 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *a3, int a4);
-signed int __cdecl const_1_0();
-void __cdecl sub_487DA9();
-double __thiscall GetFogDensityByTime(struct OutdoorLocation *_this);
-int __stdcall loc_489BB3(struct stru320 *a2, int thisa, unsigned int uNumVertices, RenderVertexSoft *a5, float a6, char uClipFlag); // weak
+void sub_487DA9();
+double GetFogDensityByTime(struct OutdoorLocation *_this);
 bool __fastcall HSV2RGB(float *a1, float *a2, float *a3, float a4, float a5, float a6);
 void __fastcall RGB2HSV(float *a1, float *a2, float a3, float a4, float a5, float *a6);
 unsigned int ReplaceHSV(unsigned int uColor, float a2, float gamma, float a4);
-signed int __cdecl PlayerCreation_Chose4Skills();
-signed int __cdecl PlayerCreation_GetUnspentAttributePointCount();
+int PlayerCreation_Choose4Skills();
+int PlayerCreation_GetUnspentAttributePointCount();
 void LoadPlayerPortraintsAndVoices();
 int __fastcall ReloadPlayerPortraits(int, int); // weak
 void sub_491E3A();
-signed int __thiscall CycleCharacter(unsigned int _this);
+int CycleCharacter(bool backwards);
 void __fastcall Rest(unsigned int uHoursToSleep);
 int _493938_regenerate();
-void sub_493F79(struct stru351_summoned_item *_this, __int64 a2);
+void init_summoned_item(struct stru351_summoned_item *_this, __int64 duration);
 void _494035_timed_effects__water_walking_damage__etc();
 unsigned int __fastcall _494820_training_time(unsigned int a1);
 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2);
@@ -1425,51 +1301,100 @@
 unsigned int ModulateColor(unsigned int diffuse, float multiplier); // idb
 struct SoundHeader *FindSound_BinSearch(unsigned int uStart, unsigned int uEnd, const char *pName);
 struct SoundData *LoadSound(const char *pSoundName, struct SoundData *pOutBuff, unsigned int uID);
-int __fastcall sub_4AAEA6_transform(RenderVertexSoft *a1);
+int __fastcall sub_4AAEA6_transform(struct RenderVertexSoft *a1);
 int __fastcall sub_4AB66C(int, int); // weak
 int GetSoundStrengthByDistanceFromParty(int x, int y, int z);
 struct _DIG_DRIVER *Audio_GetFirstHardwareDigitalDriver(void);
-void __cdecl PlayLevelMusic();
+void PlayLevelMusic();
 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID); // idb
 struct Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3);
-void __thiscall sub_4B1523(int *_this);
-void __cdecl ShowPopupShopItem();
-void __stdcall RestAndHeal(__int64 uNumMinutes); // idb
-void __cdecl GetHouseGoodbyeSpeech();
-
-void __cdecl sub_4B1ECE();
-void __fastcall ClickNPCTopic(signed int uMessageParam);
-char *__thiscall _4B254D_SkillMasteryTeacher(int _this);
-const char * ContractSelectText(int pEventCode);
-void SimpleHouseAndBoatsDialog();
-void  CreateButtonInColumn(int a1, unsigned int a2);
-void FillAviableSkillsToTeach(int _this);
-void __cdecl sub_4B3E1E();
-void DrawJoinGuildWindow(int pEventCode);
-void __fastcall sub_4B3FE5(int a4);
-void NPCHireableDialogPrepare();
-void _4B4224_UpdateNPCTopics(int _this);
-void __fastcall DrawTextAtStatusBar(const char *Str, int a5);
-int __fastcall sub_4B46F8(int a1);
-
-const char *sub_4BBA85_bounties();
-void __cdecl sub_4BBCDD();
-void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z); // idb
-void __cdecl ArenaFight();
-void  SpellBookGenerator();
-void UI_CreateEndConversationButton();
-void __fastcall OnSelectShopDialogueOption(signed int uMessageParam);
-signed int __cdecl sub_4BD8B5();
-bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx);
-void __cdecl UIShop_Buy_Identify_Repair();
-
-
-void __cdecl ShowIntroVideo_and_LoadingScreen();
-unsigned int __thiscall GameOverMenu(void *ecx0);
-bool __thiscall BinkLockBuffer(struct _BINKBUF *_this);
-void __thiscall BinkUnlockBuffer(struct _BINKBUF *_this);
-signed int __fastcall SpawnRandomTreasure(struct MapInfo *a1, struct SpawnPointMM7 *a2);
-void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, struct Vec3_int_ *pVelocity);
+void sub_4B1523(int *_this);
+void ShowPopupShopItem();
+void RestAndHeal(__int64 uNumMinutes); // idb
+void GetHouseGoodbyeSpeech();
+int __fastcall _46A6AC_spell_render(int a1, int a2, int a3);
+int __fastcall _46A6AC_spell_render_d3d(int a1, int a2, int a3);
+int __fastcall _46A89E_immolation_effect(int a1, int a2, int a3);
+int sub_46A99B();
+unsigned int GetGravityStrength();
+void UpdateUserInput_and_MapSpecificStuff();
+void BLV_UpdateUserInputAndOther();
+void ODM_UpdateUserInputAndOther();
+bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2);
+int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID);
+int ODM_GetFloorLevel(int X, signed int Y, int Z, int, int *pOnWater, int *bmodel_pid, int bWaterWalk);
+int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4);
+void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out);
+unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID);
+int __fastcall _46DF1A_collide_against_actor(int, int); // weak
+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
+void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this);
+int _46EF01_collision_chech_player(int a1); // idb
+int _46F04E_collide_against_portals();
+void BLV_UpdateDoors();
+void UpdateActors_BLV();
+void UpdateActors_ODM();
+void UpdateObjects();
+int collide_against_floor_approximate(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID); // idb
+void BLV_ProcessPartyActions();
+void ODM_ProcessPartyActions();
+bool __fastcall sub_47531C(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, struct BLVFace *a9, int a10);
+bool __fastcall sub_4754BF(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, struct BLVFace *a9, int a10, int a11);
+int sub_475665(struct BLVFace *_this, int a2, __int16 a3);
+bool __fastcall sub_4759C9(struct BLVFace *a1, int a2, int a3, __int16 a4);
+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();
+const char *GetProfessionActionText(int a1);
+struct NPCData *__fastcall GetNPCData(signed int npcid);
+struct NPCData * GetNewNPCData(signed int npcid, int* npc_indx);
+int __fastcall GetGreetType(signed int SpeakingNPC_ID);
+void  DialogueEnding();
+void PrepareHouse(enum HOUSE_ID house); // idb
+bool EnterHouse(enum HOUSE_ID uHouseID);
+int sub_4465DF_check_season(int a1);
+int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb
+int NPC_EventProcessor(int npc_event_id, int entry_line = 0);
+void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3);
+void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename);
+void __fastcall SetDecorationSprite(unsigned int uCog, int a2, const char *pFileName); // idb
+void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on);
+void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle);
+void  GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide); // idb
+void OnTimer(int);
+void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName);
+void __fastcall EventCastSpell(int spellnum, int uSkillLevel, int uSkill, int fromx, int fromy, int fromz, int tox, int toy, int toz);//sub_448DF8
+__int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2); // idb
+bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2);
+void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle); // idb
+void ShowStatusBarString(const char *pString, unsigned int uNumSeconds);
+void ShowNothingHereStatus();
+int const_2();
+bool TeleportToNWCDungeon();
+void SpawnEncounter(struct MapInfo *pMapInfo, struct SpawnPointMM7 *spawn, int a3, int a4, int a5);
+int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3);
+int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6);
+int __fastcall _45063B_spawn_some_monster(struct MapInfo *a1, int a2);
+void RespawnGlobalDecorations();
+bool __fastcall SpawnActor(unsigned int uMonsterID);
+int GetAlertStatus();
+unsigned int __fastcall sub_452442(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4);
+int integer_sqrt(int val);
+int __fastcall MakeColorMaskFromBitDepth(int a1);
+void __fastcall fill_pixels_fast(unsigned int a1, unsigned __int16 *pPixels, unsigned int uNumPixels);
+int __fastcall GetDiceResult(unsigned int uNumDice, unsigned int uDiceSides); // idb
+inline int round(float x) { return (int)floor(x + 0.5f); }
+inline void __fastcall memset32(void *ptr, unsigned __int32 value, int count)
+{
+  auto p = (unsigned __int32 *)ptr;
+  for ( int i=0; i < count; i++ )
+    *p++ = value;
+}
+inline void __fastcall j_memset32(int a2, void *a1, unsigned int a3) {memset32(a1, a2, a3);}
 
 
 #define ErrD3D(hr) do {extern void ErrHR(HRESULT, const char *, const char *, const char *, int); ErrHR(hr, "Direct3D", __FUNCTION__, __FILE__, __LINE__);} while(0)
--- a/mm7text_ru.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/mm7text_ru.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -1161,7 +1161,7 @@
   return nullptr;
 }
 
-int __cdecl sprintfex_internal(char *str)
+int  sprintfex_internal(char *str)
 {
   auto p = strstr(str, "^");
   if (!p)
--- a/stru10.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/stru10.h	Mon Aug 26 10:39:24 2013 +0600
@@ -17,7 +17,7 @@
   void _49CE9E(struct BLVFace *pFace, struct RenderVertexSoft *pVertices, unsigned int uNumVertices, RenderVertexSoft *pOutLimits);
 
 
-  void (__thiscall ***vdestructor_ptr)(stru10 *, bool);
+  void ( ***vdestructor_ptr)(stru10 *, bool);
   int bDoNotDrawPortalFrustum;
 };
 #pragma pack(pop)
--- a/stru6.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/stru6.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -28,6 +28,80 @@
 
 
 
+//----- (0042620A) --------------------------------------------------------
+bool sr_42620A(RenderVertexSoft *p)
+{
+  __int16 v1; // fps@1
+  unsigned __int8 v2; // c0@2
+  char v3; // c2@2
+  unsigned __int8 v4; // c3@2
+  bool result; // eax@2
+  unsigned __int8 v6; // c0@4
+  char v7; // c2@4
+  unsigned __int8 v8; // c3@4
+  unsigned __int8 v9; // c0@6
+  char v10; // c2@6
+  unsigned __int8 v11; // c3@6
+  double v12; // st6@7
+  float v13; // ST04_4@7
+  float v14; // ST00_4@7
+  double v15; // st7@7
+  double v16; // st6@8
+  float v17; // ST04_4@8
+  float v18; // ST00_4@8
+  double v19; // st7@8
+
+  //UNDEF(v1);
+  if ( p->vWorldViewPosition.x < 300.0
+    || (v2 = 300.0 < p[1].vWorldViewPosition.x,
+        v3 = 0,
+        v4 = 300.0 == p[1].vWorldViewPosition.x,
+        //BYTE1(result) = HIBYTE(v1),
+        !(v2 | v4)) )
+  {
+    if ( p->vWorldViewPosition.x < 300.0 )
+    {
+      v6 = 300.0 < p[1].vWorldViewPosition.x;
+      v7 = 0;
+      v8 = 300.0 == p[1].vWorldViewPosition.x;
+      //BYTE1(result) = HIBYTE(v1);
+      if ( !(v6 | v8) )
+      {
+        //LOBYTE(result) = 0;
+        return false;
+      }
+    }
+    v9 = 300.0 < p->vWorldViewPosition.x;
+    v10 = 0;
+    v11 = 300.0 == p->vWorldViewPosition.x;
+    //BYTE1(result) = HIBYTE(v1);
+    if ( v9 | v11 )
+    {
+      v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x);
+      v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16;
+      v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16;
+      v19 = 300.0 - p[1].vWorldViewPosition.x;
+      p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x;
+      p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y;
+      p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z;
+    }
+    else
+    {
+      v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x);
+      v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12;
+      v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12;
+      v15 = 300.0 - p->vWorldViewPosition.x;
+      p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x;
+      p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y;
+      p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z;
+    }
+  }
+  //LOBYTE(result) = 1;
+  return true;
+}
+
+
+
 //----- (004775C4) --------------------------------------------------------
 stru6_stru1_indoor_sw_billboard::~stru6_stru1_indoor_sw_billboard()
 {
--- a/stru9.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/stru9.h	Mon Aug 26 10:39:24 2013 +0600
@@ -58,6 +58,6 @@
   bool AreVectorsCollinear(struct RenderVertexSoft *a1, struct RenderVertexSoft *a2, struct stru312 *a3);
   bool _4989E1(struct RenderVertexSoft *a1, struct RenderVertexSoft *a2, struct RenderVertexSoft *a3, struct stru312 *a4);
 
-  void (__thiscall ***vdestructor_ptr)(stru9 *, bool);
+  void ( ***vdestructor_ptr)(stru9 *, bool);
 };
 #pragma pack(pop)
\ No newline at end of file
--- a/texts.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/texts.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -18,7 +18,7 @@
 
 
 
-int __cdecl sprintfex(char *buf, const char *format, ...)
+int  sprintfex(char *buf, const char *format, ...)
 {
   va_list args_ptr;
   va_start(args_ptr, format);
@@ -27,12 +27,12 @@
   }
   va_end(args_ptr);
 
-  extern int __cdecl sprintfex_internal(char *buf);
+  extern int  sprintfex_internal(char *buf);
   return sprintfex_internal(buf);
 }
 
 //----- (00452B95) --------------------------------------------------------
-void __cdecl SetSomeItemsNames()
+void  SetSomeItemsNames()
 {
 	pSomeItemsNames[0] = pGlobalTXT_LocalizationStrings[568];
 	pSomeItemsNames[1] = pGlobalTXT_LocalizationStrings[271];
@@ -442,7 +442,7 @@
   aAttributeNames[6] = pGlobalTXT_LocalizationStrings[136];
 }
 //----- (00410AF5) --------------------------------------------------------
-void __cdecl SetMoonPhaseNames()
+void SetMoonPhaseNames()
 {
   aMoonPhaseNames[0] = pGlobalTXT_LocalizationStrings[150];
   aMoonPhaseNames[1] = pGlobalTXT_LocalizationStrings[171];
--- a/texts.h	Mon Aug 26 10:39:10 2013 +0600
+++ b/texts.h	Mon Aug 26 10:39:24 2013 +0600
@@ -2,12 +2,12 @@
 #include <array>
 
 
-int __cdecl sprintfex(char *buf, const char *format, ...);
+int  sprintfex(char *buf, const char *format, ...);
 
 
-void __cdecl SetSomeItemsNames();
+void  SetSomeItemsNames();
 char *RemoveQuotes(char *Str);
-void __cdecl InitializeGameText();
+void  InitializeGameText();
 
 
 enum GLOBAL_LOCALIZ_INDEX