6#include "sprite/npc/Twink.h"
7#include "sprite/npc/BattleMerlee.h"
10#include "sprite/player.h"
38API_CALLABLE(ForceDisablePlayerBlurImmediately);
52API_CALLABLE(IsPartnerImmobile) {
66 script->varTable[0] = isImmobile;
70API_CALLABLE(ActivateDefend) {
81API_CALLABLE(TryPlayerLucky) {
87 script->varTable[0] = FALSE;
95 script->varTable[0] = TRUE;
100API_CALLABLE(ChoosePlayerCelebrationAnim) {
108 for (i = 0; i < 8; i++) {
112 for (i = 0; i < 8; i++) {
119 script->varTable[0] = pcao->
options[i * 2 + 1];
122 f32 healthRatio = playerData->
curHP / (f32) playerData->
curMaxHP;
124 if (healthRatio <= 0.25) {
126 }
else if (healthRatio <= 0.5) {
128 }
else if (healthRatio <= 0.75) {
135 for (i = 0; i < 8; i++) {
139 for (i = 0; i < 8; i++) {
145 script->varTable[0] = opts[i * 2 + 1];
150API_CALLABLE(SetFledBattleFlag) {
155API_CALLABLE(DetermineAutoRunAwaySuccess) {
163 var = player->
state.varTable[0];
165 script->varTable[0] = TRUE;
167 script->varTable[0] = FALSE;
172API_CALLABLE(func_80260E38) {
177API_CALLABLE(func_80260E5C) {
185API_CALLABLE(GiveRefund) {
191 f32 posX, posY, posZ;
196 s32 iconPosX, iconPosY, iconPosZ;
199 sellValue = (sellValue * 75 + 99) / 100;
201 for (i = 0; i < sellValue; i++) {
210 delayTime = (i * 3) + 30;
220 script->varTable[0] = delayTime;
225API_CALLABLE(GiveRefundCleanup) {
235API_CALLABLE(LifeShroomShroudWorld) {
240 script->functionTemp[0] = 20;
245 script->functionTemp[0] -= 1;
247 if (script->functionTemp[0] == 0) {
254API_CALLABLE(LifeShroomRevealWorld) {
256 script->functionTemp[0] = 20;
262 script->functionTemp[0] -= 1;
263 if (script->functionTemp[0] == 0) {
271API_CALLABLE(ConsumeLifeShroom) {
281 script->varTable[3] = item->
potencyA;
286API_CALLABLE(RestorePreDefeatState) {
296 battleStatus->
flags2 &= ~BS_FLAGS2_HAS_RUSH;
315API_CALLABLE(func_80261388) {
318 script->varTable[0] = FALSE;
319 if (partnerActorExists) {
320 script->varTable[0] = TRUE;
325API_CALLABLE(SetItemAsLifeShroom) {
330API_CALLABLE(PlayBattleMerleeGatherFX) {
331 Bytecode* args = script->ptrReadPos;
336 fx_energy_in_out(6, var1, var2 + 15, var3, 1.2f, 30);
340API_CALLABLE(PlayBattleMerleeOrbFX) {
341 Bytecode* args = script->ptrReadPos;
346 fx_energy_orb_wave(9, var1, var2 + 15, var3, 5.0f, 15);
350API_CALLABLE(BattleMerleeFadeStageToBlack) {
355 script->functionTemp[0] = 25;
359 script->functionTemp[0]--;
361 if (script->functionTemp[0] == 0) {
368API_CALLABLE(BattleMerleeFadeStageFromBlack) {
370 script->functionTemp[0] = 25;
375 script->functionTemp[0] -= 5;
376 if (script->functionTemp[0] == 0) {
384API_CALLABLE(BattleFadeInMerlee) {
393 if (merlee->
alpha >= 255) {
401API_CALLABLE(BattleFadeOutMerlee) {
405 if (merlee->
alpha == 0) {
413API_CALLABLE(BattleMerleeUpdateFX) {
418 script->functionTemp[1] = 0;
428 script->functionTemp[1] += 10;
429 script->functionTemp[1] =
clamp_angle(script->functionTemp[1]);
433 data->
pos.
y = merlee->
pos.
y + 16.0f;
438 data->
pos.
y = merlee->
pos.
y + 16.0f;
452 if (data->
scale > 3.5) {
461 if (data->
scale > 5.0) {
469API_CALLABLE(BattleMerleeStopFX) {
474API_CALLABLE(HasMerleeCastsLeft) {
477 script->varTable[0] = FALSE;
479 script->varTable[0] = TRUE;
484API_CALLABLE(SpawnTurnEndFX) {
485 Bytecode* args = script->ptrReadPos;
498 if (script->varTable[10] > 0) {
504 if (script->varTable[11] > 0 || script->varTable[12] > 0) {
511API_CALLABLE(RemoveTurnEndFX) {
512 if (script->varTable[10] > 0) {
515 if (script->varTable[11] > 0 || script->varTable[12] > 0) {
521API_CALLABLE(SpawnRecoverHeartFX) {
522 Bytecode* args = script->ptrReadPos;
528 fx_recover(0, var1, var2, var3, var4);
532API_CALLABLE(SpawnRecoverFlowerFX) {
533 Bytecode* args = script->ptrReadPos;
539 fx_recover(1, var1, var2, var3, var4);
543API_CALLABLE(IncrementPlayerHP) {
553API_CALLABLE(IncrementPlayerFP) {
563API_CALLABLE(InflictDizzyAttackStatus) {
569API_CALLABLE(GetLostHammerAndBootsLevel) {
572 script->varTable[11] = playerData->
bootsLevel;
577API_CALLABLE(DropAbilityItem) {
581 script->functionTemp[0] = 0;
582 script->functionTemp[1] = 0;
585 switch (script->functionTemp[1]) {
587 script->functionTemp[0]--;
588 item->
pos.
y += script->functionTemp[0];
589 if (item->
pos.
y < 0.0f) {
591 script->functionTemp[0] = 8;
592 script->functionTemp[1] = 1;
596 script->functionTemp[0]--;
597 item->
pos.
y += script->functionTemp[0];
599 if (item->
pos.
y < 0.0f) {
601 script->functionTemp[0] = 4;
602 script->functionTemp[1] = 2;
606 script->functionTemp[0]--;
607 item->
pos.
y += script->functionTemp[0];
609 if (item->
pos.
y < 0.0f) {
611 script->functionTemp[1] = 3;
623API_CALLABLE(PlayerGatherAbilityItem) {
632 script->functionTemp[0] = 0;
633 script->functionTemp[1] = 10;
636 switch (script->functionTemp[0]) {
638 interpAmt = script->functionTemp[1];
643 item->
pos.
x += deltaX / interpAmt;
644 item->
pos.
y += deltaY / interpAmt;
645 item->
pos.
z += deltaZ / interpAmt;
648 player->
curPos.
y + 12.0f) / 5.0f;
650 if (script->functionTemp[1] == 1) {
651 script->functionTemp[0] = 1;
654 script->functionTemp[1]--;
662API_CALLABLE(AbilityItemUnkDelay) {
663 s32* delayCounter = &
D_8029FBB0[script->varTable[14]];
665 if (*delayCounter != 0) {
685 Call(SetBattleCamTarget, -80, 35, 8)
695 Call(PlayerRunToGoal, 25)
701 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_BeforeJump)
702 Call(PlayerHopToGoal, 18, 0, 0)
709 Call(PlayerRunToGoal, 20)
726 Call(FreezeBattleState, TRUE)
728 Call(SetBattleCamTarget, -80, 35, 8)
744 Call(PlayerRunToGoal, 40)
747 Call(FreezeBattleState, FALSE)
809 Call(LoadStarPowerScript)
823 Call(LoadStarPowerScript)
860 Call(CloseActionCommandInfo)
863 Call(ForceDisablePlayerBlurImmediately)
874 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_Mario1_HurtFoot, ANIM_Mario1_HurtFoot, ANIM_Mario1_HurtFoot)
876 Call(PlayerHopToGoal, 5, 0, 1)
887 Call(PlayerHopToGoal, 10, 0, 2)
890 Call(PlayerHopToGoal, 7, 0, 2)
893 Call(PlayerHopToGoal, 4, 0, 2)
906 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_MarioB3_BurnHurt, ANIM_MarioB3_BurnHurt, ANIM_MarioB3_BurnHurt)
908 Call(PlayerHopToGoal, 5, 0, 1)
932 Call(PlayerHopToGoal, 10, 0, 2)
935 Call(PlayerHopToGoal, 7, 0, 2)
938 Call(PlayerHopToGoal, 4, 0, 2)
951 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_Mario1_HurtFoot, ANIM_Mario1_HurtFoot, ANIM_Mario1_HurtFoot)
953 Call(PlayerHopToGoal, 5, 0, 1)
965 Call(PlayerHopToGoal, 10, 0, 2)
968 Call(PlayerHopToGoal, 7, 0, 2)
971 Call(PlayerHopToGoal, 4, 0, 2)
987 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_Land)
990 Call(PlayerHopToGoal, 15, 0, 0)
995 Call(PlayerRunToGoal, 0)
1001 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_Land)
1004 Call(PlayerHopToGoal, 15, 0, 0)
1009 Call(PlayerRunToGoal, 0)
1051 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_BeforeJump)
1053 Call(PlayerHopToGoal, 15, 0, 0)
1069 Call(ChoosePlayerCelebrationAnim)
1109 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_Land)
1111 Call(PlayerHopToGoal, 8, 0, 0)
1112 Call(DetermineAutoRunAwaySuccess)
1114 Call(SetFledBattleFlag)
1118 Call(PlayerRunToGoal, 0)
1128 Call(PlayerRunToGoal, 0)
1180 Call(ShowActionHud, 1)
1184 Call(SetupMashMeter, 1, 100, 0, 0, 0, 0)
1200 Call(action_command_flee_start, 0, 60, 3)
1222 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_Land)
1224 Call(PlayerHopToGoal, 8, 0, 0)
1226 Call(DetermineAutoRunAwaySuccess)
1228 Call(SetFledBattleFlag)
1232 Call(PlayerRunToGoal, 0)
1242 Call(PlayerRunToGoal, 0)
1292 Call(PlayerRunToGoal, 0)
1356 Call(PlayerRunToGoal, 0)
1367 Call(GiveRefundCleanup)
1390 Call(SetBattleCamTarget, -85, 1, 0)
1391 Call(SetBattleCamOffsetY, 41)
1392 Call(SetBattleCamDist, 248)
1393 Call(MoveBattleCamOver, 30)
1403 Call(GiveRefundCleanup)
1414 Call(PlayerRunToGoal, 0)
1466 Call(LifeShroomShroudWorld)
1485 Call(SetItemAsLifeShroom)
1490 Call(GiveRefundCleanup)
1534 Call(LifeShroomRevealWorld)
1539 Call(ConsumeLifeShroom)
1543 Call(FreezeBattleCam, 0)
1545 Call(MoveBattleCamOver, 15)
1575 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_Land)
1577 Call(PlayerHopToGoal, 20, 0, 0)
1583 Call(RestorePreDefeatState)
1589 Call(HasMerleeCastsLeft)
1595 Call(WaitForMessageBoxDone)
1602 Call(BattleMerleeFadeStageToBlack)
1605 Call(SetBattleCamTarget, 0, 80, 0)
1606 Call(SetBattleCamOffsetY, 0)
1607 Call(SetBattleCamDist, 246)
1608 Call(MoveBattleCamOver, 20)
1615 Call(BattleMerleeUpdateFX)
1617 Call(BattleFadeInMerlee)
1620 Call(BattleMerleeStopFX)
1622 Call(MoveBattleCamOver, 4)
1623 Call(BattleMerleeFadeStageFromBlack)
1626 Call(BattleFadeOutMerlee)
1636 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_Land)
1638 Call(PlayerHopToGoal, 18, 0, 0)
1643 Call(WaitForMessageBoxDone)
1651 Call(BattleMerleeFadeStageToBlack)
1654 Call(SetBattleCamTarget, 0, 80, 0)
1655 Call(SetBattleCamOffsetY, 0)
1656 Call(SetBattleCamDist, 246)
1657 Call(MoveBattleCamOver, 20)
1664 Call(BattleMerleeUpdateFX)
1666 Call(BattleFadeInMerlee)
1669 Call(BattleMerleeStopFX)
1671 Call(MoveBattleCamOver, 4)
1672 Call(BattleMerleeFadeStageFromBlack)
1675 Call(BattleFadeOutMerlee)
1689 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_Land)
1691 Call(PlayerHopToGoal, 18, 0, 0)
1697 Call(WaitForMessageBoxDone)
1705 Call(BattleMerleeFadeStageToBlack)
1708 Call(SetBattleCamTarget, 0, 80, 0)
1709 Call(SetBattleCamOffsetY, 0)
1710 Call(SetBattleCamDist, 246)
1711 Call(MoveBattleCamOver, 20)
1718 Call(BattleMerleeUpdateFX)
1720 Call(BattleFadeInMerlee)
1723 Call(BattleMerleeStopFX)
1725 Call(MoveBattleCamOver, 4)
1726 Call(BattleMerleeFadeStageFromBlack)
1729 Call(BattleFadeOutMerlee)
1739 Call(SetJumpAnimations,
ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_Land)
1741 Call(PlayerHopToGoal, 18, 0, 0)
1746 Call(WaitForMessageBoxDone)
1780 Call(IncrementPlayerHP)
1787 Call(IncrementPlayerHP)
1794 Call(IncrementPlayerFP)
1800 Call(RemoveTurnEndFX)
1813 Call(InflictDizzyAttackStatus)
1826 Call(GetLostHammerAndBootsLevel)
1857 Call(DropAbilityItem)
1858 Call(AbilityItemUnkDelay)
1859 Call(PlayerGatherAbilityItem)
1864 Call(FreezeBattleState, FALSE)
@ ACTION_COMMAND_MODE_NOT_LEARNED
struct ActorPart * partsTable
struct EnergyOrbWaveFXData * energyOrbWave
#define STATUS_FLAGS_IMMOBILIZED
@ FX_INSTANCE_FLAG_DISMISS
@ ACTION_RATING_LUCKY
clears nice hits
@ BS_FLAGS1_PLAYER_DEFENDING
@ BS_FLAGS1_SHOW_PLAYER_DECORATIONS
@ BS_FLAGS1_EXECUTING_MOVE
@ BTL_MSG_ACTION_TIP_MASH_BUTTON
@ ITEM_SPAWN_MODE_TOSS_FADE1
@ PHASE_MERLEE_ATTACK_BONUS
@ PHASE_MERLEE_DEFENSE_BONUS
@ BTL_MENU_TYPE_STAR_POWERS
@ BTL_CAM_PLAYER_HIT_HAZARD
@ BTL_CAM_PLAYER_HIT_SPIKE
@ SOUND_PLAYER_RUN_IN_PLACE
@ SOUND_LIFE_SHROOM_CHIME
@ ACTOR_FLAG_NO_SHADOW
Hide shadow.
@ NPC_FLAG_IGNORE_CAMERA_FOR_YAW
s32 evt_get_variable(Evt *script, Bytecode var)
s32 is_ability_active(s32 arg0)
s32 player_team_is_ability_active(Actor *actor, s32 ability)
void get_screen_coords(s32 camID, f32 x, f32 y, f32 z, s32 *screenX, s32 *screenY, s32 *screenZ)
void sort_consumables(void)
Bubbles up player inventory items such that all ITEM_NONE values are at the bottom.
ItemEntity * get_item_entity(s32 itemEntityIndex)
void btl_update_ko_status(void)
void mdl_set_all_tint_type(s32)
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
s32 make_item_entity(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 angle, s32 pickupVar)
s32 find_item(s32)
Search player inventory for itemID and return first matching array index.
void set_actor_anim(s32 actorID, s32 partID, AnimID animID)
Actor * get_actor(s32 actorID)
void btl_show_battle_message(s32 messageIndex, s32 duration)
void deduct_current_move_fp(void)
s32 inflict_status_set_duration(Actor *actor, s32 statusTypeKey, s32 statusDurationKey, s32 duration)
void btl_cam_unfreeze(void)
void show_action_rating(s32, Actor *, f32, f32, f32)
void hud_element_set_render_pos(s32 id, s32 x, s32 y)
s32 hud_element_create(HudScript *anim)
Creates a new HUD element and returns its ID.
void hud_element_free(s32 id)
void mdl_set_shroud_tint_params(u8 r, u8 g, u8 b, u8 a)
Npc * get_npc_unsafe(s32 npcID)
BSS s32 BattleMerleeEffectsTime
EvtScript EVS_MerleeRunOut
EvtScript EVS_Player_NoDamageHit
BSS EffectInstance * BattleMerleeWaveEffect
EvtScript EVS_Player_SimpleHit
EvtScript EVS_Player_HandleEvent
EvtScript EVS_PlayerFirstStrike
EvtScript EVS_MerleeExpBonus
EvtScript EVS_PeachEnterStage
EvtScript EVS_ApplyDizzyAttack
EvtScript EVS_ExecuteMarioAction
EvtScript EVS_PlayerRegainAbility
EvtScript EVS_Peach_HandlePhase
void btl_set_player_idle_anims(void)
EvtScript EVS_Unused_UseItemWithEffect
BSS s16 BattleMerleeEffectsState
EvtScript EVS_Unused_PlayerGoHome
EvtScript EVS_Mario_HandlePhase
EvtScript EVS_Peach_OnActorCreate
EvtScript EVS_Unused_UseItem
EvtScript EVS_MerleeDefenseBonus
EvtScript EVS_Player_ComplexHit
EvtScript EVS_Unused_DrinkItem
EvtScript EVS_MarioEnterStage
BSS EffectInstance * BattleMerleeOrbEffect
PlayerCelebrationAnimOptions bPlayerCelebrations
EvtScript EVS_Player_Celebrate
EvtScript EVS_StartDefend
EvtScript EVS_PlayerHappy
EvtScript EVS_Mario_OnActorCreate
EvtScript EVS_UseLifeShroom
EvtScript EVS_RunAwayFail
EvtScript EVS_MerleeAttackBonus
EvtScript EVS_RunAwayStart
EvtScript EVS_Unused_EatItem
BSS f32 BattleMerleeBasePosY
EvtScript EVS_ExecutePeachAction
EvtScript EVS_RunAwayNoCommand
void sfx_play_sound(s32 soundID)
ApiStatus RemoveItemEntity(Evt *script, b32 isInitialCall)
ApiStatus DeleteNpc(Evt *script, b32 isInitialCall)
ApiStatus SetItemPos(Evt *script, b32 isInitialCall)
ApiStatus SetItemFlags(Evt *script, b32 isInitialCall)
ApiStatus RemoveEffect(Evt *script, b32 isInitialCall)
ApiStatus SetNpcAnimation(Evt *script, b32 isInitialCall)
ApiStatus SetNpcRenderMode(Evt *script, b32 isInitialCall)
ApiStatus CreateNpc(Evt *script, b32 isInitialCall)
ApiStatus SetNpcPos(Evt *script, b32 isInitialCall)
ApiStatus MakeItemEntity(Evt *script, b32 isInitialCall)
ApiStatus ShowStartRecoveryShimmer(Evt *script, b32 isInitialCall)
ApiStatus RandInt(Evt *script, b32 isInitialCall)
ApiStatus ShakeCam(Evt *script, b32 isInitialCall)
ApiStatus SetNpcFlagBits(Evt *script, b32 isInitialCall)
#define Else
Marks the end of an if statement and the start of the else block.
#define Switch(LVAR)
Marks the start of a switch statement.
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
#define AddF(VAR, FLOAT_VALUE)
#define CaseEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any pre...
#define CaseNe(RVAR)
Marks the start of a switch case that executes only if LVAR != RVAR. It also marks the end of any pre...
#define EndChildThread
Marks the end of a child thread block.
#define Sub(VAR, INT_VALUE)
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
#define Add(VAR, INT_VALUE)
#define EndLoop
Marks the end of a loop.
#define EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
#define IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
#define IfLt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR < RVAR.
#define CaseOrEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR.
#define EndIf
Marks the end of an if statement or an else block.
#define CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
#define BreakLoop
Breaks out of the innermost loop.
#define Thread
Marks the start of a thread block.
#define EndThread
Marks the end of a thread block.
#define IfFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is set on LVAR,...
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
#define PlayEffect(args...)
#define EndSwitch
Marks the end of a switch statement and any case.
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
#define ChildThread
Marks the start of a child thread block.
#define CaseGt(RVAR)
Marks the start of a switch case that executes only if LVAR <= RVAR. It also marks the end of any pre...
#define Loop(TIMES)
Marks the beginning of a loop.
#define SetConst(VAR, CONST)
Sets the given variable to a given value, skipping the evt_get_variable call.
#define Return
Kills the current EVT thread.
struct Actor * partnerActor
struct Actor * playerActor
u8 * gBackgroundTintModePtr
BattleStatus gBattleStatus
s32 gDefeatedBattleSubstate