Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
change_partner.c
Go to the documentation of this file.
1#include "states.h"
2#include "script_api/battle.h"
3
4enum {
5 // BTL_SUBSTATE_INIT = 0,
12};
13
14API_CALLABLE(EnablePartnerBlur) {
16 return ApiStatus_DONE2;
17}
18
19API_CALLABLE(DisablePartnerBlur) {
21 return ApiStatus_DONE2;
22}
23
45
65
68 Actor* player = battleStatus->playerActor;
69 Actor* partner = battleStatus->partnerActor;
71 Evt* script;
72 s32 i;
73
74 switch (gBattleSubState) {
78 battleStatus->stateFreezeCount = 0;
81 btl_cam_set_target_pos(-89.0, 40.0, -99.0);
85
86 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
87 enemyActor = battleStatus->enemyActors[i];
88 if (enemyActor != NULL) {
91 }
92 }
93
94 battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_MAIN] = -1;
97
98 // fallthrough
100 if (BattleSubstateDelay != 0) {
102 break;
103 }
106 battleStatus->controlScript = script;
107 battleStatus->controlScriptID = script->id;
108 script->owner1.actorID = ACTOR_PARTNER;
109 player->state.unk_18.x = partner->curPos.x;
110 player->state.unk_18.y = 0.0f;
111 player->state.unk_18.z = partner->curPos.z;
113 break;
115 if (does_script_exist(battleStatus->controlScriptID)) {
116 break;
117 }
119 gPlayerData.curPartner = battleStatus->lastSelectedPartner;
121 partner = battleStatus->partnerActor;
122 partner->scale.x = 0.1f;
123 partner->scale.y = 0.1f;
124 partner->scale.z = 0.1f;
125 partner->state.goalPos.x = player->state.unk_18.x;
126 partner->state.goalPos.y = partner->curPos.y;
127 partner->state.goalPos.z = player->state.unk_18.z;
128 partner->curPos.x = player->curPos.x;
129 partner->curPos.y = player->curPos.y + 25.0f;
130 partner->curPos.z = player->curPos.z;
132 break;
134 partner = battleStatus->partnerActor;
135 if (partner != NULL) {
136 if (does_script_exist(partner->takeTurnScriptID)) {
137 break;
138 }
139 partner->takeTurnScript = NULL;
140 }
141
143 battleStatus->controlScript = script;
144 battleStatus->controlScriptID = script->id;
145 script->owner1.actorID = ACTOR_PARTNER;
147 break;
149 if (does_script_exist(battleStatus->controlScriptID)) {
150 break;
151 }
152 partner = battleStatus->partnerActor;
153 if (partner != NULL) {
154 if (partner->handlePhaseSource != NULL) {
155 battleStatus->battlePhase = PHASE_PLAYER_BEGIN;
156 script = start_script(partner->handlePhaseSource, EVT_PRIORITY_A, 0);
157 partner->handlePhaseScript = script;
158 partner->handlePhaseScriptID = script->id;
159 script->owner1.actorID = ACTOR_PARTNER;
160 }
161 }
163 break;
165 partner = battleStatus->partnerActor;
166 if (partner != NULL) {
167 if (partner->handlePhaseSource != NULL && does_script_exist(partner->handlePhaseScriptID)) {
168 break;
169 }
170 }
173 break;
175 if (battleStatus->stateFreezeCount != 0) {
176 break;
177 }
182 } else {
184 }
185 } else {
188 } else {
190 }
191 }
192 break;
193 }
194}
195
BSS s32 PopupMenu_SelectedIndex
BSS s32 BattleSubstateDelay
void btl_state_update_change_partner(void)
EvtScript EVS_BtlPutPartnerAway
@ BTL_SUBSTATE_LOAD_NEW_PARTNER
@ BTL_SUBSTATE_EXEC_PUT_AWAY
@ BTL_SUBSTATE_AWAIT_PHASE
@ BTL_SUBSTATE_DONE
@ BTL_SUBSTATE_EXEC_PHASE
@ BTL_SUBSTATE_EXEC_BRING_OUT
EvtScript EVS_BtlBringPartnerOut
void btl_state_draw_change_partner(void)
ActorState state
Vec3f curPos
Bytecode EvtScript[]
@ BS_FLAGS1_PARTNER_ACTING
Definition enums.h:3621
@ PHASE_PLAYER_BEGIN
Definition enums.h:2099
@ BS_FLAGS2_OVERRIDE_INACTIVE_PARTNER
Definition enums.h:3641
@ BTL_CAM_DEFAULT
Definition enums.h:4409
@ BTL_CAM_REPOSITION
Definition enums.h:4426
@ BATTLE_STATE_PREPARE_MENU
Definition enums.h:3676
@ BATTLE_STATE_END_PARTNER_TURN
Definition enums.h:3687
@ BATTLE_STATE_END_PLAYER_TURN
Definition enums.h:3686
@ ABILITY_QUICK_CHANGE
Definition enums.h:462
@ SOUND_PARTNER_GET_OUT
Definition enums.h:562
@ SOUND_PARTNER_PUT_AWAY
Definition enums.h:561
@ ACTOR_PARTNER
Definition enums.h:2119
@ BTL_MENU_IDX_MAIN
Definition enums.h:3811
@ EVENT_PUT_PARTNER_AWAY
Definition enums.h:2210
@ EVT_PRIORITY_A
Definition evt.h:154
#define ApiStatus_DONE2
Definition evt.h:119
void load_partner_actor(void)
Definition 190B20.c:1154
void disable_partner_blur(void)
s32 player_team_is_ability_active(Actor *actor, s32 ability)
Definition 190B20.c:2497
void btl_cam_set_zoom(s16)
Definition camera.c:1984
void enable_partner_blur(void)
void btl_cam_set_target_pos(f32, f32, f32)
Definition camera.c:1962
void btl_cam_use_preset(s32)
Definition camera.c:1919
Evt * start_script(EvtScript *source, s32 priority, s32 initialState)
void btl_cam_set_zoffset(s16)
Definition camera.c:1996
void deduct_current_move_fp(void)
Definition 190B20.c:693
s32 does_script_exist(s32 id)
void btl_delete_actor(Actor *actor)
Definition 16C8E0.c:1041
void btl_set_state(s32 battleState)
#define AddF(VAR, FLOAT_VALUE)
Definition macros.h:384
#define EndChildThread
Marks the end of a child thread block.
Definition macros.h:564
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:214
#define Add(VAR, INT_VALUE)
Definition macros.h:377
#define EndLoop
Marks the end of a loop.
Definition macros.h:249
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define Float(DOUBLE)
Definition macros.h:52
#define SetF(VAR, FLOAT_VALUE)
Sets the given variable to a given value, but supports Floats.
Definition macros.h:374
#define LVar2
Definition macros.h:151
#define LVar1
Definition macros.h:150
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:255
#define SubF(VAR, FLOAT_VALUE)
Definition macros.h:385
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:577
#define ChildThread
Marks the start of a child thread block.
Definition macros.h:561
#define Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:246
#define LVar0
Definition macros.h:149
#define Return
Kills the current EVT thread.
Definition macros.h:218
@ BTL_SUBSTATE_INIT
Definition states.h:8
PlayerData gPlayerData
Definition 77480.c:39
BattleStatus gBattleStatus
Definition battle.cpp:14
s32 gBattleSubState
Definition battle.cpp:17