mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added "obj_under_cursor" script function (#207)
This commit is contained in:
@@ -255,6 +255,7 @@
|
|||||||
#define item_make_explosive(pid, aPid, min, max) sfall_func4("item_make_explosive", pid, aPid, min, max)
|
#define item_make_explosive(pid, aPid, min, max) sfall_func4("item_make_explosive", pid, aPid, min, max)
|
||||||
#define item_weight(obj) sfall_func1("item_weight", obj)
|
#define item_weight(obj) sfall_func1("item_weight", obj)
|
||||||
#define lock_is_jammed(obj) sfall_func1("lock_is_jammed", obj)
|
#define lock_is_jammed(obj) sfall_func1("lock_is_jammed", obj)
|
||||||
|
#define obj_under_cursor(crSwitch, inclDude) sfall_func2("obj_under_cursor", crSwitch, inclDude)
|
||||||
#define outlined_object sfall_func0("outlined_object")
|
#define outlined_object sfall_func0("outlined_object")
|
||||||
#define real_dude_obj sfall_func0("real_dude_obj")
|
#define real_dude_obj sfall_func0("real_dude_obj")
|
||||||
#define set_can_rest_on_map(map, elev, value) sfall_func3("set_can_rest_on_map", map, elev, value)
|
#define set_can_rest_on_map(map, elev, value) sfall_func3("set_can_rest_on_map", map, elev, value)
|
||||||
|
|||||||
@@ -542,6 +542,11 @@ Some utility/math functions are available:
|
|||||||
> object sfall_func0("dialog_obj")
|
> object sfall_func0("dialog_obj")
|
||||||
- returns the object (critter) the player is having a conversation or bartering with
|
- returns the object (critter) the player is having a conversation or bartering with
|
||||||
|
|
||||||
|
> object sfall_func2("obj_under_cursor", int crSwitch, int inclDude)
|
||||||
|
- returns the object under the cursor
|
||||||
|
- crSwitch must be -1 or 1: -1 - checks items/critters/scenery/walls, 1 - only checks critters and ignores their cover (roof tiles, walls, scenery, etc.)
|
||||||
|
- passing 0 to the inclDude argument will ignore dude_obj
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
------ MORE INFO -------
|
------ MORE INFO -------
|
||||||
------------------------
|
------------------------
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ WRAP_WATCOM_FUNC2(long, obj_pid_new, fo::GameObject*, object, long, pid)
|
|||||||
// checks/unjams jammed locks
|
// checks/unjams jammed locks
|
||||||
WRAP_WATCOM_FUNC1(long, obj_lock_is_jammed, GameObject*, object)
|
WRAP_WATCOM_FUNC1(long, obj_lock_is_jammed, GameObject*, object)
|
||||||
WRAP_WATCOM_FUNC1(void, obj_unjam_lock, GameObject*, object)
|
WRAP_WATCOM_FUNC1(void, obj_unjam_lock, GameObject*, object)
|
||||||
|
WRAP_WATCOM_FUNC3(long, object_under_mouse, long, crSwitch, long, inclDude, long, elevation)
|
||||||
WRAP_WATCOM_FUNC6(long, pick_death, GameObject*, attacker, GameObject*, target, GameObject*, weapon, long, amount, long, anim, long, hitFromBack)
|
WRAP_WATCOM_FUNC6(long, pick_death, GameObject*, attacker, GameObject*, target, GameObject*, weapon, long, amount, long, anim, long, hitFromBack)
|
||||||
WRAP_WATCOM_FUNC2(long, queue_find_first, GameObject*, object, long, qType)
|
WRAP_WATCOM_FUNC2(long, queue_find_first, GameObject*, object, long, qType)
|
||||||
WRAP_WATCOM_FUNC3(long, register_object_animate, GameObject*, object, long, anim, long, delay)
|
WRAP_WATCOM_FUNC3(long, register_object_animate, GameObject*, object, long, anim, long, delay)
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ static const SfallMetarule metarules[] = {
|
|||||||
{"item_make_explosive", sf_item_make_explosive, 3, 4, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
|
{"item_make_explosive", sf_item_make_explosive, 3, 4, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
|
||||||
{"item_weight", sf_item_weight, 1, 1, {ARG_OBJECT}},
|
{"item_weight", sf_item_weight, 1, 1, {ARG_OBJECT}},
|
||||||
{"lock_is_jammed", sf_lock_is_jammed, 1, 1, {ARG_OBJECT}},
|
{"lock_is_jammed", sf_lock_is_jammed, 1, 1, {ARG_OBJECT}},
|
||||||
|
{"obj_under_cursor", sf_obj_under_cursor, 2, 2, {ARG_INT, ARG_INT}},
|
||||||
{"outlined_object", sf_outlined_object, 0, 0},
|
{"outlined_object", sf_outlined_object, 0, 0},
|
||||||
{"real_dude_obj", sf_real_dude_obj, 0, 0},
|
{"real_dude_obj", sf_real_dude_obj, 0, 0},
|
||||||
{"set_can_rest_on_map", sf_set_rest_on_map, 3, 3, {ARG_INT, ARG_INT, ARG_INT}},
|
{"set_can_rest_on_map", sf_set_rest_on_map, 3, 3, {ARG_INT, ARG_INT, ARG_INT}},
|
||||||
|
|||||||
@@ -1722,5 +1722,16 @@ void sf_get_ini_section(OpcodeContext& ctx) {
|
|||||||
ctx.setReturn(arrayId);
|
ctx.setReturn(arrayId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sf_obj_under_cursor(OpcodeContext& ctx) {
|
||||||
|
int crSwitch = ctx.arg(0).asInt(),
|
||||||
|
inclDude = ctx.arg(1).asInt();
|
||||||
|
|
||||||
|
if (crSwitch != -1 && crSwitch != 1) {
|
||||||
|
ctx.printOpcodeError("obj_under_cursor() - crSwitch value must be -1 or 1.");
|
||||||
|
} else {
|
||||||
|
ctx.setReturn(fo::func::object_under_mouse(crSwitch, inclDude, fo::var::map_elevation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,5 +165,7 @@ void sf_get_ini_sections(OpcodeContext&);
|
|||||||
|
|
||||||
void sf_get_ini_section(OpcodeContext&);
|
void sf_get_ini_section(OpcodeContext&);
|
||||||
|
|
||||||
|
void sf_obj_under_cursor(OpcodeContext&);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user