Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
end_battle.c
Go to the documentation of this file.
1#include "states.h"
2#include "script_api/battle.h"
3#include "game_modes.h"
4
6
7enum {
8 // BTL_SUBSTATE_INIT = 0,
13};
14
19 Stage* stage;
20 Evt* script;
21 s32 i;
22
23 switch (gBattleSubState) {
28 }
34 }
36 break;
38 if (BattleScreenFadeAmt == 255) {
40 break;
41 }
42 BattleScreenFadeAmt += battleStatus->endBattleFadeOutRate;
43 if (BattleScreenFadeAmt > 255) {
45 }
46 break;
50 if (gCurrentStagePtr == NULL) {
51 stage = battle->stage;
52 } else {
53 stage = gCurrentStagePtr->stage;
54 }
55 if (stage->postBattle == NULL) {
57 return;
58 }
60 battleStatus->controlScript = script;
61 battleStatus->controlScriptID = script->id;
63 break;
65 if (does_script_exist(battleStatus->controlScriptID)) {
66 break;
67 }
69 // fallthrough
72 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
73 if (battleStatus->enemyActors[i] != NULL) {
74 btl_delete_actor(battleStatus->enemyActors[i]);
75 }
76 }
77 if (battleStatus->partnerActor != NULL) {
78 btl_delete_actor(battleStatus->partnerActor);
79 }
80
82
83 if (battleStatus->nextMerleeSpellType == MERLEE_SPELL_COIN_BOOST) {
84 encounterStatus->hasMerleeCoinBonus = TRUE;
85 battleStatus->nextMerleeSpellType = MERLEE_SPELL_NONE;
86 }
87
88 encounterStatus->damageTaken = battleStatus->damageTaken;
89
91 encounterStatus->dropWhackaBump = TRUE;
92 }
93
96
99 }
100
101 if (encounterStatus->battleOutcome == OUTCOME_PLAYER_LOST &&
103 {
104 s16 areaID;
105 s16 mapID;
106
109 get_map_IDs_by_name_checked("gv_01", &areaID, &mapID);
110 gGameStatusPtr->areaID = areaID;
111 gGameStatusPtr->mapID = mapID;
114 } else {
117 func_8003E514(1);
119 }
120 break;
121 }
122}
123
s32 BattleScreenFadeAmt
Definition 16C8E0.c:50
BSS s32 PopupMenu_SelectedIndex
BSS Battle * gCurrentBattlePtr
Definition battle.cpp:22
void btl_state_update_end_battle(void)
Definition end_battle.c:15
@ BTL_SUBSTATE_FADE_OUT
Definition end_battle.c:9
@ BTL_SUBSTATE_EXEC_STAGE_SCRIPT
Definition end_battle.c:10
@ BTL_SUBSTATE_CLEANUP
Definition end_battle.c:12
@ BTL_SUBSTATE_AWAIT_STAGE_SCRIPT
Definition end_battle.c:11
StageListRow * gCurrentStagePtr
Definition battle.cpp:12
void btl_state_draw_end_battle(void)
Definition end_battle.c:124
@ gv_01_ENTRY_0
Definition entrances.h:1286
@ MERLEE_SPELL_COIN_BOOST
Definition enums.h:1940
@ MERLEE_SPELL_NONE
Definition enums.h:1936
@ OVERLAY_SCREEN_MARIO
Definition enums.h:2381
@ OVERLAY_SCREEN_COLOR
Definition enums.h:2374
@ BS_FLAGS1_NO_GAME_OVER
Definition enums.h:3625
@ DEBUG_CONTACT_DIE_ON_TOUCH
Definition enums.h:3868
@ SCREEN_LAYER_FRONT
Definition enums.h:2368
@ BS_FLAGS2_PEACH_BATTLE
Definition enums.h:3643
@ BS_FLAGS2_DROP_WHACKA_BUMP
Definition enums.h:3655
@ BTL_CAM_INTERRUPT
Definition enums.h:4408
@ BATTLE_STATE_NONE
Definition enums.h:3664
@ OUTCOME_PLAYER_LOST
Definition enums.h:1929
@ EVT_PRIORITY_A
Definition evt.h:154
void kill_all_scripts(void)
void get_map_IDs_by_name_checked(const char *mapName, s16 *areaID, s16 *mapID)
Same as get_map_IDs_by_name, but will panic if the map doesn't exist.
Definition world.c:247
void decrement_status_bar_disabled(void)
Definition inventory.c:1656
void set_screen_overlay_params_front(u8, f32)
void remove_all_effects(void)
Definition effects.c:278
void btl_cam_use_preset(s32)
Definition camera.c:1919
Evt * start_script(EvtScript *source, s32 priority, s32 initialState)
void set_screen_overlay_center(s32, s32, s32, s32)
void set_screen_overlay_color(s32, u8, u8, u8)
void btl_delete_player_actor(Actor *player)
Definition 16C8E0.c:1107
void set_windows_visible(s32 groupIdx)
Definition windows.c:445
s32 does_script_exist(s32 id)
void btl_delete_actor(Actor *actor)
Definition 16C8E0.c:1041
void btl_set_state(s32 battleState)
void btl_cam_unfreeze(void)
Definition camera.c:2002
void set_game_mode(s32 modeID)
Definition game_modes.c:127
@ GAME_MODE_END_BATTLE
Definition game_modes.h:16
@ GAME_MODE_GAME_OVER
Definition game_modes.h:14
void func_8003E514(s8 arg0)
Definition npc.c:2264
EncounterStatus gCurrentEncounter
Definition encounter.c:175
s8 battleOutcome
Definition npc.h:372
#define ARRAY_COUNT(arr)
Definition macros.h:40
Stage * stage
Definition battle.h:208
EvtScript * postBattle
Definition battle.h:186
Zero-terminated.
Definition battle.h:195
Zero-terminated.
Definition battle.h:206
@ BTL_SUBSTATE_INIT
Definition states.h:8
@ BTL_SUBSTATE_END_BATTLE_EXEC_STAGE_SCRIPT
Definition states.h:11
union Camera::@17 params
s32 gBattleState
Definition battle.cpp:13
GameStatus * gGameStatusPtr
Definition main_loop.c:31
Camera gCameras[4]
Definition cam_main.c:16
BattleStatus gBattleStatus
Definition battle.cpp:14
s32 gCurrentCameraID
Definition cam_math.c:5
s32 gBattleSubState
Definition battle.cpp:17
s32 gLastDrawBattleState
Definition battle.cpp:15