Minor edits to code and documents

This commit is contained in:
NovaRain
2022-12-01 08:40:39 +08:00
parent 9ecd598544
commit 024a13c6a8
10 changed files with 21 additions and 20 deletions
+1 -1
View File
@@ -752,7 +752,7 @@ AIBestWeaponFix=1
AIDrugUsePerfFix=0
;Set to 1 to fix the bug of using First Aid/Doctor skills when using them on the player
;This will cause the party member to apply his/her skills when you use First Aid/Doctor skills on the player, but only if
;This will cause the party member to perform First Aid/Doctor skills when you use them on the player, but only if
;the player is standing next to the party member
;Note that because the related engine function is not fully implemented, enabling this option without a global script
;that overrides First Aid/Doctor functions has very limited usefulness
+2 -2
View File
@@ -603,7 +603,7 @@
```
Obj arg0 - the object
int ret0 - a pointer to the new text received by using "get_string_pointer" function
int ret0 - a pointer to the new text received by using the get_string_pointer function
```
- name: UseSkillOn
@@ -619,7 +619,7 @@
int arg2 - skill being used
int ret0 - a new critter to override the user critter. Pass -1 to cancel the skill use, pass 0 to skip this return value
int ret1 - pass 1 to allow the skill being used in combat (only for dude_obj or critter being controlled by the player)
int ret1 - pass 1 to allow the skill to be used in combat (only for dude_obj or critter being controlled by the player)
```
- name: OnExplosion
+2 -2
View File
@@ -692,7 +692,7 @@ Does not run if the script of the object overrides the description.
```
Obj arg0 - the object
int ret0 - a pointer to the new text received by using get_string_pointer function
int ret0 - a pointer to the new text received by using the get_string_pointer function
```
-------------------------------------------
@@ -709,7 +709,7 @@ Obj arg1 - the target object/critter
int arg2 - skill being used
int ret0 - a new critter to override the user critter. Pass -1 to cancel the skill use, pass 0 to skip this return value
int ret1 - pass 1 to allow the skill being used in combat (only for dude_obj or critter being controlled by the player)
int ret1 - pass 1 to allow the skill to be used in combat (only for dude_obj or critter being controlled by the player)
```
-------------------------------------------
+2 -2
View File
@@ -184,7 +184,7 @@ void HookScripts::LoadHookScript(const char* name, int id) {
}
}
void HookScripts::InitHookScriptFile(const char* name, int id) {
static void InitHookScriptFile(const char* name, int id) {
ScriptProgram prog;
dlog("> ", DL_HOOK);
dlog(name, DL_HOOK);
@@ -231,7 +231,7 @@ void HookScripts::InitHookScripts() {
dlogr("Running hook scripts...", DL_HOOK);
for (auto& hook : HookScripts::hookScriptFilesList) {
HookScripts::InitHookScriptFile(hook.name.c_str(), hook.id);
InitHookScriptFile(hook.name.c_str(), hook.id);
}
initingHookScripts = 1;
-2
View File
@@ -85,7 +85,6 @@ struct HookFile {
};
class HookScripts : public Module {
public:
const char* name() { return "HookScripts"; }
void init();
@@ -95,7 +94,6 @@ public:
static std::vector<HookFile> hookScriptFilesList;
static void LoadHookScript(const char* name, int id);
static void InitHookScriptFile(const char* name, int id);
static void LoadHookScripts();
static void InitHookScripts();
static void HookScriptClear();
+1 -1
View File
@@ -164,7 +164,7 @@ void __stdcall EndHook() {
}
// BEGIN HOOKS
void HookCommon::KeyPressHook(DWORD* dxKey, bool pressed, DWORD vKey) {
void __stdcall HookCommon::KeyPressHook(DWORD* dxKey, bool pressed, DWORD vKey) {
if (!IsGameLoaded() || !HookScripts::HookHasScript(HOOK_KEYPRESS)) {
return;
}
+1 -1
View File
@@ -18,7 +18,7 @@ public:
static void __stdcall SetHSReturn(DWORD d);
static void GameModeChangeHook(DWORD exit);
static void KeyPressHook(DWORD* dxKey, bool pressed, DWORD vKey);
static void __stdcall KeyPressHook(DWORD* dxKey, bool pressed, DWORD vKey);
static void __stdcall MouseClickHook(DWORD button, bool pressed);
static void Reset();
+7 -4
View File
@@ -99,6 +99,7 @@ void SourceUseSkillOnInit() { sourceSkillOn = fo::var::obj_dude; }
static char resultSkillOn; // -1 - cancel handler, 1 - replace user
static long bakupCombatState;
static void __fastcall UseSkillOnHook_Script(DWORD source, DWORD target, register DWORD skillId) {
BeginHook();
argCount = 3;
@@ -612,7 +613,7 @@ blinkIcon:
jmp fo::funcoffs::wmInterfaceRefresh_;
break:
mov eax, hkEncounterMapID;
cmp ds:[FO_VAR_Move_on_Car], 0;
cmp dword ptr ds:[FO_VAR_Move_on_Car], 0;
je noCar;
mov edx, FO_VAR_carCurrentArea;
call fo::funcoffs::wmMatchAreaContainingMapIdx_;
@@ -623,7 +624,7 @@ noCar:
mov hkEncounterMapID, -1;
cancelEnc:
inc eax; // 0 - continue movement, 1 - interrupt
mov ds:[FO_VAR_wmEncounterIconShow], 0;
mov dword ptr ds:[FO_VAR_wmEncounterIconShow], 0;
add esp, 4;
mov ebx, 0x4C0BC7;
jmp ebx;
@@ -739,8 +740,10 @@ void Inject_UseSkillOnHook() {
MakeCalls(skill_use_hack, {0x4AB05D, 0x4AB558, 0x4ABA60}); // fix checking obj_dude's target
// replace _obj_dude with source skill user (skill_use_ function)
SafeWriteBatch<DWORD>((DWORD)&sourceSkillOn, {0x4AAF47, 0x4AB051, 0x4AB3FB, 0x4AB550, 0x4AB8FA, 0x4ABA54});
SafeWriteBatch<DWORD>((DWORD)&sourceSkillOn, {0x4AB0EF, 0x4AB5C0, 0x4ABAF2}); // fix for time
SafeWriteBatch<DWORD>((DWORD)&sourceSkillOn, {
0x4AAF47, 0x4AB051, 0x4AB3FB, 0x4AB550, 0x4AB8FA, 0x4ABA54,
0x4AB0EF, 0x4AB5C0, 0x4ABAF2 // fix for time increment
});
}
void Inject_EncounterHook() {
+4 -4
View File
@@ -40,7 +40,7 @@ static void __declspec(naked) GNW95_process_message_hack() {
__asm {
push idle;
call Sleep;
cmp ds:[FO_VAR_GNW95_isActive], 0;
cmp dword ptr ds:[FO_VAR_GNW95_isActive], 0;
retn;
}
}
@@ -727,12 +727,12 @@ static void KeepSelectModePatch() {
}
static void PartyMemberSkillPatch() {
// Fixed getting distance from source to target when using skills
// Note: this will cause the party member to apply his/her skill when you use First Aid/Doctor skill on the player, but only if
// Fix getting distance from source to target when using skills
// Note: this will cause the party member to perform First Aid/Doctor skills when you use them on the player, but only if
// the player is standing next to the party member. Because the related engine function is not fully implemented, enabling
// this option without a global script that overrides First Aid/Doctor functions has very limited usefulness
if (IniReader::GetConfigInt("Misc", "PartyMemberSkillFix", 0)) {
dlog("Applying party member using First Aid/Doctor skill patch.", DL_INIT);
dlog("Applying First Aid/Doctor skill use patch for party members.", DL_INIT);
HookCall(0x412836, action_use_skill_on_hook);
dlogr(" Done", DL_INIT);
}
@@ -73,7 +73,7 @@ static void __declspec(naked) wmRndEncounterOccurred_hack() {
__asm {
test ForceEncounterFlags, 0x1; // _NoCar flag
jnz noCar;
cmp ds:[FO_VAR_Move_on_Car], 0;
cmp dword ptr ds:[FO_VAR_Move_on_Car], 0;
jz noCar;
mov edx, FO_VAR_carCurrentArea;
mov eax, ForceEncounterMapID;