changeset 1459:2ca62c9e7b3c

Function names
author Nomad
date Wed, 21 Aug 2013 16:06:50 +0200
parents 934074e7fcc1
children 845907a747d3 0a7ceb4b25b7
files AudioPlayer.h CastSpellInfo.cpp GUIWindow.cpp Keyboard.cpp NPC.cpp Party.cpp Player.cpp UI/UIHouses.cpp UI/UIPartyCreation.cpp UI/UIPopup.cpp UI/UiGame.cpp VideoPlayer.cpp mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp mm7_data.cpp mm7_data.h stru6.cpp
diffstat 21 files changed, 410 insertions(+), 510 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.h	Wed Aug 21 14:26:36 2013 +0200
+++ b/AudioPlayer.h	Wed Aug 21 16:06:50 2013 +0200
@@ -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,
--- a/CastSpellInfo.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/CastSpellInfo.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -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/GUIWindow.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/GUIWindow.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -282,7 +282,7 @@
 		{
 		pIcons_LOD->SyncLoadedFilesCount();
 		pCurrentScreen = pMainScreenNum;
-		pKeyActionMap->SetWindowInputStatus(3);
+		pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
 		break;
 		}
 	case WINDOW_HouseInterior:
--- a/Keyboard.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/Keyboard.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -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/NPC.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/NPC.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -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
         { 
--- a/Party.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/Party.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -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
--- a/Player.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/Player.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -162,7 +162,7 @@
 
 
 //----- (00490913) --------------------------------------------------------
-signed int  PlayerCreation_GetUnspentAttributePointCount()
+int PlayerCreation_GetUnspentAttributePointCount()
 {
   signed int v0; // edi@1
   int raceId; // ebx@2
@@ -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
@@ -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 )
--- a/UI/UIHouses.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/UI/UIHouses.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -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)
 		{
--- a/UI/UIPartyCreation.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/UI/UIPartyCreation.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -25,7 +25,7 @@
 
 
 //----- (004908DE) --------------------------------------------------------
-signed int  PlayerCreation_Chose4Skills()
+int PlayerCreation_Choose4Skills()
     {
     Player *v0; // esi@1
     signed int v1; // edx@2
--- a/UI/UIPopup.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/UI/UIPopup.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -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 )
@@ -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());
--- a/UI/UiGame.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/UI/UiGame.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -809,7 +809,7 @@
   }
   if ( pKeyActionMap->pPressedKeysBuffer[0] )
   {
-    pKeyActionMap->SetWindowInputStatus(0);
+    pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
     goto LABEL_15;
   }
 }
--- a/VideoPlayer.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/VideoPlayer.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -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)
--- a/mm7_1.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/mm7_1.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -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	Wed Aug 21 14:26:36 2013 +0200
+++ b/mm7_2.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -598,7 +598,7 @@
 }
 
 //----- (004BD8B5) --------------------------------------------------------
-signed int  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;
@@ -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
@@ -3034,7 +3034,7 @@
 // 6BE35C: using guessed type int uLevel_StartingPointType;
 
 //----- (00461103) --------------------------------------------------------
-void  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  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)
@@ -4165,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
@@ -4180,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();
 }
@@ -5774,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
@@ -5800,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;
@@ -5862,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
@@ -5931,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
--- a/mm7_3.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/mm7_3.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -673,7 +673,7 @@
 }
 
 //----- (0046F04E) --------------------------------------------------------
-signed int  _46F04E_collide_against_portals()
+int _46F04E_collide_against_portals()
 {
   BLVSector *v0; // ecx@1
   unsigned int v1; // eax@1
@@ -3348,7 +3348,7 @@
 }
 
 //----- (00475665) --------------------------------------------------------
-signed int  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  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;
 }
@@ -6189,12 +6172,6 @@
     return y_x1z1;
 }
 
-//----- (00482A90) --------------------------------------------------------
-signed int  const_1_0()
-{
-  return 1;
-}
-
 
 
 
@@ -7797,32 +7774,29 @@
 }
 
 //----- (0044C28B) --------------------------------------------------------
-signed int  const_2()
+int const_2()
 {
   return 2;
 }
 
 //----- (0044C28F) --------------------------------------------------------
-bool  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) --------------------------------------------------------
--- a/mm7_4.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/mm7_4.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -47,7 +47,7 @@
 #include "Lights.h"
 
 //----- (0046CC4B) --------------------------------------------------------
-void  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;
@@ -597,7 +597,7 @@
 }
 
 //----- (00491E3A) --------------------------------------------------------
-void  sub_491E3A()
+void sub_491E3A()
 {
   Player *v0; // ebx@1
   signed int v1; // esi@3
@@ -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 )
@@ -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());
@@ -3009,7 +3008,7 @@
 }
 
 //----- (004B1ECE) --------------------------------------------------------
-void  sub_4B1ECE()
+void OracleDialogue()
 {
   __int16 *v0; // edi@1
   int v1; // ebx@3
@@ -3103,10 +3102,6 @@
 	  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 * _4B254D_SkillMasteryTeacher(int _this)
@@ -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	Wed Aug 21 14:26:36 2013 +0200
+++ b/mm7_5.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -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;
@@ -3388,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;
@@ -4872,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;
 }
 
--- a/mm7_6.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/mm7_6.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -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  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)
--- a/mm7_data.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/mm7_data.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -998,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
@@ -1140,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
--- a/mm7_data.h	Wed Aug 21 14:26:36 2013 +0200
+++ b/mm7_data.h	Wed Aug 21 16:06:50 2013 +0200
@@ -783,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
@@ -1058,249 +1058,16 @@
 //-------------------------------------------------------------------------
 // Function declarations
 
-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
-// void  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  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();
-signed int  const_2();
-bool  sub_44C28F_open_nwc_dungeon();
-// int  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  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  crt_452B74();
-int  j_SetSomeItemsNames();
+void init_event_triggers();
+void check_event_triggers();
 
 
-int SkillToMastery(unsigned int skill_value);
-unsigned int __fastcall GetSpellColor(signed int a1);
-void * unknown_vdtor_6(void *_this, bool a2);
-unsigned short * MakeScreenshot(signed int width, signed int height);
-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  TryLoadLevelFromLOD();
-void  sub_46080D();
-bool  Initialize_GamesLOD_NewLOD();
-void SaveNewGame();
-void  PrepareToLoadBLV(unsigned int bLoading);
-void __fastcall PrepareToLoadODM(unsigned int bLoading, struct OutdoorCamera *a2);
-void  sub_461103();
-int  sub_4613C4();
-int int_get_vector_length(signed int x, signed int y, signed int z);
-int  sub_46224A();
-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  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 * 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  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  sub_46A99B();
-void * unknown_libname_8(void *_this, char a2);
-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);
-void  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  _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
-signed 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);
-signed 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);
-
-int  GetPartyReputation();
-void  sub_4783FA_construct_global_73D150();
-void  loc_4789D4(); // idb
-void  loc_47907F(); // idb
-bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused);
-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);
-unsigned int WorldPosToGridCellX(int); // weak
-unsigned int WorldPosToGridCellZ(int); // weak
-int __stdcall GridCellToWorldPosX(int); // weak
-int __stdcall GridCellToWorldPosZ(int); // weak
-void  loc_48118F(); // idb
-void  loc_481199(); // idb
-void ResetPolygons();
-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  const_1_0();
-void  sub_487DA9();
-double  GetFogDensityByTime(struct OutdoorLocation *_this);
-int __stdcall loc_489BB3(struct stru320 *a2, int thisa, unsigned int uNumVertices, struct RenderVertexSoft *a5, float a6, char uClipFlag); // weak
-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  PlayerCreation_Chose4Skills();
-signed int  PlayerCreation_GetUnspentAttributePointCount();
-void LoadPlayerPortraintsAndVoices();
-int __fastcall ReloadPlayerPortraits(int, int); // weak
-void sub_491E3A();
-signed int  CycleCharacter(unsigned int _this);
-void __fastcall Rest(unsigned int uHoursToSleep);
-int _493938_regenerate();
-void sub_493F79(struct stru351_summoned_item *_this, __int64 a2);
-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);
-char *GetReputationString(signed int a1);
-char *BuildDialogueString(char *lpsz, unsigned __int8 uPlayerID, struct ItemGen *a3, char *a4, int a5, __int64 *a6);
-void PlayerCreationUI_Draw();
-void PlayerCreationUI_Initialize();
-void DeleteCCharFont();
-bool PlayerCreationUI_Loop();
-unsigned int __fastcall GetMaxMipLevels(unsigned int uDim);
-bool CheckTextureStages();
-bool AreRenderSurfacesOk();
-unsigned int BlendColors(unsigned int c1, unsigned int c2); // weak
-void DoRenderBillboards_D3D();
-int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int z, int a4, unsigned int lightColor);
-void Present_ColorKey();
-void Present_NoColorKey();
-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(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  PlayLevelMusic();
-unsigned int __fastcall sub_4B0E07(unsigned int uFaceID); // idb
-struct Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3);
-void  sub_4B1523(int *_this);
-void  ShowPopupShopItem();
-void __stdcall RestAndHeal(__int64 uNumMinutes); // idb
-void  GetHouseGoodbyeSpeech();
-
-void  sub_4B1ECE();
-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);
-int __fastcall sub_4B46F8(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);
-signed int  sub_4BD8B5();
-bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx);
-void  UIShop_Buy_Identify_Repair();
 
 
-void  ShowIntroVideo_and_LoadingScreen();
-unsigned int  GameOverMenu(void *ecx0);
-bool  BinkLockBuffer(struct _BINKBUF *_this);
-void  BinkUnlockBuffer(struct _BINKBUF *_this);
-signed int __fastcall SpawnRandomTreasure(struct MapInfo *a1, struct SpawnPointMM7 *a2);
+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();
@@ -1321,7 +1088,6 @@
 unsigned short TargetColor(unsigned __int16 r, unsigned __int16 g, unsigned __int16 b); // idb
 void CallRenderPresent();
 void DoBlt_Copy(unsigned __int16 *pPixels); // idb
-int loc_40E4FC(); // weak
 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue);
 void __fastcall ZBuffer_DoFill(int *pZBuffer, struct Texture *pTex, int uZValue);
 void __fastcall ZBuffer_DoFill2(int *pZBuffer, struct Texture *a2, int a3); // idb
@@ -1345,11 +1111,9 @@
 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 GameUI_WritePointedObjectStatusString();
-//struct GUIWindow * GetCastSpellInInventoryWindow(void *a4);
 bool sub_421B2C_PlaceInInventory_or_DropPickedItem();
 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb
 void OnInventoryLeftClick();
@@ -1358,19 +1122,14 @@
 void SetUserInterface(enum PartyAlignment alignment, bool bReplace);
 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  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  InitializeTurnBasedAnimations(void *);
 int _42F4DA_check_actor_proximity();
@@ -1426,6 +1185,217 @@
 char *GetEventHintString(unsigned int uEventID); // idb
 int GetTravelTime();
 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4);
+int SkillToMastery(unsigned int skill_value);
+unsigned int __fastcall GetSpellColor(signed int a1);
+unsigned short * MakeScreenshot(signed int width, signed int height);
+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 TryLoadLevelFromLOD();
+void sub_46080D();
+bool Initialize_GamesLOD_NewLOD();
+void SaveNewGame();
+void PrepareToLoadBLV(unsigned int bLoading);
+void __fastcall PrepareToLoadODM(unsigned int bLoading, struct OutdoorCamera *a2);
+void _461103_load_level_sub();
+int int_get_vector_length(signed int x, signed int y, signed int z);
+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);
+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 CreateMsgScrollWindow(signed int mscroll_id);
+void free_book_subwindow();
+void CreateScrollWindow();
+void OnPaperdollLeftClick();
+void OnPressSpace();
+char __fastcall DoInteractionWithTopmostZObject(int a1, int a2);
+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 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);
+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 GridCellToWorldPosX(int); // weak
+int GridCellToWorldPosZ(int); // weak
+void ResetPolygons();
+void sub_481ED9_MessWithOutdoorCamera();
+bool IsTerrainSlopeTooHigh(int pos_x, int pos_y);
+int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *a3, int a4);
+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);
+int PlayerCreation_Choose4Skills();
+int PlayerCreation_GetUnspentAttributePointCount();
+void LoadPlayerPortraintsAndVoices();
+int __fastcall ReloadPlayerPortraits(int, int); // weak
+void sub_491E3A();
+int CycleCharacter(bool backwards);
+void __fastcall Rest(unsigned int uHoursToSleep);
+int _493938_regenerate();
+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);
+char *GetReputationString(signed int a1);
+char *BuildDialogueString(char *lpsz, unsigned __int8 uPlayerID, struct ItemGen *a3, char *a4, int a5, __int64 *a6);
+void PlayerCreationUI_Draw();
+void PlayerCreationUI_Initialize();
+void DeleteCCharFont();
+bool PlayerCreationUI_Loop();
+unsigned int __fastcall GetMaxMipLevels(unsigned int uDim);
+bool CheckTextureStages();
+bool AreRenderSurfacesOk();
+unsigned int BlendColors(unsigned int c1, unsigned int c2); // weak
+void DoRenderBillboards_D3D();
+int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int z, int a4, unsigned int lightColor);
+void Present_ColorKey();
+void Present_NoColorKey();
+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(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 PlayLevelMusic();
+unsigned int __fastcall sub_4B0E07(unsigned int uFaceID); // idb
+struct Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3);
+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/stru6.cpp	Wed Aug 21 14:26:36 2013 +0200
+++ b/stru6.cpp	Wed Aug 21 16:06:50 2013 +0200
@@ -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()
 {