Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
idle.c
Go to the documentation of this file.
1#include "common.h"
2#include "world/disguise.h"
3#include "sprite/player.h"
4
6 [PEACH_BAKING_NONE] ANIM_Peach1_Idle,
7 [PEACH_BAKING_CREAM] ANIM_Peach1_HoldCream,
8 [PEACH_BAKING_STRAWBERRY] ANIM_Peach1_HoldStrawberry,
9 [PEACH_BAKING_BUTTER] ANIM_Peach1_HoldButter,
10 [PEACH_BAKING_CLEANSER] ANIM_Peach1_HoldCleanser,
11 [PEACH_BAKING_WATER] ANIM_Peach1_HoldWater,
12 [PEACH_BAKING_MILK] ANIM_Peach1_HoldMilk,
13 [PEACH_BAKING_FLOUR] ANIM_Peach1_HoldFlour,
14 [PEACH_BAKING_EGG] ANIM_Peach1_HoldEgg,
15 [PEACH_BAKING_COMPLETE_CAKE] ANIM_Peach1_HoldCompleteCake,
16 [PEACH_BAKING_CAKE_BOWL] ANIM_Peach1_HoldCakeBowl,
17 [PEACH_BAKING_CAKE_MIXED] ANIM_Peach1_HoldCakeMixed,
18 [PEACH_BAKING_CAKE_PAN] ANIM_Peach1_HoldCakePan,
19 [PEACH_BAKING_CAKE_BATTER] ANIM_Peach1_HoldCakeBatter,
20 [PEACH_BAKING_CAKE_BARE] ANIM_Peach1_HoldBareCake,
21 [PEACH_BAKING_SALT] ANIM_Peach1_HoldSalt,
22 [PEACH_BAKING_SUGAR] ANIM_Peach1_HoldSugar,
23 [PEACH_BAKING_CAKE_WITH_ICING] ANIM_Peach1_HoldIcingCake,
24 [PEACH_BAKING_CAKE_WITH_BERRIES] ANIM_Peach1_HoldBerryCake,
25};
26
27enum {
32};
33
35
37 PlayerStatus* playerStatus = &gPlayerStatus;
38 PlayerData* playerData = &gPlayerData;
39 s32 firstFrame = FALSE;
40 f32 angle, magnitude;
41 AnimID anim;
42
43 if (playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS) {
45 return;
46 }
47
48 playerStatus->curStateTime++;
49
50 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
52 firstFrame = TRUE;
54 playerStatus->curStateTime = 0;
55 playerStatus->timeInAir = 0;
56 playerStatus->peakJumpTime = 0;
57 playerStatus->curSpeed = 0.0f;
58 playerStatus->pitch = 0.0f;
59
60 if (playerStatus->animFlags & PA_FLAG_8BIT_MARIO) {
61 anim = ANIM_MarioW3_8bit_Still;
62 } else if (!(playerStatus->animFlags & PA_FLAG_USING_WATT)) {
63 anim = ANIM_Mario1_Idle;
64 } else if (playerStatus->prevActionState == ACTION_STATE_IDLE) {
65 anim = ANIM_MarioW1_TakeItem;
66 } else {
67 anim = ANIM_MarioW1_CarryIdle;
68 }
70 }
71
72 if (playerStatus->animFlags & PA_FLAG_RAISED_ARMS) {
74 return;
75 }
76
77 player_input_to_move_vector(&angle, &magnitude);
79
80 if (check_input_jump()) {
81 if (magnitude != 0.0f || playerStatus->targetYaw != angle) {
82 playerStatus->targetYaw = angle;
83 }
84 return;
85 }
86
87 if (!firstFrame && check_input_hammer()) {
88 return;
89 }
90
91 if (magnitude == 0.0f) {
92 playerData->idleFrameCounter++;
93 } else {
94 playerStatus->curStateTime = 0;
96 if (magnitude != 0.0f) {
97 playerStatus->targetYaw = angle;
98 playerStatus->animFlags &= ~PA_FLAG_80000000;
99 }
100 }
101}
102
104 PlayerStatus* playerStatus = &gPlayerStatus;
105 PlayerData* playerData = &gPlayerData;
106 f32 angle, magnitude;
107
108 if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
109 playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED;
111 playerStatus->curStateTime = 0;
112 playerStatus->timeInAir = 0;
113 playerStatus->peakJumpTime = 0;
114 playerStatus->curSpeed = 0.0f;
115 playerStatus->flags &= ~PS_FLAG_AIRBORNE;
116
117 if (playerStatus->animFlags & PA_FLAG_INVISIBLE) {
120 suggest_player_anim_allow_backward(ANIM_Peach2_SadStill);
121 } else {
123 }
124 }
125
126 if (!(playerStatus->animFlags & PA_FLAG_INVISIBLE)) {
127 switch (playerStatus->actionSubstate) {
130 && (playerStatus->peachItemHeld == PEACH_BAKING_NONE)
131 ) {
132 if (playerStatus->curStateTime > 1800) {
133 // begin first yawm
134 playerStatus->actionSubstate++;
135 suggest_player_anim_allow_backward(ANIM_Peach2_Yawn);
136 return;
137 }
138 playerStatus->curStateTime++;
139 }
140 break;
142 // waiting for yawn to finish
143 if (playerStatus->animNotifyValue != 0) {
144 playerStatus->actionSubstate++;
145 playerStatus->curStateTime = 0;
146 suggest_player_anim_allow_backward(ANIM_Peach1_Idle);
147 }
148 break;
150 // delay before next yawn and sleep
151 playerStatus->curStateTime++;
152 if (playerStatus->curStateTime > 200) {
153 playerStatus->actionSubstate++;
154 suggest_player_anim_allow_backward(ANIM_Peach2_Yawn);
155 }
156 break;
158 // peach is asleep
160 suggest_player_anim_allow_backward(ANIM_Peach1_Idle);
162 } else if (playerStatus->animNotifyValue != 0) {
163 suggest_player_anim_allow_backward(ANIM_Peach2_Sleep);
164 }
165 break;
166 }
167 }
168
169 player_input_to_move_vector(&angle, &magnitude);
171
172 if (magnitude != 0.0f) {
173 playerStatus->curStateTime = 0;
174 playerStatus->targetYaw = angle;
176 }
177}
DisguiseAnims BasicPeachDisguiseAnims[]
Definition 7E9D0.c:464
u32 AnimID
@ PEACH_FLAG_DEPRESSED
Definition enums.h:2492
@ PS_FLAG_ACTION_STATE_CHANGED
Definition enums.h:3084
@ PS_FLAG_ARMS_RAISED
Definition enums.h:3063
@ PS_FLAG_AIRBORNE
Definition enums.h:3033
@ PS_FLAG_NO_STATIC_COLLISION
Definition enums.h:3051
@ PS_FLAG_INPUT_DISABLED
Definition enums.h:3052
@ 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_8BIT_MARIO
Definition enums.h:3105
@ PA_FLAG_USING_PEACH_PHYSICS
Definition enums.h:3103
@ PA_FLAG_USING_WATT
Definition enums.h:3090
@ PEACH_BAKING_CAKE_MIXED
Definition enums.h:2507
@ PEACH_BAKING_CAKE_BOWL
Definition enums.h:2506
@ PEACH_BAKING_BUTTER
Definition enums.h:2499
@ PEACH_BAKING_CAKE_WITH_ICING
Definition enums.h:2513
@ PEACH_BAKING_NONE
Definition enums.h:2496
@ PEACH_BAKING_WATER
Definition enums.h:2501
@ PEACH_BAKING_COMPLETE_CAKE
Definition enums.h:2505
@ PEACH_BAKING_FLOUR
Definition enums.h:2503
@ PEACH_BAKING_SUGAR
Definition enums.h:2512
@ PEACH_BAKING_CAKE_PAN
Definition enums.h:2508
@ PEACH_BAKING_STRAWBERRY
Definition enums.h:2498
@ PEACH_BAKING_CAKE_WITH_BERRIES
Definition enums.h:2514
@ PEACH_BAKING_EGG
Definition enums.h:2504
@ PEACH_BAKING_CAKE_BATTER
Definition enums.h:2509
@ PEACH_BAKING_MILK
Definition enums.h:2502
@ PEACH_BAKING_CLEANSER
Definition enums.h:2500
@ PEACH_BAKING_SALT
Definition enums.h:2511
@ PEACH_BAKING_CAKE_BARE
Definition enums.h:2510
@ PEACH_BAKING_CREAM
Definition enums.h:2497
@ ACTION_STATE_IDLE
Definition enums.h:2426
@ ACTION_STATE_RAISE_ARMS
Definition enums.h:2456
@ ACTION_STATE_WALK
Definition enums.h:2427
void peach_set_disguise_anim(AnimID)
Definition 7E9D0.c:506
void player_input_to_move_vector(f32 *angle, f32 *magnitude)
Definition 7B440.c:140
void set_action_state(s32 actionState)
Definition 7E9D0.c:209
void phys_update_interact_collider(void)
Definition 7BB60.c:1127
void suggest_player_anim_allow_backward(AnimID anim)
Definition 77480.c:894
b32 check_input_hammer(void)
Definition 7E9D0.c:321
b32 check_input_jump(void)
Definition 7E9D0.c:344
AnimID IdlePeachAnims[]
Definition idle.c:5
void action_update_idle(void)
Definition idle.c:36
@ SUBSTATE_IDLE_STRETCH
Definition idle.c:29
@ SUBSTATE_IDLE_DEFAULT
Definition idle.c:28
@ SUBSTATE_IDLE_SLEEP
Definition idle.c:31
@ SUBSTATE_DELAY_SLEEP
Definition idle.c:30
void action_update_idle_peach(void)
Definition idle.c:103
GameStatus gGameStatus
Definition main_loop.c:21
PlayerData gPlayerData
Definition 77480.c:40
PlayerStatus gPlayerStatus
Definition 77480.c:39