Mercurial > mm7
changeset 2305:a5e8eecac226
Merge
author | Grumpy7 |
---|---|
date | Sun, 16 Mar 2014 21:04:49 +0100 |
parents | e76b56512abd (diff) 42848bb89be8 (current diff) |
children | ca13c630ee2b |
files | |
diffstat | 10 files changed, 68 insertions(+), 125 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Mar 17 01:29:15 2014 +0600 +++ b/Actor.cpp Sun Mar 16 21:04:49 2014 +0100 @@ -3643,7 +3643,7 @@ && uDamageAmount != 0 ) player->ReceiveDamage(uDamageAmount, attackElement); int knockbackValue = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; - if ( (player->GetSpecialItemBonus(24) || hit_will_stun) && stru_50C198.GetMagicalResistance(pMonster, DMGT_EARTH) ) + if ( (player->GetSpecialItemBonus(24) || hit_will_stun) && pMonster->DoesDmgTypeDoDamage(DMGT_EARTH) ) { extraRecoveryTime = 20; knockbackValue = 10; @@ -3657,7 +3657,7 @@ ShowStatusBarString(pTmpBuf.data(), 2u); } } - if ( hit_will_paralyze && pMonster->CanAct() && stru_50C198.GetMagicalResistance(pMonster, DMGT_EARTH)) + if ( hit_will_paralyze && pMonster->CanAct() && pMonster->DoesDmgTypeDoDamage(DMGT_EARTH)) { v43 = player->GetActualSkillLevel(PLAYER_SKILL_MACE); v45 = SkillToMastery(v43); @@ -4246,6 +4246,54 @@ result = 0; return result; } + +//----- (00427662) -------------------------------------------------------- +bool Actor::DoesDmgTypeDoDamage(DAMAGE_TYPE uType) +{ + signed int resist; // esi@2 + bool result; // eax@13 + + switch ( uType ) + { + case 0: + resist = this->pMonsterInfo.uResFire; + break; + case 1: + resist = this->pMonsterInfo.uResAir; + break; + case 2: + resist = this->pMonsterInfo.uResWater; + break; + case 3: + resist = this->pMonsterInfo.uResEarth; + break; + case 4: + resist = this->pMonsterInfo.uResPhysical; + break; + case 6: + resist = this->pMonsterInfo.uResSpirit; + break; + case 7: + resist = this->pMonsterInfo.uResMind; + case 8: + resist = this->pMonsterInfo.uResBody; + break; + case 9: + resist = this->pMonsterInfo.uResLight; + break; + case 10: + resist = this->pMonsterInfo.uResDark; + break; + default: + return 1; + } + if ( resist < 200 ) + result = rand() % ((this->pMonsterInfo.uLevel >> 2) + resist + 30) < 30; + else + result = 0; + return result; +} + //----- (00448A98) -------------------------------------------------------- void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle) {
--- a/Actor.h Mon Mar 17 01:29:15 2014 +0600 +++ b/Actor.h Sun Mar 16 21:04:49 2014 +0100 @@ -14,7 +14,6 @@ { int which_player_to_attack(struct Actor *pActor); int _427546(int a2); - bool GetMagicalResistance(struct Actor *pActor, unsigned int uType); int FindClosestActor(int a2, int a3, int a4); char field_0; @@ -237,6 +236,7 @@ bool _4273BB_DoesHitOtherActor(Actor *defender, int a3, int a4); bool ActorHitOrMiss(Player *pPlayer); int CalcMagicalDamageToActor(DAMAGE_TYPE dmgType, signed int incomingDmg); + bool DoesDmgTypeDoDamage(DAMAGE_TYPE uType); char pActorName[32]; signed __int16 sNPC_ID;
--- a/CastSpellInfo.cpp Mon Mar 17 01:29:15 2014 +0600 +++ b/CastSpellInfo.cpp Sun Mar 16 21:04:49 2014 +0100 @@ -439,7 +439,7 @@ mon_id = PID_ID(a2); if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - if ( stru_50C198.GetMagicalResistance(&pActors[mon_id], 3) ) + if ( pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)3) ) { pActors[mon_id].pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); v704.x = 0; @@ -622,7 +622,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; mon_id = PID_ID(a2); - if (PID_TYPE(a2) == OBJECT_Actor && stru_50C198.GetMagicalResistance(&pActors[mon_id], 9) ) + if (PID_TYPE(a2) == OBJECT_Actor && pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)9) ) { Actor::AI_Stand(PID_ID(a2), 4, 0x80, 0); pActors[mon_id].pActorBuffs[ACTOR_BUFF_PARALYZED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)23040 * spell_level * 0.033333335), skill_level, 0, 0, 0); @@ -649,7 +649,7 @@ break; //v721 = 836 * PID_ID(a2); mon_id = PID_ID(a2); - if (PID_TYPE(a2) == OBJECT_Actor && stru_50C198.GetMagicalResistance(&pActors[mon_id], 3) ) + if (PID_TYPE(a2) == OBJECT_Actor && pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)3) ) { pActors[mon_id].pActorBuffs[ACTOR_BUFF_SLOWED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)23040 * spell_level * 0.033333335), skill_level, amount, 0, 0); pActors[mon_id].uAttributes |= 0x80000; @@ -663,7 +663,7 @@ v61 = PID_ID(a2); if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - if ( stru_50C198.GetMagicalResistance(&pActors[v61], 7) ) + if ( pActors[v61].DoesDmgTypeDoDamage((DAMAGE_TYPE)7) ) { uint power = 300 * spell_level; if ( skill_level == 2 ) @@ -2219,7 +2219,7 @@ if (PID_TYPE(a2) == OBJECT_Actor) { //v730 = 836 * mon_id; - if ( stru_50C198.GetMagicalResistance(&pActors[mon_id], 7) ) + if ( pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)7) ) { pActors[mon_id].pActorBuffs[ACTOR_BUFF_CHARM].Reset(); pActors[mon_id].pActorBuffs[ACTOR_BUFF_ENSLAVED].Reset(); @@ -2259,7 +2259,7 @@ //v730 = 836 * mon_id; if ( MonsterStats::BelongsToSupertype(pActors[mon_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) break; - if ( stru_50C198.GetMagicalResistance(&pActors[mon_id], 7) ) + if ( pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)7) ) { pActors[mon_id].pActorBuffs[ACTOR_BUFF_BERSERK].Reset(); pActors[mon_id].pActorBuffs[ACTOR_BUFF_CHARM].Reset(); @@ -2320,7 +2320,7 @@ pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.z - (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[a2]].uActorHeight * -0.8); pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); pSpellSprite.Create(0, 0, 0, 0); - if ( stru_50C198.GetMagicalResistance(&pActors[_50BF30_actors_in_viewport_ids[a2]], 7) ) + if ( pActors[_50BF30_actors_in_viewport_ids[a2]].DoesDmgTypeDoDamage((DAMAGE_TYPE)7) ) { pActors[_50BF30_actors_in_viewport_ids[a2]].pActorBuffs[ACTOR_BUFF_AFRAID].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), skill_level, 0, 0, 0); @@ -3006,7 +3006,7 @@ mon_id = PID_ID(a2); if ( !MonsterStats::BelongsToSupertype(pActors[mon_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) break; - if ( !stru_50C198.GetMagicalResistance(&pActors[mon_id], 10) ) + if ( !pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)10) ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
--- a/SpriteObject.cpp Mon Mar 17 01:29:15 2014 +0600 +++ b/SpriteObject.cpp Sun Mar 16 21:04:49 2014 +0100 @@ -1032,7 +1032,7 @@ if ( v11 >= v7 * v7 + v9 * v9 + v10 * v10 ) { - if ( stru_50C198.GetMagicalResistance(&pActors[i], 0xAu) ) + if ( pActors[i].DoesDmgTypeDoDamage((DAMAGE_TYPE)0xAu) ) { pActors[i].pActorBuffs[this->spell_id].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(this->spell_level << 7) * 0.033333335), this->spell_skill, 4, 0, 0);
--- a/mm7_2.cpp Mon Mar 17 01:29:15 2014 +0600 +++ b/mm7_2.cpp Sun Mar 16 21:04:49 2014 +0100 @@ -4343,7 +4343,7 @@ if ( pSpriteObjects[uLayingItemID].uType != 9030 || v152 != 4 ) { v108 = v139; - if ( stru_50C198.GetMagicalResistance(&pActors[v139], v107) ) + if ( pActors[v139].DoesDmgTypeDoDamage((DAMAGE_TYPE)v107) ) { v138 = 0; if ( pSpriteObjects[uLayingItemID].uType == 8030 )
--- a/mm7_6.cpp Mon Mar 17 01:29:15 2014 +0600 +++ b/mm7_6.cpp Sun Mar 16 21:04:49 2014 +0100 @@ -3,37 +3,26 @@ #include "Weather.h" #include "Sprites.h" -#include "BSPModel.h" #include "Mouse.h" #include "Keyboard.h" -#include "stru6.h" #include "Vis.h" #include "Game.h" #include "GUIWindow.h" -#include "GUIFont.h" #include "Party.h" #include "AudioPlayer.h" #include "Outdoor.h" -#include "Outdoor_stuff.h" -#include "Overlays.h" -#include "LOD.h" #include "Actor.h" -#include "Events.h" #include "Viewport.h" #include "OurMath.h" #include "SpriteObject.h" #include "ObjectList.h" -#include "stru123.h" #include "Timer.h" #include "IconFrameTable.h" -#include "Awards.h" #include "TurnEngine.h" #include "CastSpellInfo.h" #include "stru298.h" -#include "texts.h" -#include "mm7_data.h" @@ -59,53 +48,6 @@ return result; } -//----- (00427662) -------------------------------------------------------- -bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) -{ - signed int resist; // esi@2 - bool result; // eax@13 - - switch ( uType ) - { - case 0: - resist = pActor->pMonsterInfo.uResFire; - break; - case 1: - resist = pActor->pMonsterInfo.uResAir; - break; - case 2: - resist = pActor->pMonsterInfo.uResWater; - break; - case 3: - resist = pActor->pMonsterInfo.uResEarth; - break; - case 4: - resist = pActor->pMonsterInfo.uResPhysical; - break; - case 6: - resist = pActor->pMonsterInfo.uResSpirit; - break; - case 7: - resist = pActor->pMonsterInfo.uResMind; - case 8: - resist = pActor->pMonsterInfo.uResBody; - break; - case 9: - resist = pActor->pMonsterInfo.uResLight; - break; - case 10: - resist = pActor->pMonsterInfo.uResDark; - break; - default: - return 1; - } - if ( resist < 200 ) - result = rand() % (signed int)(((unsigned int)pActor->pMonsterInfo.uLevel >> 2) + resist + 30) < 30; - else - result = 0; - return result; -} - //----- (0042EB8D) -------------------------------------------------------- void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) {
--- a/mm7_7.cpp Mon Mar 17 01:29:15 2014 +0600 +++ b/mm7_7.cpp Sun Mar 16 21:04:49 2014 +0100 @@ -1,46 +1,4 @@ #define _CRT_SECURE_NO_WARNINGS -#include "mm7_data.h" -#include "Render.h" -#include "texts.h" -#include "Party.h" -#include "Viewport.h" - -int __cdecl sub_401022() -{ - int result; // eax@1 - signed int v1; // ecx@1 - int *v2; // edx@1 -/* - result = (int)dword_4F8580; - v1 = 60; - v2 = &dword_4F8580[1]; - do - { - v2[2] = 0; - v2[1] = 0; - *v2 = 0; - v2 += 3; - --v1; - } - while ( v1 ); - dword_4F8580[0] = 1; - return result; - */ - //__debugbreak();//Ritor1 - for( int i = 0; i < 62; i++ ) - { - dword_4F8580[i] = 0; - } - dword_4F8580[0] = 1; - return 0; -} - -//----- (00423B4A) -------------------------------------------------------- -void sub_423B4A() -{ - for ( uint i = 0; i < 50; i++ ) - array_507D30[i].flt_2C = 0.0; -} /* GUIProgressBar *__cdecl crt_construct_576E30() @@ -73,16 +31,12 @@ } */ -void constructors() +/*void constructors() { - sub_401022(); - sub_423B4A(); - //no call to these anywhere uGameUIFontMain_initialize(); uGameUIFontShadow_initialize(); - SetSomeItemsNames(); -} +}*/ /* @@ -96,7 +50,7 @@ IOStream .data:004DF00C dd offset sub_401022 -added +achieved by zero initializing dword_4F8580, dword_4F8580[0] = 1; is unused anyway .data:004DF010 dd offset sub_408B98 .data:004DF014 dd offset sub_409BCC @@ -128,7 +82,7 @@ .data:004DF050 dd offset uGameUIFontMain_initialize .data:004DF054 dd offset uGameUIFontShadow_initialize -added +X called in SetUserInterface(Neutral) .data:004DF058 dd offset crt_construct_507ABC .data:004DF05C dd offset crt_construct_507A94 @@ -152,7 +106,7 @@ deleted .data:004DF084 dd offset j_sub_423B4A -added +byte .data:004DF088 dd offset crt_sub_4262DD byte
--- a/mm7_data.cpp Mon Mar 17 01:29:15 2014 +0600 +++ b/mm7_data.cpp Sun Mar 16 21:04:49 2014 +0100 @@ -763,7 +763,7 @@ int ai_arrays_size; // weak std::array<int, 500> ai_near_actors_distances; std::array<unsigned int, 500> ai_near_actors_ids; -std::array<int, 182> dword_4F8580; // weak +std::array<int, 182> dword_4F8580 = {}; // weak char byte_4FAA24; // weak //HWND dword_4FAA28; // idb
--- a/mm7_unsorted_subs.h Mon Mar 17 01:29:15 2014 +0600 +++ b/mm7_unsorted_subs.h Sun Mar 16 21:04:49 2014 +0100 @@ -4,8 +4,6 @@ //------------------------------------------------------------------------- // Function declarations -void constructors(); - void init_event_triggers(); void check_event_triggers();
--- a/texts.cpp Mon Mar 17 01:29:15 2014 +0600 +++ b/texts.cpp Sun Mar 16 21:04:49 2014 +0100 @@ -150,6 +150,7 @@ test_string = strtok(NULL, "\r") + 1; //Carriage Return 0D 13 } + SetSomeItemsNames(); aMonthNames[0] = pGlobalTXT_LocalizationStrings[415]; aMonthNames[1] = pGlobalTXT_LocalizationStrings[416]; aMonthNames[2] = pGlobalTXT_LocalizationStrings[417]; aMonthNames[3] = pGlobalTXT_LocalizationStrings[418]; aMonthNames[4] = pGlobalTXT_LocalizationStrings[419]; aMonthNames[5] = pGlobalTXT_LocalizationStrings[420];