Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
player_events.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects.h"
3#include "model.h"
4#include "hud_element.h"
5#include "script_api/battle.h"
6#include "sprite/npc/Twink.h"
7#include "sprite/npc/BattleMerlee.h"
9#include "battle/battle.h"
10#include "sprite/player.h"
11
12extern HudScript HES_Happy;
14
19
21
31
32enum {
33 MERLEE_EFFECTS_HOLD = 0, // effects appear and track Merlee's position
34 MERLEE_EFFECTS_RELEASE = 1, // effects grow larger before vanishing
35 MERLEE_EFFECTS_DISMISS = 2, // effects vanish and are dismissed
36};
37
39
42 ActorPart* actorPart = &battleStatus->playerActor->partsTable[0];
43
47 } else if (!battleStatus->outtaSightActive) {
48 actorPart->idleAnimations = bMarioIdleAnims;
49 }
50}
51
52API_CALLABLE(IsPartnerImmobile) {
54 Actor* playerActor = battleStatus->playerActor;
55 s32 isImmobile = playerActor->debuff == STATUS_KEY_FEAR
56 || playerActor->debuff == STATUS_KEY_DIZZY
57 || playerActor->debuff == STATUS_KEY_PARALYZE
58 || playerActor->debuff == STATUS_KEY_SLEEP
59 || playerActor->debuff == STATUS_KEY_FROZEN
60 || playerActor->debuff == STATUS_KEY_STOP;
61
62 if (playerActor->stoneStatus == STATUS_KEY_STONE) {
64 }
65
66 script->varTable[0] = isImmobile;
67 return ApiStatus_DONE2;
68}
69
70API_CALLABLE(ActivateDefend) {
72
75 actorPart->idleAnimations = bMarioDefendAnims;
77 return ApiStatus_DONE2;
78}
79
80// (out) LVar0: skip playing lucky animation
81API_CALLABLE(TryPlayerLucky) {
83
84 show_action_rating(ACTION_RATING_LUCKY, player, player->curPos.x, player->curPos.y + 20.0f, player->curPos.z);
86
87 script->varTable[0] = FALSE;
88 if (player->debuff == STATUS_KEY_FEAR
89 || player->debuff == STATUS_KEY_DIZZY
90 || player->debuff == STATUS_KEY_PARALYZE
91 || player->debuff == STATUS_KEY_SLEEP
92 || player->debuff == STATUS_KEY_FROZEN
93 || player->debuff == STATUS_KEY_STOP
94 ) {
95 script->varTable[0] = TRUE;
96 }
97 return ApiStatus_DONE2;
98}
99
100API_CALLABLE(ChoosePlayerCelebrationAnim) {
103 s32 temp;
104 s32 i;
105
106 if (rand_int(pcao->randomChance + pcao->hpBasedChance) < pcao->randomChance) {
107 temp = 0;
108 for (i = 0; i < 8; i++) {
109 temp += pcao->options[i * 2];
110 }
111 temp = rand_int(temp);
112 for (i = 0; i < 8; i++) {
113 temp -= pcao->options[i * 2];
114 if (temp <= 0) {
115 break;
116 }
117 }
118
119 script->varTable[0] = pcao->options[i * 2 + 1];
120 } else {
121 s32* opts;
122 f32 healthRatio = playerData->curHP / (f32) playerData->curMaxHP;
123
124 if (healthRatio <= 0.25) {
125 opts = &pcao->options[16];
126 } else if (healthRatio <= 0.5) {
127 opts = &pcao->options[32];
128 } else if (healthRatio <= 0.75) {
129 opts = &pcao->options[48];
130 } else {
131 opts = &pcao->options[64];
132 }
133
134 temp = 0;
135 for (i = 0; i < 8; i++) {
136 temp += opts[i * 2];
137 }
138 temp = rand_int(temp);
139 for (i = 0; i < 8; i++) {
140 temp -= opts[i * 2];
141 if (temp <= 0) {
142 break;
143 }
144 }
145 script->varTable[0] = opts[i * 2 + 1];
146 }
147 return ApiStatus_DONE2;
148}
149
150API_CALLABLE(SetFledBattleFlag) {
152 return ApiStatus_DONE2;
153}
154
155API_CALLABLE(DetermineAutoRunAwaySuccess) {
157 s32 var;
158
160 return ApiStatus_DONE2;
161 }
162
163 var = player->state.varTable[0];
164 if (var >= rand_int(100)) {
165 script->varTable[0] = TRUE;
166 } else {
167 script->varTable[0] = FALSE;
168 }
169 return ApiStatus_DONE2;
170}
171
172API_CALLABLE(func_80260E38) {
174 return ApiStatus_DONE2;
175}
176
177API_CALLABLE(func_80260E5C) {
181 return ApiStatus_DONE2;
182}
183
184// out LVar0: time caller should wait for coin spawns
185API_CALLABLE(GiveRefund) {
187 Actor* player = battleStatus->playerActor;
188 s32 sellValue = gItemTable[battleStatus->moveArgument].sellValue;
189 f32 angle = 0.0f;
190 s32 delayTime = 0;
191 f32 posX, posY, posZ;
192 posY = player->curPos.y + player->size.y;
193
194 if (player_team_is_ability_active(player, ABILITY_REFUND) && sellValue > 0) {
195 s32 i;
197
198 // 75% of the item's sell value, rounded up
199 sellValue = (sellValue * 75 + 99) / 100;
200
201 for (i = 0; i < sellValue; i++) {
202 posX = player->curPos.x;
203 posZ = player->curPos.z;
204
205 make_item_entity(ITEM_COIN, posX, posY, posZ, ITEM_SPAWN_MODE_TOSS_FADE1, (i * 3) + 1, angle, 0);
206 add_coins(1);
207 angle += 30.0f;
208 }
209
210 delayTime = (i * 3) + 30;
211
212 posX = player->curPos.x;
213 posY = player->curPos.y;
214 posZ = player->curPos.z;
218 }
219
220 script->varTable[0] = delayTime;
221
222 return ApiStatus_DONE2;
223}
224
225API_CALLABLE(GiveRefundCleanup) {
227
230 }
231
232 return ApiStatus_DONE2;
233}
234
235API_CALLABLE(LifeShroomShroudWorld) {
236 if (isInitialCall) {
239 mdl_set_shroud_tint_params(0, 0, 0, 0);
240 script->functionTemp[0] = 20;
241 }
242
243 mdl_set_shroud_tint_params(0, 0, 0, ((20 - script->functionTemp[0]) * 12) & 0xFC);
244
245 script->functionTemp[0]--;
246
247 if (script->functionTemp[0] == 0) {
248 return ApiStatus_DONE2;
249 }
250
251 return ApiStatus_BLOCK;
252}
253
254API_CALLABLE(LifeShroomRevealWorld) {
255 if (isInitialCall) {
256 script->functionTemp[0] = 20;
258 }
259
260 mdl_set_shroud_tint_params(0, 0, 0, (script->functionTemp[0] * 12) & 0xFC);
261
262 script->functionTemp[0]--;
263 if (script->functionTemp[0] == 0) {
264 mdl_set_shroud_tint_params(0, 0, 0, 0);
265 return ApiStatus_DONE2;
266 }
267
268 return ApiStatus_BLOCK;
269}
270
271API_CALLABLE(ConsumeLifeShroom) {
274
275 playerData->curHP += item->potencyA;
276 if (playerData->curMaxHP < playerData->curHP) {
277 playerData->curHP = playerData->curMaxHP;
278 }
281 script->varTable[3] = item->potencyA;
282
283 return ApiStatus_DONE2;
284}
285
286API_CALLABLE(RestorePreDefeatState) {
289
293
294 // clear rush flags to initialize
295 battleStatus->rushFlags = RUSH_FLAG_NONE;
297
298 // set rush flags based on danger/peril status
299 if (!(battleStatus->flags2 & BS_FLAGS2_PEACH_BATTLE)) {
302 battleStatus->rushFlags |= RUSH_FLAG_MEGA;
303 }
304
306 if (!(battleStatus->rushFlags & RUSH_FLAG_MEGA)) {
308 battleStatus->rushFlags |= RUSH_FLAG_POWER;
309 }
310 }
311 }
312 return ApiStatus_DONE2;
313}
314
315API_CALLABLE(func_80261388) {
317
318 script->varTable[0] = FALSE;
319 if (partnerActorExists) {
320 script->varTable[0] = TRUE;
321 }
322 return ApiStatus_DONE2;
323}
324
325API_CALLABLE(SetItemAsLifeShroom) {
327 return ApiStatus_DONE2;
328}
329
330API_CALLABLE(PlayBattleMerleeGatherFX) {
331 Bytecode* args = script->ptrReadPos;
332 s32 var1 = evt_get_variable(script, *args++);
333 s32 var2 = evt_get_variable(script, *args++);
334 s32 var3 = evt_get_variable(script, *args++);
335
336 fx_energy_in_out(6, var1, var2 + 15, var3, 1.2f, 30);
337 return ApiStatus_DONE2;
338}
339
340API_CALLABLE(PlayBattleMerleeOrbFX) {
341 Bytecode* args = script->ptrReadPos;
342 s32 var1 = evt_get_variable(script, *args++);
343 s32 var2 = evt_get_variable(script, *args++);
344 s32 var3 = evt_get_variable(script, *args++);
345
346 fx_energy_orb_wave(9, var1, var2 + 15, var3, 5.0f, 15);
347 return ApiStatus_DONE2;
348}
349
350API_CALLABLE(BattleMerleeFadeStageToBlack) {
351 if (isInitialCall) {
354 mdl_set_shroud_tint_params(0, 0, 0, 0);
355 script->functionTemp[0] = 25;
356 }
357
358 mdl_set_shroud_tint_params(0, 0, 0, ((25 - script->functionTemp[0]) * 10) & 254);
359 script->functionTemp[0]--;
360
361 if (script->functionTemp[0] == 0) {
362 return ApiStatus_DONE2;
363 } else {
364 return ApiStatus_BLOCK;
365 }
366}
367
368API_CALLABLE(BattleMerleeFadeStageFromBlack) {
369 if (isInitialCall) {
370 script->functionTemp[0] = 25;
371 }
372
373 mdl_set_shroud_tint_params(0, 0, 0, (script->functionTemp[0] * 10) & 0xFF);
374
375 script->functionTemp[0] -= 5;
376 if (script->functionTemp[0] == 0) {
377 mdl_set_shroud_tint_params(0, 0, 0, 0);
378 return ApiStatus_DONE2;
379 }
380
381 return ApiStatus_BLOCK;
382}
383
384API_CALLABLE(BattleFadeInMerlee) {
386
387 if (isInitialCall) {
389 merlee->alpha = 0;
390 }
391
392 merlee->alpha += 17;
393 if (merlee->alpha >= 255) {
394 merlee->alpha = 255;
395 return ApiStatus_DONE1;
396 }
397
398 return ApiStatus_BLOCK;
399}
400
401API_CALLABLE(BattleFadeOutMerlee) {
403
404 merlee->alpha -= 17;
405 if (merlee->alpha == 0) {
406 merlee->alpha = 0;
407 return ApiStatus_DONE1;
408 }
409
410 return ApiStatus_BLOCK;
411}
412
413API_CALLABLE(BattleMerleeUpdateFX) {
416
417 if (isInitialCall) {
418 script->functionTemp[1] = 0;
420 BattleMerleeOrbEffect = fx_energy_orb_wave(0, merlee->pos.x, merlee->pos.y, merlee->pos.z, 0.4f, 0);
421 BattleMerleeWaveEffect = fx_energy_orb_wave(3, merlee->pos.x, merlee->pos.y, merlee->pos.z, 0.00001f, 0);
425 }
426 merlee->pos.y = BattleMerleeBasePosY + (sin_rad(DEG_TO_RAD(script->functionTemp[1])) * 3.0f);
427
428 script->functionTemp[1] += 10;
429 script->functionTemp[1] = clamp_angle(script->functionTemp[1]);
430
432 data->pos.x = merlee->pos.x;
433 data->pos.y = merlee->pos.y + 16.0f;
434 data->pos.z = merlee->pos.z;
435
437 data->pos.x = merlee->pos.x;
438 data->pos.y = merlee->pos.y + 16.0f;
439 data->pos.z = merlee->pos.z + 5.0f;
440
446 return ApiStatus_DONE1;
447 }
448
451 data->scale += 0.35;
452 if (data->scale > 3.5) {
453 data->scale = 3.5;
454 }
455
456 if (BattleMerleeEffectsTime != 0) {
458 } else {
460 data->scale += 0.5;
461 if (data->scale > 5.0) {
463 }
464 }
465 }
466 return ApiStatus_BLOCK;
467}
468
469API_CALLABLE(BattleMerleeStopFX) {
471 return ApiStatus_DONE2;
472}
473
474API_CALLABLE(HasMerleeCastsLeft) {
476
477 script->varTable[0] = FALSE;
478 if (playerData->merleeCastsLeft > 0) {
479 script->varTable[0] = TRUE;
480 }
481 return ApiStatus_DONE2;
482}
483
484API_CALLABLE(SpawnTurnEndFX) {
485 Bytecode* args = script->ptrReadPos;
486 s32 x = evt_get_variable(script, *args++);
487 s32 y = evt_get_variable(script, *args++);
488 s32 z = evt_get_variable(script, *args++);
489 s32 screenX;
490 s32 screenY;
491 s32 screenZ;
492
494
495 screenX += 30;
496 screenY -= 19;
497
498 if (script->varTable[10] > 0) {
501 screenY += 9;
502 }
503
504 if (script->varTable[11] > 0 || script->varTable[12] > 0) {
507 }
508 return ApiStatus_DONE2;
509}
510
511API_CALLABLE(RemoveTurnEndFX) {
512 if (script->varTable[10] > 0) {
514 }
515 if (script->varTable[11] > 0 || script->varTable[12] > 0) {
517 }
518 return ApiStatus_DONE2;
519}
520
521API_CALLABLE(SpawnRecoverHeartFX) {
522 Bytecode* args = script->ptrReadPos;
523 s32 var1 = evt_get_variable(script, *args++);
524 s32 var2 = evt_get_variable(script, *args++);
525 s32 var3 = evt_get_variable(script, *args++);
526 s32 var4 = evt_get_variable(script, *args++);
527
528 fx_recover(0, var1, var2, var3, var4);
529 return ApiStatus_DONE2;
530}
531
532API_CALLABLE(SpawnRecoverFlowerFX) {
533 Bytecode* args = script->ptrReadPos;
534 s32 var1 = evt_get_variable(script, *args++);
535 s32 var2 = evt_get_variable(script, *args++);
536 s32 var3 = evt_get_variable(script, *args++);
537 s32 var4 = evt_get_variable(script, *args++);
538
539 fx_recover(1, var1, var2, var3, var4);
540 return ApiStatus_DONE2;
541}
542
543API_CALLABLE(IncrementPlayerHP) {
545
546 playerData->curHP++;
547 if (playerData->curHP > playerData->curMaxHP) {
548 playerData->curHP = playerData->curMaxHP;
549 }
550 return ApiStatus_DONE2;
551}
552
553API_CALLABLE(IncrementPlayerFP) {
555
556 playerData->curFP++;
557 if (playerData->curFP > playerData->curMaxFP) {
558 playerData->curFP = playerData->curMaxFP;
559 }
560 return ApiStatus_DONE2;
561}
562
563API_CALLABLE(InflictDizzyAttackStatus) {
566 return ApiStatus_DONE2;
567}
568
569API_CALLABLE(GetLostHammerAndBootsLevel) {
571
572 script->varTable[11] = playerData->bootsLevel;
573 script->varTable[12] = playerData->hammerLevel;
574 return ApiStatus_DONE2;
575}
576
577API_CALLABLE(DropAbilityItem) {
578 ItemEntity* item = get_item_entity(script->varTable[10]);
579
580 if (isInitialCall) {
581 script->functionTemp[0] = 0;
582 script->functionTemp[1] = 0;
583 }
584
585 switch (script->functionTemp[1]) {
586 case 0:
587 script->functionTemp[0]--;
588 item->pos.y += script->functionTemp[0];
589 if (item->pos.y < 0.0f) {
590 item->pos.y = 0.0f;
591 script->functionTemp[0] = 8;
592 script->functionTemp[1] = 1;
593 }
594 break;
595 case 1:
596 script->functionTemp[0]--;
597 item->pos.y += script->functionTemp[0];
598 item->pos.x += 1.5;
599 if (item->pos.y < 0.0f) {
600 item->pos.y = 0.0f;
601 script->functionTemp[0] = 4;
602 script->functionTemp[1] = 2;
603 }
604 break;
605 case 2:
606 script->functionTemp[0]--;
607 item->pos.y += script->functionTemp[0];
608 item->pos.x += 1.2;
609 if (item->pos.y < 0.0f) {
610 item->pos.y = 0.0f;
611 script->functionTemp[1] = 3;
612 }
613 break;
614 case 3:
615 D_8029FBB0[0] = 20;
616 D_8029FBB0[1] = 20;
617 D_8029FBB0[2] = 20;
618 return ApiStatus_DONE2;
619 }
620 return ApiStatus_BLOCK;
621}
622
623API_CALLABLE(PlayerGatherAbilityItem) {
624 ItemEntity* item = get_item_entity(script->varTable[10]);
626 s32 interpAmt;
627 f32 deltaX;
628 f32 deltaY;
629 f32 deltaZ;
630
631 if (isInitialCall) {
632 script->functionTemp[0] = 0;
633 script->functionTemp[1] = 10;
634 }
635
636 switch (script->functionTemp[0]) {
637 case 0:
638 interpAmt = script->functionTemp[1];
639 deltaX = player->curPos.x - item->pos.x;
640 deltaY = player->curPos.y + 12.0f - item->pos.y;
641 deltaZ = player->curPos.z - 5.0f - item->pos.z;
642
643 item->pos.x += deltaX / interpAmt;
644 item->pos.y += deltaY / interpAmt;
645 item->pos.z += deltaZ / interpAmt;
646
647 item->pos.y += dist2D(item->pos.x, item->pos.y, player->curPos.x,
648 player->curPos.y + 12.0f) / 5.0f;
649
650 if (script->functionTemp[1] == 1) {
651 script->functionTemp[0] = 1;
652 }
653
654 script->functionTemp[1]--;
655 break;
656 case 1:
657 return ApiStatus_DONE2;
658 }
659 return ApiStatus_BLOCK;
660}
661
662API_CALLABLE(AbilityItemUnkDelay) {
663 s32* delayCounter = &D_8029FBB0[script->varTable[14]];
664
665 if (*delayCounter != 0) {
666 (*delayCounter)--;
667 return ApiStatus_BLOCK;
668 }
669
670 return ApiStatus_DONE2;
671}
672
677
682
685 Call(SetBattleCamTarget, -80, 35, 8)
688 Sub(LVar0, 100)
690 Call(RandInt, 100, LVar0)
692 CaseGt(50)
697 CaseGt(20)
702 Call(PlayerHopToGoal, 18, 0, 0)
704 Wait(7)
712 Call(ShakeCam, 1, 0, 5, Float(1.0))
716 Wait(10)
718 Wait(10)
721 Return
722 End
723};
724
751
783
793
817
830
847
853
871 Sub(LVar0, 60)
872 Add(LVar1, 40)
876 Call(PlayerHopToGoal, 5, 0, 1)
878 Set(LVar2, 0)
883 Add(LVar0, 30)
884 Set(LVar1, 0)
887 Call(PlayerHopToGoal, 10, 0, 2)
888 Sub(LVar0, 20)
890 Call(PlayerHopToGoal, 7, 0, 2)
891 Sub(LVar0, 10)
893 Call(PlayerHopToGoal, 4, 0, 2)
894 IfEq(LVarF, 39)
895 Return
896 EndIf
903 Sub(LVar0, 60)
904 Add(LVar1, 40)
908 Call(PlayerHopToGoal, 5, 0, 1)
911 Add(LVar5, 5)
912 Add(LVar6, 4)
913 Add(LVar7, 5)
915 Wait(2)
917 Add(LVar5, -5)
918 Add(LVar6, 18)
919 Add(LVar7, 5)
923 Set(LVar2, 0)
928 Add(LVar0, 30)
929 Set(LVar1, 0)
932 Call(PlayerHopToGoal, 10, 0, 2)
933 Sub(LVar0, 20)
935 Call(PlayerHopToGoal, 7, 0, 2)
936 Sub(LVar0, 10)
938 Call(PlayerHopToGoal, 4, 0, 2)
939 IfEq(LVarF, 36)
940 Return
941 EndIf
948 Sub(LVar0, 60)
949 Add(LVar1, 40)
953 Call(PlayerHopToGoal, 5, 0, 1)
956 Set(LVar2, 0)
961 Add(LVar0, 30)
962 Set(LVar1, 0)
965 Call(PlayerHopToGoal, 10, 0, 2)
966 Sub(LVar0, 20)
968 Call(PlayerHopToGoal, 7, 0, 2)
969 Sub(LVar0, 10)
971 Call(PlayerHopToGoal, 4, 0, 2)
972 IfEq(LVarF, 38)
973 Return
974 EndIf
980 Wait(30)
982 Else
983 Wait(30)
984 EndIf
990 Call(PlayerHopToGoal, 15, 0, 0)
998 Wait(10)
1004 Call(PlayerHopToGoal, 15, 0, 0)
1014 Set(LVar2, 0)
1027 SetConst(LVar0, 1)
1030 Wait(10)
1034 Set(LVar2, 0)
1039 Set(LVar2, 0)
1042 Return
1045 Set(LVar2, 0)
1047 Return
1053 Call(PlayerHopToGoal, 15, 0, 0)
1056 EndSwitch
1058 Return
1059 End
1060};
1061
1063 Set(LVar0, 0)
1064 Loop(5)
1065 Add(LVar0, 72)
1067 Wait(1)
1068 EndLoop
1071 Wait(31)
1072 Return
1073 End
1074};
1075
1080 Wait(1)
1082 Wait(1)
1084 Wait(1)
1086 Wait(1)
1088 Wait(1)
1090 Wait(5)
1091 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1092 Wait(2)
1093 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1094 Wait(5)
1095 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1096 Wait(2)
1097 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1098 Wait(2)
1099 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1100 Wait(5)
1101 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1102 Wait(2)
1103 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1104 Wait(5)
1105 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1106 Wait(15)
1111 Call(PlayerHopToGoal, 8, 0, 0)
1113 IfEq(LVar0, 1)
1116 Call(SetGoalPos, ACTOR_PLAYER, -240, 0, 10)
1119 Wait(5)
1120 Else
1122 Call(ShakeCam, 1, 0, 5, Float(1.0))
1126 Call(SetGoalPos, ACTOR_PLAYER, -100, 0, 10)
1129 Set(LVar3, 6)
1132 Loop(2)
1135 Wait(5)
1136 EndLoop
1138 Loop(10)
1139 Sub(LVar0, LVar3)
1140 Sub(LVar3, 1)
1141 IfLt(LVar3, 1)
1142 Set(LVar3, 1)
1143 EndIf
1145 Wait(1)
1146 EndLoop
1147 Wait(15)
1150 Wait(20)
1153 Wait(7)
1154 Loop(2)
1156 Sub(LVar0, 8)
1157 Add(LVar1, 14)
1158 Add(LVar2, 5)
1160 Wait(5)
1161 EndLoop
1163 Wait(5)
1165 Wait(10)
1166 EndIf
1168 Return
1169 End
1170};
1171
1178 Return
1179 EndIf
1184 Call(SetupMashMeter, 1, 100, 0, 0, 0, 0)
1189 Wait(1)
1191 Wait(1)
1193 Wait(1)
1195 Wait(1)
1197 Wait(1)
1199 Wait(5)
1202 Wait(5)
1203 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1204 Wait(2)
1205 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1206 Wait(5)
1207 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1208 Wait(2)
1209 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1210 Wait(2)
1211 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1212 Wait(5)
1213 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1214 Wait(2)
1215 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1216 Wait(5)
1217 Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0)
1218 Wait(15)
1219 Wait(30)
1224 Call(PlayerHopToGoal, 8, 0, 0)
1227 IfEq(LVar0, 1)
1230 Call(SetGoalPos, ACTOR_PLAYER, -240, 0, 10)
1233 Wait(5)
1234 Else
1236 Call(ShakeCam, 1, 0, 5, Float(1.0))
1240 Call(SetGoalPos, ACTOR_PLAYER, -100, 0, 10)
1243 Set(LVar3, 6)
1246 Loop(2)
1249 Wait(5)
1250 EndLoop
1252 Loop(10)
1253 Sub(LVar0, LVar3)
1254 Sub(LVar3, 1)
1255 IfLt(LVar3, 1)
1256 Set(LVar3, 1)
1257 EndIf
1259 Wait(1)
1260 EndLoop
1261 Wait(15)
1264 Wait(20)
1267 Wait(7)
1268 Loop(2)
1270 Sub(LVar0, 8)
1271 Add(LVar1, 14)
1272 Add(LVar2, 5)
1274 Wait(5)
1275 EndLoop
1277 Wait(5)
1279 Wait(10)
1280 EndIf
1282 Return
1283 End
1284};
1285
1298
1345
1387
1408
1420
1433
1446
1451 IfEq(LVar0, 1)
1454 Set(LVar0, 255)
1455 Loop(10)
1456 Sub(LVar0, 25)
1457 IfLt(LVar0, 0)
1458 Set(LVar0, 0)
1459 EndIf
1461 Wait(1)
1462 EndLoop
1464 EndIf
1469 Set(LVarA, LVar0)
1471 Set(LVar3, 30)
1472 Set(LVar4, 16)
1473 Loop(LVar3)
1474 Add(LVar4, 8)
1475 IfGt(LVar4, 255)
1476 Set(LVar4, 255)
1477 EndIf
1478 AddF(LVar1, Float(1.0))
1480 Wait(1)
1481 EndLoop
1482 Set(LVar3, LVar0)
1483 Set(LVar4, LVar1)
1484 Set(LVar5, LVar2)
1487 IfGt(LVar0, 0)
1488 Wait(LVar0)
1489 Wait(15)
1491 EndIf
1493 Add(LVar4, 15)
1495 Set(LVar0, LVarF)
1496 Loop(4)
1497 Call(SetItemFlags, LVarA, 64, 1)
1498 Wait(2)
1499 Call(SetItemFlags, LVarA, 64, 0)
1500 Wait(8)
1501 EndLoop
1505 PlayEffect(EFFECT_STARS_SHIMMER, 1, LVar3, LVar4, LVar5, 70, 70, 10, 20)
1506 Wait(20)
1509 PlayEffect(EFFECT_STARS_SHIMMER, 2, LVar0, LVar1, LVar2, 50, 20, 32, 30)
1510 Wait(40)
1511 PlayEffect(EFFECT_STARS_SHIMMER, 2, LVar0, LVar1, LVar2, 30, 50, 32, 30)
1513 Loop(3)
1515 Wait(4)
1517 Wait(4)
1518 EndLoop
1519 Loop(3)
1521 Wait(2)
1523 Wait(2)
1524 EndLoop
1525 Loop(7)
1527 Wait(1)
1529 Wait(1)
1530 EndLoop
1532 Wait(50)
1541 Add(LVar1, 25)
1548 IfEq(LVar0, 1)
1550 Set(LVar0, 0)
1551 Loop(10)
1552 Add(LVar0, 25)
1553 IfGt(LVar0, 255)
1554 Set(LVar0, 255)
1555 EndIf
1557 Wait(1)
1558 EndLoop
1561 EndIf
1564 Loop(5)
1565 Wait(2)
1567 PlayEffect(EFFECT_MISC_PARTICLES, 2, LVar0, LVar1, LVar2, 20, 20, Float(1.0), 10, 50)
1568 EndLoop
1574 Set(LVar1, 0)
1577 Call(PlayerHopToGoal, 20, 0, 0)
1579 Wait(4)
1581 Wait(10)
1584 Return
1585 End
1586};
1587
1599
1603 Wait(10)
1605 Call(SetBattleCamTarget, 0, 80, 0)
1609 Wait(10)
1613 Call(SetNpcPos, NPC_BTL_MERLEE, 0, 65, 20)
1618 Wait(30)
1624 Wait(20)
1633 Wait(15)
1638 Call(PlayerHopToGoal, 18, 0, 0)
1640 Wait(4)
1645 Return
1646 End
1647};
1648
1652 Wait(10)
1654 Call(SetBattleCamTarget, 0, 80, 0)
1658 Wait(10)
1662 Call(SetNpcPos, NPC_BTL_MERLEE, 0, 65, 20)
1667 Wait(30)
1673 Wait(20)
1682 Wait(15)
1685 Wait(22)
1686 Else
1691 Call(PlayerHopToGoal, 18, 0, 0)
1693 Wait(4)
1695 EndIf
1699 Return
1700 End
1701};
1702
1706 Wait(10)
1708 Call(SetBattleCamTarget, 0, 80, 0)
1712 Wait(10)
1716 Call(SetNpcPos, NPC_BTL_MERLEE, 0, 65, 20)
1721 Wait(30)
1727 Wait(20)
1736 Wait(15)
1741 Call(PlayerHopToGoal, 18, 0, 0)
1743 Wait(4)
1748 Return
1749 End
1750};
1751
1805
1807 Set(LVar0, 0)
1808 Loop(40)
1809 Add(LVar0, 72)
1811 Wait(1)
1812 EndLoop
1815 Return
1816 End
1817};
1818
BSS s32 PopupMenu_SelectedIndex
@ AC_DIFFICULTY_3
Definition action_cmd.h:45
@ AC_MODE_NOT_LEARNED
Definition action_cmd.h:60
u32 * idleAnimations
ActorState state
struct ActorPart * partsTable
s32 HudElemID
Vec2bu size
Vec3f curPos
Bytecode EvtScript[]
#define rand_int
#define clamp_angle
EffectInstanceDataPtr data
Definition effects.h:2605
struct EnergyOrbWaveFXData * energyOrbWave
Definition effects.h:2546
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
@ ACTION_RATING_LUCKY
clears nice hits
Definition enums.h:1981
@ ENV_TINT_SHROUD
Definition enums.h:4386
@ ACTION_COMMAND_FLEE
Definition enums.h:3475
@ BS_FLAGS1_BATTLE_FLED
Definition enums.h:3586
@ BS_FLAGS1_PLAYER_DEFENDING
Definition enums.h:3590
@ BS_FLAGS1_SHOW_PLAYER_DECORATIONS
Definition enums.h:3567
@ BS_FLAGS1_4000
Definition enums.h:3582
@ BS_FLAGS1_EXECUTING_MOVE
Definition enums.h:3577
@ BTL_MSG_MERLEE_ATK_UP
Definition enums.h:4057
@ BTL_MSG_MERLEE_EXP_UP
Definition enums.h:4059
@ BTL_MSG_ACTION_TIP_MASH_BUTTON
Definition enums.h:4107
@ BTL_MSG_MERLEE_DONE
Definition enums.h:4060
@ BTL_MSG_MERLEE_DEF_UP
Definition enums.h:4058
@ RUSH_FLAG_NONE
Definition enums.h:5329
@ RUSH_FLAG_MEGA
Definition enums.h:5330
@ RUSH_FLAG_POWER
Definition enums.h:5331
@ ITEM_SPAWN_MODE_TOSS_FADE1
Definition enums.h:2314
@ PHASE_PLAYER_HAPPY
Definition enums.h:2073
@ PHASE_MERLEE_ATTACK_BONUS
Definition enums.h:2070
@ PHASE_USE_DEFEND
Definition enums.h:2063
@ PHASE_RUN_AWAY_START
Definition enums.h:2060
@ PHASE_EXECUTE_ACTION
Definition enums.h:2058
@ PHASE_MERLEE_EXP_BONUS
Definition enums.h:2072
@ PHASE_CELEBRATE
Definition enums.h:2062
@ PHASE_USE_LIFE_SHROOM
Definition enums.h:2065
@ PHASE_MERLEE_DEFENSE_BONUS
Definition enums.h:2071
@ PHASE_DEATH
Definition enums.h:2061
@ PHASE_RUN_AWAY_FAIL
Definition enums.h:2064
@ PHASE_FIRST_STRIKE
Definition enums.h:2059
@ BTL_MENU_TYPE_SMASH
Definition enums.h:4227
@ BTL_MENU_TYPE_JUMP
Definition enums.h:4226
@ BTL_MENU_TYPE_STAR_POWERS
Definition enums.h:4234
@ BTL_MENU_TYPE_ITEMS
Definition enums.h:4228
@ BS_FLAGS2_HAS_RUSH
Definition enums.h:3620
@ BS_FLAGS2_PEACH_BATTLE
Definition enums.h:3609
@ STATUS_KEY_PARALYZE
Definition enums.h:2201
@ STATUS_KEY_FROZEN
Definition enums.h:2203
@ STATUS_KEY_FEAR
Definition enums.h:2199
@ STATUS_KEY_SLEEP
Definition enums.h:2202
@ STATUS_KEY_STONE
Definition enums.h:2208
@ STATUS_KEY_STOP
Definition enums.h:2204
@ STATUS_KEY_DIZZY
Definition enums.h:2200
@ BTL_CAM_DEFAULT
Definition enums.h:4823
@ BTL_CAM_PLAYER_ENTRY
Definition enums.h:4843
@ BTL_CAM_PLAYER_HIT_HAZARD
Definition enums.h:4852
@ BTL_CAM_REPOSITION
Definition enums.h:4840
@ BTL_CAM_PLAYER_WISH
Definition enums.h:4890
@ BTL_CAM_PLAYER_HIT_SPIKE
Definition enums.h:4851
@ BTL_CAM_PLAYER_DIES
Definition enums.h:4845
@ NPC_BTL_MERLEE
Definition enums.h:2529
@ ABILITY_POWER_RUSH
Definition enums.h:466
@ ABILITY_REFUND
Definition enums.h:465
@ ABILITY_MEGA_RUSH
Definition enums.h:456
@ SOUND_PLAYER_RUN_IN_PLACE
Definition enums.h:780
@ SOUND_MAGIC_DESCENDING
Definition enums.h:1414
@ SOUND_REVIVAL_MAGIC
Definition enums.h:1187
@ SOUND_NO_DAMGE
Definition enums.h:1433
@ SOUND_START_RECOVERY
Definition enums.h:1385
@ SOUND_PLAYER_REVIVE
Definition enums.h:1188
@ SOUND_MAGIC_ASCENDING
Definition enums.h:1413
@ SOUND_LUCKY
Definition enums.h:1313
@ SOUND_EAT_OR_DRINK
Definition enums.h:1441
@ SOUND_TRIP
Definition enums.h:784
@ SOUND_MERLEE_APPEAR
Definition enums.h:972
@ SOUND_PLAYER_COLLAPSE
Definition enums.h:1312
@ SOUND_DUST_OFF
Definition enums.h:791
@ SOUND_LIFE_SHROOM_CHIME
Definition enums.h:1186
@ SOUND_USE_ITEM
Definition enums.h:1434
@ SOUND_PLAYER_RUN_AWAY
Definition enums.h:781
@ SOUND_LONG_PLAYER_JUMP
Definition enums.h:782
@ SOUND_PLAYER_SPINNING
Definition enums.h:1185
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_PARTNER
Definition enums.h:2086
@ ACTOR_ENEMY0
Definition enums.h:2087
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_NO_SHADOW
Hide shadow.
Definition enums.h:3325
@ ACTOR_BLUR_ENABLE
Definition enums.h:6413
@ ACTOR_BLUR_DISABLE
Definition enums.h:6412
@ EVENT_LUCKY
Definition enums.h:2172
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_SPIKE_DEATH
Definition enums.h:2160
@ EVENT_BURN_HIT
Definition enums.h:2136
@ EVENT_SPIKE_CONTACT
Definition enums.h:2163
@ EVENT_FIRE_DEATH
Definition enums.h:2162
@ EVENT_IMMUNE
Definition enums.h:2146
@ EVENT_BURN_DEATH
Definition enums.h:2157
@ EVENT_ZERO_DAMAGE
Definition enums.h:2144
@ EVENT_SHOCK_DEATH
Definition enums.h:2159
@ EVENT_BLOCK
Definition enums.h:2147
@ EVENT_REVIVE
Definition enums.h:2180
@ EVENT_18
Definition enums.h:2145
@ EVENT_HIT_COMBO
Definition enums.h:2131
@ EVENT_DEATH
Definition enums.h:2153
@ EVENT_RECOVER_FROM_KO
Definition enums.h:2170
@ EVENT_LIFE_SHROOM_PROC
Definition enums.h:2179
@ EVENT_SHOCK_HIT
Definition enums.h:2165
@ EVENT_32
Definition enums.h:2168
@ EVENT_BURN_CONTACT
Definition enums.h:2164
@ EVENT_RECOVER_STATUS
Definition enums.h:2167
@ NPC_FLAG_IGNORE_CAMERA_FOR_YAW
Definition enums.h:3016
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
#define ApiStatus_DONE1
Definition evt.h:117
#define ApiStatus_BLOCK
Definition evt.h:116
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1689
s32 is_ability_active(s32 arg0)
Definition inventory.c:1735
s32 player_team_is_ability_active(Actor *actor, s32 ability)
Definition 190B20.c:2765
void get_screen_coords(s32 camID, f32 x, f32 y, f32 z, s32 *screenX, s32 *screenY, s32 *screenZ)
Definition cam_main.c:409
void sort_consumables(void)
Bubbles up player inventory items such that all ITEM_NONE values are at the bottom.
Definition inventory.c:409
ItemEntity * get_item_entity(s32 itemEntityIndex)
void btl_update_ko_status(void)
Definition 190B20.c:2869
void mdl_set_all_tint_type(s32)
Definition model.c:4519
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:668
s32 make_item_entity(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 angle, s32 pickupVar)
s32 find_item(s32)
Search player inventory for itemID and return first matching array index.
Definition inventory.c:263
void set_actor_anim(s32 actorID, s32 partID, AnimID animID)
Definition 190B20.c:1005
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
void btl_show_battle_message(s32 messageIndex, s32 duration)
void deduct_current_move_fp(void)
Definition 190B20.c:961
s32 inflict_status_set_duration(Actor *actor, s32 statusTypeKey, s32 statusDurationKey, s32 duration)
Definition 190B20.c:2581
f32 sin_rad(f32 x)
Definition 43F0.c:711
s32 add_coins(s32 amt)
Definition inventory.c:2075
void btl_cam_unfreeze(void)
Definition camera.c:2002
void show_action_rating(s32, Actor *, f32, f32, f32)
Definition 190B20.c:2360
HudScript HES_Refund
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
void mdl_set_shroud_tint_params(u8 r, u8 g, u8 b, u8 a)
Definition model.c:3905
Npc * get_npc_unsafe(s32 npcID)
Definition npc.c:993
BSS s32 BattleMerleeEffectsTime
EvtScript EVS_MerleeRunOut
EvtScript EVS_Player_NoDamageHit
BSS EffectInstance * BattleMerleeWaveEffect
EvtScript EVS_Player_SimpleHit
HudScript HES_Happy
EvtScript EVS_Player_HandleEvent
BSS HudElemID HID_HPDrain
EvtScript EVS_PlayerFirstStrike
EvtScript EVS_MerleeExpBonus
EvtScript EVS_PeachEnterStage
EvtScript EVS_ApplyDizzyAttack
EvtScript EVS_ExecuteMarioAction
EvtScript EVS_PlayerRegainAbility
@ MERLEE_EFFECTS_DISMISS
@ MERLEE_EFFECTS_RELEASE
@ MERLEE_EFFECTS_HOLD
EvtScript EVS_Peach_HandlePhase
EvtScript EVS_PlayerDies
void btl_set_player_idle_anims(void)
EvtScript EVS_Unused_UseItemWithEffect
BSS s16 BattleMerleeEffectsState
BSS s32 D_8029FBB0[3]
EvtScript EVS_Unused_PlayerGoHome
EvtScript EVS_Mario_HandlePhase
EvtScript EVS_Peach_OnActorCreate
EvtScript EVS_Unused_UseItem
HudScript HES_HPDrain
EvtScript EVS_MerleeDefenseBonus
EvtScript EVS_Player_ComplexHit
EvtScript EVS_Unused_DrinkItem
EvtScript EVS_MarioEnterStage
BSS EffectInstance * BattleMerleeOrbEffect
PlayerCelebrationAnimOptions bPlayerCelebrations
Definition actors.c:5
EvtScript EVS_Player_Celebrate
BSS HudElemID HID_Refund
EvtScript EVS_StartDefend
EvtScript EVS_PlayerHappy
EvtScript EVS_Mario_OnActorCreate
EvtScript EVS_UseLifeShroom
BSS HudElemID HID_Happy
EvtScript EVS_RunAwayFail
EvtScript EVS_MerleeAttackBonus
EvtScript EVS_RunAwayStart
EvtScript EVS_Unused_EatItem
BSS f32 BattleMerleeBasePosY
EvtScript EVS_ExecutePeachAction
EvtScript EVS_RunAwayNoCommand
void sfx_play_sound(s32 soundID)
Definition sfx.c:517
ApiStatus RemoveItemEntity(Evt *script, b32 isInitialCall)
ApiStatus DeleteNpc(Evt *script, b32 isInitialCall)
ApiStatus SetItemPos(Evt *script, b32 isInitialCall)
ApiStatus SetItemFlags(Evt *script, b32 isInitialCall)
ApiStatus RemoveEffect(Evt *script, b32 isInitialCall)
ApiStatus SetNpcAnimation(Evt *script, b32 isInitialCall)
ApiStatus SetNpcRenderMode(Evt *script, b32 isInitialCall)
ApiStatus CreateNpc(Evt *script, b32 isInitialCall)
ApiStatus SetNpcPos(Evt *script, b32 isInitialCall)
ApiStatus MakeItemEntity(Evt *script, b32 isInitialCall)
ApiStatus ShowStartRecoveryShimmer(Evt *script, b32 isInitialCall)
ApiStatus RandInt(Evt *script, b32 isInitialCall)
ApiStatus ShakeCam(Evt *script, b32 isInitialCall)
ApiStatus SetNpcFlagBits(Evt *script, b32 isInitialCall)
#define Else
Marks the end of an if statement and the start of the else block.
Definition macros.h:295
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#define LVar6
Definition macros.h:154
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define AddF(VAR, FLOAT_VALUE)
Definition macros.h:383
#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 CaseNe(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:322
#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 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 IfFalse(b)
Definition macros.h:646
#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 BSS
Definition macros.h:7
#define LVarC
Definition macros.h:160
#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 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 LVar5
Definition macros.h:153
#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 LVarB
Definition macros.h:159
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#define LVar7
Definition macros.h:155
#define BreakLoop
Breaks out of the innermost loop.
Definition macros.h:251
#define Thread
Marks the start of a thread block.
Definition macros.h:544
#define EndThread
Marks the end of a thread block.
Definition macros.h:547
#define IfFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is set on LVAR,...
Definition macros.h:288
#define LVar8
Definition macros.h:156
#define LVar2
Definition macros.h:150
#define DEG_TO_RAD(deg)
Definition macros.h:138
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define LVar9
Definition macros.h:157
#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 LVar4
Definition macros.h:152
#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 PERIL_THRESHOLD
Definition battle.h:271
#define DANGER_THRESHOLD
Definition battle.h:270
struct Actor * partnerActor
struct Actor * playerActor
s32 gBattleState
Definition battle.cpp:12
s32 gDefeatedBattleState
Definition battle.cpp:17
ItemData gItemTable[]
s32 bPeachIdleAnims[]
Definition actors.c:122
s32 bMarioDefendAnims[]
Definition actors.c:76
PlayerData gPlayerData
Definition 77480.c:39
u8 * gBackgroundTintModePtr
Definition model.c:105
BattleStatus gBattleStatus
Definition battle.cpp:13
u32 bMarioIdleAnims[]
Definition actors.c:53
s32 gCurrentCameraID
Definition cam_math.c:5
s32 gBattleSubState
Definition battle.cpp:16
s32 gDefeatedBattleSubstate
Definition battle.cpp:15