Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
partner_move.c
Go to the documentation of this file.
1#include "states.h"
2
3enum {
4 // BTL_SUBSTATE_INIT = 0,
13};
14
18 Actor* player = battleStatus->playerActor;
19 Actor* partner = battleStatus->partnerActor;
21 Evt* script;
23 s32 messageIndex;
24 s32 i;
25
26 switch (gBattleSubState) {
28 if (partner == NULL) {
30 break;
31 }
32 battleStatus->stateFreezeCount = 0;
33 battleStatus->actionResult = ACTION_RESULT_NONE;
34 battleStatus->blockResult = BLOCK_RESULT_NONE;
35 battleStatus->curDamageSource = DMG_SRC_DEFAULT;
39 partner->statusAfflicted = 0;
46
47 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
48 enemyActor = battleStatus->enemyActors[i];
49 if (enemyActor != NULL) {
50 enemyActor->statusAfflicted = 0;
51 }
52 }
55 break;
57 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
58 enemyActor = battleStatus->enemyActors[i];
59 if (enemyActor != NULL) {
62 }
63 }
64
70 script = start_script(partner->takeTurnSource, EVT_PRIORITY_A, 0);
71 partner->takeTurnScript = script;
72 partner->takeTurnScriptID = script->id;
73 script->owner1.actorID = ACTOR_PARTNER;
75 break;
78 if (partner->takeTurnScript != NULL && does_script_exist(partner->takeTurnScriptID)) {
79 break;
80 }
81 partner->takeTurnScript = NULL;
82 }
84
85 if (partner->handleEventScript != NULL && does_script_exist(partner->handleEventScriptID)) {
86 break;
87 }
88 partner->handleEventScript = NULL;
89
91 break;
92 }
93 player->handleEventScript = NULL;
94
96 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
97 enemyActor = battleStatus->enemyActors[i];
98 if (enemyActor != NULL && enemyActor->takeTurnScript != NULL) {
99 if (does_script_exist(enemyActor->takeTurnScriptID)) {
101 } else {
102 enemyActor->takeTurnScript = NULL;
103 }
104 }
105 }
106 if (enemyFound) {
107 break;
108 }
109
111 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
112 enemyActor = battleStatus->enemyActors[i];
113 if (enemyActor != NULL && enemyActor->handleEventScript != NULL) {
114 if (does_script_exist(enemyActor->handleEventScriptID)) {
116 } else {
117 enemyActor->handleEventScript = NULL;
118 }
119 }
120 }
121 if (enemyFound) {
122 break;
123 }
124
125 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
126 enemyActor = battleStatus->enemyActors[i];
127 if (enemyActor != NULL) {
129 }
130 }
131
132 if (battleStatus->stateFreezeCount != 0) {
133 break;
134 }
135
138 break;
139 }
141 if (playerData->curPartner == PARTNER_GOOMBARIO
143 && battleStatus->selectedMoveID != MOVE_CHARGE) {
144 partner->isGlowing = FALSE;
146 }
148 return;
149 }
150
151 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
152 enemyActor = battleStatus->enemyActors[i];
153 if (enemyActor != NULL) {
154 if (!(enemyActor->flags & ACTOR_FLAG_NO_DMG_APPLY)) {
156 }
157 }
158 }
159
161
162 if (partner->statusAfflicted == STATUS_KEY_KO && !btl_are_all_enemies_defeated()) {
165 partner->statusAfflicted = 0;
166 partner->disableDismissTimer = 0;
169 } else {
171 }
172 break;
175 break;
176 }
178 btl_cam_move(15);
181 break;
183 if (BattleSubstateDelay != 0) {
185 } else {
187 }
188 break;
189 }
190
191 switch (gBattleSubState) {
194 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
195 enemyActor = battleStatus->enemyActors[i];
196 if (enemyActor != NULL) {
197 if (enemyActor->statusAfflicted != 0) {
199 break;
200 }
201 }
202 }
203 if (!enemyFound) {
205 break;
206 }
207
209 switch (enemyActor->statusAfflicted) {
210 case STATUS_KEY_DIZZY:
211 messageIndex = BTL_MSG_ENEMY_DAZED;
212 break;
213 case STATUS_KEY_SLEEP:
214 messageIndex = BTL_MSG_ENEMY_ASLEEP;
215 break;
217 messageIndex = BTL_MSG_ENEMY_FROZEN;
218 break;
220 messageIndex = BTL_MSG_ENEMY_POISONED;
221 break;
223 messageIndex = BTL_MSG_ENEMY_SHRUNK;
224 break;
226 messageIndex = BTL_MSG_ENEMY_PARALYZED;
227 break;
229 messageIndex = BTL_MSG_ENEMY_ELECTRIFIED;
230 break;
231 case STATUS_KEY_STOP:
232 messageIndex = BTL_MSG_ENEMY_CANT_MOVE;
233 break;
234 default:
235 messageIndex = 0;
237 break;
238 }
239
241 btl_show_battle_message(messageIndex, 60);
242
243 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
244 enemyActor = battleStatus->enemyActors[i];
245 if (enemyActor != NULL) {
246 enemyActor->statusAfflicted = 0;
247 }
248 }
250 break;
252 if (btl_is_popup_displayed() == FALSE) {
254 btl_cam_move(15);
257 }
258 break;
260 if (BattleSubstateDelay != 0) {
262 } else {
264 }
265 break;
266 }
267
269 if (partner->takeTurnScript != NULL && does_script_exist(partner->takeTurnScriptID)) {
270 return;
271 }
272 partner->takeTurnScript = NULL;
274 }
275}
276
BSS s32 PopupMenu_SelectedIndex
BSS s32 BattleSubstateDelay
struct Evt * handleEventScript
s32 handleEventScriptID
@ BS_FLAGS1_YIELD_TURN
Definition enums.h:3623
@ BS_FLAGS1_EXECUTING_MOVE
Definition enums.h:3611
@ BTL_MSG_ENEMY_ASLEEP
Definition enums.h:3719
@ BTL_MSG_ENEMY_POISONED
Definition enums.h:3721
@ BTL_MSG_ENEMY_CANT_MOVE
Definition enums.h:3725
@ BTL_MSG_ENEMY_PARALYZED
Definition enums.h:3723
@ BTL_MSG_ENEMY_FROZEN
Definition enums.h:3720
@ BTL_MSG_ENEMY_DAZED
Definition enums.h:3718
@ BTL_MSG_PARTNER_INJURED
Definition enums.h:3735
@ BTL_MSG_ENEMY_ELECTRIFIED
Definition enums.h:3724
@ BTL_MSG_ENEMY_SHRUNK
Definition enums.h:3722
@ DEMO_BTL_FLAG_ENABLED
Definition enums.h:3576
@ PHASE_EXECUTE_ACTION
Definition enums.h:2091
@ BTL_MENU_TYPE_CHANGE_PARTNER
Definition enums.h:3831
@ BS_FLAGS2_OVERRIDE_INACTIVE_PARTNER
Definition enums.h:3641
@ STATUS_KEY_PARALYZE
Definition enums.h:2806
@ STATUS_KEY_FROZEN
Definition enums.h:2808
@ STATUS_KEY_STATIC
Definition enums.h:2812
@ STATUS_KEY_KO
Definition enums.h:2814
@ STATUS_KEY_SLEEP
Definition enums.h:2807
@ STATUS_KEY_STOP
Definition enums.h:2809
@ STATUS_KEY_SHRINK
Definition enums.h:2811
@ STATUS_KEY_DIZZY
Definition enums.h:2805
@ STATUS_KEY_POISON
Definition enums.h:2810
@ BTL_CAM_PARTNER_INJURED
Definition enums.h:4461
@ BTL_CAM_DEFAULT
Definition enums.h:4409
@ BTL_CAM_VIEW_ENEMIES
Definition enums.h:4410
@ BATTLE_STATE_END_DEMO_BATTLE
Definition enums.h:3696
@ BATTLE_STATE_END_PARTNER_TURN
Definition enums.h:3687
@ BATTLE_STATE_TRANSFER_TURN
Definition enums.h:3673
@ DMG_SRC_DEFAULT
Definition enums.h:2014
@ SOUND_INFLICT_KO
Definition enums.h:1548
@ ACTOR_PARTNER
Definition enums.h:2119
@ ACTOR_FLAG_SHOW_STATUS_ICONS
Definition enums.h:3377
@ ACTOR_FLAG_NO_DMG_APPLY
Damage is not applied to actor HP.
Definition enums.h:3374
@ ACTOR_FLAG_USING_IDLE_ANIM
Definition enums.h:3376
@ PARTNER_GOOMBARIO
Definition enums.h:2920
@ BLOCK_RESULT_NONE
Definition enums.h:1998
@ ACTION_RESULT_NONE
Definition enums.h:1989
@ EVT_PRIORITY_A
Definition evt.h:154
s32 btl_are_all_enemies_defeated(void)
Definition 190B20.c:636
void reset_all_actor_sounds(Actor *)
Definition 190B20.c:2670
s32 btl_check_player_defeated(void)
Definition 190B20.c:661
void decrement_status_bar_disabled(void)
Definition inventory.c:1656
void btl_update_ko_status(void)
Definition 190B20.c:2601
void reset_actor_turn_info(void)
Definition 190B20.c:710
void btl_cam_use_preset(s32)
Definition camera.c:1919
void btl_cam_target_actor(s32)
Definition camera.c:1926
Evt * start_script(EvtScript *source, s32 priority, s32 initialState)
void btl_show_battle_message(s32 messageIndex, s32 duration)
void btl_cam_move(s16)
Definition camera.c:1953
void deduct_current_move_fp(void)
Definition 190B20.c:693
s32 does_script_exist(s32 id)
void btl_set_state(s32 battleState)
s32 btl_is_popup_displayed(void)
void increment_status_bar_disabled(void)
Definition inventory.c:1664
void btl_state_draw_partner_move(void)
void btl_state_update_partner_move(void)
@ BTL_SUBSTATE_POST_ENEMY_STATUS_POPUP
@ BTL_SUBSTATE_AWAIT_ENEMY_STATUS_POPUP
@ BTL_SUBSTATE_AWAIT_PARTNER_STATUS_POPUP
Definition partner_move.c:7
@ BTL_SUBSTATE_EXECUTE_MOVE
Definition partner_move.c:5
@ BTL_SUBSTATE_CHECK_ENEMY_STATUS
Definition partner_move.c:9
@ BTL_SUBSTATE_POST_PARTNER_STATUS_POPUP
Definition partner_move.c:8
@ BTL_SUBSTATE_HANDLE_RESULTS
Definition partner_move.c:6
@ BTL_SUBSTATE_DONE
void sfx_play_sound(s32 soundID)
#define ARRAY_COUNT(arr)
Definition macros.h:40
@ BTL_SUBSTATE_INIT
Definition states.h:8
GameStatus * gGameStatusPtr
Definition main_loop.c:31
PlayerData gPlayerData
Definition 77480.c:39
BattleStatus gBattleStatus
Definition battle.cpp:14
s32 gBattleSubState
Definition battle.cpp:17