Added reg_anim_animate_and_move script function

This commit is contained in:
NovaRain
2023-12-27 13:21:40 +08:00
parent 95dc75da38
commit c476e54db0
7 changed files with 152 additions and 106 deletions
+1
View File
@@ -362,6 +362,7 @@
#define overlay_clear_rectangle(winType, x, y, w, h) sfall_func6("interface_overlay", winType, 2, x, y, w, h)
#define overlay_destroy(winType) sfall_func2("interface_overlay", winType, 0)
#define real_dude_obj sfall_func0("real_dude_obj")
#define reg_anim_animate_and_move(obj, tile, animID, delay) sfall_func4("reg_anim_animate_and_move", obj, tile, animID, delay)
#define remove_all_timer_events sfall_func0("remove_timer_event")
#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)
+8 -1
View File
@@ -254,7 +254,8 @@ FUNCTION REFERENCE
-----
##### `void reg_anim_animate_and_hide(object obj, int animID, int delay)`
- Exactly like `reg_anim_animate` but the object will automatically disappear after the last animation frame (but not destroyed).
- Works exactly like `reg_anim_animate` but the object will automatically disappear after the last animation frame (but not destroyed).
- `delay`: delay from the previous animation. A value of -1 will execute the specified animation immediately after the previous one in the sequence ends.
-----
##### `void reg_anim_light(object obj, int light, int delay)`
@@ -1110,6 +1111,12 @@ sfall_funcX metarule functions
**Optional argument:**
- `pos`: the position at which to start the search. If negative, it indicates a position starting from the end of the string
----
#### reg_anim_animate_and_move
`void sfall_func4("reg_anim_animate_and_move", object obj, int tile, int animID, int delay)`
- Plays the specified animation while simultaneously moving the object to the given tile
- `delay`: delay from the previous animation. A value of -1 will execute the specified animation immediately after the previous one in the sequence ends
****
_See other documentation files (arrays.md, hookscripts.md) for related functions reference._
+31 -8
View File
@@ -631,15 +631,38 @@ FUNC(refresh_mapper_, 0x4B1554)
FUNC(register_begin_, 0x413AF4)
FUNC(register_clear_, 0x413C4C)
FUNC(register_end_, 0x413CCC)
FUNC(register_object_animate_, 0x4149D0) // int aObj<eax>, int aAnim<edx>, int delay<ebx>
FUNC(register_object_animate_and_hide_, 0x414B7C) // int aObj<eax>, int aAnim<edx>, int delay<ebx>
FUNC(register_object_animate_, 0x4149D0)
FUNC(register_object_animate_and_hide_, 0x414B7C)
FUNC(register_object_animate_and_move_straight_, 0x4146C4)
FUNC(register_object_animate_forever_, 0x4154C4)
FUNC(register_object_animate_reverse_, 0x414AA8)
FUNC(register_object_call3_, 0x414F20)
FUNC(register_object_call_, 0x414E98)
FUNC(register_object_change_fid_, 0x41518C) // int aObj<eax>, int aFid<edx>, int aDelay<ebx>
FUNC(register_object_funset_, 0x4150A8) // int aObj<eax>, int ???<edx>, int aDelay<ebx> - not really sure what this does
FUNC(register_object_light_, 0x415334) // <eax>(int aObj<eax>, int aRadius<edx>, int aDelay<ebx>)
FUNC(register_object_must_erase_, 0x414E20) // int aObj<eax>
FUNC(register_object_take_out_, 0x415238) // int aObj<eax>, int aHoldFrame<edx> - hold frame ID (1 - spear, 2 - club, etc.)
FUNC(register_object_turn_towards_, 0x414C50) // int aObj<eax>, int aTile<edx>
FUNC(register_object_change_fid_, 0x41518C)
FUNC(register_object_check_falling_, 0x4148F0)
FUNC(register_object_dec_rotation_, 0x414D38)
FUNC(register_object_erase_, 0x414DA8)
FUNC(register_object_flatten_, 0x41511C)
FUNC(register_object_fset_, 0x415034)
FUNC(register_object_funset_, 0x4150A8)
FUNC(register_object_inc_rotation_, 0x414CC8)
FUNC(register_object_light_, 0x415334)
FUNC(register_object_move_on_stairs_, 0x4147B8)
FUNC(register_object_move_straight_to_tile_, 0x4145D0)
FUNC(register_object_move_to_object_, 0x413F5C)
FUNC(register_object_move_to_tile_, 0x414294)
FUNC(register_object_must_call_, 0x414FAC)
FUNC(register_object_must_erase_, 0x414E20)
FUNC(register_object_outline_, 0x4153A8)
FUNC(register_object_play_sfx_, 0x41541C)
FUNC(register_object_run_to_object_, 0x41405C)
FUNC(register_object_run_to_tile_, 0x414394)
FUNC(register_object_take_out_, 0x415238)
FUNC(register_object_turn_towards_, 0x414C50)
FUNC(register_pause_, 0x4C8F34)
FUNC(register_ping_, 0x415598)
FUNC(register_priority_, 0x413C20)
FUNC(register_screendump_, 0x4C9358)
FUNC(remove_bk_process_, 0x4C8DC4)
FUNC(report_explosion_, 0x413144)
FUNC(reset_box_bar_win_, 0x4614A0)
+1
View File
@@ -54,6 +54,7 @@ WRAP_WATCOM_FUNC3(long, obj_new_sid_inst, fo::GameObject*, object, long, sType,
WRAP_WATCOM_FUNC3(fo::GameObject*, object_under_mouse, long, crSwitch, long, inclDude, long, elevation)
WRAP_WATCOM_FUNC4(void, qsort, void*, base, long, number, long, elSize, DWORD, comp)
WRAP_WATCOM_FUNC4(long, queue_add, long, time, fo::GameObject*, object, void*, data, long, qType)
WRAP_WATCOM_FUNC5(long, register_object_animate_and_move_straight, fo::GameObject*, object, long, tile, long, elevation, long, anim, long, delay)
WRAP_WATCOM_FUNC4(void, register_object_call, long*, target, long*, source, void*, func, long, delay)
WRAP_WATCOM_FUNC3(long, scr_get_local_var, long, sid, long, varId, long*, value)
WRAP_WATCOM_FUNC3(long, scr_set_local_var, long, sid, long, varId, long, value)
@@ -131,6 +131,17 @@ void op_reg_anim_callback(OpcodeContext& ctx) {
);
}
void mf_reg_anim_animate_and_move(OpcodeContext& ctx) {
if (!checkCombatMode()) {
fo::GameObject* obj = ctx.arg(0).object();
int tile = ctx.arg(1).rawValue(),
animId = ctx.arg(2).rawValue(),
delay = ctx.arg(3).rawValue();
fo::func::register_object_animate_and_move_straight(obj, tile, obj->elevation, animId, delay);
}
}
void op_explosions_metarule(OpcodeContext& ctx) {
int mode = ctx.arg(0).rawValue(),
result = ExplosionsMetaruleFunc(mode, ctx.arg(1).rawValue(), ctx.arg(2).rawValue());
+2
View File
@@ -40,6 +40,8 @@ void op_reg_anim_take_out(OpcodeContext&);
void op_reg_anim_turn_towards(OpcodeContext&);
void op_reg_anim_callback(OpcodeContext&);
void mf_reg_anim_animate_and_move(OpcodeContext&);
void op_explosions_metarule(OpcodeContext&);
void op_art_exists(OpcodeContext&);
@@ -129,6 +129,7 @@ static const SfallMetarule metarules[] = {
{"objects_in_radius", mf_objects_in_radius, 3, 4, 0, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
{"outlined_object", mf_outlined_object, 0, 0},
{"real_dude_obj", mf_real_dude_obj, 0, 0},
{"reg_anim_animate_and_move", mf_reg_anim_animate_and_move, 4, 4, -1, {ARG_OBJECT, ARG_INT, ARG_INT, ARG_INT}},
{"remove_timer_event", mf_remove_timer_event, 0, 1, -1, {ARG_INT}},
{"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}},