From 225f36808d4cc422bc5ae7ff6dd701e84f49df0d Mon Sep 17 00:00:00 2001 From: NovaRain Date: Mon, 16 Nov 2015 15:07:24 +0800 Subject: [PATCH] Added an optional bug fix for not counting in the weight of equipped items on NPC when stealing or bartering. Added an additional fix to InventoryDragIssuesFix for only using one box of ammo when the weapon is before the ammo. Partially refactored Credits.cpp and QuestList.cpp to use proper engine function/variable names. --- artifacts/ddraw.ini | 3 + sfall/Bugs.cpp | 125 ++++++------ sfall/Credits.cpp | 24 ++- sfall/QuestList.cpp | 455 +++++++++++++++++++++----------------------- 4 files changed, 297 insertions(+), 310 deletions(-) diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 4815c693..6db41d62 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -567,6 +567,9 @@ NPCTurnsIntoContainerFix=1 ;Set to 1 to fix issues with being able to charge the car with using cells on scenary/critters and cells getting consumed even when the car is already fully charged CarChargingFix=1 +;Set to 1 to fix issues with the weight of equipped items on NPC not being counted in when stealing or bartering +NPCWeightFix=1 + ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX [Debugging] diff --git a/sfall/Bugs.cpp b/sfall/Bugs.cpp index c04057bd..7d681b91 100644 --- a/sfall/Bugs.cpp +++ b/sfall/Bugs.cpp @@ -4,7 +4,7 @@ #include "Define.h" #include "FalloutEngine.h" -//DWORD WeightOnBody = 0; +DWORD WeightOnBody = 0; static void __declspec(naked) SharpShooterFix() { __asm { @@ -22,7 +22,6 @@ end: } } - static void __declspec(naked) pipboy_hack() { __asm { cmp ebx, 0x210 // Back button? @@ -181,7 +180,8 @@ itsJet: mov eax, 0x47A3FB jmp eax } -}*/ +} +*/ static void __declspec(naked) item_d_load_hack() { __asm { @@ -293,7 +293,7 @@ end: static void __declspec(naked) gdProcessUpdate_hack() { __asm { add eax, esi - cmp eax, dword ptr ds:[0x58ECCC] // _optionRect.offy + cmp eax, dword ptr ds:[_optionRect + 0xC] // _optionRect.offy jge skip add eax, 2 mov esi, 0x44702D @@ -304,8 +304,6 @@ skip: } } - - static void __declspec(naked) invenWieldFunc_item_get_type_hook() { __asm { pushad @@ -341,9 +339,7 @@ noWeapon: } } - -/* -static void __declspec(naked) loot_container_hook() { +static void __declspec(naked) loot_container_hack() { __asm { mov eax, [esp+0x114+0x4] test eax, eax @@ -369,10 +365,8 @@ noArmor: retn } } -*/ -/* -static void __declspec(naked) barter_inventory_hook() { +static void __declspec(naked) barter_inventory_hack() { __asm { mov eax, [esp+0x20+0x4] test eax, eax @@ -396,9 +390,6 @@ end: retn } } -*/ - -/* static void __declspec(naked) barter_attempt_transaction_hook() { __asm { @@ -428,7 +419,6 @@ end: retn } } -*/ static void __declspec(naked) inven_pickup_hack() { __asm { @@ -442,9 +432,8 @@ static void __declspec(naked) inven_pickup_hack() { } } - static DWORD inven_pickup_loop=-1; -static const DWORD inven_pickup_hook1_Loop = 0x471145; +static const DWORD inven_pickup_hack2_Loop = 0x471145; static void __declspec(naked) inven_pickup_hack2() { __asm { cmp inven_pickup_loop, -1 @@ -462,7 +451,7 @@ nextLoop: add edx, 35 // y_start mov ecx, edx add ecx, 48 // y_end - jmp inven_pickup_hook1_Loop + jmp inven_pickup_hack2_Loop inLoop: test eax, eax mov eax, inven_pickup_loop @@ -496,7 +485,6 @@ inRange: } } -/* static void __declspec(naked) drop_ammo_into_weapon_hook() { __asm { dec esi @@ -536,7 +524,6 @@ end: retn } } -*/ static void __declspec(naked) PipStatus_AddHotLines_hook() { __asm { @@ -583,7 +570,7 @@ static void __declspec(naked) action_melee_hack() { cmp ebx, OBJ_TYPE_CRITTER // check if object FID type flag is set to critter jne end // if object not a critter leave jump condition flags // set to skip dodge animation - test byte ptr [eax+0x44], 3 // (original code) DAM_KNOCKED_OUT or DAM_KNOCKED_DOWN + test byte ptr [eax+0x44], 0x3 // (original code) DAM_KNOCKED_OUT or DAM_KNOCKED_DOWN jnz end mov edx, 0x4113FE end: @@ -600,7 +587,7 @@ static void __declspec(naked) action_ranged_hack() { cmp ebx, OBJ_TYPE_CRITTER // check if object FID type flag is set to critter jne end // if object not a critter leave jump condition flags // set to skip dodge animation - test byte ptr [eax+0x44], 3 // (original code) DAM_KNOCKED_OUT or DAM_KNOCKED_DOWN + test byte ptr [eax+0x44], 0x3 // (original code) DAM_KNOCKED_OUT or DAM_KNOCKED_DOWN jnz end mov edx, 0x411BD2 end: @@ -608,7 +595,6 @@ end: } } - static void __declspec(naked) set_new_results_hack() { __asm { test ah, 0x1 // DAM_KNOCKED_OUT? @@ -695,9 +681,9 @@ found: } } -static void __declspec(naked) item_m_turn_off_hack() { +static void __declspec(naked) item_m_turn_off_hook() { __asm { - and byte ptr [eax+0x25], 0xDF // Unset flag of activated items + and byte ptr [eax+0x25], 0xDF // Rest flag of used items jmp queue_remove_this_ } } @@ -705,15 +691,17 @@ static void __declspec(naked) item_m_turn_off_hack() { void BugsInit() { - dlog("Applying sharpshooter patch.", DL_INIT); - // http://www.nma-fallout.com/showthread.php?178390-FO2-Engine-Tweaks&p=4050162&viewfull=1#post4050162 - // by Slider2k - HookCall(0x4244AB, &SharpShooterFix); // hooks stat_level_() call in detemine_to_hit_func_() - // // removes this line by making unconditional jump: - // if ( who == obj_dude ) - // dist -= 2 * perk_level_(obj_dude, PERK_sharpshooter); - SafeWrite8(0x424527, 0xEB); // in detemine_to_hit_func_() - dlogr(" Done", DL_INIT); + //if (GetPrivateProfileIntA("Misc", "SharpshooterFix", 1, ini)) { + dlog("Applying sharpshooter patch.", DL_INIT); + // http://www.nma-fallout.com/showthread.php?178390-FO2-Engine-Tweaks&p=4050162&viewfull=1#post4050162 + // by Slider2k + HookCall(0x4244AB, &SharpShooterFix); // hooks stat_level_() call in detemine_to_hit_func_() + // // removes this line by making unconditional jump: + // if ( who == obj_dude ) + // dist -= 2 * perk_level_(obj_dude, PERK_sharpshooter); + SafeWrite8(0x424527, 0xEB); // in detemine_to_hit_func_() + dlogr(" Done", DL_INIT); + //} // Fixes for clickability issue in Pip-Boy and exploit that allows to rest in places where you shouldn't be able to rest dlog("Applying fix for Pip-Boy rest exploit.", DL_INIT); @@ -783,12 +771,16 @@ void BugsInit() SafeWrite8(0x4AC377, 0x7F); // jg dlogr(" Done.", DL_INIT); - // Fix for not counting in weight of equipped items - /*MakeCall(0x473B4E, &loot_container_hook, false); - MakeCall(0x47588A, &barter_inventory_hook, false); - HookCall(0x474CB8, &barter_attempt_transaction_hook); - HookCall(0x4742AD, &move_inventory_hook); - HookCall(0x4771B5, &item_add_mult_hook);*/ + // Fix for not counting in the weight of equipped items on NPC when stealing or bartering + if (GetPrivateProfileIntA("Misc", "NPCWeightFix", 1, ini)) { + dlog("Applying fix for not counting in weight of equipped items on NPC.", DL_INIT); + MakeCall(0x473B4E, &loot_container_hack, false); + MakeCall(0x47588A, &barter_inventory_hack, false); + HookCall(0x474CB8, &barter_attempt_transaction_hook); + HookCall(0x4742AD, &move_inventory_hook); + HookCall(0x4771B5, &item_add_mult_hook); + dlogr(" Done.", DL_INIT); + } // Corrects "Weight of items" text element width to be 64 (and not 80), which matches container element width SafeWrite8(0x475541, 64); @@ -802,24 +794,29 @@ void BugsInit() // Fix for error in player's inventory, related to IFACE_BAR_MODE=1 in f2_res.ini, and // also for reverse order error MakeCall(0x47114A, &inven_pickup_hack2, true); + // Fix for using only one box of ammo when the weapon is before the ammo + HookCall(0x476598, &drop_ammo_into_weapon_hook); dlogr(" Done", DL_INIT); } - // Fix for using only one pack of ammo, when the weapon is before the ammo - //HookCall(0x476598, &drop_ammo_into_weapon_hook); + //if (GetPrivateProfileIntA("Misc", "BlackSkilldexFix", 1, ini)) { + dlog("Applying black skilldex patch.", DL_INIT); + HookCall(0x497D0F, &PipStatus_AddHotLines_hook); + dlogr(" Done", DL_INIT); + //} - dlog("Applying black skilldex patch.", DL_INIT); - HookCall(0x497D0F, &PipStatus_AddHotLines_hook); - dlogr(" Done", DL_INIT); + //if (GetPrivateProfileIntA("Misc", "FixWithdrawalPerkDescCrash", 1, ini)) { + dlog("Applying withdrawal perk description crash fix.", DL_INIT); + HookCall(0x47A501, &perform_withdrawal_start_display_print_hook); + dlogr(" Done", DL_INIT); + //} - dlog("Applying withdrawal perk description crash fix.", DL_INIT); - HookCall(0x47A501, &perform_withdrawal_start_display_print_hook); - dlogr(" Done", DL_INIT); - - dlog("Applying Jet Antidote fix.", DL_INIT); - // the original jet antidote fix - MakeCall(0x47A013, &item_d_take_drug_hack1, true); - dlogr(" Done", DL_INIT); + //if (GetPrivateProfileIntA("Misc", "JetAntidoteFix", 1, ini)) { + dlog("Applying Jet Antidote fix.", DL_INIT); + // the original jet antidote fix + MakeCall(0x47A013, &item_d_take_drug_hack1, true); + dlogr(" Done", DL_INIT); + //} if (GetPrivateProfileIntA("Misc", "NPCDrugAddictionFix", 1, ini)) { dlog("Applying NPC's drug addiction fix.", DL_INIT); @@ -829,9 +826,11 @@ void BugsInit() dlogr(" Done.", DL_INIT); } - dlog("Applying shiv patch.", DL_INIT); - SafeWrite8(0x477B2B, 0xEB); - dlogr(" Done", DL_INIT); + //if (GetPrivateProfileInt("Misc", "ShivPatch", 1, ini)) { + dlog("Applying shiv patch.", DL_INIT); + SafeWrite8(0x477B2B, 0xEB); + dlogr(" Done", DL_INIT); + //} //if (GetPrivateProfileIntA("Misc", "WieldObjCritterFix", 1, ini)) { dlog("Applying wield_obj_critter fix.", DL_INIT); @@ -840,10 +839,12 @@ void BugsInit() dlogr(" Done", DL_INIT); //} - dlog("Applying Dodgy Door Fix.", DL_INIT); - MakeCall(0x4113D6, &action_melee_hack, true); - MakeCall(0x411BCC, &action_ranged_hack, true); - dlogr(" Done", DL_INIT); + //if (GetPrivateProfileIntA("Misc", "DodgyDoorsFix", 1, ini)) { + dlog("Applying Dodgy Door Fix.", DL_INIT); + MakeCall(0x4113D6, &action_melee_hack, true); + MakeCall(0x411BCC, &action_ranged_hack, true); + dlogr(" Done", DL_INIT); + //} // Fix for "NPC turns into a container" bug if (GetPrivateProfileIntA("Misc", "NPCTurnsIntoContainerFix", 1, ini)) { @@ -861,7 +862,7 @@ void BugsInit() SafeWrite8(0x478115, 0xBA); SafeWrite8(0x478138, 0xBA); MakeCall(0x474D22, &barter_attempt_transaction_hack, true); - HookCall(0x4798B1, &item_m_turn_off_hack); + HookCall(0x4798B1, &item_m_turn_off_hook); dlogr(" Done", DL_INIT); } } diff --git a/sfall/Credits.cpp b/sfall/Credits.cpp index 39001db4..36be25f8 100644 --- a/sfall/Credits.cpp +++ b/sfall/Credits.cpp @@ -18,8 +18,9 @@ #include "main.h" -#include "Version.h" #include +#include "FalloutEngine.h" +#include "version.h" static DWORD InCredits=0; static DWORD CreditsLine=0; @@ -77,8 +78,7 @@ static void _stdcall ShowCreditsHook() { CreditsLine=0; __asm { mov eax, creditsFile; - mov ebx, 0x42C860; - call ebx; + call credits_; } InCredits=0; } @@ -89,22 +89,21 @@ static DWORD _stdcall CreditsNextLine(char* buf, DWORD* font, DWORD* colour) { if(strlen(line)) { if(line[0]=='#') { line++; - *font=*(DWORD*)0x56D74C; + *font=*(DWORD*)_name_font; *colour=*(BYTE*)0x6A7F01; } else if(line[0]=='@') { line++; - *font=*(DWORD*)0x56D748; - *colour=*(DWORD*)0x56D750; + *font=*(DWORD*)_title_font; + *colour=*(DWORD*)_title_color; } else { - *font=*(DWORD*)0x56D74C; - *colour=*(DWORD*)0x56D744; + *font=*(DWORD*)_name_font; + *colour=*(DWORD*)_name_color; } } strcpy_s(buf, 256, line); return 1; } -static const DWORD _credits_get_next_line=0x42CE6C; static void __declspec(naked) CreditsNextLineHook() { __asm { pushad; @@ -113,14 +112,13 @@ static void __declspec(naked) CreditsNextLineHook() { push eax; call CreditsNextLine; test eax, eax; - jz fail; popad; + jz fail; xor eax, eax; inc eax; retn; fail: - popad; - jmp _credits_get_next_line; + jmp credits_get_next_line_; } } @@ -128,4 +126,4 @@ void CreditsInit() { HookCall(0x480C49, &ShowCreditsHook); HookCall(0x43F881, &ShowCreditsHook); HookCall(0x42CB49, &CreditsNextLineHook); -} \ No newline at end of file +} diff --git a/sfall/QuestList.cpp b/sfall/QuestList.cpp index b89b012f..f2ca0050 100644 --- a/sfall/QuestList.cpp +++ b/sfall/QuestList.cpp @@ -18,31 +18,33 @@ #include "main.h" -static DWORD calledflag=0x0; -static DWORD called_quest_number=0x0; -static DWORD total_quests=0x0; -static DWORD curent_quest_page=0x0; -static DWORD wait_flag=0x0; +#include "FalloutEngine.h" + +static DWORD calledflag = 0x0; +static DWORD called_quest_number = 0x0; +static DWORD total_quests = 0x0; +static DWORD curent_quest_page = 0x0; +static DWORD wait_flag = 0x0; static void __declspec(naked) newhookpress() { __asm { push eax; - mov calledflag, 1; + mov calledflag, 1; mov called_quest_number, ebx; mov wait_flag, 0; mov total_quests, 0; pop eax; - mov edx,ds:[0x664508]; + mov edx,ds:[_crnt_func]; retn; } } -static const DWORD back_function=0x497828; +static const DWORD back_function = 0x497828; static void __declspec(naked) backhookfunct() { __asm { push eax; - mov calledflag, 0; + mov calledflag, 0; mov curent_quest_page, 0; pop eax; call back_function; @@ -53,40 +55,39 @@ static void __declspec(naked) backhookfunct() { static void __declspec(naked) newhookpress1() { __asm { push eax; - mov calledflag, 0; + mov calledflag, 0; mov curent_quest_page, 0; pop eax; - sub ebx,0x1f4; + sub ebx, 0x1F4; retn; } } static void __declspec(naked) nexthookfunct() { __asm { push eax; - mov calledflag, 0; + mov calledflag, 0; mov curent_quest_page, 0; pop eax; - mov eax,0x401; + mov eax, 0x401; retn; } } -static const DWORD show_text_function=0x4bc6f0; -static const DWORD show_text_jump_addr=0x498193; +static const DWORD show_text_jump_addr = 0x498193; static void __declspec(naked) newhooklooktext() { - __asm { + __asm { push eax; - mov eax,curent_quest_page; - imul eax,eax,0x9; - cmp wait_flag,eax; + mov eax, curent_quest_page; + imul eax, eax, 0x9; + cmp wait_flag, eax; jl smpfhj; add eax, 0x9; - cmp wait_flag,eax; - jg smpfhj; - pop eax; - call show_text_function; - inc wait_flag; + cmp wait_flag, eax; + jg smpfhj; + pop eax; + call _word_wrap_; + inc wait_flag; add total_quests, 1; retn; smpfhj: @@ -95,24 +96,22 @@ smpfhj: inc wait_flag; mov eax, 1; retn; - } + } } -static const DWORD forresetvalue=0x497b64; static void __declspec(naked) newhookresetvalue() { __asm { push eax; - mov wait_flag,0; + mov wait_flag, 0; pop eax; - call forresetvalue; + call pip_back_; retn; } } -static const DWORD call_newbutt1=0x49720c; -static const DWORD call_newbutt2=0x497BD8; - -static const DWORD call_newbutt3=0x4999c0; -static const DWORD call_newbutt4=0x4d36d4; +//static const DWORD call_newbutt1 = 0x49720C; // Unused +//static const DWORD call_newbutt2 = 0x497BD8; // Unused - PipStatus_ +//static const DWORD call_newbutt3 = 0x4999C0; // Unused - NixHotLines_ +//static const DWORD call_newbutt4 = 0x4D36D4; // Unused - buf_to_buf_ static void __declspec(naked) newactbpip() { __asm { @@ -121,255 +120,241 @@ static void __declspec(naked) newactbpip() { jmp jmphr3; jmphr4: cmp calledflag, 0x1; - je jmphr5; + je jmphr5; jmp jmphr3; jmphr5: - cmp curent_quest_page, 0x0; - je jmphr1; - + je jmphr1; push eax; - sub curent_quest_page,1; + sub curent_quest_page, 1; mov wait_flag, 0; pop eax; mov ebx, called_quest_number; jmphr3: - cmp ebx, 0x301; - je jmphr; + je jmphr; jmp jmphr1; jmphr: - cmp calledflag, 0x1; - je jmphr2; + je jmphr2; jmp jmphr1; jmphr2: - push eax; mov eax, curent_quest_page; add eax, 1; - imul eax,eax,0x9; + imul eax, eax, 0x9; cmp eax, total_quests; jl rtjl; pop eax; jmp jmphr1; -rtjl: - add curent_quest_page,1; +rtjl: + add curent_quest_page, 1; mov wait_flag, 0; pop eax; - mov ebx, called_quest_number; -jmphr1: - cmp ebx,0x1f4; + mov ebx, called_quest_number; +jmphr1: + cmp ebx, 0x1F4; retn; } } -static const DWORD n_newbutt1=0x4d8260; -static const DWORD n_newbutt2=0x4d87f8; +static const DWORD n_newbutt2 = 0x4D87F8; -static const DWORD newbutt1=0x4d87f8; -static const DWORD newbutt2=0x419c88; -static const DWORD newbutt3=0x419188; -static const DWORD newbutt4=0x45e440; -static const DWORD newbutt5=0x419c88; -static const DWORD newbutt6=0x419188; -static const DWORD newbutt7=0x4d8260; -static const DWORD newbutt8=0x45e440; -static const DWORD newbutt9=0x45e440; +static const DWORD newbutt1 = 0x4D87F8; +//static const DWORD newbutt4 = 0x45E440; // Unused +//static const DWORD newbutt7 = 0x4D8260; // Unused - win_register_button_ +//static const DWORD newbutt8 = 0x45E440; // Unused +//static const DWORD newbutt9 = 0x45E440; // Unused static void __declspec(naked) newbuttonfct() { __asm { - - // recreate original 4 buttons - mov edi,0x155; - mov ebp,0x1f4; - xor esi,esi; -smpj1: - cmp esi,+0x1; - jz smpj4; - push +0x20; - push +0x0; - mov eax,ds:[0x664424]; - push eax; - mov edx,ds:[0x664420]; - push edx; - push ebp; - push -0x1; - push -0x1; - mov ebx,ds:[0x6642e4]; - push -0x1; - mov ecx,ds:[0x6642e0]; - mov eax,ds:[0x6644c4]; - push ebx; - mov edx,0x35; - mov ebx,edi; - call n_newbutt1; - cmp eax,-0x1; - jz smpj3; - mov ebx,0x451978; - mov edx,0x451970; - call n_newbutt2; -smpj3: - inc ebp; -smpj4: - inc esi; - add edi,+0x1b; - cmp esi,+0x5; - jl smpj1; + + // recreate original 4 buttons + mov edi, 0x155; + mov ebp, 0x1F4; + xor esi, esi; +smpj1: + cmp esi, +0x1; + jz smpj4; + push +0x20; + push +0x0; + mov eax, ds:[0x664424]; + push eax; + mov edx, ds:[0x664420]; + push edx; + push ebp; + push -0x1; + push -0x1; + mov ebx, ds:[0x6642E4]; + push -0x1; + mov ecx, ds:[0x6642E0]; + mov eax, ds:[_pip_win]; + push ebx; + mov edx, 0x35; + mov ebx, edi; + call win_register_button_; + cmp eax, -0x1; + jz smpj3; + mov ebx, 0x451978; + mov edx, 0x451970; + call n_newbutt2; +smpj3: + inc ebp; +smpj4: + inc esi; + add edi, +0x1b; + cmp esi, +0x5; + jl smpj1; - // load new texture for first (up) button. I used memory address for texture from buttons - // at chracter screen. Everything fine, because this buttons can't use in one time, and - // they everytime recreating - mov ebx,0x451990; - mov edx,0x451988; - call newbutt1; - xor ecx,ecx; - push +0x0; - mov edx,0xB5; //number from intrface.lst for button-up - mov eax,0x6; - xor ebx,ebx; - call newbutt2; - mov ecx,0x518f28; - xor ebx,ebx; - xor edx,edx; - call newbutt3; - mov ds:[0x59d3fc],eax; // first texture memory address - push +0x0; - mov edx,0xB6; //number from intrface.lst for button-down - mov eax,0x6; - xor ecx,ecx; - xor ebx,ebx; - call newbutt5; - mov ecx,0x518f2c; - xor ebx,ebx; - xor edx,edx; - call newbutt6; - mov ds:[0x59d400],eax; // second texture memory address + // load new texture for first (up) button. I used memory address for texture from buttons + // at chracter screen. Everything fine, because this buttons can't use in one time, and + // they everytime recreating + mov ebx, 0x451990; + mov edx, 0x451988; + call newbutt1; + xor ecx, ecx; + push +0x0; + mov edx, 0xB5; // number from intrface.lst for button-up + mov eax, 0x6; + xor ebx, ebx; + call art_id_; + mov ecx, 0x518F28; + xor ebx, ebx; + xor edx, edx; + call art_ptr_lock_data_; + mov ds:[0x59D3FC], eax; // first texture memory address + push +0x0; + mov edx, 0xB6; // number from intrface.lst for button-down + mov eax, 0x6; + xor ecx, ecx; + xor ebx, ebx; + call art_id_; + mov ecx, 0x518F2C; + xor ebx, ebx; + xor edx, edx; + call art_ptr_lock_data_; + mov ds:[0x59D400], eax; // second texture memory address - // load new texture for second (down) button + // load new texture for second (down) button + mov ebx, 0x451990; + mov edx, 0x451988; + call newbutt1; + xor ecx, ecx; + push +0x0; + mov edx, 0xC7; // number from intrface.lst for button-up + mov eax, 0x6; + xor ebx, ebx; + call art_id_; + mov ecx, 0x518F28; + xor ebx, ebx; + xor edx, edx; + call art_ptr_lock_data_; + mov ds:[0x570514], eax; // first texture memory address + push +0x0; + mov edx, 0xC8; // number from intrface.lst for button-down + mov eax, 0x6; + xor ecx, ecx; + xor ebx, ebx; + call art_id_; + mov ecx, 0x518F2C; + xor ebx, ebx; + xor edx, edx; + call art_ptr_lock_data_; + mov ds:[0x570518], eax; // second texture memory address - mov ebx,0x451990; - mov edx,0x451988; - call newbutt1; - xor ecx,ecx; - push +0x0; - mov edx,0xC7; //number from intrface.lst for button-up - mov eax,0x6; - xor ebx,ebx; - call newbutt2; - mov ecx,0x518f28; - xor ebx,ebx; - xor edx,edx; - call newbutt3; - mov ds:[0x570514],eax; // first texture memory address - push +0x0; - mov edx,0xC8; //number from intrface.lst for button-down - mov eax,0x6; - xor ecx,ecx; - xor ebx,ebx; - call newbutt5; - mov ecx,0x518f2c; - xor ebx,ebx; - xor edx,edx; - call newbutt6; - mov ds:[0x570518],eax; // second texture memory address - - // creating new 2 buttons + // creating new 2 buttons + mov edi, 0x149; // y position + mov ebp, 0x300; // this number will return when button pressed + xor esi, esi; + push +0x20; + push +0x0; + mov eax, ds:[0x570518]; + push eax; + mov edx, ds:[0x570514]; + push edx; + push ebp; + push -0x1; + push -0x1; + mov ebx, 0xE; + push -0x1; + mov ecx, 0xB; + mov eax, ds:[_pip_win]; + push ebx; + mov edx, 0x8B; + mov ebx, edi; + call win_register_button_; + cmp eax, -0x1; + jz smpj16; + mov ebx, 0x451978; + mov edx, 0x451970; + call n_newbutt2; +smpj16: + // second button + inc ebp; + inc esi; + add edi, +0x9; + push +0x20; + push +0x0; + mov eax, ds:[0x59D400]; + push eax; + mov edx, ds:[0x59D3FC]; + push edx; + push ebp; + push -0x1; + push -0x1; + mov ebx, 0xE; + push -0x1; + mov ecx, 0xB; + mov eax, ds:[_pip_win]; + push ebx; + mov edx, 0x8B; + mov ebx, edi; + call win_register_button_; + cmp eax, -0x1; + jz smpj6; + mov ebx, 0x451978; + mov edx, 0x451970; + call n_newbutt2; +smpj6: + inc ebp; + inc esi; + add edi, +0x9; - mov edi,0x149; // y position - mov ebp,0x300; // this number will return when button pressed - xor esi,esi; - push +0x20; - push +0x0; - mov eax,ds:[0x570518]; - push eax; - mov edx,ds:[0x570514]; - push edx; - push ebp; - push -0x1; - push -0x1; - mov ebx,0xE; - push -0x1; - mov ecx,0xB; - mov eax,ds:[0x6644c4]; - push ebx; - mov edx,0x8B; - mov ebx,edi; - call n_newbutt1; - cmp eax,-0x1; - jz smpj16; - mov ebx,0x451978; - mov edx,0x451970; - call n_newbutt2; -smpj16: - // second button - inc ebp; - inc esi; - add edi,+0x9; - - push +0x20; - push +0x0; - mov eax,ds:[0x59d400]; - push eax; - mov edx,ds:[0x59d3fc]; - push edx; - push ebp; - push -0x1; - push -0x1; - mov ebx,0xE; - push -0x1; - mov ecx,0xB; - mov eax,ds:[0x6644c4]; - push ebx; - mov edx,0x8B; - mov ebx,edi; - call n_newbutt1; - cmp eax,-0x1; - jz smpj6; - mov ebx,0x451978; - mov edx,0x451970; - call n_newbutt2; -smpj6: - inc ebp; - inc esi; - add edi,+0x9; - - - retn; + retn; } } void QuestListInit() { // - SafeWrite8(0x004974df, 0xE8); - SafeWrite32(0x004974e0, ((DWORD)&newbuttonfct) - 0x004974e4); - SafeWrite8(0x004974e4, 0xE9); - SafeWrite32(0x004974e5, 0x0000005B); + SafeWrite8(0x004974DF, 0xE8); + SafeWrite32(0x004974E0, ((DWORD)&newbuttonfct) - 0x004974E4); + SafeWrite8(0x004974E4, 0xE9); + SafeWrite32(0x004974e5, 0x0000005B); // - SafeWrite8(0x00497173, 0xE8); - SafeWrite32(0x00497174, ((DWORD)&newactbpip) - 0x00497178); - SafeWrite8(0x00497178, 0x90); + SafeWrite8(0x00497173, 0xE8); + SafeWrite32(0x00497174, ((DWORD)&newactbpip) - 0x00497178); + SafeWrite8(0x00497178, 0x90); // - SafeWrite8(0x004971b2, 0xE8); - SafeWrite32(0x004971b3, ((DWORD)&newhookpress) - 0x004971b7); - SafeWrite8(0x004971b7, 0x90); + SafeWrite8(0x004971B2, 0xE8); + SafeWrite32(0x004971B3, ((DWORD)&newhookpress) - 0x004971B7); + SafeWrite8(0x004971B7, 0x90); // - SafeWrite8(0x00497183, 0xE8); - SafeWrite32(0x00497184, ((DWORD)&newhookpress1) - 0x00497188); - SafeWrite8(0x00497188, 0x90); + SafeWrite8(0x00497183, 0xE8); + SafeWrite32(0x00497184, ((DWORD)&newhookpress1) - 0x00497188); + SafeWrite8(0x00497188, 0x90); // - SafeWrite8(0x00498186, 0xE8); - SafeWrite32(0x00498187, ((DWORD)&newhooklooktext) - 0x0049818B); + SafeWrite8(0x00498186, 0xE8); + SafeWrite32(0x00498187, ((DWORD)&newhooklooktext) - 0x0049818B); // - SafeWrite8(0x004982B0, 0xE8); - SafeWrite32(0x004982B1, ((DWORD)&newhookresetvalue) - 0x004982B5); + SafeWrite8(0x004982B0, 0xE8); + SafeWrite32(0x004982B1, ((DWORD)&newhookresetvalue) - 0x004982B5); // - SafeWrite8(0x004971d9, 0xE8); - SafeWrite32(0x004971da, ((DWORD)&nexthookfunct) - 0x004971de); + SafeWrite8(0x004971D9, 0xE8); + SafeWrite32(0x004971DA, ((DWORD)&nexthookfunct) - 0x004971DE); // - SafeWrite8(0x00497219, 0xE8); - SafeWrite32(0x0049721a, ((DWORD)&backhookfunct) - 0x0049721e); -} \ No newline at end of file + SafeWrite8(0x00497219, 0xE8); + SafeWrite32(0x0049721A, ((DWORD)&backhookfunct) - 0x0049721E); +}