changeset 490:cc4b7981c1bb

Wands
author Nomad
date Wed, 27 Feb 2013 23:13:02 +0200
parents c92dd0242fb6
children e01730a207c3
files Items.h Spells.cpp Spells.h mm7_4.cpp mm7_6.cpp
diffstat 5 files changed, 39 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/Items.h	Wed Feb 27 22:16:48 2013 +0200
+++ b/Items.h	Wed Feb 27 23:13:02 2013 +0200
@@ -42,8 +42,8 @@
   ITEM_BUCKLER_1 = 0x54,
   ITEM_GAUNTLETS_1 = 0x6E,
   ITEM_BOOTS_1 = 0x73,
-  ITEM_WAND_FIRE = 0x87,
-  ITEM_WAND_STUN = 0x8A,
+  ITEM_WAND_FIRE = 135,
+  ITEM_WAND_STUN = 138,
   ITEM_WAND_INCENERATION = 0x9F,
   ITEM_TROLL_BLOOD = 0xCA,
   ITEM_DRAGON_EYE = 0xCC,
--- a/Spells.cpp	Wed Feb 27 22:16:48 2013 +0200
+++ b/Spells.cpp	Wed Feb 27 23:13:02 2013 +0200
@@ -145,6 +145,22 @@
 	                 {60, 60, 60, 60, 300, 300, 300, 300, 2073, 0}
 	};
 
+
+unsigned int wand_spell_ids[25] =
+{
+// 135 Wand of Fire               136 Wand of Sparks             137 Wand of Poison             138 Wand of Stunning           139 Wand of Harm
+  SPELL_FIRE_FIRE_BOLT,           SPELL_AIR_SPARKS,              SPELL_WATER_POISON_SPRAY,      SPELL_EARTH_STUN,              SPELL_BODY_HARM,
+// 140 Fairy Wand of Light        141 Fairy Wand of Ice          142 Fairy Wand of Lashing      143 Fairy Wand of Mind         144 Fairy Wand of Swarms
+  SPELL_LIGHT_LIGHT_BOLT,         SPELL_WATER_ICE_BOLT,          SPELL_SPIRIT_SPIRIT_LASH,      SPELL_MIND_MIND_BLAST,         SPELL_EARTH_DEADLY_SWARM,
+// 145 Alacorn Wand of Fireballs  146 Alacorn Wand of Acid       147 Alacorn Wand of Lightning  148 Alacorn Wand of Blades     149 Alacorn Wand of Charms
+  SPELL_FIRE_FIREBALL,            SPELL_WATER_ACID_BURST,        SPELL_AIR_LIGHNING_BOLT,       SPELL_EARTH_BLADES,            SPELL_MIND_CHARM,
+// 150 Arcane Wand of Blasting    151 Arcane Wand of The Fist    152 Arcane Wand of Rocks       153 Arcane Wand of Paralyzing  154 Arcane Wand of Clouds
+  SPELL_WATER_ICE_BLAST,          SPELL_BODY_FLYING_FIST,        SPELL_EARTH_ROCK_BLAST,        SPELL_LIGHT_PARALYZE,          SPELL_DARK_TOXIC_CLOUD,
+// 155 Mystic Wand of Implosion   156 Mystic Wand of Distortion  157 Mystic Wand of Sharpmetal  158 Mystic Wand of Shrinking   159 Mystic Wand of Incineration
+  SPELL_AIR_IMPLOSION,            SPELL_EARTH_MASS_DISTORTION,   SPELL_DARK_SHARPMETAL,         SPELL_DARK_SHRINKING_RAY,      SPELL_FIRE_INCINERATE
+};
+
+
 	unsigned char pSpellbookSpellIndices[9][12] = // 4E2430
 	{  //0   1   2   3  4    5   6  7    8  9   10  11
 		{0,  3,  1,  8, 11,  7,  4, 10,  6,  2,  5,  9},
--- a/Spells.h	Wed Feb 27 22:16:48 2013 +0200
+++ b/Spells.h	Wed Feb 27 23:13:02 2013 +0200
@@ -115,7 +115,7 @@
 
   SPELL_BOW_ARROW = 100,
   SPELL_101 = 101,
-  SPELL_102 = 102,
+  SPELL_LASER_PROJECTILE = 102,
 
   SPELL_150 = 150,
   SPELL_151 = 151,
@@ -262,4 +262,5 @@
 extern struct SpellBookIconPos pIconPos[9][12];
 
 extern stru324_spell stru_4E3ACC[];
-extern SpellData pSpellDatas[100];
\ No newline at end of file
+extern SpellData pSpellDatas[100];
+extern unsigned int wand_spell_ids[];
\ No newline at end of file
--- a/mm7_4.cpp	Wed Feb 27 22:16:48 2013 +0200
+++ b/mm7_4.cpp	Wed Feb 27 23:13:02 2013 +0200
@@ -12663,7 +12663,7 @@
   DDM_DLV_Header *v26; // edi@29
   int v27; // eax@31
   int v28; // eax@32
-  unsigned int v29; // ecx@34
+  //unsigned int v29; // ecx@34
   unsigned int v30; // edx@36
   unsigned int v31; // edx@38
   unsigned int v32; // edx@40
@@ -12817,6 +12817,8 @@
         }
         return result;
       }
+
+      // DONATION
       //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
       v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
       v25 = 0;
@@ -12835,51 +12837,45 @@
           if ( v28 < -5 )
             v26->uReputation = -5;
         }
-        v29 = uActiveCharacter;
         if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 )
         {
           if ( v26->uReputation <= -5 )
           {
             v30 = pParty->uDaysPlayed % 7 + 1;
             LOBYTE(v30) = v30 | 0x80;
-            _42777D_CastSpell_UseWand_ShootArrow(12, uActiveCharacter - 1, v30, 48, 0);
-            v29 = uActiveCharacter;
+            _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0);
           }
           if ( v26->uReputation <= -10 )
           {
             v31 = pParty->uDaysPlayed % 7 + 1;
             LOBYTE(v31) = v31 | 0x80;
-            _42777D_CastSpell_UseWand_ShootArrow(50, v29 - 1, v31, 48, 0);
-            v29 = uActiveCharacter;
+            _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0);
             v26 = v66;
           }
           if ( v26->uReputation <= -15 )
           {
             v32 = pParty->uDaysPlayed % 7 + 1;
             LOBYTE(v32) = v32 | 0x80;
-            _42777D_CastSpell_UseWand_ShootArrow(75, v29 - 1, v32, 48, 0);
-            v29 = uActiveCharacter;
+            _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0);
             v26 = v66;
           }
           if ( v26->uReputation <= -20 )
           {
             v33 = pParty->uDaysPlayed % 7 + 1;
             LOBYTE(v33) = v33 | 0x80;
-            _42777D_CastSpell_UseWand_ShootArrow(86, v29 - 1, v33, 48, 0);
-            v29 = uActiveCharacter;
+            _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0);
             v26 = v66;
           }
           if ( v26->uReputation <= -25 )
           {
             v34 = pParty->uDaysPlayed % 7 + 1;
             LOBYTE(v34) = v34 | 0x80;
-            _42777D_CastSpell_UseWand_ShootArrow(85, v29 - 1, v34, 48, 0);
-            v29 = uActiveCharacter;
-          }
-        }
-        ++byte_F8B1EF[v29];
+            _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0);
+          }
+        }
+        ++byte_F8B1EF[uActiveCharacter];
         v1->PlaySound(SPEECH_83, 0);
-        ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u);
+        ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!"
         goto LABEL_46;
       }
       goto LABEL_55;
--- a/mm7_6.cpp	Wed Feb 27 22:16:48 2013 +0200
+++ b/mm7_6.cpp	Wed Feb 27 23:13:02 2013 +0200
@@ -2560,7 +2560,7 @@
   //int v10; // eax@45
   unsigned __int16 v11; // cx@45
   signed int v12; // ecx@48
-  int v13; // eax@53
+  //int v13; // eax@53
   unsigned __int8 v14; // zf@53
   //unsigned int v15; // edx@53
   //signed int v16; // eax@53
@@ -3409,7 +3409,6 @@
     }
 
     v730 = v3->spellnum;
-    v13 = v12 + 10 * v3->spellnum;
     if (v3->forced_spell_skill_level)
       uRequiredMana = 0;
     else 
@@ -3417,7 +3416,7 @@
     sRecoveryTime = pSpellDatas[v3->spellnum].recovery_per_skill[v12 - 1];
 
     if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 ||
-        LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute)
+        LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0)
       uRequiredMana = 0;
 
     if (v3->spellnum >= PLAYER_SKILL_BOW || pPlayer->sMana >= uRequiredMana)
@@ -3508,7 +3507,7 @@
         }
         goto play_sound_and_continue;
 
-      case SPELL_102:
+      case SPELL_LASER_PROJECTILE:
         sRecoveryTime = pPlayer->GetAttackRecoveryTime(0);
         a1.stru_24.Reset();
         a1.field_48 = v3->spellnum;
@@ -7759,14 +7758,14 @@
   if (laser_weapon_item_id)
   {
     shotting_laser = true;
-    _42777D_CastSpell_UseWand_ShootArrow(102, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8);
+    _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8);
   }
   else if (wand_item_id)
   {
     shooting_wand = true;
 
     int main_hand_idx = player->pEquipment.uMainHand;
-    _42777D_CastSpell_UseWand_ShootArrow(*((int *)&pSpellDatas[66].uNormalLevelRecovery + player->pInventoryItems[main_hand_idx - 1].uItemID), uActiveCharacter - 1, 8, 0, uActiveCharacter + 8);
+    _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8);
 
     if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges)
       player->pEquipment.uMainHand = 0;
@@ -7790,7 +7789,7 @@
   else if (bow_idx)
   {
     shooting_bow = true;
-    _42777D_CastSpell_UseWand_ShootArrow(100, uActiveCharacter - 1, 0, 0, 0);
+    _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0);
   }
   else
   {