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

Go to the source code of this file.

Enumerations

enum  { BTL_SUBSTATE_CHECK_LIFE_SHROOM = 1 , BTL_SUBSTATE_AWAIT_LIFE_SHROOM = 2 , BTL_SUBSTATE_DONE = 10 }
 

Functions

void btl_state_update_defeat (void)
 
void btl_state_draw_defeat (void)
 

Enumeration Type Documentation

◆ anonymous enum

Enumerator
BTL_SUBSTATE_CHECK_LIFE_SHROOM 
BTL_SUBSTATE_AWAIT_LIFE_SHROOM 
BTL_SUBSTATE_DONE 

Definition at line 4 of file defeat.c.

4 {
5 // BTL_SUBSTATE_INIT = 0,
9};
@ BTL_SUBSTATE_CHECK_LIFE_SHROOM
Definition defeat.c:6
@ BTL_SUBSTATE_AWAIT_LIFE_SHROOM
Definition defeat.c:7
@ BTL_SUBSTATE_DONE
Definition defeat.c:8

Function Documentation

◆ btl_state_update_defeat()

void btl_state_update_defeat ( void )

Definition at line 11 of file defeat.c.

11 {
13 Actor* player = battleStatus->playerActor;
14 Actor* partner = battleStatus->partnerActor;
15 Evt* script;
16
17 switch (gBattleSubState) {
24 battleStatus->stateFreezeCount = 0;
25
26 // clear player debuffs
27 if (player->debuff != 0) {
28 if (player->debuff == STATUS_KEY_FROZEN) {
31 player->icePillarEffect = NULL;
32 }
33 player->debuff = 0;
34 player->debuffDuration = 0;
36 player->koStatus = 0;
37 player->koDuration = 0;
39 }
40
43
44 // prompt player to handle PHASE_DEATH
45 battleStatus->battlePhase = PHASE_DEATH;
47 player->takeTurnScript = script;
48 player->takeTurnScriptID = script->id;
49 script->owner1.actorID = ACTOR_PLAYER;
50
51 // prompt partner to handle PHASE_DEATH
52 if (partner != NULL) {
53 script = start_script(partner->takeTurnSource, EVT_PRIORITY_A, 0);
54 partner->takeTurnScript = script;
55 partner->takeTurnScriptID = script->id;
56 script->owner1.actorID = ACTOR_PARTNER;
57 }
59 break;
61 // wait for player PHASE_DEATH event to complete (ignore partner script)
62 if (does_script_exist(player->takeTurnScriptID) || battleStatus->stateFreezeCount != 0) {
63 break;
64 }
65 if (find_item(ITEM_LIFE_SHROOM) >= 0) {
66 // prompt player to handle PHASE_USE_LIFE_SHROOM
69 player->takeTurnScript = script;
70 player->takeTurnScriptID = script->id;
71 script->owner1.actorID = ACTOR_PLAYER;
73 } else {
75 }
76 break;
78 // wait for player PHASE_USE_LIFE_SHROOM event to complete
79 if (does_script_exist(player->takeTurnScriptID) || battleStatus->stateFreezeCount != 0) {
80 break;
81 }
82 // never reached if life shroom is successful. its item script calls RestorePreDefeatState,
83 // resetting the state to BATTLE_STATE_ENEMY_MOVE (based on the value of gDefeatedBattleState)
85 break;
86 }
87
91 bgm_set_song(0, -1, 0, 1500, 8);
92 }
94 }
95}
BSS s32 PopupMenu_SelectedIndex
s32 bgm_set_song(s32 playerIndex, s32 songID, s32 variation, s32 fadeOutTime, s16 volume)
struct EffectInstance * disableEffect
struct Evt * takeTurnScript
s32 takeTurnScriptID
struct EffectInstance * icePillarEffect
s16 hudElementDataIndex
s8 debuffDuration
struct DisableXFXData * disableX
Definition effects.h:2529
EffectInstanceDataPtr data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3551
@ PHASE_USE_LIFE_SHROOM
Definition enums.h:2098
@ PHASE_DEATH
Definition enums.h:2094
@ BS_FLAGS2_DONT_STOP_MUSIC
Definition enums.h:3652
@ STATUS_KEY_FROZEN
Definition enums.h:2808
@ BTL_CAM_PLAYER_FLEE
Definition enums.h:4432
@ BATTLE_STATE_END_BATTLE
Definition enums.h:3694
@ SOUND_FROZEN_SHATTER
Definition enums.h:725
@ ACTOR_PLAYER
Definition enums.h:2118
@ ACTOR_PARTNER
Definition enums.h:2119
@ OUTCOME_PLAYER_LOST
Definition enums.h:1929
@ EVT_PRIORITY_A
Definition evt.h:154
void remove_status_debuff(s32)
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)
s32 find_item(s32)
Search player inventory for itemID and return first matching array index.
Definition inventory.c:263
s32 does_script_exist(s32 id)
void btl_set_state(s32 battleState)
EvtScript EVS_Mario_HandlePhase
EncounterStatus gCurrentEncounter
Definition encounter.c:175
s8 battleOutcome
Definition npc.h:372
void sfx_play_sound(s32 soundID)
@ BTL_SUBSTATE_INIT
Definition states.h:8
BattleStatus gBattleStatus
Definition battle.cpp:14
s32 gBattleSubState
Definition battle.cpp:17

Referenced by btl_update().

◆ btl_state_draw_defeat()

void btl_state_draw_defeat ( void )

Definition at line 97 of file defeat.c.

97 {
98}

Referenced by btl_draw_ui().