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

Go to the source code of this file.

Enumerations

enum  { SUBSTATE_INIT = 0 , SUBSTATE_DONE = 1 }
 

Functions

void action_update_peach_land (void)
 
void action_update_peach_step_down_land (void)
 
void action_update_land (void)
 
void action_update_step_down_land (void)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SUBSTATE_INIT 
SUBSTATE_DONE 

Definition at line 4 of file land.c.

4 {
7};
@ SUBSTATE_INIT
Definition land.c:5
@ SUBSTATE_DONE
Definition land.c:6

Function Documentation

◆ action_update_peach_land()

void action_update_peach_land ( void )

Definition at line 121 of file land.c.

121 {
122 CollisionStatus* collisionStatus = &gCollisionStatus;
123 PlayerStatus* playerStatus = &gPlayerStatus;
124 f32 inputMoveMagnitude;
125 f32 inputMoveAngle;
126
127 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
128 playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED;
129 playerStatus->actionSubstate = SUBSTATE_INIT;
130 playerStatus->timeInAir = 0;
131 playerStatus->peakJumpTime = 0;
132 playerStatus->flags &= ~PS_FLAG_AIRBORNE;
133 playerStatus->landPos.x = playerStatus->pos.x;
134 playerStatus->landPos.z = playerStatus->pos.z;
135
137
138 if (!(collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT)) {
140 }
141
142 collisionStatus->lastTouchedFloor = -1;
143 }
144
145 playerStatus->actionSubstate++; // SUBSTATE_DONE
146 playerStatus->curSpeed *= 0.6f;
147
148 player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude);
149
150 if (inputMoveMagnitude == 0.0f) {
152 } else {
153 if (inputMoveMagnitude != 0.0f) {
154 playerStatus->targetYaw = inputMoveAngle;
155 }
156
157 if (sqrtf(SQ(playerStatus->stickAxis[0]) + SQ(playerStatus->stickAxis[1])) > 55.0f) {
159 } else {
161 }
162 }
163}
#define sqrtf
@ PS_FLAG_ACTION_STATE_CHANGED
Definition enums.h:3084
@ SOUND_LAND_SOFTLY
Definition enums.h:765
@ ACTION_STATE_IDLE
Definition enums.h:2426
@ ACTION_STATE_WALK
Definition enums.h:2427
@ ACTION_STATE_RUN
Definition enums.h:2428
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
void player_input_to_move_vector(f32 *angle, f32 *magnitude)
Definition 7B440.c:140
s32 phys_adjust_cam_on_landing(void)
Definition 7E9D0.c:46
void set_action_state(s32 actionState)
Definition 7E9D0.c:209
void sfx_play_sound_at_player(s32 soundID, s32 arg1)
Definition sfx.c:521
#define COLLISION_WITH_ENTITY_BIT
Definition macros.h:152
#define SQ(x)
Definition macros.h:166
CollisionStatus gCollisionStatus
Definition 7BB60.c:6
PlayerStatus gPlayerStatus
Definition 77480.c:39

Referenced by action_update_land().

◆ action_update_peach_step_down_land()

void action_update_peach_step_down_land ( void )

Definition at line 165 of file land.c.

165 {
166 CollisionStatus* collisionStatus = &gCollisionStatus;
167 PlayerStatus* playerStatus = &gPlayerStatus;
168 f32 inputMoveMagnitude;
169 f32 inputMoveAngle;
170
171 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
172 playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED;
173 playerStatus->actionSubstate = SUBSTATE_INIT;
174 playerStatus->timeInAir = 0;
175 playerStatus->peakJumpTime = 0;
176 playerStatus->flags &= ~PS_FLAG_AIRBORNE;
177 playerStatus->landPos.x = playerStatus->pos.x;
178 playerStatus->landPos.z = playerStatus->pos.z;
179
180 if (!(collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT)) {
182 }
183 collisionStatus->lastTouchedFloor = -1;
184 }
185
186 playerStatus->actionSubstate++; // SUBSTATE_DONE
187 playerStatus->curSpeed *= 0.6f;
188 player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude);
189
190 if (inputMoveMagnitude != 0.0f) {
191 playerStatus->targetYaw = inputMoveAngle;
192 }
193
194 if (sqrtf(SQ(playerStatus->stickAxis[0]) + SQ(playerStatus->stickAxis[1])) > 55.0f) {
196 } else {
198 }
199}

Referenced by action_update_step_down_land().

◆ action_update_land()

void action_update_land ( void )

Definition at line 12 of file land.c.

12 {
13 CollisionStatus* collisionStatus = &gCollisionStatus;
14 PlayerStatus* playerStatus = &gPlayerStatus;
15 Camera* camera = &gCameras[CAM_DEFAULT];
16 f32 inputMoveMagnitude;
17 f32 inputMoveAngle;
18 s32 jumpInputCheck;
19 AnimID anim;
20
21 if (playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS) {
23 return;
24 }
25
26 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
27 playerStatus->flags &= ~(
32 );
33 playerStatus->actionSubstate = SUBSTATE_INIT;
34 playerStatus->timeInAir = 0;
35 playerStatus->peakJumpTime = 0;
36 playerStatus->landPos.x = playerStatus->pos.x;
37 playerStatus->landPos.z = playerStatus->pos.z;
38
39 if (playerStatus->animFlags & PA_FLAG_8BIT_MARIO) {
40 anim = ANIM_MarioW3_8bit_Still;
41 } else if (!(playerStatus->animFlags & PA_FLAG_USING_WATT)) {
42 anim = ANIM_Mario1_Land;
43 } else {
44 anim = ANIM_MarioW1_LandWatt;
45 }
46
50
51 if (!(collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT)) {
53 }
54
55 collisionStatus->lastTouchedFloor = -1;
56 playerStatus->animFlags &= ~PA_FLAG_INTERRUPT_SPIN;
57 camera->moveFlags &= ~CAMERA_MOVE_ACCEL_INTERP_Y;
58 }
59 playerStatus->actionSubstate++; // SUBSTATE_DONE
60 playerStatus->curSpeed *= 0.6f;
61
62 player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude);
63 jumpInputCheck = check_input_jump();
64
65 if (jumpInputCheck != 0 || jumpInputCheck < playerStatus->actionSubstate) {
66 if (inputMoveMagnitude == 0.0f) {
68 return;
69 }
70 if (inputMoveMagnitude != 0.0f) {
71 playerStatus->targetYaw = inputMoveAngle;
72 }
74 }
75}
u32 AnimID
@ PS_FLAG_ARMS_RAISED
Definition enums.h:3063
@ PS_FLAG_AIRBORNE
Definition enums.h:3033
@ PS_FLAG_SCRIPTED_FALL
Definition enums.h:3071
@ SOUND_ID_STOP
Definition enums.h:526
@ PA_FLAG_8BIT_MARIO
Definition enums.h:3105
@ PA_FLAG_USING_PEACH_PHYSICS
Definition enums.h:3103
@ PA_FLAG_USING_WATT
Definition enums.h:3090
@ SOUND_PLAYER_LONG_FALL
Definition enums.h:783
@ CAM_DEFAULT
Definition enums.h:1800
void update_locomotion_state(void)
Definition 7E9D0.c:281
void suggest_player_anim_allow_backward(AnimID anim)
Definition 77480.c:894
b32 check_input_jump(void)
Definition 7E9D0.c:344
void action_update_peach_land(void)
Definition land.c:121
Camera gCameras[4]
Definition cam_main.c:17

◆ action_update_step_down_land()

void action_update_step_down_land ( void )

Definition at line 77 of file land.c.

77 {
78 CollisionStatus* collisionStatus = &gCollisionStatus;
79 PlayerStatus* playerStatus = &gPlayerStatus;
80 f32 inputMoveMagnitude;
81 f32 inputMoveAngle;
82
83 if (playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS) {
85 return;
86 }
87
88 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
89 playerStatus->flags &= ~(
94 );
95 playerStatus->actionSubstate = SUBSTATE_INIT;
96 playerStatus->timeInAir = 0;
97 playerStatus->peakJumpTime = 0;
98 playerStatus->landPos.x = playerStatus->pos.x;
99 playerStatus->landPos.z = playerStatus->pos.z;
100
101 if (!(collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT)) {
103 }
104
105 collisionStatus->lastTouchedFloor = -1;
106 }
107
108 playerStatus->actionSubstate++; // SUBSTATE_DONE
109 playerStatus->curSpeed *= 0.6f;
110
111 player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude);
113
114 if (inputMoveMagnitude != 0.0f) {
115 playerStatus->targetYaw = inputMoveAngle;
116 }
117
119}
void action_update_peach_step_down_land(void)
Definition land.c:165