mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Removed "proto_exists" function in previous commit
Added macro for checking pid.
This commit is contained in:
@@ -290,6 +290,8 @@
|
|||||||
// clears the keyboard input buffer, use it in the HOOK_KEYPRESS hook to clear keyboard events before calling functions that are waiting for keyboard input
|
// clears the keyboard input buffer, use it in the HOOK_KEYPRESS hook to clear keyboard events before calling functions that are waiting for keyboard input
|
||||||
#define clear_keyboard_buffer metarule3(201, 0, 0, 0)
|
#define clear_keyboard_buffer metarule3(201, 0, 0, 0)
|
||||||
|
|
||||||
|
// checks if the specified PID number exists in the list of registered protos
|
||||||
|
#define check_pid(pid) (get_proto_data(pid, 0) != -1)
|
||||||
|
|
||||||
/* sfall_funcX macros */
|
/* sfall_funcX macros */
|
||||||
#define add_extra_msg_file(name) sfall_func1("add_extra_msg_file", name)
|
#define add_extra_msg_file(name) sfall_func1("add_extra_msg_file", name)
|
||||||
@@ -365,7 +367,6 @@
|
|||||||
#define overlay_clear(winType) sfall_func2("interface_overlay", winType, 2)
|
#define overlay_clear(winType) sfall_func2("interface_overlay", winType, 2)
|
||||||
#define overlay_clear_rectangle(winType, x, y, w, h) sfall_func6("interface_overlay", winType, 2, x, y, w, h)
|
#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 overlay_destroy(winType) sfall_func2("interface_overlay", winType, 0)
|
||||||
#define proto_exists(pid) sfall_func1("proto_exists", pid)
|
|
||||||
#define real_dude_obj sfall_func0("real_dude_obj")
|
#define real_dude_obj sfall_func0("real_dude_obj")
|
||||||
#define remove_all_timer_events sfall_func0("remove_timer_event")
|
#define remove_all_timer_events sfall_func0("remove_timer_event")
|
||||||
#define remove_timer_event(fixedParam) sfall_func1("remove_timer_event", fixedParam)
|
#define remove_timer_event(fixedParam) sfall_func1("remove_timer_event", fixedParam)
|
||||||
|
|||||||
@@ -796,9 +796,6 @@ optional arguments:
|
|||||||
- gvarNumber: the number of the global variable controlling the quest
|
- gvarNumber: the number of the global variable controlling the quest
|
||||||
- thresholdValue: the value of the global variable at which the quest is counted as a failure
|
- thresholdValue: the value of the global variable at which the quest is counted as a failure
|
||||||
|
|
||||||
> bool sfall_func1("proto_exists", int pid)
|
|
||||||
- returns True if the specified PID number exists in the list of registered protos
|
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
------ MORE INFO -------
|
------ MORE INFO -------
|
||||||
------------------------
|
------------------------
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ bool CheckProtoID(DWORD pid) {
|
|||||||
if (pid == 0) return false;
|
if (pid == 0) return false;
|
||||||
long type = pid >> 24;
|
long type = pid >> 24;
|
||||||
if (type > fo::ObjType::OBJ_TYPE_MISC) return false;
|
if (type > fo::ObjType::OBJ_TYPE_MISC) return false;
|
||||||
|
|
||||||
return (static_cast<long>(pid & 0xFFFF) < fo::var::protoLists[type].totalCount);
|
return (static_cast<long>(pid & 0xFFFF) < fo::var::protoLists[type].totalCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ static const SfallMetarule metarules[] = {
|
|||||||
{"obj_under_cursor", mf_obj_under_cursor, 2, 2, 0, {ARG_INT, ARG_INT}},
|
{"obj_under_cursor", mf_obj_under_cursor, 2, 2, 0, {ARG_INT, ARG_INT}},
|
||||||
{"objects_in_radius", mf_objects_in_radius, 3, 4, 0, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
|
{"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},
|
{"outlined_object", mf_outlined_object, 0, 0},
|
||||||
{"proto_exists", mf_proto_exists, 1, 1, 0, {ARG_INT}},
|
|
||||||
{"real_dude_obj", mf_real_dude_obj, 0, 0},
|
{"real_dude_obj", mf_real_dude_obj, 0, 0},
|
||||||
{"remove_timer_event", mf_remove_timer_event, 0, 1, -1, {ARG_INT}},
|
{"remove_timer_event", mf_remove_timer_event, 0, 1, -1, {ARG_INT}},
|
||||||
{"set_can_rest_on_map", mf_set_rest_on_map, 3, 3, -1, {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}},
|
||||||
|
|||||||
@@ -446,17 +446,13 @@ void mf_get_loot_object(OpcodeContext& ctx) {
|
|||||||
ctx.setReturn((GetLoopFlags() & INTFACELOOT) ? fo::var::target_stack[fo::var::target_curr_stack] : 0);
|
ctx.setReturn((GetLoopFlags() & INTFACELOOT) ? fo::var::target_stack[fo::var::target_curr_stack] : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mf_proto_exists(OpcodeContext& ctx) {
|
|
||||||
ctx.setReturn(fo::CheckProtoID(ctx.arg(0).rawValue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool protoMaxLimitPatch = false;
|
static bool protoMaxLimitPatch = false;
|
||||||
|
|
||||||
void op_get_proto_data(OpcodeContext& ctx) {
|
void op_get_proto_data(OpcodeContext& ctx) {
|
||||||
|
long result = -1;
|
||||||
fo::Proto* protoPtr;
|
fo::Proto* protoPtr;
|
||||||
int pid = ctx.arg(0).rawValue();
|
int pid = ctx.arg(0).rawValue();
|
||||||
int result = fo::func::proto_ptr(pid, &protoPtr);
|
if (fo::CheckProtoID(pid) && fo::func::proto_ptr(pid, &protoPtr) != result) {
|
||||||
if (result != -1) {
|
|
||||||
result = *(long*)((BYTE*)protoPtr + ctx.arg(1).rawValue());
|
result = *(long*)((BYTE*)protoPtr + ctx.arg(1).rawValue());
|
||||||
} else {
|
} else {
|
||||||
ctx.printOpcodeError(protoFailedLoad, ctx.getOpcodeName(), pid);
|
ctx.printOpcodeError(protoFailedLoad, ctx.getOpcodeName(), pid);
|
||||||
@@ -466,7 +462,7 @@ void op_get_proto_data(OpcodeContext& ctx) {
|
|||||||
|
|
||||||
void op_set_proto_data(OpcodeContext& ctx) {
|
void op_set_proto_data(OpcodeContext& ctx) {
|
||||||
int pid = ctx.arg(0).rawValue();
|
int pid = ctx.arg(0).rawValue();
|
||||||
if (CritterStats::SetProtoData(pid, ctx.arg(1).rawValue(), ctx.arg(2).rawValue()) != -1) {
|
if (fo::CheckProtoID(pid) && CritterStats::SetProtoData(pid, ctx.arg(1).rawValue(), ctx.arg(2).rawValue()) != -1) {
|
||||||
if (!protoMaxLimitPatch) {
|
if (!protoMaxLimitPatch) {
|
||||||
Objects::LoadProtoAutoMaxLimit();
|
Objects::LoadProtoAutoMaxLimit();
|
||||||
protoMaxLimitPatch = true;
|
protoMaxLimitPatch = true;
|
||||||
|
|||||||
@@ -89,8 +89,6 @@ void mf_obj_under_cursor(OpcodeContext&);
|
|||||||
|
|
||||||
void mf_get_loot_object(OpcodeContext&);
|
void mf_get_loot_object(OpcodeContext&);
|
||||||
|
|
||||||
void mf_proto_exists(OpcodeContext&);
|
|
||||||
|
|
||||||
void op_get_proto_data(OpcodeContext&);
|
void op_get_proto_data(OpcodeContext&);
|
||||||
|
|
||||||
void op_set_proto_data(OpcodeContext&);
|
void op_set_proto_data(OpcodeContext&);
|
||||||
|
|||||||
Reference in New Issue
Block a user