mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added "reg_anim_callback" script function(opcode) (#257)
Updated documents.
This commit is contained in:
@@ -218,6 +218,9 @@ Some additional reg_anim_* functions were introduced. They all work in the same
|
||||
> void reg_anim_turn_towards(object, tile/target, delay)
|
||||
- makes object change its direction to face given tile num or target object.
|
||||
|
||||
> void reg_anim_callback(procedure proc)
|
||||
- registers the given procedure and executes it after previously registered animations are finished.
|
||||
|
||||
> int/array metarule2_explosions(int arg1, int arg2, int arg3)
|
||||
was made as a dirty easy hack to allow dynamically change some explosion parameters (ranged attack). All changed parameters are reset to vanilla state automatically after each attack action. Following macros are available in sfall.h:
|
||||
|
||||
|
||||
@@ -358,6 +358,7 @@
|
||||
0x827c - any sfall_func6(string funcName, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
0x827d - void register_hook_proc_spec(int hook, procedure proc)
|
||||
0x827e - void reg_anim_callback(procedure proc)
|
||||
|
||||
|
||||
* These functions require AllowUnsafeScripting to be enabled in ddraw.ini
|
||||
|
||||
@@ -28,6 +28,7 @@ WRAP_WATCOM_FFUNC7(void, make_straight_path_func, GameObject*, objFrom, DWORD, t
|
||||
WRAP_WATCOM_FFUNC4(long, mouse_click_in, long, x, long, y, long, x_end, long, y_end)
|
||||
WRAP_WATCOM_FFUNC3(GameObject*, obj_blocking_at, GameObject*, object, long, tile, long, elevation)
|
||||
WRAP_WATCOM_FFUNC3(long, object_under_mouse, long, crSwitch, long, inclDude, long, elevation)
|
||||
WRAP_WATCOM_FFUNC4(void, register_object_call, long*, target, long*, source, void*, func, long, delay)
|
||||
WRAP_WATCOM_FFUNC3(long, scr_get_local_var, long, sid, long, varId, long*, value)
|
||||
WRAP_WATCOM_FFUNC3(long, scr_set_local_var, long, sid, long, varId, long, value)
|
||||
WRAP_WATCOM_FFUNC3(long, tile_num_in_direction, long, tile, long, rotation,long, distance)
|
||||
|
||||
@@ -322,7 +322,7 @@ artNotExist:
|
||||
push artDbgMsg;
|
||||
call fo::funcoffs::debug_printf_;
|
||||
add esp, 8;
|
||||
BREAKPOINT; // break program
|
||||
int 3; // break program
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +116,15 @@ void sf_reg_anim_turn_towards(OpcodeContext& ctx) {
|
||||
}
|
||||
}
|
||||
|
||||
void sf_reg_anim_callback(OpcodeContext& ctx) {
|
||||
fo::func::register_object_call(
|
||||
reinterpret_cast<long*>(ctx.program()),
|
||||
reinterpret_cast<long*>(ctx.arg(0).rawValue()), // callback procedure
|
||||
reinterpret_cast<void*>(fo::funcoffs::executeProcedure_),
|
||||
-1
|
||||
);
|
||||
}
|
||||
|
||||
void sf_explosions_metarule(OpcodeContext& ctx) {
|
||||
int mode = ctx.arg(0).asInt(),
|
||||
result = ExplosionsMetaruleFunc(mode, ctx.arg(1).asInt(), ctx.arg(2).asInt());
|
||||
|
||||
@@ -37,6 +37,8 @@ void sf_reg_anim_change_fid(OpcodeContext&);
|
||||
void sf_reg_anim_take_out(OpcodeContext&);
|
||||
void sf_reg_anim_turn_towards(OpcodeContext&);
|
||||
|
||||
void sf_reg_anim_callback(OpcodeContext&);
|
||||
|
||||
void sf_explosions_metarule(OpcodeContext&);
|
||||
|
||||
void sf_art_cache_flush(OpcodeContext&);
|
||||
|
||||
@@ -215,6 +215,7 @@ static SfallOpcodeInfo opcodeInfoArray[] = {
|
||||
{0x27c, "sfall_func6", HandleMetarule, 7, true}, // if you need more arguments - use arrays
|
||||
|
||||
{0x27d, "register_hook_proc_spec", sf_register_hook, 2, false, {ARG_INT, ARG_INT}},
|
||||
{0x27e, "reg_anim_callback", sf_reg_anim_callback, 1, false, {ARG_INT}},
|
||||
};
|
||||
|
||||
// A hash-table for opcode info, indexed by opcode.
|
||||
|
||||
Reference in New Issue
Block a user