Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
parakarry.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "hud_element.h"
4#include "effects.h"
8#include "sprite/npc/BattleParakarry.h"
9
10#define NAMESPACE battle_partner_parakarry
11
26
27extern EvtScript N(EVS_HandleEvent);
28extern EvtScript N(EVS_Idle);
29extern EvtScript N(EVS_HandlePhase);
30extern EvtScript N(EVS_TakeTurn);
31extern EvtScript N(EVS_Init);
32extern EvtScript N(firstStrike);
33extern EvtScript N(EVS_ExecuteAction);
34extern EvtScript N(EVS_Celebrate);
35extern EvtScript N(runAway);
36extern EvtScript N(runAwayFail);
37extern EvtScript N(skyDive);
38extern EvtScript N(shellShot);
39extern EvtScript N(airLift);
40extern EvtScript N(airRaid);
41
42static EffectInstance* airRaidEffect;
43static s32 D_8023BD74_unused;
44static s32 hudMarkers[7];
45static s32 D_8023BD94_unused;
46static s32 hudShimmers[6];
47static s32 D_8023BDB0_unused;
48static s32 hudTarget;
49static s32 hudTargetRotation;
50static s32 shellShotTimer;
51static s32 hudStick;
52static s32 hudStickPosX;
53static s32 hudStickPosY;
54
55enum N(ActorPartIDs) {
56 PRT_MAIN = 1,
57 PRT_2 = 2,
58};
59
60API_CALLABLE(N(ShellShotActionCommand)) {
61 BattleStatus* battleStatus = &gBattleStatus;
62 ActionCommandStatus* actionCommandStatus = &gActionCommandStatus;
63 Actor* parakarry = battleStatus->partnerActor;
64 ActorState* state = &parakarry->state;
65 Actor* targetActor;
66 ActorPart* targetActorPart;
67 f32 x, y, z;
68 s32 screenX, screenY, screenZ;
69 f32 aimX, aimY, aimZ;
70 f32 clampedAngleDiff, aimAngle;
71 s32 hudID, i;
72
73 if (isInitialCall) {
74 script->functionTemp[0] = 0;
75 }
76
77 switch (script->functionTemp[0]) {
78 case 0:
79 hudMarkers[0] = hudID = hud_element_create(&HES_AimMarkerF);
81 hud_element_set_render_pos(hudID, -100, -100);
82
83 hudMarkers[1] = hudID = hud_element_create(&HES_AimMarkerE);
85 hud_element_set_render_pos(hudID, -100, -100);
86
87 hudMarkers[2] = hudID = hud_element_create(&HES_AimMarkerD);
89 hud_element_set_render_pos(hudID, -100, -100);
90
91 hudMarkers[3] = hudID = hud_element_create(&HES_AimMarkerC);
93 hud_element_set_render_pos(hudID, -100, -100);
94
95 hudMarkers[4] = hudID = hud_element_create(&HES_AimMarkerB);
97 hud_element_set_render_pos(hudID, -100, -100);
98
99 hudMarkers[5] = hudID = hud_element_create(&HES_AimMarkerA);
101 hud_element_set_render_pos(hudID, -100, -100);
102
103 hudMarkers[6] = hudID = hud_element_create(&HES_AimReticle);
105 hud_element_set_render_pos(hudID, -100, -100);
106
107 hudShimmers[0] = hudID = hud_element_create(&HES_AimShimmerF);
109 hud_element_set_render_pos(hudID, -100, -100);
110
111 hudShimmers[1] = hudID = hud_element_create(&HES_AimShimmerE);
113 hud_element_set_render_pos(hudID, -100, -100);
114
115 hudShimmers[2] = hudID = hud_element_create(&HES_AimShimmerD);
117 hud_element_set_render_pos(hudID, -100, -100);
118
119 hudShimmers[3] = hudID = hud_element_create(&HES_AimShimmerC);
121 hud_element_set_render_pos(hudID, -100, -100);
122
123 hudShimmers[4] = hudID = hud_element_create(&HES_AimShimmerB);
125 hud_element_set_render_pos(hudID, -100, -100);
126
127 hudShimmers[5] = hudID = hud_element_create(&HES_AimShimmerA);
129 hud_element_set_render_pos(hudID, -100, -100);
130
131 hudTarget = hudID = hud_element_create(&HES_AimTarget);
134 hud_element_set_render_pos(hudID, -100, -100);
135 hudStickPosX = -48;
136 hudStickPosY = 80;
137
138 hudStick = hudID = hud_element_create(&HES_StickHoldLeft);
139 hud_element_set_render_pos(hudID, hudStickPosX, hudStickPosY);
141
142 set_goal_pos_to_part(state, parakarry->targetActorID, parakarry->targetPartID);
143 targetActor = get_actor(parakarry->targetActorID);
144 targetActorPart = get_actor_part(targetActor, parakarry->targetPartID);
145
146 state->goalPos.x += targetActorPart->projectileTargetOffset.x * targetActor->scalingFactor;
147 state->goalPos.y += targetActorPart->projectileTargetOffset.y * targetActor->scalingFactor;
148 state->goalPos.z = state->goalPos.z;
149 state->unk_24 = (targetActorPart->size.y + targetActorPart->size.x) / 2 / 24.0;
150 hud_element_set_scale(hudTarget, state->unk_24 * targetActor->scalingFactor);
151 state->curPos.x = parakarry->curPos.x + 8.0f;
152 state->curPos.y = parakarry->curPos.y + 16.0f;
153 state->curPos.z = parakarry->curPos.z;
154 state->angle = atan2(state->curPos.x, state->curPos.y, state->goalPos.x, state->goalPos.y);
155 state->bounceDivisor = state->angle;
156 state->dist = 116.0f;
157 state->unk_18.x = state->angle;
158 i = 0;
159
160 for (i = 0; i < 30; i++) {
161 state->unk_18.x -= 1.0f;
162 aimAngle = clamp_angle(state->unk_18.x);
163 x = state->curPos.x;
164 y = state->curPos.y;
165 z = state->curPos.z;
166 clampedAngleDiff = state->dist;
167 add_vec2D_polar(&x, &y, clampedAngleDiff, aimAngle);
168 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
169 if (screenY > 180) {
170 break;
171 }
172 }
173
174 state->unk_18.y = state->angle;
175 i = 0;
176
177 for (i = 0; i < 30; i++) {
178 state->unk_18.y += 1.0f;
179 aimAngle = clamp_angle(state->unk_18.y);
180 x = state->curPos.x;
181 y = state->curPos.y;
182 z = state->curPos.z;
183 add_vec2D_polar(&x, &y, state->dist, aimAngle);
184 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
185 if (screenY < 30) {
186 break;
187 }
188 }
189
190 state->moveTime = 120;
191 state->angle = state->unk_18.x + rand_int(state->unk_18.y - state->unk_18.x - 2.0f);
192 hudTargetRotation = 0;
193 shellShotTimer = 90;
194#if VERSION_PAL
195 state->vel = 4.0f;
196#else
197 state->vel = 3.0f;
198#endif
199 battleStatus->actionResult = ACTION_RESULT_FAIL;
202 script->functionTemp[0] = 1;
203 break;
204 case 1:
206 shellShotTimer = 0;
207 }
208
209 if (shellShotTimer != 0) {
210 shellShotTimer--;
211 if (shellShotTimer == 0) {
212 if (rand_int(100) < 50) {
213 state->angle = state->unk_18.x;
214 } else {
215 state->angle = state->unk_18.y;
216 }
217 } else {
218 break;
219 }
220 }
221
223 shellShotTimer = 60;
224 script->functionTemp[0] = 2;
225 break;
226 case 2:
228 if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT)) {
229 script->functionTemp[0] = 3;
230 break;
231 }
232 } else {
233 if (shellShotTimer == 0) {
234 targetActor = get_actor(parakarry->targetActorID);
235 aimAngle = fabsf(get_clamped_angle_diff(state->angle, state->bounceDivisor)) / state->unk_24 * targetActor->scalingFactor;
236
237 if (aimAngle < 3.0f) {
238 script->functionTemp[0] = 3;
239 break;
240 }
241 } else {
242 shellShotTimer--;
243 }
244 }
245
246 state->angle += state->vel;
247
248 if (state->angle <= state->unk_18.x) {
249 state->angle = state->unk_18.x;
250 state->vel = 0.0f - state->vel;
251 }
252
253 if (state->angle >= state->unk_18.y) {
254 state->angle = state->unk_18.y;
255 state->vel = 0.0f - state->vel;
256 }
257 break;
258 case 3:
259 targetActor = get_actor(parakarry->targetActorID);
260 clampedAngleDiff = get_clamped_angle_diff(state->angle, state->bounceDivisor);
261 aimAngle = fabsf(clampedAngleDiff) / state->unk_24 * targetActor->scalingFactor;
262
263 if (state->vel >= 0.0f) {
264 if (clampedAngleDiff < 0.0f) {
265 battleStatus->actionResult = ACTION_RESULT_FAIL;
266 } else {
267 battleStatus->actionResult = ACTION_RESULT_EARLY;
268 }
269 } else if (clampedAngleDiff < 0.0f) {
270 battleStatus->actionResult = ACTION_RESULT_EARLY;
271 } else {
272 battleStatus->actionResult = ACTION_RESULT_FAIL;
273 }
274 battleStatus->actionQuality = 0;
275
276 if (aimAngle < 7.0f) {
277 battleStatus->actionQuality = 1;
278 battleStatus->actionResult = ACTION_RESULT_SUCCESS;
280 } else if (state->angle < state->bounceDivisor) {
281 battleStatus->actionQuality = -1;
282 }
283
284 for (i = 0; i < ARRAY_COUNT(hudMarkers); i++) {
285 hud_element_free(hudMarkers[i]);
286 }
287
288 for (i = 0; i < ARRAY_COUNT(hudShimmers); i++) {
289 hud_element_free(hudShimmers[i]);
290 }
291
292 hud_element_free(hudTarget);
293 hud_element_free(hudStick);
295 return ApiStatus_DONE2;
296 }
297
298 if (script->functionTemp[0] < 3) {
299 if (script->functionTemp[0] > 0) {
300 hudID = hudStick;
301 targetActor = get_actor(parakarry->targetActorID);
302 clampedAngleDiff = get_clamped_angle_diff(state->angle, state->bounceDivisor);
303 aimAngle = fabsf(clampedAngleDiff) / state->unk_24 * targetActor->scalingFactor;
304
305 if (aimAngle < 7.0f) {
307 } else {
309 }
310
311 hudStickPosX += 20;
312 if (hudStickPosX >= 51) {
313 hudStickPosX = 50;
314 }
315 hud_element_set_render_pos(hudID, hudStickPosX, hudStickPosY);
316 }
317 }
318
319 get_screen_coords(gCurrentCameraID, state->goalPos.x, state->goalPos.y, state->goalPos.z, &screenX, &screenY, &screenZ);
320 hudID = hudTarget;
321 hud_element_set_render_pos(hudID, screenX, screenY);
322 hud_element_set_transform_rotation(hudID, 0.0f, 0.0f, hudTargetRotation);
323 hudTargetRotation -= 10;
324 hudTargetRotation = clamp_angle(hudTargetRotation);
325
326 if (script->functionTemp[0] >= 2) {
327 if (script->functionTemp[0] < 3) {
328 aimAngle = clamp_angle(state->angle);
329 aimX = state->curPos.x;
330 aimY = state->curPos.y;
331 aimZ = state->curPos.z;
332 add_vec2D_polar(&aimX, &aimY, state->dist, aimAngle);
333 z = state->curPos.z;
334 x = state->curPos.x;
335 y = state->curPos.y;
336
337 for (i = 0; i < ARRAY_COUNT(hudShimmers); i++) {
338 x += (aimX - state->curPos.x) / 6.0f;
339 y += (aimY - state->curPos.y) / 6.0f;
340 z += (aimZ - state->curPos.z) / 6.0f;
341 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
342 hud_element_set_render_pos(hudMarkers[i], screenX, screenY);
343 hudID = hudShimmers[i];
344 hud_element_set_render_pos(hudID, screenX, screenY);
345 }
346
347 hud_element_set_render_pos(hudMarkers[i], screenX, screenY);
349 }
350 }
351
352 return ApiStatus_BLOCK;
353}
354
355API_CALLABLE(N(GetShellShotDamage)) {
356 BattleStatus* battleStatus = &gBattleStatus;
357 s32 damage = 0;
358
359 switch (battleStatus->partnerActor->actorBlueprint->level) {
360 case 0:
361 damage = 5;
362 break;
363 case 1:
364 damage = 6;
365 break;
366 case 2:
367 damage = 7;
368 break;
369 }
370
371 script->varTable[15] = damage;
372 return ApiStatus_DONE2;
373}
374
375API_CALLABLE(N(AirLiftChance)) {
376 BattleStatus* battleStatus = &gBattleStatus;
377 Actor* partnerActor = battleStatus->partnerActor;
378 Actor* targetActor = get_actor(partnerActor->targetActorID);
379 ActorPart* targetActorPart = get_actor_part(targetActor, partnerActor->targetPartID);
380 s32 airLiftChance = targetActor->actorBlueprint->airLiftChance;
381 s32 hpPercentLost = 100 - targetActor->curHP * 100 / targetActor->maxHP;
382
383 if (targetActor->transparentStatus == STATUS_KEY_TRANSPARENT) {
384 airLiftChance = 0;
385 }
386
387 if (targetActorPart->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY) {
388 airLiftChance = 0;
389 }
390
391 if (airLiftChance > 0) {
392 airLiftChance += airLiftChance * hpPercentLost / 100;
393
394 if (airLiftChance > 100) {
395 airLiftChance = 100;
396 }
397
398 if (targetActor->debuff != 0) {
399 airLiftChance = airLiftChance * 150 / 100;
400
401 if (airLiftChance > 150) {
402 airLiftChance = 150;
403 }
404 }
405 }
406
407 script->varTable[0] = airLiftChance;
408
409 return ApiStatus_DONE2;
410}
411
412API_CALLABLE(N(CarryAway)) {
413 BattleStatus* battleStatus = &gBattleStatus;
414 Actor* parakarry = battleStatus->partnerActor;
415 ActorState* actorState = &parakarry->state;
416 f32* animationRatePtr = &parakarry->partsTable->animationRate;
417 Actor* targetActor;
418 f64 y;
419 u32 temp_s4;
420
421 if (isInitialCall) {
422 script->functionTempPtr[1] = get_actor(parakarry->targetActorID);
423 script->functionTemp[0] = 0;
424 }
425
426 temp_s4 = script->functionTemp[0];
427 targetActor = script->functionTempPtr[1];
428
429 switch (script->functionTemp[0]) {
430 case 0:
431 parakarry->state.goalPos.x = targetActor->curPos.x - parakarry->curPos.x;
432 parakarry->state.goalPos.y = targetActor->curPos.y - parakarry->curPos.y;
433 parakarry->state.goalPos.z = targetActor->curPos.z - parakarry->curPos.z;
434 parakarry->state.speed = 2.0f;
435 parakarry->state.moveTime = 0;
436 script->functionTemp[0] = 1;
437 break;
438 case 1:
439 parakarry->state.curPos.x += parakarry->state.speed;
440 *animationRatePtr = 1.0f;
441 y = parakarry->state.curPos.y;
442 parakarry->state.curPos.y = y + (sin_rad(2.0f * sin_rad(DEG_TO_RAD(parakarry->state.moveTime)) * PI_S) * 1.4 + 0.5);
443 parakarry->state.moveTime += 6;
444 parakarry->state.moveTime = clamp_angle(parakarry->state.moveTime);
445
446 if (gGameStatusPtr->frameCounter % 10 == 0) {
448 }
449
450 if (parakarry->state.curPos.x > 240.0f) {
451 battleStatus->actionQuality = temp_s4;
452 return ApiStatus_DONE2;
453 }
454 break;
455 }
456
457 parakarry->curPos.x = actorState->curPos.x;
458 parakarry->curPos.y = actorState->curPos.y;
459 parakarry->curPos.z = actorState->curPos.z;
460
461 targetActor->curPos.x = actorState->curPos.x + actorState->goalPos.x;
462 targetActor->curPos.y = actorState->curPos.y + actorState->goalPos.y;
463 targetActor->curPos.z = actorState->curPos.z + actorState->goalPos.z;
464 return ApiStatus_BLOCK;
465}
466
467API_CALLABLE(N(FlyAround)) {
469 ActorState* state = &partner->state;
470
471 if (isInitialCall) {
472 script->functionTemp[0] = 0;
473 }
474
475 switch (script->functionTemp[0]) {
476 case 0:
477 state->curPos.x = partner->curPos.x;
478 state->curPos.y = partner->curPos.y;
479 state->curPos.z = partner->curPos.z;
480 state->angle = 60 - rand_int(10);
481 state->bounceDivisor = 0.0f;
482 state->moveTime = 90;
483 state->speed = 48.0f;
484 script->functionTemp[1] = 0;
485 script->functionTemp[2] = 0;
486 script->functionTemp[3] = 0;
487 airRaidEffect = fx_effect_65(0, state->curPos.x, state->curPos.y, state->curPos.z, 1.0f, 0);
488 script->functionTemp[0] = 1;
489 break;
490 case 1:
491 add_vec2D_polar(&state->curPos.x, &state->curPos.y, state->speed, state->angle);
492 airRaidEffect->data.unk_65->pos.x = state->curPos.x;
493 airRaidEffect->data.unk_65->pos.y = state->curPos.y;
494 airRaidEffect->data.unk_65->pos.z = state->curPos.z;
495 if (state->curPos.x < -190.0f) {
496 if (script->functionTemp[1] != 0) {
497 script->functionTemp[0] = 2;
498 break;
499 }
500 if (state->angle >= 270.0f && state->angle < 360.0f) {
501 state->angle = 90.0f + (90.0f - clamp_angle(state->angle + 180.0f));
502 state->bounceDivisor = rand_int(4) - 2;
503 }
504 if (state->angle >= 180.0f && state->angle < 270.0f) {
505 state->angle = 90.0f - (clamp_angle(state->angle + 180.0f) - 90.0f);
506 state->bounceDivisor = rand_int(4) - 2;
507 }
508
509 if (script->functionTemp[3] != 0) {
511 } else {
513 }
514 script->functionTemp[3] = 1 - script->functionTemp[3];
515 }
516
517 if (state->curPos.x > 190.0f) {
518 if (script->functionTemp[1] != 0) {
519 script->functionTemp[0] = 2;
520 break;
521 }
522
523 do {
524 if (state->angle >= 0.0f && state->angle < 90.0f) {
525 state->angle = 270.0f + (270.0f - clamp_angle(state->angle + 180.0f));
526 } else if (state->angle >= 90.0f && state->angle < 180.0f) {
527 state->angle = 270.0f - (clamp_angle(state->angle + 180.0f) - 270.0f);
528 }
529 } while (0); // TODO macro?
530
531 if (script->functionTemp[3] != 0) {
533 } else {
535 }
536 script->functionTemp[3] = 1 - script->functionTemp[3];
537 }
538
539 if (state->curPos.y < -30.0f) {
540 if (script->functionTemp[1] != 0) {
541 script->functionTemp[0] = 2;
542 break;
543 }
544
545 do {
546 if (state->angle >= 270.0f && state->angle < 360.0f) {
547 state->angle = 180.0f + (180.0f - clamp_angle(state->angle + 180.0f));
548 } else if (state->angle >= 0.0f && state->angle < 90.0f) {
549 state->angle = 180.0f - (clamp_angle(state->angle + 180.0f) - 180.0f);
550 }
551 } while (0); // TODO macro?
552
553 if (script->functionTemp[3] != 0) {
555 } else {
557 }
558 script->functionTemp[3] = 1 - script->functionTemp[3];
559 }
560
561 if (state->curPos.y > 160.0f) {
562 if (script->functionTemp[1] != 0) {
563 script->functionTemp[0] = 2;
564 break;
565 }
566
567 do {
568 if (state->angle >= 90.0f && state->angle < 180.0f) {
569 state->angle = 360.0f + (360.0f - clamp_angle(state->angle + 180.0f));
570 } else if (state->angle >= 180.0f && state->angle < 270.0f) {
571 state->angle = 360.0f - (clamp_angle(state->angle + 180.0f) - 360.0f);
572 }
573 } while (0); // TODO macro?
574
575 if (script->functionTemp[3] != 0) {
577 } else {
579 }
580 script->functionTemp[3] = 1 - script->functionTemp[3];
581 }
582
583 state->angle = clamp_angle(state->angle + (state->bounceDivisor * 0.5));
584 if (state->moveTime != 0) {
585 state->moveTime--;
586 } else {
587 script->functionTemp[1] = 1;
588 }
589 break;
590 }
591
592 switch (script->functionTemp[0]) {
593 case 2:
594 state->moveTime = 5;
595 script->functionTemp[0] = 3;
596 airRaidEffect->flags |= FX_INSTANCE_FLAG_DISMISS;
597 // fallthrough
598 case 3:
599 add_vec2D_polar(&state->curPos.x, &state->curPos.y, state->speed, state->angle);
600 if (state->moveTime == 0) {
601 partner->rot.z = 0.0f;
602 return ApiStatus_DONE2;
603 }
604 state->moveTime--;
605 // fallthrough
606 default:
607 partner->curPos.x = state->curPos.x;
608 partner->curPos.y = state->curPos.y;
609 partner->curPos.z = state->curPos.z;
610 return ApiStatus_BLOCK;
611 }
612}
613
614API_CALLABLE(N(GetAirRaidDamage)) {
615 script->varTable[15] = ((script->varTable[0] * 100) / 2499) + 2;
616
617 return ApiStatus_DONE2;
618}
619
620s32 N(DefaultAnims)[] = {
621 STATUS_KEY_NORMAL, ANIM_BattleParakarry_Walk,
622 STATUS_KEY_STONE, ANIM_BattleParakarry_Still,
623 STATUS_KEY_SLEEP, ANIM_BattleParakarry_Pray,
624 STATUS_KEY_POISON, ANIM_BattleParakarry_Still,
625 STATUS_KEY_STOP, ANIM_BattleParakarry_Still,
626 STATUS_KEY_DAZE, ANIM_BattleParakarry_Injured,
627 STATUS_KEY_INACTIVE, ANIM_BattleParakarry_Still,
629};
630
631s32 N(DefenseTable)[] = {
634};
635
636s32 N(StatusTable)[] = {
639 STATUS_KEY_SLEEP, 100,
642 STATUS_KEY_DIZZY, 100,
643 STATUS_KEY_FEAR, 100,
647 STATUS_KEY_STOP, 100,
659};
660
661ActorPartBlueprint N(ActorParts)[] = {
662 {
663 .flags = 0,
664 .index = PRT_MAIN,
665 .posOffset = { 0, 0, 0 },
666 .targetOffset = { 11, 28 },
667 .opacity = 255,
668 .idleAnimations = N(DefaultAnims),
669 .defenseTable = N(DefenseTable),
670 .eventFlags = ACTOR_EVENT_FLAG_GROUNDABLE,
671 .elementImmunityFlags = 0,
672 .projectileTargetOffset = { 0, 0 },
673 },
674};
675
676ActorBlueprint NAMESPACE = {
677 .flags = ACTOR_FLAG_FLYING,
678 .type = ACTOR_TYPE_PARAKARRY,
679 .level = ACTOR_LEVEL_PARAKARRY,
680 .maxHP = 99,
681 .partCount = ARRAY_COUNT(N(ActorParts)),
682 .partsData = N(ActorParts),
683 .initScript = &N(EVS_Init),
684 .statusTable = N(StatusTable),
685 .escapeChance = 0,
686 .airLiftChance = 0,
687 .hurricaneChance = 0,
688 .spookChance = 0,
689 .upAndAwayChance = 0,
690 .spinSmashReq = 4,
691 .powerBounceChance = 80,
692 .coinReward = 0,
693 .size = { 38, 38 },
694 .healthBarOffset = { 0, 0 },
695 .statusIconOffset = { -10, 30 },
696 .statusTextOffset = { 10, 30 },
697};
698
699EvtScript N(EVS_Init) = {
700 Call(BindTakeTurn, ACTOR_PARTNER, Ref(N(EVS_TakeTurn)))
701 Call(BindIdle, ACTOR_PARTNER, Ref(N(EVS_Idle)))
702 Call(BindHandleEvent, ACTOR_PARTNER, Ref(N(EVS_HandleEvent)))
703 Call(BindHandlePhase, ACTOR_PARTNER, Ref(N(EVS_HandlePhase)))
704 Return
705 End
706};
707
708EvtScript N(EVS_Idle) = {
709 Return
710 End
711};
712
713EvtScript N(EVS_HandleEvent) = {
714 Call(UseIdleAnimation, ACTOR_PARTNER, FALSE)
715 Call(CloseActionCommandInfo)
716 Call(GetLastEvent, ACTOR_PARTNER, LVar0)
720 SetConst(LVar1, ANIM_BattleParakarry_HurtStill)
721 SetConst(LVar2, ANIM_BattleParakarry_HurtStill)
723 SetConst(LVar1, ANIM_BattleParakarry_HurtStill)
728 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_NO_DAMGE)
729 SetConst(LVar0, PRT_MAIN)
730 SetConst(LVar1, ANIM_BattleParakarry_HurtStill)
734 SetConst(LVar0, PRT_MAIN)
735 SetConst(LVar1, ANIM_BattleParakarry_HurtStill)
736 Set(LVar2, 22)
738 SetConst(LVar1, ANIM_BattleParakarry_HurtStill)
741 SetConst(LVar1, ANIM_BattleParakarry_BurnHurt)
742 Set(LVar2, 22)
743 SetConst(LVar3, ANIM_BattleParakarry_BurnStill)
745 SetConst(LVar1, ANIM_BattleParakarry_HurtStill)
749 SetConst(LVar1, ANIM_BattleParakarry_BurnHurt)
750 SetConst(LVar2, ANIM_BattleParakarry_BurnStill)
752 SetConst(LVar1, ANIM_BattleParakarry_HurtStill)
756 SetConst(LVar0, PRT_MAIN)
757 SetConst(LVar1, ANIM_BattleParakarry_HurtStill)
758 Set(LVar2, 22)
761 SetConst(LVar1, ANIM_BattleParakarry_HurtStill)
764 SetConst(LVar1, ANIM_BattleParakarry_Walk)
765 SetConst(LVar2, ANIM_BattleParakarry_Run)
766 Set(LVar3, 30)
770 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_NO_DAMGE)
771 SetConst(LVar0, PRT_MAIN)
772 SetConst(LVar1, ANIM_BattleParakarry_OrientShell)
774 Wait(10)
775 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_ExitShell)
779 Call(UseIdleAnimation, ACTOR_PARTNER, TRUE)
780 Return
781 End
782};
783
784EvtScript N(EVS_TakeTurn) = {
785 Call(GetBattlePhase, LVar0)
788 ExecWait(N(firstStrike))
790 ExecWait(N(EVS_ExecuteAction))
792 ExecWait(N(EVS_Celebrate))
794 ExecWait(N(runAway))
796 ExecWait(N(runAwayFail))
798 Return
799 End
800};
801
802EvtScript N(EVS_Celebrate) = {
803 SetConst(LVar0, PRT_MAIN)
804 SetConst(LVar1, ANIM_BattleParakarry_Celebrate)
805 SetConst(LVar2, ANIM_BattleParakarry_Walk)
806 SetConst(LVar3, ANIM_BattleParakarry_Idle)
808 Return
809 End
810};
811
812EvtScript N(EVS_ExecuteAction) = {
813 Call(ShowActionHud, TRUE)
814 Call(GetMenuSelection, LVar0, LVar1, LVar2)
817 Call(LoadStarPowerScript)
819 Return
821 Call(GetMenuSelection, LVar0, LVar1, LVar2)
823 CaseEq(MOVE_SKY_DIVE1)
824 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
825 Set(LVarE, 1)
826 Set(LVarF, 2)
827 ExecWait(N(skyDive))
828 CaseEq(MOVE_SKY_DIVE2)
829 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
830 Set(LVarE, 2)
831 Set(LVarF, 3)
832 ExecWait(N(skyDive))
833 CaseEq(MOVE_SKY_DIVE3)
834 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
835 Set(LVarE, 4)
836 Set(LVarF, 5)
837 ExecWait(N(skyDive))
838 CaseEq(MOVE_SHELL_SHOT)
839 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
840 ExecWait(N(shellShot))
841 CaseEq(MOVE_AIR_LIFT)
842 ExecWait(N(airLift))
843 CaseEq(MOVE_AIR_RAID)
844 ExecWait(N(airRaid))
846 Return
847 End
848};
849
850EvtScript N(firstStrike) = {
851 Return
852 End
853};
854
855EvtScript N(runAway) = {
856 SetConst(LVar0, PRT_MAIN)
857 SetConst(LVar1, ANIM_BattleParakarry_Run)
859 Return
860 End
861};
862
863EvtScript N(runAwayFail) = {
864 Call(UseIdleAnimation, ACTOR_PARTNER, FALSE)
865 Call(SetGoalToHome, ACTOR_PARTNER)
866 Call(SetActorSpeed, ACTOR_PARTNER, Float(6.0))
867 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run)
868 Call(SetActorYaw, ACTOR_PARTNER, 0)
869 Call(RunToGoal, ACTOR_PARTNER, 0)
870 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Walk)
871 Call(UseIdleAnimation, ACTOR_PARTNER, TRUE)
872 Return
873 End
874};
875
876EvtScript N(EVS_HandlePhase) = {
877 Return
878 End
879};
880
881EvtScript N(EVS_ReturnHome_Success) = {
882 Call(PartnerYieldTurn)
883 Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME)
884 Call(SetAnimation, ACTOR_PARTNER, -1, LVarA)
885 Call(SetActorJumpGravity, ACTOR_PARTNER, Float(1.4))
886 Call(AddGoalPos, ACTOR_PARTNER, -50, 0, 0)
887 Call(JumpToGoal, ACTOR_PARTNER, 15, FALSE, FALSE, FALSE)
888 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Still)
890 Wait(4)
891 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run)
893 Call(AddGoalPos, ACTOR_PARTNER, -30, 0, 0)
894 Call(JumpWithBounce, ACTOR_PARTNER, 5, Float(4.0))
895 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Idle)
896 Wait(2)
897 Call(SetGoalToHome, ACTOR_PARTNER)
898 Call(SetActorSpeed, ACTOR_PARTNER, Float(8.0))
899 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run)
900 Call(FlyToGoal, ACTOR_PARTNER, 0, -5, EASING_LINEAR)
901 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Walk)
902 Return
903 End
904};
905
906EvtScript N(EVS_ReturnHome_Miss) = {
907 Call(PartnerYieldTurn)
908 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MISTAKE)
909 Call(SetAnimation, ACTOR_PARTNER, -1, LVarA)
910 Call(SetActorJumpGravity, ACTOR_PARTNER, Float(1.0))
911 Call(AddGoalPos, ACTOR_PARTNER, -30, 0, 0)
912 Call(JumpToGoal, ACTOR_PARTNER, 15, FALSE, FALSE, FALSE)
913 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Still)
915 Wait(4)
916 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run)
918 Call(AddGoalPos, ACTOR_PARTNER, -20, 0, 0)
919 Call(JumpWithBounce, ACTOR_PARTNER, 5, Float(4.0))
920 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Idle)
921 Wait(2)
922 Call(SetGoalToHome, ACTOR_PARTNER)
923 Call(SetActorSpeed, ACTOR_PARTNER, Float(8.0))
924 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run)
925 Call(FlyToGoal, ACTOR_PARTNER, 0, -5, EASING_LINEAR)
926 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Walk)
927 Return
928 End
929};
930
931s32 N(actionCommandTable)[] = { 7, 6, 5, 4, 3, 2, 1, 0 };
932
933EvtScript N(skyDive) = {
934 Call(EnableIdleScript, ACTOR_PARTNER, IDLE_SCRIPT_DISABLE)
935 Call(UseIdleAnimation, ACTOR_PARTNER, FALSE)
936 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
937 Call(action_command_jump_init)
938 Call(SetActionDifficultyTable, Ref(N(actionCommandTable)))
939 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR)
940 Call(BattleCamTargetActor, ACTOR_SELF)
941 Call(InitTargetIterator)
942 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run)
943 Call(SetGoalToTarget, ACTOR_PARTNER)
944 Call(AddGoalPos, ACTOR_PARTNER, -20, 0, 0)
945 Call(SetActorSpeed, ACTOR_PARTNER, Float(5.0))
946 Call(FlyToGoal, ACTOR_PARTNER, 0, -10, EASING_COS_IN_OUT)
947 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Still)
948 Wait(3)
949 Call(action_command_jump_start, 32, 3)
950 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_PARAKARRY_PREDIVE)
951 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR)
952 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_FlyFast)
953 Call(AddGoalPos, ACTOR_PARTNER, 0, 10, 0)
954 Call(FlyToGoal, ACTOR_PARTNER, 5, 0, EASING_LINEAR)
955 Wait(2)
957 Wait(3)
958 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_PreDive)
960 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR)
961 Call(AddGoalPos, ACTOR_PARTNER, -26, 25, 0)
962 Call(FlyToGoal, ACTOR_PARTNER, 20, -20, EASING_QUARTIC_OUT)
963 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_PARAKARRY_DIVE)
964 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_ENABLE)
965 Call(SetGoalToTarget, ACTOR_PARTNER)
966 Call(AddGoalPos, ACTOR_PARTNER, -10, 0, 0)
967 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Dive)
968 Call(FlyToGoal, ACTOR_PARTNER, 5, 0, EASING_LINEAR)
972 Wait(5)
973 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Idle)
975 Call(SetGoalToTarget, ACTOR_PARTNER)
976 Call(AddGoalPos, ACTOR_PARTNER, 40, 10, 0)
977 Call(FlyToGoal, ACTOR_PARTNER, 10, -20, EASING_QUADRATIC_OUT)
978 Wait(20)
979 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_DISABLE)
980 Call(SetGoalToHome, ACTOR_PARTNER)
981 Call(SetActorSpeed, ACTOR_PARTNER, Float(8.0))
982 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run)
983 Call(FlyToGoal, ACTOR_PARTNER, 0, -5, EASING_LINEAR)
984 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Walk)
985 Return
986 EndIf
987 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_DISABLE)
988 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_PostDive)
989 Wait(2)
990 Call(GetPartnerActionSuccess, LVar0)
992 CaseGt(0)
997 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_NONE)
1001 SetConst(LVarA, ANIM_BattleParakarry_Think)
1002 ExecWait(N(EVS_ReturnHome_Miss))
1006 SetConst(LVarA, ANIM_BattleParakarry_Dive)
1007 ExecWait(N(EVS_ReturnHome_Success))
1009 EndSwitch
1010 Call(EnableIdleScript, ACTOR_PARTNER, IDLE_SCRIPT_ENABLE)
1011 Call(UseIdleAnimation, ACTOR_PARTNER, TRUE)
1012 Return
1013 End
1014};
1015
1016EvtScript N(shellShot) = {
1017 Call(UseIdleAnimation, ACTOR_PARTNER, FALSE)
1018 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_EnterShell)
1019 Wait(15)
1020 Call(InitTargetIterator)
1021 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_ShellFly)
1022 Call(N(ShellShotActionCommand))
1025 Call(GetActionQuality, LVar0)
1028 Set(LVar0, -2)
1029 EndIf
1030 Switch(LVar0)
1031 CaseEq(1)
1032 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR)
1033 Call(MoveBattleCamOver, 5)
1034 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_ENABLE)
1035 Call(SetGoalToTarget, ACTOR_PARTNER)
1036 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_ShellFlyFastest)
1037 Call(FlyToGoal, ACTOR_PARTNER, 7, 0, EASING_LINEAR)
1038 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_DISABLE)
1039 CaseEq(-1)
1040 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR)
1041 Call(MoveBattleCamOver, 5)
1042 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_ENABLE)
1043 Call(SetGoalToTarget, ACTOR_PARTNER)
1044 Call(AddGoalPos, ACTOR_PARTNER, 50, -50, 0)
1045 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_ShellFlyFastest)
1046 Call(FlyToGoal, ACTOR_PARTNER, 7, 0, 100)
1047 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_DISABLE)
1048 CaseEq(0)
1049 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR)
1050 Call(MoveBattleCamOver, 5)
1051 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_ENABLE)
1052 Call(SetGoalToTarget, ACTOR_PARTNER)
1053 Call(AddGoalPos, ACTOR_PARTNER, 50, 50, 0)
1054 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_ShellFlyFastest)
1055 Call(FlyToGoal, ACTOR_PARTNER, 7, 0, EASING_LINEAR)
1056 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_DISABLE)
1057 CaseEq(-2)
1058 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR)
1059 Call(MoveBattleCamOver, 5)
1060 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_ENABLE)
1061 Call(SetGoalToTarget, ACTOR_PARTNER)
1062 Call(AddGoalPos, ACTOR_PARTNER, 40, 0, 0)
1063 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_ShellFlyFastest)
1064 Call(FlyToGoal, ACTOR_PARTNER, 7, 0, EASING_LINEAR)
1065 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_DISABLE)
1066 EndSwitch
1067 Call(N(GetShellShotDamage))
1068 Switch(LVar0)
1069 CaseGt(0)
1071 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_HIT_RATTLE)
1074 EndSwitch
1075 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_NONE)
1076 Label(10)
1077 Switch(LVar0)
1080 IfEq(LFlag0, TRUE)
1081 SetConst(LVarA, ANIM_BattleParakarry_HurtStill)
1082 Else
1083 SetConst(LVarA, ANIM_BattleParakarry_Think)
1084 EndIf
1085 ExecWait(N(EVS_ReturnHome_Miss))
1089 SetConst(LVarA, ANIM_BattleParakarry_ShellFly)
1090 ExecWait(N(EVS_ReturnHome_Success))
1092 EndSwitch
1093 Return
1094 End
1095};
1096
1097EvtScript N(airLift) = {
1098 Call(InitTargetIterator)
1099 Call(N(AirLiftChance))
1100 Call(LoadActionCommand, ACTION_COMMAND_AIR_LIFT)
1101 Call(action_command_air_lift_init, LVar0)
1102 Call(SetupMashMeter, 1, 100, 0, 0, 0, 0)
1103 Call(SetActionHudPrepareTime, 0)
1104 Call(InitTargetIterator)
1105 Call(SetGoalToTarget, ACTOR_PARTNER)
1106 Call(GetDistanceToGoal, ACTOR_PARTNER, LVar0)
1107 Div(LVar0, 4)
1108 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR)
1109 Call(SetBattleCamOffsetY, 8)
1110 Call(MoveBattleCamOver, LVar0)
1111 Sub(LVar0, 12)
1112 IfLt(LVar0, 0)
1113 Set(LVar0, 0)
1114 EndIf
1115 Call(SetActionHudPrepareTime, LVar0)
1116 Call(SetActorSpeed, ACTOR_PARTNER, Float(5.0))
1117 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run)
1118 Call(FlyToGoal, ACTOR_PARTNER, 0, -4, EASING_COS_IN_OUT)
1119 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Idle)
1120 Wait(15)
1121 Call(SetBattleCamOffsetY, 0)
1122 Call(AddBattleCamDist, -160)
1123 Call(MoveBattleCamOver, 20)
1124 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_LiftLight)
1125 Call(SetAnimationRate, ACTOR_PARTNER, 0, Float(2.0))
1126 Wait(2)
1129 Call(CloseActionCommandInfo)
1130 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MISTAKE)
1131 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1132 Add(LVar1, 20)
1133 Call(SetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1134 Call(FlyToGoal, ACTOR_PARTNER, 10, -10, EASING_COS_IN)
1135 Call(SetAnimationRate, ACTOR_PARTNER, 0, Float(8.0))
1136 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Idle)
1137 Wait(10)
1138 Call(SetGoalToHome, ACTOR_PARTNER)
1139 Call(SetActorSpeed, ACTOR_PARTNER, Float(4.0))
1140 Call(SetAnimationRate, ACTOR_PARTNER, 0, Float(1.0))
1141 Call(SetActorYaw, ACTOR_SELF, 180)
1142 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run)
1143 Call(FlyToGoal, ACTOR_PARTNER, 0, 0, EASING_LINEAR)
1144 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Walk)
1145 Return
1146 EndIf
1147 Wait(3)
1149 Call(N(AirLiftChance))
1150 IfNe(LVar0, -1)
1151 Call(action_command_air_lift_start, 0, 87 * DT, 3, 0)
1152 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
1154 Wait(1)
1155 Call(GetActionQuality, LVar1)
1156 Div(LVar1, 10)
1157 Add(LVar1, 1)
1158 Loop(88 * DT)
1159 Call(GetActionQuality, LVar0)
1160 Set(LVar2, LVar1)
1161 Mul(LVar2, 10)
1162 IfGt(LVar0, LVar2)
1163 Call(SetBattleCamOffsetY, 0)
1164 Call(AddBattleCamDist, -2)
1165 Call(MoveBattleCamOver, 10)
1166 Add(LVar1, 1)
1167 EndIf
1168 Wait(1)
1169 EndLoop
1171 Wait(90 * DT)
1172 Call(GetActionSuccessCopy, LVar0)
1173 Else
1174 Call(CloseActionCommandInfo)
1175 Set(LVar0, 0)
1176 EndIf
1177 Switch(LVar0)
1178 CaseEq(1)
1179 Call(UseBattleCamPreset, BTL_CAM_VIEW_ENEMIES)
1180 Call(GetOwnerTarget, LVar0, LVar1)
1181 Call(DispatchEvent, LVar0, EVENT_BLOW_AWAY)
1182 Call(N(CarryAway), LVar0)
1183 Wait(30)
1184 Call(GetOwnerTarget, LVar0, LVar1)
1185 Call(SetBattleFlagBits, BS_FLAGS1_STAR_POINTS_DROPPED, TRUE)
1186 Call(RemoveActor, LVar0)
1188 Call(GetOwnerTarget, LVar0, LVar1)
1189 Call(DispatchEvent, LVar0, EVENT_AIR_LIFT_FAILED)
1190 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MISTAKE)
1191 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1192 Add(LVar1, 20)
1193 Call(SetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1194 Call(FlyToGoal, ACTOR_PARTNER, 5, -10, EASING_COS_IN)
1195 Call(SetAnimationRate, ACTOR_PARTNER, 0, Float(8.0))
1196 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Idle)
1197 Wait(10)
1198 EndSwitch
1199 Call(PartnerYieldTurn)
1200 Call(SetGoalToHome, ACTOR_PARTNER)
1201 Call(SetActorSpeed, ACTOR_PARTNER, Float(12.0))
1202 Call(SetAnimationRate, ACTOR_PARTNER, 0, Float(1.0))
1203 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run)
1204 Call(FlyToGoal, ACTOR_PARTNER, 0, 0, EASING_LINEAR)
1205 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Walk)
1206 Return
1207 End
1208};
1209
1210EvtScript N(airRaid) = {
1211 Call(LoadActionCommand, ACTION_COMMAND_AIR_RAID)
1212 Call(action_command_air_raid_init)
1213 Call(SetupMashMeter, 4, 25, 50, 75, 100, 0)
1214 Call(SetActionHudPrepareTime, 0)
1215 Call(UseBattleCamPreset, BTL_CAM_ACTOR)
1216 Call(BattleCamTargetActor, ACTOR_SELF)
1217 Call(MoveBattleCamOver, 30)
1218 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1219 Add(LVar0, 70)
1220 Call(SetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1221 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run)
1222 Call(FlyToGoal, ACTOR_PARTNER, 15, -2, EASING_LINEAR)
1223 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Idle)
1224 Call(action_command_air_raid_start, 0, 90 * DT, 3)
1225 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
1226 Wait(2)
1227 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_PreDive)
1228 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1229 Sub(LVar0, 50)
1230 Add(LVar1, 30)
1231 Add(LVar2, 40)
1232 Call(SetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1233 Call(FlyToGoal, ACTOR_PARTNER, 10, -10, EASING_COS_IN_OUT)
1234 Wait(2)
1235 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1236 Call(MoveBattleCamOver, 20)
1237 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_ENABLE)
1239 Loop(5)
1240 Wait(18)
1241 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1242 PlayEffect(EFFECT_LENS_FLARE, 0, LVar0, LVar1, LVar2, 10, 0)
1243 EndLoop
1246 Loop(5)
1247 Wait(18)
1248 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1249 PlayEffect(EFFECT_SPARKLES, 1, LVar0, LVar1, LVar2, 40, 0)
1250 EndLoop
1252 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_ShellFlyFastest)
1253 Call(N(FlyAround))
1254 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_DISABLE)
1255 Call(UseBattleCamPreset, BTL_CAM_VIEW_ENEMIES)
1256 Call(MoveBattleCamOver, 20)
1257 Call(GetActionQuality, LVar0)
1258 Call(N(GetAirRaidDamage))
1259 Call(InitTargetIterator)
1260 Label(10)
1261 Call(SetGoalToTarget, ACTOR_SELF)
1263 IfEq(LVar0, 6)
1264 Goto(11)
1265 EndIf
1266 Call(GetPartnerActionSuccess, LVar0)
1267 Switch(LVar0)
1268 CaseGt(99)
1270 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_HIT_RATTLE)
1273 EndSwitch
1274 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_NONE)
1275 Wait(5)
1276 Label(11)
1277 Call(ChooseNextTarget, ITER_NEXT, LVar0)
1279 Goto(10)
1280 EndIf
1281 Call(GetPartnerActionSuccess, LVar0)
1282 Switch(LVar0)
1283 CaseGt(99)
1284 Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME)
1286 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MISTAKE)
1287 EndSwitch
1289 Wait(10)
1290 Call(SetActorPos, ACTOR_PARTNER, -200, 50, 0)
1291 Call(SetGoalToHome, ACTOR_PARTNER)
1292 Call(SetActorSpeed, ACTOR_PARTNER, Float(12.0))
1293 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run)
1294 Call(FlyToGoal, ACTOR_PARTNER, 0, 0, EASING_LINEAR)
1295 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Walk)
1297 Wait(20)
1298 Call(PartnerYieldTurn)
1299 Wait(20)
1300 Return
1301 End
1302};
BSS ActionCommandStatus gActionCommandStatus
Definition action_cmd.c:91
void func_80269160(void)
Definition action_cmd.c:655
void action_command_init_status(void)
Definition action_cmd.c:256
void func_80269118(void)
Definition action_cmd.c:641
HudScript HES_StickNeutral
HudScript HES_StickHoldLeft
HudScript HES_AimShimmerD
HudScript HES_AimShimmerE
HudScript HES_AimMarkerE
HudScript HES_AimMarkerA
HudScript HES_AimMarkerD
HudScript HES_AimMarkerB
HudScript HES_AimMarkerF
HudScript HES_AimMarkerC
HudScript HES_AimShimmerF
HudScript HES_AimShimmerA
HudScript HES_AimShimmerB
HudScript HES_AimShimmerC
HudScript HES_AimTarget
HudScript HES_AimReticle
s8 transparentStatus
struct ActorBlueprint * actorBlueprint
Vec2b projectileTargetOffset
f32 scalingFactor
ActorState state
struct ActorPart * partsTable
s16 targetActorID
Vec3f curPos
Bytecode EvtScript[]
#define sfx_play_sound_at_position
#define rand_int
#define clamp_angle
#define atan2
struct Effect65FXData * unk_65
Definition effects.h:2565
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
@ ACTION_COMMAND_AIR_LIFT
Definition enums.h:3485
@ ACTION_COMMAND_AIR_RAID
Definition enums.h:3486
@ ACTION_COMMAND_JUMP
Definition enums.h:3473
@ BUTTON_STICK_LEFT
Definition enums.h:2793
@ BS_FLAGS1_STAR_POINTS_DROPPED
Definition enums.h:3593
@ BS_FLAGS1_NICE_HIT
Definition enums.h:3576
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3571
@ BS_FLAGS1_4000
Definition enums.h:3583
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ITER_NO_MORE
Definition enums.h:2030
@ ITER_NEXT
Definition enums.h:2025
@ ACTOR_EVENT_FLAG_GROUNDABLE
Actor can be knocked down from flight; triggered by jump attacks.
Definition enums.h:3382
@ ACTOR_EVENT_FLAG_ILLUSORY
Player attacks pass through and miss.
Definition enums.h:3374
@ PHASE_RUN_AWAY_START
Definition enums.h:2060
@ PHASE_EXECUTE_ACTION
Definition enums.h:2058
@ PHASE_CELEBRATE
Definition enums.h:2062
@ PHASE_RUN_AWAY_FAIL
Definition enums.h:2064
@ PHASE_FIRST_STRIKE
Definition enums.h:2059
@ BTL_MENU_TYPE_STAR_POWERS
Definition enums.h:4235
#define SUPPRESS_EVENTS_KOOPER_DAMAGE
Definition enums.h:2923
@ STATUS_KEY_PARALYZE
Definition enums.h:2201
@ STATUS_TURN_MOD_DEFAULT
Definition enums.h:2227
@ STATUS_TURN_MOD_PARALYZE
Definition enums.h:2234
@ STATUS_KEY_FROZEN
Definition enums.h:2203
@ STATUS_TURN_MOD_SLEEP
Definition enums.h:2228
@ STATUS_TURN_MOD_DIZZY
Definition enums.h:2232
@ STATUS_KEY_TRANSPARENT
Definition enums.h:2210
@ STATUS_KEY_STATIC
Definition enums.h:2207
@ STATUS_END
Definition enums.h:2196
@ STATUS_TURN_MOD_POISON
Definition enums.h:2233
@ STATUS_KEY_FEAR
Definition enums.h:2199
@ STATUS_TURN_MOD_STOP
Definition enums.h:2237
@ STATUS_KEY_SLEEP
Definition enums.h:2202
@ STATUS_KEY_STONE
Definition enums.h:2208
@ STATUS_KEY_STOP
Definition enums.h:2204
@ STATUS_KEY_INACTIVE
Definition enums.h:2214
@ STATUS_TURN_MOD_FROZEN
Definition enums.h:2230
@ STATUS_KEY_SHRINK
Definition enums.h:2206
@ STATUS_KEY_DIZZY
Definition enums.h:2200
@ STATUS_KEY_POISON
Definition enums.h:2205
@ STATUS_TURN_MOD_STATIC
Definition enums.h:2229
@ STATUS_TURN_MOD_FEAR
Definition enums.h:2231
@ STATUS_KEY_NORMAL
Definition enums.h:2197
@ STATUS_TURN_MOD_SHRINK
Definition enums.h:2235
@ STATUS_KEY_DAZE
Definition enums.h:2209
@ STATUS_KEY_DEFAULT
Definition enums.h:2198
@ HIT_RESULT_NO_DAMAGE
Definition enums.h:1952
@ HIT_RESULT_HIT
Definition enums.h:1950
@ HIT_RESULT_NICE_NO_DAMAGE
Definition enums.h:1953
@ HIT_RESULT_NICE
Definition enums.h:1951
@ HIT_RESULT_MISS
Definition enums.h:1956
@ BTL_CAM_RETURN_HOME
Definition enums.h:4826
@ BTL_CAM_DEFAULT
Definition enums.h:4824
@ BTL_CAM_PARTNER_MIDAIR
Definition enums.h:4874
@ BTL_CAM_ACTOR
Definition enums.h:4836
@ BTL_CAM_VIEW_ENEMIES
Definition enums.h:4825
@ BTL_CAM_PARTNER_MISTAKE
Definition enums.h:4873
@ SUPPRESS_EVENT_SPIKY_TOP
Definition enums.h:2900
@ SUPPRESS_EVENT_ALT_SPIKY
Definition enums.h:2905
@ SUPPRESS_EVENT_SPIKY_FRONT
Definition enums.h:2902
@ SUPPRESS_EVENT_BURN_CONTACT
Definition enums.h:2904
@ EASING_COS_IN
Definition enums.h:522
@ EASING_COS_IN_OUT
Definition enums.h:520
@ EASING_QUARTIC_OUT
Definition enums.h:516
@ EASING_QUADRATIC_OUT
Definition enums.h:514
@ EASING_LINEAR
Definition enums.h:510
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6408
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6407
@ SOUND_PARAKARRY_FLAP
Definition enums.h:1318
@ SOUND_PARAKARRY_PREDIVE
Definition enums.h:1315
@ SOUND_NO_DAMGE
Definition enums.h:1433
@ SOUND_PARAKARRY_SHELL_SHOT
Definition enums.h:1317
@ SOUND_NONE
Definition enums.h:547
@ SOUND_PARAKARRY_AIR_RAID_1
Definition enums.h:1319
@ SOUND_PARAKARRY_AIR_RAID_2
Definition enums.h:1320
@ SOUND_AIM_SHELL_SHOT
Definition enums.h:1104
@ SOUND_PARAKARRY_DIVE
Definition enums.h:1316
@ SOUND_HIT_RATTLE
Definition enums.h:749
@ ACTOR_PARTNER
Definition enums.h:2086
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_FLYING
Quake Hammer can't hit.
Definition enums.h:3329
@ ACTION_RESULT_EARLY
Definition enums.h:1966
@ ACTION_RESULT_SUCCESS
Definition enums.h:1968
@ ACTION_RESULT_FAIL
Definition enums.h:1967
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
@ ACTOR_BLUR_ENABLE
Definition enums.h:6414
@ ACTOR_BLUR_DISABLE
Definition enums.h:6413
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_33
Definition enums.h:2169
@ EVENT_BURN_HIT
Definition enums.h:2136
@ EVENT_SPIKE_CONTACT
Definition enums.h:2163
@ EVENT_IMMUNE
Definition enums.h:2146
@ EVENT_ZERO_DAMAGE
Definition enums.h:2144
@ EVENT_BLOCK
Definition enums.h:2147
@ EVENT_18
Definition enums.h:2145
@ EVENT_HIT_COMBO
Definition enums.h:2131
@ EVENT_15
Definition enums.h:2137
@ EVENT_AIR_LIFT_FAILED
Definition enums.h:2152
@ EVENT_RECOVER_FROM_KO
Definition enums.h:2170
@ EVENT_SHOCK_HIT
Definition enums.h:2165
@ EVENT_BURN_CONTACT
Definition enums.h:2164
@ EVENT_BLOW_AWAY
Definition enums.h:2143
@ DAMAGE_TYPE_AIR_LIFT
Definition enums.h:2866
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
@ DAMAGE_TYPE_MULTIPLE_POPUPS
Definition enums.h:2879
#define ApiStatus_DONE2
Definition evt.h:118
#define ApiStatus_BLOCK
Definition evt.h:116
void btl_set_popup_duration(s32 duration)
f32 fabsf(f32 f)
void get_screen_coords(s32 camID, f32 x, f32 y, f32 z, s32 *screenX, s32 *screenY, s32 *screenZ)
Definition cam_main.c:410
ActorPart * get_actor_part(Actor *actor, s32 partID)
Definition 190B20.c:1191
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
void set_goal_pos_to_part(ActorState *state, s32 actorID, s32 partID)
Definition actor_api.c:44
f32 sin_rad(f32 x)
Definition 43F0.c:713
void add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
Definition 43F0.c:685
f32 get_clamped_angle_diff(f32, f32)
Definition 43F0.c:606
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)
s32 HudScript[]
Definition hud_element.h:9
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)
Definition sfx.c:517
ApiStatus StopSound(Evt *script, b32 isInitialCall)
#define Else
Marks the end of an if statement and the start of the else block.
Definition macros.h:295
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define Mul(VAR, INT_VALUE)
Definition macros.h:378
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define CaseEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any pre...
Definition macros.h:319
#define EndChildThread
Marks the end of a child thread block.
Definition macros.h:563
#define Sub(VAR, INT_VALUE)
Definition macros.h:377
#define LVarF
Definition macros.h:163
#define IfNe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR != RVAR.
Definition macros.h:272
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Add(VAR, INT_VALUE)
Definition macros.h:376
#define EndLoop
Marks the end of a loop.
Definition macros.h:248
#define EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
Definition macros.h:352
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
Definition macros.h:278
#define IfLt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR < RVAR.
Definition macros.h:275
#define Float(DOUBLE)
Definition macros.h:51
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:227
#define CaseOrEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR.
Definition macros.h:341
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
Definition macros.h:337
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#define Div(VAR, INT_VALUE)
Definition macros.h:379
#define LVar2
Definition macros.h:150
#define DEG_TO_RAD(deg)
Definition macros.h:134
#define DT
Definition macros.h:522
#define LVar1
Definition macros.h:149
#define LFlag0
Definition macros.h:167
#define PI_S
Definition macros.h:129
#define LVarA
Definition macros.h:158
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define PlayEffect(args...)
Definition macros.h:807
#define EndSwitch
Marks the end of a switch statement and any case.
Definition macros.h:362
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:269
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define ChildThread
Marks the start of a child thread block.
Definition macros.h:560
#define CaseGt(RVAR)
Marks the start of a switch case that executes only if LVAR <= RVAR. It also marks the end of any pre...
Definition macros.h:328
#define Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#define LVar3
Definition macros.h:151
#define LVarE
Definition macros.h:162
#define LVar0
Definition macros.h:148
#define SetConst(VAR, CONST)
Sets the given variable to a given value, skipping the evt_get_variable call.
Definition macros.h:370
#define Return
Kills the current EVT thread.
Definition macros.h:217
struct Actor * partnerActor
GameStatus * gGameStatusPtr
Definition main_loop.c:32
BattleStatus gBattleStatus
Definition battle.c:11
s32 gCurrentCameraID
Definition cam_math.c:4