changeset 2186:7a517c9a1d5b

CastSpell continue
author Ritor1
date Mon, 27 Jan 2014 17:33:34 +0600
parents 385040580292
children 9856c2f8f918
files CastSpellInfo.cpp Game.cpp UI/UiGame.cpp mm7_3.cpp
diffstat 4 files changed, 237 insertions(+), 288 deletions(-) [+]
line wrap: on
line diff
--- a/CastSpellInfo.cpp	Mon Jan 27 00:13:01 2014 +0600
+++ b/CastSpellInfo.cpp	Mon Jan 27 17:33:34 2014 +0600
@@ -1935,7 +1935,7 @@
             break;
           }
           v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
-          pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(15, v663);
+          pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Pertified, v663);
         }
         LODWORD(v727) = 1;
         break;
@@ -2188,282 +2188,233 @@
         LODWORD(v727) = 1;
         break;
       }
-      case SPELL_SPIRIT_SHARED_LIFE://
+      case SPELL_SPIRIT_SHARED_LIFE://Общая жизнь
       {
         if ( skill_level == 4 )
-				amount = 4 * spell_level;
-			else
-				amount = 3 * spell_level;
-			if ( !pPlayer->CanCastSpell(uRequiredMana) )
-				break;
-			v381 = 0;
-			signed int _v733 = amount;
-			v730 = 0;
-			v382 = 1;
-			do
-			{
-				v383 = pPlayers[v382];
-				if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] )
-				v682[v381++] = v382;
-				++v382;
-			}
-			while ( v382 <= 4 );
-			v384 = 0;
-			v730 = v381;
-			if ( v381 > 0 )
-			{
-				do
-					_v733 += pPlayers[v682[v384++]]->sHealth;
-				while ( v384 < v381 );
-			}
-			v732 = (signed __int64)((double)_v733 / (double)v730);
-			_v733 = 0;
-			if ( v381 > 0 )
-			{
-				do
-				{
-					//v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]];
-					v726 = pPlayers[v682[_v733]];
-					v726->sHealth = v732;
-					//v386 = v726->GetMaxHealth();
-					if ( v726->sHealth > v726->GetMaxHealth())
-						v726->sHealth = v726->GetMaxHealth();
-					if ( v726->sHealth > 0 )
-					{
-						v726->SetUnconcious(0);
-					}
-					v388 = _v733;
-
-					pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, LOWORD(v682[_v733]) - 1);
-					_v733 = v388 + 1;
-				}
-				while ( v388 + 1 < v730 );
-			}
-			LODWORD(v727) = 1;
-			break;
-		}
-		case SPELL_SPIRIT_RESSURECTION:
-		{
-			switch (skill_level)
-			{
-				case 1: amount = 180 * spell_level; break;
-				case 2: amount = 10800 * spell_level; break;
-				case 3: amount = 259200 * spell_level; break;
-				case 4: amount = 0; break;
-				default:
-				assert(false);
-			}
-			if ( !pPlayer->CanCastSpell(uRequiredMana) )
-				break;
-			v396 = pCastSpell->uPlayerID_2;
-			if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16])
-				|| HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) )
-			{
-				if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) )
-					pParty->pPlayers[v396].PlaySound(SPEECH_25, 0);
-				if ( skill_level == 4 )
-				{
-					v397 = pCastSpell->uPlayerID_2;
-					LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
-					HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
-					v398 = pCastSpell->uPlayerID_2;
-					LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
-					HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
-					v399 = pCastSpell->uPlayerID_2;
-					LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
-					HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
-				}
-				else
-				{
-					*(float *)&a2 = (double)(amount << 7) * 0.033333335;
-					pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u,
-						(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-					pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu,
-						(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-					pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu,
-						(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-				}
-				pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1);
-				pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1;
-				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
-			}
-			LODWORD(v727) = 1;
-			break;
-		}
-		case SPELL_MIND_CURE_PARALYSIS:
-		{
-			switch (skill_level)
-			{
-				case 1: amount = 3600 * spell_level; break;
-				case 2: amount = 3600 * spell_level; break;
-				case 3: amount = 86400 * spell_level; break;
-				case 4: amount = 0; break;
-				default:
-				assert(false);
-			}
-			if ( !pPlayer->CanCastSpell(uRequiredMana) )
-				break;
-
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
-			v323 = pCastSpell->uPlayerID_2;
-			v324 = (char *)&pParty->pPlayers[v323].pConditions[12];
-			if ( !pParty->pPlayers[v323].pConditions[12] )
-			{
-				LODWORD(v727) = 1;
-				break;
-			}
-			if ( skill_level == 4 )
-			{
-				*(int *)v324 = 0;
-				*((int *)v324 + 1) = 0;
-				LODWORD(v727) = 1;
-				break;
-			}
-			v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
-			v656 = 12;
-			v325 = &pParty->pPlayers[v323];
-			v325->DiscardConditionIfLastsLongerThan(v656, v663);
-			LODWORD(v727) = 1;
-			break;
-		}
-		case SPELL_MIND_REMOVE_FEAR:
-		{
-			switch (skill_level)
-			{
-				case 1: amount = 180 * spell_level; break;
-				case 2: amount = 3600 * spell_level; break;
-				case 3: amount = 86400 * spell_level; break;
-				case 4: amount = 0; break;
-				default:
-				assert(false);
-			}
-
-			if ( !pPlayer->CanCastSpell(uRequiredMana) )
-				break;
-
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
-			v323 = pCastSpell->uPlayerID_2;
-			v324 = (char *)&pParty->pPlayers[v323].pConditions[3];
-			if ( !pParty->pPlayers[v323].pConditions[3] )
-			{
-				LODWORD(v727) = 1;
-				break;
-			}
-			if ( skill_level == 4 )
-			{
-				*(int *)v324 = 0;
-				*((int *)v324 + 1) = 0;
-				LODWORD(v727) = 1;
-				break;
-			}
-			v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
-			v656 = 3;
-			v325 = &pParty->pPlayers[v323];
-			v325->DiscardConditionIfLastsLongerThan(v656, v663);
-			LODWORD(v727) = 1;
-			break;
-		}
-		case SPELL_MIND_TELEPATHY:
-		{
-			if ( !pPlayer->CanCastSpell(uRequiredMana) )
-				break;
-			if (PID_TYPE(a2) != OBJECT_Actor)
-			{
-				LODWORD(v727) = 1;
-				break;
-			}
-			v417 = &pActors[PID_ID(a2)];
-			Actor * _v730 = v417;
-			if ( !(BYTE2(v417->uAttributes) & 0x80) )
-			{
-				v417->SetRandomGoldIfTheresNoItem();
-				v417 = _v730;
-			}
-			v418 = v417->array_000234[3].uItemID;
-			signed int _v733 = 0;
-			if ( pItemsTable->pItems[v418].uEquipType == 18 )
-				_v733 = v417->array_000234[3].uSpecEnchantmentType;
-
-			//ItemGen::ItemGen(&v683);
-			v683.Reset();
-
-			v419 = _v730->uCarriedItemID;
-			if (v419)
-			{
-				v683.uItemID = v419;
-				//goto LABEL_799;
-			}
-			else
-			{
-				v420 = 0;
-				v421 = _v730->array_000234;
-				while ( !v421->uItemID || v421->GetItemEquipType() == 18 )
-				{
-					++v420;
-					++v421;
-					if ( v420 >= 4 )
-						break;
-				}
-				if ( v420 < 4 )
-				{
-					memcpy(&v683, &_v730->array_000234[v420], sizeof(v683));
-					spell_level = v723;
-					//v1 = 0;
-				}
-			}
+          amount = 4 * spell_level;
+        else
+          amount = 3 * spell_level;
+        if ( !pPlayer->CanCastSpell(uRequiredMana) )
+          break;
+        int active_pl_num = 0;
+        signed int shared_life_count = amount;
+        int mean_life = 0;
+        int pl_array[4];
+        for ( uint pl_id = 1; pl_id <= 4; pl_id++ )
+        {
+          if ( !pPlayers[pl_id]->pConditions[Condition_Dead] && !pPlayers[pl_id]->pConditions[Condition_Pertified]
+            && !pPlayers[pl_id]->pConditions[Condition_Eradicated] )
+            pl_array[active_pl_num++] = pl_id;
+        }
+        for ( uint i = 0; i < active_pl_num; i++ )
+          shared_life_count += pPlayers[pl_array[i]]->sHealth;
+        mean_life = (signed __int64)((double)shared_life_count / (double)active_pl_num);
+        for ( uint i = 0; i < active_pl_num; i++ )
+        {
+          pPlayers[pl_array[i]]->sHealth = mean_life;
+          if ( pPlayers[pl_array[i]]->sHealth > pPlayers[pl_array[i]]->GetMaxHealth())
+            pPlayers[pl_array[i]]->sHealth = pPlayers[pl_array[i]]->GetMaxHealth();
+          if ( pPlayers[pl_array[i]]->sHealth > 0 )
+            pPlayers[pl_array[i]]->SetUnconcious(0);
+          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_array[i] - 1);
+        }
+        LODWORD(v727) = 1;
+        break;
+      }
+      case SPELL_SPIRIT_RESSURECTION://Воскресение
+      {
+        switch (skill_level)
+        {
+          case 1: amount = 180 * spell_level; break;
+          case 2: amount = 10800 * spell_level; break;
+          case 3: amount = 259200 * spell_level; break;
+          case 4: amount = 0; break;
+          default:
+            assert(false);
+        }
+        if ( !pPlayer->CanCastSpell(uRequiredMana) )
+          break;
+        if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Eradicated]
+          || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Dead] )
+        {
+          if ( !(pParty->pPlayers[v396].pConditions[Condition_Weak]) )
+            pParty->pPlayers[v396].PlaySound(SPEECH_25, 0);
+          if ( skill_level == 4 )
+          {
+            pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Eradicated] = 0;
+            pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Dead] = 0;
+            pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Unconcious] = 0;
+          }
+          else
+          {
+            pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( Condition_Eradicated,
+                   (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
+            pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( Condition_Dead,
+                  (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
+            pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( Condition_Unconcious,
+                  (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
+          }
+          pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(Condition_Weak, 1);
+          pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1;
+          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+        }
+        LODWORD(v727) = 1;
+        break;
+      }
+      case SPELL_MIND_CURE_PARALYSIS://лечение паралича
+      {
+        switch (skill_level)
+        {
+          case 1: amount = 3600 * spell_level; break;
+          case 2: amount = 3600 * spell_level; break;
+          case 3: amount = 86400 * spell_level; break;
+          case 4: amount = 0; break;
+          default:
+            assert(false);
+        }
+        if ( !pPlayer->CanCastSpell(uRequiredMana) )
+          break;
+        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+        if ( !pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Paralyzed] )
+        {
+          LODWORD(v727) = 1;
+          break;
+        }
+        if ( skill_level == 4 )
+        {
+          pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Paralyzed] = 0;
+          LODWORD(v727) = 1;
+          break;
+        }
+        pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Paralyzed,
+               (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
+        LODWORD(v727) = 1;
+        break;
+      }
+      case SPELL_MIND_REMOVE_FEAR://Снять страх
+      {
+        switch (skill_level)
+        {
+          case 1: amount = 180 * spell_level; break;
+          case 2: amount = 3600 * spell_level; break;
+          case 3: amount = 86400 * spell_level; break;
+          case 4: amount = 0; break;
+          default:
+            assert(false);
+        }
+        if ( !pPlayer->CanCastSpell(uRequiredMana) )
+          break;
+        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+        if ( !pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Fear] )
+        {
+          LODWORD(v727) = 1;
+          break;
+        }
+        if ( skill_level == 4 )
+        {
+          pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Fear] = 0;
+          LODWORD(v727) = 1;
+          break;
+        }
+        pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Fear,
+                (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
+        LODWORD(v727) = 1;
+        break;
+      }
+      case SPELL_MIND_TELEPATHY://Телепатия
+      {
+        if ( !pPlayer->CanCastSpell(uRequiredMana) )
+          break;
+        if (PID_TYPE(a2) != OBJECT_Actor)
+        {
+          LODWORD(v727) = 1;
+          break;
+        }
+        mon_id = PID_ID(a2);
+        //v417 = &pActors[mon_id];
+        //Actor * _v730 = v417;
+        if ( !(pActors[mon_id].uAttributes & 0x800000) )
+          pActors[mon_id].SetRandomGoldIfTheresNoItem();
+        v418 = 0;
+        if ( pItemsTable->pItems[pActors[mon_id].array_000234[3].uItemID].uEquipType == EQUIP_GOLD )
+          v418 = pActors[mon_id].array_000234[3].uSpecEnchantmentType;
+        //ItemGen::ItemGen(&v683);
+        v683.Reset();
+        //v419 = _v730->uCarriedItemID;
+        if (pActors[mon_id].uCarriedItemID)
+          v683.uItemID = pActors[mon_id].uCarriedItemID;
+        else
+        {
+          
+          //v421 = pActors[mon_id].array_000234;
+          //while ( !pActors[mon_id].array_000234[v420].uItemID || pActors[mon_id].array_000234[v420].GetItemEquipType() == EQUIP_GOLD )
+          for ( v420 = 0; v420 < 4; ++v420 )
+          {
+            if ( pActors[mon_id].array_000234[v420].uItemID > 0 && pItemsTable->pItems[pActors[mon_id].array_000234[v420].uItemID].uEquipType != EQUIP_GOLD )
+            {
+              memcpy(&v683, &pActors[mon_id].array_000234[v420], sizeof(v683));
+              spell_level = v723;
+            }
+          }
+          //if ( v420 < 4 )
+          //{
+            //memcpy(&v683, &pActors[mon_id].array_000234[v420], sizeof(v683));
+            //spell_level = v723;
+            //v1 = 0;
+          //}
+        }
 //	LABEL_799:
-			if ( _v733 != 0 )
-			{
-				v675 = _v733;
-				if (v683.uItemID)
-				{
-					v422 = v683.GetDisplayName();
-					sprintf(pTmpBuf2.data(), "(%s), and %d gold", v422, v675);
-
-				}
-				else
-				{
-					v664 = "%d gold";
-					sprintf(pTmpBuf2.data(), v664, v675);
-				}
-			}
-			else
-			{
-				if (v683.uItemID)
-				{
-					const char *_v675 = v683.GetDisplayName();
-					v664 = "(%s)";
-					sprintf(pTmpBuf2.data(), v664, _v675);
-				}
-				else
-				{
-					strcpy(pTmpBuf2.data(), "nothing");
-					ShowStatusBarString(pTmpBuf2.data(), 2);
-				}
-			}
-			ShowStatusBarString(pTmpBuf2.data(), 2);
-			pSpellSprite.stru_24.Reset();
-			pSpellSprite.spell_id = pCastSpell->uSpellID;
-			pSpellSprite.spell_level = spell_level;
-			pSpellSprite.spell_skill = skill_level;
-			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-			pSpellSprite.vPosition.x = _v730->vPosition.x;
-			pSpellSprite.vPosition.y = _v730->vPosition.y;
-			pSpellSprite.vPosition.z = _v730->uActorHeight;
-			pSpellSprite.uAttributes = 0;
-			pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z);
-			pSpellSprite.uSpriteFrameID = 0;
-			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-			pSpellSprite.spell_target_pid = a2;
-			pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
-			pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
-			LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
-			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-			pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
-			LODWORD(v727) = 1;
-			break;
-		}
-		case SPELL_MIND_BERSERK:
+        if ( v418 != 0 )
+        {
+          //v675 = _v733;
+          if (v683.uItemID)
+          {
+            //v422 = v683.GetDisplayName();
+            sprintf(pTmpBuf2.data(), "(%s), and %d gold", v683.GetDisplayName(), v418);
+          }
+          else
+          {
+            //v664 = "%d gold";
+            sprintf(pTmpBuf2.data(), "%d gold", v418);
+          }
+        }
+        else
+        {
+          if (v683.uItemID)
+          {
+            //const char *_v675 = v683.GetDisplayName();
+            //v664 = "(%s)";
+            sprintf(pTmpBuf2.data(), "(%s)", v683.GetDisplayName());
+          }
+          else
+          {
+            strcpy(pTmpBuf2.data(), "nothing");
+            ShowStatusBarString(pTmpBuf2.data(), 2);
+          }
+        }
+        ShowStatusBarString(pTmpBuf2.data(), 2);
+        pSpellSprite.stru_24.Reset();
+        pSpellSprite.spell_id = pCastSpell->uSpellID;
+        pSpellSprite.spell_level = spell_level;
+        pSpellSprite.spell_skill = skill_level;
+        pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+        pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x;
+        pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y;
+        pSpellSprite.vPosition.z = pActors[mon_id].uActorHeight;
+        pSpellSprite.uAttributes = 0;
+        pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z);
+        pSpellSprite.uSpriteFrameID = 0;
+        pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+        pSpellSprite.spell_target_pid = a2;
+        pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
+        pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
+        LOBYTE(pSpellSprite.uAttributes) |= 0x80;
+        pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+        pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
+        LODWORD(v727) = 1;
+        break;
+      }
+      case SPELL_MIND_BERSERK:
 		{
 			switch (skill_level)
 			{
--- a/Game.cpp	Mon Jan 27 00:13:01 2014 +0600
+++ b/Game.cpp	Mon Jan 27 17:33:34 2014 +0600
@@ -3838,7 +3838,7 @@
         case UIMSG_SpellBookWindow:
           if ( pTurnEngine->turn_stage == 3 )
             continue;
-          if ( bUnderwater == 1 )
+          if ( bUnderwater == true )
           {
             ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
@@ -3849,9 +3849,9 @@
               pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
             if ( uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery )
             {
-              if ( !pCurrentScreen )
+              if ( pCurrentScreen == SCREEN_GAME )
               {
-                GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
+                GUIWindow::Create(476, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
                 pCurrentScreen = SCREEN_SPELL_BOOK;
                 pEventTimer->Pause();
                 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0);
@@ -3859,13 +3859,11 @@
                 viewparams->field_48 = 1;
                 continue;
               }
-              if ( pCurrentScreen != SCREEN_REST
-                && pCurrentScreen != SCREEN_CHARACTERS
-                && (pCurrentScreen <= SCREEN_63
-                 || pCurrentScreen > SCREEN_67) )
+              if ( pCurrentScreen != SCREEN_REST && pCurrentScreen != SCREEN_CHARACTERS
+                && (pCurrentScreen <= SCREEN_63 || pCurrentScreen > SCREEN_67) )
               {
                 pGUIWindow_CurrentMenu->Release();
-                GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
+                GUIWindow::Create(476, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
                 pCurrentScreen = SCREEN_SPELL_BOOK;
                 pEventTimer->Pause();
                 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0);
--- a/UI/UiGame.cpp	Mon Jan 27 00:13:01 2014 +0600
+++ b/UI/UiGame.cpp	Mon Jan 27 17:33:34 2014 +0600
@@ -978,15 +978,15 @@
 //----- (0041AEBB) --------------------------------------------------------
 void GameUI_DrawFoodAndGold()
 {
-  int v2; // esi@2
+  int text_y; // esi@2
 
   if ( uGameState != GAME_STATE_FINAL_WINDOW )
   {
-    v2 = sub_44100D() != 0 ? 381 : 322;
+    text_y = sub_44100D() != 0 ? 381 : 322;
     sprintf(pTmpBuf.data(), "\r087%lu", pParty->uNumFoodRations);
-    pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow);
+    pPrimaryWindow->DrawText(pFontSmallnum, 0, text_y, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow);
     sprintf(pTmpBuf.data(), "\r028%lu", pParty->uNumGold);
-    pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow);
+    pPrimaryWindow->DrawText(pFontSmallnum, 0, text_y, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow);
   }
 }
 
--- a/mm7_3.cpp	Mon Jan 27 00:13:01 2014 +0600
+++ b/mm7_3.cpp	Mon Jan 27 17:33:34 2014 +0600
@@ -3412,8 +3412,8 @@
 bool sub_44100D()
 {
   return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS ||
-         pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E ||
-         pCurrentScreen > SCREEN_VIDEO && pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING;
+         pCurrentScreen == SCREEN_HOUSE || pCurrentScreen == SCREEN_E ||
+         pCurrentScreen == SCREEN_CHANGE_LOCATION || pCurrentScreen == SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING;
 }
 // 4E28F8: using guessed type int pCurrentScreen;