Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
paratroopa.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/KoopaTroopa.h"
6#include "sprite/npc/ParaTroopa.h"
7
8#define NAMESPACE A(paratroopa)
9
10extern s32 N(DownedAnims)[];
11extern s32 N(FlyingAnims)[];
12extern s32 N(WingAnims)[];
17extern EvtScript N(EVS_KnockDown);
18
23
26
27enum N(ActorPartIDs) {
28 PRT_DOWNED = 1,
29 PRT_FLYING = 2,
31};
32
33enum N(ActorVars) {
34 AVAR_AerialFlip = 0, // TRUE if current hit should trigger a flip event when KnockDown is done
37};
38
39enum N(ActorParams) {
42};
43
44s32 N(DownedDefense)[] = {
47 ELEMENT_JUMP, 1,
51};
52
53s32 N(FlyingDefense)[] = {
56};
57
58s32 N(FlippedDefense)[] = {
61};
62
63s32 N(DownedStatusTable)[] = {
74 STATUS_KEY_STOP, 100,
86};
87
88s32 N(FlyingStatusTable)[] = {
99 STATUS_KEY_STOP, 100,
111};
112
114 {
116 .index = PRT_DOWNED,
117 .posOffset = { 0, 0, 0 },
118 .targetOffset = { -2, 36 },
119 .opacity = 255,
120 .idleAnimations = N(DownedAnims),
121 .defenseTable = N(DownedDefense),
122 .eventFlags = ACTOR_EVENT_FLAG_FLIPABLE,
123 .elementImmunityFlags = 0,
124 .projectileTargetOffset = { 0, -7 },
125 },
126 {
128 .index = PRT_FLYING,
129 .posOffset = { 0, 0, 0 },
130 .targetOffset = { -4, 36 },
131 .opacity = 255,
132 .idleAnimations = N(FlyingAnims),
133 .defenseTable = N(FlyingDefense),
134 .eventFlags = ACTOR_EVENT_FLAG_GROUNDABLE,
135 .elementImmunityFlags = 0,
136 .projectileTargetOffset = { 2, -14 },
137 },
138 {
140 .index = PRT_DUMMY_WINGS,
141 .posOffset = { 0, 0, 0 },
142 .targetOffset = { 0, 32 },
143 .opacity = 255,
144 .idleAnimations = N(WingAnims),
145 .defenseTable = N(DownedDefense),
146 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
147 .elementImmunityFlags = 0,
148 .projectileTargetOffset = { 0, -10 },
149 },
150};
151
152ActorBlueprint NAMESPACE = {
153 .flags = ACTOR_FLAG_FLYING,
154 .type = ACTOR_TYPE_PARATROOPA,
155 .level = ACTOR_LEVEL_PARATROOPA,
156 .maxHP = 4,
157 .partCount = ARRAY_COUNT(N(ActorParts)),
158 .partsData = N(ActorParts),
159 .initScript = &N(EVS_Flying_Init),
160 .statusTable = N(FlyingStatusTable),
161 .escapeChance = 60,
162 .airLiftChance = 95,
163 .hurricaneChance = 100,
164 .spookChance = 90,
165 .upAndAwayChance = 95,
166 .spinSmashReq = 0,
167 .powerBounceChance = 90,
168 .coinReward = 1,
169 .size = { 50, 38 },
170 .healthBarOffset = { 0, 0 },
171 .statusIconOffset = { -10, 29 },
172 .statusTextOffset = { 8, 30 },
173};
174
175s32 N(FlyingAnims)[] = {
186};
187
188s32 N(FlyingShuffleAnims)[] = {
199};
200
201s32 N(WingAnims)[] = {
212};
213
216 Return
217 End
218};
219
226 Return
227 End
228};
229
234 Call(N(SetAbsoluteStatusOffsets), -19, 25, 4, 28)
235 Else
238 Call(N(SetAbsoluteStatusOffsets), -10, 29, 8, 30)
239 EndIf
240 Return
241 End
242};
243
245 Label(10)
246 Call(RandInt, 80, LVar0)
247 Add(LVar0, 80)
248 Loop(LVar0)
249 Label(0)
253 Wait(1)
254 Goto(0)
255 EndIf
256 Wait(1)
257 EndLoop
259 Add(LVar0, 5)
265 Loop(20)
266 Label(1)
270 Wait(1)
271 Goto(1)
272 EndIf
273 Wait(1)
274 EndLoop
276 Sub(LVar0, 5)
282 Loop(40)
283 Label(2)
287 Wait(1)
288 Goto(2)
289 EndIf
290 Wait(1)
291 EndLoop
292 Goto(10)
293 Return
294 End
295};
296
303 Return
304 End
305};
306
326 EndIf
327 EndIf
339 Return
353 Return
380 Return
396 EndIf
397 EndIf
403 Wait(10)
407 Return
409 Call(SetActorPos, ACTOR_SELF, 20, 0, 0)
424 Return
433 Return
438 Return
439 End
440};
441
452 Call(AddGoalPos, ACTOR_SELF, 40, 30, 0)
456 Wait(5)
461 Set(LVarA, LVar0)
467 Call(AddGoalPos, ACTOR_SELF, 6, 6, 0)
470 Wait(6)
474 Sub(LVar0, 25)
475 Set(LVar1, 0)
481 Sub(LVar0, 30)
484 Thread
486 Set(LVar0, 0)
487 Loop(8)
488 Add(LVar0, 90)
489 IfGe(LVar0, 360)
490 Sub(LVar0, 360)
491 EndIf
493 Wait(1)
494 EndLoop
500 Sub(LVar0, 30)
506 Sub(LVar0, 30)
513 EndIf
515 Add(LVar1, 30)
517 Wait(20)
528 Return
536 Call(AddGoalPos, ACTOR_SELF, 6, 6, 0)
539 Wait(6)
546 Wait(2)
553 Call(AddGoalPos, ACTOR_SELF, 40, 30, 0)
556 Thread
558 Set(LVar0, 0)
559 Loop(12)
560 Sub(LVar0, 90)
561 IfLt(LVar0, 0)
562 Add(LVar0, 360)
563 EndIf
565 Wait(1)
566 EndLoop
572 Wait(10)
580 Return
581 End
582};
583
591 Add(LVar1, 8)
592 Sub(LVar2, 2)
599 Set(LVar1, 0)
603 Call(N(StartRumbleWithParams), 128, 7)
604 Thread
605 Call(ShakeCam, CAM_BATTLE, 0, 5, Float(0.3))
612 Loop(10)
614 Wait(1)
616 Wait(1)
617 EndLoop
619 Else
621 Set(LVar1, 0)
625 Thread
626 Loop(10)
628 Wait(1)
630 Wait(1)
631 EndLoop
634 Call(N(StartRumbleWithParams), 150, 7)
635 Thread
636 Call(ShakeCam, CAM_BATTLE, 0, 5, Float(0.3))
639 EndIf
641 Mod(LVar0, 4)
656 EndIf
657 Return
658 End
659};
660
661// everything below this point is shared with Koopa Troopa, but not in a manner
662// that can be cleanly separated
663
664s32 N(DownedAnims)[] = {
675};
676
677s32 N(DownedShuffleAnims)[] = {
688};
689
690s32 N(DownedFlippedAnims)[] = {
701};
702
708 Return
709 End
710};
711
714 CaseEq(0)
718 Call(N(SetAbsoluteStatusOffsets), -10, 20, 10, 20)
719 Else
722 Call(N(SetAbsoluteStatusOffsets), -15, 32, 5, 32)
723 EndIf
724 CaseEq(1)
727 Call(N(SetAbsoluteStatusOffsets), -10, 20, 10, 20)
729 Return
730 End
731};
732
734 Label(0)
735 Call(RandInt, 80, LVarA)
736 Add(LVarA, 80)
737 Loop(LVarA)
738 Label(1)
742 IfEq(LVar0, 1)
743 Wait(1)
744 Goto(1)
745 EndIf
747 Wait(1)
748 Goto(1)
749 EndIf
750 Wait(1)
751 EndLoop
753 Add(LVar0, 5)
760 CaseEq(0)
762 CaseEq(1)
765 Loop(20)
766 Label(2)
770 IfEq(LVar0, 1)
771 Wait(1)
772 Goto(2)
773 EndIf
775 Wait(1)
776 Goto(2)
777 EndIf
778 Wait(1)
779 EndLoop
781 Sub(LVar0, 5)
788 CaseEq(0)
790 CaseEq(1)
793 Loop(80)
794 Label(3)
798 IfEq(LVar0, 1)
799 Wait(1)
800 Goto(3)
801 EndIf
803 Wait(1)
804 Goto(3)
805 EndIf
806 Wait(1)
807 EndLoop
808 Goto(0)
809 Return
810 End
811};
812
813s32 N(FlipPosOffsets)[] = { 9, 16, 22, 26, 30, 32, 33, 32, 30, 26, 22, 16, 9, 0, 4, 6, 7, 6, 4, 0, 2, 0 };
814
840 Return
852 Return
865 Wait(4)
867 Wait(1)
869 Wait(1)
870 Call(SetActorRotation, ACTOR_SELF, 0, 0, -30)
871 Wait(1)
872 Call(SetActorRotation, ACTOR_SELF, 0, 0, -60)
873 Wait(1)
874 Call(SetActorRotation, ACTOR_SELF, 0, 0, -75)
875 Wait(1)
881 Wait(1)
882 EndLoop
907 Return
911 IfEq(LVar0, 0)
918 Wait(10)
919 EndIf
920 Else
924 EndIf
930 Wait(10)
934 Return
937 IfEq(LVar0, 0)
941 EndIf
947 IfEq(LVar0, 0)
951 Else
955 EndIf
958 IfEq(LVar0, 0)
963 Return
964 Else
968 EndIf
971 IfEq(LVar0, 0)
974 Else
977 EndIf
981 IfEq(LVar0, 0)
984 Else
987 EndIf
989 Return
992 IfEq(LVar0, 0)
996 Else
1000 EndIf
1001 EndSwitch
1004 Return
1005 End
1006};
1007
1015 Else
1017 IfEq(LVar0, 1)
1019 Sub(LVar0, 1)
1020 IfGt(LVar0, 0)
1024 Wait(30)
1027 Else
1030 Wait(20)
1036 Set(LVar0, 0)
1039 Loop(5)
1040 Add(LVar0, 15)
1042 Wait(1)
1043 EndLoop
1061 EndIf
1064 Return
1065 EndIf
1068 Wait(10)
1070 Wait(10)
1073 Add(LVar1, 4)
1074 PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
1075 Wait(3)
1076 PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
1077 Wait(2)
1078 PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
1082 Wait(10)
1084 EndIf
1088 Switch(LVar0)
1091 Set(LVarA, LVar0)
1093 Call(AddGoalPos, ACTOR_SELF, -40, 0, 0)
1103 EndIf
1105 Wait(8)
1108 Wait(4)
1111 EndIf
1113 Wait(1)
1116 Add(LVar1, 20)
1121 Wait(6)
1122 Sub(LVar1, 20)
1139 Return
1141 EndSwitch
1146 Wait(2)
1148 Switch(LVar0)
1153 Add(LVar0, 40)
1154 Set(LVar1, 0)
1158 Add(LVar0, 30)
1161 Add(LVar0, 20)
1165 Wait(8)
1172 EndSwitch
1175 Return
1176 End
1177};
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_FLY
Definition enums.h:2035
@ 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_JUMP
Definition enums.h:2122
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_BLAST
Definition enums.h:2124
@ ELEMENT_SMASH
Definition enums.h:2121
@ ELEMENT_WATER
Definition enums.h:2117
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ACTOR_EVENT_FLAG_GROUNDABLE
Actor can be knocked down from flight; triggered by jump attacks.
Definition enums.h:3382
@ ACTOR_EVENT_FLAGS_NONE
Definition enums.h:3370
@ ACTOR_EVENT_FLAG_FLIPABLE
Actor can be flipped; triggered by jump and quake attacks.
Definition enums.h:3380
@ ACTOR_DECORATION_SWEAT
Definition enums.h:2045
@ PHASE_FIRST_STRIKE
Definition enums.h:2059
@ ENCOUNTER_TRIGGER_HAMMER
Definition enums.h:271
@ 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_ACTOR_TARGET_MIDPOINT
Definition enums.h:4826
@ BTL_CAM_DEFAULT
Definition enums.h:4823
@ BTL_CAM_INTERRUPT
Definition enums.h:4822
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4884
@ SUPPRESS_EVENT_ALL
Definition enums.h:2907
@ EASING_SIN_OUT
Definition enums.h:521
@ EASING_LINEAR
Definition enums.h:510
@ IDLE_SCRIPT_RESTART
Definition enums.h:6408
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6407
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6406
@ STATUS_FLAG_DIZZY
Definition enums.h:2818
@ STATUS_FLAG_SLEEP
Definition enums.h:2812
@ SOUND_NONE
Definition enums.h:547
@ SOUND_PARAGOOMBA_PREDIVE
Definition enums.h:1510
@ SOUND_ACTOR_STEP_A
Definition enums.h:1474
@ SOUND_SHELL_SPIN
Definition enums.h:1342
@ SOUND_FALL_QUICK
Definition enums.h:1090
@ SOUND_SHELL_TOSS
Definition enums.h:1497
@ SOUND_ACTOR_JUMP
Definition enums.h:1290
@ SOUND_PARAGOOMBA_DIVE
Definition enums.h:1029
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_FLYING
Quake Hammer can't hit.
Definition enums.h:3329
@ ACTOR_FLAG_TYPE_CHANGED
Indicates actors type has changed, triggers recheck for if HP bar should be shown based on tattle sta...
Definition enums.h:3332
@ ACTOR_FLAG_FLIPPED
Actor has been flipped over.
Definition enums.h:3330
@ 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_BEGIN_FIRST_STRIKE
Definition enums.h:2173
@ EVENT_END_FIRST_STRIKE
Definition enums.h:2171
@ EVENT_IMMUNE
Definition enums.h:2146
@ EVENT_FALL_TRIGGER
Definition enums.h:2134
@ 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_15
Definition enums.h:2137
@ EVENT_AIR_LIFT_FAILED
Definition enums.h:2152
@ EVENT_BEGIN_AIR_LIFT
Definition enums.h:2175
@ EVENT_DEATH
Definition enums.h:2153
@ EVENT_FLIP_TRIGGER
Definition enums.h:2135
@ 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
@ ACTOR_PART_FLAG_NO_SHADOW
Definition enums.h:3352
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3361
@ ACTOR_PART_FLAG_NO_TARGET
Cannot be targeted.
Definition enums.h:3360
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3350
@ CAM_BATTLE
Definition enums.h:1801
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2881
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)
ApiStatus ShakeCam(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 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 EndChildThread
Marks the end of a child thread block.
Definition macros.h:563
#define Sub(VAR, INT_VALUE)
Definition macros.h:377
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define UseBuf(INT_PTR)
Loads a s32 pointer for use with subsequent EVT_BUF_READ commands.
Definition macros.h:389
#define Mod(VAR, INT_VALUE)
Definition macros.h:380
#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 Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define BufRead1(VAR)
Consumes the next s32 from the buffer and stores it in the given variable.
Definition macros.h:392
#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 IfTrue(b)
Definition macros.h:645
#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 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 LVar2
Definition macros.h:150
#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 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 Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#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