# HG changeset patch # User Ritor1 # Date 1364404814 -21600 # Node ID 72f6df90df98be099e0a6fc4885144aa3791f410 # Parent 95d9727412c9293ded402b45aefd130ddda47c61 EventCastSpell diff -r 95d9727412c9 -r 72f6df90df98 Events.cpp --- a/Events.cpp Wed Mar 27 21:24:24 2013 +0600 +++ b/Events.cpp Wed Mar 27 23:20:14 2013 +0600 @@ -1189,13 +1189,12 @@ //v7 = ""; break; case EVENT_CastSpell: - sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ), + EventCastSpell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ), EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 )); - ++curr_seq_num; - v4 = v124; - - break; + ++curr_seq_num; + v4 = v124; + break; case EVENT_SetTexture: sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9); ++curr_seq_num; diff -r 95d9727412c9 -r 72f6df90df98 mm7_3.cpp --- a/mm7_3.cpp Wed Mar 27 21:24:24 2013 +0600 +++ b/mm7_3.cpp Wed Mar 27 23:20:14 2013 +0600 @@ -13616,7 +13616,7 @@ } //----- (00448DF8) -------------------------------------------------------- -void __fastcall sub_448DF8_cast_spell(int spellnum, int rank, int level, int fromx, int fromy, int fromz, int tox, int toy, int toz) +void __fastcall EventCastSpell(int spellnum, int uSkillLevel, int uSkill, int fromx, int fromy, int fromz, int tox, int toy, int toz)//sub_448DF8 { int v9; // esi@1 double v10; // st7@4 @@ -13683,7 +13683,7 @@ float toza; // [sp+D4h] [bp+20h]@6 v9 = 0; - v59 = rank + 1; + v59 = uSkillLevel + 1; //spellnum_ = spellnum; v60 = 0; if ( tox || toy || toz ) @@ -13740,34 +13740,43 @@ v41 = v40 - 1; if ( !v41 ) { - v42 = 14400 * level; - v43 = 4 * level + 10; - goto LABEL_114; + 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[2]; + v36 = pParty->uTimePlayed + v39; + v37->Apply(v36, a7b, v43, 0, 0); + goto LABEL_139; } if ( v41 == 1 ) { - v42 = 18000 * level; - v43 = 5 * level + 10; - goto LABEL_114; - } - } - v42 = 10800 * level; - v43 = 3 * level + 10; -LABEL_114: + 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[2]; + v36 = pParty->uTimePlayed + v39; + v37->Apply(v36, a7b, v43, 0, 0); + goto LABEL_139; + } + } + v42 = 10800 * uSkill; + v43 = 3 * uSkill + 10; pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0); pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u); pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u); pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u); - v52 = 0; - v50 = 0; - v48 = v43; - v46 = a7b; v39 = (signed __int64)((double)(v42 << 7) * 0.033333335); v37 = &pParty->pPartyBuffs[2]; -LABEL_115: v36 = pParty->uTimePlayed + v39; -LABEL_116: - v37->Apply(v36, v46, v48, v50, v52); + v37->Apply(v36, a7b, v43, 0, 0); goto LABEL_139; } if ( spellnum != 58 ) @@ -13785,21 +13794,68 @@ a1.stru_24.Reset(); v16 = 0; a1.spell_id = spellnum; - a1.spell_level = level; + a1.spell_level = uSkill; a1.spell_skill = v15; if ( (signed int)pObjectList->uNumObjects <= 0 ) - goto LABEL_34; + { + v18 = 0; + a1.uObjectDescID = v18; + *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); + a1.vPosition.x = fromx; + a1.uAttributes = 16; + a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); + a1.field_60_distance_related_prolly_lod = v55; + v20 = yaw; + a1.uSpriteFrameID = 0; + a1.spell_caster_pid = 8000 | OBJECT_Item; + a1.spell_target_pid = 0; + a1.uFacing = yaw; + a1.uSoundID = 0; + v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; + a1.Create(v20, pitch, v49, 0); + goto LABEL_139; + } v17 = (char *)&pObjectList->pObjects->uObjectID; while ( (short)a1.uType != *(short *)v17 ) { ++v16; v17 += 56; if ( v16 >= (signed int)pObjectList->uNumObjects ) - goto LABEL_34; - } -LABEL_20: + { + v18 = 0; + a1.uObjectDescID = v18; + *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); + a1.vPosition.x = fromx; + a1.uAttributes = 16; + a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); + a1.field_60_distance_related_prolly_lod = v55; + v20 = yaw; + a1.uSpriteFrameID = 0; + a1.spell_caster_pid = 8000 | OBJECT_Item; + a1.spell_target_pid = 0; + a1.uFacing = yaw; + a1.uSoundID = 0; + v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; + a1.Create(v20, pitch, v49, 0); + goto LABEL_139; + } + } v18 = v16; - goto LABEL_35; + a1.uObjectDescID = v18; + *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); + a1.vPosition.x = fromx; + a1.uAttributes = 16; + a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); + a1.field_60_distance_related_prolly_lod = v55; + v20 = yaw; + a1.uSpriteFrameID = 0; + a1.spell_caster_pid = 8000 | OBJECT_Item; + a1.spell_target_pid = 0; + a1.uFacing = yaw; + a1.uSoundID = 0; + v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; + a1.Create(v20, pitch, v49, 0); + goto LABEL_139; case 24: switch ( v15 ) { @@ -13823,11 +13879,10 @@ a1.stru_24.Reset(); v21 = 0; a1.spell_id = spellnum; - a1.spell_level = level; + a1.spell_level = uSkill; a1.spell_skill = v15; if ( (signed int)pObjectList->uNumObjects <= 0 ) { -LABEL_41: v23 = 0; } else @@ -13838,7 +13893,25 @@ ++v21; v22 += 56; if ( v21 >= (signed int)pObjectList->uNumObjects ) - goto LABEL_41; + { + v23 = 0; + a1.uObjectDescID = v23; + *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); + a1.vPosition.x = fromx; + a1.uAttributes = 16; + a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); + a1.field_60_distance_related_prolly_lod = v55; + a1.uSpriteFrameID = 0; + a1.spell_caster_pid = 8000 | OBJECT_Item; + a1.spell_target_pid = 4; + a1.uSoundID = 0; + for ( i = a7c / -2; i <= a7c / 2; i += a8b ) + { + a1.uFacing = i + yaw; + a1.Create((signed __int16)(i + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); + } + goto LABEL_139; + } } v23 = v21; } @@ -13855,33 +13928,65 @@ for ( i = a7c / -2; i <= a7c / 2; i += a8b ) { a1.uFacing = i + yaw; - a1.Create( - (signed __int16)(i + (short)yaw), - pitch, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - 0); + a1.Create((signed __int16)(i + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); } goto LABEL_139; } a1.stru_24.Reset(); v16 = 0; a1.spell_id = spellnum; - a1.spell_level = level; + a1.spell_level = uSkill; a1.spell_skill = v15; if ( (signed int)pObjectList->uNumObjects <= 0 ) - goto LABEL_34; + { + v18 = 0; + a1.uObjectDescID = v18; + *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); + a1.vPosition.x = fromx; + a1.uAttributes = 16; + a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); + a1.field_60_distance_related_prolly_lod = v55; + v20 = yaw; + a1.uSpriteFrameID = 0; + a1.spell_caster_pid = 8000 | OBJECT_Item; + a1.spell_target_pid = 0; + a1.uFacing = yaw; + a1.uSoundID = 0; + v51 = 0; + v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; + v47 = pitch; + a1.Create(v20, v47, v49, v51); + goto LABEL_139; + } v19 = (char *)&pObjectList->pObjects->uObjectID; do { if ( (short)a1.uType == *(short *)v19 ) - goto LABEL_20; + { + v18 = v16; + a1.uObjectDescID = v18; + *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); + a1.vPosition.x = fromx; + a1.uAttributes = 16; + a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); + a1.field_60_distance_related_prolly_lod = v55; + v20 = yaw; + a1.uSpriteFrameID = 0; + a1.spell_caster_pid = 8000 | OBJECT_Item; + a1.spell_target_pid = 0; + a1.uFacing = yaw; + a1.uSoundID = 0; + v51 = 0; + v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; + v47 = pitch; + a1.Create(v20, v47, v49, v51); + goto LABEL_139; + } ++v16; v19 += 56; } while ( v16 < (signed int)pObjectList->uNumObjects ); -LABEL_34: v18 = 0; -LABEL_35: a1.uObjectDescID = v18; *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); a1.vPosition.x = fromx; @@ -13897,7 +14002,8 @@ v51 = 0; v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; v47 = pitch; - goto LABEL_36; + a1.Create(v20, v47, v49, v51); + goto LABEL_139; case 15: switch ( v15 ) { @@ -13919,10 +14025,28 @@ a1.stru_24.Reset(); v25 = 0; a1.spell_id = spellnum; - a1.spell_level = level; + a1.spell_level = uSkill; a1.spell_skill = v15; if ( (signed int)pObjectList->uNumObjects <= 0 ) - goto LABEL_59; + { + v27 = 0; + a1.uObjectDescID = v27; + *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); + a1.vPosition.x = fromx; + a1.uAttributes = 16; + a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); + a1.field_60_distance_related_prolly_lod = v55; + a1.uSpriteFrameID = 0; + a1.spell_caster_pid = 8000 | OBJECT_Item; + a1.spell_target_pid = 4; + a1.uSoundID = 0; + for ( j = a7d / -2; j <= a7d / 2; j += a8c ) + { + a1.uFacing = j + yaw; + a1.Create((signed __int16)(j + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); + } + goto LABEL_139; + } v26 = (char *)&pObjectList->pObjects->uObjectID; while ( (short)a1.uType != *(short *)v26 ) { @@ -13930,13 +14054,26 @@ v26 += 56; if ( v25 >= (signed int)pObjectList->uNumObjects ) { -LABEL_59: v27 = 0; - goto LABEL_60; + a1.uObjectDescID = v27; + *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); + a1.vPosition.x = fromx; + a1.uAttributes = 16; + a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); + a1.field_60_distance_related_prolly_lod = v55; + a1.uSpriteFrameID = 0; + a1.spell_caster_pid = 8000 | OBJECT_Item; + a1.spell_target_pid = 4; + a1.uSoundID = 0; + for ( j = a7d / -2; j <= a7d / 2; j += a8c ) + { + a1.uFacing = j + yaw; + a1.Create((signed __int16)(j + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); + } + goto LABEL_139; } } v27 = v25; -LABEL_60: a1.uObjectDescID = v27; *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); a1.vPosition.x = fromx; @@ -13963,10 +14100,28 @@ a1.stru_24.Reset(); v29 = 0; a1.spell_id = spellnum; - a1.spell_level = level; + a1.spell_level = uSkill; a1.spell_skill = v15; if ( (signed int)pObjectList->uNumObjects <= 0 ) - goto LABEL_70; + { + v31 = 0; + a1.uObjectDescID = v31; + *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); + a1.vPosition.x = fromx; + a1.uAttributes = 16; + a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); + a1.field_60_distance_related_prolly_lod = v55; + a1.uSpriteFrameID = 0; + a1.spell_caster_pid = 8000 | OBJECT_Item; + a1.spell_target_pid = 4; + a1.uSoundID = 0; + v51 = 0; + v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; + v20 = yaw; + v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2; + a1.Create(v20, v47, v49, v51); + goto LABEL_139; + } v30 = (char *)&pObjectList->pObjects->uObjectID; break; @@ -13975,18 +14130,18 @@ { if ( v15 <= 2 ) { - v9 = 60 * (level + 60); + v9 = 60 * (uSkill + 60); } else { if ( v15 == 3 ) { - v9 = 180 * (level + 20); + v9 = 180 * (uSkill + 20); } else { if ( v15 == 4 ) - v9 = 240 * (level + 15); + v9 = 240 * (uSkill + 15); } } } @@ -14017,29 +14172,29 @@ { case 1: case 2: - v9 = 300 * (level + 12); + v9 = 300 * (uSkill + 12); break; case 3: - v9 = 900 * (level + 4); + v9 = 900 * (uSkill + 4); break; case 4: - v9 = 3600 * (level + 1); + v9 = 3600 * (uSkill + 1); break; } switch ( spellnum ) { case 17: v60 = 0; - level = 14; + uSkill = 14; break; case 38: - v35 = level + 5; - level = 15; + v35 = uSkill + 5; + uSkill = 15; v60 = v35; break; case 51: - v34 = level + 5; - level = 9; + v34 = uSkill + 5; + uSkill = 9; v60 = v34; break; } @@ -14052,24 +14207,27 @@ v48 = v60; v46 = v15; v36 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 << 7) * 0.033333335); - v37 = &pParty->pPartyBuffs[level]; - goto LABEL_116; + v37 = &pParty->pPartyBuffs[uSkill]; + v37->Apply(v36, v46, v48, v50, v52); + goto LABEL_139;; case 8: if ( v15 == 2 || v15 == 3 || v15 != 4 ) - v38 = 60 * level; + v38 = 60 * uSkill; else - v38 = 600 * level; + v38 = 600 * uSkill; pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0); pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1); pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2); pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3); v52 = 0; v50 = 0; - v48 = level; + v48 = uSkill; v46 = v15; v39 = (signed __int64)((double)(v38 << 7) * 0.033333335); v37 = &pParty->pPartyBuffs[10]; - goto LABEL_115; + v36 = pParty->uTimePlayed + v39; + v37->Apply(v36, v46, v48, v50, v52); + goto LABEL_139; case 3: case 14: case 25: @@ -14084,13 +14242,26 @@ v30 += 56; if ( v29 >= (signed int)pObjectList->uNumObjects ) { -LABEL_70: v31 = 0; - goto LABEL_71; + a1.uObjectDescID = v31; + *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); + a1.vPosition.x = fromx; + a1.uAttributes = 16; + a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); + a1.field_60_distance_related_prolly_lod = v55; + a1.uSpriteFrameID = 0; + a1.spell_caster_pid = 8000 | OBJECT_Item; + a1.spell_target_pid = 4; + a1.uSoundID = 0; + v51 = 0; + v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; + v20 = yaw; + v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2; + a1.Create(v20, v47, v49, v51); + goto LABEL_139; } } v31 = v29; -LABEL_71: a1.uObjectDescID = v31; *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); a1.vPosition.x = fromx; @@ -14105,54 +14276,55 @@ v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; v20 = yaw; v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2; -LABEL_36: a1.Create(v20, v47, v49, v51); goto LABEL_139; } LABEL_117: - v44 = level; - a6_4 = 3600 * level; + v44 = uSkill; + a6_4 = 3600 * uSkill; if ( v15 == 1 ) { -LABEL_124: v60 = v44; goto LABEL_125; } if ( v15 == 2 ) { - v44 = 2 * level; - goto LABEL_124; + v44 = 2 * uSkill; + v60 = v44; + goto LABEL_125; } if ( v15 == 3 ) { - v44 = 3 * level; - goto LABEL_124; + v44 = 3 * uSkill; + v60 = v44; + goto LABEL_125; } if ( v15 == 4 ) { - v44 = 4 * level; - goto LABEL_124; + v44 = 4 * uSkill; + v60 = v44; + goto LABEL_125; } LABEL_125: switch ( spellnum ) { case 3: - level = 6; + uSkill = 6; break; case 14: - level = 0; + uSkill = 0; break; case 25: - level = 17; + uSkill = 17; break; case 36: - level = 4; + uSkill = 4; break; case 58: - level = 12; + uSkill = 12; break; case 69: - level = 1; + uSkill = 1; break; } //v45 = spellnum_; @@ -14160,12 +14332,7 @@ pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1); pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2); pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3); - pParty->pPartyBuffs[level].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), v15, v60, 0, 0); //levela = 1; LABEL_138: //if ( levela ) diff -r 95d9727412c9 -r 72f6df90df98 mm7_data.h --- a/mm7_data.h Wed Mar 27 21:24:24 2013 +0600 +++ b/mm7_data.h Wed Mar 27 23:20:14 2013 +0600 @@ -1835,7 +1835,7 @@ void __thiscall GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide); // idb void OnTimer(int); void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName); -void __fastcall sub_448DF8_cast_spell(int spellnum, int rank, int level, int fromx, int fromy, int fromz, int tox, int toy, int toz); +void __fastcall EventCastSpell(int spellnum, int uSkillLevel, int uSkill, int fromx, int fromy, int fromz, int tox, int toy, int toz);//sub_448DF8 __int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2); // idb bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2); void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle); // idb