Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
groove_guy.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects.h"
3#include "battle/battle.h"
4#include "script_api/battle.h"
5#include "sprite/npc/ShyGuy.h"
6#include "sprite/npc/MediGuy.h"
7#include "sprite/npc/GrooveGuy.h"
8
9#define NAMESPACE A(groove_guy)
10
13
14extern EvtScript N(EVS_Init);
15extern EvtScript N(EVS_Idle);
16extern EvtScript N(EVS_TakeTurn);
22
26
27enum N(ActorPartIDs) {
28 PRT_MAIN = 1,
29};
30
31enum N(ActorVars) {
33};
34
35enum N(ActorParams) {
36 DMG_TACKLE = 2,
37};
38
39s32 N(DefaultAnims)[] = {
50};
51
52s32 N(DefenseTable)[] = {
56};
57
58s32 N(StatusTable)[] = {
65 STATUS_KEY_FEAR, 100,
81};
82
84
86 {
88 .index = PRT_MAIN,
89 .posOffset = { 0, 0, 0 },
90 .targetOffset = { 0, 24 },
91 .opacity = 255,
92 .idleAnimations = N(DefaultAnims),
93 .defenseTable = N(DefenseTable),
94 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
95 .elementImmunityFlags = 0,
96 .projectileTargetOffset = { 0, -10 },
97 },
98};
99
100ActorBlueprint NAMESPACE = {
101 .flags = 0,
102 .type = ACTOR_TYPE_GROOVE_GUY,
103 .level = ACTOR_LEVEL_GROOVE_GUY,
104 .maxHP = 7,
105 .partCount = ARRAY_COUNT(N(ActorParts)),
106 .partsData = N(ActorParts),
107 .initScript = &N(EVS_Init),
108 .statusTable = N(StatusTable),
109 .escapeChance = 50,
110 .airLiftChance = 85,
111 .hurricaneChance = 80,
112 .spookChance = 70,
113 .upAndAwayChance = 95,
114 .spinSmashReq = 0,
115 .powerBounceChance = 80,
116 .coinReward = 2,
117 .size = { 28, 28 },
118 .healthBarOffset = { 0, 0 },
119 .statusIconOffset = { -10, 20 },
120 .statusTextOffset = { 10, 20 },
121};
122
123EvtScript N(EVS_Init) = {
128 Return
129 End
130};
131
132#include "common/battle/SetAbsoluteStatusOffsets.inc.c"
133
134EvtScript N(EVS_Idle) = {
135 Label(0)
140 Call(N(SetAbsoluteStatusOffsets), -13, 15, 4, 13)
141 Else
144 Call(N(SetAbsoluteStatusOffsets), -10, 20, 10, 20)
145 EndIf
146 Wait(1)
147 Goto(0)
148 Return
149 End
150};
151
158 Return
159 End
160};
161
186 Return
198 Return
215 Return
226 Wait(10)
230 Return
240 Return
249 Return
258 Return
259 End
260};
261
273 Add(LVar0, 50)
274 Set(LVar1, 0)
281 Set(LVarA, LVar0)
292 Sub(LVar0, 30)
297 EndIf
299 Sub(LVar0, 20)
302 Wait(15)
312 Return
315 Thread
316 Wait(3)
325 Add(LVar0, 10)
326 Set(LVar1, 0)
329 Wait(2)
337 Add(LVar0, 30)
338 Set(LVar1, 0)
343 Wait(8)
350 Return
351 End
352};
353
367 Add(LVar0, 10)
368 Set(LVar1, 0)
373 Set(LVar0, 0)
374 Loop(30)
375 Add(LVar0, 48)
376 Mod(LVar0, 360)
378 Wait(1)
379 EndLoop
386 Wait(20)
389 EndIf
396 Return
405 IfEq(LVar0, TRUE)
406 Thread
407 Set(LVar0, 0)
408 Loop(30)
409 Add(LVar0, 48)
410 Mod(LVar0, 360)
412 Wait(1)
413 EndLoop
416 EndIf
419 Set(LVar0, 0)
420 Loop(15)
421 Add(LVar0, 24)
422 Mod(LVar0, 360)
424 Wait(1)
425 EndLoop
430 Thread
431 Set(LVar0, 0)
432 Loop(20)
433 Add(LVar0, 72)
434 Mod(LVar0, 360)
436 Wait(1)
437 EndLoop
441 Add(LVar0, 40)
442 Set(LVar1, 0)
447 Wait(25)
455 Return
456 End
457};
458
466 Label(0)
469 Mod(LVar5, 4)
471 CaseEq(0)
472 Set(LFlag1, TRUE)
473 CaseEq(1)
474 Set(LFlag2, TRUE)
475 CaseEq(2)
476 Set(LFlag3, TRUE)
477 CaseEq(3)
478 Set(LFlag4, TRUE)
482 Goto(0)
483 EndIf
485 Set(LVarA, 0)
486 Return
487 EndIf
489 Set(LVarA, 1)
490 Return
491 EndIf
493 Set(LVarA, 2)
494 Return
495 EndIf
497 Set(LVarA, 3)
498 Return
499 EndIf
500 Set(LVarA, -1)
501 Return
502 End
503};
504
506 Set(LVar9, 0)
509 Label(0)
517 IfNe(LVar3, 2)
518 Add(LVar9, 1)
519 EndIf
520 EndIf
524 Goto(0)
525 EndIf
526 Return
527 End
528};
529
532 IfEq(LVar0, 2)
533 Call(RandInt, 100, LVar0)
534 IfLt(LVar0, 60)
538 Else
540 EndIf
541 Else
543 EndIf
544 Return
545 EndIf
547 IfEq(LVarA, -1)
548 Call(RandInt, 100, LVar0)
549 IfLt(LVar0, 60)
553 Else
555 EndIf
556 Else
558 EndIf
559 Return
560 EndIf
563 CaseEq(1)
564 Call(RandInt, 1000, LVar0)
565 IfLt(LVar0, 300)
567 Return
568 EndIf
569 CaseEq(2)
570 Call(RandInt, 1000, LVar0)
571 IfLt(LVar0, 150)
573 Return
574 EndIf
575 CaseEq(3)
576 Call(RandInt, 1000, LVar0)
577 IfLt(LVar0, 100)
579 Return
580 EndIf
582 Call(RandInt, 100, LVar0)
583 IfLt(LVar0, 60)
587 Else
589 EndIf
590 Else
592 EndIf
593 Return
594 End
595};
596
600 Call(RandInt, 2, LVar1)
602 CaseEq(0)
604 CaseEq(1)
606 CaseEq(2)
611 Return
612 End
613};
614
615API_CALLABLE(N(SpawnSpinFX)) {
616 Bytecode* args = script->ptrReadPos;
617 s32 x, y, z;
618 f32 scale;
619 s32 duration;
620
621 x = evt_get_variable(script, *args++);
622 y = evt_get_variable(script, *args++);
623 z = evt_get_variable(script, *args++);
624 scale = evt_get_float_variable(script, *args++);
625 duration = evt_get_variable(script, *args++);
626
627 N(DummyPlayerStatus).pos.x = x;
628 N(DummyPlayerStatus).pos.y = y;
629 N(DummyPlayerStatus).pos.z = z;
630 fx_effect_46(6, &N(DummyPlayerStatus), scale, duration);
631
632 return ApiStatus_DONE2;
633}
634
636 Thread
637 Wait(1)
641 Wait(4)
642 Thread
643 Wait(1)
647 Wait(4)
648 Thread
649 Wait(1)
653 Wait(4)
654 Thread
655 Wait(1)
659 Wait(4)
660 Thread
661 Wait(1)
665 Wait(4)
666 Thread
667 Wait(1)
671 Wait(4)
672 Thread
673 Wait(1)
677 Wait(4)
678 Thread
679 Wait(1)
683 Wait(4)
684 Thread
685 Wait(1)
691 SetF(LVar3, Float(1.0))
692 Else
693 SetF(LVar3, Float(0.4))
694 EndIf
698 Set(LVar0, 0)
699 Loop(48)
700 Add(LVar0, 30)
701 IfGe(LVar0, 360)
702 Sub(LVar0, 360)
703 EndIf
705 Wait(1)
706 EndLoop
709 Add(LVar1, 30)
713 Wait(8)
714 Return
715 End
716};
717
723 Set(LVarB, LVar0)
724 Set(LVar0, 200)
725 Set(LVar1, 0)
726 Set(LVar2, 0)
742 Return
743 End
744};
745
753 Set(LVarB, LVar0)
757 Add(LVar3, 200)
759 Thread
760 Set(LVar6, 0)
761 Loop(50)
762 Add(LVar6, 30)
763 Mod(LVar6, 360)
765 Wait(1)
766 EndLoop
770 Thread
771 Loop(2)
773 Wait(25)
774 EndLoop
781 Add(LVar1, 20)
785 Wait(25)
792 CaseEq(0)
794 CaseEq(1)
797 Return
798 End
799};
800
806 Set(LVarB, LVar0)
808 Add(LVarA, 4)
811 Set(LVar0, 200)
812 Set(LVar1, LVar4)
813 Set(LVar2, LVar5)
826 Return
827 End
828};
829
831
834};
835
837 ACTOR_BY_POS(NAMESPACE, N(SummonPos), 100),
838};
839
841 ACTOR_BY_POS(A(medi_guy), N(SummonPos), 100),
842};
BSS s32 PopupMenu_SelectedIndex
Bytecode EvtScript[]
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ BTL_CAM_XADJ_AVG
Definition enums.h:4899
@ ACTOR_SOUND_WALK
Definition enums.h:2034
@ ACTOR_SOUND_WALK_INCREMENT
Definition enums.h:2038
@ ACTOR_SOUND_JUMP
Definition enums.h:2036
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3574
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3570
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_SHOCK
Definition enums.h:2125
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ITER_NO_MORE
Definition enums.h:2030
@ ITER_NEXT
Definition enums.h:2025
@ ACTOR_EVENT_FLAGS_NONE
Definition enums.h:3370
@ ACTOR_DECORATION_SWEAT
Definition enums.h:2045
@ 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_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_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_DEFAULT
Definition enums.h:2198
@ HIT_RESULT_NO_DAMAGE
Definition enums.h:1952
@ HIT_RESULT_HIT
Definition enums.h:1950
@ HIT_RESULT_LUCKY
Definition enums.h:1955
@ HIT_RESULT_MISS
Definition enums.h:1956
@ BTL_CAM_MIDPOINT_NORMAL
Definition enums.h:4832
@ BTL_CAM_DEFAULT
Definition enums.h:4823
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4884
@ BTL_CAM_VIEW_ENEMIES
Definition enums.h:4824
@ TARGET_FLAG_PRIMARY_ONLY
Definition enums.h:1863
@ TARGET_FLAG_2
Definition enums.h:1850
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6407
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6406
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ STATUS_FLAG_DIZZY
Definition enums.h:2818
@ STATUS_FLAG_SLEEP
Definition enums.h:2812
@ SOUND_NONE
Definition enums.h:547
@ SOUND_GROOVE_GUY_SUMMON
Definition enums.h:1064
@ SOUND_SMALL_LENS_FLARE
Definition enums.h:1529
@ SOUND_RECOVER_HEART
Definition enums.h:1406
@ SOUND_GROOVE_GUY_SPIN_DOWN
Definition enums.h:1062
@ SOUND_ACTOR_HOP
Definition enums.h:1073
@ SOUND_GROOVE_GUY_TWIRL
Definition enums.h:1060
@ SOUND_ACTOR_STEP_A
Definition enums.h:1474
@ SOUND_ACTOR_STEP_B
Definition enums.h:1250
@ SOUND_GROOVE_GUY_LEAP
Definition enums.h:1061
@ SOUND_SHY_GUY_FLY
Definition enums.h:1199
@ SOUND_CALL_FOR_BACKUP
Definition enums.h:1063
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4904
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_SCARE_AWAY
Definition enums.h:2174
@ EVENT_BURN_HIT
Definition enums.h:2136
@ 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_SPIN_SMASH_HIT
Definition enums.h:2133
@ EVENT_SPIN_SMASH_DEATH
Definition enums.h:2154
@ EVENT_HIT_COMBO
Definition enums.h:2131
@ EVENT_AIR_LIFT_FAILED
Definition enums.h:2152
@ EVENT_BEGIN_AIR_LIFT
Definition enums.h:2175
@ EVENT_DEATH
Definition enums.h:2153
@ EVENT_SHOCK_HIT
Definition enums.h:2165
@ EVENT_RECOVER_STATUS
Definition enums.h:2167
@ EVENT_BLOW_AWAY
Definition enums.h:2143
@ ACTOR_PART_FLAG_PRIMARY_TARGET
Definition enums.h:3362
@ DAMAGE_TYPE_STATUS_ALWAYS_HITS
Definition enums.h:2880
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2881
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1689
f32 evt_get_float_variable(Evt *script, Bytecode var)
Definition evt.c:1929
EvtScript EVS_Enemy_ReturnHome
EvtScript EVS_Enemy_Knockback
EvtScript EVS_Enemy_ScareAway
EvtScript EVS_Enemy_Hit
EvtScript EVS_Enemy_Death
EvtScript EVS_Enemy_SpinSmashHit
EvtScript EVS_Enemy_ShockHit
EvtScript EVS_Enemy_AirLift
EvtScript EVS_Enemy_BlowAway
EvtScript EVS_Enemy_Recover
EvtScript EVS_Enemy_BurnHit
EvtScript EVS_Enemy_NoDamageHit
ApiStatus RandInt(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 Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define IfGe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR >= RVAR.
Definition macros.h:284
#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 Sub(VAR, INT_VALUE)
Definition macros.h:377
#define LFlag4
Definition macros.h:171
#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 Mod(VAR, INT_VALUE)
Definition macros.h:380
#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 BSS
Definition macros.h:7
#define ARRAY_COUNT(arr)
Definition macros.h:40
#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 LFlag1
Definition macros.h:168
#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 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 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 SetF(VAR, FLOAT_VALUE)
Sets the given variable to a given value, but supports Floats.
Definition macros.h:373
#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 LVar2
Definition macros.h:150
#define DMG_STATUS_KEY(typeFlag, duration, chance)
Definition macros.h:228
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#define IfNotFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is unset on LVAR,...
Definition macros.h:292
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define LFlag2
Definition macros.h:169
#define LVar9
Definition macros.h:157
#define NPC_DISPOSE_LOCATION
Definition macros.h:162
#define A(sym)
Definition macros.h:36
#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 LFlag3
Definition macros.h:170
#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 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 ACTOR_BY_POS(_name, _pos, _priority, args...)
Definition battle.h:230
FormationRow Formation[]
Definition battle.h:167