Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
menu_peach.c
Go to the documentation of this file.
1#include "states.h"
2#include "battle/battle.h"
4#include "sprite/player.h"
5
6enum {
7 // BTL_SUBSTATE_INIT = 0,
16};
17
19
23
26 Actor* player = battleStatus->playerActor;
27 Actor* partner = battleStatus->partnerActor;
28 s32 selectedOption;
29 s32 initialPos;
31
32 switch (gBattleSubState) {
35 btl_cam_move(10);
37 // if the player (Peach) is in back, we need to swap her to the front before opening the menu
38 player->state.curPos.x = player->homePos.x;
39 player->state.curPos.z = player->homePos.z;
40 player->state.goalPos.x = partner->homePos.x;
41 player->state.goalPos.z = partner->homePos.z;
42 player->state.moveTime = 4;
43 player->state.angle = 0.0f;
45 } else {
47 }
48 break;
50 if (player->state.moveTime != 0) {
51 player->curPos.x += (player->state.goalPos.x - player->curPos.x) / player->state.moveTime;
52 player->curPos.z += (player->state.goalPos.z - player->curPos.z) / player->state.moveTime;
53 partner->curPos.x += (player->state.curPos.x - partner->curPos.x) / player->state.moveTime;
54 partner->curPos.z += (player->state.curPos.z - partner->curPos.z) / player->state.moveTime;
55 }
56
57 player->curPos.z -= sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f;
58 player->yaw = clamp_angle(-player->state.angle);
59 partner->curPos.z += sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f;
60 partner->yaw = clamp_angle(-player->state.angle);
61 player->state.angle += 90.0f;
62
63 if (player->state.moveTime != 0) {
64 player->state.moveTime--;
65 break;
66 }
67
68 player->curPos.x = player->state.goalPos.x;
69 player->curPos.z = player->state.goalPos.z;
70 partner->curPos.x = player->state.curPos.x;
71 partner->curPos.z = player->state.curPos.z;
72 player->homePos.x = player->curPos.x;
73 player->homePos.z = player->curPos.z;
74 partner->homePos.x = partner->curPos.x;
75 partner->homePos.z = partner->curPos.z;
77 // fallthrough
82 if (partner != NULL) {
85 }
86
87 // add main menu entry for star powers
88 entryIdx = 0;
89 battleStatus->selectedMoveID = MOVE_NONE;
95 if (!(battleStatus->enabledMenusFlags & BTL_MENU_ENABLED_STAR_POWERS)) {
99 }
100 entryIdx++;
101
102 initialPos = 0;
104 BattleMenu_PrevSelected = initialPos;
105 BattleMenu_WheelBase = 2 - initialPos;
106
109 } else {
111 }
112
116 break;
119 selectedOption = btl_main_menu_update();
120 if (BattleMenu_ChooseDelay != 0) {
122 break;
123 }
124 if (selectedOption != 0) {
126 battleStatus->curSubmenu = WheelOptionSubmenu[selectedOption - 1];
131 }
132 break;
134 if (btl_main_menu_update() != 0) {
135 battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_TARGET_CANCEL;
136 battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_TARGET_CHOSEN;
137 battleStatus->curTargetListFlags = gMoveTable[MOVE_PEACH_FOCUS].flags;
139 battleStatus->selectedMoveID = MOVE_PEACH_FOCUS;
142 }
143 break;
149 break;
152 break;
157 break;
160 break;
161 }
165 break;
166 }
167}
168
170 switch (gBattleSubState) {
173 break;
176 break;
179 break;
182 break;
185 break;
186 }
187}
BSS s32 PopupMenu_SelectedIndex
void btl_main_menu_resume_choose(void)
void btl_main_menu_destroy(void)
s32 BattleMenu_ChooseDelay
s8 ShowingErrorMessage
Definition menu_strats.c:54
s32 WheelOptionEnabled[]
s32 WheelOptionName[]
void btl_main_menu_init(void)
s32 btl_main_menu_update(void)
s32 BattleMenu_SwapDelay
s32 WheelOptionError[]
s32 WheelOptionSubmenu[]
#define MENU_CHANGE_DELAY
Definition battle_menu.h:7
void btl_main_menu_hide(void)
HudScript * WheelOptionHudScript[]
s32 BattleMenu_WheelBase
HudScript HES_MenuStarPowerDisabled
s32 BattleMenu_PrevSelected
s32 WheelOptionCount
void btl_main_menu_draw(void)
b32 BattleMenu_ShowSwapIcons
HudScript HES_MenuStarPower
ActorState state
Vec3f homePos
Vec3f curPos
#define clamp_angle
@ BS_FLAGS1_PLAYER_IN_BACK
Definition enums.h:3622
@ BS_FLAGS1_MENU_OPEN
Definition enums.h:3599
@ BTL_MSG_CANT_SWITCH
Definition enums.h:3782
@ BTL_MSG_CANT_SELECT_NOW
Definition enums.h:3774
@ BTL_MENU_TYPE_STAR_POWERS
Definition enums.h:3834
@ BS_FLAGS2_PARTNER_TURN_USED
Definition enums.h:3639
@ BTL_CAM_DEFAULT
Definition enums.h:4409
@ BATTLE_STATE_SELECT_TARGET
Definition enums.h:3681
@ BTL_MENU_ENABLED_STAR_POWERS
Definition enums.h:3846
@ ACTOR_PLAYER
Definition enums.h:2118
@ ACTOR_FLAG_SHOW_STATUS_ICONS
Definition enums.h:3377
@ ACTOR_FLAG_USING_IDLE_ANIM
Definition enums.h:3376
void btl_show_variable_battle_message(s32, s32, s32)
void btl_cam_use_preset(s32)
Definition camera.c:1919
void set_actor_anim(s32 actorID, s32 partID, AnimID animID)
Definition 190B20.c:737
void btl_cam_move(s16)
Definition camera.c:1953
f32 sin_rad(f32 x)
Definition 43F0.c:711
void btl_set_state(s32 battleState)
s32 btl_is_popup_displayed(void)
HudScript * disabled
HudScript * enabled
void btl_state_update_peach_menu(void)
Definition menu_peach.c:24
IconHudScriptPair PeachStarPowerHudScripts
Definition menu_peach.c:18
void btl_state_draw_peach_menu(void)
Definition menu_peach.c:169
@ BTL_SUBSTATE_CREATE_MAIN_MENU
Definition menu_peach.c:15
@ BTL_SUBSTATE_TARGET_CANCEL
Definition menu_peach.c:10
@ BTL_SUBSTATE_SWAP_PEACH_FRONT
Definition menu_peach.c:14
@ BTL_SUBSTATE_AWAIT_CANT_SWITCH_POPUP
Definition menu_peach.c:13
@ BTL_SUBSTATE_TARGET_CHOSEN
Definition menu_peach.c:11
@ BTL_SUBSTATE_CHOOSE_TARGET
Definition menu_peach.c:9
@ BTL_SUBSTATE_CHOOSE_CATEGORY
Definition menu_peach.c:8
@ BTL_SUBSTATE_SHOW_CANT_SWITCH
Definition menu_peach.c:12
s32 PeachMenuMessages[]
Definition menu_peach.c:20
#define DEG_TO_RAD(deg)
Definition macros.h:146
@ BTL_SUBSTATE_INIT
Definition states.h:8
BattleStatus gBattleStatus
Definition battle.cpp:14
s32 gBattleSubState
Definition battle.cpp:17
MoveData gMoveTable[]