mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Cosmetic edits: unified the placement of __declspec keyword
* it's recommended to place __declspec before the return type. (ref: https://stackoverflow.com/q/13613864 )
This commit is contained in:
@@ -116,7 +116,7 @@ static void __fastcall WriteGameLog(const char* a) {
|
||||
ConsoleWindow::instance().write(a, ConsoleWindow::Source::GAME);
|
||||
}
|
||||
|
||||
static void __declspec(naked) debug_printf_hook() {
|
||||
static __declspec(naked) void debug_printf_hook() {
|
||||
__asm {
|
||||
call fo::funcoffs::vsprintf_;
|
||||
pushadc;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace func
|
||||
|
||||
// Prints debug message to game debug.log file for develop build
|
||||
#ifndef NDEBUG
|
||||
void __declspec(naked) dev_printf(const char* fmt, ...) {
|
||||
__declspec(naked) void dev_printf(const char* fmt, ...) {
|
||||
__asm jmp fo::funcoffs::debug_printf_;
|
||||
}
|
||||
#else
|
||||
@@ -117,7 +117,7 @@ void dev_printf(...) {}
|
||||
|
||||
|
||||
// prints message to debug.log file
|
||||
void __declspec(naked) debug_printf(const char* fmt, ...) {
|
||||
__declspec(naked) void debug_printf(const char* fmt, ...) {
|
||||
__asm jmp fo::funcoffs::debug_printf_;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ isNotStr:
|
||||
|
||||
// prints scripting error in debug.log and stops current script execution by performing longjmp
|
||||
// USE WITH CAUTION
|
||||
void __declspec(naked) interpretError(const char* fmt, ...) {
|
||||
__declspec(naked) void interpretError(const char* fmt, ...) {
|
||||
__asm jmp fo::funcoffs::interpretError_;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,13 +42,13 @@ void dev_printf(...);
|
||||
*/
|
||||
|
||||
// prints message to debug.log file
|
||||
void __declspec() debug_printf(const char* fmt, ...);
|
||||
void debug_printf(const char* fmt, ...);
|
||||
|
||||
void interpretReturnValue(Program* scriptPtr, DWORD val, DWORD valType);
|
||||
|
||||
// prints scripting error in debug.log and stops current script execution by performing longjmp
|
||||
// USE WITH CAUTION
|
||||
void __declspec() interpretError(const char* fmt, ...);
|
||||
void interpretError(const char* fmt, ...);
|
||||
|
||||
long __stdcall db_init(const char* path_dat, const char* path_patches);
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ void __stdcall CombatAI::ai_check_drugs(fo::GameObject* source) {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_check_drugs_replacement() {
|
||||
static __declspec(naked) void ai_check_drugs_replacement() {
|
||||
__asm {
|
||||
push ecx;
|
||||
push eax; // source
|
||||
@@ -183,7 +183,7 @@ static void __declspec(naked) ai_check_drugs_replacement() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_can_use_drug_hack() {
|
||||
static __declspec(naked) void ai_can_use_drug_hack() {
|
||||
__asm {
|
||||
push ecx; // item
|
||||
call Items::IsHealingItem;
|
||||
|
||||
@@ -99,7 +99,7 @@ DWORD __stdcall Inventory::adjust_fid() {
|
||||
return *fo::ptr::i_fid;
|
||||
}
|
||||
|
||||
static void __declspec(naked) adjust_fid_replacement() {
|
||||
static __declspec(naked) void adjust_fid_replacement() {
|
||||
__asm {
|
||||
push ecx;
|
||||
push edx;
|
||||
|
||||
@@ -183,7 +183,7 @@ endReload:
|
||||
return sf::CalcApCostHook_Invoke(source, hitMode, isCalled, cost, weapon); // return cost
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_search_inven_weap_hook() {
|
||||
static __declspec(naked) void ai_search_inven_weap_hook() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
push 0; // no called
|
||||
@@ -233,7 +233,7 @@ long __fastcall Items::item_w_mp_cost(fo::GameObject* source, fo::AttackType hit
|
||||
);
|
||||
}
|
||||
|
||||
static void __declspec(naked) item_w_mp_cost_replacement() {
|
||||
static __declspec(naked) void item_w_mp_cost_replacement() {
|
||||
__asm {
|
||||
push ebx; // isCalled
|
||||
mov ecx, eax; // source
|
||||
@@ -250,7 +250,7 @@ long __fastcall Items::item_w_curr_ammo(fo::GameObject* item) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __declspec(naked) item_w_curr_ammo_replacement() {
|
||||
static __declspec(naked) void item_w_curr_ammo_replacement() {
|
||||
__asm {
|
||||
push ecx;
|
||||
push edx;
|
||||
|
||||
@@ -37,7 +37,7 @@ int __stdcall Skills::trait_adjust_skill(DWORD skillID) {
|
||||
return result;
|
||||
}
|
||||
|
||||
static void __declspec(naked) trait_adjust_skill_replacement() {
|
||||
static __declspec(naked) void trait_adjust_skill_replacement() {
|
||||
__asm {
|
||||
push edx;
|
||||
push ecx;
|
||||
|
||||
@@ -107,7 +107,7 @@ int __stdcall Stats::trait_adjust_stat(DWORD statID) {
|
||||
return result;
|
||||
}
|
||||
|
||||
static void __declspec(naked) trait_adjust_stat_replacement() {
|
||||
static __declspec(naked) void trait_adjust_stat_replacement() {
|
||||
__asm {
|
||||
push edx;
|
||||
push ecx;
|
||||
|
||||
@@ -56,7 +56,7 @@ static fo::GameObject* __fastcall obj_path_blocking_at(fo::GameObject* source, l
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void __declspec(naked) Tilemap::obj_path_blocking_at_() {
|
||||
__declspec(naked) void Tilemap::obj_path_blocking_at_() {
|
||||
__asm {
|
||||
push ecx;
|
||||
push ebx;
|
||||
@@ -175,7 +175,7 @@ long __fastcall Tilemap::tile_num_beyond(long sourceTile, long targetTile, long
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) tile_num_beyond_replacement() {
|
||||
static __declspec(naked) void tile_num_beyond_replacement() {
|
||||
__asm { // push ecx;
|
||||
push ebx;
|
||||
mov ecx, eax;
|
||||
|
||||
+24
-24
@@ -78,7 +78,7 @@ bool AIHelpers::AttackInRange(fo::GameObject* source, fo::GameObject* weapon, fo
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void __declspec(naked) ai_try_attack_hook_FleeFix() {
|
||||
static __declspec(naked) void ai_try_attack_hook_FleeFix() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
or byte ptr [esi + combatState], ReTarget; // set CombatStateFlag flag
|
||||
@@ -86,7 +86,7 @@ static void __declspec(naked) ai_try_attack_hook_FleeFix() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) combat_ai_hook_FleeFix() {
|
||||
static __declspec(naked) void combat_ai_hook_FleeFix() {
|
||||
static const DWORD combat_ai_hook_flee_Ret = 0x42B206;
|
||||
using namespace fo;
|
||||
__asm {
|
||||
@@ -102,7 +102,7 @@ reTarget:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_try_attack_hook_runFix() {
|
||||
static __declspec(naked) void ai_try_attack_hook_runFix() {
|
||||
__asm {
|
||||
mov ecx, [esi + combatState]; // save combat flags before ai_run_away
|
||||
call fo::funcoffs::ai_run_away_;
|
||||
@@ -111,7 +111,7 @@ static void __declspec(naked) ai_try_attack_hook_runFix() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) combat_ai_hack() {
|
||||
static __declspec(naked) void combat_ai_hack() {
|
||||
static const DWORD combat_ai_hack_Ret = 0x42B204;
|
||||
__asm {
|
||||
mov edx, [ebx + 0x10]; // cap.min_hp
|
||||
@@ -131,7 +131,7 @@ tryHeal:
|
||||
}
|
||||
}
|
||||
|
||||
/*static void __declspec(naked) ai_check_drugs_hook() {
|
||||
/*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
|
||||
@@ -142,7 +142,7 @@ tryHeal:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_check_drugs_hook_healing() {
|
||||
static __declspec(naked) void ai_check_drugs_hook_healing() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
call fo::funcoffs::ai_retrieve_object_;
|
||||
@@ -190,7 +190,7 @@ static bool __fastcall TargetExistInList(fo::GameObject* target, fo::GameObject*
|
||||
return false;
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_find_attackers_hack_target2() {
|
||||
static __declspec(naked) void ai_find_attackers_hack_target2() {
|
||||
__asm {
|
||||
mov edi, [esp + 0x24 - 0x24 + 4] // critter (target)
|
||||
pushadc;
|
||||
@@ -207,7 +207,7 @@ skip:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_find_attackers_hack_target3() {
|
||||
static __declspec(naked) void ai_find_attackers_hack_target3() {
|
||||
__asm {
|
||||
mov edi, [esp + 0x24 - 0x20 + 4] // critter (target)
|
||||
push eax;
|
||||
@@ -233,7 +233,7 @@ skip:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_find_attackers_hack_target4() {
|
||||
static __declspec(naked) void ai_find_attackers_hack_target4() {
|
||||
__asm {
|
||||
mov eax, [ecx + eax]; // critter (target)
|
||||
pushadc;
|
||||
@@ -252,7 +252,7 @@ skip:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void __declspec(naked) ai_danger_source_hack_pm_newFind() {
|
||||
static __declspec(naked) void ai_danger_source_hack_pm_newFind() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
mov ecx, [ebp + 0x18]; // source combat_data.who_hit_me
|
||||
@@ -305,7 +305,7 @@ static long __fastcall ai_try_attack_switch_fix(fo::GameObject* target, long &hi
|
||||
return -1; // exit, NPC has a weapon in hand slot, so we don't look for another weapon on the map
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_try_attack_hook_switch_fix() {
|
||||
static __declspec(naked) void ai_try_attack_hook_switch_fix() {
|
||||
__asm {
|
||||
push edx;
|
||||
push [ebx]; // weapon
|
||||
@@ -326,7 +326,7 @@ noSwitch:
|
||||
|
||||
static long RetryCombatMinAP;
|
||||
|
||||
static void __declspec(naked) RetryCombatHook() {
|
||||
static __declspec(naked) void RetryCombatHook() {
|
||||
static DWORD RetryCombatLastAP = 0;
|
||||
using namespace fo;
|
||||
__asm {
|
||||
@@ -393,7 +393,7 @@ static long __fastcall ai_weapon_reload_fix(fo::GameObject* weapon, fo::GameObje
|
||||
return result;
|
||||
}
|
||||
|
||||
static void __declspec(naked) item_w_reload_hook() {
|
||||
static __declspec(naked) void item_w_reload_hook() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
cmp dword ptr [eax + protoId], PID_SOLAR_SCORCHER;
|
||||
@@ -420,7 +420,7 @@ static long __fastcall item_weapon_reload_cost_fix(fo::GameObject* source, fo::G
|
||||
return fo::func::ai_have_ammo(source, weapon, outAmmo); // 0 - no ammo
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_try_attack_hook_cost_reload() {
|
||||
static __declspec(naked) void ai_try_attack_hook_cost_reload() {
|
||||
static const DWORD ai_try_attack_hook_goNext_Ret = 0x42A9F2;
|
||||
__asm {
|
||||
push ebx; // ammoObj ref
|
||||
@@ -436,7 +436,7 @@ static void __declspec(naked) ai_try_attack_hook_cost_reload() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_try_attack_hook_cost1() {
|
||||
static __declspec(naked) void ai_try_attack_hook_cost1() {
|
||||
__asm {
|
||||
xor ebx, ebx;
|
||||
sub edx, aiReloadCost; // curr.mp - reload cost
|
||||
@@ -445,7 +445,7 @@ static void __declspec(naked) ai_try_attack_hook_cost1() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_try_attack_hook_cost2() {
|
||||
static __declspec(naked) void ai_try_attack_hook_cost2() {
|
||||
__asm {
|
||||
xor ecx, ecx;
|
||||
sub ebx, aiReloadCost; // curr.mp - reload cost
|
||||
@@ -464,7 +464,7 @@ static long __fastcall CheckWeaponRangeAndApCost(fo::GameObject* source, fo::Gam
|
||||
return (source->critter.movePoints >= game::Items::item_w_mp_cost(source, fo::ATKTYPE_RWEAPON_SECONDARY, 0)); // 1 - allow secondary mode
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_pick_hit_mode_hook() {
|
||||
static __declspec(naked) void ai_pick_hit_mode_hook() {
|
||||
__asm {
|
||||
call fo::funcoffs::caiHasWeapPrefType_;
|
||||
test eax, eax;
|
||||
@@ -477,7 +477,7 @@ evaluation:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_danger_source_hook() {
|
||||
static __declspec(naked) void ai_danger_source_hook() {
|
||||
__asm {
|
||||
call fo::funcoffs::combat_check_bad_shot_;
|
||||
cmp dword ptr [esp + 56], 0x42B235 + 5; // called from combat_ai_
|
||||
@@ -490,7 +490,7 @@ fix: // check result
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) cai_perform_distance_prefs_hack() {
|
||||
static __declspec(naked) void cai_perform_distance_prefs_hack() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
mov ecx, eax; // current distance to target
|
||||
@@ -521,7 +521,7 @@ skipMove:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_move_away_hook() {
|
||||
static __declspec(naked) void ai_move_away_hook() {
|
||||
static const DWORD ai_move_away_hook_Ret = 0x4289DA;
|
||||
__asm {
|
||||
test ebx, ebx;
|
||||
@@ -547,7 +547,7 @@ static bool __fastcall RollFriendlyFire(fo::GameObject* target, fo::GameObject*
|
||||
return false;
|
||||
}
|
||||
|
||||
static void __declspec(naked) combat_safety_invalidate_weapon_func_hook_check() {
|
||||
static __declspec(naked) void combat_safety_invalidate_weapon_func_hook_check() {
|
||||
static const DWORD safety_invalidate_weapon_burst_friendly = 0x4216C9;
|
||||
__asm {
|
||||
pushadc;
|
||||
@@ -570,7 +570,7 @@ static long __fastcall CheckFireBurst(fo::GameObject* attacker, fo::GameObject*
|
||||
return 1; // allow
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_pick_hit_mode_hack() {
|
||||
static __declspec(naked) void ai_pick_hit_mode_hack() {
|
||||
__asm {
|
||||
cmp eax, 1;
|
||||
je isAllowed;
|
||||
@@ -590,7 +590,7 @@ skip:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void __declspec(naked) ai_try_attack_hack_check_safe_weapon() {
|
||||
static __declspec(naked) void ai_try_attack_hack_check_safe_weapon() {
|
||||
__asm {
|
||||
mov ebx, [esp + 0x364 - 0x38 + 4]; // hit mode
|
||||
retn;
|
||||
@@ -604,7 +604,7 @@ static void __fastcall CombatAttackHook(fo::GameObject* source, fo::GameObject*
|
||||
targets[source] = target; // who was attacked by the 'source' from the last time
|
||||
}
|
||||
|
||||
static void __declspec(naked) combat_attack_hook() {
|
||||
static __declspec(naked) void combat_attack_hook() {
|
||||
__asm {
|
||||
push eax;
|
||||
push ecx;
|
||||
|
||||
@@ -221,7 +221,7 @@ static long __fastcall CopyRegistry(long checkSlot) {
|
||||
return lastAnim;
|
||||
}
|
||||
|
||||
static void __declspec(naked) check_registry_hack() {
|
||||
static __declspec(naked) void check_registry_hack() {
|
||||
__asm {
|
||||
mov eax, animSet;
|
||||
cmp [eax][edx][0x10], 0x0B; // animSet[].anim[].animType == Must_Call
|
||||
@@ -258,7 +258,7 @@ static long __fastcall anim_cleanup_sub(long currAnims) {
|
||||
return (currAnims <= 0) ? -1 : 0;
|
||||
}
|
||||
|
||||
static void __declspec(naked) anim_cleanup_hack() {
|
||||
static __declspec(naked) void anim_cleanup_hack() {
|
||||
__asm {
|
||||
call anim_cleanup_sub;
|
||||
mov ecx, eax; // ecx - anims slot index
|
||||
@@ -308,7 +308,7 @@ static void __fastcall CheckAppendReg(long, long totalAnims) {
|
||||
set->totalAnimCount = totalAnims;
|
||||
}
|
||||
|
||||
static void __declspec(naked) register_end_hack_begin() {
|
||||
static __declspec(naked) void register_end_hack_begin() {
|
||||
__asm {
|
||||
mov edx, ds:[FO_VAR_curr_anim_counter];
|
||||
mov esi, animSet;
|
||||
@@ -352,7 +352,7 @@ static long __fastcall UnlockAnimSlot() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __declspec(naked) register_end_hack_end() {
|
||||
static __declspec(naked) void register_end_hack_end() {
|
||||
__asm {
|
||||
// mov eax, animSet;
|
||||
// test word ptr [eax][esi][0xC], e_Append; // slot with added animation?
|
||||
@@ -367,7 +367,7 @@ static void __declspec(naked) register_end_hack_end() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) register_clear_hook() {
|
||||
static __declspec(naked) void register_clear_hook() {
|
||||
__asm {
|
||||
mov ecx, eax;
|
||||
call LockAnimSlot;
|
||||
@@ -375,7 +375,7 @@ static void __declspec(naked) register_clear_hook() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) anim_free_slot_hack() {
|
||||
static __declspec(naked) void anim_free_slot_hack() {
|
||||
static const DWORD anim_free_slot_next = 0x413BD5;
|
||||
using namespace fo;
|
||||
__asm {
|
||||
@@ -396,7 +396,7 @@ static void ClearAllLock() {
|
||||
std::fill(lockAnimSet.begin(), lockAnimSet.end(), 0);
|
||||
}
|
||||
|
||||
static void __declspec(naked) anim_stop_hack() {
|
||||
static __declspec(naked) void anim_stop_hack() {
|
||||
__asm {
|
||||
call ClearAllLock;
|
||||
mov edx, 1;
|
||||
@@ -411,7 +411,7 @@ static void __fastcall ClearDataAnimations(long slot) {
|
||||
}
|
||||
#endif
|
||||
|
||||
static void __declspec(naked) anim_set_end_hack() {
|
||||
static __declspec(naked) void anim_set_end_hack() {
|
||||
__asm {
|
||||
test dl, e_InCombat; // is combat flag set?
|
||||
jz skip;
|
||||
@@ -437,7 +437,7 @@ static bool __fastcall CheckSetSad(BYTE openFlag, DWORD slot) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void __declspec(naked) object_move_hack() {
|
||||
static __declspec(naked) void object_move_hack() {
|
||||
static const DWORD object_move_back0 = 0x417611;
|
||||
static const DWORD object_move_back1 = 0x417616;
|
||||
__asm {
|
||||
@@ -452,7 +452,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) action_climb_ladder_hook() {
|
||||
static __declspec(naked) void action_climb_ladder_hook() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
cmp word ptr [edi + 0x40], 0xFFFF; // DestTile
|
||||
@@ -471,7 +471,7 @@ skip:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) art_alias_fid_hack() {
|
||||
static __declspec(naked) void art_alias_fid_hack() {
|
||||
static const DWORD art_alias_fid_Ret = 0x419A6D;
|
||||
using namespace fo;
|
||||
__asm {
|
||||
@@ -488,7 +488,7 @@ skip:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) obj_use_container_hook() {
|
||||
static __declspec(naked) void obj_use_container_hook() {
|
||||
static const DWORD obj_use_container_Ret = 0x49D012;
|
||||
static const DWORD obj_use_container_ExitRet = 0x49D069;
|
||||
using namespace fo::Fields;
|
||||
|
||||
@@ -56,7 +56,7 @@ static struct tBox {
|
||||
|
||||
static bool setCustomBoxText;
|
||||
|
||||
static void __declspec(naked) DisplayBoxesHack() {
|
||||
static __declspec(naked) void DisplayBoxesHack() {
|
||||
static const DWORD DisplayBoxesRet1 = 0x4615A8;
|
||||
static const DWORD DisplayBoxesRet2 = 0x4615BE;
|
||||
__asm {
|
||||
@@ -83,7 +83,7 @@ fail:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) BarBoxesTextHack() {
|
||||
static __declspec(naked) void BarBoxesTextHack() {
|
||||
__asm {
|
||||
push ecx; // ecx = BoxIndex
|
||||
sub ecx, 5; // subtract vanilla boxes
|
||||
@@ -110,7 +110,7 @@ skip:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) BarBoxesIndexHack() {
|
||||
static __declspec(naked) void BarBoxesIndexHack() {
|
||||
static const DWORD SetIndexBoxRet = 0x4612E8;
|
||||
__asm {
|
||||
mov eax, ds:[0x4612E2]; // fontnum
|
||||
@@ -120,7 +120,7 @@ static void __declspec(naked) BarBoxesIndexHack() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) BarBoxesSizeHack() {
|
||||
static __declspec(naked) void BarBoxesSizeHack() {
|
||||
static const DWORD SizeLoopBoxRet = 0x461477;
|
||||
static const DWORD ExitLoopBoxRet = 0x461498;
|
||||
__asm {
|
||||
@@ -249,7 +249,7 @@ static long __fastcall GetOffsetX(int width) {
|
||||
return x_offset;
|
||||
}
|
||||
|
||||
static void __declspec(naked) refresh_box_bar_win_hack() {
|
||||
static __declspec(naked) void refresh_box_bar_win_hack() {
|
||||
__asm {
|
||||
push ecx;
|
||||
mov ecx, ebx; // _barWindow width
|
||||
|
||||
@@ -47,7 +47,7 @@ static sBook* __fastcall FindBook(DWORD pid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __declspec(naked) obj_use_book_hook() {
|
||||
static __declspec(naked) void obj_use_book_hook() {
|
||||
static const DWORD obj_use_book_hook_back = 0x49BA5A;
|
||||
__asm {
|
||||
mov edi, -1;
|
||||
|
||||
+188
-188
File diff suppressed because it is too large
Load Diff
@@ -62,7 +62,7 @@ static long __fastcall ComputeSpray(DWORD* roundsLeftOut, DWORD* roundsRightOut,
|
||||
return (result % compute_spray_target_div) ? ++roundsMainTarget : roundsMainTarget; // if remainder then round up
|
||||
}
|
||||
|
||||
static void __declspec(naked) compute_spray_rounds_distribution() {
|
||||
static __declspec(naked) void compute_spray_rounds_distribution() {
|
||||
static const DWORD compute_spray_rounds_back = 0x42353A;
|
||||
__asm {
|
||||
push ecx;
|
||||
|
||||
+14
-14
@@ -114,7 +114,7 @@ static long __fastcall check_item_ammo_cost(fo::GameObject* weapon, fo::AttackTy
|
||||
}
|
||||
|
||||
// adds check for weapons which require more than 1 ammo for single shot (super cattle prod & mega power fist) and burst rounds
|
||||
static void __declspec(naked) combat_check_bad_shot_hook() {
|
||||
static __declspec(naked) void combat_check_bad_shot_hook() {
|
||||
__asm {
|
||||
push edx;
|
||||
push ecx; // weapon
|
||||
@@ -127,7 +127,7 @@ static void __declspec(naked) combat_check_bad_shot_hook() {
|
||||
}
|
||||
|
||||
// check if there is enough ammo to shoot
|
||||
static void __declspec(naked) ai_search_inven_weap_hook() {
|
||||
static __declspec(naked) void ai_search_inven_weap_hook() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
push ecx;
|
||||
@@ -140,7 +140,7 @@ static void __declspec(naked) ai_search_inven_weap_hook() {
|
||||
}
|
||||
|
||||
// switch weapon mode from secondary to primary if there is not enough ammo to shoot
|
||||
static void __declspec(naked) ai_try_attack_hook() {
|
||||
static __declspec(naked) void ai_try_attack_hook() {
|
||||
static const DWORD ai_try_attack_search_ammo = 0x42AA1E;
|
||||
static const DWORD ai_try_attack_continue = 0x42A929;
|
||||
using namespace fo;
|
||||
@@ -178,7 +178,7 @@ static long __fastcall divide_burst_rounds_by_ammo_cost(long currAmmo, fo::GameO
|
||||
return max(1, (cost / roundsCost)); // divide back to get proper number of rounds for damage calculations (minimum is 1)
|
||||
}
|
||||
|
||||
static void __declspec(naked) compute_spray_hack() {
|
||||
static __declspec(naked) void compute_spray_hack() {
|
||||
__asm { // ebp = current ammo
|
||||
// push edx; // weapon
|
||||
// push ecx; // current ammo in weapon
|
||||
@@ -219,7 +219,7 @@ static DWORD __fastcall CalcKnockbackMod(int knockValue, int damage, fo::GameObj
|
||||
return (DWORD)floor(result);
|
||||
}
|
||||
|
||||
static void __declspec(naked) compute_damage_hack() {
|
||||
static __declspec(naked) void compute_damage_hack() {
|
||||
__asm {
|
||||
mov eax, [esp + 0x14 + 4];
|
||||
push eax; // Target
|
||||
@@ -232,7 +232,7 @@ static void __declspec(naked) compute_damage_hack() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) compute_dmg_damage_hack() {
|
||||
static __declspec(naked) void compute_dmg_damage_hack() {
|
||||
static const DWORD KnockbackRetAddr = 0x4136E1;
|
||||
__asm {
|
||||
push ecx
|
||||
@@ -258,7 +258,7 @@ static int __fastcall HitChanceMod(int base, fo::GameObject* critter) {
|
||||
return min(base + baseHitChance.mod, baseHitChance.maximum);
|
||||
}
|
||||
|
||||
static void __declspec(naked) determine_to_hit_func_hack() {
|
||||
static __declspec(naked) void determine_to_hit_func_hack() {
|
||||
__asm {
|
||||
mov edx, edi; // critter
|
||||
mov ecx, esi; // base (calculated hit chance)
|
||||
@@ -270,7 +270,7 @@ static void __declspec(naked) determine_to_hit_func_hack() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) determine_to_hit_func_hook_min() {
|
||||
static __declspec(naked) void determine_to_hit_func_hook_min() {
|
||||
__asm {
|
||||
mov esi, -99; // min
|
||||
jmp fo::funcoffs::debug_printf_;
|
||||
@@ -294,7 +294,7 @@ static long __fastcall CheckDisableBurst(fo::GameObject* critter, fo::GameObject
|
||||
return (long)cap->area_attack_mode; // default engine code
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_pick_hit_mode_hack_noBurst() {
|
||||
static __declspec(naked) void ai_pick_hit_mode_hack_noBurst() {
|
||||
__asm {
|
||||
push eax;
|
||||
push ecx;
|
||||
@@ -409,7 +409,7 @@ static int __fastcall AimedShotTest(DWORD pid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __declspec(naked) item_w_called_shot_hook() {
|
||||
static __declspec(naked) void item_w_called_shot_hook() {
|
||||
static const DWORD aimedShotRet1 = 0x478EE4;
|
||||
static const DWORD aimedShotRet2 = 0x478EEA;
|
||||
__asm {
|
||||
@@ -483,7 +483,7 @@ static void BodypartHitReadConfig() {
|
||||
bodyPartHit.Uncalled = static_cast<long>(IniReader::GetConfigInt("Misc", "BodyHit_Torso_Uncalled", 0));
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_pick_hit_mode_hook_bodypart() {
|
||||
static __declspec(naked) void ai_pick_hit_mode_hook_bodypart() {
|
||||
using fo::Uncalled;
|
||||
__asm {
|
||||
mov ebx, Uncalled; // replace Body_Torso with Body_Uncalled
|
||||
@@ -493,7 +493,7 @@ static void __declspec(naked) ai_pick_hit_mode_hook_bodypart() {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void __declspec(naked) apply_damage_hack_main() {
|
||||
static __declspec(naked) void apply_damage_hack_main() {
|
||||
using namespace fo::Fields;
|
||||
__asm {
|
||||
mov edx, [eax + teamNum]; // ctd.target.team_num
|
||||
@@ -517,7 +517,7 @@ skipSetHitTarget:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) apply_damage_hook_extra() {
|
||||
static __declspec(naked) void apply_damage_hook_extra() {
|
||||
using namespace fo::Fields;
|
||||
__asm { // eax - target1-6
|
||||
// does the target belong to the player's team?
|
||||
@@ -536,7 +536,7 @@ dudeTeam: // check who the attacker was attacking
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Ray's combat_p_proc patch
|
||||
static void __declspec(naked) apply_damage_hack() {
|
||||
static __declspec(naked) void apply_damage_hack() {
|
||||
using namespace fo::Fields;
|
||||
__asm {
|
||||
xor edx, edx;
|
||||
|
||||
@@ -37,7 +37,7 @@ static void __fastcall ConsoleFilePrint(const char* msg) {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) display_print_hack() {
|
||||
static __declspec(naked) void display_print_hack() {
|
||||
static const DWORD display_print_Ret = 0x431871;
|
||||
__asm {
|
||||
push ebx;
|
||||
|
||||
@@ -105,7 +105,7 @@ static DWORD __fastcall CreditsNextLine(char* buf, DWORD* font, DWORD* colour) {
|
||||
}
|
||||
|
||||
// Additional lines will be at the top of CREDITS.TXT contents
|
||||
static void __declspec(naked) CreditsNextLineHook_Top() {
|
||||
static __declspec(naked) void CreditsNextLineHook_Top() {
|
||||
__asm {
|
||||
pushadc;
|
||||
push ebx;
|
||||
@@ -123,7 +123,7 @@ fail:
|
||||
}
|
||||
|
||||
// Additional lines will be at the bottom of CREDITS.TXT contents
|
||||
static void __declspec(naked) CreditsNextLineHook_Bottom() {
|
||||
static __declspec(naked) void CreditsNextLineHook_Bottom() {
|
||||
__asm {
|
||||
push eax;
|
||||
push edx;
|
||||
@@ -159,7 +159,7 @@ static void __stdcall SetCreditsPosition(DWORD addr) {
|
||||
HookCall(0x42CB49, func);
|
||||
}
|
||||
|
||||
static void __declspec(naked) ShowCreditsHook() {
|
||||
static __declspec(naked) void ShowCreditsHook() {
|
||||
__asm {
|
||||
push eax;
|
||||
push edx;
|
||||
@@ -178,7 +178,7 @@ static void __declspec(naked) ShowCreditsHook() {
|
||||
}
|
||||
|
||||
// Loads the credits from the 'english' folder if it does not exist in the current language directory
|
||||
static void __declspec(naked) CreditsFileHook() {
|
||||
static __declspec(naked) void CreditsFileHook() {
|
||||
__asm {
|
||||
mov ebx, edx; // keep mode
|
||||
call fo::funcoffs::db_fopen_;
|
||||
|
||||
@@ -422,7 +422,7 @@ fix:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) DisplayBonusRangedDmg_hook() {
|
||||
static __declspec(naked) void DisplayBonusRangedDmg_hook() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
mov edx, PERK_bonus_ranged_damage;
|
||||
@@ -435,7 +435,7 @@ static void __declspec(naked) DisplayBonusRangedDmg_hook() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) DisplayBonusHtHDmg1_hook() {
|
||||
static __declspec(naked) void DisplayBonusHtHDmg1_hook() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
mov edx, PERK_bonus_hth_damage;
|
||||
@@ -469,7 +469,7 @@ static const char* __fastcall GetHtHName(long handOffset) {
|
||||
return Unarmed::GetName(hit);
|
||||
}
|
||||
|
||||
static void __declspec(naked) DisplayBonusHtHDmg2_hack() {
|
||||
static __declspec(naked) void DisplayBonusHtHDmg2_hack() {
|
||||
static const DWORD DisplayBonusHtHDmg2Exit = 0x47254F;
|
||||
static const DWORD DisplayBonusHtHDmg2Exit2 = 0x472556;
|
||||
__asm {
|
||||
|
||||
@@ -297,7 +297,7 @@ void RunDebugEditor() {
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
static void __declspec(naked) dbg_error_hack() {
|
||||
static __declspec(naked) void dbg_error_hack() {
|
||||
static const DWORD dbg_error_ret = 0x453FD8;
|
||||
__asm {
|
||||
cmp ebx, 1;
|
||||
@@ -311,7 +311,7 @@ hide:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) art_data_size_hook() {
|
||||
static __declspec(naked) void art_data_size_hook() {
|
||||
static const char* artDbgMsg = "\nERROR: Art file not found: %s\n";
|
||||
__asm {
|
||||
test edi, edi; // 1 - isExistsArt
|
||||
@@ -327,7 +327,7 @@ artNotExist:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) art_data_size_hook_check() {
|
||||
static __declspec(naked) void art_data_size_hook_check() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
xor esi, esi;
|
||||
@@ -339,7 +339,7 @@ static void __declspec(naked) art_data_size_hook_check() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) proto_load_pid_hack() {
|
||||
static __declspec(naked) void proto_load_pid_hack() {
|
||||
static const char* proDbgMsg = "\nERROR: Reading prototype file: %s\n";
|
||||
__asm {
|
||||
mov dword ptr [esp + 0x120 - 0x1C + 4], -1;
|
||||
@@ -353,7 +353,7 @@ static void __declspec(naked) proto_load_pid_hack() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) win_debug_hook() {
|
||||
static __declspec(naked) void win_debug_hook() {
|
||||
__asm {
|
||||
call fo::funcoffs::debug_log_;
|
||||
xor eax, eax;
|
||||
@@ -362,7 +362,7 @@ static void __declspec(naked) win_debug_hook() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) debug_log_hack() {
|
||||
static __declspec(naked) void debug_log_hack() {
|
||||
__asm {
|
||||
push eax; // text
|
||||
push 0x5016EC; // fmt '%s'
|
||||
@@ -373,7 +373,7 @@ static void __declspec(naked) debug_log_hack() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) debugMsg() {
|
||||
static __declspec(naked) void debugMsg() {
|
||||
static const char* scrNameFmt = "\nScript: %s ";
|
||||
__asm {
|
||||
mov edx, ds:[FO_VAR_currentProgram];
|
||||
@@ -385,7 +385,7 @@ static void __declspec(naked) debugMsg() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) combat_load_hack() {
|
||||
static __declspec(naked) void combat_load_hack() {
|
||||
static const char* msgCombat = "LOADSAVE: Object ID not found while loading the combat data.\n";
|
||||
__asm {
|
||||
push msgCombat;
|
||||
@@ -403,7 +403,7 @@ static void __fastcall DuplicateLogToConsole(const char* a, unsigned long displa
|
||||
console.write(a, source);
|
||||
}
|
||||
|
||||
static void __declspec(naked) op_display_debug_msg_hack() {
|
||||
static __declspec(naked) void op_display_debug_msg_hack() {
|
||||
__asm {
|
||||
mov eax, 0x505224; // "\n"
|
||||
call ds:[FO_VAR_debug_func];
|
||||
@@ -421,14 +421,14 @@ static void __declspec(naked) op_display_debug_msg_hack() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) op_display_msg_hack() {
|
||||
static __declspec(naked) void op_display_msg_hack() {
|
||||
__asm {
|
||||
push 1; // displayMsg = true
|
||||
jmp op_display_debug_msg_hack;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) op_debug_msg_hack() {
|
||||
static __declspec(naked) void op_debug_msg_hack() {
|
||||
__asm {
|
||||
push 0; // displayMsg = false
|
||||
jmp op_display_debug_msg_hack;
|
||||
@@ -438,7 +438,7 @@ static void __declspec(naked) op_debug_msg_hack() {
|
||||
static long debugWndFontOld;
|
||||
static long debugWndFont = 0;
|
||||
// Before something is printed in the window: remembers current font, replace it with debugWndFont.
|
||||
static void __declspec(naked) win_debug_text_height_hook() {
|
||||
static __declspec(naked) void win_debug_text_height_hook() {
|
||||
__asm {
|
||||
call fo::funcoffs::text_curr_;
|
||||
mov debugWndFontOld, eax;
|
||||
@@ -450,7 +450,7 @@ static void __declspec(naked) win_debug_text_height_hook() {
|
||||
}
|
||||
|
||||
// After something is printed in the window: restores current font.
|
||||
static void __declspec(naked) win_debug_win_draw_hook() {
|
||||
static __declspec(naked) void win_debug_win_draw_hook() {
|
||||
__asm {
|
||||
push eax; // winID
|
||||
mov eax, debugWndFontOld;
|
||||
@@ -461,7 +461,7 @@ static void __declspec(naked) win_debug_win_draw_hook() {
|
||||
}
|
||||
|
||||
static long debugWndWidth;
|
||||
static void __declspec(naked) win_debug_pitch_calc_hack() {
|
||||
static __declspec(naked) void win_debug_pitch_calc_hack() {
|
||||
static const DWORD win_debug_pitch_calc_hack_back = 0x4DC542;
|
||||
__asm {
|
||||
mov eax, debugWndWidth;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user