Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
pokey_mummy.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/Pokey.h"
6
7#define NAMESPACE A(pokey_mummy)
8
9extern s32 N(FourPartAnims)[];
10extern s32 N(ThrownPartAnims)[];
11extern EvtScript N(EVS_Init);
12extern EvtScript N(EVS_TakeTurn);
13extern EvtScript N(EVS_Idle);
19extern EvtScript N(EVS_Pokey_Hit);
21
22// while these parts seem set up to manage Pokeys changing size, its actually all handled via animations
23// and the PRT_BODY* are always invisible
24enum N(ActorPartIDs) {
25 PRT_MAIN = 1, // top part of a 4-part Pokey
26 PRT_BODY3 = 2, // bottom part of a 4-part Pokey
27 PRT_BODY2 = 3,
28 PRT_BODY1 = 4,
29 PRT_SINGLE = 5, // single-part Pokey
30 PRT_PROJECTILE = 6, // part which is thrown
31};
32
33enum N(ActorVars) {
37 AVAR_Anim_Run = 2,
38 AVAR_Anim_Hit = 3,
44 AVAR_Generation = 10,
45
49};
50
51enum N(ActorParams) {
52 DMG_THROW_PART = 2, // throw a body part at the player
53 DMG_LEAP = 2, // jump onto the player, used when no more parts can be thrown
54};
55
56s32 N(DefenseTable)[] = {
59};
60
61s32 N(StatusTable)[] = {
84};
85
87 {
89 .index = PRT_MAIN,
90 .posOffset = { 0, 0, 0 },
91 .targetOffset = { 0, 20 },
92 .opacity = 255,
93 .idleAnimations = N(FourPartAnims),
94 .defenseTable = N(DefenseTable),
96 .elementImmunityFlags = 0,
97 .projectileTargetOffset = { 0, 0 },
98 },
99 {
101 .index = PRT_BODY3,
102 .posOffset = { 0, 0, 0 },
103 .targetOffset = { 0, 72 },
104 .opacity = 255,
105 .idleAnimations = NULL,
106 .defenseTable = N(DefenseTable),
108 .elementImmunityFlags = 0,
109 .projectileTargetOffset = { 0, -8 },
110 },
111 {
113 .index = PRT_BODY2,
114 .posOffset = { 0, 0, 0 },
115 .targetOffset = { 0, 54 },
116 .opacity = 255,
117 .idleAnimations = NULL,
118 .defenseTable = N(DefenseTable),
120 .elementImmunityFlags = 0,
121 .projectileTargetOffset = { 0, -8 },
122 },
123 {
125 .index = PRT_BODY1,
126 .posOffset = { 0, 0, 0 },
127 .targetOffset = { 0, 36 },
128 .opacity = 255,
129 .idleAnimations = NULL,
130 .defenseTable = N(DefenseTable),
132 .elementImmunityFlags = 0,
133 .projectileTargetOffset = { 0, -8 },
134 },
135 {
137 .index = PRT_SINGLE,
138 .posOffset = { 0, 0, 0 },
139 .targetOffset = { 0, 16 },
140 .opacity = 255,
141 .idleAnimations = NULL,
142 .defenseTable = N(DefenseTable),
144 .elementImmunityFlags = 0,
145 .projectileTargetOffset = { 0, -8 },
146 },
147 {
149 .index = PRT_PROJECTILE,
150 .posOffset = { 0, 0, 0 },
151 .targetOffset = { 0, 0 },
152 .opacity = 255,
153 .idleAnimations = N(ThrownPartAnims),
154 .defenseTable = N(DefenseTable),
156 .elementImmunityFlags = 0,
157 .projectileTargetOffset = { 0, 0 },
158 },
159};
160
161ActorBlueprint NAMESPACE = {
162 .flags = 0,
165 .maxHP = 4,
166 .partCount = ARRAY_COUNT(N(ActorParts)),
167 .partsData = N(ActorParts),
168 .initScript = &N(EVS_Init),
169 .statusTable = N(StatusTable),
170 .escapeChance = 60,
171 .airLiftChance = 90,
172 .hurricaneChance = 85,
173 .spookChance = 60,
174 .upAndAwayChance = 95,
175 .spinSmashReq = 0,
176 .powerBounceChance = 95,
177 .coinReward = 1,
178 .size = { 24, 80 },
179 .healthBarOffset = { 0, 0 },
180 .statusIconOffset = { -15, 75 },
181 .statusTextOffset = { 10, 65 },
182};
183
184s32 N(FourPartAnims)[] = {
193};
194
195s32 N(ThreePartAnims)[] = {
204};
205
206s32 N(TwoPartAnims)[] = {
215};
216
217s32 N(OnePartAnims)[] = {
226};
227
228s32 N(ThrownPartAnims)[] = {
231};
232
234
235EvtScript N(EVS_Init) = {
240 // copy input var from Formation
253 Return
254 End
255};
256
257EvtScript N(EVS_Idle) = {
258 Return
259 End
260};
261
277 Else
279 IfEq(LVarA, 3)
283 Else
296 EndIf
297 EndIf
304 Wait(10)
305 Else
307 IfEq(LVarA, 3)
311 Wait(10)
312 Else
324 Wait(10)
326 EndIf
327 EndIf
331 Return
339 Else
341 IfEq(LVarA, 3)
343 Else
354 EndIf
355 EndIf
363 Else
365 IfEq(LVarA, 3)
367 Else
378 EndIf
379 EndIf
383 Return
391 Return
398 Else
400 EndIf
407 Else
409 EndIf
411 SetConst(LVar1, -1)
413 Return
434 Return
445 EndIf
448 CaseEq(0)
449 Set(LVar0, 0)
450 Set(LVar1, 77)
452 CaseEq(1)
453 Set(LVar0, 0)
454 Set(LVar1, 59)
456 CaseEq(2)
457 Set(LVar0, 0)
458 Set(LVar1, 41)
460 CaseEq(3)
461 Set(LVar0, 0)
462 Set(LVar1, 23)
468 EndIf
472 MulF(LVar0, Float(0.4))
473 MulF(LVar1, Float(0.4))
474 EndIf
478 Wait(30)
485 Return
490 Return
491 End
492};
493
496 IfEq(LVarA, 3)
498 Return
499 EndIf
506 EndIf
511 Else
513 EndIf
523 CaseEq(0)
525 Add(LVar1, 38)
526 Else
527 Add(LVar1, 15)
529 EndIf
531 CaseEq(1)
533 Add(LVar1, 20)
534 Else
535 Add(LVar1, 8)
537 EndIf
539 CaseEq(2)
541 Add(LVar1, 8)
542 Else
543 Add(LVar1, 3)
545 EndIf
547 CaseEq(3)
553 Wait(12)
556 Wait(1)
558 Wait(3)
567 Wait(5)
570 EndIf
574 Sub(LVar0, 80)
575 Sub(LVar1, 5)
583 Return
600 Sub(LVar0, 55)
601 Set(LVar1, 0)
606 Sub(LVar0, 24)
609 Sub(LVar0, 20)
616 Return
617 End
618};
619
631 Add(LVar0, 50)
632 Set(LVar1, 0)
639 Wait(4)
641 Wait(1)
643 Wait(4)
650 Set(LVarA, LVar0)
653 Sub(LVar0, 5)
654 Set(LVar1, 10)
658 Wait(2)
659 Set(LVar0, 0)
660 Loop(5)
661 Add(LVar0, 30)
663 Wait(1)
664 EndLoop
669 EndIf
672 Wait(2)
673 Set(LVar0, 180)
674 Loop(6)
675 Add(LVar0, 30)
676 IfEq(LVar0, 360)
677 Set(LVar0, 0)
678 EndIf
680 Wait(1)
681 EndLoop
686 Sub(LVar0, 30)
687 Set(LVar1, 0)
690 Wait(15)
702 Return
708 Wait(2)
709 Set(LVar0, 0)
710 Loop(5)
711 Add(LVar0, 30)
713 Wait(1)
714 EndLoop
717 Wait(2)
727 Add(LVar0, 40)
728 Set(LVar1, 0)
732 Add(LVar0, 30)
735 Add(LVar0, 20)
738 Sub(LVar0, 10)
751 Return
752 End
753};
754
761 Return
762 EndIf
765 CaseEq(0)
767 CaseEq(1)
769 CaseEq(2)
771 CaseEq(3)
776 Return
777 End
778};
779
783 CaseEq(0)
799 Call(N(SetAbsoluteStatusOffsets), -15, 55, 10, 45)
800 CaseEq(1)
816 Call(N(SetAbsoluteStatusOffsets), -15, 35, 10, 25)
817 CaseEq(2)
831 Call(N(SetAbsoluteStatusOffsets), -15, 15, 10, 5)
833 Return
834 End
835};
836
839 Add(LVar1, 18)
842 Set(LVar3, LVar1)
843 Wait(2)
844 Sub(LVar3, 1)
846 Wait(3)
847 Sub(LVar3, 2)
849 Wait(2)
850 Sub(LVar3, 3)
852 Wait(1)
853 Sub(LVar3, 5)
855 Wait(1)
856 Sub(LVar3, 7)
858 Wait(1)
859 Add(LVar3, 2)
861 Wait(1)
862 Add(LVar3, 3)
864 Wait(1)
865 Add(LVar3, 3)
867 Wait(1)
868 Sub(LVar3, 3)
870 Wait(1)
871 Sub(LVar3, 3)
873 Wait(1)
874 Sub(LVar3, 2)
876 Return
877 End
878};
879
887 Else
889 EndIf
895 Wait(4)
900 Label(0)
905 Goto(0)
906 EndIf
907 Label(1)
908 Add(LVarF, 1)
911 Goto(10)
912 EndIf
916 Goto(1)
917 EndIf
922 Set(LVar1, 0)
927 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.0))
932 Goto(1)
933 Label(10)
940 Return
941 End
942};
943
948 Else
950 EndIf
965 Wait(4)
969 IfNe(LVarA, 3)
975 Add(LVar0, 30)
976 Set(LVar1, 0)
978 Add(LVar0, 20)
980 Loop(20)
982 Wait(1)
984 Wait(1)
985 EndLoop
988 Else
989 Wait(30)
990 EndIf
998 Div(LVar3, 2)
999 Add(LVar1, LVar3)
1000 Add(LVar2, 5)
1001 DivF(LVar3, Float(10.0))
1006 Wait(10)
1008 EndSwitch
1009 Return
1010 End
1011};
1012
1020 Set(LVarD, LVarB)
1021 Add(LVarD, 40)
1025 Wait(20)
1028 Wait(20)
1030 Wait(5)
1032 Call(SetGoalPos, ACTOR_SELF, 200, 0, 0)
1034 Wait(8)
1038 Return
1039 End
1040};
BSS s32 PopupMenu_SelectedIndex
Bytecode EvtScript[]
@ BTL_CAM_XADJ_AVG
Definition enums.h:4899
@ ACTOR_SOUND_WALK
Definition enums.h:2034
@ ACTOR_SOUND_JUMP
Definition enums.h:2036
@ BS_FLAGS1_PARTNER_ACTING
Definition enums.h:3587
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3574
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3570
@ 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_ALT_SPIKY
Additional spiky quality associated with Pokeys and Spinies.
Definition enums.h:3388
@ ACTOR_EVENT_FLAG_SPIKY_TOP
Player takes spike damage from jump attacks.
Definition enums.h:3373
@ ACTOR_DECORATION_SWEAT
Definition enums.h:2045
@ PHASE_FIRST_STRIKE
Definition enums.h:2059
@ 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_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_ALLOW_TARGET_ONLY
Definition enums.h:1864
@ TARGET_FLAG_GROUND
Definition enums.h:1851
@ EASING_LINEAR
Definition enums.h:510
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6407
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6406
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ STATUS_FLAG_SLEEP
Definition enums.h:2812
@ STATUS_FLAG_POISON
Definition enums.h:2817
@ DMG_SRC_POWER_SHELL
Definition enums.h:1995
@ DMG_SRC_FIRE_SHELL
Definition enums.h:1997
@ DMG_SRC_SHELL_TOSS
Definition enums.h:1994
@ SOUND_NONE
Definition enums.h:547
@ SOUND_POKEY_THROW
Definition enums.h:1040
@ SOUND_POKEY_SWAY
Definition enums.h:1146
@ SOUND_POKEY_STEP
Definition enums.h:1070
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_TARGET_ONLY
Battle ends even if undefeated. No turn.
Definition enums.h:3334
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4904
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_SPIN_SMASH_LAUNCH_HIT
Definition enums.h:2138
@ 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_SPIKE_TAUNT
Definition enums.h:2148
@ EVENT_DEATH
Definition enums.h:2153
@ EVENT_SPIN_SMASH_LAUNCH_DEATH
Definition enums.h:2158
@ EVENT_SHOCK_HIT
Definition enums.h:2165
@ EVENT_RECOVER_STATUS
Definition enums.h:2167
@ ACTOR_PART_FLAG_PRIMARY_TARGET
Definition enums.h:3362
@ 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
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
EvtScript EVS_Enemy_HopToPos
EvtScript EVS_Enemy_Hit
EvtScript EVS_Enemy_Death
EvtScript EVS_Enemy_SpinSmashHit
EvtScript EVS_Enemy_ShockHit
EvtScript EVS_Enemy_Recover
EvtScript EVS_Enemy_BurnHit
EvtScript EVS_Enemy_NoDamageHit
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 LVar6
Definition macros.h:154
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define DivF(VAR, FLOAT_VALUE)
Definition macros.h:386
#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 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 LVarC
Definition macros.h:160
#define ARRAY_COUNT(arr)
Definition macros.h:40
#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 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 Div(VAR, INT_VALUE)
Definition macros.h:379
#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 MulF(VAR, FLOAT_VALUE)
Definition macros.h:385
#define DMG_STATUS_KEY(typeFlag, duration, chance)
Definition macros.h:228
#define EVT_IGNORE_ARG
Definition macros.h:46
#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 LVarD
Definition macros.h:161
#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 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