Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
foliage.c File Reference

Go to the source code of this file.

Macros

#define SHAKE_CYCLES   5
 

Variables

EvtScript EVS_SearchBush
 Execute this script to animate a shaking bush and potentially spawn an item from it.
 
EvtScript EVS_ShakeTree
 Execute this script to animate a shaking tree and potentially spawn items from it.
 

Macro Definition Documentation

◆ SHAKE_CYCLES

#define SHAKE_CYCLES   5

Definition at line 7 of file foliage.c.

Variable Documentation

◆ EVS_SearchBush

EvtScript EVS_SearchBush
Initial value:
= {
Wait(15)
IfNe(LVar4, 0)
}
BSS s32 PopupMenu_SelectedIndex
@ CONTEXT_BATTLE
Definition enums.h:3563
@ SOUND_SEARCH_BUSH
Definition enums.h:776
@ ACTOR_PLAYER
Definition enums.h:2118
ApiStatus GetPlayerPos(Evt *script, b32 isInitialCall)
ApiStatus GetGameContext(Evt *script, b32 isInitialCall)
Get current GameContext from GameStatus Use this to tell whether the script is executing in world or ...
#define Else
Marks the end of an if statement and the start of the else block.
Definition macros.h:296
#define LVarF
Definition macros.h:164
#define IfNe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR != RVAR.
Definition macros.h:273
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:214
#define UseBuf(INT_PTR)
Loads a s32 pointer for use with subsequent EVT_BUF_READ commands.
Definition macros.h:390
#define BufRead4(VAR1, VAR2, VAR3, VAR4)
Consumes the next four s32s from the buffer and stores them in the given variables.
Definition macros.h:402
#define BufRead1(VAR)
Consumes the next s32 from the buffer and stores it in the given variable.
Definition macros.h:393
#define Float(DOUBLE)
Definition macros.h:52
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:299
#define LVar5
Definition macros.h:154
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:476
#define Thread
Marks the start of a thread block.
Definition macros.h:545
#define EndThread
Marks the end of a thread block.
Definition macros.h:548
#define LVar2
Definition macros.h:151
#define LVar1
Definition macros.h:150
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:255
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:270
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:577
#define LVar4
Definition macros.h:153
#define LVar3
Definition macros.h:152
#define LVar0
Definition macros.h:149
#define Return
Kills the current EVT thread.
Definition macros.h:218

Execute this script to animate a shaking bush and potentially spawn an item from it.

Expects a SearchBushConfig on LVar0. Typically used with BindTrigger.

Definition at line 190 of file foliage.c.

190 {
191 // get player Y to find bottom of bush
195 Else
197 EndIf
198 // read SearchBushConfig
200 BufRead4(LVar1, LVar2, LVar3, LVar4) // bush models, drops, vectors, callback
201 BufRead1(LVar5) // bush type
202 Thread
205 Thread
208 Wait(15)
209 IfNe(LVar4, 0) // has callback?
211 EndIf
212 Return
213 End
214};

◆ EVS_ShakeTree

EvtScript EVS_ShakeTree

Execute this script to animate a shaking tree and potentially spawn items from it.

Expects a ShakeTreeConfig on LVar0. Typically used with BindTrigger.

Definition at line 216 of file foliage.c.

216 {
217 SetTimescale(Float(2.0))
218 // get player Y to find bottom of tree
222 Else
223 Call(GetPlayerPos, LVar1, LVarF, LVar2) // get player Y (ignore X and Z)
224 EndIf
225 // read ShakeTreeConfig
227 BufRead4(LVar1, LVar2, LVar3, LVar4) // leaf models, trunk models, drops, vectors
228 BufRead2(LVar5, LVar6) // callback, tree type
229 Thread
232 Thread
235 Thread
238 Thread
241 IfNe(LVar5, 0) // has callback?
243 EndIf
244 Wait(15)
245 Return
246 End
247};
@ SOUND_SMACK_TREE
Definition enums.h:790
@ SOUND_SHAKE_TREE_LEAVES
Definition enums.h:791
#define LVar6
Definition macros.h:155
#define SetTimescale(TIMESCALE)
Sets the current thread's timescale. This is a multiplier applied to Wait and Wait_SECONDS.
Definition macros.h:517
#define BufRead2(VAR1, VAR2)
Consumes the next two s32s from the buffer and stores them in the given variables.
Definition macros.h:396