Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
use_tweester.c
Go to the documentation of this file.
1#include "common.h"
2#include "../partners.h"
3#include "npc.h"
4#include "sprite/player.h"
5
8
9enum {
12};
13
15 PlayerStatus* playerStatus = &gPlayerStatus;
16 f32 sinAngle, cosAngle, liftoffVelocity;
17 Entity* entity;
18
20 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
21 playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED;
24 playerStatus->flags |= (PS_FLAG_ROTATION_LOCKED | PS_FLAG_FLYING);
25 suggest_player_anim_allow_backward(ANIM_MarioW2_FlailArms);
26 playerStatus->actionSubstate = SUBSTATE_LAUNCH;
28 PlayerTweesterPhysicsPtr->radius = fabsf(dist2D(playerStatus->pos.x, playerStatus->pos.z, entity->pos.x, entity->pos.z));
29 PlayerTweesterPhysicsPtr->angle = atan2(entity->pos.x, entity->pos.z, playerStatus->pos.x, playerStatus->pos.z);
34 }
35
36 switch (playerStatus->actionSubstate) {
37 case SUBSTATE_LAUNCH:
39
40 playerStatus->pos.x = entity->pos.x + (sinAngle * PlayerTweesterPhysicsPtr->radius);
41 playerStatus->pos.z = entity->pos.z - (cosAngle * PlayerTweesterPhysicsPtr->radius);
42
44
45 if (PlayerTweesterPhysicsPtr->radius > 20.0f) {
47 } else if (PlayerTweesterPhysicsPtr->radius < 19.0f) {
49 }
50
55 }
56
57 playerStatus->pos.y += liftoffVelocity;
62 }
64 playerStatus->actionSubstate++; // SUBSTATE_DONE
65 entity_start_script(entity);
66 }
67 break;
68 case SUBSTATE_DONE:
71 playerStatus->blinkTimer = 50;
74 playerStatus->flags &= ~(PS_FLAG_ROTATION_LOCKED | PS_FLAG_FLYING);
76 break;
77 }
78}
79
#define clamp_angle
#define atan2
#define mem_clear
@ PS_FLAG_ROTATION_LOCKED
Definition enums.h:3065
@ PS_FLAG_ACTION_STATE_CHANGED
Definition enums.h:3084
@ PS_FLAG_FLYING
Definition enums.h:3037
@ SOUND_TWEESTER_LAUNCH
Definition enums.h:1080
@ ACTION_STATE_IDLE
Definition enums.h:2426
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
f32 fabsf(f32 f)
s32 disable_player_input(void)
Definition 77480.c:990
s32 entity_start_script(Entity *entity)
Definition entity.c:560
s32 disable_player_static_collisions(void)
Definition 77480.c:972
s32 enable_player_input(void)
Definition 77480.c:998
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:670
void set_action_state(s32 actionState)
Definition 7E9D0.c:209
void suggest_player_anim_allow_backward(AnimID anim)
Definition 77480.c:894
f32 sin_rad(f32 x)
Definition 43F0.c:713
s32 enable_player_static_collisions(void)
Definition 77480.c:980
void sin_cos_rad(f32 rad, f32 *outSinTheta, f32 *outCosTheta)
Definition 43F0.c:706
void disable_player_shadow(void)
Definition 77480.c:968
void disable_npc_shadow(Npc *npc)
Definition npc.c:1037
Npc * wPartnerNpc
Definition partners.c:43
void sfx_play_sound_at_player(s32 soundID, s32 arg1)
Definition sfx.c:521
#define BSS
Definition macros.h:7
#define DEG_TO_RAD(deg)
Definition macros.h:134
void action_update_use_tweester(void)
BSS TweesterPhysics PlayerTweesterPhysicsData
Definition use_tweester.c:6
TweesterPhysics * PlayerTweesterPhysicsPtr
Definition use_tweester.c:7
@ SUBSTATE_LAUNCH
@ SUBSTATE_DONE
PlayerStatus gPlayerStatus
Definition 77480.c:39
Entity * TweesterTouchingPlayer
Definition 7B440.c:6