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

Go to the source code of this file.

Enumerations

enum  {
  BLOCK_PROP_X = LVar0 , BLOCK_PROP_Y = LVar1 , BLOCK_PROP_Z = LVar2 , BLOCK_PROP_I = LVar3 ,
  BLOCK_PROP_J = LVar4 , BLOCK_PROP_K = LVar5 , BLOCK_PROP_DI = LVar6 , BLOCK_PROP_DJ = LVar7 ,
  BLOCK_PROP_DK = LVar8 , BLOCK_PROP_RESULT = LVar9
}
 
enum  { PUSH_BLOCK_READY = 0 , PUSH_BLOCK_OBSTRUCTED = 1 , PUSH_BLOCK_INVALID = 2 }
 

Variables

PushBlockGridwPushBlockGrids [8]
 
f32 PushBlockMovePositions []
 
EvtScript EVS_PushWall_PushBlock
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BLOCK_PROP_X 
BLOCK_PROP_Y 
BLOCK_PROP_Z 
BLOCK_PROP_I 
BLOCK_PROP_J 
BLOCK_PROP_K 
BLOCK_PROP_DI 
BLOCK_PROP_DJ 
BLOCK_PROP_DK 
BLOCK_PROP_RESULT 

Definition at line 8 of file push_blocks.c.

8 {
19};
@ BLOCK_PROP_I
Definition push_blocks.c:12
@ BLOCK_PROP_K
Definition push_blocks.c:14
@ BLOCK_PROP_DJ
Definition push_blocks.c:16
@ BLOCK_PROP_DK
Definition push_blocks.c:17
@ BLOCK_PROP_J
Definition push_blocks.c:13
@ BLOCK_PROP_Z
Definition push_blocks.c:11
@ BLOCK_PROP_DI
Definition push_blocks.c:15
@ BLOCK_PROP_RESULT
Definition push_blocks.c:18
@ BLOCK_PROP_X
Definition push_blocks.c:9
@ BLOCK_PROP_Y
Definition push_blocks.c:10
#define LVar6
Definition macros.h:154
#define LVar5
Definition macros.h:153
#define LVar7
Definition macros.h:155
#define LVar8
Definition macros.h:156
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define LVar9
Definition macros.h:157
#define LVar4
Definition macros.h:152
#define LVar3
Definition macros.h:151
#define LVar0
Definition macros.h:148

◆ anonymous enum

anonymous enum
Enumerator
PUSH_BLOCK_READY 
PUSH_BLOCK_OBSTRUCTED 
PUSH_BLOCK_INVALID 

Definition at line 22 of file push_blocks.c.

22 {
26};
@ PUSH_BLOCK_INVALID
Definition push_blocks.c:25
@ PUSH_BLOCK_READY
Definition push_blocks.c:23
@ PUSH_BLOCK_OBSTRUCTED
Definition push_blocks.c:24

Variable Documentation

◆ wPushBlockGrids

PushBlockGrid* wPushBlockGrids[8]
extern

Definition at line 64 of file script_list.c.

◆ PushBlockMovePositions

f32 PushBlockMovePositions[]
Initial value:
= {
0.04, 0.04, 0.08, 0.16, 0.21, 0.4, 0.6, 0.72, 0.84, 0.92, 0.96, 0.96, 1.0,
}

Definition at line 28 of file push_blocks.c.

28 {
29 0.04, 0.04, 0.08, 0.16, 0.21, 0.4, 0.6, 0.72, 0.84, 0.92, 0.96, 0.96, 1.0,
30};

◆ EVS_PushWall_PushBlock

EvtScript EVS_PushWall_PushBlock

Definition at line 288 of file push_blocks.c.

288 {
289 Set(LVarA, LVar0) // grid system
290 Set(LVarB, LVar1) // block entity ID
291 // check cell where the block will move to
292 Call(FetchPushedBlockProperties)
295 Call(MovePlayerTowardBlock)
296 EndIf
297 // try setting the player action state
298 Set(LVarC, 0)
299 Call(CheckPlayerActionState, LVarD, ACTION_STATE_RUN)
300 IfEq(LVarD, FALSE)
301 Call(CheckPlayerActionState, LVarD, ACTION_STATE_PUSHING_BLOCK)
302 IfEq(LVarD, FALSE)
303 Return
304 EndIf
305 EndIf
306 // cancel state change if the block can't be pushed
309 Return
310 EndIf
311 // wait for 8 frames of pushing
312 Set(LVarC, 0)
313 Label(0)
314 Add(LVarC, 1)
315 Call(CanPlayerPushBlock)
316 IfEq(LVarD, TRUE)
317 Goto(1)
318 EndIf
321 Return
322 EndIf
324 Return
325 Label(1)
327 Call(MovePlayerTowardBlock)
328 IfLt(LVarC, 8)
329 Wait(1)
330 Goto(0)
331 EndIf
332 // perform the push
333 Call(ClearPushedBlockFromGrid)
336 Call(UpdatePushBlockMotion)
337 Call(FinishPushBlockMotion)
338 Thread
339 Wait(2)
340 Call(CheckPlayerActionState, LVarD, ACTION_STATE_PUSHING_BLOCK)
341 IfNe(LVarD, FALSE)
342 Call(IsEventForSourceRunning, LVarD, Ref(EVS_PushWall_PushBlock))
343 IfEq(LVarD, FALSE)
345 EndIf
346 EndIf
349 Return
350 End
351};
@ SOUND_PUSH_BLOCK
Definition enums.h:1429
@ ACTION_STATE_PUSHING_BLOCK
Definition enums.h:2448
@ ACTION_STATE_JUMP
Definition enums.h:2430
@ ACTION_STATE_IDLE
Definition enums.h:2426
@ ACTION_STATE_RUN
Definition enums.h:2428
EvtScript EVS_PushWall_PushBlock
ApiStatus PlaySound(Evt *script, b32 isInitialCall)
ApiStatus GetPlayerActionState(Evt *script, b32 isInitialCall)
ApiStatus FacePlayerTowardPoint(Evt *script, b32 isInitialCall)
ApiStatus SetPlayerActionState(Evt *script, b32 isInitialCall)
ApiStatus DisablePlayerPhysics(Evt *script, b32 isInitialCall)
Disables player physics if disable is TRUE, enables it if FALSE.
#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 IfNe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR != RVAR.
Definition macros.h:272
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Add(VAR, INT_VALUE)
Definition macros.h:376
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define LVarC
Definition macros.h:160
#define IfLt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR < RVAR.
Definition macros.h:275
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:227
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define LVarB
Definition macros.h:159
#define Thread
Marks the start of a thread block.
Definition macros.h:544
#define EndThread
Marks the end of a thread block.
Definition macros.h:547
#define LVarA
Definition macros.h:158
#define LVarD
Definition macros.h:161
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:269
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define Return
Kills the current EVT thread.
Definition macros.h:217