diff --git a/hsm/limbo_state.cpp b/hsm/limbo_state.cpp index 83d2428..e24e5d6 100644 --- a/hsm/limbo_state.cpp +++ b/hsm/limbo_state.cpp @@ -41,7 +41,7 @@ LimboState *LimboState::named(String p_name) { void LimboState::_do_enter() { active = true; - VCALL(_enter); + VCALL_OR_NATIVE(_enter); emit_signal(LimboStringNames::get_singleton()->entered); }; @@ -49,13 +49,13 @@ void LimboState::_do_exit() { if (!active) { return; } - VCALL(_exit); + VCALL_OR_NATIVE(_exit); emit_signal(LimboStringNames::get_singleton()->exited); active = false; }; void LimboState::_do_update(double p_delta) { - VCALL_ARGS(_update, p_delta); + VCALL_OR_NATIVE_ARGS(_update, p_delta); emit_signal(LimboStringNames::get_singleton()->updated, p_delta); }; @@ -71,7 +71,7 @@ void LimboState::_initialize(Node *p_agent, const Ref &p_blackboard) } } - VCALL(_setup); + VCALL_OR_NATIVE(_setup); emit_signal(LimboStringNames::get_singleton()->setup); } diff --git a/util/limbo_compat.h b/util/limbo_compat.h index 69d6965..d165cc9 100644 --- a/util/limbo_compat.h +++ b/util/limbo_compat.h @@ -60,7 +60,12 @@ #define VCALL(m_name, ...) (GDVIRTUAL_CALL(m_name, __VA_ARGS__)) #define VCALL_ARGS(method, ...) (call(LW_NAME(method), __VA_ARGS__)) #define VCALL_V(m_name, r_ret) (GDVIRTUAL_CALL(m_name, r_ret)) -#define VCALL_OR_NATIVE(m_name, ...) \ +#define VCALL_OR_NATIVE(m_name) \ + if (!GDVIRTUAL_CALL(m_name)) { \ + m_name(); \ + } + +#define VCALL_OR_NATIVE_ARGS(m_name, ...) \ if (!GDVIRTUAL_CALL(m_name, __VA_ARGS__)) { \ m_name(__VA_ARGS__); \ } @@ -124,6 +129,7 @@ using namespace godot; #define VCALL_ARGS(m_name, ...) (call(LW_NAME(m_name), __VA_ARGS__)) #define VCALL_V(m_name, r_ret) (r_ret = call(LW_NAME(m_name))) #define VCALL_OR_NATIVE(m_name) (call(LW_NAME(m_name))) +#define VCALL_OR_NATIVE_ARGS(m_name, ...) (call(LW_NAME(m_name), __VA_ARGS__)) // * Enum