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
28extern EvtScript N(EVS_Idle);
30extern EvtScript N(EVS_TakeTurn);
31extern EvtScript N(EVS_Init);
32extern EvtScript N(firstStrike);
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)) {
63 Actor* parakarry = battleStatus->partnerActor;
64 ActorState* state = &parakarry->state;
67 f32 x, y, z;
69 f32 aimX, aimY, aimZ;
72 s32 i;
73
74 if (isInitialCall) {
75 script->functionTemp[0] = 0;
76 }
77
78 switch (script->functionTemp[0]) {
79 case 0:
80 hudMarkers[0] = hid = hud_element_create(&HES_AimMarkerF);
83
84 hudMarkers[1] = hid = hud_element_create(&HES_AimMarkerE);
87
88 hudMarkers[2] = hid = hud_element_create(&HES_AimMarkerD);
91
92 hudMarkers[3] = hid = hud_element_create(&HES_AimMarkerC);
95
96 hudMarkers[4] = hid = hud_element_create(&HES_AimMarkerB);
99
100 hudMarkers[5] = hid = hud_element_create(&HES_AimMarkerA);
102 hud_element_set_render_pos(hid, -100, -100);
103
104 hudMarkers[6] = hid = hud_element_create(&HES_AimReticle);
106 hud_element_set_render_pos(hid, -100, -100);
107
108 hudShimmers[0] = hid = hud_element_create(&HES_AimShimmerF);
110 hud_element_set_render_pos(hid, -100, -100);
111
112 hudShimmers[1] = hid = hud_element_create(&HES_AimShimmerE);
114 hud_element_set_render_pos(hid, -100, -100);
115
116 hudShimmers[2] = hid = hud_element_create(&HES_AimShimmerD);
118 hud_element_set_render_pos(hid, -100, -100);
119
120 hudShimmers[3] = hid = hud_element_create(&HES_AimShimmerC);
122 hud_element_set_render_pos(hid, -100, -100);
123
124 hudShimmers[4] = hid = hud_element_create(&HES_AimShimmerB);
126 hud_element_set_render_pos(hid, -100, -100);
127
128 hudShimmers[5] = hid = hud_element_create(&HES_AimShimmerA);
130 hud_element_set_render_pos(hid, -100, -100);
131
132 hudTarget = hid = hud_element_create(&HES_AimTarget);
135 hud_element_set_render_pos(hid, -100, -100);
136 hudStickPosX = -48;
137 hudStickPosY = 80;
138
140 hud_element_set_render_pos(hid, hudStickPosX, hudStickPosY);
142
143 set_goal_pos_to_part(state, parakarry->targetActorID, parakarry->targetPartID);
144 targetActor = get_actor(parakarry->targetActorID);
146
147 state->goalPos.x += targetActorPart->projectileTargetOffset.x * targetActor->scalingFactor;
148 state->goalPos.y += targetActorPart->projectileTargetOffset.y * targetActor->scalingFactor;
149 state->goalPos.z = state->goalPos.z;
150 state->unk_24 = (targetActorPart->size.y + targetActorPart->size.x) / 2 / 24.0;
151 hud_element_set_scale(hudTarget, state->unk_24 * targetActor->scalingFactor);
152 state->curPos.x = parakarry->curPos.x + 8.0f;
153 state->curPos.y = parakarry->curPos.y + 16.0f;
154 state->curPos.z = parakarry->curPos.z;
155 state->angle = atan2(state->curPos.x, state->curPos.y, state->goalPos.x, state->goalPos.y);
156 state->bounceDivisor = state->angle;
157 state->dist = 116.0f;
158 state->unk_18.x = state->angle;
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;
169 if (screenY > 180) {
170 break;
171 }
172 }
173
174 state->unk_18.y = state->angle;
175
176 for (i = 0; i < 30; i++) {
177 state->unk_18.y += 1.0f;
178 aimAngle = clamp_angle(state->unk_18.y);
179 x = state->curPos.x;
180 y = state->curPos.y;
181 z = state->curPos.z;
182 add_vec2D_polar(&x, &y, state->dist, aimAngle);
184 if (screenY < 30) {
185 break;
186 }
187 }
188
189 state->moveTime = 120;
190 state->angle = state->unk_18.x + rand_int(state->unk_18.y - state->unk_18.x - 2.0f);
191 hudTargetRotation = 0;
192 shellShotTimer = 90;
193#if VERSION_PAL
194 state->vel = 4.0f;
195#else
196 state->vel = 3.0f;
197#endif
198 battleStatus->actionResult = ACTION_RESULT_FAIL;
201 script->functionTemp[0] = 1;
202 break;
203 case 1:
205 shellShotTimer = 0;
206 }
207
208 if (shellShotTimer != 0) {
209 shellShotTimer--;
210 if (shellShotTimer == 0) {
211 if (rand_int(100) < 50) {
212 state->angle = state->unk_18.x;
213 } else {
214 state->angle = state->unk_18.y;
215 }
216 } else {
217 break;
218 }
219 }
220
222 shellShotTimer = 60;
223 script->functionTemp[0] = 2;
224 break;
225 case 2:
227 if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT)) {
228 script->functionTemp[0] = 3;
229 break;
230 }
231 } else {
232 if (shellShotTimer == 0) {
233 targetActor = get_actor(parakarry->targetActorID);
234 aimAngle = fabsf(get_clamped_angle_diff(state->angle, state->bounceDivisor)) / state->unk_24 * targetActor->scalingFactor;
235
236 if (aimAngle < 3.0f) {
237 script->functionTemp[0] = 3;
238 break;
239 }
240 } else {
241 shellShotTimer--;
242 }
243 }
244
245 state->angle += state->vel;
246
247 if (state->angle <= state->unk_18.x) {
248 state->angle = state->unk_18.x;
249 state->vel = 0.0f - state->vel;
250 }
251
252 if (state->angle >= state->unk_18.y) {
253 state->angle = state->unk_18.y;
254 state->vel = 0.0f - state->vel;
255 }
256 break;
257 case 3:
258 targetActor = get_actor(parakarry->targetActorID);
260 aimAngle = fabsf(clampedAngleDiff) / state->unk_24 * targetActor->scalingFactor;
261
262 if (state->vel >= 0.0f) {
263 if (clampedAngleDiff < 0.0f) {
264 battleStatus->actionResult = ACTION_RESULT_FAIL;
265 } else {
266 battleStatus->actionResult = ACTION_RESULT_EARLY;
267 }
268 } else if (clampedAngleDiff < 0.0f) {
269 battleStatus->actionResult = ACTION_RESULT_EARLY;
270 } else {
271 battleStatus->actionResult = ACTION_RESULT_FAIL;
272 }
273 battleStatus->actionProgress = 0;
274
275 if (aimAngle < 7.0f) {
276 battleStatus->actionProgress = 1;
277 battleStatus->actionResult = ACTION_RESULT_SUCCESS;
279 } else if (state->angle < state->bounceDivisor) {
280 battleStatus->actionProgress = -1;
281 }
282
283 for (i = 0; i < ARRAY_COUNT(hudMarkers); i++) {
284 hud_element_free(hudMarkers[i]);
285 }
286
287 for (i = 0; i < ARRAY_COUNT(hudShimmers); i++) {
288 hud_element_free(hudShimmers[i]);
289 }
290
291 hud_element_free(hudTarget);
292 hud_element_free(hudStick);
294 return ApiStatus_DONE2;
295 }
296
297 if (script->functionTemp[0] < 3) {
298 if (script->functionTemp[0] > 0) {
299 hid = hudStick;
300 targetActor = get_actor(parakarry->targetActorID);
302 aimAngle = fabsf(clampedAngleDiff) / state->unk_24 * targetActor->scalingFactor;
303
304 if (aimAngle < 7.0f) {
306 } else {
308 }
309
310 hudStickPosX += 20;
311 if (hudStickPosX >= 51) {
312 hudStickPosX = 50;
313 }
314 hud_element_set_render_pos(hid, hudStickPosX, hudStickPosY);
315 }
316 }
317
319 hid = hudTarget;
321 hud_element_set_transform_rotation(hid, 0.0f, 0.0f, hudTargetRotation);
322 hudTargetRotation -= 10;
323 hudTargetRotation = clamp_angle(hudTargetRotation);
324
325 if (script->functionTemp[0] >= 2) {
326 if (script->functionTemp[0] < 3) {
327 aimAngle = clamp_angle(state->angle);
328 aimX = state->curPos.x;
329 aimY = state->curPos.y;
330 aimZ = state->curPos.z;
332 z = state->curPos.z;
333 x = state->curPos.x;
334 y = state->curPos.y;
335
336 for (i = 0; i < ARRAY_COUNT(hudShimmers); i++) {
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];
344 }
345
348 }
349 }
350
351 return ApiStatus_BLOCK;
352}
353
354API_CALLABLE(N(GetShellShotDamage)) {
356 s32 damage = 0;
357
358 switch (battleStatus->partnerActor->actorBlueprint->level) {
360 damage = 5;
361 break;
363 damage = 6;
364 break;
366 damage = 7;
367 break;
368 }
369
370 script->varTable[15] = damage;
371 return ApiStatus_DONE2;
372}
373
374API_CALLABLE(N(AirLiftChance)) {
376 Actor* partnerActor = battleStatus->partnerActor;
377 Actor* targetActor = get_actor(partnerActor->targetActorID);
379 s32 airLiftChance = targetActor->actorBlueprint->airLiftChance;
380 s32 hpPercentLost = 100 - targetActor->curHP * 100 / targetActor->maxHP;
381
382 if (targetActor->transparentStatus == STATUS_KEY_TRANSPARENT) {
383 airLiftChance = 0;
384 }
385
386 if (targetActorPart->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY) {
387 airLiftChance = 0;
388 }
389
390 if (airLiftChance > 0) {
391 airLiftChance += airLiftChance * hpPercentLost / 100;
392
393 if (airLiftChance > 100) {
394 airLiftChance = 100;
395 }
396
397 if (targetActor->debuff != 0) {
398 airLiftChance = airLiftChance * 150 / 100;
399
400 if (airLiftChance > 150) {
401 airLiftChance = 150;
402 }
403 }
404 }
405
406 script->varTable[0] = airLiftChance;
407
408 return ApiStatus_DONE2;
409}
410
411API_CALLABLE(N(CarryAway)) {
413 Actor* parakarry = battleStatus->partnerActor;
415 f32* animationRatePtr = &parakarry->partsTable->animationRate;
417 f64 y;
418 u32 temp_s4;
419
420 if (isInitialCall) {
421 script->functionTempPtr[1] = get_actor(parakarry->targetActorID);
422 script->functionTemp[0] = 0;
423 }
424
425 temp_s4 = script->functionTemp[0];
426 targetActor = script->functionTempPtr[1];
427
428 switch (script->functionTemp[0]) {
429 case 0:
430 parakarry->state.goalPos.x = targetActor->curPos.x - parakarry->curPos.x;
431 parakarry->state.goalPos.y = targetActor->curPos.y - parakarry->curPos.y;
432 parakarry->state.goalPos.z = targetActor->curPos.z - parakarry->curPos.z;
433 parakarry->state.speed = 2.0f;
434 parakarry->state.moveTime = 0;
435 script->functionTemp[0] = 1;
436 break;
437 case 1:
438 parakarry->state.curPos.x += parakarry->state.speed;
439 *animationRatePtr = 1.0f;
440 y = parakarry->state.curPos.y;
441 parakarry->state.curPos.y = y + (sin_rad(2.0f * sin_rad(DEG_TO_RAD(parakarry->state.moveTime)) * PI_S) * 1.4 + 0.5);
442 parakarry->state.moveTime += 6;
443 parakarry->state.moveTime = clamp_angle(parakarry->state.moveTime);
444
445 if (gGameStatusPtr->frameCounter % 10 == 0) {
446 sfx_play_sound_at_position(SOUND_PARAKARRY_FLAP, SOUND_SPACE_DEFAULT, parakarry->state.curPos.x, parakarry->state.curPos.y, parakarry->state.curPos.z);
447 }
448
449 if (parakarry->state.curPos.x > 240.0f) {
450 battleStatus->actionProgress = temp_s4;
451 return ApiStatus_DONE2;
452 }
453 break;
454 }
455
456 parakarry->curPos.x = actorState->curPos.x;
457 parakarry->curPos.y = actorState->curPos.y;
458 parakarry->curPos.z = actorState->curPos.z;
459
460 targetActor->curPos.x = actorState->curPos.x + actorState->goalPos.x;
461 targetActor->curPos.y = actorState->curPos.y + actorState->goalPos.y;
462 targetActor->curPos.z = actorState->curPos.z + actorState->goalPos.z;
463 return ApiStatus_BLOCK;
464}
465
466API_CALLABLE(N(FlyAround)) {
468 ActorState* state = &partner->state;
469
470 if (isInitialCall) {
471 script->functionTemp[0] = 0;
472 }
473
474 switch (script->functionTemp[0]) {
475 case 0:
476 state->curPos.x = partner->curPos.x;
477 state->curPos.y = partner->curPos.y;
478 state->curPos.z = partner->curPos.z;
479 state->angle = 60 - rand_int(10);
480 state->bounceDivisor = 0.0f;
481 state->moveTime = 90;
482 state->speed = 48.0f;
483 script->functionTemp[1] = 0;
484 script->functionTemp[2] = 0;
485 script->functionTemp[3] = 0;
486 airRaidEffect = fx_effect_65(0, state->curPos.x, state->curPos.y, state->curPos.z, 1.0f, 0);
487 script->functionTemp[0] = 1;
488 break;
489 case 1:
490 add_vec2D_polar(&state->curPos.x, &state->curPos.y, state->speed, state->angle);
491 airRaidEffect->data.unk_65->pos.x = state->curPos.x;
492 airRaidEffect->data.unk_65->pos.y = state->curPos.y;
493 airRaidEffect->data.unk_65->pos.z = state->curPos.z;
494 if (state->curPos.x < -190.0f) {
495 if (script->functionTemp[1] != 0) {
496 script->functionTemp[0] = 2;
497 break;
498 }
499 if (state->angle >= 270.0f && state->angle < 360.0f) {
500 state->angle = 90.0f + (90.0f - clamp_angle(state->angle + 180.0f));
501 state->bounceDivisor = rand_int(4) - 2;
502 }
503 if (state->angle >= 180.0f && state->angle < 270.0f) {
504 state->angle = 90.0f - (clamp_angle(state->angle + 180.0f) - 90.0f);
505 state->bounceDivisor = rand_int(4) - 2;
506 }
507
508 if (script->functionTemp[3] != 0) {
510 } else {
512 }
513 script->functionTemp[3] = 1 - script->functionTemp[3];
514 }
515
516 if (state->curPos.x > 190.0f) {
517 if (script->functionTemp[1] != 0) {
518 script->functionTemp[0] = 2;
519 break;
520 }
521
522 do {
523 if (state->angle >= 0.0f && state->angle < 90.0f) {
524 state->angle = 270.0f + (270.0f - clamp_angle(state->angle + 180.0f));
525 } else if (state->angle >= 90.0f && state->angle < 180.0f) {
526 state->angle = 270.0f - (clamp_angle(state->angle + 180.0f) - 270.0f);
527 }
528 } while (0); // TODO macro?
529
530 if (script->functionTemp[3] != 0) {
532 } else {
534 }
535 script->functionTemp[3] = 1 - script->functionTemp[3];
536 }
537
538 if (state->curPos.y < -30.0f) {
539 if (script->functionTemp[1] != 0) {
540 script->functionTemp[0] = 2;
541 break;
542 }
543
544 do {
545 if (state->angle >= 270.0f && state->angle < 360.0f) {
546 state->angle = 180.0f + (180.0f - clamp_angle(state->angle + 180.0f));
547 } else if (state->angle >= 0.0f && state->angle < 90.0f) {
548 state->angle = 180.0f - (clamp_angle(state->angle + 180.0f) - 180.0f);
549 }
550 } while (0); // TODO macro?
551
552 if (script->functionTemp[3] != 0) {
554 } else {
556 }
557 script->functionTemp[3] = 1 - script->functionTemp[3];
558 }
559
560 if (state->curPos.y > 160.0f) {
561 if (script->functionTemp[1] != 0) {
562 script->functionTemp[0] = 2;
563 break;
564 }
565
566 do {
567 if (state->angle >= 90.0f && state->angle < 180.0f) {
568 state->angle = 360.0f + (360.0f - clamp_angle(state->angle + 180.0f));
569 } else if (state->angle >= 180.0f && state->angle < 270.0f) {
570 state->angle = 360.0f - (clamp_angle(state->angle + 180.0f) - 360.0f);
571 }
572 } while (0); // TODO macro?
573
574 if (script->functionTemp[3] != 0) {
576 } else {
578 }
579 script->functionTemp[3] = 1 - script->functionTemp[3];
580 }
581
582 state->angle = clamp_angle(state->angle + (state->bounceDivisor * 0.5));
583 if (state->moveTime != 0) {
584 state->moveTime--;
585 } else {
586 script->functionTemp[1] = 1;
587 }
588 break;
589 }
590
591 switch (script->functionTemp[0]) {
592 case 2:
593 state->moveTime = 5;
594 script->functionTemp[0] = 3;
595 airRaidEffect->flags |= FX_INSTANCE_FLAG_DISMISS;
596 // fallthrough
597 case 3:
598 add_vec2D_polar(&state->curPos.x, &state->curPos.y, state->speed, state->angle);
599 if (state->moveTime == 0) {
600 partner->rot.z = 0.0f;
601 return ApiStatus_DONE2;
602 }
603 state->moveTime--;
604 // fallthrough
605 default:
606 partner->curPos.x = state->curPos.x;
607 partner->curPos.y = state->curPos.y;
608 partner->curPos.z = state->curPos.z;
609 return ApiStatus_BLOCK;
610 }
611}
612
613API_CALLABLE(N(GetAirRaidDamage)) {
614 script->varTable[15] = ((script->varTable[0] * 100) / 2499) + 2;
615
616 return ApiStatus_DONE2;
617}
618
619s32 N(DefaultAnims)[] = {
628};
629
630s32 N(DefenseTable)[] = {
633};
634
635s32 N(StatusTable)[] = {
638 STATUS_KEY_SLEEP, 100,
641 STATUS_KEY_DIZZY, 100,
642 STATUS_KEY_FEAR, 100,
646 STATUS_KEY_STOP, 100,
658};
659
661 {
662 .flags = 0,
663 .index = PRT_MAIN,
664 .posOffset = { 0, 0, 0 },
665 .targetOffset = { 11, 28 },
666 .opacity = 255,
667 .idleAnimations = N(DefaultAnims),
668 .defenseTable = N(DefenseTable),
669 .eventFlags = ACTOR_EVENT_FLAG_GROUNDABLE,
670 .elementImmunityFlags = 0,
671 .projectileTargetOffset = { 0, 0 },
672 },
673};
674
675ActorBlueprint NAMESPACE = {
676 .flags = ACTOR_FLAG_FLYING,
677 .type = ACTOR_TYPE_PARAKARRY,
678 .level = ACTOR_LEVEL_PARAKARRY,
679 .maxHP = 99,
680 .partCount = ARRAY_COUNT(N(ActorParts)),
681 .partsData = N(ActorParts),
682 .initScript = &N(EVS_Init),
683 .statusTable = N(StatusTable),
684 .escapeChance = 0,
685 .airLiftChance = 0,
686 .hurricaneChance = 0,
687 .spookChance = 0,
688 .upAndAwayChance = 0,
689 .spinSmashReq = 4,
690 .powerBounceChance = 80,
691 .coinReward = 0,
692 .size = { 38, 38 },
693 .healthBarOffset = { 0, 0 },
694 .statusIconOffset = { -10, 30 },
695 .statusTextOffset = { 10, 30 },
696};
697
698EvtScript N(EVS_Init) = {
703 Return
704 End
705};
706
707EvtScript N(EVS_Idle) = {
708 Return
709 End
710};
711
735 Set(LVar2, 22)
741 Set(LVar2, 22)
757 Set(LVar2, 22)
765 Set(LVar3, 30)
773 Wait(10)
779 Return
780 End
781};
782
793 ExecWait(N(runAway))
797 Return
798 End
799};
800
807 Return
808 End
809};
810
818 Return
824 Set(LVarE, 1)
825 Set(LVarF, 2)
826 ExecWait(N(skyDive))
829 Set(LVarE, 2)
830 Set(LVarF, 3)
831 ExecWait(N(skyDive))
834 Set(LVarE, 4)
835 Set(LVarF, 5)
836 ExecWait(N(skyDive))
841 ExecWait(N(airLift))
843 ExecWait(N(airRaid))
845 Return
846 End
847};
848
850 Return
851 End
852};
853
854EvtScript N(runAway) = {
858 Return
859 End
860};
861
871 Return
872 End
873};
874
876 Return
877 End
878};
879
885 Call(AddGoalPos, ACTOR_PARTNER, -50, 0, 0)
889 Wait(4)
892 Call(AddGoalPos, ACTOR_PARTNER, -30, 0, 0)
895 Wait(2)
901 Return
902 End
903};
904
910 Call(AddGoalPos, ACTOR_PARTNER, -30, 0, 0)
914 Wait(4)
917 Call(AddGoalPos, ACTOR_PARTNER, -20, 0, 0)
920 Wait(2)
926 Return
927 End
928};
929
930s32 N(actionCommandTable)[] = { 7, 6, 5, 4, 3, 2, 1, 0 };
931
932EvtScript N(skyDive) = {
943 Call(AddGoalPos, ACTOR_PARTNER, -20, 0, 0)
947 Wait(3)
952 Call(AddGoalPos, ACTOR_PARTNER, 0, 10, 0)
954 Wait(2)
956 Wait(3)
960 Call(AddGoalPos, ACTOR_PARTNER, -26, 25, 0)
965 Call(AddGoalPos, ACTOR_PARTNER, -10, 0, 0)
971 Wait(5)
975 Call(AddGoalPos, ACTOR_PARTNER, 40, 10, 0)
977 Wait(20)
984 Return
985 EndIf
988 Wait(2)
991 CaseGt(0)
1008 EndSwitch
1011 Return
1012 End
1013};
1014
1015EvtScript N(shellShot) = {
1018 Wait(15)
1027 Set(LVar0, -2)
1028 EndIf
1029 Switch(LVar0)
1030 CaseEq(1)
1038 CaseEq(-1)
1043 Call(AddGoalPos, ACTOR_PARTNER, 50, -50, 0)
1045 Call(FlyToGoal, ACTOR_PARTNER, 7, 0, 100)
1047 CaseEq(0)
1052 Call(AddGoalPos, ACTOR_PARTNER, 50, 50, 0)
1056 CaseEq(-2)
1061 Call(AddGoalPos, ACTOR_PARTNER, 40, 0, 0)
1065 EndSwitch
1067 Switch(LVar0)
1068 CaseGt(0)
1073 EndSwitch
1075 Label(10)
1076 Switch(LVar0)
1079 IfEq(LFlag0, TRUE)
1081 Else
1083 EndIf
1091 EndSwitch
1092 Return
1093 End
1094};
1095
1096EvtScript N(airLift) = {
1101 Call(SetupMashMeter, 1, 100, 0, 0, 0, 0)
1106 Div(LVar0, 4)
1110 Sub(LVar0, 12)
1111 IfLt(LVar0, 0)
1112 Set(LVar0, 0)
1113 EndIf
1119 Wait(15)
1121 Call(AddBattleCamDist, -160)
1125 Wait(2)
1131 Add(LVar1, 20)
1136 Wait(10)
1144 Return
1145 EndIf
1146 Wait(3)
1149 IfNe(LVar0, -1)
1153 Wait(1)
1155 Div(LVar1, 10)
1156 Add(LVar1, 1)
1157 Loop(88 * DT)
1159 Set(LVar2, LVar1)
1160 Mul(LVar2, 10)
1161 IfGt(LVar0, LVar2)
1165 Add(LVar1, 1)
1166 EndIf
1167 Wait(1)
1168 EndLoop
1170 Wait(90 * DT)
1172 Else
1174 Set(LVar0, 0)
1175 EndIf
1176 Switch(LVar0)
1177 CaseEq(1)
1181 Call(N(CarryAway), LVar0)
1182 Wait(30)
1191 Add(LVar1, 20)
1196 Wait(10)
1197 EndSwitch
1205 Return
1206 End
1207};
1208
1209EvtScript N(airRaid) = {
1212 Call(SetupMashMeter, 4, 25, 50, 75, 100, 0)
1218 Add(LVar0, 70)
1225 Wait(2)
1228 Sub(LVar0, 50)
1229 Add(LVar1, 30)
1230 Add(LVar2, 40)
1233 Wait(2)
1238 Loop(5)
1239 Wait(18)
1242 EndLoop
1245 Loop(5)
1246 Wait(18)
1249 EndLoop
1252 Call(N(FlyAround))
1259 Label(10)
1262 IfEq(LVar0, 6)
1263 Goto(11)
1264 EndIf
1266 Switch(LVar0)
1267 CaseGt(99)
1272 EndSwitch
1274 Wait(5)
1275 Label(11)
1278 Goto(10)
1279 EndIf
1281 Switch(LVar0)
1282 CaseGt(99)
1286 EndSwitch
1288 Wait(10)
1289 Call(SetActorPos, ACTOR_PARTNER, -200, 50, 0)
1296 Wait(20)
1298 Wait(20)
1299 Return
1300 End
1301};
BSS s32 PopupMenu_SelectedIndex
BSS ActionCommandStatus gActionCommandStatus
Definition action_cmd.c:91
void increment_action_command_attempt_count(void)
Definition action_cmd.c:641
void increment_action_command_success_count(void)
Definition action_cmd.c:655
void action_command_init_status(void)
Definition action_cmd.c:256
@ AC_DIFFICULTY_3
Definition action_cmd.h:45
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
s16 targetActorID
s32 HudElemID
Bytecode EvtScript[]
#define sfx_play_sound_at_position
#define rand_int
#define clamp_angle
#define atan2
EffectInstanceDataPtr data
Definition effects.h:2605
struct Effect65FXData * unk_65
Definition effects.h:2565
@ 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:3592
@ BS_FLAGS1_NICE_HIT
Definition enums.h:3575
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3574
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3570
@ BS_FLAGS1_4000
Definition enums.h:3582
@ 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:4234
#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:4825
@ BTL_CAM_DEFAULT
Definition enums.h:4823
@ BTL_CAM_PARTNER_MIDAIR
Definition enums.h:4873
@ BTL_CAM_ACTOR
Definition enums.h:4835
@ BTL_CAM_VIEW_ENEMIES
Definition enums.h:4824
@ BTL_CAM_PARTNER_MISTAKE
Definition enums.h:4872
@ 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:6407
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6406
@ PARTNER_RANK_NORMAL
Definition enums.h:2018
@ PARTNER_RANK_SUPER
Definition enums.h:2019
@ PARTNER_RANK_ULTRA
Definition enums.h:2020
@ 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:6413
@ ACTOR_BLUR_DISABLE
Definition enums.h:6412
@ 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:712
void add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
Definition 43F0.c:684
f32 get_clamped_angle_diff(f32, f32)
Definition 43F0.c:605
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:138
#define DT
Definition macros.h:526
#define LVar1
Definition macros.h:149
#define LFlag0
Definition macros.h:167
#define PI_S
Definition macros.h:133
#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
#define POPUP_MSG_OFF
Definition battle.h:270
#define POPUP_MSG_ON
Definition battle.h:269
struct Actor * partnerActor
GameStatus * gGameStatusPtr
Definition main_loop.c:32
BattleStatus gBattleStatus
Definition battle.c:11
s32 gCurrentCameraID
Definition cam_math.c:4