Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
misc.c
Go to the documentation of this file.
1#include "common.h"
2#include "world/disguise.h"
5#include "sprite/player.h"
6
8
10 PartnerStatus* partnerStatus = &gPartnerStatus;
11 PlayerStatus* playerStatus = &gPlayerStatus;
12
13 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
15 playerStatus->actionSubstate = 0;
16 playerStatus->curStateTime = 0;
17 playerStatus->timeInAir = 0;
18 playerStatus->peakJumpTime = 0;
19 playerStatus->curSpeed = 0.0f;
20 playerStatus->pitch = 0.0f;
21 }
22
23 if (playerStatus->animFlags & PA_FLAG_RIDING_PARTNER) {
24 if (partnerStatus->actingPartner == PARTNER_LAKILESTER) {
26 } else if (partnerStatus->actingPartner == PARTNER_SUSHIE) {
28 }
29 }
30}
31
33 PlayerStatus* playerStatus = &gPlayerStatus;
34 f32 hitDirZ;
35 f32 hitDirX;
36 f32 hitRz;
37 f32 hitRx;
38 f32 outLength;
39 f32 outZ;
40 f32 outY;
41 f32 outX;
42 f32 cosTheta;
43 f32 sinTheta;
44 f32 miscTempVariable;
45 f32 playerXOffset;
46 f32 playerZOffset;
47 f32 zDelta;
48 f32 playerOffsetTempVar;
49
50 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
52 playerStatus->actionSubstate = 0;
53 playerStatus->curStateTime = 0;
54 playerStatus->timeInAir = 0;
55 playerStatus->peakJumpTime = 0;
56 playerStatus->curSpeed = 0.0f;
57 playerStatus->pitch = 0.0f;
59 }
60
61 switch (playerStatus->actionSubstate) {
62 case 0:
63 playerStatus->actionSubstate++;
64 case 1:
65 break;
66 default:
67 return;
68 }
69
70 sin_cos_rad(DEG_TO_RAD(PlayerNormalPitch), &sinTheta, &cosTheta);
71
72 miscTempVariable = 3.0f;
73 miscTempVariable = sinTheta * miscTempVariable;
74
75 sin_cos_rad(DEG_TO_RAD(D_802B6770_E27C80), &sinTheta, &cosTheta);
76
77 playerXOffset = sinTheta * miscTempVariable;
78 playerZOffset = cosTheta * miscTempVariable;
79
80 if (fabs(playerXOffset) < 0.1) {
81 playerOffsetTempVar = 0.1f;
82 if (playerXOffset < 0.0f) {
83 playerOffsetTempVar = -0.1f;
84 }
85 playerXOffset = playerOffsetTempVar;
86 }
87
88 if (fabs(playerZOffset) < 0.1) {
89 playerOffsetTempVar = 0.1f;
90 if (playerZOffset < 0.0f) {
91 playerOffsetTempVar = -0.1f;
92 }
93 playerZOffset = playerOffsetTempVar;
94 }
95
96 playerStatus->pos.x += playerXOffset;
97 playerStatus->pos.z -= playerZOffset;
98 outX = playerStatus->pos.x;
99 outY = playerStatus->pos.y;
100 outZ = playerStatus->pos.z;
101 outLength = 5.0f;
102 if (player_raycast_below_cam_relative(playerStatus, &outX, &outY, &outZ, &outLength, &hitRx, &hitRz, &hitDirX, &hitDirZ) >= 0) {
103 playerStatus->pos.y = outY;
104 }
105
107 miscTempVariable = 30.0f;
108 } else {
109 miscTempVariable = 60.0f;
110 }
111
112 if (PlayerNormalPitch < miscTempVariable) {
115 }
116}
117
119 PlayerStatus* playerStatus = &gPlayerStatus;
120
121 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
123 playerStatus->actionSubstate = 0;
124 playerStatus->curStateTime = 0;
125 playerStatus->timeInAir = 0;
126 playerStatus->peakJumpTime = 0;
127 playerStatus->curSpeed = 0.0f;
128 playerStatus->pitch = 0.0f;
129
130 if (playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS) {
131 return;
132 }
133 playerStatus->curStateTime = 5;
134 }
135
136 playerStatus->curStateTime--;
137 if (playerStatus->curStateTime == 0) {
139 }
140}
141
143 PlayerStatus* playerStatus = &gPlayerStatus;
144
145 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
147 playerStatus->actionSubstate = 0;
148 playerStatus->timeInAir = 0;
149 playerStatus->peakJumpTime = 0;
150 playerStatus->curSpeed = 0.0f;
151 playerStatus->pitch = 0.0f;
152 suggest_player_anim_always_forward(ANIM_Mario1_Hurt);
153 playerStatus->curStateTime = 30;
154 }
155
156 if (playerStatus->curStateTime != 0) {
157 playerStatus->curStateTime--;
158 } else if (gGameStatusPtr->context == CONTEXT_WORLD) {
160 }
161}
162
164 PlayerStatus* playerStatus = &gPlayerStatus;
165
166 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
167 playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED;
168 playerStatus->flags |= PS_FLAG_ARMS_RAISED;
169 playerStatus->curStateTime = 0;
170 playerStatus->actionSubstate = 0;
171 playerStatus->curSpeed = 0.0f;
172 playerStatus->pitch = 0.0f;
173 suggest_player_anim_always_forward(ANIM_Mario1_UsePower);
174 }
175
176 if (!(playerStatus->animFlags & PA_FLAG_RAISED_ARMS)) {
178 playerStatus->flags &= ~PS_FLAG_ARMS_RAISED;
179 }
180}
181
183 PlayerStatus* playerStatus = &gPlayerStatus;
184
185 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
186 f32 angle;
187 f32 magnitude;
188
189 playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED;
190 playerStatus->curSpeed = 0.0f;
191 playerStatus->unk_60 = 0;
192 playerStatus->curStateTime = 5;
193 player_input_to_move_vector(&angle, &magnitude);
194
195 if (((angle >= 45.0f) && (angle <= 135.0f)) || ((angle >= 225.0f) && (angle <= 315.0f))) {
196 suggest_player_anim_always_forward(ANIM_MarioW2_PushSide);
197 } else {
198 suggest_player_anim_allow_backward(ANIM_MarioW1_PushToward);
199 }
200 }
201
203
204 if (playerStatus->animFlags & PA_FLAG_ABORT_PUSHING_BLOCK) {
205 if (playerStatus->curStateTime != 0) {
206 playerStatus->curStateTime--;
207 if (playerStatus->curStateTime == 0) {
209 }
210 }
211 }
212}
213
215 PlayerStatus* playerStatus = &gPlayerStatus;
216
217 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
218 playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED;
219 playerStatus->curSpeed = 0.0f;
220 playerStatus->unk_60 = 0;
221
222 if (!(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS)) {
223 suggest_player_anim_always_forward(ANIM_MarioW2_SpeakUp);
224 } else if (playerStatus->peachItemHeld == PEACH_BAKING_NONE) {
225 if (!(playerStatus->animFlags & PA_FLAG_INVISIBLE)) {
226 suggest_player_anim_always_forward(ANIM_Peach2_RaiseArms);
227 } else {
229 }
230 }
231 playerStatus->curStateTime = 30;
232 }
233
234 if (playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS) {
235 if (playerStatus->curStateTime != 0) {
236 playerStatus->curStateTime--;
237 } else if (playerStatus->peachItemHeld == PEACH_BAKING_NONE) {
238 if (!(playerStatus->animFlags & PA_FLAG_INVISIBLE)) {
239 suggest_player_anim_always_forward(ANIM_Peach1_Idle);
240 } else {
242 }
243 }
244 }
245}
DisguiseAnims BasicPeachDisguiseAnims[]
Definition 7E9D0.c:464
@ PS_FLAG_ACTION_STATE_CHANGED
Definition enums.h:3084
@ PS_FLAG_ARMS_RAISED
Definition enums.h:3063
@ PS_FLAG_AIRBORNE
Definition enums.h:3033
@ AREA_SBK
Definition enums.h:2970
@ PA_FLAG_INVISIBLE
Definition enums.h:3104
@ PA_FLAG_RAISED_ARMS
Sets action state to ACTION_STATE_RAISE_ARMS on idle.
Definition enums.h:3100
@ PA_FLAG_ABORT_PUSHING_BLOCK
Definition enums.h:3117
@ PA_FLAG_RIDING_PARTNER
Definition enums.h:3116
@ PA_FLAG_USING_PEACH_PHYSICS
Definition enums.h:3103
@ CONTEXT_WORLD
Definition enums.h:3529
@ PEACH_BAKING_NONE
Definition enums.h:2496
@ PARTNER_LAKILESTER
Definition enums.h:2893
@ PARTNER_SUSHIE
Definition enums.h:2892
@ ACTION_STATE_IDLE
Definition enums.h:2426
@ ACTION_STATE_FALLING
Definition enums.h:2435
void peach_set_disguise_anim(AnimID)
Definition 7E9D0.c:506
void player_input_to_move_vector(f32 *angle, f32 *magnitude)
Definition 7B440.c:140
f64 fabs(f64 f)
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
void suggest_player_anim_always_forward(AnimID anim)
Definition 77480.c:913
void gravity_use_fall_parms(void)
Definition 7BB60.c:302
void set_action_state(s32 actionState)
Definition 7E9D0.c:209
void suggest_player_anim_allow_backward(AnimID anim)
Definition 77480.c:894
b32 check_input_jump(void)
Definition 7E9D0.c:344
void sin_cos_rad(f32 rad, f32 *outSinTheta, f32 *outCosTheta)
Definition 43F0.c:706
void world_lakilester_sync_player_position(void)
void action_update_pushing_block(void)
Definition misc.c:182
void action_update_talk(void)
Definition misc.c:214
void action_update_raise_arms(void)
Definition misc.c:163
BSS f32 D_802B6770_E27C80
Definition misc.c:7
void action_update_first_strike(void)
Definition misc.c:142
void action_update_launch(void)
Definition misc.c:118
void action_update_state_23(void)
Definition misc.c:32
void action_update_ride(void)
Definition misc.c:9
#define BSS
Definition macros.h:7
#define DEG_TO_RAD(deg)
Definition macros.h:134
void world_sushie_sync_player_position(void)
PartnerStatus gPartnerStatus
Definition partners.c:42
GameStatus * gGameStatusPtr
Definition main_loop.c:32
f32 PlayerNormalPitch
Definition 7B440.c:10
f32 PlayerNormalYaw
Definition 7B440.c:9
PlayerStatus gPlayerStatus
Definition 77480.c:39