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;
75 script->functionTemp[0] = 0;
78 switch (script->functionTemp[0]) {
150 state->
unk_24 = (targetActorPart->
size.
y + targetActorPart->
size.
x) / 2 / 24.0;
157 state->
dist = 116.0f;
160 for (i = 0; i < 30; i++) {
166 clampedAngleDiff = state->
dist;
176 for (i = 0; i < 30; i++) {
191 hudTargetRotation = 0;
201 script->functionTemp[0] = 1;
208 if (shellShotTimer != 0) {
210 if (shellShotTimer == 0) {
223 script->functionTemp[0] = 2;
228 script->functionTemp[0] = 3;
232 if (shellShotTimer == 0) {
236 if (aimAngle < 3.0f) {
237 script->functionTemp[0] = 3;
249 state->
vel = 0.0f - state->
vel;
254 state->
vel = 0.0f - state->
vel;
262 if (state->
vel >= 0.0f) {
263 if (clampedAngleDiff < 0.0f) {
268 }
else if (clampedAngleDiff < 0.0f) {
275 if (aimAngle < 7.0f) {
297 if (script->functionTemp[0] < 3) {
298 if (script->functionTemp[0] > 0) {
304 if (aimAngle < 7.0f) {
311 if (hudStickPosX >= 51) {
322 hudTargetRotation -= 10;
323 hudTargetRotation =
clamp_angle(hudTargetRotation);
325 if (script->functionTemp[0] >= 2) {
326 if (script->functionTemp[0] < 3) {
337 x += (aimX - state->
curPos.
x) / 6.0f;
338 y += (aimY - state->
curPos.
y) / 6.0f;
339 z += (aimZ - state->
curPos.
z) / 6.0f;
342 hid = hudShimmers[i];
354API_CALLABLE(N(GetShellShotDamage)) {
370 script->varTable[15] = damage;
374API_CALLABLE(N(AirLiftChance)) {
380 s32 hpPercentLost = 100 - targetActor->
curHP * 100 / targetActor->
maxHP;
390 if (airLiftChance > 0) {
391 airLiftChance += airLiftChance * hpPercentLost / 100;
393 if (airLiftChance > 100) {
397 if (targetActor->
debuff != 0) {
398 airLiftChance = airLiftChance * 150 / 100;
400 if (airLiftChance > 150) {
406 script->varTable[0] = airLiftChance;
411API_CALLABLE(N(CarryAway)) {
422 script->functionTemp[0] = 0;
425 temp_s4 = script->functionTemp[0];
426 targetActor = script->functionTempPtr[1];
428 switch (script->functionTemp[0]) {
435 script->functionTemp[0] = 1;
439 *animationRatePtr = 1.0f;
466API_CALLABLE(N(FlyAround)) {
471 script->functionTemp[0] = 0;
474 switch (script->functionTemp[0]) {
482 state->
speed = 48.0f;
483 script->functionTemp[1] = 0;
484 script->functionTemp[2] = 0;
485 script->functionTemp[3] = 0;
487 script->functionTemp[0] = 1;
494 if (state->
curPos.
x < -190.0f) {
495 if (script->functionTemp[1] != 0) {
496 script->functionTemp[0] = 2;
499 if (state->
angle >= 270.0f && state->
angle < 360.0f) {
503 if (state->
angle >= 180.0f && state->
angle < 270.0f) {
508 if (script->functionTemp[3] != 0) {
513 script->functionTemp[3] = 1 - script->functionTemp[3];
516 if (state->
curPos.
x > 190.0f) {
517 if (script->functionTemp[1] != 0) {
518 script->functionTemp[0] = 2;
523 if (state->
angle >= 0.0f && state->
angle < 90.0f) {
525 }
else if (state->
angle >= 90.0f && state->
angle < 180.0f) {
530 if (script->functionTemp[3] != 0) {
535 script->functionTemp[3] = 1 - script->functionTemp[3];
538 if (state->
curPos.
y < -30.0f) {
539 if (script->functionTemp[1] != 0) {
540 script->functionTemp[0] = 2;
545 if (state->
angle >= 270.0f && state->
angle < 360.0f) {
547 }
else if (state->
angle >= 0.0f && state->
angle < 90.0f) {
552 if (script->functionTemp[3] != 0) {
557 script->functionTemp[3] = 1 - script->functionTemp[3];
560 if (state->
curPos.
y > 160.0f) {
561 if (script->functionTemp[1] != 0) {
562 script->functionTemp[0] = 2;
567 if (state->
angle >= 90.0f && state->
angle < 180.0f) {
569 }
else if (state->
angle >= 180.0f && state->
angle < 270.0f) {
574 if (script->functionTemp[3] != 0) {
579 script->functionTemp[3] = 1 - script->functionTemp[3];
586 script->functionTemp[1] = 1;
591 switch (script->functionTemp[0]) {
594 script->functionTemp[0] = 3;
600 partner->
rot.
z = 0.0f;
613API_CALLABLE(N(GetAirRaidDamage)) {
614 script->varTable[15] = ((script->varTable[0] * 100) / 2499) + 2;
619s32 N(DefaultAnims)[] = {
630s32 N(DefenseTable)[] = {
635s32 N(StatusTable)[] = {
664 .posOffset = { 0, 0, 0 },
665 .targetOffset = { 11, 28 },
667 .idleAnimations = N(DefaultAnims),
668 .defenseTable = N(DefenseTable),
670 .elementImmunityFlags = 0,
671 .projectileTargetOffset = { 0, 0 },
677 .type = ACTOR_TYPE_PARAKARRY,
678 .level = ACTOR_LEVEL_PARAKARRY,
681 .partsData = N(ActorParts),
682 .initScript = &N(EVS_Init),
683 .statusTable = N(StatusTable),
686 .hurricaneChance = 0,
688 .upAndAwayChance = 0,
690 .powerBounceChance = 80,
693 .healthBarOffset = { 0, 0 },
694 .statusIconOffset = { -10, 30 },
695 .statusTextOffset = { 10, 30 },
714 Call(InterruptActionCommand)
812 Call(ShowActionHud, TRUE)
816 Call(LoadStarPowerScript)
881 Call(PartnerYieldTurn)
906 Call(PartnerYieldTurn)
930s32 N(actionCommandTable)[] = { 7, 6, 5, 4, 3, 2, 1, 0 };
936 Call(action_command_jump_init)
937 Call(SetActionDifficultyTable,
Ref(N(actionCommandTable)))
940 Call(InitTargetIterator)
1006 ExecWait(N(EVS_ReturnHome_Success))
1019 Call(InitTargetIterator)
1021 Call(N(ShellShotActionCommand))
1032 Call(MoveBattleCamOver, 5)
1040 Call(MoveBattleCamOver, 5)
1049 Call(MoveBattleCamOver, 5)
1058 Call(MoveBattleCamOver, 5)
1066 Call(N(GetShellShotDamage))
1089 ExecWait(N(EVS_ReturnHome_Success))
1097 Call(InitTargetIterator)
1098 Call(N(AirLiftChance))
1100 Call(action_command_air_lift_init,
LVar0)
1101 Call(SetupMashMeter, 1, 100, 0, 0, 0, 0)
1102 Call(SetActionHudPrepareTime, 0)
1103 Call(InitTargetIterator)
1108 Call(SetBattleCamOffsetY, 8)
1120 Call(SetBattleCamOffsetY, 0)
1121 Call(AddBattleCamDist, -160)
1122 Call(MoveBattleCamOver, 20)
1128 Call(InterruptActionCommand)
1148 Call(N(AirLiftChance))
1162 Call(SetBattleCamOffsetY, 0)
1163 Call(AddBattleCamDist, -2)
1164 Call(MoveBattleCamOver, 10)
1173 Call(InterruptActionCommand)
1198 Call(PartnerYieldTurn)
1211 Call(action_command_air_raid_init)
1212 Call(SetupMashMeter, 4, 25, 50, 75, 100, 0)
1213 Call(SetActionHudPrepareTime, 0)
1216 Call(MoveBattleCamOver, 30)
1235 Call(MoveBattleCamOver, 20)
1255 Call(MoveBattleCamOver, 20)
1257 Call(N(GetAirRaidDamage))
1258 Call(InitTargetIterator)
1297 Call(PartnerYieldTurn)
BSS ActionCommandStatus gActionCommandStatus
void increment_action_command_attempt_count(void)
void increment_action_command_success_count(void)
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
EffectInstanceDataPtr data
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