mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Merge pull request #107 from FakelsHub/crafty_features/combat_proc
Added calls to unimplemented script procedures: combat_is_starting_p_proc/combat_is_over_p_proc (from Crafty)
This commit is contained in:
@@ -274,3 +274,9 @@
|
||||
#define ROLL_FAILURE (1)
|
||||
#define ROLL_SUCCESS (2)
|
||||
#define ROLL_CRITICAL_SUCCESS (3)
|
||||
|
||||
//XXXXXXXXXXXXXXXXXXXXXX
|
||||
//XX Handlers defines XX
|
||||
//XXXXXXXXXXXXXXXXXXXXXX
|
||||
#define combat_is_starting_p_proc (26)
|
||||
#define combat_is_over_p_proc (27)
|
||||
@@ -1170,6 +1170,26 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) combat_begin_hook() {
|
||||
__asm {
|
||||
push eax
|
||||
call scr_set_ext_param_
|
||||
pop eax // pobj.sid
|
||||
mov edx, combat_is_starting_p_proc
|
||||
jmp exec_script_proc_
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) combat_over_hook() {
|
||||
__asm {
|
||||
push eax
|
||||
call scr_set_ext_param_
|
||||
pop eax // pobj.sid
|
||||
mov edx, combat_is_over_p_proc
|
||||
jmp exec_script_proc_
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptExtenderSetup() {
|
||||
bool AllowUnsafeScripting = IsDebug
|
||||
&& GetPrivateProfileIntA("Debugging", "AllowUnsafeScripting", 0, ".\\ddraw.ini") != 0;
|
||||
@@ -1236,6 +1256,10 @@ void ScriptExtenderSetup() {
|
||||
|
||||
HookCall(0x46E141, FreeProgramHook);
|
||||
|
||||
// combat_is_starting_p_proc / combat_is_over_p_proc
|
||||
HookCall(0x421B72, &combat_begin_hook);
|
||||
HookCall(0x421FC1, &combat_over_hook);
|
||||
|
||||
if(AllowUnsafeScripting) {
|
||||
opcodes[0x156]=ReadByte;
|
||||
opcodes[0x157]=ReadShort;
|
||||
@@ -1717,7 +1741,7 @@ static void RunScript(sGlobalScript* script) {
|
||||
*/
|
||||
static void ResetStateAfterFrame() {
|
||||
if (tempArrays.size()) {
|
||||
for (std::set<DWORD>::iterator it = tempArrays.begin(); it != tempArrays.end(); ++it)
|
||||
for (std::set<DWORD>::iterator it = tempArrays.begin(); it != tempArrays.end(); ++it)
|
||||
FreeArray(*it);
|
||||
tempArrays.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user