mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Cosmetic edits: remove unnecessary size directives
* verified the compiled binary is still the same.
This commit is contained in:
@@ -404,8 +404,8 @@ long wmGetCurrentTerrainType() {
|
||||
if (terrainId == nullptr) {
|
||||
__asm {
|
||||
lea ebx, terrainId;
|
||||
mov edx, dword ptr ds:[FO_VAR_world_ypos];
|
||||
mov eax, dword ptr ds:[FO_VAR_world_xpos];
|
||||
mov edx, ds:[FO_VAR_world_ypos];
|
||||
mov eax, ds:[FO_VAR_world_xpos];
|
||||
call fo::funcoffs::wmFindCurSubTileFromPos_;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ static __declspec(naked) void combat_ai_hook_FleeFix() {
|
||||
reTarget:
|
||||
and byte ptr [ebp], ~(InFlee | ReTarget); // unset CombatStateFlag flags
|
||||
xor edi, edi;
|
||||
mov dword ptr [esi + whoHitMe], edi;
|
||||
mov [esi + whoHitMe], edi;
|
||||
add esp, 4;
|
||||
jmp combat_ai_flee_Ret;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ tryHeal:
|
||||
/*static __declspec(naked) void ai_check_drugs_hook() {
|
||||
__asm {
|
||||
call fo::funcoffs::stat_level_; // current hp
|
||||
mov edx, dword ptr [esp + 0x34 - 0x1C + 4]; // ai cap
|
||||
mov edx, [esp + 0x34 - 0x1C + 4]; // ai cap
|
||||
mov edx, [edx + 0x10]; // min_hp
|
||||
cmp eax, edx; // curr_hp < cap.min_hp
|
||||
cmovl edi, edx; // min_hp <- cap.min_hp
|
||||
|
||||
@@ -461,7 +461,7 @@ static __declspec(naked) void action_climb_ladder_hook() {
|
||||
je reset;
|
||||
push edx;
|
||||
mov edx, ds:[FO_VAR_map_number];
|
||||
cmp dword ptr [edi + 0x3C], edx;
|
||||
cmp [edi + 0x3C], edx;
|
||||
pop edx;
|
||||
jne skip;
|
||||
reset:
|
||||
|
||||
+39
-39
@@ -197,7 +197,7 @@ end:
|
||||
static __declspec(naked) void SharpShooterFix() {
|
||||
__asm {
|
||||
call fo::funcoffs::stat_level_; // Perception
|
||||
cmp edi, dword ptr ds:[FO_VAR_obj_dude];
|
||||
cmp edi, ds:[FO_VAR_obj_dude];
|
||||
jne end;
|
||||
xchg ecx, eax;
|
||||
mov eax, edi; // _obj_dude
|
||||
@@ -236,7 +236,7 @@ static __declspec(naked) void PipAlarm_hack() {
|
||||
static __declspec(naked) void PipStatus_hook() {
|
||||
__asm {
|
||||
call fo::funcoffs::ListHoloDiskTitles_;
|
||||
mov dword ptr ds:[FO_VAR_holodisk], ebx;
|
||||
mov ds:[FO_VAR_holodisk], ebx;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -244,7 +244,7 @@ static __declspec(naked) void PipStatus_hook() {
|
||||
static __declspec(naked) void PipStatus_hack() {
|
||||
static const DWORD PipStatus_Ret = 0x497DD6;
|
||||
__asm {
|
||||
cmp dword ptr ds:[FO_VAR_statcount], eax; // eax - "result" argument
|
||||
cmp ds:[FO_VAR_statcount], eax; // eax - "result" argument
|
||||
jl skip;
|
||||
cmp dword ptr ds:[FO_VAR_mouse_x], 429; // overwritten engine code
|
||||
retn;
|
||||
@@ -275,21 +275,21 @@ end: // overwritten engine code
|
||||
static __declspec(naked) void scr_write_ScriptNode_hook() {
|
||||
__asm {
|
||||
mov ecx, 16; // maximum number of scripts in block
|
||||
cmp dword ptr [esp + 0xEC + 4], ecx; // number_of_scripts (total scripts)
|
||||
cmp [esp + 0xEC + 4], ecx; // number_of_scripts (total scripts)
|
||||
jg writeBlock;
|
||||
mov ecx, dword ptr [esp + 0xEC + 4];
|
||||
mov ecx, [esp + 0xEC + 4];
|
||||
test ecx, ecx;
|
||||
jg writeBlock; // > 0
|
||||
xor eax, eax;
|
||||
retn; // don't save the current ScriptBlock
|
||||
writeBlock:
|
||||
sub dword ptr [esp + 0xEC + 4], ecx; // number_of_scripts (reduce number [e.g. 24-16=8] or set it to 0)
|
||||
xchg dword ptr [ebp + 0xE00], ecx; // ScriptBlocks.num (keep and set correct value: 16 or previous value of number_of_scripts)
|
||||
sub [esp + 0xEC + 4], ecx; // number_of_scripts (reduce number [e.g. 24-16=8] or set it to 0)
|
||||
xchg [ebp + 0xE00], ecx; // ScriptBlocks.num (keep and set correct value: 16 or previous value of number_of_scripts)
|
||||
xor esi, esi;
|
||||
xchg dword ptr [ebp + 0xE04], esi; // ScriptBlocks.NextBlock (keep pointer and set it to 0)
|
||||
xchg [ebp + 0xE04], esi; // ScriptBlocks.NextBlock (keep pointer and set it to 0)
|
||||
call fo::funcoffs::scr_write_ScriptNode_;
|
||||
mov dword ptr [ebp + 0xE04], esi; // restore ScriptBlocks.NextBlock
|
||||
mov dword ptr [ebp + 0xE00], ecx; // restore ScriptBlocks.num
|
||||
mov [ebp + 0xE04], esi; // restore ScriptBlocks.NextBlock
|
||||
mov [ebp + 0xE00], ecx; // restore ScriptBlocks.num
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -298,7 +298,7 @@ static __declspec(naked) void protinst_default_use_item_hack() {
|
||||
static const DWORD protinst_default_use_item_Ret = 0x49C38B;
|
||||
static const DWORD protinst_default_use_item_End = 0x49C3C5;
|
||||
__asm {
|
||||
mov eax, dword ptr [edx + protoId]; // eax = target pid
|
||||
mov eax, [edx + protoId]; // eax = target pid
|
||||
cmp eax, PID_DRIVABLE_CAR;
|
||||
je isCar;
|
||||
cmp eax, PID_CAR_TRUNK;
|
||||
@@ -364,7 +364,7 @@ static __declspec(naked) void item_d_take_drug_hook() {
|
||||
|
||||
static __declspec(naked) void RemoveJetAddictFunc() {
|
||||
__asm {
|
||||
cmp eax, dword ptr ds:[FO_VAR_wd_obj];
|
||||
cmp eax, ds:[FO_VAR_wd_obj];
|
||||
jne end;
|
||||
cmp dword ptr [edx + 0x4], PID_JET; // queue_addict.drug_pid == PID_JET?
|
||||
end:
|
||||
@@ -381,7 +381,7 @@ static __declspec(naked) void item_d_take_drug_hack() {
|
||||
mov eax, esi;
|
||||
call fo::funcoffs::perform_withdrawal_end_;
|
||||
skip: // remove event from queue
|
||||
mov dword ptr ds:[FO_VAR_wd_obj], esi;
|
||||
mov ds:[FO_VAR_wd_obj], esi;
|
||||
mov eax, addict_event; // type = addiction
|
||||
mov edx, offset RemoveJetAddictFunc;
|
||||
jmp fo::funcoffs::queue_clear_type_;
|
||||
@@ -602,7 +602,7 @@ end:
|
||||
static __declspec(naked) void gdProcessUpdate_hack() {
|
||||
__asm {
|
||||
lea edx, [eax - 2];
|
||||
cmp edx, dword ptr ds:[FO_VAR_optionRect + 0xC]; // _optionRect.offy
|
||||
cmp edx, ds:[FO_VAR_optionRect + 0xC]; // _optionRect.offy
|
||||
jl skip;
|
||||
mov eax, edx;
|
||||
skip:
|
||||
@@ -625,7 +625,7 @@ static __declspec(naked) void invenWieldFunc_item_get_type_hook() {
|
||||
xor ebx, ebx;
|
||||
inc ebx;
|
||||
push ebx;
|
||||
mov cl, byte ptr [edi + 0x27];
|
||||
mov cl, [edi + 0x27];
|
||||
and cl, 0x3;
|
||||
xchg edx, eax; // eax = who, edx = item
|
||||
push eax;
|
||||
@@ -646,7 +646,7 @@ removeFlag:
|
||||
jz noWeapon;
|
||||
and byte ptr [eax + 0x27], 0xFC; // Unset flag of a weapon in hand
|
||||
noWeapon:
|
||||
or byte ptr [edi + 0x27], cl; // Set flag of a weapon in hand
|
||||
or [edi + 0x27], cl; // Set flag of a weapon in hand
|
||||
inc ebx;
|
||||
pop ebx;
|
||||
jz skip;
|
||||
@@ -825,7 +825,7 @@ static __declspec(naked) void item_total_weight_hack() {
|
||||
mov ebx, [edi]; // Inventory.inv_size
|
||||
xor esi, esi;
|
||||
//------
|
||||
cmp eax, dword ptr ds:[FO_VAR_obj_dude]; // eax - source
|
||||
cmp eax, ds:[FO_VAR_obj_dude]; // eax - source
|
||||
jz skip;
|
||||
cmp critterBody, eax; // if condition is true, then now it's exchanging/bartering with source object
|
||||
cmovz esi, weightOnBody; // take the weight of target's equipped items into account
|
||||
@@ -841,7 +841,7 @@ static __declspec(naked) void item_c_curr_size_hack() {
|
||||
mov edx, [ecx]; // Inventory.inv_size
|
||||
xor edi, edi;
|
||||
//------
|
||||
cmp eax, dword ptr ds:[FO_VAR_obj_dude]; // eax - source
|
||||
cmp eax, ds:[FO_VAR_obj_dude]; // eax - source
|
||||
jz skip;
|
||||
cmp critterBody, eax; // if condition is true, then now it's exchanging/bartering with source object
|
||||
cmovz edi, sizeOnBody; // take the size of target's equipped items into account
|
||||
@@ -965,7 +965,7 @@ static __declspec(naked) void PipStatus_AddHotLines_hook() {
|
||||
__asm {
|
||||
call fo::funcoffs::AddHotLines_;
|
||||
xor eax, eax;
|
||||
mov dword ptr ds:[FO_VAR_hot_line_count], eax;
|
||||
mov ds:[FO_VAR_hot_line_count], eax;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ static __declspec(naked) void NPCStage6Fix2() {
|
||||
static const DWORD partyMemberGetAIOptions_End = 0x49423A;
|
||||
__asm {
|
||||
imul edx, 220; // multiply record size 220 bytes by NPC number as listed in party.txt
|
||||
mov eax, dword ptr ds:[FO_VAR_partyMemberAIOptions]; // get starting offset of internal NPC table
|
||||
mov eax, ds:[FO_VAR_partyMemberAIOptions]; // get starting offset of internal NPC table
|
||||
jmp partyMemberGetAIOptions_End; // eax + edx = offset of specific NPC record
|
||||
}
|
||||
}
|
||||
@@ -1603,7 +1603,7 @@ static __declspec(naked) void combat_load_hook() {
|
||||
jnz end; // No
|
||||
push PERK_bonus_move;
|
||||
pop edx;
|
||||
mov eax, dword ptr ds:[FO_VAR_obj_dude];
|
||||
mov eax, ds:[FO_VAR_obj_dude];
|
||||
call fo::funcoffs::perk_level_;
|
||||
test eax, eax; // Have the perk?
|
||||
jz end; // No
|
||||
@@ -1671,7 +1671,7 @@ end:
|
||||
static __declspec(naked) void partyMemberGetCurLevel_hack() {
|
||||
__asm {
|
||||
mov esi, 0xFFFFFFFF; // initialize party member index
|
||||
mov edi, dword ptr ds:[FO_VAR_partyMemberMaxCount];
|
||||
mov edi, ds:[FO_VAR_partyMemberMaxCount];
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -1711,7 +1711,7 @@ static __declspec(naked) void obj_move_to_tile_hack_seen() {
|
||||
cmp dword ptr ds:[FO_VAR_mapEntranceTileNum], -1;
|
||||
jne end; // fix
|
||||
skip:
|
||||
or byte ptr ds:[FO_VAR_obj_seen][eax], dl;
|
||||
or ds:[FO_VAR_obj_seen][eax], dl;
|
||||
end:
|
||||
retn;
|
||||
}
|
||||
@@ -1864,9 +1864,9 @@ static __declspec(naked) void statPCAddExperienceCheckPMs_hack() {
|
||||
mov expSwiftLearner, edi;
|
||||
cmp dword ptr [esp + 0x24 + 4], 0x496CAA + 5; // called from perk_add_effect_ (PERK_here_and_now)
|
||||
jne notHereAndNow;
|
||||
mov dword ptr ds:[FO_VAR_hereAndNowExps], edi;
|
||||
mov ds:[FO_VAR_hereAndNowExps], edi;
|
||||
notHereAndNow:
|
||||
mov eax, dword ptr ds:[FO_VAR_Experience_pc];
|
||||
mov eax, ds:[FO_VAR_Experience_pc];
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -1992,7 +1992,7 @@ static __declspec(naked) void wmSetupRandomEncounter_hook() {
|
||||
|
||||
static __declspec(naked) void inven_obj_examine_func_hack() {
|
||||
__asm {
|
||||
mov edx, dword ptr ds:[0x519064]; // inven_display_msg_line
|
||||
mov edx, ds:[0x519064]; // inven_display_msg_line
|
||||
cmp edx, 2; // >2
|
||||
ja fix;
|
||||
retn;
|
||||
@@ -2033,7 +2033,7 @@ static __declspec(naked) void Add4thTagSkill_hook() {
|
||||
mov edi, eax;
|
||||
call fo::funcoffs::skill_set_tags_;
|
||||
mov eax, ds:[FO_VAR_obj_dude];
|
||||
mov edx, dword ptr ds:[edi + 3 * 4]; // _temp_tag_skill4
|
||||
mov edx, ds:[edi + 3 * 4]; // _temp_tag_skill4
|
||||
call fo::funcoffs::skill_level_;
|
||||
mov tagSkill4LevelBase, eax; // x2
|
||||
retn;
|
||||
@@ -2075,7 +2075,7 @@ static __declspec(naked) void op_start_gdialog_hack() {
|
||||
__asm {
|
||||
cmp eax, -1; // check mood arg
|
||||
jnz useMood;
|
||||
mov eax, dword ptr [esp + 0x3C - 0x30 + 4]; // fix dialog_target (overwritten engine code)
|
||||
mov eax, [esp + 0x3C - 0x30 + 4]; // fix dialog_target (overwritten engine code)
|
||||
retn;
|
||||
useMood:
|
||||
add esp, 4; // Destroy the return address
|
||||
@@ -2143,10 +2143,10 @@ static __declspec(naked) void process_rads_hook_msg() {
|
||||
mov eax, 1;
|
||||
call fo::funcoffs::gmouse_set_cursor_;
|
||||
skip:
|
||||
mov ebx, dword ptr ds:[FO_VAR_game_user_wants_to_quit];
|
||||
mov ebx, ds:[FO_VAR_game_user_wants_to_quit];
|
||||
mov dword ptr ds:[FO_VAR_game_user_wants_to_quit], 0;
|
||||
call fo::func::DialogOut;
|
||||
mov dword ptr ds:[FO_VAR_game_user_wants_to_quit], ebx;
|
||||
mov ds:[FO_VAR_game_user_wants_to_quit], ebx;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -2163,7 +2163,7 @@ static __declspec(naked) void ai_check_drugs_hack_break() {
|
||||
add esp, 4;
|
||||
jmp ai_check_drugs_break_Ret; // break loop
|
||||
useDrugs: // use the first found item
|
||||
mov dword ptr [esp + 4], eax; // slot set -1
|
||||
mov [esp + 4], eax; // slot set -1
|
||||
mov edi, firstItemDrug;
|
||||
mov ebx, edi;
|
||||
mov firstItemDrug, eax; // set -1
|
||||
@@ -2222,7 +2222,7 @@ static __declspec(naked) void config_get_values_hack() {
|
||||
mov eax, [esp + 0x100];
|
||||
cmp byte ptr [eax], 0; // check char
|
||||
jz getFail;
|
||||
mov eax, dword ptr [esp + 0x114]; // total num of values
|
||||
mov eax, [esp + 0x114]; // total num of values
|
||||
sub eax, ebp;
|
||||
cmp eax, 1;
|
||||
ja getFail;
|
||||
@@ -2248,8 +2248,8 @@ skip:
|
||||
|
||||
static __declspec(naked) void op_attack_hook() {
|
||||
__asm {
|
||||
mov esi, dword ptr [esp + 0x3C + 4]; // free_move
|
||||
mov ebx, dword ptr [esp + 0x40 + 4]; // add amount damage to target
|
||||
mov esi, [esp + 0x3C + 4]; // free_move
|
||||
mov ebx, [esp + 0x40 + 4]; // add amount damage to target
|
||||
jmp fo::funcoffs::gdialogActive_;
|
||||
}
|
||||
}
|
||||
@@ -2327,7 +2327,7 @@ static __declspec(naked) void op_use_obj_on_obj_hack() {
|
||||
jz fail;
|
||||
mov edx, [eax + protoId];
|
||||
shr edx, 24;
|
||||
cmp dword ptr [esp + 4], eax; // target != source
|
||||
cmp [esp + 4], eax; // target != source
|
||||
jne skip;
|
||||
xor edx, edx; // for calling obj_use_item_on_ instead of action_use_an_item_on_object_
|
||||
skip:
|
||||
@@ -2558,7 +2558,7 @@ bad:
|
||||
|
||||
static __declspec(naked) void obj_pickup_hook() {
|
||||
__asm {
|
||||
cmp edi, dword ptr ds:[FO_VAR_obj_dude];
|
||||
cmp edi, ds:[FO_VAR_obj_dude];
|
||||
je dude;
|
||||
test byte ptr ds:[FO_VAR_combat_state], 1; // in combat?
|
||||
jz dude;
|
||||
@@ -2577,7 +2577,7 @@ static const char* __fastcall GetPickupMessage(const char* name) {
|
||||
|
||||
static __declspec(naked) void obj_pickup_hook_message() {
|
||||
__asm {
|
||||
cmp edi, dword ptr ds:[FO_VAR_obj_dude];
|
||||
cmp edi, ds:[FO_VAR_obj_dude];
|
||||
je dude;
|
||||
mov eax, edi;
|
||||
call fo::funcoffs::critter_name_;
|
||||
@@ -2603,7 +2603,7 @@ static __declspec(naked) void anim_move_to_tile_hook() {
|
||||
isDude:
|
||||
test eax, eax;
|
||||
jnz skip; // tile is blocked
|
||||
mov ebx, dword ptr [esp + 0x18 - 0x10 + 4]; // distance
|
||||
mov ebx, [esp + 0x18 - 0x10 + 4]; // distance
|
||||
test ebx, ebx;
|
||||
jl skip; // dist < 0
|
||||
sub ebx, ds:[FO_VAR_combat_free_move];
|
||||
@@ -2826,7 +2826,7 @@ break:
|
||||
static __declspec(naked) void wmInterfaceInit_hack() {
|
||||
__asm {
|
||||
mov eax, GVAR_CAR_PLACED_TILE;
|
||||
cmp eax, dword ptr ds:[FO_VAR_num_game_global_vars];
|
||||
cmp eax, ds:[FO_VAR_num_game_global_vars];
|
||||
jge skip;
|
||||
mov edx, ds:[FO_VAR_game_global_vars];
|
||||
lea edx, [edx + eax * 4];
|
||||
|
||||
@@ -389,7 +389,7 @@ static __declspec(naked) void CommonDmgRngDispFix_hook() {
|
||||
static __declspec(naked) void HtHDamageFix1a_hack() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
cmp ecx, dword ptr ds:[FO_VAR_obj_dude]; // Is the critter == PC?
|
||||
cmp ecx, ds:[FO_VAR_obj_dude]; // Is the critter == PC?
|
||||
je fix; // Skip if no
|
||||
mov edx, 1; // Min_Damage = 1
|
||||
retn;
|
||||
@@ -407,7 +407,7 @@ static __declspec(naked) void HtHDamageFix1b_hook() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
call fo::funcoffs::stat_level_; // Get Total_Melee_Damage
|
||||
cmp ecx, dword ptr ds:[FO_VAR_obj_dude]; // Is the critter == PC?
|
||||
cmp ecx, ds:[FO_VAR_obj_dude]; // Is the critter == PC?
|
||||
je fix; // Skip to exit if no
|
||||
retn;
|
||||
fix:
|
||||
@@ -416,7 +416,7 @@ fix:
|
||||
mov eax, ecx; // pointer to PC
|
||||
call fo::funcoffs::perk_level_; // Return Rank_of_Bonus_HtH_Damage_perk
|
||||
shl eax, 1; // Rank_of_Bonus_HtH_Damage_perk *= 2
|
||||
add dword ptr [esp + 0x24 - 0x20 + 8], eax; // Min_Damage += Rank_of_Bonus_HtH_Damage_perk
|
||||
add [esp + 0x24 - 0x20 + 8], eax; // Min_Damage += Rank_of_Bonus_HtH_Damage_perk
|
||||
pop eax;
|
||||
retn;
|
||||
}
|
||||
@@ -426,11 +426,11 @@ static __declspec(naked) void DisplayBonusRangedDmg_hook() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
mov edx, PERK_bonus_ranged_damage;
|
||||
mov eax, dword ptr ds:[FO_VAR_stack];
|
||||
mov eax, ds:[FO_VAR_stack];
|
||||
call fo::funcoffs::perk_level_;
|
||||
shl eax, 1; // Multiply by 2
|
||||
add dword ptr [esp + 4 * 4], eax; // min_dmg + perk bonus
|
||||
add dword ptr [esp + 4 * 5], eax; // max_dmg + perk bonus
|
||||
add [esp + 4 * 4], eax; // min_dmg + perk bonus
|
||||
add [esp + 4 * 5], eax; // max_dmg + perk bonus
|
||||
jmp fo::funcoffs::sprintf_;
|
||||
}
|
||||
}
|
||||
@@ -439,10 +439,10 @@ static __declspec(naked) void DisplayBonusHtHDmg1_hook() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
mov edx, PERK_bonus_hth_damage;
|
||||
mov eax, dword ptr ds:[FO_VAR_stack];
|
||||
mov eax, ds:[FO_VAR_stack];
|
||||
call fo::funcoffs::perk_level_;
|
||||
shl eax, 1; // Multiply by 2
|
||||
add dword ptr [esp + 4 * 4], eax; // min_dmg + perk bonus
|
||||
add [esp + 4 * 4], eax; // min_dmg + perk bonus
|
||||
jmp fo::funcoffs::sprintf_;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ static __declspec(naked) void obj_use_explosive_active_hack() {
|
||||
call CheckExplosives;
|
||||
test eax, eax;
|
||||
jz skipSet;
|
||||
mov dword ptr [esi + protoId], eax; // change item pid to active;
|
||||
mov [esi + protoId], eax; // change item pid to active;
|
||||
skipSet:
|
||||
mov dword ptr [esp], 0x49BD62;
|
||||
end:
|
||||
|
||||
@@ -72,7 +72,7 @@ static void LoadPageOffsets() {
|
||||
}
|
||||
}
|
||||
|
||||
static __declspec(naked) void load_page_offsets(void) {
|
||||
static __declspec(naked) void load_page_offsets() {
|
||||
__asm {
|
||||
call LoadPageOffsets;
|
||||
mov edx, 0x50A480; // ASCII "SAV" (restore original code)
|
||||
@@ -229,7 +229,7 @@ static long __fastcall CheckPage(long button) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __declspec(naked) void check_page_buttons(void) {
|
||||
static __declspec(naked) void check_page_buttons() {
|
||||
__asm {
|
||||
push eax;
|
||||
push ecx;
|
||||
@@ -320,7 +320,7 @@ static void DrawPageText() {
|
||||
SaveLoadWin = nullptr;
|
||||
}
|
||||
|
||||
static __declspec(naked) void draw_page_text(void) {
|
||||
static __declspec(naked) void draw_page_text() {
|
||||
__asm {
|
||||
push eax;
|
||||
call DrawPageText;
|
||||
@@ -331,16 +331,16 @@ static __declspec(naked) void draw_page_text(void) {
|
||||
}
|
||||
|
||||
// add page num offset when reading and writing various save data files
|
||||
static __declspec(naked) void add_page_offset_hack1(void) {
|
||||
static __declspec(naked) void add_page_offset_hack1() {
|
||||
__asm {
|
||||
mov eax, dword ptr ds:[FO_VAR_slot_cursor]; // list position 0-9
|
||||
add eax, LSPageOffset; // add page num offset
|
||||
mov eax, ds:[FO_VAR_slot_cursor]; // list position 0-9
|
||||
add eax, LSPageOffset; // add page num offset
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
// getting info for the 10 currently displayed save slots from save.dats
|
||||
static __declspec(naked) void add_page_offset_hack2(void) {
|
||||
static __declspec(naked) void add_page_offset_hack2() {
|
||||
__asm {
|
||||
pop edx; // ret addr
|
||||
push 0x50A514; // ASCII "SAVE.DAT"
|
||||
@@ -351,11 +351,11 @@ static __declspec(naked) void add_page_offset_hack2(void) {
|
||||
}
|
||||
|
||||
// printing current 10 slot numbers
|
||||
static __declspec(naked) void add_page_offset_hack3(void) {
|
||||
static __declspec(naked) void add_page_offset_hack3() {
|
||||
__asm {
|
||||
inc eax;
|
||||
add eax, LSPageOffset; // add page num offset
|
||||
mov bl, byte ptr ss:[esp + 0x10]; // add 4 bytes - func ret addr
|
||||
add eax, LSPageOffset; // add page num offset
|
||||
mov bl, ss:[esp + 0x10]; // add 4 bytes - func ret addr
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,14 +230,14 @@ static __declspec(noinline) int __stdcall LoadHeroDat(unsigned int race, unsigne
|
||||
// insert hero art path in front of main path structure when loading art
|
||||
static __declspec(naked) void LoadNewHeroArt() {
|
||||
__asm {
|
||||
cmp byte ptr ds:[esi], 'r';
|
||||
jne isNotReading;
|
||||
mov ecx, heroAppPaths;
|
||||
mov ecx, dword ptr ds:[ecx]; // set app path
|
||||
cmp byte ptr ds:[esi], 'r';
|
||||
jne isNotReading;
|
||||
mov ecx, heroAppPaths;
|
||||
mov ecx, ds:[ecx]; // set app path
|
||||
retn;
|
||||
isNotReading:
|
||||
mov ecx, FO_VAR_paths;
|
||||
mov ecx, dword ptr ds:[ecx];
|
||||
mov ecx, FO_VAR_paths;
|
||||
mov ecx, ds:[ecx];
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -265,8 +265,8 @@ notExists: // if file not found load regular critter art instead
|
||||
// adjust base hero art if num below hero art range
|
||||
static __declspec(naked) void AdjustHeroBaseArt() {
|
||||
__asm {
|
||||
add eax, critterListSize;
|
||||
mov dword ptr ds:[FO_VAR_art_vault_guy_num], eax;
|
||||
add eax, critterListSize;
|
||||
mov ds:[FO_VAR_art_vault_guy_num], eax;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -1061,7 +1061,7 @@ static __declspec(naked) void SexScrnEnd() {
|
||||
__asm {
|
||||
push edx;
|
||||
mov edx, STAT_gender;
|
||||
mov eax, dword ptr ds:[FO_VAR_obj_dude];
|
||||
mov eax, ds:[FO_VAR_obj_dude];
|
||||
call fo::funcoffs::stat_level_; // get PC stat current gender
|
||||
mov ecx, eax; // gender
|
||||
call fo::funcoffs::SexWindow_; // call gender selection window
|
||||
@@ -1071,7 +1071,7 @@ static __declspec(naked) void SexScrnEnd() {
|
||||
jne NoVaultSuit
|
||||
mov ebx, 0x8
|
||||
NoVaultSuit:
|
||||
mov eax, dword ptr ds:[ebx + FO_VAR_art_vault_person_nums]; // base male model
|
||||
mov eax, ds:[ebx + FO_VAR_art_vault_person_nums]; // base male model
|
||||
*/
|
||||
call HeroGenderChange;
|
||||
pop edx;
|
||||
@@ -1139,8 +1139,8 @@ static __declspec(naked) void AddCharScrnButtons() {
|
||||
// Loading or creating a background image for the character creation/editing interface
|
||||
static __declspec(naked) void FixCharScrnBack() {
|
||||
__asm {
|
||||
mov dword ptr ds:[FO_VAR_bckgnd], eax; // surface ptr for char scrn back
|
||||
test eax, eax; // check if frm loaded ok
|
||||
mov ds:[FO_VAR_bckgnd], eax; // surface ptr for char scrn back
|
||||
test eax, eax; // check if frm loaded ok
|
||||
je endFunc;
|
||||
// prolog
|
||||
pushad;
|
||||
@@ -1271,7 +1271,7 @@ static __declspec(naked) void CharScrnEnd() {
|
||||
push eax;
|
||||
call DeleteCharSurfaces;
|
||||
pop eax;
|
||||
mov ebp, dword ptr ds:[FO_VAR_info_line];
|
||||
mov ebp, ds:[FO_VAR_info_line];
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ static __declspec(naked) void InvenActionExplosiveDropHack() {
|
||||
cmp eax, -1; // ret value
|
||||
popadc;
|
||||
jnz noDrop;
|
||||
mov dword ptr ds:[FO_VAR_dropped_explosive], ebp; // overwritten engine code (ebp = 1)
|
||||
mov ds:[FO_VAR_dropped_explosive], ebp; // overwritten engine code (ebp = 1)
|
||||
mov nextHookDropSkip, ebp;
|
||||
retn;
|
||||
noDrop:
|
||||
|
||||
@@ -79,9 +79,9 @@ static __declspec(naked) void PC_BarterPriceHook() {
|
||||
push edx;
|
||||
push ecx;
|
||||
//-------
|
||||
push -1; // address on call stack
|
||||
mov ecx, dword ptr ds:[FO_VAR_obj_dude]; // source
|
||||
mov edx, dword ptr ds:[FO_VAR_target_stack]; // target
|
||||
push -1; // address on call stack
|
||||
mov ecx, ds:[FO_VAR_obj_dude]; // source
|
||||
mov edx, ds:[FO_VAR_target_stack]; // target
|
||||
call BarterPriceHook_Script;
|
||||
pop ecx;
|
||||
pop edx;
|
||||
@@ -166,7 +166,7 @@ static __declspec(naked) void UseSkillOnHack() {
|
||||
cmp bakupCombatState, -1;
|
||||
jz skip;
|
||||
mov ebp, bakupCombatState;
|
||||
mov dword ptr ds:[FO_VAR_combat_state], ebp;
|
||||
mov ds:[FO_VAR_combat_state], ebp;
|
||||
skip:
|
||||
cmp resultSkillOn, 0;
|
||||
jz default;
|
||||
@@ -174,14 +174,14 @@ skip:
|
||||
retn; // flag ZF = 0
|
||||
default:
|
||||
// engine code
|
||||
cmp eax, dword ptr ds:[FO_VAR_obj_dude];
|
||||
cmp eax, ds:[FO_VAR_obj_dude];
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static __declspec(naked) void skill_use_hack() {
|
||||
__asm {
|
||||
cmp ebp, dword ptr ds:[FO_VAR_obj_dude];
|
||||
cmp ebp, ds:[FO_VAR_obj_dude];
|
||||
setnz al;
|
||||
retn;
|
||||
}
|
||||
@@ -353,7 +353,7 @@ static __declspec(naked) void PerceptionRangeSeeHook() {
|
||||
cmp eax, 2;
|
||||
jne nevermind; // normal return
|
||||
dec eax;
|
||||
mov dword ptr [esp + 0x2C - 0x1C + 4], eax; // set 1, skip blocking check
|
||||
mov [esp + 0x2C - 0x1C + 4], eax; // set 1, skip blocking check
|
||||
dec eax;
|
||||
nevermind:
|
||||
retn;
|
||||
@@ -645,11 +645,11 @@ hookRun: /////////////////////////////////
|
||||
push ecx;
|
||||
push ecx; // encType
|
||||
xor edx, edx;
|
||||
mov ecx, dword ptr ds:[FO_VAR_EncounterMapID];
|
||||
mov ecx, ds:[FO_VAR_EncounterMapID];
|
||||
call EncounterHook_Script;
|
||||
pop ecx;
|
||||
pop edx;
|
||||
mov dword ptr ds:[FO_VAR_EncounterMapID], eax;
|
||||
mov ds:[FO_VAR_EncounterMapID], eax;
|
||||
cmp eax, -1;
|
||||
je cancelEnc;
|
||||
jl clearEnc;
|
||||
|
||||
@@ -56,7 +56,7 @@ static void __declspec(naked) get_input_str2_hack() {
|
||||
pop getInputStrRet;
|
||||
push edx;
|
||||
mov dl, xltKey;
|
||||
test byte ptr ds:[FO_VAR_kb_lock_flags], dl;
|
||||
test ds:[FO_VAR_kb_lock_flags], dl;
|
||||
jz end;
|
||||
and eax, 0xFF;
|
||||
cmp eax, 32; // skip the space char
|
||||
|
||||
@@ -381,13 +381,13 @@ skipX:
|
||||
add ecx, eax; // xpos * 1.5
|
||||
add ecx, ebx;
|
||||
pop ebx;
|
||||
mov eax, dword ptr [esp + 8]; // ypos
|
||||
mov eax, [esp + 8]; // ypos
|
||||
sar eax, 1;
|
||||
test eax, eax;
|
||||
jz skipY;
|
||||
sub eax, 5; // y adjust
|
||||
skipY:
|
||||
add dword ptr [esp + 8], eax; // ypos * 1.5
|
||||
add [esp + 8], eax; // ypos * 1.5
|
||||
pop eax;
|
||||
jmp fo::funcoffs::win_print_;
|
||||
}
|
||||
@@ -757,7 +757,7 @@ static __declspec(naked) void wmWorldMap_hack() {
|
||||
__asm {
|
||||
cmp dword ptr ds:[FO_VAR_In_WorldMap], 1; // player is moving
|
||||
jne checkHover;
|
||||
mov eax, dword ptr ds:[FO_VAR_wmWorldOffsetY]; // overwritten code
|
||||
mov eax, ds:[FO_VAR_wmWorldOffsetY]; // overwritten code
|
||||
retn;
|
||||
checkHover:
|
||||
cmp esi, 328;
|
||||
@@ -773,12 +773,12 @@ checkHover:
|
||||
mov edx, [esp + 0x38 - 0x34 + 8]; // y
|
||||
call wmDetectHotspotHover;
|
||||
pop ecx;
|
||||
mov eax, dword ptr ds:[FO_VAR_wmWorldOffsetY];
|
||||
mov eax, ds:[FO_VAR_wmWorldOffsetY];
|
||||
retn;
|
||||
isScroll:
|
||||
mov isHoveringHotspot, 0;
|
||||
mov backImageIsCopy, 0;
|
||||
mov eax, dword ptr ds:[FO_VAR_wmWorldOffsetY];
|
||||
mov eax, ds:[FO_VAR_wmWorldOffsetY];
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -838,14 +838,14 @@ static __declspec(naked) void wmDrawCursorStopped_hack_hotspot() {
|
||||
__asm {
|
||||
mov eax, 0x503E34; // 'ib2p1xx1'
|
||||
call fo::funcoffs::gsound_play_sfx_file_;
|
||||
mov eax, dword ptr ds:[0x672E90]; // hotspot2_pic
|
||||
mov eax, ds:[0x672E90]; // hotspot2_pic
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static __declspec(naked) void wmTownMapInit_hack() {
|
||||
__asm {
|
||||
mov dword ptr ds:[edi + 0x672DD8], eax; // _wmTownMapButtonId
|
||||
mov ds:[edi + 0x672DD8], eax; // _wmTownMapButtonId
|
||||
mov ecx, eax; // save button ID
|
||||
mov edx, fo::funcoffs::gsound_med_butt_press_;
|
||||
xor ebx, ebx; // no button release sfx
|
||||
|
||||
@@ -688,8 +688,8 @@ static __declspec(naked) void do_move_timer_hack() {
|
||||
__asm {
|
||||
push ecx;
|
||||
push ebp; // max
|
||||
mov edx, dword ptr [esp + 32]; // return address
|
||||
mov ecx, dword ptr [esp + 20]; // item, potentially
|
||||
mov edx, [esp + 32]; // return address
|
||||
mov ecx, [esp + 20]; // item, potentially
|
||||
call CalculateDefaultMoveCount;
|
||||
mov ebx, eax;
|
||||
pop ecx;
|
||||
@@ -719,7 +719,7 @@ static __declspec(naked) void move_inventory_hack() {
|
||||
retn;
|
||||
skipDrag:
|
||||
call DragSkipPrepare;
|
||||
mov eax, dword ptr [esp + 0x54 - 0x18 + 4]; // isPlanting flag
|
||||
mov eax, [esp + 0x54 - 0x18 + 4]; // isPlanting flag
|
||||
add esp, 4;
|
||||
test eax, eax;
|
||||
jz jmpTaking;
|
||||
@@ -747,7 +747,7 @@ static __declspec(naked) void barter_move_inventory_skip_drag_hack_common() {
|
||||
retn;
|
||||
skipDrag:
|
||||
call DragSkipPrepare;
|
||||
mov eax, dword ptr [esp + 0x38 + 0xC + 4]; // fromDude flag
|
||||
mov eax, [esp + 0x38 + 0xC + 4]; // fromDude flag
|
||||
add esp, 4;
|
||||
test eax, eax;
|
||||
jz jmpTaking;
|
||||
|
||||
@@ -37,7 +37,7 @@ static __declspec(naked) DWORD ReadKillCounter() {
|
||||
static __declspec(naked) void IncKillCounter() {
|
||||
__asm {
|
||||
inc bx;
|
||||
mov word ptr ds:[FO_VAR_pc_kill_counts][edx], bx;
|
||||
mov ds:[FO_VAR_pc_kill_counts][edx], bx;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -590,7 +590,7 @@ checkFile:
|
||||
jz noFile;
|
||||
retn;
|
||||
noFile:
|
||||
mov eax, dword ptr [esp + 0xA4 - 0x20 + 4]; // splash value
|
||||
mov eax, [esp + 0xA4 - 0x20 + 4]; // splash value
|
||||
push eax;
|
||||
push 0x5023E8; // "art\splash\"
|
||||
push 0x502404; // "%ssplash%d.rix"
|
||||
|
||||
@@ -129,18 +129,18 @@ end:
|
||||
static __declspec(naked) void intface_item_reload_hook() {
|
||||
__asm {
|
||||
push eax;
|
||||
mov eax, dword ptr ds:[FO_VAR_obj_dude];
|
||||
mov eax, ds:[FO_VAR_obj_dude];
|
||||
call fo::funcoffs::register_clear_;
|
||||
xor edx, edx; // ANIM_stand
|
||||
xor ebx, ebx; // delay (unused)
|
||||
lea eax, [edx + 1]; // RB_UNRESERVED
|
||||
call fo::funcoffs::register_begin_;
|
||||
mov eax, dword ptr ds:[FO_VAR_obj_dude];
|
||||
mov eax, ds:[FO_VAR_obj_dude];
|
||||
call fo::funcoffs::register_object_animate_;
|
||||
mov ecx, dword ptr ds:[FO_VAR_combat_highlight]; // backup setting
|
||||
mov dword ptr ds:[FO_VAR_combat_highlight], eax; // prevent calling combat_outline_off_ (eax is never 2)
|
||||
mov ecx, ds:[FO_VAR_combat_highlight]; // backup setting
|
||||
mov ds:[FO_VAR_combat_highlight], eax; // prevent calling combat_outline_off_ (eax is never 2)
|
||||
call fo::funcoffs::register_end_;
|
||||
mov dword ptr ds:[FO_VAR_combat_highlight], ecx; // restore setting
|
||||
mov ds:[FO_VAR_combat_highlight], ecx; // restore setting
|
||||
pop eax;
|
||||
jmp fo::funcoffs::gsound_play_sfx_file_;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ notIdentical:
|
||||
static __declspec(naked) void new_obj_id_hook() {
|
||||
__asm {
|
||||
mov eax, 83535;
|
||||
cmp dword ptr ds:[FO_VAR_cur_id], eax;
|
||||
cmp ds:[FO_VAR_cur_id], eax;
|
||||
jle pickNewID;
|
||||
retn;
|
||||
pickNewID: // skip PM range (18000 - 83535)
|
||||
|
||||
@@ -62,12 +62,12 @@ static __declspec(naked) void PipStatus_hook_printfix() {
|
||||
movzx eax, word ptr [esp + 0x49C + 8];
|
||||
dec eax;
|
||||
shl eax, 1;
|
||||
add eax, dword ptr ds:[FO_VAR_cursor_line];
|
||||
cmp eax, dword ptr ds:[FO_VAR_bottom_line]; // check max
|
||||
add eax, ds:[FO_VAR_cursor_line];
|
||||
cmp eax, ds:[FO_VAR_bottom_line]; // check max
|
||||
jb skip;
|
||||
mov eax, dword ptr ds:[FO_VAR_quest_count];
|
||||
mov eax, ds:[FO_VAR_quest_count];
|
||||
sub eax, 2;
|
||||
mov dword ptr [esp + 0x4BC - 0x24 + 8], eax; // set last counter
|
||||
mov [esp + 0x4BC - 0x24 + 8], eax; // set last counter
|
||||
mov outRangeFlag, 1;
|
||||
skip:
|
||||
pop eax;
|
||||
@@ -123,7 +123,7 @@ skip:
|
||||
mov calledflag, 1;
|
||||
mov called_quest_number, ebx
|
||||
// engine
|
||||
mov edx, dword ptr ds:[FO_VAR_crnt_func];
|
||||
mov edx, ds:[FO_VAR_crnt_func];
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -266,8 +266,8 @@ static __declspec(naked) void PrintPages() {
|
||||
add esp, 0x18;
|
||||
|
||||
mov ebx, 1;
|
||||
mov dword ptr ds:[FO_VAR_cursor_line], ebx;
|
||||
mov bl, byte ptr ds:[FO_VAR_GreenColor];
|
||||
mov ds:[FO_VAR_cursor_line], ebx;
|
||||
mov bl, ds:[FO_VAR_GreenColor];
|
||||
mov edx, 0x21;
|
||||
lea eax, bufPage;
|
||||
jmp fo::funcoffs::pip_print_;
|
||||
|
||||
@@ -78,7 +78,7 @@ __declspec(naked) void op_mod_kill_counter() {
|
||||
skip:
|
||||
cmp eax, 38;
|
||||
jae end;
|
||||
add word ptr ds:[FO_VAR_pc_kill_counts][eax * 2], cx;
|
||||
add ds:[FO_VAR_pc_kill_counts][eax * 2], cx;
|
||||
end:
|
||||
pop ecx;
|
||||
retn;
|
||||
|
||||
@@ -358,7 +358,7 @@ __declspec(naked) void op_set_shader_vector() {
|
||||
argloopstart:
|
||||
mov eax, ebp;
|
||||
call fo::funcoffs::interpretPopShort_;
|
||||
mov word ptr [esp + ecx * 2 + 0x16], ax;
|
||||
mov [esp + ecx * 2 + 0x16], ax;
|
||||
mov eax, ebp;
|
||||
call fo::funcoffs::interpretPopLong_;
|
||||
mov [esp + ecx * 4 - 0x4], eax;
|
||||
@@ -386,7 +386,7 @@ next:
|
||||
mov eax, ebp;
|
||||
mov ebx, [esp + 4];
|
||||
xor edx, edx;
|
||||
mov dx, word ptr [esp + 0x1a];
|
||||
mov dx, [esp + 0x1a];
|
||||
call fo::funcoffs::interpretGetString_;
|
||||
mov [esp + 4], eax;
|
||||
call SetShaderVector;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user