Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
77480.c
Go to the documentation of this file.
1#include "common.h"
2#include "ld_addrs.h"
3#include "world/disguise.h"
4#include "world/surfaces.h"
5#include "sprite.h"
7#include "sprite/player.h"
8#include "dx/debug_menu.h"
9
10#ifdef SHIFT
11#define inspect_icon_VRAM inspect_icon_VRAM
12#define speech_bubble_VRAM speech_bubble_VRAM
13#define pulse_stone_VRAM pulse_stone_VRAM
14#define i_spy_VRAM i_spy_VRAM
15#else
16#define inspect_icon_VRAM (void*)0x802B7000
17#define speech_bubble_VRAM (void*)0x802B7000
18#define pulse_stone_VRAM (void*)0x802B7000
19#define i_spy_VRAM (void*)0x802B7000
20#endif
21
22#if VERSION_JP // TODO remove once segments are split
23extern Addr i_spy_ROM_START;
24extern Addr i_spy_ROM_END;
25extern Addr pulse_stone_ROM_START;
26extern Addr pulse_stone_ROM_END;
27extern Addr speech_bubble_ROM_START;
28extern Addr speech_bubble_ROM_END;
29extern Addr inspect_icon_ROM_START;
30extern Addr inspect_icon_ROM_END;
31#endif
32
38
41
43
44HitID player_raycast_down(f32*, f32*, f32*, f32*);
45HitID player_raycast_up_corner(f32* x, f32* y, f32* z, f32* length);
46HitID player_raycast_general(s32, f32, f32, f32, f32, f32, f32, f32*, f32*, f32*, f32*, f32*, f32*, f32*);
47void player_get_slip_vector(f32* outX, f32* outY, f32 x, f32 y, f32 nX, f32 nY);
48void phys_update_standard(void);
49void phys_update_lava_reset(void);
50void update_player_blink(void);
51void check_for_ispy(void);
52void render_ispy_icon(void);
53void check_for_pulse_stone(void);
54void clear_ispy_icon(void);
56void clear_pulse_stone_icon(void);
61void render_interact_prompt(void);
62void clear_interact_prompt(void);
63void update_partner_timers(void);
64void player_update_sprite(void);
65s32 get_player_back_anim(s32 arg0);
66void appendGfx_player(void* data);
67void appendGfx_player_spin(void* data);
68void update_player_shadow(void);
69s32 partner_use_ability(void);
70
71HitID player_raycast_below(f32 yaw, f32 diameter, f32* outX, f32* outY, f32* outZ, f32* outLength, f32* hitRx, f32* hitRz,
72 f32* hitDirX, f32* hitDirZ) {
73 f32 x, y, z, length;
74 f32 inputX, inputY, inputZ, inputLength;
75 f32 cosTheta;
76 f32 sinTheta;
77 f32 temp_f20;
78 f32 cosTemp;
79 f32 sinTemp;
80 s32 hitID;
81 s32 ret;
82
83 *hitRx = 0.0f;
84 *hitRz = 0.0f;
85 *hitDirX = 0.0f;
86 *hitDirZ = 0.0f;
87 inputLength = *outLength;
88 temp_f20 = diameter * 0.28f;
89 sin_cos_rad(DEG_TO_RAD(yaw), &sinTheta, &cosTheta);
90 sinTemp = temp_f20 * sinTheta;
91 cosTemp = -temp_f20 * cosTheta;
92 inputX = *outX;
93 inputY = *outY;
94 inputZ = *outZ;
95
96 x = inputX + sinTemp;
97 y = inputY;
98 z = inputZ + cosTemp;
99 length = inputLength;
100 hitID = player_raycast_down(&x, &y, &z, &length);
101 ret = NO_COLLIDER;
102 if (hitID > NO_COLLIDER && length <= fabsf(*outLength)) {
105 *outX = x;
106 *outY = y;
107 *outZ = z;
108 *outLength = length;
109 *hitDirX = sinTemp;
110 *hitDirZ = cosTemp;
111 ret = hitID;
112 }
113
114 x = inputX - sinTemp;
115 y = inputY;
116 z = inputZ - cosTemp;
117 length = inputLength;
118 hitID = player_raycast_down(&x, &y, &z, &length);
119 if (hitID > NO_COLLIDER && length <= fabsf(*outLength)) {
122 *outX = x;
123 *outY = y;
124 *outZ = z;
125 *outLength = length;
126 *hitDirX = -sinTemp;
127 *hitDirZ = -cosTemp;
128 ret = hitID;
129 }
130
131 // @bug duplicate test -- same as first one. should be +/-?
132 x = inputX + cosTemp;
133 y = inputY;
134 z = inputZ + sinTemp;
135 length = inputLength;
136 hitID = player_raycast_down(&x, &y, &z, &length);
137 if (hitID > NO_COLLIDER && length <= fabsf(*outLength)) {
140 *outX = x;
141 *outY = y;
142 *outZ = z;
143 *outLength = length;
144 *hitDirX = sinTemp;
145 *hitDirZ = cosTemp;
146 ret = hitID;
147 }
148
149 // @bug duplicate test -- same as second one. should be -/+?
150 x = inputX - cosTemp;
151 y = inputY;
152 z = inputZ - sinTemp;
153 length = inputLength;
154 hitID = player_raycast_down(&x, &y, &z, &length);
155 if (hitID > NO_COLLIDER && length <= fabsf(*outLength)) {
158 *outX = x;
159 *outY = y;
160 *outZ = z;
161 *outLength = length;
162 *hitDirX = -sinTemp;
163 *hitDirZ = -cosTemp;
164 ret = hitID;
165 }
166
167 x = inputX;
168 y = inputY;
169 z = inputZ;
170 length = inputLength;
171 hitID = player_raycast_down(&x, &y, &z, &length);
172 if (hitID > NO_COLLIDER && length <= fabsf(*outLength)) {
175 *outX = x;
176 *outY = y;
177 *outZ = z;
178 *outLength = length;
179 *hitDirX = 0.0f;
180 *hitDirZ = 0.0f;
181 ret = hitID;
182 }
183
184 if (ret <= NO_COLLIDER) {
185 *outX = x;
186 *outY = y;
187 *outZ = z;
188 }
189
190 return ret;
191}
192
193HitID player_raycast_below_cam_relative(PlayerStatus* playerStatus, f32* outX, f32* outY, f32* outZ, f32* outLength,
194 f32* hitRx, f32* hitRz, f32* hitDirX, f32* hitDirZ) {
195 f32 yaw = 0.0f;
196
197 if (playerStatus->spriteFacingAngle >= 90.0f && playerStatus->spriteFacingAngle < 270.0f) {
198 yaw = 180.0f;
199 }
200
201 return player_raycast_below(yaw - 90.0f + gCameras[gCurrentCameraID].curYaw, playerStatus->colliderDiameter,
202 outX, outY, outZ, outLength, hitRx, hitRz, hitDirX, hitDirZ);
203}
204
205HitID player_raycast_down(f32* x, f32* y, f32* z, f32* length) {
206 f32 hitX;
207 f32 hitY;
208 f32 hitZ;
209 f32 hitDepth;
210 f32 hitNx;
211 f32 hitNy;
212 f32 hitNz;
213 s32 entityID, colliderID;
214 Entity* entity;
215 s32 ret = NO_COLLIDER;
216
217 hitDepth = *length;
218 entityID = test_ray_entities(*x, *y, *z, 0.0f, -1.0f, 0.0f, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
219 if (entityID > NO_COLLIDER) {
220 entity = get_entity_by_index(entityID);
221 if (entity->alpha < 255) {
222 entity->collisionTimer = 4;
224 } else {
225 ret = entityID | COLLISION_WITH_ENTITY_BIT;
226 }
227 }
228
229 colliderID = test_ray_colliders(COLLIDER_FLAG_IGNORE_PLAYER, *x, *y, *z, 0, -1.0f, 0, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
230 if (colliderID > NO_COLLIDER) {
231 ret = colliderID;
232 }
233
234 if (ret > NO_COLLIDER) {
235 *length = hitDepth;
236 *x = hitX;
237 *y = hitY;
238 *z = hitZ;
244 gGameStatusPtr->playerGroundTraceAngles.x = atan2(0.0f, 0.0f, hitNz * 100.0, hitNy * 100.0);
246 gGameStatusPtr->playerGroundTraceAngles.z = atan2(0.0f, 0.0f, hitNx * 100.0, hitNy * 100.0);
247 } else {
251 }
252 return ret;
253}
254
255HitID player_raycast_up_corners(PlayerStatus* player, f32* posX, f32* posY, f32* posZ, f32* hitDepth, f32 yaw) {
256 f32 startX;
257 f32 startY;
258 f32 startZ;
259 f32 depth;
260 f32 theta;
261 f32 deltaZ;
262 f32 deltaX;
263 f32 x,y,z;
264 s32 ret;
265 s32 hitID;
266 f32 radius;
267
268 radius = player->colliderDiameter * 0.3f;
269 theta = DEG_TO_RAD(yaw);
270 deltaX = radius * sin_rad(theta);
271 deltaZ = -radius * cos_rad(theta);
272
273 x = *posX;
274 y = *posY;
275 z = *posZ;
276
277 depth = *hitDepth;
278 startX = x + deltaX;
279 startY = y;
280 startZ = z + deltaZ;
281
282 ret = NO_COLLIDER;
283 hitID = player_raycast_up_corner(&startX, &startY, &startZ, &depth);
284
285 if (hitID <= NO_COLLIDER) {
286 startX = x - deltaX;
287 startY = y;
288 startZ = z - deltaZ;
289 hitID = player_raycast_up_corner(&startX, &startY, &startZ, &depth);
290 }
291
292 if (hitID <= NO_COLLIDER) {
293 startX = x + deltaZ;
294 startY = y;
295 startZ = z + deltaX;
296 hitID = player_raycast_up_corner(&startX, &startY, &startZ, &depth);
297 }
298
299 if (hitID <= NO_COLLIDER) {
300 startX = x - deltaZ;
301 startY = y;
302 startZ = z - deltaX;
303 hitID = player_raycast_up_corner(&startX, &startY, &startZ, &depth);
304 }
305
306 if (hitID > NO_COLLIDER) {
307 *posX = startX;
308 *posY = startY;
309 *posZ = startZ;
310 *hitDepth = depth;
311 ret = hitID;
312 }
313
314 if (ret <= NO_COLLIDER) {
315 *posX = startX;
316 *posY = startY;
317 *posZ = startZ;
318 *hitDepth = 0;
319 }
320
321 return ret;
322}
323
324HitID player_raycast_up_corner(f32* x, f32* y, f32* z, f32* length) {
325 f32 hitX;
326 f32 hitY;
327 f32 hitZ;
328 f32 hitDepth;
329 f32 hitNx;
330 f32 hitNy;
331 f32 hitNz;
332 s32 hitID;
333 s32 ret;
334 f32 sx, sy, sz;
335 f32 sx2, sy2, sz2;
336
337 ret = NO_COLLIDER;
338
339 // needed to match
340 sx2 = sx = *x;
341 sy2 = sy = *y;
342 sz2 = sz = *z;
343 hitDepth = *length;
344 hitID = test_ray_colliders(COLLIDER_FLAG_IGNORE_PLAYER, sx, sy, sz, 0.0f, 1.0f, 0.0f, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
345 if (hitID > NO_COLLIDER && *length > hitDepth) {
346 *length = hitDepth;
347 ret = hitID;
348 *x = sx = sx2;
349 *y = sy = sy2;
350 *z = sz = sz2;
351 }
352
353 hitDepth = 10.0f;
354 hitID = test_ray_entities(*x, *y, *z, 0.0f, 1.0f, 0.0f, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
355 sx = sx2;
356 sy = sy2;
357 sz = sz2;
358 if (hitID > NO_COLLIDER && *length > hitDepth) {
359 get_entity_by_index(hitID);
360 ret = hitID | COLLISION_WITH_ENTITY_BIT;
361 *length = hitDepth;
362 *x = sx;
363 *y = sy;
364 *z = sz;
365 }
366
367 return ret;
368}
369
370HitID player_test_lateral_overlap(s32 mode, PlayerStatus* playerStatus, f32* x, f32* y, f32* z, f32 length, f32 yaw) {
371 f32 sinTheta;
372 f32 cosTheta;
373 f32 hitX;
374 f32 hitY;
375 f32 hitZ;
376 f32 hitDepth;
377 f32 hitNx;
378 f32 hitNy;
379 f32 hitNz;
380 f32 slipDx;
381 f32 slipDz;
382 f32 depthDiff;
383 f32 radius;
384 f32 originalDepth;
385 s32 hitID;
386 f32 height;
387 f32 targetDx;
388 f32 targetDz;
389 f32 dx;
390 f32 dz;
391 s32 ret;
392
393 radius = playerStatus->colliderDiameter * 0.5f;
394 ret = NO_COLLIDER;
395
396 if (!(playerStatus->flags & (PS_FLAG_FALLING | PS_FLAG_JUMPING))) {
397 height = playerStatus->colliderHeight * 0.286f;
398 } else {
399 height = 1.0f;
400 }
401
402 sin_cos_rad(DEG_TO_RAD(yaw), &sinTheta, &cosTheta);
403 cosTheta = -cosTheta;
404 hitDepth = length + radius;
405 hitID = player_raycast_general(mode, *x, *y + height, *z, sinTheta, 0, cosTheta, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
406
407 if (mode == PLAYER_COLLISION_HAMMER) {
408 targetDx = 0.0f;
409 targetDz = 0.0f;
410 } else {
411 targetDx = length * sinTheta;
412 targetDz = length * cosTheta;
413 }
414
415 if (hitID > NO_COLLIDER) {
416 originalDepth = length + radius;
417 if (hitDepth <= originalDepth) {
418 depthDiff = hitDepth - originalDepth;
419 dx = depthDiff * sinTheta;
420 dz = depthDiff * cosTheta;
421
422 player_get_slip_vector(&slipDx, &slipDz, targetDx, targetDz, hitNx, hitNz);
423 *x += dx + slipDx;
424 *z += dz + slipDz;
425 ret = hitID;
426 }
427 }
428
429 *x += targetDx;
430 *z += targetDz;
431 return ret;
432}
433
434HitID player_raycast_general(s32 mode, f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32* hitX,
435 f32* hitY, f32* hitZ, f32* hitDepth, f32*hitNx, f32* hitNy, f32* hitNz) {
436 f32 nAngleX;
437 f32 nAngleZ;
438 s32 entityID;
439 s32 colliderID;
440 Entity* entity;
441 s32 ignoreFlags;
442 s32 ret;
443
444 #if DX_DEBUG_MENU
445 if (dx_debug_is_cheat_enabled(DEBUG_CHEAT_IGNORE_WALLS)) {
446 return NO_COLLIDER;
447 }
448 #endif
449
450 entityID = test_ray_entities(startX, startY, startZ, dirX, dirY, dirZ, hitX, hitY, hitZ, hitDepth, hitNx, hitNy,
451 hitNz);
452 ret = NO_COLLIDER;
453 if (entityID > NO_COLLIDER) {
454 entity = get_entity_by_index(entityID);
455 if (entity->alpha < 255) {
456 entity->collisionTimer = 0;
458 } else {
459 ret = entityID | COLLISION_WITH_ENTITY_BIT;
460 }
461 } else if (mode == PLAYER_COLLISION_HAMMER) {
462 ret = test_ray_colliders(COLLIDER_FLAG_IGNORE_SHELL, startX, startY, startZ, dirX, dirY, dirZ,
463 hitX, hitY, hitZ, hitDepth, hitNx, hitNy, hitNz);
464 }
465
466 if (mode == PLAYER_COLLISION_1 || mode == PLAYER_COLLISION_HAMMER) {
467 return ret;
468 }
469
470 if (mode == PLAYER_COLLISION_4) {
471 ignoreFlags = COLLIDER_FLAG_DOCK_WALL;
472 } else {
473 ignoreFlags = COLLIDER_FLAG_IGNORE_PLAYER;
474 }
475
476 colliderID = test_ray_colliders(ignoreFlags, startX, startY, startZ, dirX, dirY, dirZ,
477 hitX, hitY, hitZ, hitDepth, hitNx, hitNy, hitNz);
478
479 if (ret <= NO_COLLIDER) {
480 ret = colliderID;
481 }
482
483 if (ret > NO_COLLIDER) {
484 nAngleZ = 180.0f - atan2(0, 0, *hitNz * 100.0, *hitNy * 100.0);
485 nAngleX = 180.0f - atan2(0, 0, *hitNx * 100.0, *hitNy * 100.0);
486
487 if (!((nAngleZ == 90.0f && nAngleX == 90.0f) || fabs(nAngleZ) >= 30.0 || fabs(nAngleX) >= 30.0)) {
488 ret = NO_COLLIDER;
489 }
490 }
491
492 return ret;
493}
494
496HitID player_test_move_without_slipping(PlayerStatus* playerStatus, f32* x, f32* y, f32* z, f32 length, f32 yaw, s32* hasClimbableStep) {
497 f32 sinTheta;
498 f32 cosTheta;
499 f32 hitX;
500 f32 hitY;
501 f32 hitZ;
502 f32 hitDepth;
503 f32 hitNx;
504 f32 hitNy;
505 f32 hitNz;
506 f32 slipDx;
507 f32 slipDz;
508 f32 depth;
509 f32 radius;
510 f32 depthDiff;
511 f32 height;
512 s32 ret;
513 s32 hitID;
514 f32 targetDx;
515 f32 targetDz;
516 f32 dx, dz;
517
518 radius = playerStatus->colliderDiameter * 0.5f;
519 height = playerStatus->colliderHeight * 0.286f;
520 sin_cos_rad(DEG_TO_RAD(yaw), &sinTheta, &cosTheta);
521
522 depth = length + radius;
523 cosTheta = -cosTheta;
524 hitDepth = depth;
525 dx = radius * sinTheta;
526 ret = NO_COLLIDER;
527
528 hitID = player_raycast_general(PLAYER_COLLISION_0, *x, *y + 0.1, *z, sinTheta, 0, cosTheta, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
529 if (hitID > NO_COLLIDER && hitDepth <= depth) {
530 *hasClimbableStep = TRUE;
531 }
532
533 depth = length + radius;
534 hitDepth = depth;
535 dz = radius * cosTheta;
536
537 hitID = player_raycast_general(PLAYER_COLLISION_0, *x, *y + height, *z, sinTheta, 0, cosTheta, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
538
539 targetDx = 0.0f;
540 targetDz = 0.0f;
541
542 if (hitID > NO_COLLIDER && hitDepth <= depth) {
543 depthDiff = hitDepth - depth;
544 dx = depthDiff * sinTheta;
545 dz = depthDiff * cosTheta;
546 player_get_slip_vector(&slipDx, &slipDz, 0.0f, 0.0f, hitNx, hitNz);
547 *x += dx + slipDx;
548 *z += dz + slipDz;
549 ret = hitID;
550 }
551 *x += targetDx;
552 *z += targetDz;
553 return ret;
554}
555
556void player_get_slip_vector(f32* outX, f32* outY, f32 x, f32 y, f32 nX, f32 nY) {
557 f32 projectionLength = (x * nX) + (y * nY);
558
559 *outX = (x - projectionLength * nX) * 0.5f;
560 *outY = (y - projectionLength * nY) * 0.5f;
561}
562
563HitID player_test_move_with_slipping(PlayerStatus* playerStatus, f32* x, f32* y, f32* z, f32 length, f32 yaw) {
564 f32 sinTheta;
565 f32 cosTheta;
566 f32 hitX;
567 f32 hitY;
568 f32 hitZ;
569 f32 hitDepth;
570 f32 hitNx;
571 f32 hitNy;
572 f32 hitNz;
573 f32 slipDx;
574 f32 slipDz;
575 f32 radius;
576 f32 height;
577 s32 hitID;
578 f32 targetDx, targetDz;
579 f32 dx, dz;
580 f32 depthDiff;
581 s32 ret = NO_COLLIDER;
582
583 height = 0.0f;
584 if (!(playerStatus->flags & (PS_FLAG_JUMPING | PS_FLAG_FALLING))) {
585 height = 10.01f;
586 }
587 radius = playerStatus->colliderDiameter * 0.5f;
588
589 sin_cos_rad(DEG_TO_RAD(yaw), &sinTheta, &cosTheta);
590 cosTheta = -cosTheta;
591 hitDepth = length + radius;
592
593 targetDx = length * sinTheta;
594 targetDz = length * cosTheta;
595
596 hitID = player_raycast_general(PLAYER_COLLISION_0, *x, *y + height, *z, sinTheta, 0, cosTheta, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
597 if (hitID > NO_COLLIDER && (depthDiff = hitDepth, depthDiff <= length + radius)) {
598 depthDiff -= (length + radius);
599 dx = depthDiff * sinTheta;
600 dz = depthDiff * cosTheta;
601 player_get_slip_vector(&slipDx, &slipDz, targetDx, targetDz, hitNx, hitNz);
602 *x += dx + slipDx;
603 *z += dz + slipDz;
604 ret = hitID;
605 } else {
606 height = playerStatus->colliderHeight * 0.75;
607 hitID = player_raycast_general(PLAYER_COLLISION_0, *x, *y + height, *z, sinTheta, 0, cosTheta, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
608 if (hitID > NO_COLLIDER && (depthDiff = hitDepth, depthDiff <= length + radius)) {
609 depthDiff -= (length + radius);
610 dx = depthDiff * sinTheta;
611 dz = depthDiff * cosTheta;
612 player_get_slip_vector(&slipDx, &slipDz, targetDx, targetDz, hitNx, hitNz);
613 *x += dx + slipDx;
614 *z += dz + slipDz;
615 ret = hitID;
616 }
617 }
618
619 *x += targetDx;
620 *z += targetDz;
621 return ret;
622}
623
624// main function for player physics called from state step functions
625void update_player(void) {
626 PlayerStatus* playerStatus = &gPlayerStatus;
627 CollisionStatus* collisionStatus = &gCollisionStatus;
628
629 #if DX_DEBUG_MENU
630 if (dx_debug_is_cheat_enabled(DEBUG_CHEAT_SPEED_MODE)) {
632 gPlayerStatus.runSpeed = 12.0f;
633 }
634 #endif
635
637
638 if ((playerStatus->timeInAir > 100) || (playerStatus->pos.y < -2000.0f)) {
639 if (!(playerStatus->animFlags & PA_FLAG_NO_OOB_RESPAWN)) {
640 playerStatus->timeInAir = 0;
641 playerStatus->pos.x = playerStatus->lastGoodPos.x;
642 playerStatus->pos.y = playerStatus->lastGoodPos.y;
643 playerStatus->pos.z = playerStatus->lastGoodPos.z;
644
645 if (playerStatus->animFlags & PA_FLAG_RIDING_PARTNER) {
646 Npc* partner;
647
649 partner = get_npc_unsafe(NPC_PARTNER);
650 partner->pos.x = playerStatus->lastGoodPos.x;
651 partner->pos.y = playerStatus->lastGoodPos.y + playerStatus->colliderHeight;
652 partner->pos.z = playerStatus->lastGoodPos.z;
653 partner->moveToPos.y = playerStatus->lastGoodPos.y;
654 } else {
655 playerStatus->timeInAir = 10;
656 }
657 }
658 }
659
660 collisionStatus->curWall = NO_COLLIDER;
661 collisionStatus->lastWallHammered = NO_COLLIDER;
662 collisionStatus->curInspect = NO_COLLIDER;
663 collisionStatus->floorBelow = TRUE;
664
666 playerStatus->flags &= ~PS_FLAG_SPECIAL_LAND;
668
669 if (playerStatus->flags & PS_FLAG_NO_STATIC_COLLISION) {
673 }
674 } else if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) {
676 } else {
678 }
679
680 if (playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT) {
681 playerStatus->moveFrames--;
682 if (playerStatus->moveFrames <= 0) {
683 playerStatus->moveFrames = 0;
684 playerStatus->flags &= ~PS_FLAG_CUTSCENE_MOVEMENT;
685 }
686 }
687
688 if (!(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS)) {
690 }
691
693
694 gGameStatus.playerPos.x = playerStatus->pos.x;
695 gGameStatus.playerPos.y = playerStatus->pos.y;
696 gGameStatus.playerPos.z = playerStatus->pos.z;
697 gGameStatus.playerYaw = playerStatus->curYaw;
698
700 if (!(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS)) {
702 }
703
705
710
711 playerStatus->pushVel.x = 0.0f;
712 playerStatus->pushVel.y = 0.0f;
713 playerStatus->pushVel.z = 0.0f;
714 playerStatus->flags &= ~PS_FLAG_SLIDING;
715 playerStatus->animFlags &= ~PA_FLAG_FORCE_USE_PARTNER;
716}
717
719 PlayerStatus* playerStatus = &gPlayerStatus;
720 PlayerData* playerData = &gPlayerData;
721 u32 actionState = playerStatus->actionState;
722
723 if (!(playerStatus->animFlags & PA_FLAG_8BIT_MARIO)
724 && (playerStatus->animFlags & PA_FLAG_FORCE_USE_PARTNER || playerStatus->inputDisabledCount == 0)
725 && (playerStatus->pressedButtons & BUTTON_C_DOWN && !(playerStatus->flags & PS_FLAG_NO_PARTNER_USAGE))
726 && !(playerStatus->pressedButtons & BUTTON_B)
727 && !(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS)
728 && actionState <= ACTION_STATE_RUN
729 ) {
730 if (playerData->curPartner == PARTNER_GOOMBARIO) {
732 }
734 }
735}
736
738 PlayerStatus* playerStatus = &gPlayerStatus;
739
742
743 #if DX_DEBUG_MENU
744 if (dx_debug_is_cheat_enabled(DEBUG_CHEAT_FLY) && playerStatus->curButtons & BUTTON_L) {
745 playerStatus->pos.y += 5.0f;
746 playerStatus->flags |= PS_FLAG_JUMPING;
747 }
748 #endif
749
750 if (!(playerStatus->flags & PS_FLAG_FLYING)) {
751 if (playerStatus->flags & PS_FLAG_JUMPING) {
753 }
754 }
755
756 if (playerStatus->flags & PS_FLAG_FALLING) {
757 if (!(playerStatus->flags & PS_FLAG_FLYING)) {
759 }
760 }
761
763
764 if (playerStatus->actionState != ACTION_STATE_SLIDING) {
767
769 && playerStatus->timeInAir == 0
770 && playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS
771 ) {
773 }
774
776 && playerStatus->actionState != ACTION_STATE_STEP_UP
777 ) {
779 }
780 }
781
782 if (playerStatus->animFlags & PA_FLAG_WATT_IN_HANDS) {
784 }
785
786 if (!(playerStatus->flags & PS_FLAG_CAMERA_DOESNT_FOLLOW)) {
787 gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x;
788 gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y;
789 gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z;
790 }
791}
792
806
810
812 PlayerStatus* playerStatus = &gPlayerStatus;
813
814 mem_clear(playerStatus, sizeof(PlayerStatus));
815 playerStatus->flags = PS_FLAG_HAS_REFLECTION;
817 playerStatus->shadowID = create_shadow_type(SHADOW_VARYING_CIRCLE, playerStatus->pos.x, playerStatus->pos.y,
818 playerStatus->pos.z);
825}
826
838
840 PlayerStatus* playerStatus = &gPlayerStatus;
841 PartnerStatus* partnerStatus = &gPartnerStatus;
842
844 && anim != ANIM_Mario1_Flail
845 && anim != ANIM_Mario1_Jump
846 ) {
847 return -1;
848 }
849
850 if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE) {
851 if (partnerStatus->actingPartner == PARTNER_LAKILESTER && anim == ANIM_Mario1_Idle) {
852 anim = ANIM_MarioW2_RideLaki;
853 }
854
855 if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE
856 && partnerStatus->actingPartner == PARTNER_BOW
857 && anim != ANIM_Mario1_Crouch
858 && anim != ANIM_Mario1_Idle
859 ) {
860 return -1;
861 }
862 }
863
864 if (anim == ANIM_Mario1_ThumbsUp && partnerStatus->partnerActionState == PARTNER_ACTION_USE) {
865 return -1;
866 }
867
868 if (anim == ANIM_MarioW1_Lift || anim == ANIM_Peach2_SpreadArms || anim == ANIM_Mario1_Idle) {
869 if (!(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS)) {
870 if (!is_player_dismounted()) {
871 return -1;
872 }
873 } else if (!(playerStatus->animFlags & PA_FLAG_INVISIBLE)) {
874 anim = ANIM_Peach2_SpreadArms;
875 } else {
877 return -1;
878 }
879 } else if (playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS) {
880 if (playerStatus->peachItemHeld != PEACH_BAKING_NONE
881 && (anim == ANIM_Peach2_RaiseArms || anim == ANIM_Peach2_Talk || anim == ANIM_Peach2_LowerArms)
882 ) {
883 anim = ANIM_Peach3_PresentCompleteCake;
884 }
885 }
886
887 if (anim == ANIM_MarioW2_Collapse) {
888 exec_ShakeCam1(0, 0, 2);
889 }
890
891 return anim;
892}
893
895 PlayerStatus* playerStatus = &gPlayerStatus;
896 AnimID newAnim = get_overriding_player_anim(anim);
897
898 if (newAnim != -1) {
899 playerStatus->anim = newAnim;
900 playerStatus->animNotifyValue = 0;
901 playerStatus->flags &= ~PS_FLAG_FACE_FORWARD;
902 }
903}
904
906 PlayerStatus* playerStatus = &gPlayerStatus;
907
908 playerStatus->anim = anim;
909 playerStatus->animNotifyValue = 0;
910 playerStatus->flags &= ~PS_FLAG_FACE_FORWARD;
911}
912
914 PlayerStatus* playerStatus = &gPlayerStatus;
915 AnimID newAnim = get_overriding_player_anim(anim);
916
917 if (newAnim != -1) {
918 playerStatus->anim = newAnim;
919 playerStatus->animNotifyValue = 0;
920 playerStatus->flags |= PS_FLAG_FACE_FORWARD;
921 }
922}
923
925 PlayerStatus* playerStatus = &gPlayerStatus;
926 s32 outtaSight = FALSE;
927
930 }
931
932 if (playerStatus->blinkTimer > 0) {
933 playerStatus->blinkTimer--;
934
935 if (!(gGameStatusPtr->frameCounter & 1)) {
936 if (outtaSight) {
937 playerStatus->curAlpha = 192;
938 } else {
939 playerStatus->curAlpha = 255;
940 }
941 } else {
942 playerStatus->curAlpha = 96;
943 }
944
945 if (!playerStatus->blinkTimer) {
946 if (outtaSight) {
947 playerStatus->curAlpha = 128;
948 playerStatus->flags |= PS_FLAG_HAZARD_INVINCIBILITY;
949 } else {
950 playerStatus->curAlpha = 255;
951 playerStatus->flags &= ~PS_FLAG_HAZARD_INVINCIBILITY;
952 }
953 } else {
954 playerStatus->flags |= PS_FLAG_HAZARD_INVINCIBILITY;
955 }
956 }
957}
958
959// dist_to_player2D
960f32 get_xz_dist_to_player(f32 x, f32 z) {
961 return dist2D(x, z, gPlayerStatus.pos.x, gPlayerStatus.pos.z);
962}
963
965 get_shadow_by_index(gPlayerStatus.shadowID)->flags &= ~ENTITY_FLAG_HIDDEN;
966}
967
971
973 PlayerStatus* playerStatus = &gPlayerStatus;
974
975 playerStatus->flags |= PS_FLAG_NO_STATIC_COLLISION;
976 playerStatus->enableCollisionOverlapsCheck++;
977 return playerStatus->enableCollisionOverlapsCheck;
978}
979
981 PlayerStatus* playerStatus = &gPlayerStatus;
982
983 playerStatus->enableCollisionOverlapsCheck--;
984 if (playerStatus->enableCollisionOverlapsCheck == 0) {
985 playerStatus->flags &= ~PS_FLAG_NO_STATIC_COLLISION;
986 }
987 return playerStatus->enableCollisionOverlapsCheck;
988}
989
991 PlayerStatus* playerStatus = &gPlayerStatus;
992
993 playerStatus->flags |= PS_FLAG_INPUT_DISABLED;
994 playerStatus->inputDisabledCount++;
995 return playerStatus->inputDisabledCount;
996}
997
999 PlayerStatus* playerStatus = &gPlayerStatus;
1000
1001 playerStatus->inputDisabledCount--;
1002 if (playerStatus->inputDisabledCount == 0) {
1003 playerStatus->flags &= ~PS_FLAG_INPUT_DISABLED;
1004 }
1005 return playerStatus->inputDisabledCount;
1006}
1007
1008void func_800E01DC(void) {
1009 PlayerStatus* playerStatus = &gPlayerStatus;
1010
1011 if (playerStatus->animFlags & PA_FLAG_INTERACT_PROMPT_AVAILABLE) {
1012 playerStatus->flags |= PS_FLAG_INTERACTED;
1013 }
1014}
1015
1025
1026//BEGIN player/prompts.c
1027
1034
1035void check_for_ispy(void) {
1036 PlayerStatus* playerStatus = &gPlayerStatus;
1037
1039 if (!(playerStatus->animFlags &
1041 DMA_COPY_SEGMENT(i_spy);
1043 }
1044 }
1045
1046 if (ISpyNotificationCallback != NULL) {
1048 }
1049}
1050
1056
1059 gPlayerStatusPtr->animFlags &= ~PA_FLAG_ISPY_VISIBLE;
1060}
1061
1064 s32 dx, dy;
1065
1066 if (PulseStoneNotificationCallback == NULL) {
1068 return;
1069 }
1070
1072 return;
1073 }
1074
1075 dx = abs(gGameStatusPtr->mapID % 7 - 2);
1076 dy = gGameStatusPtr->mapID / 7;
1077 if ((dx + dy) > 5) {
1078 return;
1079 }
1080
1082 return;
1083 }
1084
1086 return;
1087 }
1088
1090 DMA_COPY_SEGMENT(pulse_stone);
1092 }
1093 }
1094
1095 if (PulseStoneNotificationCallback != NULL) {
1097 }
1098}
1099
1105
1108 gPlayerStatusPtr->animFlags &= ~PA_FLAG_PULSE_STONE_VISIBLE;
1109}
1110
1112 PlayerStatus* playerStatus = &gPlayerStatus;
1113 Npc* npc = playerStatus->encounteredNPC;
1114 s32 ret = FALSE;
1115 s32 cond;
1116
1117 if (npc != NULL && !(npc->flags & NPC_FLAG_USE_INSPECT_ICON)) {
1118 cond = !(playerStatus->flags & PS_FLAG_INPUT_DISABLED) && (playerStatus->flags & PS_FLAG_HAS_CONVERSATION_NPC);
1119 ret = cond;
1120 }
1121 return ret;
1122}
1123
1126 return;
1127 }
1128
1129 if (TalkNotificationCallback == NULL) {
1131 return;
1132 }
1133
1136 DMA_COPY_SEGMENT(speech_bubble);
1138 } else {
1140 return;
1141 }
1142 }
1143
1144 if (TalkNotificationCallback != NULL) {
1146 }
1147}
1148
1154
1157 gPlayerStatusPtr->animFlags &= ~PA_FLAG_SPEECH_PROMPT_AVAILABLE;
1158}
1159
1160void func_800E06C0(s32 arg0) {
1161 D_8010C950 = (arg0 == 1);
1162}
1163
1164s32 func_800E06D8(void) {
1165 PlayerStatus* playerStatus = &gPlayerStatus;
1166 s32 currentWall;
1167
1168 if (playerStatus->timeInAir != 0 || playerStatus->inputDisabledCount != 0) {
1169 return FALSE;
1170 }
1172 return FALSE;
1173 }
1174 if (playerStatus->flags & PS_FLAG_HAS_CONVERSATION_NPC
1175 && !(playerStatus->flags & PS_FLAG_INPUT_DISABLED)
1176 && playerStatus->encounteredNPC != NULL
1178 ) {
1179 playerStatus->interactingWithID = NO_COLLIDER;
1180 return TRUE;
1181 }
1182
1183 currentWall = gCollisionStatus.curWall;
1184 if (!(currentWall & COLLISION_WITH_ENTITY_BIT)) {
1185 if (!should_collider_allow_interact(currentWall)) {
1186 return FALSE;
1187 }
1188 } else if (!phys_can_player_interact()) {
1189 playerStatus->interactingWithID = NO_COLLIDER;
1190 return FALSE;
1191 } else if (get_entity_type(currentWall) == ENTITY_TYPE_PUSH_BLOCK) {
1192 return FALSE;
1193 }
1194
1195 if (playerStatus->interactingWithID == currentWall) {
1196 if (playerStatus->flags & PS_FLAG_INTERACTED) {
1197 return FALSE;
1198 }
1199 } else {
1200 playerStatus->flags &= ~PS_FLAG_INTERACTED;
1201 }
1202 playerStatus->interactingWithID = NO_COLLIDER;
1203
1204 return TRUE;
1205}
1206
1208 PlayerStatus* playerStatus = &gPlayerStatus;
1210 b32 collidingWithEntity = FALSE;
1211
1213 return;
1214 }
1215
1216 if (InteractNotificationCallback == NULL) {
1217 s32 curInteraction = gCollisionStatus.curWall;
1218
1219 if (playerStatus->inputDisabledCount != 0) {
1220 if (gPlayerStatus.interactingWithID != curInteraction) {
1221 gPlayerStatus.interactingWithID = curInteraction;
1222 }
1223 return;
1224 }
1225
1226 if (playerStatus->timeInAir != 0) {
1227 return;
1228 }
1229
1230 if (curInteraction == NO_COLLIDER) {
1231 s32 floor = gCollisionStatus.curFloor;
1232
1233 if ((floor > NO_COLLIDER) && (floor & COLLISION_WITH_ENTITY_BIT)) {
1234 collidingWithEntity = TRUE;
1235 curInteraction = floor;
1236 switch (get_entity_type(floor)) {
1242 case ENTITY_TYPE_CHEST:
1244 curInteraction = NO_COLLIDER;
1245 break;
1246 }
1247 } else if (
1248 (!(playerStatus->flags & PS_FLAG_INPUT_DISABLED))
1249 && (playerStatus->flags & PS_FLAG_HAS_CONVERSATION_NPC)
1250 && (npc != NULL)
1252 ) {
1253 curInteraction = npc->npcID | COLLISION_WITH_NPC_BIT;
1254 if (playerStatus->interactingWithID == curInteraction) {
1255 return;
1256 }
1257 } else {
1258 playerStatus->interactingWithID = NO_COLLIDER;
1259 playerStatus->flags &= ~PS_FLAG_INTERACTED;
1260 return;
1261 }
1262 } else {
1263 if (curInteraction & COLLISION_WITH_ENTITY_BIT) {
1264 collidingWithEntity = TRUE;
1265 if (!phys_can_player_interact()) {
1266 playerStatus->interactingWithID = NO_COLLIDER;
1267 playerStatus->flags &= ~PS_FLAG_INTERACTED;
1268 return;
1269 }
1270 } else {
1271 if (!(curInteraction & COLLISION_WITH_NPC_BIT)) {
1272 if (!should_collider_allow_interact(curInteraction)) {
1273 playerStatus->interactingWithID = NO_COLLIDER;
1274 playerStatus->flags &= ~PS_FLAG_INTERACTED;
1275 return;
1276 }
1277 }
1278 }
1279 }
1280 if (playerStatus->interactingWithID == curInteraction) {
1281 if ((playerStatus->flags & PS_FLAG_INTERACTED)) {
1282 return;
1283 }
1284 } else {
1285 playerStatus->flags &= ~PS_FLAG_INTERACTED;
1286 }
1287
1288 playerStatus->interactingWithID = curInteraction;
1289 if (!collidingWithEntity || (curInteraction > NO_COLLIDER && get_entity_by_index(curInteraction)->flags & ENTITY_FLAG_SHOWS_INSPECT_PROMPT)) {
1290 if (playerStatus->actionState == ACTION_STATE_IDLE || playerStatus->actionState == ACTION_STATE_WALK || playerStatus->actionState == ACTION_STATE_RUN) {
1292 func_800EF3D4(2);
1293 }
1294 }
1295 }
1296
1297 if (!(playerStatus->animFlags & PA_FLAG_INTERACT_PROMPT_AVAILABLE)) {
1298 func_800EF3D4(0);
1300 return;
1301 }
1302
1303 if (InteractNotificationCallback == NULL) {
1304 DMA_COPY_SEGMENT(inspect_icon);
1306
1307 }
1308
1309 if (InteractNotificationCallback != NULL) {
1311 }
1312}
1313
1314void appendGfx_interact_prompt(void);
1315
1321
1324 gPlayerStatusPtr->animFlags &= ~PA_FLAG_INTERACT_PROMPT_AVAILABLE;
1325}
1326
1327//END player/prompts.c
1328
1330 PlayerData* playerData = &gPlayerData;
1331
1333 s32 i;
1334
1335 for (i = 1; i < ARRAY_COUNT(playerData->partnerUnlockedTime); i++) {
1336 if (playerData->partners[i].enabled) {
1337 playerData->partnerUnlockedTime[i]++;
1338 }
1339 }
1340 }
1341}
1342
1343//BEGIN player/render.c
1344
1345f32 D_800F7B48 = 0.0f; // always zero, remove?
1346
1348 PlayerStatus* playerStatus = &gPlayerStatus;
1349 f32 cameraYaw = gCameras[gCurrentCameraID].curYaw;
1350 f32 camRelativeYaw = get_clamped_angle_diff(cameraYaw, playerStatus->curYaw);
1351 s32 trueAnim;
1352 s32 sprIndex;
1353 f32 angle;
1354 s32 direction;
1355 f32 timescale;
1356
1357 D_800F7B48 = 0.0f;
1358 if (camRelativeYaw < -5.0f && camRelativeYaw > -175.0f) {
1359 camRelativeYaw = 0.0f;
1360 direction = 0;
1361 } else if (camRelativeYaw > 5.0f && camRelativeYaw < 175.0f) {
1362 camRelativeYaw = 180.0f;
1363 direction = 1;
1364 } else {
1365 // direction is close to flipping, use saved value
1366 camRelativeYaw = PrevPlayerCamRelativeYaw;
1367 direction = 2;
1368 }
1369 // detect direction change
1370 if (PrevPlayerDirection != direction && direction != 2) {
1371 PrevPlayerDirection = direction;
1372 playerStatus->flipYaw[gCurrentCameraID] = (direction != 0) ? 180.0f : -180.0f;
1373
1374 if (fabsf(get_clamped_angle_diff(cameraYaw, playerStatus->curYaw)) >= 90.0f) {
1375 playerStatus->flipYaw[gCurrentCameraID] = -playerStatus->flipYaw[gCurrentCameraID];
1376 }
1377 }
1378 // handle sprite 'flipping' when changing direction
1379 angle = playerStatus->flipYaw[gCurrentCameraID];
1380 if (angle != 0.0f) {
1381 if (angle < 0.0f) {
1382 angle += 28.0f;
1383 if (angle > 0.0f) {
1384 angle = 0.0f;
1385 }
1386 }
1387 if (angle > 0.0f) {
1388 angle -= 28.0f;
1389 if (angle < 0.0f) {
1390 angle = 0.0f;
1391 }
1392 }
1393 }
1394
1395 if (playerStatus->flags & PS_FLAG_NO_FLIPPING) {
1396 angle = 0.0f;
1397 }
1398
1399 playerStatus->flipYaw[gCurrentCameraID] = angle;
1400
1401 PrevPlayerCamRelativeYaw = angle = clamp_angle(camRelativeYaw);
1402 angle = clamp_angle(playerStatus->flipYaw[gCurrentCameraID] + angle);
1403 if (playerStatus->curSpeed == 0.0f) {
1404 D_800F7B48 = 0.0f;
1405 }
1406
1407 trueAnim = playerStatus->anim;
1408 if (!(playerStatus->flags & PS_FLAG_SPINNING)) {
1409 sprIndex = (playerStatus->anim >> 0x10) & 0xFF;
1410
1411 if (playerStatus->actionState == ACTION_STATE_TORNADO_JUMP || playerStatus->flags & PS_FLAG_ROTATION_LOCKED) {
1412 if (!(playerStatus->flags & PS_FLAG_FACE_FORWARD)
1413 && (sprIndex == SPR_Mario1 || sprIndex == SPR_MarioW1 || sprIndex == SPR_Peach1)
1414 && playerStatus->spriteFacingAngle < 350.0f && playerStatus->spriteFacingAngle > 190.0f
1415 ) {
1416 trueAnim = get_player_back_anim(trueAnim);
1417 }
1418 } else {
1419 playerStatus->spriteFacingAngle = angle + D_800F7B48;
1420 if (!(playerStatus->flags & PS_FLAG_FACE_FORWARD)
1421 && (sprIndex == SPR_Mario1 || sprIndex == SPR_MarioW1 || sprIndex == SPR_Peach1)
1422 && fabsf(get_clamped_angle_diff(cameraYaw, playerStatus->curYaw)) < 60.0f
1423 ) {
1424 trueAnim = get_player_back_anim(trueAnim);
1425 }
1426 playerStatus->curYaw = playerStatus->targetYaw;
1427 }
1428 }
1429 playerStatus->trueAnimation = trueAnim;
1430
1431 timescale = 1.0f;
1432 if (playerStatus->flags & PS_FLAG_ENTERING_BATTLE) {
1433 timescale = 0.5f;
1434 }
1435 if (playerStatus->flags & PS_FLAG_TIME_STOPPED) {
1436 timescale = 0.0f;
1437 }
1438 playerStatus->animNotifyValue = spr_update_player_sprite(PLAYER_SPRITE_MAIN, playerStatus->trueAnimation, timescale);
1439 playerStatus->flags |= PS_FLAG_SPRITE_REDRAW;
1440}
1441
1443 s32 sprIndex = (anim >> 16) & 0xff;
1444 s32 outAnim = 0;
1445
1446 if (sprIndex != SPR_Mario1) {
1447 if (sprIndex != SPR_MarioW1 && sprIndex != SPR_Peach1) {
1448 return anim;
1449 }
1450
1451 if (sprIndex == SPR_Mario1) {
1452 if (anim > ANIM_Mario1_SpinFall) {
1453 return anim;
1454 }
1455 } else if (sprIndex == SPR_MarioW1) {
1456 if (anim == ANIM_MarioW1_Lift) {
1457 outAnim = ANIM_MarioW1_Lift_Back;
1458 } else if (anim == ANIM_MarioW1_Toss) {
1459 outAnim = ANIM_MarioW1_Toss_Back;
1460 } else if (anim == ANIM_MarioW1_Smash1_Miss) {
1461 outAnim = ANIM_MarioW1_Smash1_Miss_Back;
1462 } else if (anim == ANIM_MarioW1_Smash1_Hit) {
1463 outAnim = ANIM_MarioW1_Smash1_Hit_Back;
1464 } else if (anim == ANIM_MarioW1_Smash2_Miss) {
1465 outAnim = ANIM_MarioW1_Smash2_Miss_Back;
1466 } else if (anim == ANIM_MarioW1_Smash2_Hit) {
1467 outAnim = ANIM_MarioW1_Smash2_Hit_Back;
1468 } else if (anim == ANIM_MarioW1_Smash3_Miss) {
1469 outAnim = ANIM_MarioW1_Smash3_Miss_Back;
1470 } else if (anim == ANIM_MarioW1_Smash3_Hit) {
1471 outAnim = ANIM_MarioW1_Smash3_Hit_Back;
1472 }
1473 } else if (sprIndex == SPR_Peach1) {
1474 if (anim > ANIM_Peach1_StepDown) {
1475 outAnim = anim + 1;
1476 }
1477 }
1478 } else if (anim > ANIM_Mario1_SpinFall) {
1479 return anim;
1480 }
1481
1482 if (outAnim != 0) {
1483 return outAnim;
1484 } else {
1485 return anim | SPRITE_ID_BACK_FACING;
1486 }
1487}
1488
1489void render_player(void) {
1492 }
1493}
1494
1496 RenderTask task;
1497 RenderTask* rtPtr = &task;
1498 PlayerStatus* playerStatus = &gPlayerStatus;
1499 s32 x, y, z;
1500
1501 if (playerStatus->flags & PS_FLAG_SPRITE_REDRAW) {
1502 playerStatus->flags &= ~PS_FLAG_SPRITE_REDRAW;
1503 get_screen_coords(gCurrentCamID, playerStatus->pos.x, playerStatus->pos.y,
1504 playerStatus->pos.z, &x, &y, &z);
1505 if (!(playerStatus->flags & PS_FLAG_SPINNING)) {
1506 if (playerStatus->curAlpha != playerStatus->prevAlpha) {
1507 if (playerStatus->curAlpha < 254) {
1508 if (playerStatus->animFlags & PA_FLAG_MAP_HAS_SWITCH) {
1510 } else {
1512 }
1513 set_player_imgfx_comp(PLAYER_SPRITE_MAIN, -1, IMGFX_SET_ALPHA, 0, 0, 0, playerStatus->curAlpha, 0);
1514
1515 } else {
1516 playerStatus->renderMode = RENDER_MODE_ALPHATEST;
1518 }
1519 }
1520
1521 playerStatus->prevAlpha = playerStatus->curAlpha;
1522
1523 } else {
1525 playerStatus->prevAlpha = 0;
1526 }
1527
1528 if (!(playerStatus->animFlags & PA_FLAG_INVISIBLE)) {
1529 rtPtr->appendGfxArg = playerStatus;
1530 rtPtr->dist = -z;
1531 rtPtr->renderMode = playerStatus->renderMode;
1532
1533 if (playerStatus->flags & PS_FLAG_SPINNING) {
1535 } else {
1536 rtPtr->appendGfx = appendGfx_player;
1537 }
1538
1539 queue_render_task(rtPtr);
1540 }
1541 }
1542}
1543
1544void appendGfx_player(void* data) {
1545 PlayerStatus* playerStatus = &gPlayerStatus;
1546 Matrix4f sp20, sp60, spA0, spE0;
1547 f32 temp_f0 = -gCameras[gCurrentCamID].curYaw;
1548 s32 spriteIdx;
1549
1550 if (playerStatus->actionState == ACTION_STATE_SLIDING) {
1552 guRotateF(sp20, temp_f0, 0.0f, 1.0f, 0.0f);
1553 guMtxCatF(spE0, sp20, sp20);
1554 guRotateF(spA0, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f);
1555 guMtxCatF(sp20, spA0, sp20);
1556 guTranslateF(sp60, playerStatus->pos.x, playerStatus->pos.y - 1.0f, playerStatus->pos.z);
1557 guMtxCatF(sp20, sp60, sp20);
1559 } else {
1560 guRotateF(spA0, temp_f0, 0.0f, -1.0f, 0.0f);
1561 guRotateF(sp20, clamp_angle(playerStatus->pitch), 0.0f, 0.0f, 1.0f);
1562 guMtxCatF(spA0, sp20, sp20);
1563 guTranslateF(sp60, 0.0f, -playerStatus->colliderHeight * 0.5f, 0.0f);
1564 guMtxCatF(sp60, sp20, sp20);
1565 guRotateF(spA0, temp_f0, 0.0f, 1.0f, 0.0f);
1566 guMtxCatF(sp20, spA0, sp20);
1567 guRotateF(spA0, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f);
1568 guMtxCatF(sp20, spA0, sp20);
1569 guTranslateF(sp60, 0.0f, playerStatus->colliderHeight * 0.5f, 0.0f);
1570 guMtxCatF(sp20, sp60, sp20);
1572 guMtxCatF(sp20, spE0, sp20);
1573 guTranslateF(sp60, playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z);
1574 guMtxCatF(sp20, sp60, sp20);
1575
1576 if (playerStatus->animFlags & PA_FLAG_SHIVERING) {
1577 playerStatus->animFlags = playerStatus->animFlags & ~PA_FLAG_SHIVERING;
1578 playerStatus->shiverTime = 22;
1580 set_player_imgfx_all(playerStatus->anim, IMGFX_SET_ANIM, IMGFX_ANIM_SHIVER, 1, 1, 0, 0);
1581 }
1582
1583 if (playerStatus->shiverTime != 0) {
1584 playerStatus->shiverTime--;
1585 if (playerStatus->shiverTime == 0) {
1587 }
1588 }
1589
1590 if (playerStatus->spriteFacingAngle >= 90.0f && playerStatus->spriteFacingAngle < 270.0f) {
1592 } else {
1593 spriteIdx = PLAYER_SPRITE_MAIN;
1594 }
1595
1596 spr_draw_player_sprite(spriteIdx, 0, 0, 0, sp20);
1597 }
1598}
1599
1601void appendGfx_player_spin(void* data) {
1602 PlayerStatus* playerStatus = &gPlayerStatus;
1603 Matrix4f mtx;
1604 Matrix4f translation;
1605 Matrix4f rotation;
1606 Matrix4f scale;
1607 f32 yaw;
1608 f32 blurAngle;
1609 s32 tint;
1610 f32 px, py, pz;
1611 s32 x, y, z;
1612 s32 i;
1613 s32 spriteIdx;
1614
1615 for (i = 0; i < 2; i++) {
1617
1618 if (i == 0) {
1619 if (playerStatus->spriteFacingAngle > 90.0f && playerStatus->spriteFacingAngle <= 180.0f) {
1620 yaw = 180.0f - playerStatus->spriteFacingAngle;
1621 } else {
1622 if (playerStatus->spriteFacingAngle > 180.0f && playerStatus->spriteFacingAngle <= 270.0f) {
1623 yaw = playerStatus->spriteFacingAngle - 180.0f;
1624 } else if (playerStatus->spriteFacingAngle > 270.0f && playerStatus->spriteFacingAngle <= 360.0f) {
1625 yaw = 360.0f - playerStatus->spriteFacingAngle;
1626 } else {
1627 yaw = playerStatus->spriteFacingAngle;
1628 }
1629 }
1630
1631 tint = yaw / 25.0f;
1632 tint = 255 - (tint * 60);
1633 if (tint < 100) {
1634 tint = 100;
1635 }
1636
1637 set_player_imgfx_all(PLAYER_SPRITE_MAIN, IMGFX_SET_COLOR, tint, tint, tint, 255, 0);
1638
1639 guRotateF(rotation, yaw, 0.0f, -1.0f, 0.0f);
1640 guRotateF(mtx, clamp_angle(playerStatus->pitch), 0.0f, 0.0f, 1.0f);
1641 guMtxCatF(rotation, mtx, mtx);
1642 px = playerStatus->pos.x;
1643 py = playerStatus->pos.y;
1644 pz = playerStatus->pos.z;
1645 } else {
1646 blurAngle = phys_get_spin_history(i, &x, &y, &z);
1647
1648 if (y == 0x80000000) {
1649 py = playerStatus->pos.y;
1650 } else {
1651 py = y;
1652 }
1653
1654 px = playerStatus->pos.x;
1655 pz = playerStatus->pos.z;
1657 guRotateF(mtx, yaw, 0.0f, -1.0f, 0.0f);
1658 guRotateF(rotation, yaw, 0.0f, -1.0f, 0.0f);
1659 guRotateF(mtx, blurAngle, 0.0f, 1.0f, 0.0f);
1660 guMtxCatF(rotation, mtx, mtx);
1661 }
1662
1663 guTranslateF(translation, 0.0f, -playerStatus->colliderHeight * 0.5f, 0.0f);
1664 guMtxCatF(translation, mtx, mtx);
1665 guRotateF(rotation, yaw, 0.0f, 1.0f, 0.0f);
1666 guMtxCatF(mtx, rotation, mtx);
1667 guRotateF(rotation, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f);
1668 guMtxCatF(mtx, rotation, mtx);
1669 guTranslateF(translation, 0.0f, playerStatus->colliderHeight * 0.5f, 0.0f);
1670 guMtxCatF(mtx, translation, mtx);
1672 guMtxCatF(mtx, scale, mtx);
1673 guTranslateF(translation, px, py, pz);
1674 guMtxCatF(mtx, translation, mtx);
1675
1676 if (playerStatus->spriteFacingAngle >= 90.0f && playerStatus->spriteFacingAngle < 270.0f) {
1678 } else {
1679 spriteIdx = PLAYER_SPRITE_MAIN;
1680 }
1681
1682 spr_draw_player_sprite(spriteIdx, 0, 0, 0, mtx);
1683 }
1684}
1685
1687 PlayerStatus* playerStatus = &gPlayerStatus;
1689 Camera* camera = &gCameras[gCurrentCameraID];
1690 f32 shadowScale = 0.0f;
1691 f32 yawTemp = 0.0f;
1692 f32 hitDirX, hitDirZ;
1693 f32 hitRx, hitRz;
1694 f32 x, y, z;
1695 f32 playerX, playerZ;
1696 f32 raycastYaw;
1697
1698 if (playerStatus->spriteFacingAngle >= 90.0f && playerStatus->spriteFacingAngle < 270.0f) {
1699 yawTemp = 180.0f;
1700 }
1701
1702 raycastYaw = (yawTemp - 90.0f) + gCameras[gCurrentCameraID].curYaw;
1703 shadow->pos.x = playerX = playerStatus->pos.x;
1704 shadow->pos.z = playerZ = playerStatus->pos.z;
1705 x = playerX;
1706 y = playerStatus->pos.y + (playerStatus->colliderHeight / 3.5f);
1707 z = playerZ;
1708 shadowScale = 1024.0f;
1709 gCollisionStatus.floorBelow = player_raycast_below(raycastYaw, playerStatus->colliderDiameter, &x, &y, &z,
1710 &shadowScale, &hitRx, &hitRz, &hitDirX, &hitDirZ);
1711 shadow->rot.x = hitRx;
1712 shadow->rot.z = hitRz;
1713 shadow->rot.y = clamp_angle(-camera->curYaw);
1714 hitRx += 180.0f;
1715 hitRz += 180.0f;
1716
1717 if (hitRx != 0.0f || hitRz != 0.0f) {
1718 s32 dist = dist2D(x, z, playerStatus->pos.x, playerStatus->pos.z);
1719 f32 tan = atan2(playerStatus->pos.x, playerStatus->pos.z, x, z);
1720 s32 angleTemp = clamp_angle((-90.0f - tan) + get_player_normal_yaw());
1721
1724 gGameStatusPtr->playerGroundTraceNormal.y * dist * sin_deg(angleTemp);
1725 }
1726 }
1727
1728 shadow->pos.y = y;
1729 shadow->alpha = (f64)playerStatus->curAlpha / 2;
1730
1732 set_peach_shadow_scale(shadow, shadowScale);
1733 } else {
1734 set_standard_shadow_scale(shadow, shadowScale);
1735 }
1736}
1737
1738//END player/render.c
void force_player_anim(AnimID anim)
Definition 77480.c:905
HitID player_raycast_up_corner(f32 *x, f32 *y, f32 *z, f32 *length)
Definition 77480.c:324
void appendGfx_player_spin(void *data)
Only used when speedy spinning.
Definition 77480.c:1601
void clear_pulse_stone_icon(void)
Definition 77480.c:1106
void phys_update_lava_reset(void)
Definition 77480.c:793
void clear_interact_prompt(void)
Definition 77480.c:1322
HitID player_test_move_with_slipping(PlayerStatus *playerStatus, f32 *x, f32 *y, f32 *z, f32 length, f32 yaw)
Definition 77480.c:563
s32 WorldTattleInteractionID
Definition goombario.c:18
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
s32 has_valid_conversation_npc(void)
Definition 77480.c:1111
HitID player_test_move_without_slipping(PlayerStatus *playerStatus, f32 *x, f32 *y, f32 *z, f32 length, f32 yaw, s32 *hasClimbableStep)
Only used for Peach physics.
Definition 77480.c:496
void suggest_player_anim_always_forward(AnimID anim)
Definition 77480.c:913
HitID player_raycast_down(f32 *, f32 *, f32 *, f32 *)
Definition 77480.c:205
b32 check_player_action_debug(void)
Definition 77480.c:1016
s32 disable_player_input(void)
Definition 77480.c:990
HitID player_raycast_general(s32, f32, f32, f32, f32, f32, f32, f32 *, f32 *, f32 *, f32 *, f32 *, f32 *, f32 *)
Definition 77480.c:434
void render_interact_prompt(void)
Definition 77480.c:1316
s32 disable_player_static_collisions(void)
Definition 77480.c:972
s32 enable_player_input(void)
Definition 77480.c:998
void update_partner_timers(void)
Definition 77480.c:1329
void phys_update_standard(void)
Definition 77480.c:737
void(* TalkNotificationCallback)(void)
Definition 77480.c:35
s32 get_overriding_player_anim(s32 anim)
Definition 77480.c:839
PlayerData gPlayerData
Definition 77480.c:40
void render_conversation_prompt(void)
Definition 77480.c:1149
void func_800E01DC(void)
Definition 77480.c:1008
void player_reset_data(void)
Definition 77480.c:811
void clear_player_status(void)
Definition 77480.c:807
void enable_player_shadow(void)
Definition 77480.c:964
void render_pulse_stone_icon(void)
Definition 77480.c:1100
s32 partner_use_ability(void)
Definition partners.c:964
void player_render_interact_prompts(void)
Definition 77480.c:1028
void update_player_blink(void)
Definition 77480.c:924
void player_get_slip_vector(f32 *outX, f32 *outY, f32 x, f32 y, f32 nX, f32 nY)
Definition 77480.c:556
void check_for_pulse_stone(void)
unavoidable use of hardcoded map and area IDs
Definition 77480.c:1063
void(* PulseStoneNotificationCallback)(void)
Definition 77480.c:34
void render_player_model(void)
Definition 77480.c:1495
PlayerStatus gPlayerStatus
Definition 77480.c:39
s32 D_8010C950
Definition 77480.c:37
void check_for_conversation_prompt(void)
Definition 77480.c:1124
HitID player_test_lateral_overlap(s32 mode, PlayerStatus *playerStatus, f32 *x, f32 *y, f32 *z, f32 length, f32 yaw)
Definition 77480.c:370
void render_ispy_icon(void)
Definition 77480.c:1051
f32 get_xz_dist_to_player(f32 x, f32 z)
Definition 77480.c:960
f32 D_800F7B48
Definition 77480.c:1345
void suggest_player_anim_allow_backward(AnimID anim)
Definition 77480.c:894
void(* InteractNotificationCallback)(void)
Definition 77480.c:36
s32 func_800E06D8(void)
Definition 77480.c:1164
void appendGfx_player(void *data)
Definition 77480.c:1544
void check_input_use_partner(void)
Definition 77480.c:718
HitID player_raycast_up_corners(PlayerStatus *player, f32 *posX, f32 *posY, f32 *posZ, f32 *hitDepth, f32 yaw)
Definition 77480.c:255
void clear_conversation_prompt(void)
Definition 77480.c:1155
void update_player_shadow(void)
Definition 77480.c:1686
void func_800E06C0(s32 arg0)
Definition 77480.c:1160
void(* ISpyNotificationCallback)(void)
Definition 77480.c:33
void render_player(void)
Definition 77480.c:1489
void appendGfx_interact_prompt(void)
s32 enable_player_static_collisions(void)
Definition 77480.c:980
HitID player_raycast_below(f32 yaw, f32 diameter, f32 *outX, f32 *outY, f32 *outZ, f32 *outLength, f32 *hitRx, f32 *hitRz, f32 *hitDirX, f32 *hitDirZ)
Definition 77480.c:71
void player_update_sprite(void)
Definition 77480.c:1347
b32 is_player_dismounted(void)
Definition 77480.c:827
s32 get_player_back_anim(s32 arg0)
Definition 77480.c:1442
void update_player(void)
Definition 77480.c:625
void disable_player_shadow(void)
Definition 77480.c:968
void clear_ispy_icon(void)
Definition 77480.c:1057
void check_for_ispy(void)
Definition 77480.c:1035
void check_for_interactables(void)
Definition 77480.c:1207
DisguiseAnims BasicPeachDisguiseAnims[]
Definition 7E9D0.c:464
s8 enableCollisionOverlapsCheck
PartnerData partners[12]
Vec3f playerGroundTraceNormal
s32 b32
AnimID trueAnimation
Encoding back-facing sprite.
f32 Matrix4f[4][4]
s32 HitID
s32 partnerUnlockedTime[12]
u32 AnimID
Vec3f playerGroundTraceAngles
s8 flags
Definition demo_api.c:15
#define guRotateF
#define queue_render_task
#define sqrtf
#define sin_deg
#define guTranslateF
#define guMtxCatF
#define clamp_angle
#define atan2
#define mem_clear
#define guScaleF
@ DEBUG_SCRIPTS_NONE
Definition enums.h:4275
@ BUTTON_C_DOWN
Definition enums.h:2779
@ BUTTON_R
Definition enums.h:2781
@ BUTTON_L
Definition enums.h:2782
@ BUTTON_B
Definition enums.h:2789
@ IMGFX_SET_ALPHA
Definition enums.h:5124
@ IMGFX_SET_COLOR
Definition enums.h:5123
@ IMGFX_CLEAR
Definition enums.h:5117
@ IMGFX_SET_ANIM
Definition enums.h:5122
@ PEACH_FLAG_IS_PEACH
Definition enums.h:2488
@ SHADOW_VARYING_CIRCLE
Definition enums.h:2535
@ PS_FLAG_PAUSED
Definition enums.h:3040
@ PS_FLAG_TIME_STOPPED
Definition enums.h:3081
@ PS_FLAG_FALLING
Definition enums.h:3036
@ PS_FLAG_HAS_REFLECTION
Definition enums.h:3034
@ PS_FLAG_ENTERING_BATTLE
Definition enums.h:3061
@ PS_FLAG_INTERACTED
Definition enums.h:3077
@ PS_FLAG_ROTATION_LOCKED
Definition enums.h:3065
@ PS_FLAG_JUMPING
Definition enums.h:3035
@ PS_FLAG_CAMERA_DOESNT_FOLLOW
Definition enums.h:3075
@ PS_FLAG_FLYING
Definition enums.h:3037
@ PS_FLAG_CUTSCENE_MOVEMENT
Definition enums.h:3054
@ PS_FLAG_NO_PARTNER_USAGE
Definition enums.h:3042
@ PS_FLAG_HAZARD_INVINCIBILITY
Definition enums.h:3056
@ PS_FLAG_NO_STATIC_COLLISION
Definition enums.h:3051
@ PS_FLAG_NO_FLIPPING
Definition enums.h:3067
@ PS_FLAG_SPINNING
Definition enums.h:3058
@ PS_FLAG_INPUT_DISABLED
Definition enums.h:3052
@ PS_FLAG_FACE_FORWARD
Definition enums.h:3079
@ PS_FLAG_HAS_CONVERSATION_NPC
Definition enums.h:3074
@ PS_FLAG_SPRITE_REDRAW
Definition enums.h:3083
@ PARTNER_ACTION_NONE
Definition enums.h:2932
@ PARTNER_ACTION_USE
Definition enums.h:2933
@ IMGFX_ANIM_SHIVER
Definition enums.h:5139
@ COLLIDER_FLAG_DOCK_WALL
Definition enums.h:4699
@ COLLIDER_FLAG_IGNORE_PLAYER
Definition enums.h:4696
@ COLLIDER_FLAG_IGNORE_SHELL
Definition enums.h:4695
@ NPC_PARTNER
Definition enums.h:2528
@ ENTITY_TYPE_PUSH_BLOCK
Definition enums.h:2555
@ ENTITY_TYPE_PADLOCK
Definition enums.h:2546
@ ENTITY_TYPE_SIGNPOST
Definition enums.h:2588
@ ENTITY_TYPE_CHEST
Definition enums.h:2587
@ ENTITY_TYPE_PADLOCK_RED_FACE
Definition enums.h:2548
@ ENTITY_TYPE_PADLOCK_RED_FRAME
Definition enums.h:2547
@ ENTITY_TYPE_PADLOCK_BLUE_FACE
Definition enums.h:2549
@ PLAYER_COLLISION_HAMMER
Definition enums.h:4715
@ PLAYER_COLLISION_4
Definition enums.h:4716
@ PLAYER_COLLISION_0
Definition enums.h:4712
@ PLAYER_COLLISION_1
Definition enums.h:4713
@ AREA_SBK
Definition enums.h:2970
@ PA_FLAG_INTERRUPT_USE_PARTNER
forces actions with bow, parakarry, watt, and lakilester to end (sushie not tested)
Definition enums.h:3093
@ PA_FLAG_WATT_IN_HANDS
Definition enums.h:3092
@ PA_FLAG_SHIVERING
Definition enums.h:3101
@ PA_FLAG_NO_OOB_RESPAWN
Definition enums.h:3121
@ PA_FLAG_SPEECH_PROMPT_AVAILABLE
(...) prompt
Definition enums.h:3096
@ PA_FLAG_MAP_HAS_SWITCH
Definition enums.h:3119
@ PA_FLAG_FORCE_USE_PARTNER
triggers partner use when set
Definition enums.h:3094
@ PA_FLAG_DISMOUNTING_ALLOWED
Definition enums.h:3123
@ PA_FLAG_INVISIBLE
Definition enums.h:3104
@ PA_FLAG_ISPY_VISIBLE
The I Spy icon is being shown.
Definition enums.h:3099
@ PA_FLAG_8BIT_MARIO
Definition enums.h:3105
@ PA_FLAG_PULSE_STONE_VISIBLE
The pulse stone icon is being shown.
Definition enums.h:3097
@ PA_FLAG_RIDING_PARTNER
Definition enums.h:3116
@ PA_FLAG_USING_PEACH_PHYSICS
Definition enums.h:3103
@ PA_FLAG_USING_PULSE_STONE
Definition enums.h:3098
@ PA_FLAG_INTERACT_PROMPT_AVAILABLE
! prompt
Definition enums.h:3095
@ CONTEXT_WORLD
Definition enums.h:3529
@ RENDER_MODE_SURFACE_XLU_LAYER2
Definition enums.h:3287
@ RENDER_MODE_ALPHATEST
Definition enums.h:3276
@ RENDER_MODE_SURFACE_XLU_LAYER1
Definition enums.h:3282
@ PEACH_BAKING_NONE
Definition enums.h:2496
@ ENTITY_FLAG_CONTINUOUS_COLLISION
Definition enums.h:2619
@ ENTITY_FLAG_SHOWS_INSPECT_PROMPT
Definition enums.h:2625
@ ENTITY_FLAG_HIDDEN
Definition enums.h:2613
@ 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
@ PARTNER_GOOMBARIO
Definition enums.h:2886
@ ACTION_STATE_HIT_LAVA
Definition enums.h:2451
@ ACTION_STATE_IDLE
Definition enums.h:2426
@ ACTION_STATE_USE_SPINNING_FLOWER
Definition enums.h:2457
@ ACTION_STATE_SLIDING
Definition enums.h:2445
@ ACTION_STATE_ENEMY_FIRST_STRIKE
Definition enums.h:2455
@ ACTION_STATE_WALK
Definition enums.h:2427
@ ACTION_STATE_TORNADO_JUMP
Definition enums.h:2443
@ ACTION_STATE_STEP_UP
Definition enums.h:2462
@ ACTION_STATE_RUN
Definition enums.h:2428
@ CAM_DEFAULT
Definition enums.h:1800
@ NPC_FLAG_USE_INSPECT_ICON
Definition enums.h:3026
void reset_player_status(void)
Definition 7B440.c:58
Entity * get_entity_by_index(s32 index)
Definition entity.c:530
f32 fabsf(f32 f)
void peach_set_disguise_anim(AnimID)
Definition 7E9D0.c:506
void clear_world_menus(void)
Definition menus.c:131
s32 phys_can_player_interact(void)
Definition 7BB60.c:1159
void get_screen_coords(s32 camID, f32 x, f32 y, f32 z, s32 *screenX, s32 *screenY, s32 *screenZ)
Definition cam_main.c:410
void phys_update_action_state(void)
Definition 7E9D0.c:112
void set_standard_shadow_scale(Shadow *shadow, f32 scale)
Definition entity.c:1674
void appendGfx_speech_bubble(void)
f64 fabs(f64 f)
void func_800E5520(void)
Definition 7E9D0.c:36
void func_800EF3D4(s32)
Definition partners.c:2414
void interact_speech_setup(void)
void phys_update_falling(void)
Definition 7BB60.c:316
Shadow * get_shadow_by_index(s32 index)
Definition entity.c:534
void appendGfx_ispy_icon(void)
Definition i_spy.c:34
void appendGfx_pulse_stone_icon(void)
Definition pulse_stone.c:82
void interact_inspect_setup(void)
f32 cos_rad(f32 x)
Definition 43F0.c:717
void check_input_open_menus(void)
Definition menus.c:191
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:670
void phys_main_collision_below(void)
Definition 7BB60.c:863
void collision_check_player_overlaps(void)
Definition 7BB60.c:813
u32 get_entity_type(s32 arg0)
Definition entity.c:568
void collision_lateral_peach(void)
Definition 7BB60.c:1057
void pulse_stone_notification_setup(void)
Definition pulse_stone.c:71
void set_action_state(s32 actionState)
Definition 7E9D0.c:209
void exec_ShakeCam1(s32 arg0, s32 arg1, s32 arg2)
Definition cam_api.c:365
void update_player_input(void)
Definition 7B440.c:22
void check_input_status_bar(void)
Definition menus.c:391
s32 test_ray_entities(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32 *hitX, f32 *hitY, f32 *hitZ, f32 *hitDepth, f32 *hitNx, f32 *hitNy, f32 *hitNz)
Test a general ray from a given starting position and direction against all entities.
Definition collision.c:947
s32 should_collider_allow_interact(s32)
Definition trigger.c:281
void set_peach_shadow_scale(Shadow *shadow, f32 scale)
Definition entity.c:1705
s32 create_shadow_type(s32 type, f32 x, f32 y, f32 z)
Definition entity.c:1528
void collision_main_lateral(void)
Definition 7BB60.c:494
void collision_lava_reset_check_additional_overlaps(void)
Definition 7BB60.c:990
s32 test_ray_colliders(s32 ignoreFlags, f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32 *hitX, f32 *hitY, f32 *hitZ, f32 *hitDepth, f32 *hitNx, f32 *hitNy, f32 *hitNz)
Definition collision.c:768
void player_surface_spawn_fx(void)
Definition surfaces.c:42
f32 sin_rad(f32 x)
Definition 43F0.c:713
f32 get_player_normal_pitch(void)
Definition 43F0.c:662
void phys_update_jump(void)
Definition 7BB60.c:199
void sin_cos_rad(f32 rad, f32 *outSinTheta, f32 *outCosTheta)
Definition 43F0.c:706
void partner_reset_tether_distance(void)
Definition partners.c:2405
f32 phys_get_spin_history(s32 lag, s32 *x, s32 *y, s32 *z)
Definition 7E9D0.c:82
f32 get_clamped_angle_diff(f32, f32)
Definition 43F0.c:606
f32 get_player_normal_yaw(void)
Definition 43F0.c:658
void check_input_midair_jump(void)
Definition 7BB60.c:1079
void ispy_notification_setup(void)
Definition i_spy.c:91
HitID collision_main_above(void)
Definition 7BB60.c:68
Npc * get_npc_unsafe(s32 npcID)
Definition npc.c:995
#define DMA_COPY_SEGMENT(segment)
Definition macros.h:525
#define SPRITE_WORLD_SCALE_D
Definition macros.h:140
#define COLLISION_WITH_ENTITY_BIT
Definition macros.h:152
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define DEG_TO_RAD(deg)
Definition macros.h:134
#define SQ(x)
Definition macros.h:166
#define NO_COLLIDER
Definition macros.h:156
#define COLLISION_WITH_NPC_BIT
Definition macros.h:151
void set_player_imgfx_all(s32 animID, ImgFXType imgfxType, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6)
Definition sprite.c:995
s32 spr_draw_player_sprite(s32 spriteInstanceID, s32 yaw, s32 alphaIn, PAL_PTR *paletteList, Matrix4f mtx)
Definition sprite.c:872
s32 spr_update_player_sprite(s32 spriteInstanceID, s32 animID, f32 timeScale)
Definition sprite.c:823
void set_player_imgfx_comp(s32 spriteIdx, s32 compIdx, ImgFXType imgfx, s32 imgfxArg1, s32 imgfxArg2, s32 imgfxArg3, s32 imgfxArg4, s32 flags)
Definition sprite.c:969
@ PLAYER_SPRITE_MAIN
Definition sprite.h:26
@ DRAW_SPRITE_UPSIDE_DOWN
Definition sprite.h:19
@ SPRITE_ID_BACK_FACING
Definition sprite.h:13
Vec3f targetPos
s8 collisionTimer
s32 flags
Vec3f moveToPos
Vec3f pos
void * appendGfxArg
void(* appendGfx)(void *)
u8 Addr[]
Linker symbol address, as in ld_addrs.h.
Definition types.h:16
PlayerStatus * gPlayerStatusPtr
GameStatus gGameStatus
Definition main_loop.c:21
s32 PrevPlayerDirection
Definition 7B440.c:7
CollisionStatus gCollisionStatus
Definition 7BB60.c:6
PartnerStatus gPartnerStatus
Definition partners.c:42
GameStatus * gGameStatusPtr
Definition main_loop.c:32
f32 PlayerNormalPitch
Definition 7B440.c:10
Camera gCameras[4]
Definition cam_main.c:17
s32 PrevPlayerCamRelativeYaw
Definition 7E9D0.c:31
f32 PlayerNormalYaw
Definition 7B440.c:9
s32 gCurrentCameraID
Definition cam_math.c:4
s16 gCurrentCamID
Definition cam_main.c:13
HiddenPanelsData gCurrentHiddenPanels
Definition entity.c:36
void world_watt_sync_held_position(void)