Mercurial > mm7
changeset 2326:c889e521af1f
some EventCastSpell cleanups - removing labels, changing some numbers to enums
author | Grumpy7 |
---|---|
date | Tue, 01 Apr 2014 22:19:57 +0200 |
parents | b2e3ac05f2b3 |
children | 5e4d90305d06 |
files | Spells.cpp |
diffstat | 1 files changed, 67 insertions(+), 110 deletions(-) [+] |
line wrap: on
line diff
--- a/Spells.cpp Thu Mar 27 23:30:02 2014 +0100 +++ b/Spells.cpp Tue Apr 01 22:19:57 2014 +0200 @@ -360,7 +360,7 @@ double v12; // st5@4 double v13; // st7@6 int v14; // ST44_4@7 - signed int v15; // ebx@9 + uint skillMasteryPlusOne; // ebx@9 signed int v16; // edx@15 char *v17; // ecx@16 unsigned __int16 v18; // ax@20 @@ -404,13 +404,11 @@ unsigned int yaw; // [sp+30h] [bp-84h]@7 int pitch; // [sp+34h] [bp-80h]@7 //SpriteObject a1; // [sp+38h] [bp-7Ch]@12 - int v59; // [sp+A8h] [bp-Ch]@1 int v60; // [sp+ACh] [bp-8h]@1 //int spellnum_; // [sp+B0h] [bp-4h]@1 //signed int levela; // [sp+BCh] [bp+8h]@80 int a6_4; // [sp+C8h] [bp+14h]@117 float a7a; // [sp+CCh] [bp+18h]@6 - signed int a7b; // [sp+CCh] [bp+18h]@12 int a7c; // [sp+CCh] [bp+18h]@29 int a7d; // [sp+CCh] [bp+18h]@55 float a8a; // [sp+D0h] [bp+1Ch]@6 @@ -419,23 +417,19 @@ float toza; // [sp+D4h] [bp+20h]@6 v9 = 0; - v59 = uSkillLevel + 1; + skillMasteryPlusOne = uSkillLevel + 1; //spellnum_ = uSpellID; v60 = 0; if ( tox || toy || toz ) { v10 = (double)tox - (double)fromx; - v53 = v10; v11 = (double)toy - (double)fromy; - v54 = v11; v12 = (double)toz; } else { v10 = (double)pParty->vPosition.x - (double)fromx; - v53 = v10; v11 = (double)pParty->vPosition.y - (double)fromy; - v54 = v11; v12 = (double)(pParty->vPosition.z + pParty->sEyelevel); } a7a = v12 - (double)fromz; @@ -452,13 +446,10 @@ { v55 = (signed __int64)v13; v14 = (signed __int64)sqrt(a8a + toza); - yaw = stru_5C6E00->Atan2((signed __int64)v53, (signed __int64)v54); + yaw = stru_5C6E00->Atan2((signed __int64)v10, (signed __int64)v11); pitch = stru_5C6E00->Atan2(v14, (signed __int64)a7a); } - v15 = v59; - if ( v59 <= 0 || v59 > 4 ) - v15 = 1; - a7b = v15; + Assert(skillMasteryPlusOne > 0 && skillMasteryPlusOne <= 4, "Invalid mastery level"); SpriteObject a1; // [sp+38h] [bp-7Ch]@12 //SpriteObject::SpriteObject(&a1); @@ -470,43 +461,21 @@ goto LABEL_117; if ( uSpellID != SPELL_LIGHT_DAY_OF_THE_GODS ) return; - v40 = v15 - 2; - if ( v40 ) + switch (skillMasteryPlusOne) { - v41 = v40 - 1; - if ( !v41 ) - { - v42 = 14400 * uSkill; - v43 = 4 * uSkill + 10; - pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u); - pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u); - pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u); - v39 = (signed __int64)((double)(v42 << 7) * 0.033333335); - v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS]; - v36 = pParty->uTimePlayed + v39; - v37->Apply(v36, a7b, v43, 0, 0); - pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); - return; - } - if ( v41 == 1 ) - { - v42 = 18000 * uSkill; - v43 = 5 * uSkill + 10; - pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u); - pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u); - pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u); - v39 = (signed __int64)((double)(v42 << 7) * 0.033333335); - v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS]; - v36 = pParty->uTimePlayed + v39; - v37->Apply(v36, a7b, v43, 0, 0); - pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); - return; - } + case 2: + v42 = 10800 * uSkill; + v43 = 3 * uSkill + 10; + break; + case 3: + v42 = 18000 * uSkill; + v43 = 5 * uSkill + 10; + break; + case 4: + v42 = 14400 * uSkill; + v43 = 4 * uSkill + 10; + break; } - v42 = 10800 * uSkill; - v43 = 3 * uSkill + 10; pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u); pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u); @@ -514,7 +483,7 @@ v39 = (signed __int64)((double)(v42 << 7) * 0.033333335); v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS]; v36 = pParty->uTimePlayed + v39; - v37->Apply(v36, a7b, v43, 0, 0); + v37->Apply(v36, skillMasteryPlusOne, v43, 0, 0); pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); return; } @@ -534,7 +503,7 @@ v16 = 0; a1.spell_id = uSpellID; a1.spell_level = uSkill; - a1.spell_skill = v15; + a1.spell_skill = skillMasteryPlusOne; if ( (signed int)pObjectList->uNumObjects <= 0 ) { //v18 = 0; @@ -599,7 +568,7 @@ pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); return; case SPELL_WATER_POISON_SPRAY: - switch ( v15 ) + switch ( skillMasteryPlusOne ) { case 1: v60 = 1; @@ -622,7 +591,7 @@ v21 = 0; a1.spell_id = uSpellID; a1.spell_level = uSkill; - a1.spell_skill = v15; + a1.spell_skill = skillMasteryPlusOne; if ( (signed int)pObjectList->uNumObjects <= 0 ) v23 = 0; else @@ -677,7 +646,7 @@ a1.stru_24.Reset(); a1.spell_id = uSpellID; a1.spell_level = uSkill; - a1.spell_skill = v15; + a1.spell_skill = skillMasteryPlusOne; if ( (signed int)pObjectList->uNumObjects <= 0 ) { //v18 = 0; @@ -747,7 +716,7 @@ pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); return; case SPELL_AIR_SPARKS: - switch ( v15 ) + switch ( skillMasteryPlusOne ) { case 1: v60 = 3; @@ -768,7 +737,7 @@ v25 = 0; a1.spell_id = uSpellID; a1.spell_level = uSkill; - a1.spell_skill = v15; + a1.spell_skill = skillMasteryPlusOne; if ( (signed int)pObjectList->uNumObjects <= 0 ) { //v27 = 0; @@ -843,7 +812,7 @@ v29 = 0; a1.spell_id = uSpellID; a1.spell_level = uSkill; - a1.spell_skill = v15; + a1.spell_skill = skillMasteryPlusOne; if ( (signed int)pObjectList->uNumObjects <= 0 ) { //v31 = 0; @@ -869,13 +838,13 @@ break; case SPELL_FIRE_HASTE: - if ( v15 > 0 ) + if ( skillMasteryPlusOne > 0 ) { - if ( v15 <= 2 ) + if ( skillMasteryPlusOne <= 2 ) v9 = 60 * (uSkill + 60); - else if ( v15 == 3 ) + else if ( skillMasteryPlusOne == 3 ) v9 = 180 * (uSkill + 20); - else if ( v15 == 4 ) + else if ( skillMasteryPlusOne == 4 ) v9 = 240 * (uSkill + 15); } //levela = 1; @@ -888,7 +857,7 @@ //if ( !levela ) // return; pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 * 128) * 0.033333335), - v15, 0, 0, 0); + skillMasteryPlusOne, 0, 0, 0); //v33 = spellnum_; pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); @@ -899,7 +868,7 @@ case SPELL_AIR_SHIELD: case SPELL_EARTH_STONESKIN: case SPELL_SPIRIT_HEROISM: - switch ( v15 ) + switch ( skillMasteryPlusOne ) { case 1: case 2: @@ -914,19 +883,17 @@ } switch ( uSpellID ) { - case 17: + case SPELL_AIR_SHIELD: v60 = 0; uSkill = 14; break; - case 38: - v35 = uSkill + 5; + case SPELL_EARTH_STONESKIN: + v60 = uSkill + 5; uSkill = 15; - v60 = v35; break; - case 51: - v34 = uSkill + 5; + case SPELL_SPIRIT_HEROISM: + v60 = uSkill + 5; uSkill = 9; - v60 = v34; break; } pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); @@ -939,14 +906,14 @@ //v46 = v15; v36 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 << 7) * 0.033333335); //v37 = &pParty->pPartyBuffs[uSkill]; - pParty->pPartyBuffs[uSkill].Apply(v36, v15, v60, 0, 0); + pParty->pPartyBuffs[uSkill].Apply(v36, skillMasteryPlusOne, v60, 0, 0); pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); return; case SPELL_FIRE_IMMOLATION: - if ( v15 == 2 || v15 == 3 || v15 != 4 ) + if (skillMasteryPlusOne == 4) + v38 = 600 * uSkill; + else v38 = 60 * uSkill; - else - v38 = 600 * uSkill; pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); @@ -954,7 +921,7 @@ v52 = 0; v50 = 0; v48 = uSkill; - v46 = v15; + v46 = skillMasteryPlusOne; v39 = (signed __int64)((double)(v38 << 7) * 0.033333335); v37 = &pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION]; v36 = pParty->uTimePlayed + v39; @@ -1015,51 +982,41 @@ return; } LABEL_117: - v44 = uSkill; a6_4 = 3600 * uSkill; - if ( v15 == 1 ) + switch (skillMasteryPlusOne) { - v60 = v44; - goto LABEL_125; - } - if ( v15 == 2 ) - { - v44 = 2 * uSkill; - v60 = v44; - goto LABEL_125; + case 1: + v60 = uSkill; + break; + case 2: + v60 = 2 * uSkill; + break; + case 3: + v60 = 3 * uSkill; + break; + case 4: + v60 = 4 * uSkill; + break; } - if ( v15 == 3 ) - { - v44 = 3 * uSkill; - v60 = v44; - goto LABEL_125; - } - if ( v15 == 4 ) - { - v44 = 4 * uSkill; - v60 = v44; - goto LABEL_125; - } -LABEL_125: switch ( uSpellID ) { - case 3: - uSkill = 6; + case SPELL_FIRE_PROTECTION_FROM_FIRE: + uSkill = PARTY_BUFF_RESIST_FIRE; break; - case 14: - uSkill = 0; + case SPELL_AIR_PROTECTION_FROM_AIR: + uSkill = PARTY_BUFF_RESIST_AIR; break; - case 25: - uSkill = 17; + case SPELL_WATER_PROTECTION_FROM_WATER: + uSkill = PARTY_BUFF_RESIST_WATER; break; - case 36: - uSkill = 4; + case SPELL_EARTH_PROTECTION_FROM_EARTH: + uSkill = PARTY_BUFF_RESIST_EARTH; break; - case 58: - uSkill = 12; + case SPELL_MIND_PROTECTION_FROM_MIND: + uSkill = PARTY_BUFF_RESIST_MIND; break; - case 69: - uSkill = 1; + case SPELL_BODY_PROTECTION_FROM_BODY: + uSkill = PARTY_BUFF_RESIST_BODY; break; } //v45 = spellnum_; @@ -1067,7 +1024,7 @@ pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); - pParty->pPartyBuffs[uSkill].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)a6_4 * 4.2666669), v15, v60, 0, 0); + pParty->pPartyBuffs[uSkill].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)a6_4 * 4.2666669), skillMasteryPlusOne, v60, 0, 0); //levela = 1; //LABEL_138: //if ( levela )