Something went wrong. Try again.
Base for making Paper Mario (N64) mods, built on the decompilation docs.starhaven.dev/papermario-dx
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283#pragma once
#include "common.h"
// finds the live script currently recorded by this bindingstatic ALWAYS_INLINE Evt* get_bound_script(BoundScript* boundScript) { if (boundScript->live == nullptr) { return nullptr; }
return get_script_by_id(boundScript->liveID);}
// records a newly started script in this bindingstatic ALWAYS_INLINE void assign_bound_script(BoundScript* boundScript, Evt* script) { boundScript->live = script; boundScript->liveID = script->id;}
// forgets the current instance without changing the script sourcestatic ALWAYS_INLINE void clear_bound_script(BoundScript* boundScript) { boundScript->live = nullptr; boundScript->liveID = 0;}
// checks whether the bound script is still running and clears a stale bindingstatic ALWAYS_INLINE b32 is_bound_script_running(BoundScript* boundScript) { if (boundScript->live != nullptr && does_script_exist(boundScript->liveID)) { return true; }
boundScript->live = nullptr; boundScript->liveID = 0; return false;}
// applies flags to the bound script if it still existsstatic ALWAYS_INLINE void set_bound_script_flags(BoundScript* boundScript, s32 flags) { Evt* script = get_bound_script(boundScript);
if (script != nullptr) { set_script_flags(script, flags); }}
// removes flags from the bound script if it still existsstatic ALWAYS_INLINE void clear_bound_script_flags(BoundScript* boundScript, s32 flags) { Evt* script = get_bound_script(boundScript);
if (script != nullptr) { clear_script_flags(script, flags); }}
// suspends the bound script and its children if one is recordedstatic ALWAYS_INLINE void suspend_bound_script(BoundScript* boundScript) { if (boundScript->live != nullptr) { suspend_all_script(boundScript->liveID); }}
// resumes the bound script and its children if one is recordedstatic ALWAYS_INLINE void resume_bound_script(BoundScript* boundScript) { if (boundScript->live != nullptr) { resume_all_script(boundScript->liveID); }}
// kills the bound script without clearing a replacement started by Finallystatic ALWAYS_INLINE void kill_bound_script(BoundScript* boundScript) { if (boundScript->live != nullptr) { s32 liveID = boundScript->liveID;
kill_script_by_ID(liveID);
// Finally may have bound a replacement with a new ID if (boundScript->liveID == liveID) { boundScript->live = nullptr; boundScript->liveID = 0; } }}