80 s32 numValidScripts = 0;
85 curScript = (*gCurrentScriptListPtr)[i];
86 if (curScript != NULL) {
88 scriptIndexList[numValidScripts] = i;
89 scriptIdList[numValidScripts] = curScript->
id;
96 for (i = 0; i < (x = numValidScripts - 1); i++) {
100 for (j = i + 1; j < numValidScripts; j++) {
101 temp_a1 = scriptIndexList[i];
102 temp_a0 = scriptIndexList[j];
104 if ((**currentScriptListPtr)[temp_a1]->priority > (**currentScriptListPtr)[temp_a0]->priority) {
105 scriptIndexList[i] = temp_a0;
106 scriptIndexList[j] = temp_a1;
107 tempID = scriptIdList[i];
108 scriptIdList[i] = scriptIdList[j];
109 scriptIdList[j] = tempID;
132 numArgs = *curLine++;
163 (*gCurrentScriptListPtr)[i] = NULL;
232 (*gCurrentScriptListPtr)[curScriptIndex] = newScript =
heap_malloc(
sizeof(*newScript));
234 ASSERT(newScript != NULL);
247 newScript->
owner1.actorID = -1;
248 newScript->
owner2.npcID = -1;
259 for (i = 0; i <
ARRAY_COUNT(newScript->varTable); i++) {
260 newScript->varTable[i] = 0;
299 (*gCurrentScriptListPtr)[curScriptIndex] = newScript =
heap_malloc(
sizeof(*newScript));
301 ASSERT(newScript != NULL);
314 newScript->
owner1.actorID = -1;
315 newScript->
owner2.npcID = -1;
326 for (i = 0; i <
ARRAY_COUNT(newScript->varTable); i++) {
327 newScript->varTable[i] = 0;
365 (*gCurrentScriptListPtr)[curScriptIndex] = child =
heap_malloc(
sizeof(*child));
395 for (i = 0; i <
ARRAY_COUNT(child->varTable); i++) {
396 child->varTable[i] = parentScript->varTable[i];
434 (*gCurrentScriptListPtr)[curScriptIndex] = child =
heap_malloc(
sizeof(*child));
463 for (i = 0; i <
ARRAY_COUNT(child->varTable); i++) {
464 child->varTable[i] = parentScript->varTable[i];
508 curScript = (*gCurrentScriptListPtr)[i];
509 if ((curScript != 0) && (curScript->
parentScript == script)) {
563 if (script != NULL &&
602 temp = *((s32*) temp);
626 if (childScript != NULL) {
631 Evt* tempScriptInstance = (*gCurrentScriptListPtr)[j];
632 if (tempScriptInstance != NULL) {
633 if (tempScriptInstance->
parentScript == instanceToKill) {
640 if (blockingParent != NULL) {
642 blockingParent->
stateFlags &= ~EVT_FLAG_BLOCKED_BY_CHILD;
644 for (j = 0; j <
ARRAY_COUNT(blockingParent->varTable); j++) {
645 blockingParent->varTable[j] = instanceToKill->varTable[j];
653 if (instanceToKill->
userData != NULL) {
659 (*gCurrentScriptListPtr)[i] = NULL;
665 Evt* scriptContextPtr;
668 scriptContextPtr = (*gCurrentScriptListPtr)[i];
669 if (scriptContextPtr != NULL && scriptContextPtr->
id ==
id) {
677 Evt* scriptContextPtr;
680 scriptContextPtr = (*gCurrentScriptListPtr)[i];
681 if (scriptContextPtr != NULL) {
689 Evt* scriptContextPtr;
692 scriptContextPtr = (*gCurrentScriptListPtr)[i];
693 if (scriptContextPtr != NULL && scriptContextPtr->
id ==
id) {
732 s32 priority, s32 arg6) {
746 trigger->varTable[0] = triggerVar0;
747 trigger->varTable[1] = triggerVar1;
753 return bind_trigger(script,
flags, triggerFlagIndex, triggerVar0, triggerVar1, priority, 1);
760 if (childScript != NULL) {
765 Evt* scriptContextPtr = (*gCurrentScriptListPtr)[i];
767 if (scriptContextPtr != NULL && scriptContextPtr->
parentScript == script) {
781 if (childScript != NULL) {
786 Evt* scriptContextPtr = (*gCurrentScriptListPtr)[i];
788 if (scriptContextPtr != NULL && scriptContextPtr->
parentScript == script) {
802 Evt* scriptContextPtr = (*gCurrentScriptListPtr)[i];
804 if (scriptContextPtr != NULL && scriptContextPtr->
id ==
id) {
812 Evt* scriptContextPtr;
815 scriptContextPtr = (*gCurrentScriptListPtr)[i];
816 if (scriptContextPtr != NULL && scriptContextPtr->
id ==
id) {
824 Evt* scriptContextPtr;
827 scriptContextPtr = (*gCurrentScriptListPtr)[i];
828 if (scriptContextPtr != NULL && scriptContextPtr->
id ==
id) {
836 Evt* scriptContextPtr;
839 scriptContextPtr = (*gCurrentScriptListPtr)[i];
840 if (scriptContextPtr != NULL && scriptContextPtr->
id ==
id) {
848 Evt* scriptContextPtr;
851 scriptContextPtr = (*gCurrentScriptListPtr)[i];
852 if (scriptContextPtr != NULL) {
860 Evt* scriptContextPtr;
863 scriptContextPtr = (*gCurrentScriptListPtr)[i];
864 if (scriptContextPtr != NULL) {
872 Evt* scriptContextPtr;
875 scriptContextPtr = (*gCurrentScriptListPtr)[i];
876 if (scriptContextPtr != NULL && scriptContextPtr != script) {
884 Evt* scriptContextPtr;
887 scriptContextPtr = (*gCurrentScriptListPtr)[i];
888 if (scriptContextPtr != NULL && scriptContextPtr != script) {
900 Evt* scriptContextPtr;
904 scriptContextPtr = (*gCurrentScriptListPtr)[i];
905 if (scriptContextPtr->
id ==
id) {
906 return scriptContextPtr;
918 if (childScript != NULL) {
923 Evt* scriptContextPtr = (*gCurrentScriptListPtr)[i];
925 if (scriptContextPtr != NULL && scriptContextPtr->
parentScript == script) {
936 if (childScript != NULL) {
941 Evt* scriptContextPtr = (*gCurrentScriptListPtr)[i];
943 if (scriptContextPtr != NULL && scriptContextPtr->
parentScript == script) {
struct Evt * parentScript
void * labelPositions[16]
struct Evt * blockingParent
AnimatedModel * AnimatedModelList[16]
union Evt::@8 owner1
Initially -1.
VirtualEntity * VirtualEntityList[0x40]
union Evt::@9 owner2
Initially -1.
#define ASSERT(condition)
@ DEBUG_SCRIPTS_NO_UPDATE
@ EVT_GROUP_FLAG_INTERACT
@ EVT_FLAG_PAUSED
paused through suspend_group_script / resume_group_script
@ EVT_FLAG_RUN_IMMEDIATELY
don't wait for next update_scripts call
@ EVT_FLAG_BLOCKED_BY_CHILD
@ EVT_FLAG_SUSPENDED
doesn't affect child
void init_model_animators(void)
void init_virtual_entity_list(void)
s32 evt_trigger_on_activate_exec_script(Trigger *trigger)
void clear_virtual_entity_list(void)
Trigger * create_trigger(TriggerBlueprint *def)
void reset_model_animators(void)
void * heap_malloc(s32 size)
void clear_script_list(void)
s32 does_script_exist_by_ref(Evt *script)
void suspend_group_others(Evt *script, s32 groupFlags)
Evt * start_script_in_group(EvtScript *source, u8 priority, u8 flags, u8 groupFlags)
void kill_all_scripts(void)
void kill_script(Evt *instanceToKill)
void resume_group_script_index(s32 id, s32 groupFlags)
BSS u32 gWorldMapFlags[MAX_MAPFLAGS]
void resume_group_script(Evt *script, s32 groupFlags)
BSS u32 gBattleMapFlags[MAX_MAPFLAGS]
BSS s32 ShowMessageScreenOffsetX
BSS AnimatedModelList gBattleMeshAnimationList
Evt * func_802C3C10(Evt *script, Bytecode *line, s32 arg2)
BSS u32 gBattleMapVars[MAX_MAPVARS]
void set_script_group(Evt *script, s32 groupFlags)
BSS s32 wExtraPartnerNpcID
BSS u32 gWorldMapVars[MAX_MAPVARS]
BSS struct LavaReset * gLavaResetList
BSS ScriptList gBattleScriptList
BSS VirtualEntityList bBattleVirtualEntityList
BSS char evtDebugPrintBuffer[0x100]
Evt * get_script_by_index(s32 index)
s32 resume_all_group(s32 groupFlags)
s32 suspend_all_script(s32 id)
BSS s32 gScriptIdList[MAX_SCRIPTS]
void suspend_group_script(Evt *script, s32 groupFlags)
void find_script_labels(Evt *script)
BSS AnimatedModelList gWorldMeshAnimationList
void update_scripts(void)
void set_script_flags(Evt *script, s32 flags)
BSS ScriptList gWorldScriptList
void suspend_group_script_index(s32 id, s32 groupFlags)
BSS AnimatedModelList * gCurrentMeshAnimationListPtr
BSS s32 DoorModelsSwingCCW[3]
void clear_script_flags(Evt *script, s32 flags)
void set_global_timespace(f32 timeScale)
void resume_group_others(Evt *script, s32 groupFlags)
void kill_script_by_ID(s32 id)
void init_script_list(void)
BSS PopupMenu gItemChoicePopupMenu
s32 evt_execute_next_command(Evt *script)
void suspend_frozen_scripts(Evt *script)
BSS s32 gScriptIndexList[MAX_SCRIPTS]
Evt * start_script(EvtScript *source, s32 priority, s32 flags)
void set_script_timescale(Evt *script, f32 timescale)
BSS VirtualEntityList * gCurrentVirtualEntityListPtr
void set_script_priority(Evt *script, s32 priority)
BSS VirtualEntityList wWorldVirtualEntityList
Evt * start_child_script(Evt *parentScript, EvtScript *source, s32 flags)
s32 resume_all_script(s32 id)
BSS MessagePrintState * D_802DB268
s32 does_script_exist(s32 id)
BSS s32 DoorModelsSwingCW[3]
BSS ScriptList * gCurrentScriptListPtr
BSS MessagePrintState * gCurrentPrintContext
BSS MusicEvent * MusicEventList
BSS Evt * RunningMusicEvents[10]
Trigger * bind_trigger(EvtScript *script, s32 flags, s32 triggerFlagIndex, s32 triggerVar0, s32 triggerVar1, s32 priority, s32 arg6)
BSS PushBlockGrid * wPushBlockGrids[8]
f32 get_global_timespace(void)
Evt * get_script_by_id(s32 id)
void suspend_all_group(s32 groupFlags)
Trigger * bind_trigger_1(EvtScript *script, s32 flags, s32 triggerFlagIndex, s32 triggerVar0, s32 triggerVar1, s32 priority)
Evt * restart_script(Evt *script)
BSS s32 ShowMessageScreenOffsetY
BSS s32 RunningMusicEventIDs[10]
Evt * func_802C39F8(Evt *parentScript, Bytecode *nextLine, s32 newState)
s32(* onActivateFunc)(struct Trigger *)
s32 hasPlayerInteractPrompt
struct Evt * runningScript
GameStatus * gGameStatusPtr