Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
evt.h
Go to the documentation of this file.
1#ifndef _EVT_H_
2#define _EVT_H_
3
4#include "ultra64.h"
5
6// Should be at least the width of a pointer i.e. intptr_t
7typedef s32 Bytecode;
8
9enum {
105};
106
107#define MAKE_ENTITY_END 0x80000000
108
109/* Return type of evt_execute_next_command */
110#define EVT_CONTINUE 0 /* Continue to next command */
111#define EVT_ABORT 1 /* Quit execution */
112#define EVT_FINISH 255 /* Return from script */
113
114/* Return type of script API functions */
115typedef s32 ApiStatus;
116#define ApiStatus_BLOCK 0 /* Call again next frame */
117#define ApiStatus_DONE1 1 /* Unconditional. Probably only exists to return a bool from functions */
118#define ApiStatus_DONE2 2 /* Conditional on Evt->disableScripts */
119#define ApiStatus_REPEAT 3 /* Call again immediately */
120#define ApiStatus_FINISH 255 /* Corresponds to EVT_FINISH */
121
127
128// EventGroupFlags determine when scripts are paused and resumed.
129// Each flag corresponds to a set of circumstances which may pause scripts independently of the others.
130// These group flags are inherited when one script launches another.
132 // Each flag represents a distinct condition for suspending or resuming script execution.
133 // These flags are named based on the scenarios that trigger suspension.
134 EVT_GROUP_FLAG_INTERACT = 0x01, // Suspended during certain scenes, interactions, and NPC dialogue.
135 EVT_GROUP_FLAG_MENUS = 0x02, // Suspended when menus are open, during pause, item pickups, or "got item" scenes.
136 EVT_GROUP_FLAG_CAM = 0x04, // Never suspended; used exclusively with camera shake (ShakeCam) scripts.
137 EVT_GROUP_FLAG_UNUSED = 0x08, // Unused flag; its original purpose is unknown.
138 EVT_GROUP_FLAG_BATTLE = 0x10, // Suspended during battle entry and exit transitions.
139
140 // Combinations of flags used to assign specific behaviors to scripts.
141 // These groups are named after their most common script use-cases.
142 EVT_GROUP_NEVER_PAUSE = 0x00, // Never paused; default for map scripts derived from the main script, which always uses this group.
143 EVT_GROUP_PASSIVE_NPC = EVT_GROUP_FLAG_MENUS | EVT_GROUP_FLAG_UNUSED, // 0xA -- Pauses similar to passive NPC scripts.
144 EVT_GROUP_HOSTILE_NPC = EVT_GROUP_FLAG_INTERACT | EVT_GROUP_FLAG_MENUS | EVT_GROUP_FLAG_UNUSED, // 0xB -- Pauses similar to hostile NPC scripts; used for platforms, machinery, etc.
146 EVT_GROUP_SHAKE_CAM = EVT_GROUP_FLAG_CAM, // Only used by ShakeCam scripts.
147 EVT_GROUP_NOT_BATTLE = 0xFF & ~EVT_GROUP_FLAG_BATTLE, // 0xEF -- Pauses from anything except battles; default for scripts started via start_script, common in many battle scripts.
148};
149
151 EVT_PRIORITY_0 = 0x00, // map main script
155};
156
165
166#endif
EventPriority
Definition evt.h:150
@ EVT_PRIORITY_14
Definition evt.h:154
@ EVT_PRIORITY_A
Definition evt.h:153
@ EVT_PRIORITY_1
Definition evt.h:152
@ EVT_PRIORITY_0
Definition evt.h:151
@ EVT_OP_LOOP
Args: number of repeats (0 = infinite)
Definition evt.h:15
@ EVT_OP_EXEC_GET_TID
Args: EvtScript*, container.
Definition evt.h:79
@ EVT_OP_CASE_DEFAULT
Definition evt.h:38
@ EVT_OP_END_IF
Definition evt.h:29
@ EVT_OP_INTERNAL_FETCH
Definition evt.h:10
@ EVT_OP_MOD
Args: container, expression to divide by.
Definition evt.h:53
@ EVT_OP_FBUF_READ2
Args: container.
Definition evt.h:66
@ EVT_OP_94
Definition evt.h:104
@ EVT_OP_93
Definition evt.h:103
@ EVT_OP_UNBIND
Unbinds any triggers bound to this script.
Definition evt.h:82
@ EVT_OP_ADDF
Args: container, expression to increment by.
Definition evt.h:54
@ EVT_OP_FBUF_READ3
Args: container, container.
Definition evt.h:67
@ EVT_OP_SET_PRIORITY
Args: priority.
Definition evt.h:85
@ EVT_OP_DIVF
Args: container, expression to divide by.
Definition evt.h:57
@ EVT_OP_CASE_FLAG
Args: expression to test for.
Definition evt.h:41
@ EVT_OP_ELSE
Definition evt.h:28
@ EVT_OP_DEBUG_LOG
Definition evt.h:100
@ EVT_OP_MULF
Args: container, expression to multiply by.
Definition evt.h:56
@ EVT_OP_SUSPEND_OTHERS
Args: group.
Definition evt.h:91
@ EVT_OP_SUSPEND_THREAD
Args: ScriptID.
Definition evt.h:93
@ EVT_OP_GOTO
Args: index.
Definition evt.h:14
@ EVT_OP_EXEC
Args: EvtScript*.
Definition evt.h:78
@ EVT_OP_USE_ARRAY
Args: *s32.
Definition evt.h:70
@ EVT_OP_MUL
Args: container, expression to multiply by.
Definition evt.h:51
@ EVT_OP_END_CASE_GROUP
Ends the case block of EVT_OP_CASE_OR_EQ condition(s).
Definition evt.h:42
@ EVT_OP_92
Definition evt.h:102
@ EVT_OP_IF_LE
Args: a, b.
Definition evt.h:24
@ EVT_OP_IF_FLAG
Args: a, b.
Definition evt.h:26
@ EVT_OP_WAIT_SECS
Definition evt.h:19
@ EVT_OP_END
Definition evt.h:11
@ EVT_OP_RETURN
Definition evt.h:12
@ EVT_OP_SET
Args: container, expression.
Definition evt.h:46
@ EVT_OP_IF_NE
Args: a, b.
Definition evt.h:21
@ EVT_OP_CASE_EQ
Args: expression to test for.
Definition evt.h:32
@ EVT_OP_BITWISE_OR_CONST
Args: container, value to bitwise OR with.
Definition evt.h:76
@ EVT_OP_BUF_READ1
Definition evt.h:59
@ EVT_OP_USE_FBUF
Identical to USE_BUFFER. Args: f32*.
Definition evt.h:64
@ EVT_OP_SETF
Args: container, expression.
Definition evt.h:48
@ EVT_OP_CHILD_THREAD
Parallel threads are killed as soon as the parent script returns.
Definition evt.h:98
@ EVT_OP_CASE_GE
Args: expression to test for.
Definition evt.h:37
@ EVT_OP_IF_GT
Args: a, b.
Definition evt.h:23
@ EVT_OP_CASE_OR_EQ
Args: expression to test for.
Definition evt.h:39
@ EVT_OP_END_CHILD_THREAD
Definition evt.h:99
@ EVT_OP_END_SWITCH
Definition evt.h:45
@ EVT_OP_DEBUG_PRINT_VAR
Args: expression.
Definition evt.h:101
@ EVT_OP_BUF_READ3
Args: container, container.
Definition evt.h:61
@ EVT_OP_DIV
Integer division. Args: container, expression to divide by.
Definition evt.h:52
@ EVT_OP_EXEC_WAIT
Spawns a script and waits for it to return before continuing. Args: EvtScript*.
Definition evt.h:80
@ EVT_OP_END_LOOP
Definition evt.h:16
@ EVT_OP_BUF_READ4
Args: container, container, container.
Definition evt.h:62
@ EVT_OP_ADD
Args: container, expression to increment by.
Definition evt.h:49
@ EVT_OP_FBUF_READ4
Args: container, container, container.
Definition evt.h:68
@ EVT_OP_BREAK_SWITCH
Definition evt.h:44
@ EVT_OP_SET_TIMESCALE
Args: timescale.
Definition evt.h:86
@ EVT_OP_USE_BUF
Args: s32*.
Definition evt.h:58
@ EVT_OP_BREAK_LOOP
Definition evt.h:17
@ EVT_OP_USE_FLAGS
Args: *s32.
Definition evt.h:71
@ EVT_OP_CASE_RANGE
Args: from, to.
Definition evt.h:43
@ EVT_OP_BITWISE_AND_CONST
Args: container, value to bitwise AND with.
Definition evt.h:74
@ EVT_OP_FBUF_READ1
Definition evt.h:65
@ EVT_OP_SUBF
Args: container, expression to decrement by.
Definition evt.h:55
@ EVT_OP_WAIT_FRAMES
Definition evt.h:18
@ EVT_OP_JUMP
Args: EvtScript*.
Definition evt.h:84
@ EVT_OP_THREAD
Definition evt.h:96
@ EVT_OP_CASE_AND_EQ
Args: expression to test for.
Definition evt.h:40
@ EVT_OP_SWITCH
Args: expression to test against.
Definition evt.h:30
@ EVT_OP_CASE_LE
Args: expression to test for.
Definition evt.h:36
@ EVT_OP_SUB
Args: container, expression to decrement by.
Definition evt.h:50
@ EVT_OP_IF_GE
Args: a, b.
Definition evt.h:25
@ EVT_OP_CALL
Args: *function, ...
Definition evt.h:77
@ EVT_OP_IF_NOT_FLAG
Args: a, b.
Definition evt.h:27
@ EVT_OP_IS_THREAD_RUNNING
Args: ScriptID, container.
Definition evt.h:95
@ EVT_OP_IF_LT
Args: a, b.
Definition evt.h:22
@ EVT_OP_SWITCH_CONST
Args: value to test against.
Definition evt.h:31
@ EVT_OP_CASE_NE
Args: expression to test for.
Definition evt.h:33
@ EVT_OP_SET_CONST
Args: container, value.
Definition evt.h:47
@ EVT_OP_KILL_THREAD
Args: ScriptID.
Definition evt.h:83
@ EVT_OP_LABEL
Args: index.
Definition evt.h:13
@ EVT_OP_RESUME_OTHERS
Args: group.
Definition evt.h:92
@ EVT_OP_RESUME_THREAD
Args: ScriptID.
Definition evt.h:94
@ EVT_OP_BUF_READ2
Args: container.
Definition evt.h:60
@ EVT_OP_END_THREAD
Definition evt.h:97
@ EVT_OP_RESUME_GROUP
Args: group.
Definition evt.h:90
@ EVT_OP_BIND_TRIGGER
Args: EvtScript*, trigger flags, s32 target, 1, Trigger*.
Definition evt.h:81
@ EVT_OP_BITWISE_AND
Args: container, expression to bitwise AND with.
Definition evt.h:73
@ EVT_OP_CASE_GT
Args: expression to test for.
Definition evt.h:35
@ EVT_OP_BITWISE_OR
Args: container, expression to bitwise OR with.
Definition evt.h:75
@ EVT_OP_SET_GROUP
Args: group.
Definition evt.h:87
@ EVT_OP_BIND_PADLOCK
Args: EvtScript*, trigger flags, s32 target, ItemList*, 0, 1.
Definition evt.h:88
@ EVT_OP_SUSPEND_GROUP
Args: group.
Definition evt.h:89
@ EVT_OP_CASE_LT
Args: expression to test for.
Definition evt.h:34
@ EVT_OP_MALLOC_ARRAY
Allocates a new array. Args: length, s32*.
Definition evt.h:72
@ EVT_OP_BUF_PEEK
Args: container, container, container, container.
Definition evt.h:63
@ EVT_OP_IF_EQ
Args: a, b.
Definition evt.h:20
@ EVT_OP_FBUF_PEEK
Args: container, container, container, container.
Definition evt.h:69
s32 ApiStatus
Definition evt.h:115
s32 Bytecode
Definition evt.h:7
EventGroupFlags
Definition evt.h:131
@ EVT_GROUP_HOSTILE_NPC
Definition evt.h:144
@ EVT_GROUP_FLAG_BATTLE
Definition evt.h:138
@ EVT_GROUP_FLAG_MENUS
Definition evt.h:135
@ EVT_GROUP_NOT_BATTLE
Definition evt.h:147
@ EVT_GROUP_FLAG_INTERACT
Definition evt.h:134
@ EVT_GROUP_PASSIVE_NPC
Definition evt.h:143
@ EVT_GROUP_FLAG_CAM
Definition evt.h:136
@ EVT_GROUP_NEVER_PAUSE
Definition evt.h:142
@ EVT_GROUP_FLAG_UNUSED
Definition evt.h:137
@ EVT_GROUP_SHAKE_CAM
Definition evt.h:146
@ EVT_GROUP_EXIT_MAP
Definition evt.h:145
EventCommandResults
Definition evt.h:122
@ EVT_CMD_RESULT_YIELD
Definition evt.h:123
@ EVT_CMD_RESULT_CONTINUE
Definition evt.h:124
@ EVT_CMD_RESULT_ERROR
Definition evt.h:125
EventStateFlags
Definition evt.h:157
@ EVT_FLAG_ACTIVE
Definition evt.h:158
@ EVT_FLAG_PAUSED
paused through suspend_group_script / resume_group_script
Definition evt.h:159
@ EVT_FLAG_RUN_IMMEDIATELY
don't wait for next update_scripts call
Definition evt.h:161
@ EVT_FLAG_THREAD
Definition evt.h:162
@ EVT_FLAG_BLOCKED_BY_CHILD
Definition evt.h:160
@ EVT_FLAG_SUSPENDED
doesn't affect child
Definition evt.h:163