Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
enemy_move.c File Reference

Go to the source code of this file.

Enumerations

enum  {
  BTL_SUBSTATE_EXECUTE = 0 , BTL_SUBSTATE_UNUSED_1 = 1 , BTL_SUBSTATE_AWAIT_SCRIPTS = 2 , BTL_SUBSTATE_AWAIT_PLAYER_POPUP_DONE = 11 ,
  BTL_SUBSTATE_POST_PLAYER_POPUP_DELAY = 12 , BTL_SUBSTATE_CHECK_PARTNER = 20 , BTL_SUBSTATE_AWAIT_PARTNER_POPUP_DONE = 21 , BTL_SUBSTATE_POST_PARTNER_POPUP_DELAY = 22 ,
  BTL_SUBSTATE_DONE = 30
}
 

Functions

void btl_state_update_enemy_move (void)
 
void btl_state_draw_enemy_move (void)
 

Enumeration Type Documentation

◆ anonymous enum

Enumerator
BTL_SUBSTATE_EXECUTE 
BTL_SUBSTATE_UNUSED_1 
BTL_SUBSTATE_AWAIT_SCRIPTS 
BTL_SUBSTATE_AWAIT_PLAYER_POPUP_DONE 
BTL_SUBSTATE_POST_PLAYER_POPUP_DELAY 
BTL_SUBSTATE_CHECK_PARTNER 
BTL_SUBSTATE_AWAIT_PARTNER_POPUP_DONE 
BTL_SUBSTATE_POST_PARTNER_POPUP_DELAY 
BTL_SUBSTATE_DONE 

Definition at line 3 of file enemy_move.c.

3 {
7 BTL_SUBSTATE_AWAIT_PLAYER_POPUP_DONE = 11, // wait for popups regarding player status to finish
8 BTL_SUBSTATE_POST_PLAYER_POPUP_DELAY = 12, // a brief delay after the popup vanishes
10 BTL_SUBSTATE_AWAIT_PARTNER_POPUP_DONE = 21, // wait for popups regarding partner status to finish
11 BTL_SUBSTATE_POST_PARTNER_POPUP_DELAY = 22, // a brief delay after the popup vanishes
13};
@ BTL_SUBSTATE_POST_PARTNER_POPUP_DELAY
Definition enemy_move.c:11
@ BTL_SUBSTATE_POST_PLAYER_POPUP_DELAY
Definition enemy_move.c:8
@ BTL_SUBSTATE_UNUSED_1
Definition enemy_move.c:5
@ BTL_SUBSTATE_EXECUTE
Definition enemy_move.c:4
@ BTL_SUBSTATE_AWAIT_PARTNER_POPUP_DONE
Definition enemy_move.c:10
@ BTL_SUBSTATE_CHECK_PARTNER
Definition enemy_move.c:9
@ BTL_SUBSTATE_AWAIT_SCRIPTS
Definition enemy_move.c:6
@ BTL_SUBSTATE_DONE
Definition enemy_move.c:12
@ BTL_SUBSTATE_AWAIT_PLAYER_POPUP_DONE
Definition enemy_move.c:7

Function Documentation

◆ btl_state_update_enemy_move()

void btl_state_update_enemy_move ( void )

Definition at line 15 of file enemy_move.c.

15 {
19 Actor* enemy;
20 s32 i;
21
22 Evt* script;
23 s32 messageIndex;
25
26 switch (gBattleSubState) {
32 if (partner != NULL) {
34 }
35 battleStatus->stateFreezeCount = 0;
36 battleStatus->lastAttackDamage = 0;
37 battleStatus->actionQuality = 0;
38 battleStatus->actionResult = ACTION_RESULT_NONE;
39 battleStatus->blockResult = BLOCK_RESULT_NONE;
40 battleStatus->curDamageSource = DMG_SRC_DEFAULT;
43 player->statusAfflicted = 0;
44 if (partner != NULL) {
45 partner->statusAfflicted = 0;
46 }
47
49 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
50 enemy = battleStatus->enemyActors[i];
51 if (enemy != NULL) {
53 }
54 }
55
56 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
57 enemy = battleStatus->enemyActors[i];
58 if (enemy != NULL) {
59 if (!(enemy->flags & ACTOR_FLAG_NO_DMG_APPLY)) {
61 }
62 }
63 }
64
65 enemy = battleStatus->curTurnEnemy;
66 if (!(enemy->flags & ACTOR_FLAG_NO_ATTACK)) {
70 enemy->takeTurnScript = script;
71 enemy->takeTurnScriptID = script->id;
72 script->owner1.actorID = battleStatus->activeEnemyActorID;
73 }
75 break;
77 if (player->takeTurnScript != NULL && does_script_exist(player->takeTurnScriptID)) {
78 break;
79 }
80 player->takeTurnScript = NULL;
81
83 break;
84 }
85 player->handleEventScript = NULL;
86
87 if (partner != NULL) {
88 if (partner->handleEventScript != NULL && does_script_exist(partner->handleEventScriptID)) {
89 break;
90 }
91 partner->handleEventScript = NULL;
92 }
93
95 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
96 enemy = battleStatus->enemyActors[i];
97 if (enemy != NULL && enemy->handleEventScript != NULL) {
100 } else {
101 enemy->handleEventScript = NULL;
102 }
103 }
104 }
105
107 break;
108 }
109
111 return;
112 }
113
114 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
115 enemy = battleStatus->enemyActors[i];
116 if (enemy != NULL && enemy->takeTurnScript != NULL) {
119 } else {
120 enemy->takeTurnScript = NULL;
121 }
122 }
123 }
124
126 break;
127 }
128
132 return;
133 }
134
135 if (battleStatus->stateFreezeCount != 0) {
136 break;
137 }
138
141 } else {
143 if (player->statusAfflicted != 0) {
145 if (partner != NULL) {
147 }
149
150 switch (player->statusAfflicted) {
151 case STATUS_KEY_DIZZY:
152 messageIndex = BTL_MSG_PLAYER_DAZED;
153 break;
154 case STATUS_KEY_SLEEP:
155 messageIndex = BTL_MSG_PLAYER_ASLEEP;
156 break;
158 messageIndex = BTL_MSG_PLAYER_FROZEN;
159 break;
161 messageIndex = BTL_MSG_PLAYER_POISONED;
162 break;
164 messageIndex = BTL_MSG_PLAYER_SHRUNK;
165 break;
167 messageIndex = BTL_MSG_PLAYER_PARALYZED;
168 break;
169 default:
170 messageIndex = 0;
172 break;
173 }
174 btl_show_battle_message(messageIndex, 60);
175 player->statusAfflicted = 0;
177 break;
178 } else {
180 break;
181 }
182 }
183 break;
185 if (!btl_is_popup_displayed()) {
187 btl_cam_move(15);
190 }
191 break;
193 if (BattleSubstateDelay != 0) {
195 } else {
197 break;
198 }
199 break;
200 }
201
202 switch (gBattleSubState) {
204 if (partner != NULL) {
205 if (partner->statusAfflicted == STATUS_KEY_KO) {
210 partner->statusAfflicted = 0;
212 } else {
214 }
215 } else {
217 }
218 break;
220 if (!btl_is_popup_displayed()) {
222 btl_cam_move(15);
225 }
226 break;
228 if (BattleSubstateDelay != 0) {
230 } else {
232 }
233 break;
234 }
235
238 }
239}
BSS s32 PopupMenu_SelectedIndex
BSS s32 BattleSubstateDelay
struct Evt * takeTurnScript
struct Evt * handleEventScript
s32 takeTurnScriptID
s32 handleEventScriptID
EvtScript * takeTurnSource
s8 statusAfflicted
@ BS_FLAGS1_YIELD_TURN
Definition enums.h:3623
@ BS_FLAGS1_EXECUTING_MOVE
Definition enums.h:3611
@ BTL_MSG_PLAYER_FROZEN
Definition enums.h:3712
@ BTL_MSG_PLAYER_POISONED
Definition enums.h:3713
@ BTL_MSG_PLAYER_PARALYZED
Definition enums.h:3715
@ BTL_MSG_PLAYER_ASLEEP
Definition enums.h:3711
@ BTL_MSG_PLAYER_SHRUNK
Definition enums.h:3714
@ BTL_MSG_PARTNER_INJURED
Definition enums.h:3735
@ BTL_MSG_PLAYER_DAZED
Definition enums.h:3710
@ DEMO_BTL_FLAG_ENABLED
Definition enums.h:3576
@ PHASE_EXECUTE_ACTION
Definition enums.h:2091
@ BS_FLAGS2_IGNORE_DARKNESS
Definition enums.h:3648
@ STATUS_KEY_PARALYZE
Definition enums.h:2806
@ STATUS_KEY_FROZEN
Definition enums.h:2808
@ STATUS_KEY_KO
Definition enums.h:2814
@ STATUS_KEY_SLEEP
Definition enums.h:2807
@ 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_PLAYER_STATUS_AFFLICTED
Definition enums.h:4440
@ BATTLE_STATE_NEXT_ENEMY
Definition enums.h:3684
@ BATTLE_STATE_END_DEMO_BATTLE
Definition enums.h:3696
@ DMG_SRC_DEFAULT
Definition enums.h:2014
@ 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_NO_ATTACK
Skip attack turn.
Definition enums.h:3373
@ ACTOR_FLAG_USING_IDLE_ANIM
Definition enums.h:3376
@ BLOCK_RESULT_NONE
Definition enums.h:1998
@ ACTION_RESULT_NONE
Definition enums.h:1989
@ EVT_PRIORITY_A
Definition evt.h:154
void reset_all_actor_sounds(Actor *)
Definition 190B20.c:2670
s32 btl_check_player_defeated(void)
Definition 190B20.c:661
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
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
s32 does_script_exist(s32 id)
void btl_set_state(s32 battleState)
s32 btl_is_popup_displayed(void)
s32 btl_check_enemies_defeated(void)
Definition 190B20.c:653
#define ARRAY_COUNT(arr)
Definition macros.h:40
struct Actor * partnerActor
struct Actor * playerActor
GameStatus * gGameStatusPtr
Definition main_loop.c:31
BattleStatus gBattleStatus
Definition battle.cpp:14
s32 gBattleSubState
Definition battle.cpp:17

Referenced by btl_update().

◆ btl_state_draw_enemy_move()

void btl_state_draw_enemy_move ( void )

Definition at line 241 of file enemy_move.c.

241 {
242}

Referenced by btl_draw_ui().