-
AlexSpl
имя: Александр
- Эксперт
-
- Сообщения: 5587
- Зарегистрирован: 17 сен 2010, 12:58
- Пол:
- Награды: 14
-
-
- Поблагодарили: 2185 раз.
|
AlexSpl » 19 авг 2021, 07:03
Починил свитки и артефакты, дающие заклинания (кроме сборников пока): - Код: Выделить всё
#define _CRT_SECURE_NO_WARNINGS #include <bitset> #include "..\..\HotA\homm3.h"
Patcher* _P; PatcherInstance* _PI;
//char iniPath[MAX_PATH];
#define SPELLS_MAX 128 #define SPELLS_NUM 71 #define SPL_FEAR 70
_Spell_ spell[SPELLS_MAX];
int __stdcall afterInit(LoHook* h, HookContext* c) { for (int i = 0; i < SPL_FEAR; ++i) spell[i] = o_Spell[i];
spell[SPL_FEAR].type = -1; spell[SPL_FEAR].wav_name = "Fear.wav"; spell[SPL_FEAR].animation_ix = 15; spell[SPL_FEAR].flags = 0x20415; spell[SPL_FEAR].name = "Fear"; spell[SPL_FEAR].short_name = "Fear"; spell[SPL_FEAR].level = 4; spell[SPL_FEAR].school_flags = 8; spell[SPL_FEAR].mana_cost[0] = 16; spell[SPL_FEAR].mana_cost[1] = 8; spell[SPL_FEAR].mana_cost[2] = 8; spell[SPL_FEAR].mana_cost[3] = 8; spell[SPL_FEAR].eff_power = 0; spell[SPL_FEAR].effect[0] = 75; spell[SPL_FEAR].effect[1] = 75; spell[SPL_FEAR].effect[2] = 50; spell[SPL_FEAR].effect[3] = 25; spell[SPL_FEAR].chance2get_var[0] = 10; spell[SPL_FEAR].chance2get_var[1] = 10; spell[SPL_FEAR].chance2get_var[2] = 10; spell[SPL_FEAR].chance2get_var[3] = 10; spell[SPL_FEAR].chance2get_var[4] = 10; spell[SPL_FEAR].chance2get_var[5] = 10; spell[SPL_FEAR].chance2get_var[6] = 10; spell[SPL_FEAR].chance2get_var[7] = 10; spell[SPL_FEAR].chance2get_var[8] = 10; spell[SPL_FEAR].ai_value[0] = 50; spell[SPL_FEAR].ai_value[1] = 50; spell[SPL_FEAR].ai_value[2] = 50; spell[SPL_FEAR].ai_value[3] = 50; spell[SPL_FEAR].description[0] = "{Fear}\n\nStrikes an enemy unit with such fear that it becomes unable to attack and nearly unable to move.\n"; spell[SPL_FEAR].description[1] = "{Basic Fear}\n\nStrikes an enemy unit with such fear that it becomes unable to attack and nearly unable to move.\n\nSpell Point cost is half that of Normal Fear.\n"; spell[SPL_FEAR].description[2] = "{Advanced Fear}\n\nStrikes an enemy unit with such fear that it becomes unable to attack and nearly unable to move.\n\nPenalty to movement is twice that of Basic Fear.\n"; spell[SPL_FEAR].description[3] = "{Expert Fear}\n\nStrikes an enemy unit with such fear that it becomes unable to attack and nearly unable to move.\n\nPenalty to movement is three times that of Basic Fear.\n";
for (int i = SPL_FEAR + 1; i < SPL_FEAR + 11; ++i) spell[i] = o_Spell[i];
_PI->WriteDword(0x687FA8, (int)&spell);
return EXEC_DEFAULT; }
void __stdcall updateSpellsFromArtifacts(HiHook* hook, _Hero_* hero) { for (int i = 0; i < SPELLS_MAX; ++i) if (hero->spell[i] > 1) hero->spell[i] = 0;
for (int i = 0; i < 19; ++i) { if (hero->doll_art[i].id != ID_NONE) { if (hero->doll_art[i].id == AID_SPELL_SCROLL) { if (hero->doll_art[i].mod < SPELLS_NUM && !hero->spell[hero->doll_art[i].mod]) hero->spell[hero->doll_art[i].mod] = 2; } else if (o_ArtInfo[hero->doll_art[i].id].new_spell) { std::bitset<SPELLS_MAX> spells; CALL_2(int, __fastcall, 0x4D95C0, &spells, hero->doll_art[i].id);
for (std::size_t i = 0; i < spells.size(); ++i) { if (spells[i] && !hero->spell[i]) hero->spell[i] = 2; }
if (o_ArtInfo[hero->doll_art[i].id].supercomposite != -1) { // TODO: composite artifacts } } } } }
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { static bool plugin_On = false; if ( DLL_PROCESS_ATTACH == ul_reason_for_call ) { if ( !plugin_On ) { plugin_On = true; _P = GetPatcher(); _PI = _P->CreateInstance("HD.Plugin.H3.NewSpells");
//GetCurrentDirectoryA(sizeof(iniPath), iniPath); //strcat(iniPath, "\\NewSpells.ini");
// Moving and Expanding Spell Table _PI->WriteLoHook(0x4EE1C1, afterInit); // nwcthereisnospoon _PI->WriteByte (0x402902, SPELLS_NUM); _PI->WriteByte (0x41FC91, SPELLS_NUM); _PI->WriteDword(0x425E98, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteByte (0x427085, SPELLS_NUM); _PI->WriteDword(0x432A43, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteDword(0x432D1E, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteDword(0x43C21B, SPELLS_NUM * sizeof(_Spell_)); // Master Genie AI _PI->WriteDword(0x43C6F2, SPELLS_NUM * sizeof(_Spell_)); // Battle AI _PI->WriteDword(0x447551, SPELLS_NUM * sizeof(_Spell_)); // Casters _PI->WriteDword(0x447C7D, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteDword(0x447CC8, SPELLS_NUM * sizeof(_Spell_)); // Cheats in battle _PI->WriteByte (0x471C57, SPELLS_NUM); _PI->WriteByte (0x4864B0, SPELLS_NUM); _PI->WriteByte (0x48A34B, SPELLS_NUM); _PI->WriteByte (0x4C244D, SPELLS_NUM); _PI->WriteByte (0x4C246F, SPELLS_NUM); _PI->WriteDword(0x4C24C9, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteByte (0x4E67AC, SPELLS_NUM); _PI->WriteByte (0x4F508B, SPELLS_NUM); _PI->WriteDword(0x4F50CE, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteDword(0x4F5114, SPELLS_NUM * sizeof(_Spell_)); // _GameMgr_.disabled_spells[SPELLS_NUM] _PI->WriteByte (0x4C250E, SPELLS_NUM); _PI->WriteDword(0x4C2557, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteDword(0x4C260D, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteDword(0x4C92C5, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteDword(0x4C9347, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteDword(0x4C93C0, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteByte (0x4CEC4F, SPELLS_NUM); _PI->WriteByte (0x4D8F53, SPELLS_NUM); _PI->WriteByte (0x4D8F8A, SPELLS_NUM); // Tome of Air Magic _PI->WriteDword(0x4D962D, SPELLS_NUM * sizeof(_Spell_)); // Tome of Fire Magic _PI->WriteDword(0x4D9681, SPELLS_NUM * sizeof(_Spell_)); // Tome of Water Magic _PI->WriteDword(0x4D96D6, SPELLS_NUM * sizeof(_Spell_)); // Tome of Earth Magic _PI->WriteDword(0x4D972E, SPELLS_NUM * sizeof(_Spell_)); // Spellbinder's Hat _PI->WriteDword(0x4D9771, SPELLS_NUM * sizeof(_Spell_)); // Scholars _PI->WriteByte (0x5012B7, SPELLS_NUM); _PI->WriteDword(0x527B08, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteDword(0x52A9B6, SPELLS_NUM * sizeof(_Spell_)); // AI _PI->WriteDword(0x534C4B, SPELLS_NUM * sizeof(_Spell_)); // RMG _PI->WriteDword(0x5353D5, SPELLS_NUM); _PI->WriteByte (0x53542B, SPELLS_NUM); _PI->WriteDword(0x59CDBF, SPELLS_NUM * sizeof(_Spell_)); // Spell Book _PI->WriteDword(0x5A1AD6, SPELLS_NUM * sizeof(_Spell_)); // Cast Spell
// Mage Guild _PI->WriteByte (0x5BEA2C, SPELLS_NUM); _PI->WriteByte (0x5BEA70, SPELLS_NUM); _PI->WriteByte (0x5BEAAD, SPELLS_NUM); _PI->WriteDword(0x5BEAFE, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteDword(0x5BEB2C, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteByte (0x5BEB48, SPELLS_NUM); _PI->WriteByte (0x5BEB71, SPELLS_NUM); _PI->WriteByte (0x5BEBB2, SPELLS_NUM); _PI->WriteDword(0x5BEC05, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteByte (0x5BEC1B, SPELLS_NUM); // Conflux Grail _PI->WriteDword(0x5BE512, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteDword(0x5BE56E, SPELLS_NUM * sizeof(_Spell_)); _PI->WriteDword(0x5D7464, SPELLS_NUM); // --------------------------- // New _Hero_.spell[140] field // --------------------------- _PI->WriteCodePatch(0x4D8B72, "%n", 8); _PI->WriteCodePatch(0x4D8F7F, "%n", 8); _PI->WriteCodePatch(0x4D95AF, "%n", 7);
_PI->WriteDword(0x40D97C, 0x3EA); _PI->WriteDword(0x41FBDF, 0x3EA); _PI->WriteDword(0x425C72, 0x3EA); _PI->WriteDword(0x427039, 0x3EA); _PI->WriteDword(0x427044, 0x3EA); _PI->WriteDword(0x4329C1, 0x3EA); _PI->WriteDword(0x432CDE, 0x3EA); _PI->WriteDword(0x433026, 0x3EA); _PI->WriteDword(0x4336C0, 0x3EA); _PI->WriteDword(0x439330, 0x3EA); _PI->WriteDword(0x43C561, 0x3EA); // Clear _Hero_.spell[140] (optional) _PI->WriteDword(0x48647A, 0x23); _PI->WriteJmp(0x486485, 0x486498); _PI->WriteDword(0x4E57CC, 0x3EA); _PI->WriteDword(0x527ACB, 0x3EA); _PI->WriteDword(0x52A97A, 0x3EA); _PI->WriteDword(0x52AE1C, 0x3EA); // Spell Book _PI->WriteDword(0x59CD5E, 0x3EA);
// Artifacts (incl. Spell Scrolls); _PI->WriteHiHook(0x4D9840, SPLICE_, EXTENDED_, THISCALL_, updateSpellsFromArtifacts); } }
return TRUE; }
|