changeset 396:4a60371fd70c

Слияние
author Ritor1
date Fri, 22 Feb 2013 21:47:55 +0600
parents 6c3f8694005f (current diff) edd2d8b7e3c4 (diff)
children 5fd328336048
files Party.cpp mm7_4.cpp
diffstat 18 files changed, 160 insertions(+), 94 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/Actor.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -151,14 +151,14 @@
   NPCData *v4; // eax@1
   NPCData *v5; // ebp@1
   unsigned int v6; // eax@1
-  signed int v7; // eax@3
+  //signed int v7; // eax@3
   unsigned int v8; // eax@8
   int v9; // esi@8
   int v10; // eax@11
   GUIWindow *v11; // ecx@19
   signed int v12; // eax@21
   //int v13; // [sp-8h] [bp-44h]@34
-  const char *v14; // [sp-4h] [bp-40h]@4
+  //const char *v14; // [sp-4h] [bp-40h]@4
   //int v15; // [sp-4h] [bp-40h]@34
   signed int v16; // [sp-4h] [bp-40h]@35
   int v17; // [sp+10h] [bp-2Ch]@1
@@ -181,9 +181,9 @@
   v6 = v4->uFlags;
   if ( (v6 & 3) != 2 )
     v5->uFlags = v6 + 1;
-  v7 = const_2();
+  /*v7 = const_2();
   sprintf(pContainer, "evt%02d", v7);
-  if ( !pParty->uAlignment )
+  if (pParty->alignment == PartyAlignment_Good)
   {
     v14 = "-b";
     strcat(pContainer, v14);
@@ -192,7 +192,15 @@
   {
     v14 = "-c";
     strcat(pContainer, v14);
+  }*/
+
+  switch (pParty->alignment)
+  {
+    case PartyAlignment_Good:    sprintf(pContainer, "evt%02d-b", const_2()); break;
+    case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break;
+    case PartyAlignment_Evil:    sprintf(pContainer, "evt%02d-c", const_2()); break;
   }
+
   v8 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
   array_5913D8[6] = 0;
   uNumDialogueNPCPortraits = 1;
--- a/Events.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/Events.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -25,6 +25,7 @@
 #include "Events.h"
 #include "Events2D.h"
 #include "Weather.h"
+#include "Party.h"
 
 
 
@@ -367,11 +368,11 @@
 				v16 = RemoveQuotes(Str);
 				VideoPlayer::MovieLoop(v16, 0, v14, 1);
 				if ( !_strcmpi(v16, "arbiter good") )
-					{
-					pParty->uAlignment = 0;
+                {
+                  pParty->alignment = PartyAlignment_Good;
 					v18 = 0;
 					LOBYTE(v17) = 1;
-					SetUserInterface(v18, v17);
+					SetUserInterface(PartyAlignment_Good, v17);
 					if ( !v15 || v128 == 3 )
 						{
 						pCurrentScreen = v128;
@@ -392,9 +393,9 @@
 				if ( !_strcmpi(v16, "arbiter evil") )
 					{
 					v18 = 2;
-					pParty->uAlignment = 2;
+					pParty->alignment = PartyAlignment_Evil;
 					LOBYTE(v17) = 1;
-					SetUserInterface(v18, v17);
+					SetUserInterface(PartyAlignment_Evil, v17);
 					if ( !v15 || v128 == 3 )
 						{
 						pCurrentScreen = v128;
--- a/GUIProgressBar.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/GUIProgressBar.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -1,3 +1,5 @@
+#include <assert.h>
+
 #include "GUIProgressBar.h"
 #include "LOD.h"
 #include "Mouse.h"
@@ -23,8 +25,8 @@
   int v5; // ecx@8
   int v6; // edi@8
   int v7; // edx@14
-  const char *v8; // [sp-8h] [bp-84h]@20
-  unsigned int v9; // [sp-4h] [bp-80h]@20
+  //const char *v8; // [sp-8h] [bp-84h]@20
+  //unsigned int v9; // [sp-4h] [bp-80h]@20
   char Str1[64]; // [sp+4h] [bp-78h]@16
 
   if (type < 1 || type > 1)
@@ -74,7 +76,8 @@
     Draw();
     return true;
   }
-  if ( !pParty->uAlignment )
+
+  /*if ( !pParty->uAlignment )
   {
     v9 = 2;
     v8 = "bardata-b";
@@ -92,7 +95,15 @@
     v8 = "bardata-c";
 LABEL_23:
     pIcons_LOD->_410522(&pBardata, v8, v9);
+  }*/
+  switch (pParty->alignment)
+  {
+    case PartyAlignment_Good:    pIcons_LOD->_410522(&pBardata, "bardata-b", 2); break;
+    case PartyAlignment_Neutral: pIcons_LOD->_410522(&pBardata, "bardata", 2); break;
+    case PartyAlignment_Evil:    pIcons_LOD->_410522(&pBardata, "bardata-c", 2); break;
+    default: assert(false);
   }
+
   uProgressCurrent = 0;
   uProgressMax = 26;
   Draw();
--- a/GUIWindow.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/GUIWindow.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -1040,11 +1040,11 @@
   int v9; // eax@50
   unsigned int v10; // [sp-10h] [bp-C8h]@53
   unsigned __int16 v11; // [sp-Ch] [bp-C4h]@53
-  unsigned int v12; // [sp-Ch] [bp-C4h]@60
+  //unsigned int v12; // [sp-Ch] [bp-C4h]@60
   char *v13; // [sp-8h] [bp-C0h]@50
-  unsigned int v14; // [sp-8h] [bp-C0h]@60
+  //unsigned int v14; // [sp-8h] [bp-C0h]@60
   unsigned int v15; // [sp-4h] [bp-BCh]@50
-  Texture *v16; // [sp-4h] [bp-BCh]@60
+  //Texture *v16; // [sp-4h] [bp-BCh]@60
   GUIWindow w; // [sp+Ch] [bp-ACh]@4
   GUIWindow v18; // [sp+60h] [bp-58h]@2
   int v19; // [sp+B4h] [bp-4h]@2
@@ -1057,7 +1057,7 @@
   v1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
   v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u);
   pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
-  pRenderer->DrawTextureTransparent(0x1D4u, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0));
+  pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_507B04]);
   if ( array_5913D8[6] != (NPCData *)uNumDialogueNPCPortraits || !uHouse_ExitPic )
   {
     w.uFrameWidth = 130;
@@ -1092,8 +1092,7 @@
       w.uFrameZ = 457;
       v5 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0);
       v6 = v5 + 7;
-      pRenderer->_4A6A68(8, 352 - (v5 + 7), (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0),
-        (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v5 + 7));
+      pRenderer->_4A6A68(8, 352 - (v5 + 7), &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - (v5 + 7));
       pRenderer->DrawTextureIndexed(8u, 347 - v6, pTexture_591428);
       v7 = FitTextInAWindow(ptr_F8B1E8, pFontArrus, &w, 0xDu, 0);
       window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0);
@@ -1105,7 +1104,7 @@
     {
       pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4,
         *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4,
-        (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0));
+        &pIcons_LOD->pTextures[uTextureID_50795C]);
       pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6),
         *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6), pDialogueNPCPortraits[v8]);
       if ( uNumDialogueNPCPortraits < 4 )
@@ -1143,8 +1142,7 @@
     goto LABEL_56;
   }
   v4 = (char *)array_5913D8[6] - 1;
-  pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4,
-    (Texture *)(uTextureID_50795C != -1 ? &pIcons_LOD->pTextures[uTextureID_50795C] : 0));
+  pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, &pIcons_LOD->pTextures[uTextureID_50795C]);
   pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pDialogueNPCPortraits[(signed int)v4]);
   if ( pCurrentScreen == SCREEN_E )
   {
@@ -1233,18 +1231,13 @@
 LABEL_58:
   if ( array_5913D8[6] == (NPCData *)uNumDialogueNPCPortraits && uHouse_ExitPic )
   {
-    pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, (Texture *)(uTextureID_x_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_x_u] : 0));
-    v16 = (Texture *)(uTextureID_x_ok_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_ok_u] : 0);
-    v14 = 451;
-    v12 = 476;
+    pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
+    pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
   }
   else
   {
-    v16 = (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0);
-    v14 = 445;
-    v12 = 471;
+    pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uTextureID_506438]);
   }
-  pRenderer->DrawTextureIndexed(v12, v14, v16);
 }
 
 
--- a/GUIWindow.h	Fri Feb 22 21:47:42 2013 +0600
+++ b/GUIWindow.h	Fri Feb 22 21:47:55 2013 +0600
@@ -190,7 +190,7 @@
   UIMSG_PlayerCreationRemoveUpSkill = 0x4A,
   UIMSG_PlayerCreationRemoveDownSkill = 0x4B,
   UIMSG_4E = 0x4E,
-  UIMSG_4F = 0x4F,
+  UIMSG_SPellbook_ShowHightlightedSpellInfo = 0x4F,
   UIMSG_51 = 0x51,
   UIMSG_LoadGame = 0x52,
   UIMSG_SaveGame = 0x53,
@@ -240,7 +240,7 @@
   UIMSG_SelectDialogueOption = 0x88,
   UIMSG_8C = 0x8C,
   UIMSG_8D = 0x8D,
-  UIMSG_8E = 0x8E,
+  UIMSG_CastSpellFromBook = 0x8E,
   UIMSG_8F = 0x8F,
   UIMSG_PlayerCreation_VoicePrev = 0x90,
   UIMSG_PlayerCreation_VoiceNext = 0x91,
--- a/Party.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/Party.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -555,9 +555,9 @@
   uNumGold = 200;
   uNumGoldInBank = 0;
   uNumFoodRations = 7;
-  uAlignment = 1;
 
-  SetUserInterface(uAlignment, true);
+  alignment = PartyAlignment_Neutral;
+  SetUserInterface(alignment, true);
 
   uTimePlayed = 0x21C00u;
   uLastRegenerationTime = 0x21C00;
--- a/Party.h	Fri Feb 22 21:47:42 2013 +0600
+++ b/Party.h	Fri Feb 22 21:47:55 2013 +0600
@@ -95,6 +95,12 @@
 
 
 
+enum PartyAlignment: unsigned __int32
+{
+  PartyAlignment_Good = 0,
+  PartyAlignment_Neutral = 1,
+  PartyAlignment_Evil = 2
+};
 
 
 
@@ -253,7 +259,7 @@
   unsigned int bTurnBasedModeOn;
   int field_880;
   int uFlags2;
-  unsigned int uAlignment;
+  PartyAlignment alignment;
   SpellBuff pPartyBuffs[20];
   Player pPlayers[4];
   NPCData pHirelings[2];
--- a/Render.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/Render.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -10976,7 +10976,7 @@
       while ( v2 < (signed int)pObjectList->uNumObjects );
     }
     LOBYTE(v1) = 1;
-    SetUserInterface(pParty->uAlignment, v1);
+    SetUserInterface(pParty->alignment, v1);
     if ( pVideoPlayer->pVideoFrame.pPixels )
       pVideoPlayer->pVideoFrame.Load(pVideoPlayer->pVideoFrameTextureFilename, 1);
     if ( uCurrentMenuID )
--- a/SaveLoad.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/SaveLoad.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -196,7 +196,7 @@
 
   viewparams->bRedrawGameUI = true;
 
-  SetUserInterface(pParty->uAlignment, true);
+  SetUserInterface(pParty->alignment, true);
 
   pEventTimer->Resume();
   pEventTimer->StopGameTime();
@@ -670,7 +670,8 @@
 //----- (0045E297) --------------------------------------------------------
 void SavegameList::Initialize(unsigned int bHideEmptySlots)
 {
-    memset(pSavegameList, 0, 0x3138);
+    //memset(pSavegameList, 0, 0x3138);
+  Reset();
     uNumSavegameFiles = 0;
 
   _chdir("saves");
--- a/SaveLoad.h	Fri Feb 22 21:47:42 2013 +0600
+++ b/SaveLoad.h	Fri Feb 22 21:47:55 2013 +0600
@@ -8,8 +8,16 @@
 {
   void Initialize(unsigned int a1);
 
+  inline void Reset()
+  {
+    for (int i = 0; i < 20; ++i)
+      field_0[i] = 0;
+    for (int i = 0; i < 44; ++i)
+      pSavesNames[i][0] = 0;
+  }
+
   char field_0[20];
-  char pSavesNames[40][280];
+  char pSavesNames[44][280];
 };
 #pragma pack(pop)
 
--- a/TurnEngine.h	Fri Feb 22 21:47:42 2013 +0600
+++ b/TurnEngine.h	Fri Feb 22 21:47:55 2013 +0600
@@ -6,6 +6,13 @@
 #pragma pack(push, 1)
 struct TurnBased_QueueElem
 {
+  inline TurnBased_QueueElem()
+  {
+    uPackedID = 0;
+    field_4 = 0;
+    uActionLength = 0;
+    field_C = 0;
+  }
   int uPackedID;
   int field_4;
   int uActionLength;
@@ -17,6 +24,18 @@
 #pragma pack(push, 1)
 struct stru262_TurnBased
 {
+  inline stru262_TurnBased()
+  {
+    field_0 = 0;
+    field_4 = 0;
+    field_8 = 0;
+    uActorQueueSize = 0;
+    field_10 = 0;
+    uActionPointsLeft = 0;
+    field_18 = 0;
+    field_1C = 0;
+  }
+
   signed int _404544();
   void _40471C();
   signed int Start();
--- a/mm7_1.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/mm7_1.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -5,6 +5,8 @@
 */
 
 //#include <defs.h>
+#include <assert.h>
+
 #include "MM7.h"
 
 #include "MapInfo.h"
@@ -6115,21 +6117,16 @@
 // 4E28F8: using guessed type int pCurrentScreen;
 
 //----- (004226EF) --------------------------------------------------------
-void __fastcall SetUserInterface(int a1, bool bReplace)
+void SetUserInterface(PartyAlignment align, bool bReplace)
 {
-  int v2; // ecx@2
   unsigned int v3; // eax@7
   unsigned __int16 v4; // dx@7
   unsigned __int16 v5; // cx@7
   unsigned __int16 v6; // [sp-4h] [bp-14h]@7
 
-  if ( a1 )
-  {
-    v2 = a1 - 1;
-    if ( v2 )
-    {
-      if ( v2 != 1 )
-        return;
+
+    if (align == PartyAlignment_Evil)
+    {
       if ( bReplace )
       {
         pTexture_RightFrame->Reload("ib-r-C.pcx");
@@ -6213,7 +6210,7 @@
       v6 = 0;
       v5 = 10;
     }
-    else
+    else if (align == PartyAlignment_Neutral)
     {
       if ( bReplace )
       {
@@ -6309,8 +6306,7 @@
       v5 = 230;
       v6 = 193;
     }
-  }
-  else
+  else if (align == PartyAlignment_Good)
   {
     if ( bReplace )
     {
@@ -6361,6 +6357,8 @@
     v4 = 225;
     v6 = 255;
   }
+  else assert(false);
+
   uGameUIFontMain = v3;
   uGameUIFontShadow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v5, v4, v6);
 }
--- a/mm7_2.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/mm7_2.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -13431,7 +13431,7 @@
       Rect.bottom = 246;
       ClipCursor(&Rect);
     }
-    SetUserInterface(1, false);
+    SetUserInterface(PartyAlignment_Neutral, false);
     ShowIntroVideo_and_LoadingScreen();
     WriteWindowsRegistryInt("Ran once", 1);
     dword_6BE364_game_settings_1 |= 0x4000;
--- a/mm7_3.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/mm7_3.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -14670,14 +14670,14 @@
 //----- (00444C8F) --------------------------------------------------------
 GUIWindow *__cdecl UI_CreateTravelDialogue()
 {
-  signed int v0; // eax@1
+  //signed int v0; // eax@1
   unsigned int v1; // eax@6
   GUIWindow *result; // eax@9
-  const char *v3; // [sp-4h] [bp-2Ch]@2
+  //const char *v3; // [sp-4h] [bp-2Ch]@2
   char pContainer[32]; // [sp+0h] [bp-28h]@1
 
   pEventTimer->Pause();
-  v0 = const_2();
+  /*v0 = const_2();
   sprintf(pContainer, "evt%02d", v0);
   if ( pParty->uAlignment )
   {
@@ -14690,7 +14690,15 @@
     v3 = "-b";
   }
   strcat(pContainer, v3);
-LABEL_6:
+LABEL_6:*/
+  switch (pParty->alignment)
+  {
+    case PartyAlignment_Good:    sprintf(pContainer, "evt%02d-b", const_2());
+    case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2());
+    case PartyAlignment_Evil:    sprintf(pContainer, "evt%02d-c", const_2());
+    default: assert(false);
+  }
+
   pTexture_Dialogue_Background = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)];
   pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("outside", TEXTURE_16BIT_PALETTE)];
   v1 = pMapStats->GetMapInfo(pCurrentMapName);
--- a/mm7_4.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/mm7_4.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -5915,15 +5915,7 @@
             && uMouseY >= (signed int)pControlsHead->uY && uMouseY <= (signed int)pControlsHead->uW )//mouse movement
         {
           pControlParam = pControlsHead->uControlParam;
-          if ( (signed int)pNumMessage < 40 )
-          {
-            pMessageQueue_50CBD0->pMessages[pNumMessage].eType = (UIMessageType)pControlsHead->field_1C;
-            //pTexture = &pTexture_PCX;
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = pControlParam;
-            *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-            pNumMessage = pMessageQueue_50CBD0->uNumMessages + 1;
-            ++pMessageQueue_50CBD0->uNumMessages;
-          }
+          pMessageQueue_50CBD0->SendMessage((UIMessageType)pControlsHead->field_1C, pControlParam, 0);
           v1 = 0;
         }
         pControlsHead = pControlsHead->pNext;
@@ -14771,7 +14763,7 @@
 {
   unsigned int v9; // ebx@1
   int v10; // edi@1
-  signed int v11; // eax@1
+  //signed int v11; // eax@1
   unsigned int v12; // eax@6
   const char *v13; // ST0C_4@6
   unsigned int v14; // eax@8
@@ -14779,7 +14771,7 @@
   unsigned int v16; // eax@16
   unsigned int result; // eax@26
   const char *v18; // [sp-8h] [bp-40h]@9
-  const char *v19; // [sp-4h] [bp-3Ch]@2
+  //const char *v19; // [sp-4h] [bp-3Ch]@2
   char *v20; // [sp-4h] [bp-3Ch]@9
   const char *v21; // [sp-4h] [bp-3Ch]@11
   char pContainer[40]; // [sp+Ch] [bp-2Ch]@1
@@ -14798,7 +14790,15 @@
   uCurrentHouse_Animation = v9;
   pEventTimer->Pause();
   pAudioPlayer->StopChannels(-1, -1);
-  v11 = const_2();
+
+  switch (pParty->alignment)
+  {
+    case PartyAlignment_Good:    sprintf(pContainer, "evt%02d-b", const_2()); break;
+    case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break;
+    case PartyAlignment_Evil:    sprintf(pContainer, "evt%02d-c", const_2()); break;
+    default: assert(false);
+  }
+  /*v11 = const_2();
   sprintf(pContainer, "evt%02d", v11);
   if ( pParty->uAlignment )
   {
@@ -14810,8 +14810,9 @@
   {
     v19 = "-b";
   }
-  strcat(pContainer, v19);
-LABEL_6:
+  strcat(pContainer, v19);*/
+
+//LABEL_6:
   v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
   v13 = pHouse_ExitPictures[v10];
   pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12];
@@ -15006,12 +15007,12 @@
   //Player *v13; // esi@25
   int v14; // eax@25
   //Player *v15; // esi@27
-  signed int v16; // eax@32
+  //signed int v16; // eax@32
   unsigned int v17; // eax@37
   signed int v18; // edi@37
   signed int v19; // edi@41
   //unsigned int v20; // ecx@41
-  const char *v22; // [sp-4h] [bp-40h]@33
+  //const char *v22; // [sp-4h] [bp-40h]@33
   char pContainer[40]; // [sp+Ch] [bp-30h]@32
   unsigned int v24; // [sp+34h] [bp-8h]@5
   //enum HOUSE_TYPE v25; // [sp+38h] [bp-4h]@1
@@ -15129,7 +15130,8 @@
     ++pIcons_LOD->uTexturePacksCount;
     if ( !pIcons_LOD->uNumPrevLoadedFiles )
       pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-    v16 = const_2();
+
+    /*v16 = const_2();
     sprintf(pContainer, "evt%02d", v16);
     if ( pParty->uAlignment )
     {
@@ -15141,8 +15143,16 @@
     {
       v22 = "-b";
     }
-    strcat(pContainer, v22);
-LABEL_37:
+    strcat(pContainer, v22);*/
+//LABEL_37:
+    switch (pParty->alignment)
+    {
+      case PartyAlignment_Good:    sprintf(pContainer, "evt%02d-b", const_2()); break;
+      case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break;
+      case PartyAlignment_Evil:    sprintf(pContainer, "evt%02d-c", const_2()); break;
+      default: assert(false);
+    }
+
     v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     array_5913D8[6] = 0;
     pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17];
--- a/mm7_5.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/mm7_5.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -2753,7 +2753,7 @@
 //_set_status_string_pTmpBuf_and_continue:
           sub_41C0B8_set_status_string(pTmpBuf);
           continue;
-        case UIMSG_4F:
+        case UIMSG_SPellbook_ShowHightlightedSpellInfo:
           if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter],
                 !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402)) )
             continue;
@@ -2907,17 +2907,12 @@
             }
           }
           continue;
-        case UIMSG_8E:
-          if ( pTurnEngine->field_4 == 3 )
-            continue;
-          v175 = 0;
-          v159 = 0;
-          v147 = 0;
-          //goto LABEL_678;
-          v80 = v199;
-          v79 = uMessageParam;
-          _42777D_CastSpell_UseWand_ShootArrow(v79, v80, v147, v159, v175);
-          continue;
+
+        case UIMSG_CastSpellFromBook:
+          if ( pTurnEngine->field_4 != 3 )
+            _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0);
+        continue;
+
         case UIMSG_92:
           if ( pTurnEngine->field_4 != 3 )
           {
@@ -6278,8 +6273,8 @@
   char pContainer[128]; // [sp+24h] [bp-14h]@12
 
   uTextureID_MAGNIF_B = pIcons_LOD->LoadTexture("MAGNIF-B", TEXTURE_16BIT_PALETTE);
-  if ( !pParty->uAlignment || pParty->uAlignment == 1 || pParty->uAlignment == 2 )
-    uTextureID_BACKDOLL = pIcons_LOD->LoadTexture("BACKDOLL", TEXTURE_16BIT_PALETTE);
+  //if ( !pParty->uAlignment || pParty->uAlignment == 1 || pParty->uAlignment == 2 )
+  uTextureID_BACKDOLL = pIcons_LOD->LoadTexture("BACKDOLL", TEXTURE_16BIT_PALETTE);
   uTextureID_507B04 = uTextureID_right_panel;
   v30 = 0;
   uTextureID_BACKHAND = pIcons_LOD->LoadTexture("BACKHAND", TEXTURE_16BIT_PALETTE);
--- a/mm7_6.cpp	Fri Feb 22 21:47:42 2013 +0600
+++ b/mm7_6.cpp	Fri Feb 22 21:47:55 2013 +0600
@@ -42,6 +42,7 @@
 #include "texts.h"
 #include "StorylineTextTable.h"
 #include "Events2D.h"
+#include "Log.h"
 
 #include "mm7_data.h"
 
@@ -2172,7 +2173,7 @@
 //----- (0042777D) --------------------------------------------------------
 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6)
 {
-  bool result; // eax@2
+  //bool result; // eax@2
   __int16 v6; // bx@4
   Player *v7; // eax@4
   char v8; // zf@12
@@ -2202,9 +2203,16 @@
 
   a3a = uPlayerID;
   a2a = a1;
-  if ( pParty->bTurnBasedModeOn != 1
-    || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 )
+  
+  //if ( pParty->bTurnBasedModeOn != 1
+  //  || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 )
+  if (pParty->bTurnBasedModeOn)
   {
+    if (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3)
+      return;
+  }
+
+
     v6 = a5;
     v7 = &pParty->pPlayers[uPlayerID];
     if ( !(a5 & 0x10) )
@@ -2317,6 +2325,7 @@
           break;
       }
     }
+
     v15 = pStru277;
     if ( v6 & 0x3CA )
     {
@@ -2349,7 +2358,7 @@
       ++v15;
     }
     while ( (signed int)v15 < (signed int)&unk_50C190 );
-    result = pStru277->PushStru277(a2a, a3a, a4, v6, a6);
+    int result = pStru277->PushStru277(a2a, a3a, a4, v6, a6);
     if ( result != -1 )
     {
       if ( v6 & 2 )
@@ -2469,7 +2478,6 @@
         pGUIWindow_Settings->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, 0x8Fu, 5u, 0x36u, "", 0);
       }
     }
-  }
 }
 
 
--- a/mm7_data.h	Fri Feb 22 21:47:42 2013 +0600
+++ b/mm7_data.h	Fri Feb 22 21:47:55 2013 +0600
@@ -1915,7 +1915,7 @@
 void __cdecl sub_421EA6_OnInventoryLeftClick();
 void __cdecl OnGameViewportClick();
 bool PauseGameDrawing();
-void __fastcall SetUserInterface(int a1, bool bReplace);
+void SetUserInterface(enum PartyAlignment alignment, bool bReplace);
 void __cdecl reset_some_strus_flt_2Cs();
 void __cdecl j_sub_423B4A();
 void __cdecl sub_423B4A();