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

Go to the source code of this file.

Functions

HitID collision_check_player_intersecting_world (s32 mode, s32 arg1, f32 yaw)
 
HitID phys_check_interactable_collision (void)
 
void phys_save_ground_pos (void)
 
void record_jump_apex (void)
 
b32 can_trigger_loading_zone (void)
 
void move_player (s32 duration, f32 heading, f32 speed)
 
HitID collision_main_above (void)
 
void handle_jumping_land_on_switch (void)
 
void handle_jumping_launch (void)
 
void phys_update_jump (void)
 
void phys_init_integrator_for_current_state (void)
 
void gravity_use_fall_parms (void)
 
void phys_update_falling (void)
 
void player_handle_floor_collider_type (s32 colliderID)
 
void phys_player_land (void)
 
f32 integrate_gravity (void)
 
f32 player_fall_distance (void)
 
f32 player_check_collision_below (f32 offset, s32 *colliderID)
 
void collision_main_lateral (void)
 
HitID func_800E4404 (s32 mode, s32 offsetY, f32 arg2, f32 *outX, f32 *outY, f32 *outZ)
 
void collision_check_player_overlaps (void)
 
s32 phys_should_player_be_sliding (void)
 
void phys_set_player_sliding_check (b32(*funcPtr)(void))
 
s32 phys_is_on_sloped_ground (void)
 
void phys_main_collision_below (void)
 
void func_800E4AD8 (s32 mode)
 
void func_800E4B40 (s32 mode, f32 *outX, f32 *outY, f32 *outZ)
 
void collision_lava_reset_check_additional_overlaps (void)
 
void collision_lateral_peach (void)
 
void check_input_midair_jump (void)
 
s8 get_current_partner_id (void)
 
void try_player_footstep_sounds (s32 interval)
 
void phys_update_interact_collider (void)
 
s32 phys_can_player_interact (void)
 
f32 player_get_side_angle (void)
 
f32 player_get_camera_facing_angle (void)
 

Variables

CollisionStatus gCollisionStatus
 
f32 JumpedOnSwitchX
 
f32 JumpedOnSwitchZ
 
f32 StepUpLastYaw
 
f32 StepUpLastY
 
s16 FootstepSoundSelector = 0
 
f32 GravityParamsStartJump [] = { 15.7566404343f, -7.38624f, 3.44693994522f, -0.75f }
 
f32 GravityParamsStartFall [] = { 0.154342994094f, -0.350080013275f, -0.182262003422f, 0.0115200001746f }
 
b32(* PlayerSlidingCallback )(void) = NULL
 

Function Documentation

◆ collision_check_player_intersecting_world()

HitID collision_check_player_intersecting_world ( s32 mode,
s32 arg1,
f32 yaw )

Definition at line 755 of file 7BB60.c.

755 {
756 HitID ret = NO_COLLIDER;
757 f32 angle = 0.0f;
758 s32 i;
759
760 for (i = 0; i < 4; i++) {
761 f32 x = gPlayerStatusPtr->pos.x;
762 f32 y = gPlayerStatusPtr->pos.y + arg1;
763 f32 z = gPlayerStatusPtr->pos.z;
764 s32 hitID, hitID2;
765
766 hitID = player_test_lateral_overlap(mode, gPlayerStatusPtr, &x, &y, &z, 0.0f, angle);
767
768 // required to match
769 if (hitID > 0 || hitID == 0) {
770 hitID2 = hitID;
771 } else if (hitID == -1) {
772 hitID2 = hitID;
773 } else {
774 hitID2 = hitID;
775 }
776
777 if (hitID2 > NO_COLLIDER) {
778 ret = hitID2;
779 }
781
784 angle += 90.0f;
785 }
786
787 return ret;
788}
s32 HitID
s32 player_test_lateral_overlap(s32, PlayerStatus *, f32 *, f32 *, f32 *, f32, f32)
Definition 77480.c:370
#define NO_COLLIDER
Definition macros.h:156
PlayerStatus * gPlayerStatusPtr

Referenced by collision_main_lateral(), and func_800E4AD8().

◆ phys_check_interactable_collision()

HitID phys_check_interactable_collision ( void )

Definition at line 1131 of file 7BB60.c.

1131 {
1132 PlayerStatus* playerStatus = &gPlayerStatus;
1133 HitID ret = NO_COLLIDER;
1134 f32 x, y, z, yaw;
1135
1136 if (playerStatus->flags & PS_FLAG_INPUT_DISABLED) {
1137 return ret;
1138 }
1139
1140 if (playerStatus->pressedButtons & BUTTON_A) {
1141 yaw = playerStatus->targetYaw;
1142 x = playerStatus->pos.x;
1143 y = playerStatus->pos.y;
1144 z = playerStatus->pos.z;
1145 ret = player_test_move_with_slipping(playerStatus, &x, &y, &z, playerStatus->colliderDiameter * 0.5f, yaw);
1146
1147 if (ret <= NO_COLLIDER && playerStatus->curSpeed == 0.0f) {
1148 yaw = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw;
1149 x = playerStatus->pos.x;
1150 y = playerStatus->pos.y;
1151 z = playerStatus->pos.z;
1152 ret = player_test_move_with_slipping(playerStatus, &x, &y, &z, playerStatus->colliderDiameter * 0.5f, yaw);
1153 }
1154 }
1155
1156 return ret;
1157}
@ BUTTON_A
Definition enums.h:2790
@ PS_FLAG_INPUT_DISABLED
Definition enums.h:3052
HitID player_test_move_with_slipping(PlayerStatus *playerStatus, f32 *posX, f32 *posY, f32 *posZ, f32 speed, f32 heading)
Definition 77480.c:563
Camera gCameras[4]
Definition cam_main.c:17
PlayerStatus gPlayerStatus
Definition 77480.c:39
s32 gCurrentCameraID
Definition cam_math.c:4

Referenced by phys_update_interact_collider().

◆ phys_save_ground_pos()

void phys_save_ground_pos ( void )

Definition at line 1203 of file 7BB60.c.

1203 {
1204 PlayerStatus* playerStatus = &gPlayerStatus;
1205
1206 playerStatus->lastGoodPos.x = playerStatus->pos.x;
1207 playerStatus->lastGoodPos.y = playerStatus->pos.y;
1208 playerStatus->lastGoodPos.z = playerStatus->pos.z;
1209}

Referenced by phys_main_collision_below().

◆ record_jump_apex()

void record_jump_apex ( void )

◆ can_trigger_loading_zone()

b32 can_trigger_loading_zone ( void )

Definition at line 22 of file 7BB60.c.

22 {
23 PlayerData* playerData = &gPlayerData;
24 s32 actionState = gPlayerStatusPtr->actionState;
25 PartnerStatus* partnerStatus = &gPartnerStatus;
26
27 if (actionState == ACTION_STATE_IDLE ||
28 actionState == ACTION_STATE_WALK ||
29 actionState == ACTION_STATE_RUN ||
30 actionState == ACTION_STATE_USE_TWEESTER ||
31 actionState == ACTION_STATE_SPIN
32 ) {
33 return TRUE;
34 }
35
36 if (actionState == ACTION_STATE_RIDE) {
37 if (playerData->curPartner == PARTNER_LAKILESTER || playerData->curPartner == PARTNER_BOW) {
38 if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE) {
39 return TRUE;
40 } else {
42 return FALSE;
43 }
44 } else {
45 if (partnerStatus->actingPartner == PARTNER_WATT || partnerStatus->actingPartner == PARTNER_SUSHIE) {
46 return partnerStatus->partnerActionState != PARTNER_ACTION_NONE;
47 }
48 if (partnerStatus->actingPartner == PARTNER_PARAKARRY) {
50 return FALSE;
51 }
52 }
53 }
54 return FALSE;
55}
@ PARTNER_ACTION_NONE
Definition enums.h:2932
@ PA_FLAG_INTERRUPT_USE_PARTNER
forces actions with bow, parakarry, watt, and lakilester to end (sushie not tested)
Definition enums.h:3093
@ PARTNER_LAKILESTER
Definition enums.h:2893
@ PARTNER_WATT
Definition enums.h:2891
@ PARTNER_BOW
Definition enums.h:2894
@ PARTNER_SUSHIE
Definition enums.h:2892
@ PARTNER_PARAKARRY
Definition enums.h:2889
@ ACTION_STATE_RIDE
Definition enums.h:2461
@ ACTION_STATE_IDLE
Definition enums.h:2426
@ ACTION_STATE_USE_TWEESTER
Definition enums.h:2459
@ ACTION_STATE_WALK
Definition enums.h:2427
@ ACTION_STATE_SPIN
Definition enums.h:2454
@ ACTION_STATE_RUN
Definition enums.h:2428
PartnerStatus gPartnerStatus
Definition partners.c:42
PlayerData gPlayerData
Definition 77480.c:40

◆ move_player()

void move_player ( s32 duration,
f32 heading,
f32 speed )

Definition at line 57 of file 7BB60.c.

57 {
59 gPlayerStatus.heading = heading;
60 gPlayerStatus.moveFrames = duration;
61 gPlayerStatus.curSpeed = speed;
62
65 }
66}
@ PS_FLAG_CUTSCENE_MOVEMENT
Definition enums.h:3054
@ PA_FLAG_RIDING_PARTNER
Definition enums.h:3116
void set_action_state(s32 actionState)
Definition 7E9D0.c:209

Referenced by entity_BlueWarpPipe_set_player_move_to_center().

◆ collision_main_above()

HitID collision_main_above ( void )

Definition at line 68 of file 7BB60.c.

68 {
69 PlayerStatus* playerStatus = &gPlayerStatus;
70 CollisionStatus* collisionStatus = &gCollisionStatus;
71 HitID hitResult;
72 f32 x, y, z;
73 f32 halfHeight;
74 f32 moveAngle;
75 f32 moveMagnitude;
76 f32 outDepth;
77
78 outDepth = halfHeight = playerStatus->colliderHeight * 0.5f;
79 x = playerStatus->pos.x;
80 y = playerStatus->pos.y + halfHeight;
81 z = playerStatus->pos.z;
82
83 player_input_to_move_vector(&moveAngle, &moveMagnitude);
84
85 if (moveMagnitude != 0.0f) {
86 moveAngle = playerStatus->targetYaw;
87 } else {
88 moveAngle = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw;
89 }
90
91 hitResult = player_raycast_up_corners(playerStatus, &x, &y, &z, &outDepth, moveAngle);
92 collisionStatus->curCeiling = hitResult;
93
94 if (hitResult > NO_COLLIDER) {
95 if (playerStatus->actionState != ACTION_STATE_FALLING
96 && playerStatus->actionState != ACTION_STATE_STEP_DOWN
97 && collisionStatus->curFloor <= NO_COLLIDER
98 ) {
99 if (outDepth <= fabsf(halfHeight + playerStatus->gravityIntegrator[0])) {
100 if ((hitResult & COLLISION_WITH_ENTITY_BIT) && get_entity_type(hitResult) == ENTITY_TYPE_BRICK_BLOCK) {
101 return hitResult;
102 }
103
104 playerStatus->pos.y = y - ((playerStatus->colliderHeight / 5.0f) * 3.0f);
105 if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP
106 && playerStatus->actionState != ACTION_STATE_SPIN_JUMP
107 ) {
108 playerStatus->gravityIntegrator[0] = 0.0f;
109 playerStatus->gravityIntegrator[1] = 0.0f;
110 playerStatus->gravityIntegrator[2] = 0.0f;
111 playerStatus->gravityIntegrator[3] = 0.0f;
112 }
113 }
114 }
115 }
116
117 return hitResult;
118}
CollisionStatus gCollisionStatus
Definition 7BB60.c:6
f32 gravityIntegrator[4]
@ ENTITY_TYPE_BRICK_BLOCK
Definition enums.h:2556
@ ACTION_STATE_SPIN_JUMP
Definition enums.h:2441
@ ACTION_STATE_FALLING
Definition enums.h:2435
@ ACTION_STATE_STEP_DOWN
Definition enums.h:2436
@ ACTION_STATE_TORNADO_JUMP
Definition enums.h:2443
f32 fabsf(f32 f)
void player_input_to_move_vector(f32 *angle, f32 *magnitude)
Definition 7B440.c:140
u32 get_entity_type(s32 arg0)
Definition entity.c:568
HitID player_raycast_up_corners(PlayerStatus *, f32 *, f32 *, f32 *, f32 *, f32)
Definition 77480.c:255
#define COLLISION_WITH_ENTITY_BIT
Definition macros.h:152

Referenced by phys_update_standard().

◆ handle_jumping_land_on_switch()

void handle_jumping_land_on_switch ( void )

Definition at line 120 of file 7BB60.c.

120 {
121 PlayerStatus* playerStatus = &gPlayerStatus;
122 s32 colliderID;
123 f32 groundPosY;
124 AnimID anim;
125
126 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
127 playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED;
129 }
130
131 if (playerStatus->actionSubstate == LANDING_ON_SWITCH_SUBSTATE_0) {
132 if (dist2D(JumpedOnSwitchX, JumpedOnSwitchZ, playerStatus->pos.x, playerStatus->pos.z) <= 22.0f) {
133 add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, 5.0f, playerStatus->targetYaw);
134 }
136 if (playerStatus->gravityIntegrator[0] <= 0.0f) {
141 }
142 if (playerStatus->gravityIntegrator[0] > playerStatus->maxJumpSpeed) {
143 playerStatus->gravityIntegrator[0] = playerStatus->maxJumpSpeed;
144 }
145 playerStatus->pos.y += playerStatus->gravityIntegrator[0];
146 } else if (playerStatus->actionSubstate == LANDING_ON_SWITCH_SUBSTATE_2) {
147 if (dist2D(JumpedOnSwitchX, JumpedOnSwitchZ, playerStatus->pos.x, playerStatus->pos.z) <= 22.0f) {
148 add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, 5.0f, playerStatus->targetYaw);
149 }
150 groundPosY = player_check_collision_below(player_fall_distance(), &colliderID);
152 playerStatus->pos.y = groundPosY;
153 if (colliderID > NO_COLLIDER) {
154 if (!(playerStatus->animFlags & PA_FLAG_USING_WATT)) {
155 anim = ANIM_Mario1_Land;
156 } else {
157 anim = ANIM_MarioW1_LandWatt;
158 }
162 }
163 }
164}
f32 JumpedOnSwitchZ
Definition 7BB60.c:8
f32 integrate_gravity(void)
Definition 7BB60.c:436
void phys_player_land(void)
Definition 7BB60.c:369
void gravity_use_fall_parms(void)
Definition 7BB60.c:302
void player_handle_floor_collider_type(s32 colliderID)
Definition 7BB60.c:326
void record_jump_apex(void)
Definition 7BB60.c:18
f32 JumpedOnSwitchX
Definition 7BB60.c:7
f32 player_fall_distance(void)
Definition 7BB60.c:461
f32 player_check_collision_below(f32 offset, s32 *colliderID)
Definition 7BB60.c:470
u32 AnimID
@ PS_FLAG_ACTION_STATE_CHANGED
Definition enums.h:3084
@ LANDING_ON_SWITCH_SUBSTATE_1
Definition enums.h:2483
@ LANDING_ON_SWITCH_SUBSTATE_0
Definition enums.h:2482
@ LANDING_ON_SWITCH_SUBSTATE_2
Definition enums.h:2484
@ PA_FLAG_USING_WATT
Definition enums.h:3090
s32 enable_player_input(void)
Definition 77480.c:998
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:670
void suggest_player_anim_allow_backward(AnimID anim)
Definition 77480.c:894
void add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
Definition 43F0.c:685

Referenced by phys_update_jump().

◆ handle_jumping_launch()

void handle_jumping_launch ( void )

Definition at line 166 of file 7BB60.c.

166 {
167 PlayerStatus* playerStatus = &gPlayerStatus;
168 s32 cond = FALSE;
169
170 if (playerStatus->pos.y < playerStatus->gravityIntegrator[3] + playerStatus->gravityIntegrator[2]) {
171 f32 phi_f6 = (playerStatus->gravityIntegrator[3] - playerStatus->pos.y) / 777.0f;
172
173 if (phi_f6 < -0.47) {
174 phi_f6 = -0.47f;
175 }
176 if (phi_f6 > 0.001) {
177 phi_f6 = 0.001f;
178 }
179 playerStatus->gravityIntegrator[0] += phi_f6;
180 playerStatus->pos.y += playerStatus->gravityIntegrator[0];
181 if (playerStatus->gravityIntegrator[0] <= 0.0f) {
182 cond = TRUE;
183 }
184 } else {
185 playerStatus->gravityIntegrator[0] += -1.2;
186 if (playerStatus->gravityIntegrator[0] <= 0.0f) {
187 cond = TRUE;
188 }
189 playerStatus->pos.y += playerStatus->gravityIntegrator[0];
190 }
191
192 if (cond) {
196 }
197}
#define LOAD_INTEGRATOR_FALL(ptr)
Definition macros.h:186

Referenced by phys_update_jump().

◆ phys_update_jump()

void phys_update_jump ( void )

Definition at line 199 of file 7BB60.c.

199 {
200 PlayerStatus* playerStatus = &gPlayerStatus;
201
202 if (playerStatus->timeInAir != 0) {
203 switch (playerStatus->actionState) {
206 return;
209 return;
212 playerStatus->pos.y += playerStatus->gravityIntegrator[0];
213 if (playerStatus->gravityIntegrator[0] <= 0.0f) {
216 playerStatus->gravityIntegrator[0] = 0.154343f;
217 playerStatus->gravityIntegrator[1] = -0.35008f;
218 playerStatus->gravityIntegrator[2] = 0.0f;
219 playerStatus->gravityIntegrator[3] = 0.0f;
220 } else {
222 }
225 }
226 return;
227 case ACTION_STATE_HOP:
228 playerStatus->gravityIntegrator[0] -= 4.5;
229 playerStatus->pos.y += playerStatus->gravityIntegrator[0];
230 if (playerStatus->gravityIntegrator[0] <= 0.0f) {
235 }
236 return;
239 return;
240 default:
241 if (!(playerStatus->curButtons & BUTTON_A)) {
245 if (playerStatus->flags & PS_FLAG_ENTERING_BATTLE) {
246 playerStatus->gravityIntegrator[1] *= 0.5f;
247 playerStatus->gravityIntegrator[2] *= 0.5f;
248 playerStatus->gravityIntegrator[3] *= 0.5f;
249 }
250 }
251 break;
252 }
253 }
254
256 if (playerStatus->gravityIntegrator[0] <= 0.0f) {
261 }
262
263 if (playerStatus->gravityIntegrator[0] > playerStatus->maxJumpSpeed) {
264 playerStatus->gravityIntegrator[0] = playerStatus->maxJumpSpeed;
265 }
266 playerStatus->pos.y += playerStatus->gravityIntegrator[0];
267}
void handle_jumping_launch(void)
Definition 7BB60.c:166
void handle_jumping_land_on_switch(void)
Definition 7BB60.c:120
@ PS_FLAG_ENTERING_BATTLE
Definition enums.h:3061
@ ACTION_STATE_HIT_LAVA
Definition enums.h:2451
@ ACTION_STATE_LANDING_ON_SWITCH
Small red/blue ! switches.
Definition enums.h:2434
@ ACTION_STATE_LAUNCH
Shy Guy Toybox jack-in-the-boxes.
Definition enums.h:2433
@ ACTION_STATE_HOP
Released A before apex of jump.
Definition enums.h:2432
@ ACTION_STATE_BOUNCE
Used with Kooper.
Definition enums.h:2431
@ ACTION_STATE_HIT_FIRE
Causes Mario to fly up and take damage. Used for fire bars.
Definition enums.h:2449
s32 is_starting_conversation(void)
Definition encounter.c:2818

Referenced by phys_update_standard().

◆ phys_init_integrator_for_current_state()

void phys_init_integrator_for_current_state ( void )

Definition at line 272 of file 7BB60.c.

Referenced by initialize_jump().

◆ gravity_use_fall_parms()

◆ phys_update_falling()

void phys_update_falling ( void )

Definition at line 316 of file 7BB60.c.

Referenced by phys_update_standard().

◆ player_handle_floor_collider_type()

void player_handle_floor_collider_type ( s32 colliderID)

Definition at line 326 of file 7BB60.c.

326 {
327 PlayerStatus* playerStatus = &gPlayerStatus;
328 PartnerStatus* partnerStatus = &gPartnerStatus;
329
330 if (colliderID > NO_COLLIDER) {
331 s32 surfaceType = get_collider_flags(colliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
332 switch (surfaceType) {
337 break;
339 if ((*(s32*)(&partnerStatus->partnerActionState) & 0xFF0000FF) != 0x01000009) {
340 if (playerStatus->blinkTimer == 0) {
341 if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) {
342 playerStatus->hazardType = HAZARD_TYPE_LAVA;
344 }
345 } else {
347 }
348 }
349 break;
351 if ((*(s32*)(&partnerStatus->partnerActionState) & 0xFF0000FF) != 0x01000009) {
352 if (playerStatus->blinkTimer == 0) {
353 if (playerStatus->actionState != ACTION_STATE_HIT_FIRE) {
354 playerStatus->hazardType = HAZARD_TYPE_SPIKES;
356 }
357 break;
358 }
360 }
361 break;
362 default:
364 break;
365 }
366 }
367}
@ SURFACE_TYPE_WATER
Definition enums.h:4671
@ SURFACE_TYPE_SLIDE
Definition enums.h:4675
@ SURFACE_TYPE_LAVA
Definition enums.h:4673
@ SURFACE_TYPE_DOCK_WALL
Definition enums.h:4674
@ SURFACE_TYPE_SPIKES
Definition enums.h:4672
@ COLLIDER_FLAGS_SURFACE_TYPE_MASK
Definition enums.h:4693
@ HAZARD_TYPE_LAVA
Definition enums.h:3500
@ HAZARD_TYPE_SPIKES
Definition enums.h:3501
@ ACTION_STATE_LAND
Definition enums.h:2437
@ ACTION_STATE_KNOCKBACK
Definition enums.h:2450
s32 get_collider_flags(s32 colliderID)
Definition collision.c:481

Referenced by handle_jumping_land_on_switch(), phys_update_falling(), and player_jump().

◆ phys_player_land()

void phys_player_land ( void )

Definition at line 369 of file 7BB60.c.

369 {
370 PlayerStatus* playerStatus = &gPlayerStatus;
371 CollisionStatus* collisionStatus = &gCollisionStatus;
372 f32 moveAngle;
373 f32 moveMagnitude;
374
375 playerStatus->timeInAir = 0;
376 playerStatus->peakJumpTime = 0;
377 playerStatus->flags &= ~PS_FLAG_SCRIPTED_FALL;
378 playerStatus->landPos.x = playerStatus->pos.x;
379 playerStatus->landPos.z = playerStatus->pos.z;
380 playerStatus->flags &= ~PS_FLAG_AIRBORNE;
382 if (!(collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT)) {
384 }
385
386 collisionStatus->lastTouchedFloor = -1;
387 if (collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT) {
388 s32 entityType = get_entity_type(collisionStatus->curFloor);
389
390 if (entityType <= ACTION_STATE_FALLING) {
391 if (entityType >= ACTION_STATE_LANDING_ON_SWITCH) {
392 Entity* entity = get_entity_by_index(collisionStatus->curFloor);
393
395 if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP
396 && playerStatus->actionState != ACTION_STATE_TORNADO_POUND
397 && playerStatus->actionState != ACTION_STATE_SPIN_JUMP
398 && playerStatus->actionState != ACTION_STATE_SPIN_POUND
399 ) {
401 } else {
403 playerStatus->actionSubstate = 11;
404 }
405 return;
406 }
407 }
408 }
409
410 if (playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT) {
412 return;
413 }
414
415 if (playerStatus->actionState == ACTION_STATE_LANDING_ON_SWITCH) {
417 return;
418 }
419
420 player_input_to_move_vector(&moveAngle, &moveMagnitude);
421 if (moveMagnitude == 0.0f) {
422 if (playerStatus->actionState != ACTION_STATE_STEP_DOWN) {
424 } else {
426 }
427 return;
428 }
429
430 if (moveMagnitude != 0.0f) {
431 playerStatus->targetYaw = moveAngle;
432 }
434}
@ ENTITY_COLLISION_PLAYER_TOUCH_FLOOR
Definition enums.h:2648
@ SOUND_LAND_SOFTLY
Definition enums.h:765
@ ACTION_STATE_STEP_DOWN_LAND
Definition enums.h:2438
@ ACTION_STATE_BOUNCE_OFF_SWITCH
Small red/blue ! switches.
Definition enums.h:2460
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
Entity * get_entity_by_index(s32 index)
Definition entity.c:530
void update_locomotion_state(void)
Definition 7E9D0.c:281
s32 disable_player_input(void)
Definition 77480.c:990
s32 phys_adjust_cam_on_landing(void)
Definition 7E9D0.c:46
void sfx_play_sound_at_player(s32 soundID, s32 arg1)
Definition sfx.c:521
u8 collisionFlags

Referenced by action_update_tornado_jump(), handle_jumping_land_on_switch(), and player_handle_floor_collider_type().

◆ integrate_gravity()

f32 integrate_gravity ( void )

Definition at line 436 of file 7BB60.c.

436 {
437 PlayerStatus* playerStatus = &gPlayerStatus;
438
439 if (playerStatus->flags & PS_FLAG_ENTERING_BATTLE) {
440 playerStatus->gravityIntegrator[2] += playerStatus->gravityIntegrator[3] / 1.7f;
441 playerStatus->gravityIntegrator[1] += playerStatus->gravityIntegrator[2] / 1.7f;
442 playerStatus->gravityIntegrator[0] += playerStatus->gravityIntegrator[1] / 1.7f;
443 } else {
444 #if DX_DEBUG_MENU
445 if (dx_debug_is_cheat_enabled(DEBUG_CHEAT_HIGH_JUMP)) {
446 playerStatus->gravityIntegrator[2] += playerStatus->gravityIntegrator[3];
447 playerStatus->gravityIntegrator[1] += playerStatus->gravityIntegrator[2] * 1.5;
448 playerStatus->gravityIntegrator[0] += playerStatus->gravityIntegrator[1] * 1.5;
449 return playerStatus->gravityIntegrator[0];
450 }
451 #endif
452
453 playerStatus->gravityIntegrator[2] += playerStatus->gravityIntegrator[3];
454 playerStatus->gravityIntegrator[1] += playerStatus->gravityIntegrator[2];
455 playerStatus->gravityIntegrator[0] += playerStatus->gravityIntegrator[1];
456 }
457
458 return playerStatus->gravityIntegrator[0];
459}

Referenced by action_update_hit_fire(), action_update_knockback(), action_update_spin_jump(), action_update_step_up(), action_update_tornado_jump(), handle_jumping_land_on_switch(), phys_update_jump(), and player_fall_distance().

◆ player_fall_distance()

f32 player_fall_distance ( void )

Definition at line 461 of file 7BB60.c.

461 {
462 f32 velocity = integrate_gravity();
463
465 velocity = 0.0f;
466 }
467 return velocity;
468}
b32 check_player_action_debug(void)
Definition 77480.c:1016

Referenced by action_update_hit_fire(), action_update_hit_lava(), action_update_knockback(), action_update_sliding(), action_update_spin_jump(), handle_jumping_land_on_switch(), and phys_update_falling().

◆ player_check_collision_below()

f32 player_check_collision_below ( f32 offset,
s32 * colliderID )

Definition at line 470 of file 7BB60.c.

470 {
471 PlayerStatus* playerStatus = &gPlayerStatus;
472 CollisionStatus* collisionStatus = &gCollisionStatus;
473 f32 temp_f4 = playerStatus->colliderHeight * 0.5f;
474 f32 outLength = fabsf(offset) + temp_f4;
475 f32 x = playerStatus->pos.x;
476 f32 y = playerStatus->pos.y + temp_f4;
477 f32 z = playerStatus->pos.z;
478 f32 sp38, sp3C, sp40, sp44;
479 s32 hit = *colliderID = player_raycast_below_cam_relative(&gPlayerStatus, &x, &y, &z, &outLength,
480 &sp38, &sp3C, &sp40, &sp44);
481
482 if (hit <= NO_COLLIDER) {
483 if (offset >= 0.0f && collisionStatus->curCeiling > NO_COLLIDER) {
484 return playerStatus->pos.y;
485 }
486 y = playerStatus->pos.y + offset;
487 } else {
488 collisionStatus->curFloor = hit;
489 collisionStatus->lastTouchedFloor = -1;
490 }
491 return y;
492}
HitID player_raycast_below_cam_relative(PlayerStatus *playerStatus, f32 *outX, f32 *outY, f32 *outZ, f32 *outLength, f32 *hitRx, f32 *hitRz, f32 *hitDirX, f32 *hitDirZ)
Definition 77480.c:193

Referenced by action_update_hit_fire(), action_update_hit_lava(), action_update_knockback(), action_update_sliding(), action_update_spin_jump(), action_update_step_up(), action_update_tornado_jump(), action_update_use_munchlesia(), action_update_use_spinning_flower(), handle_jumping_land_on_switch(), phys_update_falling(), and player_jump().

◆ collision_main_lateral()

void collision_main_lateral ( void )

Definition at line 494 of file 7BB60.c.

494 {
495 PlayerStatus* playerStatus = &gPlayerStatus;
496 CollisionStatus* collisionStatus = &gCollisionStatus;
497 f32 playerX, playerY, playerZ;
498 f32 test1X, test1Y, test1Z;
499 f32 test2X, test2Y, test2Z;
500 f32 yaw;
501 f32 yaw2;
502 f32 speed;
503 f32 sinTheta;
504 f32 cosTheta;
505 s32 result;
506 s32 test1;
507 s32 test2;
508 f32 xBump;
509 f32 zBump;
510
512 if (playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT) {
513 speed = playerStatus->curSpeed;
514 if (playerStatus->flags & PS_FLAG_ENTERING_BATTLE) {
515 speed *= 0.5f;
516 }
517 add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, speed, playerStatus->heading);
518 return;
519 }
520
521 switch (playerStatus->actionState) {
524 playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw);
525 break;
528 playerStatus->pos.x += playerStatus->pushVel.x;
529 playerStatus->pos.y += playerStatus->pushVel.y;
530 playerStatus->pos.z += playerStatus->pushVel.z;
531
532 if (playerStatus->pushVel.x != 0.0f ||
533 playerStatus->pushVel.y != 0.0f ||
534 playerStatus->pushVel.z != 0.0f)
535 {
536 gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x;
537 gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y;
538 gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z;
539 if (playerStatus->curAlpha != 128) {
541 atan2(0.0f, 0.0f, playerStatus->pushVel.x, playerStatus->pushVel.z));
542 }
543 }
544 }
545 break;
548 playerStatus->pos.x += playerStatus->pushVel.x;
549 playerStatus->pos.y += playerStatus->pushVel.y;
550 playerStatus->pos.z += playerStatus->pushVel.z;
551 if (playerStatus->pushVel.x != 0.0f ||
552 playerStatus->pushVel.y != 0.0f ||
553 playerStatus->pushVel.z != 0.0f)
554 {
555 gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x;
556 gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y;
557 gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z;
558 }
559 if (playerStatus->pushVel.x != 0.0f ||
560 playerStatus->pushVel.y != 0.0f ||
561 playerStatus->pushVel.z != 0.0f)
562 {
564 playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw);
565 }
566 break;
568 playerStatus->pos.x += playerStatus->pushVel.x;
569 playerStatus->pos.y += playerStatus->pushVel.y;
570 playerStatus->pos.z += playerStatus->pushVel.z;
571 if (playerStatus->pushVel.x != 0.0f ||
572 playerStatus->pushVel.y != 0.0f ||
573 playerStatus->pushVel.z != 0.0f)
574 {
575 gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x;
576 gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y;
577 gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z;
578 }
579
580 playerX = playerStatus->pos.x;
581 playerY = playerStatus->pos.y;
582 playerZ = playerStatus->pos.z;
583 if (playerStatus->curSpeed != 0.0f) {
584 yaw = playerStatus->targetYaw;
585 } else {
586 yaw = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw;
587 }
588 collisionStatus->curWall =
589 player_test_move_with_slipping(playerStatus, &playerX, &playerY, &playerZ,
590 playerStatus->colliderDiameter * 0.5f, yaw);
591
592 if (playerStatus->pushVel.x != 0.0f ||
593 playerStatus->pushVel.y != 0.0f ||
594 playerStatus->pushVel.z != 0.0f)
595 {
597 playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw);
598 }
599 break;
600 default:
601 if (!(playerStatus->flags & PS_FLAG_FLYING)) {
602 speed = 0.0f;
603 if (!(playerStatus->flags & (PS_FLAG_SCRIPTED_FALL | PS_FLAG_INPUT_DISABLED))) {
604 player_input_to_move_vector(&yaw, &speed);
605 if (!(playerStatus->animFlags & PA_FLAG_SPINNING)) {
606 speed *= 0.03125f;
607 if (!(playerStatus->flags & (PS_FLAG_FALLING | PS_FLAG_JUMPING))) {
608 speed *= 0.25;
609 }
610 if (playerStatus->actionState == ACTION_STATE_LAUNCH) {
611 speed *= 1.5;
612 }
613 if (playerStatus->flags & PS_FLAG_ENTERING_BATTLE) {
614 speed *= 0.5f;
615 }
616 }
617 sin_cos_rad(DEG_TO_RAD(yaw), &sinTheta, &cosTheta);
618
619 if (playerStatus->actionState == ACTION_STATE_PUSHING_BLOCK) {
620 if (fabsf(sinTheta) > fabsf(cosTheta)) {
621 xBump = speed * sinTheta;
622 zBump = 0.0f;
623 } else {
624 xBump = 0.0f;
625 zBump = -speed * cosTheta;
626 }
627 } else if (!(playerStatus->animFlags & PA_FLAG_SPINNING)) {
628 xBump = speed * sinTheta;
629 zBump = -speed * cosTheta;
630 } else {
631 xBump = 0.0f;
632 zBump = 0.0f;
633 }
634
635 sin_cos_rad(DEG_TO_RAD(playerStatus->targetYaw), &sinTheta, &cosTheta);
636 speed = playerStatus->curSpeed;
637 if (playerStatus->flags & PS_FLAG_ENTERING_BATTLE) {
638 speed *= 0.5f;
639 }
640 playerX = xBump + (speed * sinTheta);
641 playerZ = zBump - (speed * cosTheta);
642 yaw = atan2(0.0f, 0.0f, playerX, playerZ);
643 speed = sqrtf(SQ(playerX) + SQ(playerZ));
644 if (playerStatus->flags & (PS_FLAG_FALLING | PS_FLAG_JUMPING)) {
645 if (speed > playerStatus->runSpeed) {
646 speed = playerStatus->runSpeed;
647 }
648 }
649 }
650
651 playerStatus->pos.x += playerStatus->pushVel.x;
652 playerStatus->pos.z += playerStatus->pushVel.z;
653 if (playerStatus->timeInAir == 0) {
654 playerStatus->pos.y += playerStatus->pushVel.y;
655 }
656
657 if (
658 playerStatus->pushVel.x != 0.0f ||
659 playerStatus->pushVel.y != 0.0f ||
660 playerStatus->pushVel.z != 0.0f)
661 {
662 gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x;
663 gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y;
664 gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z;
665 }
666
667 playerX = playerStatus->pos.x;
668 playerY = playerStatus->pos.y;
669 playerZ = playerStatus->pos.z;
670 result = player_test_move_with_slipping(playerStatus, &playerX, &playerY, &playerZ,
671 playerStatus->colliderDiameter * 0.5f, playerStatus->targetYaw);
672 if (speed == 0.0f && result <= NO_COLLIDER) {
673 yaw2 = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw;
674 sin_cos_rad(DEG_TO_RAD(yaw2 + 180.0f), &sinTheta, &cosTheta);
675 playerX = playerStatus->pos.x + (sinTheta * playerStatus->colliderDiameter * 0.5f);
676 playerY = playerStatus->pos.y;
677 playerZ = playerStatus->pos.z - (cosTheta * playerStatus->colliderDiameter * 0.5f);
678 result = player_test_move_with_slipping(playerStatus, &playerX, &playerY, &playerZ,
679 playerStatus->colliderDiameter, yaw2);
680 }
681 collisionStatus->curWall = result;
682 if (!(playerStatus->flags & PS_FLAG_MOVEMENT_LOCKED) && playerStatus->actionState != ACTION_STATE_HAMMER) {
683 if (speed == 0.0f) {
685 playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw);
686 break;
687 }
688
689 playerX = playerStatus->pos.x;
690 playerZ = playerStatus->pos.z;
691 playerY = playerStatus->pos.y;
692 yaw2 = yaw;
693
694 if (speed > 4.0f) {
695 result = player_test_move_with_slipping(playerStatus, &playerX, &playerY, &playerZ, 4.0f, yaw2);
696 if (result <= NO_COLLIDER) {
697 result = player_test_move_with_slipping(playerStatus, &playerX, &playerY, &playerZ, speed - 4.0f, yaw2);
698 }
699 collisionStatus->pushingAgainstWall = result;
700 } else {
701 collisionStatus->pushingAgainstWall =
702 player_test_move_with_slipping(playerStatus, &playerX, &playerY, &playerZ, speed, yaw2);
703 }
704
705 test1X = playerX;
706 test1Y = playerY;
707 test1Z = playerZ;
708 yaw = clamp_angle(yaw2 - 35.0);
709 test1 = player_test_lateral_overlap(PLAYER_COLLISION_0, playerStatus, &test1X, &test1Y, &test1Z, 0.0f, yaw);
710 test2X = playerX;
711 test2Z = playerY;
712 test2Y = playerZ;
713 yaw = clamp_angle(yaw2 + 35.0);
714 test2 = player_test_lateral_overlap(PLAYER_COLLISION_0, playerStatus, &test2X, &test2Z, &test2Y, 0.0f, yaw);
715
716 if (test1 <= NO_COLLIDER) {
717 if (test2 <= NO_COLLIDER) {
718 playerStatus->pos.x = playerX;
719 playerStatus->pos.z = playerZ;
720 } else {
721 playerStatus->pos.x = test1X;
722 playerStatus->pos.z = test1Z;
723 }
724 } else if (test2 <= NO_COLLIDER) {
725 playerStatus->pos.x = test2X;
726 playerStatus->pos.z = test2Y;
727 }
728
729 if (playerStatus->enableCollisionOverlapsCheck == 0) {
730 if (playerStatus->animFlags & PA_FLAG_SPINNING) {
731 yaw2 = playerStatus->targetYaw;
732 } else {
733 yaw2 = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw;
734 }
737 }
738 }
739 }
740 }
741 break;
751 break;
752 }
753}
HitID collision_check_player_intersecting_world(s32 mode, s32 arg1, f32 yaw)
Definition 7BB60.c:755
s8 get_current_partner_id(void)
Definition 7BB60.c:1101
s8 enableCollisionOverlapsCheck
#define sqrtf
#define clamp_angle
#define atan2
@ PS_FLAG_FALLING
Definition enums.h:3036
@ PS_FLAG_JUMPING
Definition enums.h:3035
@ PS_FLAG_FLYING
Definition enums.h:3037
@ PS_FLAG_SCRIPTED_FALL
Definition enums.h:3071
@ PS_FLAG_MOVEMENT_LOCKED
Definition enums.h:3069
@ PLAYER_COLLISION_0
Definition enums.h:4712
@ PLAYER_COLLISION_1
Definition enums.h:4713
@ PA_FLAG_SPINNING
Definition enums.h:3107
@ ACTION_STATE_PUSHING_BLOCK
Definition enums.h:2448
@ ACTION_STATE_USE_SPRING
Definition enums.h:2466
@ ACTION_STATE_USE_SNEAKY_PARASOL
Definition enums.h:2453
@ ACTION_STATE_SLIDING
Definition enums.h:2445
@ ACTION_STATE_HAMMER
Definition enums.h:2446
@ ACTION_STATE_STEP_UP
Definition enums.h:2462
@ CAM_DEFAULT
Definition enums.h:1800
void sin_cos_rad(f32 rad, f32 *outSinTheta, f32 *outCosTheta)
Definition 43F0.c:706
#define DEG_TO_RAD(deg)
Definition macros.h:134
#define SQ(x)
Definition macros.h:166
Vec3f targetPos

Referenced by phys_update_lava_reset(), phys_update_standard(), and update_player().

◆ func_800E4404()

HitID func_800E4404 ( s32 mode,
s32 offsetY,
f32 arg2,
f32 * outX,
f32 * outY,
f32 * outZ )

Definition at line 790 of file 7BB60.c.

790 {
791 HitID ret = NO_COLLIDER;
792 f32 angle = 0.0f;
793 s32 i;
794
795 for (i = 0; i < 4; i++) {
796 f32 x = *outX;
797 f32 y = *outY + offsetY;
798 f32 z = *outZ;
799 s32 hitID = player_test_lateral_overlap(mode, gPlayerStatusPtr, &x, &y, &z, 0.0f, angle);
800
801 if (hitID > NO_COLLIDER) {
802 ret = hitID;
803 }
804
805 *outX = x;
806 *outZ = z;
807 angle += 90.0f;
808 }
809
810 return ret;
811}

Referenced by func_800E4B40().

◆ collision_check_player_overlaps()

void collision_check_player_overlaps ( void )

Definition at line 813 of file 7BB60.c.

813 {
814 PlayerStatus* playerStatus = &gPlayerStatus;
815 f32 overlapPush = playerStatus->overlapPushAmount;
816
817 if (overlapPush != 0.0f) {
818 f32 x = playerStatus->pos.x;
819 f32 y = playerStatus->pos.y;
820 f32 z = playerStatus->pos.z;
821
822 player_test_lateral_overlap(PLAYER_COLLISION_0, &gPlayerStatus, &x, &y, &z, overlapPush, playerStatus->overlapPushYaw);
823
824 overlapPush -= playerStatus->runSpeed / 10.0f;
825 playerStatus->pos.x = x;
826 playerStatus->pos.y = y;
827 playerStatus->pos.z = z;
828
829 if (overlapPush < 0.0f) {
830 overlapPush = 0.0f;
831 }
832
833 playerStatus->overlapPushAmount = overlapPush;
834 }
835}

Referenced by phys_update_standard().

◆ phys_should_player_be_sliding()

s32 phys_should_player_be_sliding ( void )

Definition at line 839 of file 7BB60.c.

839 {
840 if (PlayerSlidingCallback != NULL) {
841 return PlayerSlidingCallback();
842 }
843 return FALSE;
844}
b32(* PlayerSlidingCallback)(void)
Definition 7BB60.c:837

Referenced by check_input_jump(), and phys_main_collision_below().

◆ phys_set_player_sliding_check()

void phys_set_player_sliding_check ( b32(*)(void) funcPtr)

Definition at line 846 of file 7BB60.c.

846 {
847 PlayerSlidingCallback = funcPtr;
848}

Referenced by load_map_by_IDs().

◆ phys_is_on_sloped_ground()

s32 phys_is_on_sloped_ground ( void )

Definition at line 850 of file 7BB60.c.

850 {
852 f32 rotZ = playerShadow->rot.z + 180.0;
853 f32 rotX = playerShadow->rot.x + 180.0;
854 s32 ret = TRUE;
855
856 if (fabsf(rotZ) < 20.0f && fabsf(rotX) < 20.0f) {
857 ret = FALSE;
858 }
859
860 return ret;
861}
Shadow * get_shadow_by_index(s32 index)
Definition entity.c:534

◆ phys_main_collision_below()

void phys_main_collision_below ( void )

Definition at line 863 of file 7BB60.c.

863 {
864 PlayerStatus* playerStatus = &gPlayerStatus;
865 PartnerStatus* partnerStatus = &gPartnerStatus;
866 CollisionStatus* collisionStatus = &gCollisionStatus;
867 f32 collHeightHalf = playerStatus->colliderHeight * 0.5f;
868 f32 playerX = playerStatus->pos.x;
869 f32 playerY = playerStatus->pos.y + collHeightHalf;
870 f32 playerZ = playerStatus->pos.z;
871 f32 outLength = playerStatus->colliderHeight;
872 f32 temp_f24 = (2.0f * playerStatus->colliderHeight) / 7.0f;
873 f32 hitRx, hitRz;
874 f32 hitDirX, hitDirZ;
875 s32 colliderID;
876 s32 cond;
877
878 colliderID = player_raycast_below_cam_relative(playerStatus, &playerX, &playerY, &playerZ, &outLength, &hitRx, &hitRz,
879 &hitDirX, &hitDirZ);
881
882 if (collHeightHalf + (temp_f24 * 0.5f) < outLength) {
883 colliderID = NO_COLLIDER;
884 }
885 if (playerStatus->timeInAir == 0) {
886 collisionStatus->curFloor = colliderID;
887 }
888 if (colliderID > NO_COLLIDER) {
889 playerStatus->groundAnglesXZ.x = hitDirX;
890 playerStatus->groundAnglesXZ.y = hitDirZ;
891 }
892
894 return;
895 }
896
897 if (playerStatus->flags & PS_FLAG_AIRBORNE) {
898 return;
899 }
900
901 if (playerStatus->actionState == ACTION_STATE_SLIDING) {
902 return;
903 }
904
905 if (playerStatus->flags & PS_FLAG_SLIDING) {
907 }
908
909 if (playerStatus->flags & PS_FLAG_SLIDING && phys_should_player_be_sliding()) {
911 }
912
913 if (playerStatus->actionState == ACTION_STATE_SLIDING) {
914 return;
915 }
916
917 if (colliderID > NO_COLLIDER) {
918 s32 surfaceType = get_collider_flags(colliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK;
919 switch (surfaceType) {
921 if (partnerStatus->partnerActionState == PARTNER_ACTION_NONE || partnerStatus->actingPartner != PARTNER_BOW) {
922 if (playerStatus->blinkTimer == 0) {
923 if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) {
924 playerStatus->hazardType = HAZARD_TYPE_SPIKES;
926 }
927 } else {
929 }
930 }
931 break;
933 if (partnerStatus->partnerActionState == PARTNER_ACTION_NONE || partnerStatus->actingPartner != PARTNER_BOW) {
934 if (playerStatus->blinkTimer == 0) {
935 if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) {
936 playerStatus->hazardType = HAZARD_TYPE_LAVA;
938 }
939 } else {
941 }
942 }
943 break;
944 default:
945 cond = FALSE;
946 if (collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT) {
947 cond = get_entity_type(collisionStatus->curFloor) == ENTITY_TYPE_HIDDEN_PANEL;
948 }
949
950 if (playerStatus->actionState != ACTION_STATE_STEP_UP && !cond) {
951 if (!(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS)) {
952 if (playerY - playerStatus->pos.y < 6.0f) {
953 playerStatus->pos.y = playerY;
954 } else {
956 StepUpLastY = playerY;
957 StepUpLastYaw = playerStatus->targetYaw;
958 }
959 } else {
960 playerStatus->pos.y = playerY;
961 }
963 }
964 break;
965 }
966 } else if (!(playerStatus->flags & PS_FLAG_FLYING)
968 ) {
969 if (outLength <= collHeightHalf + temp_f24 && hitDirX == 0.0f && hitDirZ == 0.0f) {
971 } else {
973 }
975 }
976}
s32 phys_should_player_be_sliding(void)
Definition 7BB60.c:839
f32 StepUpLastYaw
Definition 7BB60.c:9
f32 StepUpLastY
Definition 7BB60.c:10
void phys_save_ground_pos(void)
Definition 7BB60.c:1203
@ PS_FLAG_AIRBORNE
Definition enums.h:3033
@ PS_FLAG_SLIDING
Definition enums.h:3038
@ ENTITY_TYPE_HIDDEN_PANEL
Definition enums.h:2585
@ PA_FLAG_USING_PEACH_PHYSICS
Definition enums.h:3103
@ ACTION_STATE_USE_SPINNING_FLOWER
Definition enums.h:2457
f32 get_player_normal_pitch(void)
Definition 43F0.c:662

Referenced by phys_update_standard().

◆ func_800E4AD8()

void func_800E4AD8 ( s32 mode)

Definition at line 978 of file 7BB60.c.

978 {
979 f32 camYaw = gCameras[gCurrentCameraID].curYaw;
980
982}

◆ func_800E4B40()

void func_800E4B40 ( s32 mode,
f32 * outX,
f32 * outY,
f32 * outZ )

Definition at line 984 of file 7BB60.c.

984 {
985 f32 camYaw = gCameras[gCurrentCameraID].curYaw;
986
987 func_800E4404(mode, 0, gPlayerStatus.spriteFacingAngle - 90.0f + camYaw, outX, outY, outZ);
988}
HitID func_800E4404(s32 mode, s32 offsetY, f32 arg2, f32 *outX, f32 *outY, f32 *outZ)
Definition 7BB60.c:790

◆ collision_lava_reset_check_additional_overlaps()

void collision_lava_reset_check_additional_overlaps ( void )

Definition at line 990 of file 7BB60.c.

990 {
991 PlayerStatus* playerStatus = &gPlayerStatus;
992 f32 x, y, z;
993 f32 yaw;
994
995 if (playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS) {
997 return;
998 }
999
1000 yaw = clamp_angle(playerStatus->targetYaw - 30.0);
1001 y = playerStatus->pos.y + (playerStatus->colliderHeight * 0.75f);
1002 x = playerStatus->pos.x;
1003 z = playerStatus->pos.z;
1005 playerStatus->pos.x = x;
1006 playerStatus->pos.z = z;
1007
1008 yaw = clamp_angle(playerStatus->targetYaw + 30.0);
1009 y = playerStatus->pos.y + (playerStatus->colliderHeight * 0.75f);
1010 x = playerStatus->pos.x;
1011 z = playerStatus->pos.z;
1013 playerStatus->pos.x = x;
1014 playerStatus->pos.z = z;
1015
1016 yaw = clamp_angle(playerStatus->targetYaw - 30.0);
1017 x = playerStatus->pos.x;
1018 y = playerStatus->pos.y;
1019 z = playerStatus->pos.z;
1021 playerStatus->pos.x = x;
1022 playerStatus->pos.z = z;
1023
1024 yaw = clamp_angle(playerStatus->targetYaw + 30.0);
1025 x = playerStatus->pos.x;
1026 y = playerStatus->pos.y;
1027 z = playerStatus->pos.z;
1029 playerStatus->pos.x = x;
1030 playerStatus->pos.z = z;
1031
1032 yaw = clamp_angle(playerStatus->targetYaw + 90.0);
1033 x = playerStatus->pos.x;
1034 y = playerStatus->pos.y;
1035 z = playerStatus->pos.z;
1037 playerStatus->pos.x = x;
1038 playerStatus->pos.z = z;
1039 yaw = clamp_angle(playerStatus->targetYaw - 90.0);
1040
1041 x = playerStatus->pos.x;
1042 y = playerStatus->pos.y;
1043 z = playerStatus->pos.z;
1045 playerStatus->pos.x = x;
1046 playerStatus->pos.z = z;
1047
1048 yaw = clamp_angle(playerStatus->targetYaw + 180.0);
1049 x = playerStatus->pos.x;
1050 y = playerStatus->pos.y;
1051 z = playerStatus->pos.z;
1053 playerStatus->pos.x = x;
1054 playerStatus->pos.z = z;
1055}
void collision_lateral_peach(void)
Definition 7BB60.c:1057

Referenced by action_update_use_spinning_flower(), and phys_update_lava_reset().

◆ collision_lateral_peach()

void collision_lateral_peach ( void )

Definition at line 1057 of file 7BB60.c.

1057 {
1058 PlayerStatus* playerStatus = &gPlayerStatus;
1059 s32 climbableStep = FALSE;
1060 f32 yaw = playerStatus->targetYaw;
1061 f32 x = playerStatus->pos.x;
1062 f32 y = playerStatus->pos.y;
1063 f32 z = playerStatus->pos.z;
1064 HitID wall = player_test_move_without_slipping(&gPlayerStatus, &x, &y, &z, 0, yaw, &climbableStep);
1065
1066 playerStatus->pos.x = x;
1067 playerStatus->pos.z = z;
1068
1069 // If there was a climbable step in this direction, but no wall, we can climb up it
1070 if (climbableStep
1071 && wall <= NO_COLLIDER
1072 && playerStatus->actionState != ACTION_STATE_STEP_UP_PEACH
1073 && playerStatus->curSpeed != 0.0f
1074 ) {
1076 }
1077}
@ ACTION_STATE_STEP_UP_PEACH
Definition enums.h:2452
HitID player_test_move_without_slipping(PlayerStatus *, f32 *, f32 *, f32 *, f32, f32, s32 *)
Only used for Peach physics.
Definition 77480.c:496

Referenced by collision_lava_reset_check_additional_overlaps(), and phys_update_standard().

◆ check_input_midair_jump()

void check_input_midair_jump ( void )

Definition at line 1079 of file 7BB60.c.

1079 {
1083 && gPlayerStatus.timeInAir < 18
1085 ) {
1086 switch (gPlayerData.bootsLevel) {
1087 case 0:
1088 break;
1089 case 1:
1092 break;
1093 case 2:
1096 break;
1097 }
1098 }
1099}
@ PA_FLAG_8BIT_MARIO
Definition enums.h:3105

Referenced by phys_update_standard().

◆ get_current_partner_id()

s8 get_current_partner_id ( void )

Definition at line 1101 of file 7BB60.c.

1101 {
1102 return gPlayerData.curPartner;
1103}

Referenced by collision_main_lateral(), and entity_try_partner_interaction_trigger().

◆ try_player_footstep_sounds()

void try_player_footstep_sounds ( s32 interval)

Definition at line 1105 of file 7BB60.c.

1105 {
1106 if (gGameStatusPtr->frameCounter % interval == 0) {
1108 s32 soundID, altSoundID;
1109
1110 if (surfaceType == SURFACE_TYPE_FLOWERS || surfaceType == SURFACE_TYPE_HEDGES) {
1111 soundID = SOUND_STEP_CRUNCHY1;
1112 altSoundID = SOUND_STEP_CRUNCHY2;
1113 } else {
1114 soundID = SOUND_STEP_NORMAL1;
1115 altSoundID = SOUND_STEP_NORMAL2;
1116 }
1117
1118 if (FootstepSoundSelector == 0) {
1119 soundID = altSoundID;
1120 }
1121
1124 }
1125}
s16 FootstepSoundSelector
Definition 7BB60.c:12
@ SURFACE_TYPE_HEDGES
used within hedge maze in flo_11
Definition enums.h:4679
@ SURFACE_TYPE_FLOWERS
Definition enums.h:4676
@ SOUND_STEP_NORMAL1
Definition enums.h:759
@ SOUND_STEP_CRUNCHY1
Definition enums.h:761
@ SOUND_STEP_CRUNCHY2
Definition enums.h:762
@ SOUND_STEP_NORMAL2
Definition enums.h:760
GameStatus * gGameStatusPtr
Definition main_loop.c:32

Referenced by action_update_run(), action_update_step_up_peach(), and action_update_walk().

◆ phys_update_interact_collider()

void phys_update_interact_collider ( void )

◆ phys_can_player_interact()

s32 phys_can_player_interact ( void )

Definition at line 1159 of file 7BB60.c.

1159 {
1160 s32 ret = TRUE;
1161
1165 ret = FALSE;
1166 }
1167 } else {
1168 ret = FALSE;
1169 }
1173 ret = FALSE;
1174 }
1175 return ret;
1176}
@ PARTNER_ACTION_BOMBETTE_2
Definition enums.h:2937
@ PARTNER_BOMBETTE
Definition enums.h:2888

Referenced by check_for_interactables(), func_800E06D8(), should_collider_allow_interact(), should_continue_inspect(), and update_triggers().

◆ player_get_side_angle()

f32 player_get_side_angle ( void )

Definition at line 1178 of file 7BB60.c.

1178 {
1180
1181 if (deltaYaw < -5.0f && deltaYaw > -175.0f) {
1182 deltaYaw = 0.0f;
1183 } else if (deltaYaw > 5.0f && deltaYaw < 175.0f) {
1184 deltaYaw = 180.0f;
1185 } else {
1186 deltaYaw = PrevPlayerCamRelativeYaw;
1187 }
1188 return clamp_angle(deltaYaw - 90.0f + gCameras[gCurrentCameraID].curYaw);
1189}
f32 get_clamped_angle_diff(f32, f32)
Definition 43F0.c:606
s32 PrevPlayerCamRelativeYaw
Definition 7E9D0.c:31

Referenced by action_hammer_end_swing(), action_hammer_play_hit_fx(), action_hammer_test_swing_collision(), entity_StarBoxLauncher_check_launch(), parasol_get_npc(), partner_flying_follow_player(), and partner_walking_follow_player().

◆ player_get_camera_facing_angle()

f32 player_get_camera_facing_angle ( void )

Definition at line 1191 of file 7BB60.c.

1191 {
1192 f32 angle = 0.0f;
1193
1195 angle = 180.0f;
1196 }
1197
1198 angle = angle + gCameras[CAM_DEFAULT].curYaw + 90.0f;
1199
1200 return clamp_angle(angle);
1201}

Referenced by entity_ItemBlock_spawn_item(), and entity_WoodenCrate_shatter().

Variable Documentation

◆ gCollisionStatus

◆ JumpedOnSwitchX

f32 JumpedOnSwitchX

Definition at line 7 of file 7BB60.c.

Referenced by action_update_landing_on_switch(), and handle_jumping_land_on_switch().

◆ JumpedOnSwitchZ

f32 JumpedOnSwitchZ

Definition at line 8 of file 7BB60.c.

Referenced by action_update_landing_on_switch(), and handle_jumping_land_on_switch().

◆ StepUpLastYaw

f32 StepUpLastYaw

Definition at line 9 of file 7BB60.c.

Referenced by phys_main_collision_below().

◆ StepUpLastY

f32 StepUpLastY

Definition at line 10 of file 7BB60.c.

Referenced by phys_main_collision_below().

◆ FootstepSoundSelector

s16 FootstepSoundSelector = 0

Definition at line 12 of file 7BB60.c.

Referenced by try_player_footstep_sounds().

◆ GravityParamsStartJump

f32 GravityParamsStartJump[] = { 15.7566404343f, -7.38624f, 3.44693994522f, -0.75f }

Definition at line 269 of file 7BB60.c.

269{ 15.7566404343f, -7.38624f, 3.44693994522f, -0.75f };

Referenced by phys_init_integrator_for_current_state().

◆ GravityParamsStartFall

f32 GravityParamsStartFall[] = { 0.154342994094f, -0.350080013275f, -0.182262003422f, 0.0115200001746f }

Definition at line 270 of file 7BB60.c.

270{ 0.154342994094f, -0.350080013275f, -0.182262003422f, 0.0115200001746f };

Referenced by gravity_use_fall_parms().

◆ PlayerSlidingCallback

b32(* PlayerSlidingCallback) (void) ( void ) = NULL

Definition at line 837 of file 7BB60.c.

Referenced by phys_set_player_sliding_check(), and phys_should_player_be_sliding().