Added optimization for the save/load game screens

Edited the description of args for HOOK_TOHIT.
This commit is contained in:
NovaRain
2021-11-23 20:43:19 +08:00
parent 809cba44e8
commit 81912b47ed
5 changed files with 30 additions and 20 deletions
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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
+10
View File
@@ -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<BYTE>(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() {
+12 -12
View File
@@ -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());
+4 -4
View File
@@ -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));