mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Changed the check for unavailable hooks
* easier to backport more discontinuous hooks if needed.
This commit is contained in:
@@ -145,9 +145,13 @@ void __declspec(naked) interpretError(const char* fmt, ...) {
|
||||
__asm jmp fo::funcoffs::interpretError_;
|
||||
}
|
||||
|
||||
long __fastcall db_init(const char* path_dat, const char* path_patches) {
|
||||
__asm mov ebx, edx; // don't delete
|
||||
WRAP_WATCOM_FCALL2(db_init_, path_dat, path_patches);
|
||||
long __stdcall db_init(const char* path_dat, const char* path_patches) {
|
||||
__asm {
|
||||
mov ebx, path_patches;
|
||||
mov eax, path_dat;
|
||||
xor edx, edx;
|
||||
call fo::funcoffs::db_init_;
|
||||
}
|
||||
}
|
||||
|
||||
long __stdcall tile_num(long x, long y) {
|
||||
|
||||
@@ -50,7 +50,7 @@ void interpretReturnValue(Program* scriptPtr, DWORD val, DWORD valType);
|
||||
// USE WITH CAUTION
|
||||
void __declspec() interpretError(const char* fmt, ...);
|
||||
|
||||
long __fastcall db_init(const char* path_dat, const char* path_patches);
|
||||
long __stdcall db_init(const char* path_dat, const char* path_patches);
|
||||
|
||||
long __stdcall tile_num(long x, long y);
|
||||
|
||||
|
||||
@@ -89,10 +89,10 @@ static HooksInjectInfo injectHooks[] = {
|
||||
{HOOK_INVENTORYMOVE, Inject_InventoryMoveHook, false},
|
||||
{HOOK_INVENWIELD, Inject_InvenWieldHook, false},
|
||||
{HOOK_ADJUSTFID, nullptr, true}, // always embedded to the engine
|
||||
{-1, nullptr, true}, // dummy
|
||||
{-1, nullptr, true}, // dummy
|
||||
{-1, nullptr, true}, // dummy
|
||||
{-1, nullptr, true}, // dummy
|
||||
{-1, nullptr, false}, // dummy
|
||||
{-1, nullptr, false}, // dummy
|
||||
{-1, nullptr, false}, // dummy
|
||||
{-1, nullptr, false}, // dummy
|
||||
{HOOK_GAMEMODECHANGE, nullptr, true}, // always embedded to the engine
|
||||
};
|
||||
|
||||
@@ -113,7 +113,7 @@ bool HookScripts::HookHasScript(int hookId) {
|
||||
}
|
||||
|
||||
void HookScripts::RegisterHook(fo::Program* script, int id, int procNum, bool specReg) {
|
||||
if (id >= numHooks || (id > HOOK_ADJUSTFID && id < HOOK_GAMEMODECHANGE)) return;
|
||||
if (id >= numHooks || injectHooks[id].id < 0) return;
|
||||
for (std::vector<HookScript>::iterator it = hooks[id].begin(); it != hooks[id].end(); ++it) {
|
||||
if (it->prog.ptr == script) {
|
||||
if (procNum == 0) hooks[id].erase(it); // unregister
|
||||
|
||||
Reference in New Issue
Block a user