diff --git a/artifacts/scripting/hooks.yml b/artifacts/scripting/hooks.yml index 9b7aa1e6..e9a4ceda 100644 --- a/artifacts/scripting/hooks.yml +++ b/artifacts/scripting/hooks.yml @@ -18,8 +18,8 @@ Critter arg2 - The target of the attack int arg3 - The targeted bodypart int arg4 - Source tile (may differ from attacker's tile, when AI is considering potential fire position) - int arg5 - Attack Type (one of ATKTYPE_*) - int arg6 - Ranged flag. 1 means the hit chance is calculated by taking into account the bonuses/penalties of the distance to the target + int arg5 - Attack Type (see ATKTYPE_* constants) + int arg6 - Ranged flag. 1 if the hit chance calculation takes into account the distance to the target. This does not mean the attack is a ranged attack int arg7 - The raw hit chance before applying the cap int ret0 - the new hit chance diff --git a/artifacts/scripting/hookscripts.md b/artifacts/scripting/hookscripts.md index 2db9213e..89325f89 100644 --- a/artifacts/scripting/hookscripts.md +++ b/artifacts/scripting/hookscripts.md @@ -96,8 +96,8 @@ Critter arg1 - The attacker Critter arg2 - The target of the attack int arg3 - The targeted bodypart int arg4 - Source tile (may differ from attacker's tile, when AI is considering potential fire position) -int arg5 - Attack Type (one of ATKTYPE_*) -int arg6 - Ranged flag. 1 means the hit chance is calculated by taking into account the bonuses/penalties of the distance to the target +int arg5 - Attack Type (see ATKTYPE_* constants) +int arg6 - Ranged flag. 1 if the hit chance calculation takes into account the distance to the target. This does not mean the attack is a ranged attack int arg7 - The raw hit chance before applying the cap int ret0 - the new hit chance diff --git a/sfall/Modules/MiscPatches.cpp b/sfall/Modules/MiscPatches.cpp index 89ac8553..a22f720d 100644 --- a/sfall/Modules/MiscPatches.cpp +++ b/sfall/Modules/MiscPatches.cpp @@ -852,6 +852,16 @@ static void EngineOptimizationPatches() { SafeWrite32(0x4D630C, 0x9090C031); // xor eax, eax SafeWrite8(0x4D6310, 0x90); BlockCall(0x4D6319); + + // Reduce excessive delays in the save/load game screens + SafeWriteBatch(16, { // 41 to 16 ms + 0x47D00D, // LoadGame_ + 0x47C1FD // SaveGame_ + }); + // LoadGame_ + SafeWrite8(0x47CF0D, 195 + 10); // jz +10 + // SaveGame_ + SafeWrite8(0x47C135, 140 + 10); // jz +10 } void MiscPatches::init() { diff --git a/sfall/Modules/Scripting/Handlers/Misc.cpp b/sfall/Modules/Scripting/Handlers/Misc.cpp index cfa4f5e3..5b5ad5bc 100644 --- a/sfall/Modules/Scripting/Handlers/Misc.cpp +++ b/sfall/Modules/Scripting/Handlers/Misc.cpp @@ -195,10 +195,10 @@ end: static const char* valueOutRange = "%s() - argument values out of range."; void op_set_critical_table(OpcodeContext& ctx) { - DWORD critter = ctx.arg(0).rawValue(), - bodypart = ctx.arg(1).rawValue(), - slot = ctx.arg(2).rawValue(), - element = ctx.arg(3).rawValue(); + DWORD critter = ctx.arg(0).rawValue(), + bodypart = ctx.arg(1).rawValue(), + slot = ctx.arg(2).rawValue(), + element = ctx.arg(3).rawValue(); if (critter >= Criticals::critTableCount || bodypart >= 9 || slot >= 6 || element >= 7) { ctx.printOpcodeError(valueOutRange, ctx.getOpcodeName()); @@ -208,10 +208,10 @@ void op_set_critical_table(OpcodeContext& ctx) { } void op_get_critical_table(OpcodeContext& ctx) { - DWORD critter = ctx.arg(0).rawValue(), - bodypart = ctx.arg(1).rawValue(), - slot = ctx.arg(2).rawValue(), - element = ctx.arg(3).rawValue(); + DWORD critter = ctx.arg(0).rawValue(), + bodypart = ctx.arg(1).rawValue(), + slot = ctx.arg(2).rawValue(), + element = ctx.arg(3).rawValue(); if (critter >= Criticals::critTableCount || bodypart >= 9 || slot >= 6 || element >= 7) { ctx.printOpcodeError(valueOutRange, ctx.getOpcodeName()); @@ -221,10 +221,10 @@ void op_get_critical_table(OpcodeContext& ctx) { } void op_reset_critical_table(OpcodeContext& ctx) { - DWORD critter = ctx.arg(0).rawValue(), - bodypart = ctx.arg(1).rawValue(), - slot = ctx.arg(2).rawValue(), - element = ctx.arg(3).rawValue(); + DWORD critter = ctx.arg(0).rawValue(), + bodypart = ctx.arg(1).rawValue(), + slot = ctx.arg(2).rawValue(), + element = ctx.arg(3).rawValue(); if (critter >= Criticals::critTableCount || bodypart >= 9 || slot >= 6 || element >= 7) { ctx.printOpcodeError(valueOutRange, ctx.getOpcodeName()); diff --git a/sfall/Modules/Scripting/Handlers/Objects.cpp b/sfall/Modules/Scripting/Handlers/Objects.cpp index 00119bb4..713be105 100644 --- a/sfall/Modules/Scripting/Handlers/Objects.cpp +++ b/sfall/Modules/Scripting/Handlers/Objects.cpp @@ -182,9 +182,9 @@ void op_create_spatial(OpcodeContext& ctx) { using fo::Scripts::start; DWORD scriptIndex = ctx.arg(0).rawValue(), - tile = ctx.arg(1).rawValue(), - elevation = ctx.arg(2).rawValue(), - radius = ctx.arg(3).rawValue(); + tile = ctx.arg(1).rawValue(), + elevation = ctx.arg(2).rawValue(), + radius = ctx.arg(3).rawValue(); long scriptId; fo::ScriptInstance* scriptPtr; @@ -311,7 +311,7 @@ void op_make_path(OpcodeContext& ctx) { void op_obj_blocking_at(OpcodeContext& ctx) { DWORD tile = ctx.arg(0).rawValue(), - elevation = ctx.arg(1).rawValue(); + elevation = ctx.arg(1).rawValue(); BlockType type = (BlockType)ctx.arg(2).rawValue(); fo::GameObject* resultObj = fo::func::obj_blocking_at_wrapper(0, tile, elevation, (void*)getBlockingFunc(type));