mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added new game mode DIALOGVIEW. (#182)
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
#define INTFACELOOT (0x10000)
|
#define INTFACELOOT (0x10000)
|
||||||
#define BARTER (0x20000)
|
#define BARTER (0x20000)
|
||||||
#define HEROWIN (0x40000)
|
#define HEROWIN (0x40000)
|
||||||
|
#define DIALOGVIEW (0x80000)
|
||||||
|
|
||||||
//Valid arguments to register_hook
|
//Valid arguments to register_hook
|
||||||
#define HOOK_TOHIT (0)
|
#define HOOK_TOHIT (0)
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ void _stdcall MouseClickHook(DWORD button, bool pressed) {
|
|||||||
EndHook();
|
EndHook();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _stdcall GameModeChangeHook(DWORD exit) {
|
void HookScripts::GameModeChangeHook(DWORD exit) {
|
||||||
BeginHook();
|
BeginHook();
|
||||||
argCount = 1;
|
argCount = 1;
|
||||||
args[0] = exit;
|
args[0] = exit;
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ public:
|
|||||||
|
|
||||||
static void InjectingHook(int hookId);
|
static void InjectingHook(int hookId);
|
||||||
static bool injectAllHooks;
|
static bool injectAllHooks;
|
||||||
|
|
||||||
|
static void GameModeChangeHook(DWORD exit);
|
||||||
};
|
};
|
||||||
|
|
||||||
DWORD _stdcall GetHSArgCount();
|
DWORD _stdcall GetHSArgCount();
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "AI.h"
|
#include "AI.h"
|
||||||
#include "FileSystem.h"
|
#include "FileSystem.h"
|
||||||
#include "HeroAppearance.h"
|
#include "HeroAppearance.h"
|
||||||
|
#include "HookScripts.h"
|
||||||
#include "PartyControl.h"
|
#include "PartyControl.h"
|
||||||
#include "Perks.h"
|
#include "Perks.h"
|
||||||
#include "ScriptExtender.h"
|
#include "ScriptExtender.h"
|
||||||
@@ -99,7 +100,7 @@ void _stdcall SetInLoop(DWORD mode, LoopFlag flag) {
|
|||||||
} else {
|
} else {
|
||||||
ClearLoopFlag(flag);
|
ClearLoopFlag(flag);
|
||||||
}
|
}
|
||||||
GameModeChange(0);
|
HookScripts::GameModeChangeHook(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetSavePath(char* buf, char* ftype) {
|
void GetSavePath(char* buf, char* ftype) {
|
||||||
@@ -502,6 +503,31 @@ static void __declspec(naked) AutomapHook() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __declspec(naked) DialogReviewInitHook() {
|
||||||
|
__asm {
|
||||||
|
call fo::funcoffs::gdReviewInit_;
|
||||||
|
test eax, eax;
|
||||||
|
jnz error;
|
||||||
|
push ecx;
|
||||||
|
_InLoop2(1, DIALOGVIEW);
|
||||||
|
pop ecx;
|
||||||
|
xor eax, eax;
|
||||||
|
error:
|
||||||
|
retn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __declspec(naked) DialogReviewExitHook() {
|
||||||
|
__asm {
|
||||||
|
push ecx;
|
||||||
|
push eax;
|
||||||
|
_InLoop2(0, DIALOGVIEW);
|
||||||
|
pop eax;
|
||||||
|
pop ecx;
|
||||||
|
jmp fo::funcoffs::gdReviewExit_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LoadGameHook::init() {
|
void LoadGameHook::init() {
|
||||||
saveInCombatFix = GetConfigInt("Misc", "SaveInCombatFix", 1);
|
saveInCombatFix = GetConfigInt("Misc", "SaveInCombatFix", 1);
|
||||||
if (saveInCombatFix > 2) saveInCombatFix = 0;
|
if (saveInCombatFix > 2) saveInCombatFix = 0;
|
||||||
@@ -551,6 +577,8 @@ void LoadGameHook::init() {
|
|||||||
0x4A4565});
|
0x4A4565});
|
||||||
HookCalls(BarterInventoryHook, {0x4466C7});
|
HookCalls(BarterInventoryHook, {0x4466C7});
|
||||||
HookCalls(AutomapHook, {0x44396D, 0x479519});
|
HookCalls(AutomapHook, {0x44396D, 0x479519});
|
||||||
|
HookCall(0x445CA7, DialogReviewInitHook);
|
||||||
|
HookCall(0x445D30, DialogReviewExitHook);
|
||||||
}
|
}
|
||||||
|
|
||||||
Delegate<>& LoadGameHook::OnGameInit() {
|
Delegate<>& LoadGameHook::OnGameInit() {
|
||||||
|
|||||||
@@ -76,7 +76,9 @@ enum LoopFlag : unsigned long {
|
|||||||
INTFACEUSE = 1 << 15, // 0x8000
|
INTFACEUSE = 1 << 15, // 0x8000
|
||||||
INTFACELOOT = 1 << 16, // 0x10000
|
INTFACELOOT = 1 << 16, // 0x10000
|
||||||
BARTER = 1 << 17, // 0x20000
|
BARTER = 1 << 17, // 0x20000
|
||||||
HEROWIN = 1 << 18, // 0x40000
|
HEROWIN = 1 << 18, // 0x40000 Hero Appearance mod
|
||||||
|
DIALOGVIEW = 1 << 19, // 0x80000
|
||||||
|
|
||||||
// RESERVED = 1 << 31
|
// RESERVED = 1 << 31
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user