Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
ConsumableItemChoice.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#include "inventory.h"
7
9
10#ifndef _CHOICE_SUPPORT_
11#define _CHOICE_SUPPORT_
12
15
18
19API_CALLABLE(N(ItemChoice_WaitForSelection)) {
20 Bytecode* args = script->ptrReadPos;
21
22 if (isInitialCall) {
24 }
25
29 return ApiStatus_DONE2;
30 }
31
32 return ApiStatus_BLOCK;
33}
34
35API_CALLABLE(N(ItemChoice_SaveSelected)) {
36 Bytecode* args = script->ptrReadPos;
37
40 return ApiStatus_DONE2;
41}
42
43#endif
44
45API_CALLABLE(N(BuildItemChoiceList)) {
46 Bytecode* args = script->ptrReadPos;
47 s32* allowedItemList = (s32*)evt_get_variable(script, *args++);
48 s32 i;
49
50 if (allowedItemList != NULL) {
51 for (i = 0; allowedItemList[i] != ITEM_NONE; i++) {
53 }
55 } else {
56 s32 pos = 0;
57 for (i = 0; i < NUM_ITEMS; i++) {
58 if (item_is_key(i)) {
59 N(ItemChoice_List)[pos++] = i;
60 }
61 }
63 }
64 return ApiStatus_DONE2;
65}
66
72 CaseEq(0)
73 CaseEq(-1)
80 Wait(30)
86 Unbind
87 Return
88 End
89};
90
95 Return
96 End
97};
98
99#define EVT_CHOOSE_ANY_CONSUMABLE(unkMode) \
100 Set(LVar0, NULL) \
101 Set(LVar1, unkMode) \
102 ExecWait(N(EVS_ChooseItem))
103
104#define EVT_CHOOSE_CONSUMABLE_FROM(itemList, unkMode) \
105 Set(LVar0, Ref(itemList)) \
106 Set(LVar1, unkMode) \
107 ExecWait(N(EVS_ChooseItem))
108
109#endif
BSS s32 PopupMenu_SelectedIndex
Bytecode EvtScript[]
Vec3s pos
Definition demo_api.c:17
@ 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