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