Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
menu_twink.c
Go to the documentation of this file.
1#include "states.h"
2#include "battle/battle.h"
4#include "sprite/npc/Twink.h"
5
6enum {
7 // BTL_SUBSTATE_INIT = 0,
19};
20
22
26
29 Actor* player = battleStatus->playerActor;
30 Actor* partner = battleStatus->partnerActor;
33 s32 initialPos;
35
36 switch (gBattleSubState) {
39
40 switch (player->debuff) {
46 case STATUS_KEY_STOP:
48 break;
49 default:
50 break;
51 }
52
53 if (player->stoneStatus == STATUS_KEY_STONE) {
55 }
56
57 if (player->koStatus == STATUS_KEY_KO) {
59 }
60
61 if (shouldSkipTurn) {
63 break;
64 }
65
67 btl_cam_move(10);
69 // if the player (Peach) is in front, we need to swap her to the back before opening the menu
70 player->state.curPos.x = player->homePos.x;
71 player->state.curPos.z = player->homePos.z;
72 player->state.goalPos.x = partner->homePos.x;
73 player->state.goalPos.z = partner->homePos.z;
74 player->state.moveTime = 4;
75 player->state.angle = 0.0f;
77 } else {
79 }
80 break;
82 if (player->state.moveTime != 0) {
83 player->curPos.x += (player->state.goalPos.x - player->curPos.x) / player->state.moveTime;
84 player->curPos.z += (player->state.goalPos.z - player->curPos.z) / player->state.moveTime;
85 partner->curPos.x += (player->state.curPos.x - partner->curPos.x) / player->state.moveTime;
86 partner->curPos.z += (player->state.curPos.z - partner->curPos.z) / player->state.moveTime;
87 }
88 player->curPos.z += sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f;
89 player->yaw = clamp_angle(-player->state.angle);
90 partner->curPos.z -= sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f;
91 partner->yaw = clamp_angle(-player->state.angle);
92 player->state.angle += 90.0f;
93 if (player->state.moveTime != 0) {
94 player->state.moveTime--;
95 break;
96 }
97 player->curPos.x = player->state.goalPos.x;
98 player->curPos.z = player->state.goalPos.z;
99 partner->curPos.x = player->state.curPos.x;
100 partner->curPos.z = player->state.curPos.z;
101 player->homePos.x = player->curPos.x;
102 player->homePos.z = player->curPos.z;
103 partner->homePos.x = partner->curPos.x;
104 partner->homePos.z = partner->curPos.z;
106 // fallthrough
111 if (partner != NULL) {
114 }
115
116 // add main menu entry for star powers
117 entryIdx = 0;
118 battleStatus->selectedMoveID = MOVE_NONE;
124 if (!(battleStatus->enabledMenusFlags & BTL_MENU_ENABLED_STAR_POWERS)) {
128 }
129 entryIdx++;
130
131 initialPos = 0;
133 BattleMenu_PrevSelected = initialPos;
134 BattleMenu_WheelBase = 2 - initialPos;
135
138 } else {
140 }
141
145 break;
149 if (BattleMenu_ChooseDelay != 0) {
151 break;
152 }
153 if (selection != 0) {
155 battleStatus->curSubmenu = WheelOptionSubmenu[selection - 1];
160 }
161 break;
163 if (btl_main_menu_update() != 0) {
164 battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_TARGET_CANCEL;
165 battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_TARGET_CHOSEN;
167 battleStatus->selectedMoveID = MOVE_TWINK_DASH;
168 battleStatus->moveArgument = 0;
169 battleStatus->curTargetListFlags = gMoveTable[MOVE_TWINK_DASH].flags;
171 }
172 break;
178 break;
181 break;
186 break;
189 break;
190 }
194 break;
195 }
196}
197
199 switch (gBattleSubState) {
202 break;
205 break;
208 break;
211 break;
214 break;
219 break;
220 }
221}
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_PLAYER_TURN_USED
Definition enums.h:3638
@ 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_UNUSED
Definition enums.h:2804
@ STATUS_KEY_STONE
Definition enums.h:2813
@ STATUS_KEY_STOP
Definition enums.h:2809
@ STATUS_KEY_DIZZY
Definition enums.h:2805
@ BTL_CAM_DEFAULT
Definition enums.h:4409
@ BATTLE_STATE_END_PLAYER_TURN
Definition enums.h:3686
@ BATTLE_STATE_SELECT_TARGET
Definition enums.h:3681
@ BTL_MENU_ENABLED_STAR_POWERS
Definition enums.h:3846
@ ACTOR_PARTNER
Definition enums.h:2119
@ 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_draw_twink_menu(void)
Definition menu_twink.c:198
s32 TwinkMenuMessages[]
Definition menu_twink.c:23
IconHudScriptPair TwinkStarPowerHudScripts
Definition menu_twink.c:21
@ BTL_SUBSTATE_UNUSED_7
Definition menu_twink.c:14
@ BTL_SUBSTATE_CREATE_MAIN_MENU
Definition menu_twink.c:18
@ BTL_SUBSTATE_TARGET_CANCEL
Definition menu_twink.c:11
@ BTL_SUBSTATE_AWAIT_CANT_SWITCH_POPUP
Definition menu_twink.c:16
@ BTL_SUBSTATE_TARGET_CHOSEN
Definition menu_twink.c:12
@ BTL_SUBSTATE_SWAP_PEACH_BACK
Definition menu_twink.c:17
@ BTL_SUBSTATE_CHOOSE_TARGET
Definition menu_twink.c:9
@ BTL_SUBSTATE_CHOOSE_CATEGORY
Definition menu_twink.c:8
@ BTL_SUBSTATE_UNUSED_6
Definition menu_twink.c:13
@ BTL_SUBSTATE_UNUSED_3
Definition menu_twink.c:10
@ BTL_SUBSTATE_SHOW_CANT_SWITCH
Definition menu_twink.c:15
void btl_state_update_twink_menu(void)
Definition menu_twink.c:27
#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[]