Add set_combat_free_move metarule and 2 arguments to STDPROCEDURE to make it more useful

This commit is contained in:
phobos2077
2023-06-04 11:59:13 +02:00
parent f755e0a1dc
commit bfc9fd4d88
9 changed files with 43 additions and 5 deletions
+7
View File
@@ -1565,6 +1565,13 @@
- `centerMult/targetMult`: multiplier values are capped at divisor values
- __NOTE:__ refer to the description of **ComputeSpray_\*** settings in ddraw.ini for details of the bullet distribution of burst attacks
macro: sfall.h
- name: set_combat_free_move
detail: void set_combat_free_move(int value)
doc: |
Allows to change "bonus move" points, that can only be used for moving, not attacking.
- Can be called from HOOK_COMBATTURN at the start of the turn (will not work on dude_obj)
- Can be called from HOOK_STDPROCEDURE with combat_proc event (will work for both NPC's and dude_obj)
- name: Car
items:
+1
View File
@@ -360,6 +360,7 @@
#define remove_timer_event(fixedParam) sfall_func1("remove_timer_event", fixedParam)
#define set_can_rest_on_map(map, elev, value) sfall_func3("set_can_rest_on_map", map, elev, value)
#define set_car_intface_art(artIndex) sfall_func1("set_car_intface_art", artIndex)
#define set_combat_free_move(value) sfall_func1("set_combat_free_move", value)
#define set_cursor_mode(mode) sfall_func1("set_cursor_mode", mode)
#define set_drugs_data(type, pid, value) sfall_func3("set_drugs_data", type, pid, value)
#define set_dude_obj(critter) sfall_func1("set_dude_obj", critter)
+8 -3
View File
@@ -498,9 +498,12 @@
NOTE: this hook will not be executed for `start`, `critter_p_proc`, `timed_event_p_proc`, and `map_update_p_proc` procedures.
```
int arg0 - the number of the standard script handler (see define.h)
int arg0 - the number of the standard script handler (see *_proc in define.h)
Obj arg1 - the object that owns this handler (self_obj)
Obj arg2 - the object that called this handler (source_obj, can be 0)
int arg3 - always 0 (1 for _END version)
int arg4 - the target object of this call (target_obj)
int arg5 - the parameter of this call (fixed_param), useful for combat_proc
int ret0 - pass -1 to cancel the execution of the handler
```
@@ -512,10 +515,12 @@
NOTE: this hook will not be executed for `start`, `critter_p_proc`, `timed_event_p_proc`, and `map_update_p_proc` procedures.
```
int arg0 - the number of the standard script handler (see define.h)
int arg0 - the number of the standard script handler (see *_proc in define.h)
Obj arg1 - the object that owns this handler (self_obj)
Obj arg2 - the object that called this handler (source_obj, can be 0)
int arg3 - 1 after procedure execution
int arg3 - always 1 (procedure end)
int arg4 - the target object of this call (target_obj)
int arg5 - the parameter of this call (fixed_param), useful for combat_proc
```
- name: CarTravel
+3 -1
View File
@@ -802,10 +802,12 @@ Runs before or after Fallout engine executes a standard procedure (handler) in a
__NOTE:__ This hook will not be executed for `start`, `critter_p_proc`, `timed_event_p_proc`, and `map_update_p_proc` procedures.
```
int arg0 - the number of the standard script handler (see define.h)
int arg0 - the number of the standard script handler (see *_proc in define.h)
Obj arg1 - the object that owns this handler (self_obj)
Obj arg2 - the object that called this handler (source_obj, can be 0)
int arg3 - 1 after procedure execution (for HOOK_STDPROCEDURE_END), 0 otherwise
int arg4 - the target object of this call (target_obj)
int arg5 - the parameter of this call (fixed_param), useful for combat_proc
int ret0 - pass -1 to cancel the execution of the handler (only for HOOK_STDPROCEDURE)
```
@@ -1073,6 +1073,13 @@ sfall_funcX metarule functions
- `centerMult/targetMult`: multiplier values are capped at divisor values
- __NOTE:__ refer to the description of **ComputeSpray_\*** settings in ddraw.ini for details of the bullet distribution of burst attacks
----
##### set_combat_free_move
`void sfall_func1("set_combat_free_move", int value)`
- Allows to change "bonus move" points, that can only be used for moving, not attacking.
- Can be called from HOOK_COMBATTURN at the start of the turn (will not work on dude_obj)
- Can be called from HOOK_STDPROCEDURE with combat_proc event (will work for both NPC's and dude_obj)
****
_See other documentation files (arrays.md, hookscripts.md) for related functions reference._
+3 -1
View File
@@ -254,11 +254,13 @@ skip:
static DWORD __fastcall StdProcedureHook_Script(long numHandler, fo::ScriptInstance* script, DWORD procTable) {
BeginHook();
argCount = 4;
argCount = 6;
args[0] = numHandler;
args[1] = (DWORD)script->selfObject;
args[2] = (DWORD)script->sourceObject;
args[4] = (DWORD)script->targetObject;
args[5] = script->fixedParam;
if (procTable) {
args[3] = 0;
@@ -265,5 +265,16 @@ void mf_set_spray_settings(OpcodeContext& ctx) {
BurstMods::SetComputeSpraySettings(centerMult, centerDiv, targetMult, targetDiv);
}
void mf_set_combat_free_move(OpcodeContext& ctx) {
long value = ctx.arg(0).rawValue();
if (value < 0)
value = 0;
fo::var::combat_free_move = value;
if (fo::var::main_ctd.attacker == fo::var::obj_dude) {
fo::func::intface_update_move_points(fo::var::obj_dude->critter.movePoints, fo::var::combat_free_move);
}
}
}
}
@@ -58,5 +58,7 @@ void mf_combat_data(OpcodeContext&);
void mf_set_spray_settings(OpcodeContext&);
void mf_set_combat_free_move(OpcodeContext&);
}
}
@@ -128,6 +128,7 @@ static const SfallMetarule metarules[] = {
{"set_spray_settings", mf_set_spray_settings, 4, 4, -1, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
{"set_can_rest_on_map", mf_set_rest_on_map, 3, 3, -1, {ARG_INT, ARG_INT, ARG_INT}},
{"set_car_intface_art", mf_set_car_intface_art, 1, 1, -1, {ARG_INT}},
{"set_combat_free_move", mf_set_combat_free_move, 1, 1, -1, {ARG_INT}},
{"set_cursor_mode", mf_set_cursor_mode, 1, 1, -1, {ARG_INT}},
{"set_drugs_data", mf_set_drugs_data, 3, 3, -1, {ARG_INT, ARG_INT, ARG_INT}},
{"set_dude_obj", mf_set_dude_obj, 1, 1, -1, {ARG_INT}},