Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
NormalItemChoice.inc.c
Go to the documentation of this file.
1#ifndef _COMMON_CONSUMABLE_CHOICE_
2#define _COMMON_CONSUMABLE_CHOICE_
3
4#include "common.h"
5#include "sprite/player.h"
6
8
9#ifndef _CHOICE_SUPPORT_
10#define _CHOICE_SUPPORT_
11
14
17
18API_CALLABLE(N(ItemChoice_WaitForSelection)) {
19 Bytecode* args = script->ptrReadPos;
20
21 if (isInitialCall) {
23 }
24
28 return ApiStatus_DONE2;
29 }
30
31 return ApiStatus_BLOCK;
32}
33
34API_CALLABLE(N(ItemChoice_SaveSelected)) {
35 Bytecode* args = script->ptrReadPos;
36
39 return ApiStatus_DONE2;
40}
41
42#endif
43
44API_CALLABLE(N(BuildItemChoiceList)) {
45 Bytecode* args = script->ptrReadPos;
46 s32* allowedItemList = (s32*)evt_get_variable(script, *args++);
47 s32 i;
48
49 if (allowedItemList != NULL) {
50 for (i = 0; allowedItemList[i] != ITEM_NONE; i++) {
52 }
54 } else {
55 for (i = 0; i < ITEM_NUM_CONSUMABLES; i++) {
57 N(ItemChoice_List)[ITEM_NUM_CONSUMABLES] = ITEM_NONE; // oddity -- should be after the loop!
58 }
59 }
60 return ApiStatus_DONE2;
61}
62
68 CaseEq(0)
69 CaseEq(-1)
76 Wait(30)
82 Unbind
83 Return
84 End
85};
86
91 Return
92 End
93};
94
95#define EVT_CHOOSE_ANY_CONSUMABLE(unkMode) \
96 Set(LVar0, NULL) \
97 Set(LVar1, unkMode) \
98 ExecWait(N(EVS_ChooseItem))
99
100#define EVT_CHOOSE_CONSUMABLE_FROM(itemList, unkMode) \
101 Set(LVar0, Ref(itemList)) \
102 Set(LVar1, unkMode) \
103 ExecWait(N(EVS_ChooseItem))
104
105#endif
BSS s32 PopupMenu_SelectedIndex
Bytecode EvtScript[]
@ ITEM_SPAWN_MODE_DECORATION
Definition enums.h:2292
@ TRIGGER_FORCE_ACTIVATE
Definition enums.h:2675
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
#define ApiStatus_BLOCK
Definition evt.h:116
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1689
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
Definition evt.c:1846
ApiStatus CloseChoicePopup(Evt *script, b32 isInitialCall)
ApiStatus RemoveItemEntity(Evt *script, b32 isInitialCall)
ApiStatus ShowConsumableChoicePopup(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerAnimation(Evt *script, b32 isInitialCall)
ApiStatus MakeItemEntity(Evt *script, b32 isInitialCall)
ApiStatus RemoveItemAt(Evt *script, b32 isInitialCall)
ApiStatus GetPlayerPos(Evt *script, b32 isInitialCall)
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define CaseEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any pre...
Definition macros.h:319
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Unbind
Unbinds the current thread from the trigger it was bound to, if any.
Definition macros.h:507
#define BindPadlock(EVT_SOURCE, TRIGGER, COLLIDER_ID, ITEM_LIST, UNK_A3, TRIGGER_PTR_OUTVAR)
Similar to BindTrigger, but also takes arguments for the item list to show.
Definition macros.h:503
#define LVar5
Definition macros.h:153
#define CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
Definition macros.h:337
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define LVar9
Definition macros.h:157
#define EndSwitch
Marks the end of a switch statement and any case.
Definition macros.h:362
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define LVar4
Definition macros.h:152
#define LVar3
Definition macros.h:151
#define LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217