diff mm7_6.cpp @ 710:735dab8d3c9a

Town portal screen + misc gui const replacements
author Nomad
date Thu, 21 Mar 2013 20:30:17 +0200
parents e0a1fccc89b1
children 9d13d2ec35a6
line wrap: on
line diff
--- a/mm7_6.cpp	Thu Mar 21 12:37:49 2013 +0200
+++ b/mm7_6.cpp	Thu Mar 21 20:30:17 2013 +0200
@@ -2166,6 +2166,7 @@
 {
   bool result; // eax@2
 
+  __debugbreak(); // refactor
   if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC )
     result = 1;
   else
@@ -2616,8 +2617,8 @@
   int v63; // ecx@187
   int v64; // ecx@188
   int v65; // ecx@189
-  const char *v66; // ecx@200
-  unsigned int v67; // edx@201
+  //const char *v66; // ecx@200
+  //unsigned int v67; // edx@201
   char v68; // al@207
   ItemGen *v69; // esi@211
   int v70; // ecx@214
@@ -2740,7 +2741,7 @@
   int v187; // eax@367
   int v188; // esi@369
   int v189; // edi@369
-  const char *v190; // ecx@377
+  //const char *v190; // ecx@377
   signed int v191; // edi@379
   int v192; // ecx@382
   int v193; // ecx@383
@@ -3613,7 +3614,11 @@
           while ( v730 );*/
         }
         if ( SHIDWORD(v733) > amount )
-          goto LABEL_200;
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
 
@@ -3644,11 +3649,16 @@
         v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
         v35 = pParty->sRotationX + 10;
         goto LABEL_124;
+
       case 20:
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
         if (!a2)
-          goto LABEL_200;
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         if ( (a2 & 7) != OBJECT_Actor)
           goto LABEL_1056;
         v699 = 0;
@@ -3753,7 +3763,11 @@
         a1.uSoundID = v49;
         v726 = (Player *)a1.Create(0, 0, 0, 0);
         if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) )
-          goto LABEL_200;
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         v47 = v730;
         v670 = (Vec3_int_ *)&v691;
         v42 = (signed int)v726;
@@ -3820,7 +3834,11 @@
       case 87:
         if ( uCurrentlyLoadedLevelType == LEVEL_Indoor
           || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) )
-          goto LABEL_200;
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         if ( pPlayer->CanCastSpell(uRequiredMana) )
           goto LABEL_152;
         goto play_sound_and_continue;
@@ -4056,16 +4074,12 @@
             }
           }
         }
-LABEL_199:
+
         dword_50C9D0 = 113;
         dword_50C9D4 = 0;
         dword_50C9D8 = 1;
-LABEL_200:
-        v66 = pGlobalTXT_LocalizationStrings[428];
-LABEL_201:
-        v67 = 2;
-LABEL_202:
-        ShowStatusBarString(v66, v67);
+
+        ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
         pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
         goto LABEL_203;
 
@@ -4443,8 +4457,9 @@
         }
         if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
         {
-          v66 = pGlobalTXT_LocalizationStrings[491];
-          goto LABEL_201;
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2);  // Can't cast Meteor Shower indoors!
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
@@ -4533,11 +4548,12 @@
         }
         goto LABEL_1056;
       case 10:
-        v67 = 2;
+        //v67 = 2;
         if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
         {
-          v66 = pGlobalTXT_LocalizationStrings[492];
-          goto LABEL_202;
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors!
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
@@ -4708,8 +4724,9 @@
       case 16:
         if ( pParty->uFlags & PARTY_FLAGS_1_FALLING)
         {
-          v190 = pGlobalTXT_LocalizationStrings[493]; // Can't cast Jump while airborne!
-          goto LABEL_462;
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2);  // Can't cast Jump while airborne!
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto play_sound_and_continue;
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
@@ -4751,10 +4768,11 @@
 LABEL_392:
         LODWORD(v733) = v195;
 LABEL_393:
-        if ( pParty->uFlags & 0x30 )
-        {
-          v66 = pGlobalTXT_LocalizationStrings[638];
-          goto LABEL_201;
+        if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW))
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2);  // There are hostile creatures nearby!
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
         }
         if ( pPlayer->CanCastSpell(uRequiredMana) )
         {
@@ -4769,20 +4787,19 @@
           LODWORD(v727) = v83;
         }
         goto play_sound_and_continue;
+
       case 21:
         if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
         {
-          v190 = pGlobalTXT_LocalizationStrings[494]; // Can not cast Fly indoors!
-LABEL_462:
-          ShowStatusBarString(v190, 2u);
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2);  // Can not cast Fly indoors!
           pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
           goto play_sound_and_continue;
         }
         if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() )
         {
-LABEL_461:
-          v190 = pGlobalTXT_LocalizationStrings[428];
-          goto LABEL_462;
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2);  // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto play_sound_and_continue;
         }
         LODWORD(v733) = 3600 * v2;
         if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) )
@@ -4803,11 +4820,12 @@
         goto LABEL_1056;
 
       case 22:
-        v67 = 2;
+        //v67 = 2;
         if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
         {
-          v66 = pGlobalTXT_LocalizationStrings[495];
-          goto LABEL_202;
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2);  // Can't cast Starburst indoors!
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
@@ -5034,7 +5052,11 @@
         goto LABEL_1056;
       case 27:
         if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() )
-          goto LABEL_461;
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2);  // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto play_sound_and_continue;
+        }
         if ( v731 == 2 || v731 != 3 && v731 != 4 )
           v229 = 600 * v2;
         else
@@ -5059,13 +5081,22 @@
           pParty->pPartyBuffs[18].uFlags = 1;
         LODWORD(v727) = 1;
         goto play_sound_and_continue;
+
       case 28:
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
         v240 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2];
         y = v240;
         if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 )
-          goto LABEL_199;
+        {
+          dword_50C9D0 = 113;
+          dword_50C9D4 = 0;
+          dword_50C9D8 = 1;
+
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2);  // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         if ( v731 == 1 || v731 == 2 )
         {
           v241 = (double)v723 * 0.0099999998 + 0.5;
@@ -5428,13 +5459,28 @@
         if ( rand() % 100 >= SHIDWORD(v733) )
           uRequiredMana = 1;
         if ( uRequiredMana != 0 )
-          goto LABEL_199;
+        {
+          dword_50C9D0 = 113;
+          dword_50C9D4 = 0;
+          dword_50C9D8 = 1;
+
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         v292 = *(char *)(LODWORD(v725) + 28);
         if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) )
         {
           v2 = v723;
           //v1 = 0;
-          goto LABEL_199;
+
+          dword_50C9D0 = 113;
+          dword_50C9D4 = 0;
+          dword_50C9D8 = 1;
+
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
         }
         if ( rand() % 100 >= 80 )
         {
@@ -5506,19 +5552,27 @@
         }
         v294->uAttributes |= 0x20u;
         goto LABEL_1055;
-      case 31:
+      case SPELL_WATER_TOWN_PORTAL:
         amount = 10 * v2;
         if ( pPlayer->sMana < (signed int)uRequiredMana )
           goto play_sound_and_continue;
-        if ( pParty->uFlags & 0x30 && v12 != 4 || rand() % 100 >= amount && v731 != 4 )
-          goto LABEL_200;
-        byte_50C0C0 = LOBYTE(v3->uPlayerID);
-        pMessageQueue_50CBD0->AddMessage(UIMSG_C3, 0, 0);
+        if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v12 != 4 || rand() % 100 >= amount && v731 != 4 )
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
+        town_portal_caster_id = LOBYTE(v3->uPlayerID);
+        pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0);
         goto LABEL_1056;
       case 33:
         LODWORD(v733) = 604800 * v2;
         if ( !_strcmpi(pCurrentMapName, "d05.blv") )
-          goto LABEL_200;
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         v319 = uRequiredMana;
         if ( pPlayer->sMana >= (signed int)uRequiredMana )
         {
@@ -5595,7 +5649,11 @@
         goto LABEL_125;
       case 43:
         if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
-          goto LABEL_200;
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
         a1.uType = 4090;
@@ -6741,8 +6799,9 @@
         }
         if ( SHIDWORD(v733) >= amount )
         {
-          v66 = pGlobalTXT_LocalizationStrings[648];
-          goto LABEL_201;
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2);  // This character can't summon any more monsters!
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
@@ -6790,11 +6849,12 @@
         goto play_sound_and_continue;
 
       case 84:
-        v67 = 2;
+        //v67 = 2;
         if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
         {
-          v66 = pGlobalTXT_LocalizationStrings[497];
-          goto LABEL_202;
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2);  // Can't cast Prismatic Light outdoors!
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
@@ -6940,7 +7000,11 @@
       case 88:
         amount = 3;
         if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u )
-          goto LABEL_200;
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
         a2 = 0;
@@ -7017,13 +7081,18 @@
         v726 = v577;
         if ( v577 == (Player *)-1 )
         {
-          v66 = pGlobalTXT_LocalizationStrings[496];
-          goto LABEL_201;
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2);  // No valid target exists!
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
         }
         v578 = (int)&pActors[(int)v577];
         v721 = v578;
         if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 )
-          goto LABEL_200;
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         ++a1.uType;
         a1.stru_24.Reset();
         a1.field_48 = v3->spellnum;
@@ -7090,7 +7159,15 @@
           || *(int *)(HIDWORD(v733) + 4) != 0
           || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2
           || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) )
-          goto LABEL_199;
+        {
+          dword_50C9D0 = 113;
+          dword_50C9D4 = 0;
+          dword_50C9D8 = 1;
+
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         v592 = HIDWORD(v733);
         v14 = v731 == 4;
         *(int *)(HIDWORD(v733) + 12) = 16;
@@ -7191,7 +7268,11 @@
         if ( !MonsterStats::BelongsToSupertype(pActors[v599].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
           goto play_sound_and_continue;
         if ( !stru_50C198.GetMagicalResistance(&pActors[v599], 0xAu) )
-          goto LABEL_200;
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         pActors[v599].pActorBuffs[9].Reset();
         pActors[v599].pActorBuffs[1].Reset();
         v732 = (int)v733 << 7;
@@ -7273,7 +7354,11 @@
         if ( v608 != 4 && v608 != 5
           || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0)
           || v609 >= 3 )
-          goto LABEL_200;
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         v610 = 76 * v609;
         *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0;
         v611 = pIconsFrameTable->FindIcon("spell96");
@@ -7425,14 +7510,19 @@
       case 98:
         if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
         {
-          v66 = pGlobalTXT_LocalizationStrings[499];
-          goto LABEL_201;
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2);  // Can't cast Armageddon indoors!
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
         }
         v640 = v12 - 2;
         if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) )
           amount = 3;
         if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 )
-          goto LABEL_200;
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+          pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+          goto LABEL_203;
+        }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto play_sound_and_continue;
         pParty->armageddon_timer = 256;