Mercurial > mm7
changeset 303:3dcc9d945eeb
DamageMonsterFromParty
author | Nomad |
---|---|
date | Tue, 19 Feb 2013 15:39:50 +0200 |
parents | af7e848d6def |
children | f16ac5e65438 |
files | Actor.cpp Actor.h LayingItem.h Player.h mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp mm7text_ru.cpp stru6.cpp |
diffstat | 12 files changed, 288 insertions(+), 292 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Tue Feb 19 13:31:50 2013 +0200 +++ b/Actor.cpp Tue Feb 19 15:39:50 2013 +0200 @@ -297,16 +297,16 @@ } //----- (004089C7) -------------------------------------------------------- -bool Actor::IsAlive() +bool Actor::IsNotAlive() { signed int v1; // esi@1 - unsigned __int16 v2; // ax@3 + //unsigned __int16 v2; // ax@3 v1 = 0; - if ( (signed __int64)this->pActorBuffs[5].uExpireTime > 0 ) + if (pActorBuffs[5].uExpireTime) v1 = 1; - v2 = this->uAIState; - return (v1 | (v2 == Dying) | (v2 == Dead) | (v2 == Removed) | (v2 == Summoned) | (v2 == Disabled)) != 0; + //v2 = this->uAIState; + return (v1 | (uAIState == Dying) | (uAIState == Dead) | (uAIState == Removed) | (uAIState == Summoned) | (uAIState == Disabled)) != 0; } //----- (004086E9) -------------------------------------------------------- @@ -589,7 +589,7 @@ a1.uSectorID = pIndoor->GetSector(v13, v14, v15); v18 = 8 * LODWORD(v120); LOBYTE(v18) = 8 * LOBYTE(v120) | AI_OBJECT_ACTOR; - a1.field_58 = v18; + a1.field_58_pid = v18; a1.uSpriteFrameID = 0; a1.field_5C = 0; a1.field_60_distance_related_prolly_lod = 3; @@ -672,9 +672,9 @@ a1.uSectorID = v88; LODWORD(v119) = v89; v90 = 8 * LODWORD(v120); - LOBYTE(v90) = 8 * LOBYTE(v120) | 3; + LOBYTE(v90) = 8 * LOBYTE(v120) | OBJECT_Actor; a1.uSpriteFrameID = 0; - a1.field_58 = v90; + a1.field_58_pid = v90; a1.field_5C = 0; a1.field_60_distance_related_prolly_lod = 3; if ( (double)v89 >= 307.2 ) @@ -809,7 +809,7 @@ a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; - a1.field_58 = v116; + a1.field_58_pid = v116; a1.field_5C = 0; a1.field_60_distance_related_prolly_lod = stru_50C198._427546(v30 + 2500); a1.uFacing = v32; @@ -1361,8 +1361,8 @@ a1.uAttributes = 0; a1.uSectorID = pIndoor->GetSector(v73, v74, v75); v78 = 8 * LODWORD(v120); - LOBYTE(v78) = 8 * LOBYTE(v120) | 3; - a1.field_58 = v78; + LOBYTE(v78) = 8 * LOBYTE(v120) | OBJECT_Actor; + a1.field_58_pid = v78; a1.uSpriteFrameID = 0; a1.field_5C = 0; a1.field_60_distance_related_prolly_lod = 3; @@ -1579,7 +1579,7 @@ v12 = 8 * v15; LOBYTE(v12) = 8 * v15 | AI_OBJECT_ACTOR; a1.uSpriteFrameID = 0; - a1.field_58 = v12; + a1.field_58_pid = v12; a1.field_5C = 0; if ( (double)v11 >= 307.2 ) { @@ -1683,9 +1683,9 @@ a1.uAttributes = 0; a1.uSectorID = pIndoor->GetSector(v5, a1.vPosition.y, v6); v7 = 8 * v10; - LOBYTE(v7) = 8 * v10 | 3; + LOBYTE(v7) = 8 * v10 | OBJECT_Actor; a1.uSpriteFrameID = 0; - a1.field_58 = v7; + a1.field_58_pid = v7; a1.field_5C = 0; a1.field_60_distance_related_prolly_lod = 3; a1.field_61 = 4; @@ -3868,7 +3868,7 @@ continue; } } - else if ( v7->IsAlive() == 1 ) + else if (v7->IsNotAlive()) { v24 = v4; v3->uLastCharacterIDToHit = v4;
--- a/Actor.h Tue Feb 19 13:31:50 2013 +0200 +++ b/Actor.h Tue Feb 19 15:39:50 2013 +0200 @@ -194,7 +194,7 @@ signed int GetActorsRelation(Actor *a2); void SetRandomGoldIfTheresNoItem(); bool CanAct(); - bool IsAlive(); + bool IsNotAlive(); void InitializeDialogue(int bPlayerSaysHello); char _438B9B();
--- a/LayingItem.h Tue Feb 19 13:31:50 2013 +0200 +++ b/LayingItem.h Tue Feb 19 15:39:50 2013 +0200 @@ -33,7 +33,7 @@ int field_4C; int field_50; int field_54; - int field_58; + int field_58_pid; int field_5C; char field_60_distance_related_prolly_lod; char field_61;
--- a/Player.h Tue Feb 19 13:31:50 2013 +0200 +++ b/Player.h Tue Feb 19 15:39:50 2013 +0200 @@ -560,6 +560,7 @@ bool Recover(signed int a2); bool CanCastSpell(unsigned int uRequiredMana); + inline bool Weak() {return pConditions[Condition::Condition_Weak] != 0;} inline bool Dead() {return pConditions[Condition::Condition_Dead] != 0;} inline bool Eradicated() {return pConditions[Condition::Condition_Eradicated] != 0;} inline bool Zombie() {return pConditions[Condition::Condition_Zombie] != 0;}
--- a/mm7_1.cpp Tue Feb 19 13:31:50 2013 +0200 +++ b/mm7_1.cpp Tue Feb 19 15:39:50 2013 +0200 @@ -4489,7 +4489,7 @@ a1.uAttributes = 48; a1.uSectorID = pIndoor->GetSector(pOut.x, pOut.z, pOut.y); a1.uSpriteFrameID = 0; - a1.field_58 = 0; + a1.field_58_pid = 0; a1.field_5C = 0; a1.uFacing = 0; a1.Create(0, 0, 0, 0); @@ -5694,7 +5694,7 @@ } } } - a1.field_58 = 4; + a1.field_58_pid = OBJECT_Player; a1.uObjectDescID = v6; a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; @@ -6077,7 +6077,7 @@ } a1.uObjectDescID = v6; a1.vPosition.y = pParty->vPosition.y; - a1.field_58 = 4; + a1.field_58_pid = OBJECT_Player; a1.vPosition.x = pParty->vPosition.x; a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; a1.uSoundID = 0;
--- a/mm7_2.cpp Tue Feb 19 13:31:50 2013 +0200 +++ b/mm7_2.cpp Tue Feb 19 15:39:50 2013 +0200 @@ -8065,7 +8065,7 @@ a1a.field_48 = 0; v30 = pIndoor->GetSector(v28, v27, v29); a1a.field_5C = 0; - a1a.field_58 = 0; + a1a.field_58_pid = 0; a1a.uSpriteFrameID = 0; a1a.uSectorID = v30; return a1a.Create(0, 0, 0, 0); @@ -16034,12 +16034,12 @@ v151 = a2 & 7; if ( (a2 & 7) == OBJECT_Actor) { - if ( (v2->field_58 & 7) == OBJECT_Actor && !pActors[v2->field_58 >> 3].GetActorsRelation(&pActors[a2 >> 3]) ) + if ( (v2->field_58_pid & 7) == OBJECT_Actor && !pActors[v2->field_58_pid >> 3].GetActorsRelation(&pActors[a2 >> 3]) ) return 1; } else { - if ( (a2 & 7) == OBJECT_Player && (v2->field_58 & 7) == OBJECT_Player) + if ( (a2 & 7) == OBJECT_Player && (v2->field_58_pid & 7) == OBJECT_Player) return 1; } if ( pParty->bTurnBasedModeOn == 1 ) @@ -16051,8 +16051,8 @@ v2->uAttributes = v5 & 0xFFFB; } } - if ( v151 == OBJECT_BModel && (v2->field_58 & 7) != OBJECT_Player) - BYTE2(pActors[v2->field_58 >> 3].uAttributes) |= 4u; + if ( v151 == OBJECT_BModel && (v2->field_58_pid & 7) != OBJECT_Player) + BYTE2(pActors[v2->field_58_pid >> 3].uAttributes) |= 4u; v6 = v2->uItemType; v7 = v2->uItemType; if ( v7 > 3060 )
--- a/mm7_3.cpp Tue Feb 19 13:31:50 2013 +0200 +++ b/mm7_3.cpp Tue Feb 19 15:39:50 2013 +0200 @@ -1484,9 +1484,9 @@ { _46E44E_collide_against_faces_and_portals(0); _46E0B2_collide_against_decorations(); - if ( (v1->field_58 & 7) != OBJECT_Player) + if ( (v1->field_58_pid & 7) != OBJECT_Player) _46EF01_collision_chech_player(1); - v13 = v1->field_58; + v13 = v1->field_58_pid; v42 = v8; if ( (v13 & 7) == OBJECT_Actor) { @@ -1499,7 +1499,7 @@ //v14 = (signed __int64)((double)v41 * 0.3333333333333333); //v41 = *(short *)(v39 - 38) - 1; //if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) ) - if( pActors[v1->field_58 >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID ) + if( pActors[v1->field_58_pid >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID ) //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius _46DF1A_collide_against_actor(v42, *((short *)&pMonsterList->pMonsters[v39b->word_000086_some_monster_id] - 73)); ++v42; @@ -1988,11 +1988,11 @@ v58 = v16; v18 = WorldPosToGridCellX(v17); _46E26D_collide_against_sprites(v18, v58); - if ( (v1->field_58 & 7) != OBJECT_Player) + if ( (v1->field_58_pid & 7) != OBJECT_Player) _46EF01_collision_chech_player(0); - if ( (v1->field_58 & 7) == OBJECT_Actor) - { - v19 = v1->field_58 >> 3; + if ( (v1->field_58_pid & 7) == OBJECT_Actor) + { + v19 = v1->field_58_pid >> 3; if ( v19 >= 0 ) { if ( v19 < (signed int)(uNumActors - 1) ) @@ -18187,7 +18187,7 @@ a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); a1.field_60_distance_related_prolly_lod = v55; a1.uSpriteFrameID = 0; - a1.field_58 = 8002; + a1.field_58_pid = 8000 | OBJECT_Item; a1.field_5C = 4; a1.uSoundID = 0; for ( i = a7c / -2; i <= a7c / 2; i += a8b ) @@ -18228,7 +18228,7 @@ a1.field_60_distance_related_prolly_lod = v55; v20 = yaw; a1.uSpriteFrameID = 0; - a1.field_58 = 8002; + a1.field_58_pid = 8000 | OBJECT_Item; a1.field_5C = 0; a1.uFacing = yaw; a1.uSoundID = 0; @@ -18282,7 +18282,7 @@ a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); a1.field_60_distance_related_prolly_lod = v55; a1.uSpriteFrameID = 0; - a1.field_58 = 8002; + a1.field_58_pid = 8000 | OBJECT_Item; a1.field_5C = 4; a1.uSoundID = 0; for ( j = a7d / -2; j <= a7d / 2; j += a8c ) @@ -18438,7 +18438,7 @@ a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); a1.field_60_distance_related_prolly_lod = v55; a1.uSpriteFrameID = 0; - a1.field_58 = 8002; + a1.field_58_pid = 8000 | OBJECT_Item; a1.field_5C = 4; a1.uSoundID = 0; v51 = 0;
--- a/mm7_4.cpp Tue Feb 19 13:31:50 2013 +0200 +++ b/mm7_4.cpp Tue Feb 19 15:39:50 2013 +0200 @@ -3489,11 +3489,11 @@ a1.uObjectDescID = v10; a1.field_60_distance_related_prolly_lod = 0; v12 = 8 * pParty->pPartyBuffs[10].uCaster; - LOBYTE(v12) = v12 | 4; + LOBYTE(v12) = v12 | OBJECT_Player; a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; - a1.field_58 = v12; + a1.field_58_pid = v12; a1.uFacing = 0; a1.uSoundID = 0; v13 = sub_46A89E((int)v41, 100, 307);
--- a/mm7_5.cpp Tue Feb 19 13:31:50 2013 +0200 +++ b/mm7_5.cpp Tue Feb 19 15:39:50 2013 +0200 @@ -1,3 +1,5 @@ +#include <assert.h> + #include "mm7.h" #include "MapInfo.h" @@ -4981,7 +4983,7 @@ { v4 = &pLayingItems[v3]; v36 = v4; - v5 = v4->field_58; + v5 = v4->field_58_pid; v2 = v5 & 7; v3 = v5 >> 3; } @@ -5110,14 +5112,14 @@ v35->z = v44; switch ( v41 ) { - case 4: + case OBJECT_Player: DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); break; - case 3: + case OBJECT_Actor: if ( v36 && pActors[v37].GetActorsRelation(v28) ) sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); break; - case 2: + case OBJECT_Item: sub_43B057(*((short *)v1 - 300), uActorID, v35); break; } @@ -5144,11 +5146,11 @@ //----- (00439474) -------------------------------------------------------- void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) { - signed int v3; // eax@1 + //signed int v3; // eax@1 LayingItem *v4; // ebx@1 - int v5; // edx@3 - bool uPlayerID; // eax@3 - Player *pPlayer; // edi@4 + //int v5; // edx@3 + //bool uPlayerID; // eax@3 + //Player *pPlayer; // edi@4 Actor *pMonster; // esi@7 LayingItem *v9; // ebx@12 int v10; // eax@12 @@ -5168,8 +5170,8 @@ unsigned __int8 v24; // sf@44 int v25; // edx@51 int v26; // ecx@51 - signed int v27; // eax@51 - int v28; // eax@53 + //signed int v27; // eax@51 + //int v28; // eax@53 signed int v29; // eax@76 signed int v30; // eax@84 signed int v31; // eax@92 @@ -5192,14 +5194,14 @@ char *pPlayerName; // [sp+18h] [bp-54h]@12 char *pMonsterName; // [sp+1Ch] [bp-50h]@6 int v50; // [sp+20h] [bp-4Ch]@6 - unsigned __int64 *v51; // [sp+30h] [bp-3Ch]@6 + //unsigned __int64 *v51; // [sp+30h] [bp-3Ch]@6 int v52; // [sp+34h] [bp-38h]@12 - int v53; // [sp+38h] [bp-34h]@10 - int v54; // [sp+3Ch] [bp-30h]@1 - int v55; // [sp+40h] [bp-2Ch]@12 + //int v53; // [sp+38h] [bp-34h]@10 + //int v54; // [sp+3Ch] [bp-30h]@1 + //int v55; // [sp+40h] [bp-2Ch]@12 signed int a4; // [sp+44h] [bp-28h]@1 PlayerEquipment *v57; // [sp+48h] [bp-24h]@10 - int v58; // [sp+4Ch] [bp-20h]@10 + //int v58; // [sp+4Ch] [bp-20h]@10 int v59; // [sp+50h] [bp-1Ch]@1 unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1 int v61; // [sp+58h] [bp-14h]@1 @@ -5208,10 +5210,10 @@ int a2; // [sp+64h] [bp-8h]@27 int a3; // [sp+6Bh] [bp-1h]@6 - v3 = a1; + //v3 = a1; v4 = 0; uActorID_Monster_ = uActorID_Monster; - v54 = a1; + //v54 = a1; uDamageAmount = 0; a4 = 0; v61 = 0; @@ -5220,94 +5222,96 @@ if ( (a1 & 7) == OBJECT_Item) { v4 = &pLayingItems[a1 >> 3]; - uDamageAmount = (int)v4; + //uDamageAmount = (int)v4; v61 = v4->field_60_distance_related_prolly_lod; - v3 = v4->field_58; - v54 = v4->field_58; - } - v5 = v3 & 7; - uPlayerID = v3 >> 3; - if (v5 != OBJECT_Player) + a1 = v4->field_58_pid; + //v54 = v4->field_58_pid; + } + //v5 = a1 & 7; + //uPlayerID = a1 >> 3; + if ((a1 & 7) != OBJECT_Player) return; - pPlayer = &pParty->pPlayers[uPlayerID]; - if ( uPlayerID < 0 && uPlayerID > 3 ) - { - MessageBoxW(nullptr, L"Invalid player in damageMonsterFromParty!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Damage.cpp:457", 0); - } + + assert(abs(a1 >> 3) < 4); + auto player = &pParty->pPlayers[a1 >> 3]; pMonster = &pActors[uActorID_Monster_]; - uPlayerID = pMonster->IsAlive(); - if ( uPlayerID ) + //uPlayerID = pMonster->IsAlive(); + if (pMonster->IsNotAlive()) return; + BYTE1(pMonster->uAttributes) |= 0xC0u; if ( pMonster->uAIState == Fleeing ) pMonster->uAttributes |= 0x20000u; - v58 = 0; - v53 = 0; - v57 = 0; + //v57 = 0; + //v53 = 0; + //v58 = 0; + bool hit_will_stun = false, + hit_will_paralyze = false; if ( !v4 ) { - v51 = (unsigned __int64 *)pPlayer->pEquipment.uMainHand; + //v51 = (unsigned __int64 *)player->pEquipment.uMainHand; + int main_hand_idx = player->pEquipment.uMainHand; v59 = 1; - if ( pPlayer->HasItemEquipped(EQUIP_TWO_HANDED) ) - { - v55 = pItemsTable->pItems[*(int *)&pPlayer->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)v51 + 5]].uSkillType; - v28 = SkillToMastery(pPlayer->pActiveSkills[v55]); - uDamageAmount = v28; - if ( v55 ) - { - if ( v55 == 6 ) - { - if ( v28 >= 3 ) - { - LOBYTE(v51) = pPlayer->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F; - v51 = (unsigned __int64 *)(unsigned __int8)v51; - if ( rand() % 100 < (unsigned __int8)v51 ) - v58 = 1; - } - if ( uDamageAmount >= 4 ) - { - LOBYTE(v51) = pPlayer->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F; - v51 = (unsigned __int64 *)(unsigned __int8)v51; - if ( rand() % 100 < (unsigned __int8)v51 ) - v53 = 1; - } - } - } - else - { - if ( uDamageAmount >= 3 ) - { - LOBYTE(v51) = pPlayer->GetActualSkillLevel((PLAYER_SKILL_TYPE)0) & 0x3F; - v51 = (unsigned __int64 *)(unsigned __int8)v51; - if ( rand() % 100 < (unsigned __int8)v51 ) - v58 = 1; - } + if ( player->HasItemEquipped(EQUIP_TWO_HANDED) ) + { + auto main_hand_skill = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; + //v55 = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; + //v28 = SkillToMastery(player->pActiveSkills[v55]); + auto main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]); + //uDamageAmount = v28; + switch (main_hand_skill) + { + case PLAYER_SKILL_STAFF: + if (main_hand_mastery >= 3) + { + if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_STAFF) & 0x3F) // stun chance when mastery >= 3 + hit_will_stun = true; + } + break; + + case PLAYER_SKILL_MACE: + if (main_hand_mastery >= 3) + { + if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F) + hit_will_stun = true; + } + if (main_hand_mastery >= 4) + { + if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F) + hit_will_paralyze = true; + } + break; } } v50 = pMonster->pMonsterInfo.uID; a2 = 4; - v27 = pPlayer->CalculateMeleeDamageTo(0, 0, v50); - goto LABEL_65; - } + //v27 = player->CalculateMeleeDamageTo(0, 0, v50); + uDamageAmount = player->CalculateMeleeDamageTo(0, 0, v50); + //if ( !v57 ) + goto LABEL_67; + //goto LABEL_69; + } + + v19 = v4->field_48 == 99; v61 = v4->field_60_distance_related_prolly_lod; if ( !v19 ) { v9 = (LayingItem *)uDamageAmount; v50 = pParty->vPosition.x - *(int *)(uDamageAmount + 4); - v55 = abs(v50); + //v55 = abs(v50); pMonsterName = (char *)(pParty->vPosition.y - v9->vPosition.y); - v51 = (unsigned __int64 *)abs((int)pMonsterName); + //v51 = (unsigned __int64 *)abs((int)pMonsterName); pPlayerName = (char *)(pParty->vPosition.z - v9->vPosition.z); v52 = abs((int)pPlayerName); - v61 = v55; - v10 = v55; - v11 = (int)v51; + v61 = abs(v50); + v10 = abs(v50); + v11 = (int)abs((int)pMonsterName); v12 = v52; - if ( v55 < (signed int)v51 ) - { - v10 = (int)v51; - v11 = v55; + if ( v10 < v11) + { + v10 = (int)v11; + v11 = v10; } if ( v10 < v52 ) { @@ -5321,9 +5325,9 @@ v12 = v11; v11 = v14; } - uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; - v61 = uPlayerID; - if ( uPlayerID >= 2560 ) + //uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; + v61 = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; + if ( v61 >= 2560 ) { if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) ) return; @@ -5335,15 +5339,16 @@ } v4 = (LayingItem *)uDamageAmount; } + v15 = v4->field_48; if ( v15 == 102 ) { - v16 = pPlayer->pActiveSkills[7]; + v16 = player->pActiveSkills[7]; v61 = 1; if ( (signed int)SkillToMastery(v16) >= 3 ) - a4 = pPlayer->pActiveSkills[7] & 0x3F; + a4 = player->pActiveSkills[7] & 0x3F; a2 = 4; - uDamageAmount = pPlayer->CalculateMeleeDamageTo(1, 1, 0); + uDamageAmount = player->CalculateMeleeDamageTo(1, 1, 0); goto LABEL_67; } if ( v15 != 100 ) @@ -5351,7 +5356,7 @@ if ( v15 == 101 ) { a2 = 0; - v18 = pPlayer->CalculateRangedDamageTo(0); + v18 = player->CalculateRangedDamageTo(0); v19 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; v20 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; uDamageAmount = v18; @@ -5363,7 +5368,7 @@ if ( v15 == 39 ) { a4 = 5 * v4->field_4C; - a2 = pPlayer->GetSpellSchool(0x27u); + a2 = player->GetSpellSchool(0x27u); v21 = v4->field_4C; v50 = pMonster->sCurrentHP; pMonsterName = (char *)v4->field_50; @@ -5375,10 +5380,10 @@ uDamageAmount >>= 1; v59 = 0; LABEL_67: - if ( !stru_50C198.PlayerHitOrMiss(pPlayer, pMonster, v61, a4) ) - { -LABEL_68: - pPlayer->PlaySound(SPEECH_52, 0); + if ( !stru_50C198.PlayerHitOrMiss(player, pMonster, v61, a4) ) + { +//LABEL_68: + player->PlaySound(SPEECH_52, 0); return; } goto LABEL_69; @@ -5387,27 +5392,30 @@ { uDamageAmount = 0; a2 = 4; - v58 = 1; + hit_will_stun = 1; goto LABEL_67; } v50 = v4->field_48; - a2 = pPlayer->GetSpellSchool(v50); + a2 = player->GetSpellSchool(v50); v25 = v4->field_4C; v26 = v4->field_48; v50 = pMonster->sCurrentHP; pMonsterName = (char *)v4->field_50; - v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); + //v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); v59 = 0; - v57 = (PlayerEquipment *)1; -LABEL_65: - uDamageAmount = v27; - goto LABEL_66; + //v57 = (PlayerEquipment *)1; +//LABEL_65: + uDamageAmount = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); + //if ( !v57 ) + // goto LABEL_67; + goto LABEL_69; } v50 = pMonster->word_000086_some_monster_id; a2 = 4; - v17 = pPlayer->CalculateRangedDamageTo(v50); + v17 = player->CalculateRangedDamageTo(v50); v19 = v4->stru_24.uItemID == 0; uDamageAmount = v17; + v57 = 0; if ( !v19 && v4->stru_24.uAdditionalValue == 3 ) { a2 = 0; @@ -5417,18 +5425,18 @@ && (SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) > 0 || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) uDamageAmount >>= 1; v59 = 1; -LABEL_66: +//LABEL_66: if ( !v57 ) goto LABEL_67; LABEL_69: - if ( pPlayer->pConditions[1] ) - uDamageAmount >>= 1; + if (player->Weak()) + uDamageAmount /= 1; if ( (signed __int64)pMonster->pActorBuffs[5].uExpireTime > 0 ) uDamageAmount = 0; v61 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, uDamageAmount); - if ( !v4 && pPlayer->IsUnarmed() && (signed __int64)pPlayer->pPlayerBuffs[6].uExpireTime > 0 ) - { - v50 = pPlayer->pPlayerBuffs[6].uPower; + if ( !v4 && player->IsUnarmed() && (signed __int64)player->pPlayerBuffs[6].uExpireTime > 0 ) + { + v50 = player->pPlayerBuffs[6].uPower; v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, v50); v61 += v29; } @@ -5440,9 +5448,9 @@ a4 = v4->stru_24._439DF3_get_additional_damage(&a2, &v62); if ( v62 && pMonster->sCurrentHP > 0 ) { - pPlayer->sHealth += v61 / 5; - if ( pPlayer->sHealth > pPlayer->GetMaxHealth() ) - pPlayer->sHealth = pPlayer->GetMaxHealth(); + player->sHealth += v61 / 5; + if ( player->sHealth > player->GetMaxHealth() ) + player->sHealth = player->GetMaxHealth(); v62 = 0; } v30 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); @@ -5451,18 +5459,18 @@ else { v59 = 0; - v57 = &pPlayer->pEquipment; + v57 = &player->pEquipment; do { - if ( pPlayer->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) - { - auto _s = (ItemGen *)&pPlayer->pInventoryItems[v57->uOffHand-1]; + if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) + { + auto _s = (ItemGen *)&player->pInventoryItems[v57->uOffHand-1]; a4 = _s->_439DF3_get_additional_damage(&a2, &v62); if ( v62 && pMonster->sCurrentHP > 0 ) { - pPlayer->sHealth += v61 / 5; - if ( pPlayer->sHealth > pPlayer->GetMaxHealth() ) - pPlayer->sHealth = pPlayer->GetMaxHealth(); + player->sHealth += v61 / 5; + if ( player->sHealth > player->GetMaxHealth() ) + player->sHealth = player->GetMaxHealth(); v62 = 0; } v31 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); @@ -5476,22 +5484,25 @@ } v32 = uDamageAmount; pMonster->sCurrentHP -= uDamageAmount; - if ( !v32 && !v58 ) - goto LABEL_68; + if ( !v32 && !hit_will_stun ) + { + player->PlaySound(SPEECH_52, 0); + return; + } if ( pMonster->sCurrentHP > 0 ) { - Actor::_4030AD(uActorID_Monster_, v54, 0); + Actor::_4030AD(uActorID_Monster_, a1, 0); Actor::_43AC45(uActorID_Monster_, 1); if ( bShowDamage ) { v50 = uDamageAmount; pMonsterName = (char *)pMonster; - pPlayerName = pPlayer->pName; + pPlayerName = player->pName; if ( v4 ) v47 = pGlobalTXT_LocalizationStrings[189];// "%s shoots %s for %lu points" else v47 = pGlobalTXT_LocalizationStrings[164];// "%s hits %s for %lu damage" - sprintf(pTmpBuf, v47, pPlayerName, pMonsterName, v50); + sprintfex(pTmpBuf, v47, pPlayerName, pMonsterName, v50); ShowStatusBarString(pTmpBuf, 2u); } v41 = 0; @@ -5501,7 +5512,7 @@ if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 ) { v33 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; - v55 = v33; + //v55 = v33; if ( pRenderer->pRenderD3D ) { if ( pGame->uFlags2 & 0x20 ) @@ -5509,18 +5520,18 @@ v50 = 0; pMonsterName = 0; v34 = pMonster->vPosition.z; - *(float *)&pPlayerName = (double)v55; - v51 = (unsigned __int64 *)v34; + *(float *)&pPlayerName = (double)v33; + //v51 = (unsigned __int64 *)v34; *(float *)&v47 = 0.0; v35 = pMonster->vPosition.y; *((float *)&v46 + 1) = 0.0; *(float *)&v46 = 1.0; - v36 = (double)(signed int)v51; - v51 = (unsigned __int64 *)v35; + v36 = (double)(signed int)pMonster->vPosition.z; + //v51 = (unsigned __int64 *)v35; v37 = v36; - v51 = (unsigned __int64 *)pMonster->vPosition.x; + //v51 = (unsigned __int64 *)pMonster->vPosition.x; v38 = (double)v35; - v39 = (double)(signed int)v51; + v39 = (double)(signed int)pMonster->vPosition.x; pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0); } } @@ -5533,14 +5544,14 @@ v40 = SPEECH_51; if ( rand() % 100 < 20 ) v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1; - pPlayer->PlaySound((PlayerSpeech)v40, 0); + player->PlaySound((PlayerSpeech)v40, 0); v41 = 0; if ( bShowDamage ) { v50 = (int)pMonster; pMonsterName = (char *)uDamageAmount; - pPlayerName = pPlayer->pName; // "%s inflicts %lu points killing %s" - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[175], pPlayer->pName, uDamageAmount, pMonster); + pPlayerName = player->pName; // "%s inflicts %lu points killing %s" + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster); ShowStatusBarString(pTmpBuf, 2u); } } @@ -5548,10 +5559,10 @@ && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41) && uDamageAmount != v41 ) - pPlayer->ReceiveDamage(uDamageAmount, a2); + player->ReceiveDamage(uDamageAmount, a2); v50 = 24; v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; - if ( (pPlayer->_48EA46_calc_special_bonus_by_items(24) || v58 != v41) + if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41) && stru_50C198.GetMagicalResistance(pMonster, 3u) ) { LODWORD(v42) = 20; @@ -5562,28 +5573,28 @@ if ( bShowDamage != v41 ) { v50 = (int)pMonster; - pMonsterName = pPlayer->pName; // "%s stuns %s" - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[635], pPlayer->pName, pMonster); + pMonsterName = player->pName; // "%s stuns %s" + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[635], player->pName, pMonster); ShowStatusBarString(pTmpBuf, 2u); } } - if ( v53 != v41 ) + if ( hit_will_paralyze != v41 ) { if ( pMonster->CanAct() ) { - if ( stru_50C198.GetMagicalResistance(pMonster, 3u) ) - { - LOBYTE(v43) = pPlayer->GetActualSkillLevel(PLAYER_SKILL_MACE); + if ( stru_50C198.GetMagicalResistance(pMonster, 3) ) + { + LOBYTE(v43) = player->GetActualSkillLevel(PLAYER_SKILL_MACE); v44 = v43; v45 = SkillToMastery(v43); - v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F)); - v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v51 * 0.033333335); + //v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F)); + v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(7680 * (v44 & 0x3F)) * 0.033333335); pMonster->pActorBuffs[6].Apply(v46, v45, 0, 0, 0); if ( bShowDamage ) { v50 = (int)pMonster; - pMonsterName = pPlayer->pName; // "%s paralyzes %s" - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[636], pPlayer->pName, pMonster); + pMonsterName = player->pName; // "%s paralyzes %s" + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[636], player->pName, pMonster); ShowStatusBarString(pTmpBuf, 2u); } } @@ -5883,10 +5894,10 @@ return; } v37 = &pLayingItems[uActorID]; - v38 = v37->field_58 & 7; - v39 = v37->field_58 >> 3; - v40 = v37->field_58 & 7; - uActorID = v37->field_58 >> 3; + v38 = v37->field_58_pid & 7; + v39 = v37->field_58_pid >> 3; + v40 = v37->field_58_pid & 7; + uActorID = v37->field_58_pid >> 3; v41 = v40 - 2; if ( !v41 ) goto LABEL_80; @@ -6072,7 +6083,7 @@ v43 = &pParty->pPlayers[a4]; LABEL_168: a4b = v43; - if ( v38 != 4 || v37->field_48 != 100 ) + if ( v38 != OBJECT_Player || v37->field_48 != 100 ) { v70 = v43->GetMaxHealth(); v68 = _43AFE3_calc_spell_damage(v37->field_48, v37->field_4C, v37->field_50, v70); @@ -6084,7 +6095,7 @@ v69 = 0; } a4b->ReceiveDamage(v68, v69); - if ( v38 == 4 && !qword_A750D8 ) + if ( v38 == OBJECT_Player && !qword_A750D8 ) { qword_A750D8 = 256i64; word_A750E0 = 44; @@ -6124,7 +6135,7 @@ v6 = uLayingItemID; v2 = uLayingItemID; v3 = a2 >> 3; - v4 = pLayingItems[uLayingItemID].field_58 & 7; + v4 = pLayingItems[uLayingItemID].field_58_pid & 7; v5 = (a2 & 7) - 3; if ( v5 ) { @@ -6296,7 +6307,7 @@ uActorIDa = uActorID; pActor = &pActors[uActorID]; a2 = uObjID; - if ( !pActors[uActorID].IsAlive() ) + if ( !pActors[uActorID].IsNotAlive() ) { if ( (a2 & 7) == OBJECT_Item) { @@ -6361,14 +6372,14 @@ { v5 = &pLayingItems[a1 >> 3]; v4 = v5->field_60_distance_related_prolly_lod; - v17 = v5->field_58; + v17 = v5->field_58_pid; } LOWORD(v6) = v17 & 7; - if ( v6 == 3 ) + if ( v6 == OBJECT_Actor) { v7 = &pActors[a2]; v8 = &pActors[v17 >> 3]; - v6 = pActors[a2].IsAlive(); + v6 = pActors[a2].IsNotAlive(); if ( !v6 ) { v9 = v7->uAIState == 7; @@ -12088,7 +12099,7 @@ if ( (v6 & 0x100000) == v8 ) { ++*v1; - if ( v5->IsAlive() == 1 ) + if ( v5->IsNotAlive() == 1 ) ++v3; } ++v4; @@ -12127,7 +12138,7 @@ if ( v4->pMonsterInfo.field_33 == v7 ) { ++*v2; - if ( v4->IsAlive() == 1 ) + if ( v4->IsNotAlive() == 1 ) ++v9; } } @@ -12167,7 +12178,7 @@ if ( v4->uGroup == v7 ) { ++*v2; - if ( v4->IsAlive() == 1 ) + if ( v4->IsNotAlive() == 1 ) ++v9; } } @@ -12197,7 +12208,7 @@ if ( (v6 & 0x100000) == v4 ) { *v3 = 1; - if ( pActors[v2].IsAlive() == 1 ) + if ( pActors[v2].IsNotAlive() == 1 ) v5 = 1; } return v5;
--- a/mm7_6.cpp Tue Feb 19 13:31:50 2013 +0200 +++ b/mm7_6.cpp Tue Feb 19 15:39:50 2013 +0200 @@ -3512,8 +3512,8 @@ a1.uSpriteFrameID = 0; a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v19 = 8 * v3->uPlayerID; - LOBYTE(v19) = v19 | 4; - a1.field_58 = v19; + LOBYTE(v19) = v19 | OBJECT_Player; + a1.field_58_pid = v19; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -3550,8 +3550,8 @@ a1.uSpriteFrameID = 0; a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; v22 = 8 * v3->uPlayerID; - LOBYTE(v22) = v22 | 4; - a1.field_58 = v22; + LOBYTE(v22) = v22 | OBJECT_Player; + a1.field_58_pid = v22; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -3656,8 +3656,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v34 = 8 * v3->uPlayerID; - LOBYTE(v34) = v34 | 4; - a1.field_58 = v34; + LOBYTE(v34) = v34 | OBJECT_Player; + a1.field_58_pid = v34; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -3689,9 +3689,9 @@ v37 = v3->uPlayerID; a1.field_60_distance_related_prolly_lod = 0; v37 *= 8; - LOBYTE(v37) = v37 | 4; + LOBYTE(v37) = v37 | OBJECT_Player; a1.uFacing = v1; - a1.field_58 = v37; + a1.field_58_pid = v37; v38 = a2 >> 3; a1.uSoundID = LOWORD(v3->field_10); v39 = a2 >> 3; @@ -3733,9 +3733,9 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v44 *= 8; - LOBYTE(v44) = v44 | 4; + LOBYTE(v44) = v44 | OBJECT_Player; v38 = (signed int)v726; - a1.field_58 = v44; + a1.field_58_pid = v44; a1.uSoundID = LOWORD(v3->field_10); a1.vPosition.x = *(__int16 *)((char *)&pActors[0].vPosition.x + HIDWORD(v733)); v45 = *(__int16 *)((char *)&pActors[0].vPosition.y + HIDWORD(v733)); @@ -3771,8 +3771,8 @@ a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, v48); a1.uSpriteFrameID = v1; v49 = 8 * v3->uPlayerID; - LOBYTE(v49) = v49 | 4; - a1.field_58 = v49; + LOBYTE(v49) = v49 | OBJECT_Player; + a1.field_58_pid = v49; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -3818,8 +3818,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v50 = 8 * v3->uPlayerID; - LOBYTE(v50) = v50 | 4; - a1.field_58 = v50; + LOBYTE(v50) = v50 | OBJECT_Player; + a1.field_58_pid = v50; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -3967,8 +3967,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v62 = 8 * v3->uPlayerID; - LOBYTE(v62) = v62 | 4; - a1.field_58 = v62; + LOBYTE(v62) = v62 | OBJECT_Player; + a1.field_58_pid = v62; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -4369,9 +4369,9 @@ a1.uSectorID = 0; a1.uSpriteFrameID = 0; v120 = 8 * *(short *)(v119 + 2); - LOBYTE(v120) = v120 | 4; + LOBYTE(v120) = v120 | OBJECT_Player; a1.field_60_distance_related_prolly_lod = 0; - a1.field_58 = v120; + a1.field_58_pid = v120; a1.uFacing = 0; a1.uSoundID = *(short *)(v119 + 16); a1.vPosition.x = v112->vPosition.x; @@ -4572,7 +4572,7 @@ a1.uSectorID = v1; a1.vPosition.z = a2 + v713; a1.uSpriteFrameID = v1; - a1.field_58 = 8 * v3->uPlayerID | 4; + a1.field_58_pid = 8 * v3->uPlayerID | OBJECT_Player; a1.field_5C = v730; a1.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); a1.uFacing = v687; @@ -4620,8 +4620,8 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v161 *= 8; - LOBYTE(v161) = v161 | 4; - a1.field_58 = v161; + LOBYTE(v161) = v161 | OBJECT_Player; + a1.field_58_pid = v161; a1.uSoundID = LOWORD(v3->field_10); a2 = v1; if ( (signed int)v726 > v1 ) @@ -4759,8 +4759,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v187 = 8 * v3->uPlayerID; - LOBYTE(v187) = v187 | 4; - a1.field_58 = v187; + LOBYTE(v187) = v187 | OBJECT_Player; + a1.field_58_pid = v187; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uSoundID = LOWORD(v3->field_10); @@ -4976,7 +4976,7 @@ a1.uSectorID = v1; a1.vPosition.z = (int)((char *)_this + LODWORD(v725)); a1.uSpriteFrameID = v1; - a1.field_58 = 8 * v3->uPlayerID | 4; + a1.field_58_pid = 8 * v3->uPlayerID | OBJECT_Player; a1.field_5C = v730; a1.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); a1.uFacing = v685; @@ -5071,8 +5071,8 @@ a1.uSpriteFrameID = v1; a1.uSectorID = v52; v53 = 8 * v3->uPlayerID; - LOBYTE(v53) = v53 | 4; - a1.field_58 = v53; + LOBYTE(v53) = v53 | OBJECT_Player; + a1.field_58_pid = v53; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -5107,8 +5107,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v226 = 8 * v3->uPlayerID; - LOBYTE(v226) = v226 | 4; - a1.field_58 = v226; + LOBYTE(v226) = v226 | OBJECT_Player; + a1.field_58_pid = v226; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uSoundID = LOWORD(v3->field_10); @@ -5693,8 +5693,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); a1.uSpriteFrameID = v1; v326 = 8 * v3->uPlayerID; - LOBYTE(v326) = v326 | 4; - a1.field_58 = v326; + LOBYTE(v326) = v326 | OBJECT_Player; + a1.field_58_pid = v326; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(pParty->sRotationY); @@ -5723,9 +5723,9 @@ a1.uSpriteFrameID = v1; a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v327 = 8 * v3->uPlayerID; - LOBYTE(v327) = v327 | 4; + LOBYTE(v327) = v327 | OBJECT_Player; a1.field_60_distance_related_prolly_lod = 0; - a1.field_58 = v327; + a1.field_58_pid = v327; a1.field_5C = a2; a1.uFacing = LOWORD(pParty->sRotationY); a1.uSoundID = LOWORD(v3->field_10); @@ -5940,8 +5940,8 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v368 *= 8; - LOBYTE(v368) = v368 | 4; - a1.field_58 = v368; + LOBYTE(v368) = v368 | OBJECT_Player; + a1.field_58_pid = v368; a1.uSoundID = LOWORD(v3->field_10); for ( a2 = v1; a2 < (signed int)v726; ++a2 ) { @@ -6381,8 +6381,8 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v432 *= 8; - LOBYTE(v432) = v432 | 4; - a1.field_58 = v432; + LOBYTE(v432) = v432 | OBJECT_Player; + a1.field_58_pid = v432; a1.uSoundID = LOWORD(v3->field_10); for ( a2 = v1; a2 < (signed int)v726; ++a2 ) { @@ -6842,8 +6842,8 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v506 *= 8; - LOBYTE(v506) = v506 | 4; - a1.field_58 = v506; + LOBYTE(v506) = v506 | OBJECT_Player; + a1.field_58_pid = v506; a1.uSoundID = LOWORD(v3->field_10); a2 = v1; if ( SHIDWORD(v733) > v1 ) @@ -7012,8 +7012,8 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v532 *= 8; - LOBYTE(v532) = v532 | 4; - a1.field_58 = v532; + LOBYTE(v532) = v532 | OBJECT_Player; + a1.field_58_pid = v532; a1.uSoundID = LOWORD(v3->field_10); a2 = v1; if ( (signed int)v726 > v1 ) @@ -7284,9 +7284,9 @@ a1.field_60_distance_related_prolly_lod = 0; v581 = v721; v580 *= 8; - LOBYTE(v580) = v580 | 4; + LOBYTE(v580) = v580 | OBJECT_Player; a1.uFacing = v1; - a1.field_58 = v580; + a1.field_58_pid = v580; a1.uSoundID = LOWORD(v3->field_10); a1.vPosition.x = *(short *)(v721 + 142); a1.vPosition.y = *(short *)(v721 + 144); @@ -7386,8 +7386,8 @@ pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); a1.uSpriteFrameID = v1; v595 = 8 * v3->uPlayerID; - LOBYTE(v595) = v595 | 4; - a1.field_58 = v595; + LOBYTE(v595) = v595 | OBJECT_Player; + a1.field_58_pid = v595; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uSoundID = LOWORD(v3->field_10); @@ -7471,8 +7471,8 @@ a1.uSectorID = pIndoor->GetSector(v657, v665, v676); a1.uSpriteFrameID = v1; v604 = 8 * v3->uPlayerID; - LOBYTE(v604) = v604 | 4; - a1.field_58 = v604; + LOBYTE(v604) = v604 | OBJECT_Player; + a1.field_58_pid = v604; a1.field_5C = a2; a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); a1.uFacing = LOWORD(v715.uYawAngle); @@ -7619,8 +7619,8 @@ a1.field_60_distance_related_prolly_lod = 0; a1.uFacing = v1; v624 *= 8; - LOBYTE(v624) = v624 | 4; - a1.field_58 = v624; + LOBYTE(v624) = v624 | OBJECT_Player; + a1.field_58_pid = v624; a1.uSoundID = LOWORD(v3->field_10); a2 = v1; if ( SHIDWORD(v733) > v1 ) @@ -7961,55 +7961,38 @@ if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) player->pEquipment.uMainHand = 0; } - else if (target_type == OBJECT_Actor) + else if (target_type == OBJECT_Actor && actor_distance <= 407.2) { - if (actor_distance <= 407.2) - { - Vec3_int_ a3; - a3.x = actor->vPosition.x - pParty->vPosition.x; - a3.y = actor->vPosition.y - pParty->vPosition.y; - a3.z = actor->vPosition.z - pParty->vPosition.z; - Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); - - DamageMonsterFromParty((8 * uActiveCharacter - 8) | OBJECT_Player, target_id, &a3); - if (player->WearsItem(506, 1) || player->WearsItem(506, 0)) + Vec3_int_ a3; + a3.x = actor->vPosition.x - pParty->vPosition.x; + a3.y = actor->vPosition.y - pParty->vPosition.y; + a3.z = actor->vPosition.z - pParty->vPosition.z; + Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); + + DamageMonsterFromParty((8 * (uActiveCharacter - 1)) | OBJECT_Player, target_id, &a3); + if (player->WearsItem(506, 1) || player->WearsItem(506, 0)) _42FA66_do_explosive_impact( actor->vPosition.x, actor->vPosition.y, actor->vPosition.z + actor->uActorHeight / 2, 0, 512, uActiveCharacter); - } - else if (bow_idx) - { - shooting_bow = true; - - _42777D_CastSpell_UseWand_ShootArrow(100, uActiveCharacter - 1, 0, 0, 0); - if (!pParty->bTurnBasedModeOn) - { - int recovery = player->GetAttackRecoveryTime(0); - if (recovery < 30) - recovery = 30; - player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); - } - } + } + else if (bow_idx) + { + shooting_bow = true; + _42777D_CastSpell_UseWand_ShootArrow(100, uActiveCharacter - 1, 0, 0, 0); } else { - if (bow_idx) - { - shooting_bow = true; - _42777D_CastSpell_UseWand_ShootArrow(100, uActiveCharacter - 1, 0, 0, 0); - } - else - { - if (!pParty->bTurnBasedModeOn) - { - int recovery = player->GetAttackRecoveryTime(0); - if (recovery < 30 ) - recovery = 30; - player->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333)); - } - } + ; // actor out of range or no actor; no ranged weapon so melee attacking air + } + + if (!pParty->bTurnBasedModeOn) + { + int recovery = player->GetAttackRecoveryTime(0); + if (recovery < 30 ) + recovery = 30; + player->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333)); } @@ -8508,7 +8491,7 @@ a1a.uAttributes = attributes; a1a.uSectorID = pIndoor->GetSector(v21, y, z); a1a.uSpriteFrameID = 0; - a1a.field_58 = 0; + a1a.field_58_pid = 0; a1a.field_5C = 0; if ( !(a1a.uAttributes & 0x10) ) { @@ -8614,7 +8597,7 @@ a1.uAttributes = 0; a1.uSectorID = pIndoor->GetSector(v3, v4, z); a1.uSpriteFrameID = 0; - a1.field_58 = 0; + a1.field_58_pid = 0; a1.field_5C = 0; v8 = a1.Create(0, 0, 0, 0); if ( v8 != -1 ) @@ -8714,12 +8697,12 @@ if ( a6 >= 1 || a6 <= 4 ) { v10 = 8 * a6 - 8; - LOBYTE(v10) = v10 | 4; - a1a.field_58 = v10; + LOBYTE(v10) = v10 | OBJECT_Player; + a1a.field_58_pid = v10; } else { - a1a.field_58 = 0; + a1a.field_58_pid = 0; } result = a1a.Create(0, 0, 0, 0); if ( result != -1 )
--- a/mm7text_ru.cpp Tue Feb 19 13:31:50 2013 +0200 +++ b/mm7text_ru.cpp Tue Feb 19 15:39:50 2013 +0200 @@ -1096,7 +1096,8 @@ else left = match; } - assert(false); + + Log::Warning(L"sprintfex: unknown gender: %S", name); return 0; }
--- a/stru6.cpp Tue Feb 19 13:31:50 2013 +0200 +++ b/stru6.cpp Tue Feb 19 15:39:50 2013 +0200 @@ -865,7 +865,7 @@ result = AddMobileLight(a2, 0xFF3C1Eu, 256);// fireball hit if ( pRenderer->pRenderD3D ) { - result = a2->field_58 & 7; + result = a2->field_58_pid & 7; if ( result != 3 ) { if ( result != 2 )