8#include "sprite/npc/BattleParakarry.h"
10#define NAMESPACE battle_partner_parakarry
43static s32 D_8023BD74_unused;
44static s32 hudMarkers[7];
45static s32 D_8023BD94_unused;
46static s32 hudShimmers[6];
47static s32 D_8023BDB0_unused;
49static s32 hudTargetRotation;
50static s32 shellShotTimer;
52static s32 hudStickPosX;
53static s32 hudStickPosY;
60API_CALLABLE(N(ShellShotActionCommand)) {
68 s32 screenX, screenY, screenZ;
70 f32 clampedAngleDiff, aimAngle;
74 script->functionTemp[0] = 0;
77 switch (script->functionTemp[0]) {
149 state->
unk_24 = (targetActorPart->
size.
y + targetActorPart->
size.
x) / 2 / 24.0;
156 state->
dist = 116.0f;
160 for (i = 0; i < 30; i++) {
166 clampedAngleDiff = state->
dist;
177 for (i = 0; i < 30; i++) {
192 hudTargetRotation = 0;
202 script->functionTemp[0] = 1;
209 if (shellShotTimer != 0) {
211 if (shellShotTimer == 0) {
224 script->functionTemp[0] = 2;
229 script->functionTemp[0] = 3;
233 if (shellShotTimer == 0) {
237 if (aimAngle < 3.0f) {
238 script->functionTemp[0] = 3;
250 state->
vel = 0.0f - state->
vel;
255 state->
vel = 0.0f - state->
vel;
263 if (state->
vel >= 0.0f) {
264 if (clampedAngleDiff < 0.0f) {
269 }
else if (clampedAngleDiff < 0.0f) {
276 if (aimAngle < 7.0f) {
298 if (script->functionTemp[0] < 3) {
299 if (script->functionTemp[0] > 0) {
305 if (aimAngle < 7.0f) {
312 if (hudStickPosX >= 51) {
323 hudTargetRotation -= 10;
324 hudTargetRotation =
clamp_angle(hudTargetRotation);
326 if (script->functionTemp[0] >= 2) {
327 if (script->functionTemp[0] < 3) {
338 x += (aimX - state->
curPos.
x) / 6.0f;
339 y += (aimY - state->
curPos.
y) / 6.0f;
340 z += (aimZ - state->
curPos.
z) / 6.0f;
343 hudID = hudShimmers[i];
355API_CALLABLE(N(GetShellShotDamage)) {
371 script->varTable[15] = damage;
375API_CALLABLE(N(AirLiftChance)) {
381 s32 hpPercentLost = 100 - targetActor->
curHP * 100 / targetActor->
maxHP;
391 if (airLiftChance > 0) {
392 airLiftChance += airLiftChance * hpPercentLost / 100;
394 if (airLiftChance > 100) {
398 if (targetActor->
debuff != 0) {
399 airLiftChance = airLiftChance * 150 / 100;
401 if (airLiftChance > 150) {
407 script->varTable[0] = airLiftChance;
412API_CALLABLE(N(CarryAway)) {
423 script->functionTemp[0] = 0;
426 temp_s4 = script->functionTemp[0];
427 targetActor = script->functionTempPtr[1];
429 switch (script->functionTemp[0]) {
436 script->functionTemp[0] = 1;
440 *animationRatePtr = 1.0f;
467API_CALLABLE(N(FlyAround)) {
472 script->functionTemp[0] = 0;
475 switch (script->functionTemp[0]) {
483 state->
speed = 48.0f;
484 script->functionTemp[1] = 0;
485 script->functionTemp[2] = 0;
486 script->functionTemp[3] = 0;
488 script->functionTemp[0] = 1;
495 if (state->
curPos.
x < -190.0f) {
496 if (script->functionTemp[1] != 0) {
497 script->functionTemp[0] = 2;
500 if (state->
angle >= 270.0f && state->
angle < 360.0f) {
504 if (state->
angle >= 180.0f && state->
angle < 270.0f) {
509 if (script->functionTemp[3] != 0) {
514 script->functionTemp[3] = 1 - script->functionTemp[3];
517 if (state->
curPos.
x > 190.0f) {
518 if (script->functionTemp[1] != 0) {
519 script->functionTemp[0] = 2;
524 if (state->
angle >= 0.0f && state->
angle < 90.0f) {
526 }
else if (state->
angle >= 90.0f && state->
angle < 180.0f) {
531 if (script->functionTemp[3] != 0) {
536 script->functionTemp[3] = 1 - script->functionTemp[3];
539 if (state->
curPos.
y < -30.0f) {
540 if (script->functionTemp[1] != 0) {
541 script->functionTemp[0] = 2;
546 if (state->
angle >= 270.0f && state->
angle < 360.0f) {
548 }
else if (state->
angle >= 0.0f && state->
angle < 90.0f) {
553 if (script->functionTemp[3] != 0) {
558 script->functionTemp[3] = 1 - script->functionTemp[3];
561 if (state->
curPos.
y > 160.0f) {
562 if (script->functionTemp[1] != 0) {
563 script->functionTemp[0] = 2;
568 if (state->
angle >= 90.0f && state->
angle < 180.0f) {
570 }
else if (state->
angle >= 180.0f && state->
angle < 270.0f) {
575 if (script->functionTemp[3] != 0) {
580 script->functionTemp[3] = 1 - script->functionTemp[3];
587 script->functionTemp[1] = 1;
592 switch (script->functionTemp[0]) {
595 script->functionTemp[0] = 3;
601 partner->
rot.
z = 0.0f;
614API_CALLABLE(N(GetAirRaidDamage)) {
615 script->varTable[15] = ((script->varTable[0] * 100) / 2499) + 2;
620s32 N(DefaultAnims)[] = {
631s32 N(DefenseTable)[] = {
636s32 N(StatusTable)[] = {
665 .posOffset = { 0, 0, 0 },
666 .targetOffset = { 11, 28 },
668 .idleAnimations = N(DefaultAnims),
669 .defenseTable = N(DefenseTable),
671 .elementImmunityFlags = 0,
672 .projectileTargetOffset = { 0, 0 },
678 .type = ACTOR_TYPE_PARAKARRY,
679 .level = ACTOR_LEVEL_PARAKARRY,
682 .partsData = N(ActorParts),
683 .initScript = &N(EVS_Init),
684 .statusTable = N(StatusTable),
687 .hurricaneChance = 0,
689 .upAndAwayChance = 0,
691 .powerBounceChance = 80,
694 .healthBarOffset = { 0, 0 },
695 .statusIconOffset = { -10, 30 },
696 .statusTextOffset = { 10, 30 },
715 Call(CloseActionCommandInfo)
813 Call(ShowActionHud, TRUE)
817 Call(LoadStarPowerScript)
882 Call(PartnerYieldTurn)
907 Call(PartnerYieldTurn)
931s32 N(actionCommandTable)[] = { 7, 6, 5, 4, 3, 2, 1, 0 };
937 Call(action_command_jump_init)
938 Call(SetActionDifficultyTable,
Ref(N(actionCommandTable)))
941 Call(InitTargetIterator)
949 Call(action_command_jump_start, 32, 3)
1007 ExecWait(N(EVS_ReturnHome_Success))
1020 Call(InitTargetIterator)
1022 Call(N(ShellShotActionCommand))
1033 Call(MoveBattleCamOver, 5)
1041 Call(MoveBattleCamOver, 5)
1050 Call(MoveBattleCamOver, 5)
1059 Call(MoveBattleCamOver, 5)
1067 Call(N(GetShellShotDamage))
1090 ExecWait(N(EVS_ReturnHome_Success))
1098 Call(InitTargetIterator)
1099 Call(N(AirLiftChance))
1101 Call(action_command_air_lift_init,
LVar0)
1102 Call(SetupMashMeter, 1, 100, 0, 0, 0, 0)
1103 Call(SetActionHudPrepareTime, 0)
1104 Call(InitTargetIterator)
1109 Call(SetBattleCamOffsetY, 8)
1121 Call(SetBattleCamOffsetY, 0)
1122 Call(AddBattleCamDist, -160)
1123 Call(MoveBattleCamOver, 20)
1129 Call(CloseActionCommandInfo)
1149 Call(N(AirLiftChance))
1151 Call(action_command_air_lift_start, 0, 87 *
DT, 3, 0)
1163 Call(SetBattleCamOffsetY, 0)
1164 Call(AddBattleCamDist, -2)
1165 Call(MoveBattleCamOver, 10)
1174 Call(CloseActionCommandInfo)
1199 Call(PartnerYieldTurn)
1212 Call(action_command_air_raid_init)
1213 Call(SetupMashMeter, 4, 25, 50, 75, 100, 0)
1214 Call(SetActionHudPrepareTime, 0)
1217 Call(MoveBattleCamOver, 30)
1224 Call(action_command_air_raid_start, 0, 90 *
DT, 3)
1236 Call(MoveBattleCamOver, 20)
1256 Call(MoveBattleCamOver, 20)
1258 Call(N(GetAirRaidDamage))
1259 Call(InitTargetIterator)
1298 Call(PartnerYieldTurn)
BSS ActionCommandStatus gActionCommandStatus
void action_command_init_status(void)
HudScript HES_StickNeutral
HudScript HES_StickHoldLeft
HudScript HES_AimShimmerD
HudScript HES_AimShimmerE
HudScript HES_AimShimmerF
HudScript HES_AimShimmerA
HudScript HES_AimShimmerB
HudScript HES_AimShimmerC
struct ActorBlueprint * actorBlueprint
Vec2b projectileTargetOffset
struct ActorPart * partsTable
#define sfx_play_sound_at_position
struct Effect65FXData * unk_65
@ FX_INSTANCE_FLAG_DISMISS
@ ACTION_COMMAND_AIR_LIFT
@ ACTION_COMMAND_AIR_RAID
@ BS_FLAGS1_STAR_POINTS_DROPPED
@ BS_FLAGS1_TRIGGER_EVENTS
@ BS_FLAGS1_INCLUDE_POWER_UPS
@ ACTOR_EVENT_FLAG_GROUNDABLE
Actor can be knocked down from flight; triggered by jump attacks.
@ ACTOR_EVENT_FLAG_ILLUSORY
Player attacks pass through and miss.
@ BTL_MENU_TYPE_STAR_POWERS
#define SUPPRESS_EVENTS_KOOPER_DAMAGE
@ STATUS_TURN_MOD_DEFAULT
@ STATUS_TURN_MOD_PARALYZE
@ HIT_RESULT_NICE_NO_DAMAGE
@ BTL_CAM_PARTNER_MISTAKE
@ SUPPRESS_EVENT_SPIKY_TOP
@ SUPPRESS_EVENT_ALT_SPIKY
@ SUPPRESS_EVENT_SPIKY_FRONT
@ SUPPRESS_EVENT_BURN_CONTACT
@ SOUND_PARAKARRY_PREDIVE
@ SOUND_PARAKARRY_SHELL_SHOT
@ SOUND_PARAKARRY_AIR_RAID_1
@ SOUND_PARAKARRY_AIR_RAID_2
@ ACTOR_FLAG_FLYING
Quake Hammer can't hit.
@ DAMAGE_TYPE_MULTIPLE_POPUPS
void btl_set_popup_duration(s32 duration)
void get_screen_coords(s32 camID, f32 x, f32 y, f32 z, s32 *screenX, s32 *screenY, s32 *screenZ)
ActorPart * get_actor_part(Actor *actor, s32 partID)
Actor * get_actor(s32 actorID)
void set_goal_pos_to_part(ActorState *state, s32 actorID, s32 partID)
void add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
f32 get_clamped_angle_diff(f32, f32)
void hud_element_create_transform_A(s32 id)
void hud_element_set_scale(s32 index, f32 scale)
void hud_element_set_script(s32 id, HudScript *anim)
void hud_element_set_render_depth(s32 id, s32 z)
void hud_element_set_transform_rotation(s32 id, f32 x, f32 y, f32 z)
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)
EvtScript EVS_Partner_Hit
EvtScript EVS_Partner_Recover
EvtScript EVS_Partner_BurnContact
EvtScript EVS_Partner_Drop
EvtScript EVS_Partner_NoDamageHit
EvtScript EVS_Partner_ShockHit
EvtScript EVS_Partner_BurnHit
EvtScript EVS_Partner_Celebrate
EvtScript EVS_Partner_SpikeContact
EvtScript EVS_Partner_RunAway
void sfx_play_sound(s32 soundID)
ApiStatus StopSound(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 Ref(sym)
Address/pointer constant.
#define Mul(VAR, INT_VALUE)
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
#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 EndChildThread
Marks the end of a child thread block.
#define Sub(VAR, INT_VALUE)
#define IfNe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR != RVAR.
#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 Goto(LABEL_ID)
Moves execution to the given label.
#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 Label(LABEL_ID)
Marks this point in the script as a Goto target.
#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 Div(VAR, INT_VALUE)
#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
GameStatus * gGameStatusPtr
BattleStatus gBattleStatus