Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
ghost_goombario.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/BattleGoombario.h"
4
5#define NAMESPACE A(goombario_clone)
6
7extern EvtScript N(EVS_Init);
8extern EvtScript N(EVS_Idle);
9extern EvtScript N(EVS_TakeTurn);
11
12s32 N(DefaultAnims)[] = {
23};
24
25s32 N(DefenseTable)[] = {
28};
29
30s32 N(StatusTable)[] = {
53};
54
56 {
58 .index = PRT_MAIN,
59 .posOffset = { 0, 0, 0 },
60 .targetOffset = { 0, 20 },
61 .opacity = 255,
62 .idleAnimations = N(DefaultAnims),
63 .defenseTable = N(DefenseTable),
64 .eventFlags = 0,
65 .elementImmunityFlags = 0,
66 .projectileTargetOffset = { -1, -9 },
67 },
68};
69
70ActorBlueprint NAMESPACE = {
71 .flags = 0,
74 .maxHP = 15,
75 .partCount = ARRAY_COUNT(N(ActorParts)),
76 .partsData = N(ActorParts),
77 .initScript = &N(EVS_Init),
78 .statusTable = N(StatusTable),
79 .escapeChance = 50,
80 .airLiftChance = 80,
81 .hurricaneChance = 70,
82 .spookChance = 50,
83 .upAndAwayChance = 95,
84 .spinSmashReq = 0,
85 .powerBounceChance = 90,
86 .coinReward = 2,
87 .size = { 29, 26 },
88 .healthBarOffset = { 0, 0 },
89 .statusIconOffset = { -10, 20 },
90 .statusTextOffset = { 10, 20 },
91};
92
97 Return
98 End
99};
100
101EvtScript N(EVS_Idle) = {
102 Return
103 End
104};
105
118 Return
119 Else
123 EndIf
136 Wait(10)
140 Return
153 Return
158 Return
163 Set(LVar2, 12)
168 Return
181 Wait(10)
185 Return
195 Return
204 Return
209 Return
210 End
211};
212
213#include "world/common/todo/UnkFunc62.inc.c"
215
219 Thread
221 Set(LVar0, 180)
222 Loop(15)
223 Sub(LVar0, 60)
225 Wait(1)
226 EndLoop
233 Add(LVar0, 60)
234 Set(LVar1, 0)
240 SetF(LVar5, Float(7.2))
241 Else
242 Set(LVar5, 18)
243 EndIf
246 Wait(1)
250 Add(LVar0, 20)
255 Wait(1)
256 Add(LVar0, 10)
263 Wait(1)
266 Wait(2)
272 Return
273 End
274};
275
282 Call(AddGoalPos, ACTOR_SELF, 70, 0, 0)
287 Return
288 End
289};
290
291// copied from goombario.c and used, but result is discarded
297 Sub(LVarB, LVarC)
298 Else
299 Sub(LVarC, LVarB)
300 Set(LVarB, LVarC)
301 EndIf
302 Sub(LVarB, 20)
303 DivF(LVarB, Float(10.588))
304 AddF(LVarB, 15)
305 Set(LVarA, LVarB)
306 Return
307 End
308};
309
317 SetF(LVar0, Float(7.2))
318 SetF(LVar1, Float(7.6))
319 SetF(LVar1, Float(3.6))
320 Else
321 Set(LVar0, 18)
322 Set(LVar1, 19)
323 Set(LVar2, 9)
324 EndIf
327 Wait(5)
329 Wait(1)
333 Call(AddGoalPos, ACTOR_SELF, 0, 0, 5)
337 Call(N(UnkFunc62), LVarA, 0)
342 Set(LVarA, LVar0)
345 Thread
346 Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0))
350 EndIf
351 Wait(20)
356 Return
361 Wait(1)
363 Wait(1)
366 Wait(1)
367 Wait(2)
378 IfEq(LVar0, 0)
379 Goto(100)
380 EndIf
381 Set(LVarA, 24)
385 Thread
386 Wait(4)
387 Set(LVar0, 0)
388 Loop(6)
389 Add(LVar0, 30)
391 Wait(1)
392 EndLoop
397 Call(N(UnkFunc62), LVarA, 3)
399 Thread
400 Wait(4)
401 Set(LVar0, 0)
402 Loop(6)
403 Add(LVar0, 30)
405 Wait(1)
406 EndLoop
412 Call(N(UnkFunc62), LVarA, 3)
415 Thread
416 Wait(4)
417 Set(LVar0, 0)
418 Loop(6)
419 Add(LVar0, 30)
421 Wait(1)
422 EndLoop
425 Thread
426 Set(LVar0, 0)
427 Loop(LVarA)
428 Add(LVar0, 133)
430 Wait(1)
431 EndLoop
437 Call(N(UnkFunc62), LVarA, 3)
442 Wait(1)
444 Wait(1)
447 Wait(1)
448 Wait(2)
458 Label(100)
468 Return
469 End
470};
471
472API_CALLABLE(N(CalculateTattleCamBoomLength)) {
473 Actor* actor = get_actor(script->owner1.actorID);
475
476 if (!(targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
477 script->varTable[1] += targetActor->size.y / 2;
478 script->varTable[1] += targetActor->size.y / 4;
479 } else {
480 script->varTable[1] -= targetActor->size.y / 2;
481 script->varTable[1] -= targetActor->size.y / 4;
482 }
483
484 script->varTable[3] = 126 + MAX(targetActor->size.x, targetActor->size.y);
485 return ApiStatus_DONE2;
486}
487
488API_CALLABLE(N(OpenTattleWindow)) {
489 Bytecode* args = script->ptrReadPos;
490
491 evt_set_variable(script, *args++, (s32) fx_tattle_window(0, 106.0f, 144.0f, 0, 1.0f, 0));
492 return ApiStatus_DONE2;
493}
494
495API_CALLABLE(N(HideTattleWindow)) {
496 Bytecode* args = script->ptrReadPos;
498
500 return ApiStatus_DONE2;
501}
502
503API_CALLABLE(N(CloseTattleWindow)) {
504 Bytecode* args = script->ptrReadPos;
506
507 effect->data.tattleWindow->pos.y = 144.0f;
509 return ApiStatus_DONE2;
510}
511
519 Wait(10)
524 Wait(12)
529 Call(SetCamViewport, CAM_TATTLE, 37, 95, 138, 99)
532 Sub(LVar0, 8)
533 Set(LVar1, 0)
535 Wait(1)
538 Wait(2)
541 Wait(10)
544 Wait(12)
546 Wait(32)
552 Return
553 End
554};
555
557 Call(RandInt, 100, LVar0)
558 IfLt(LVar0, 10)
560 Else
562 EndIf
563 Return
564 End
565};
566
BSS s32 PopupMenu_SelectedIndex
s16 targetActorID
Bytecode EvtScript[]
EffectInstanceDataPtr data
Definition effects.h:2605
struct TattleWindowFXData * tattleWindow
Definition effects.h:2572
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
@ BTL_CAM_XADJ_AVG
Definition enums.h:4899
@ ACTOR_SOUND_JUMP
Definition enums.h:2036
@ BS_FLAGS1_TATTLE_OPEN
Definition enums.h:3566
@ 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
@ CAM_UPDATE_NO_INTERP
Definition enums.h:4760
@ 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
@ 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
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ SOUND_GOOMBARIO_HEADBONK
Definition enums.h:993
@ SOUND_TATTLE_WINDOW_OPEN
Definition enums.h:994
@ SOUND_NONE
Definition enums.h:547
@ SOUND_GOOMBARIO_JUMP
Definition enums.h:1322
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_UPSIDE_DOWN
HP bar offset below actor (e.g. Swooper when upside-down).
Definition enums.h:3331
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4904
@ ACTOR_BLUR_ENABLE
Definition enums.h:6413
@ ACTOR_BLUR_DISABLE
Definition enums.h:6412
@ 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
@ CAM_TATTLE
Definition enums.h:1802
@ CAM_BATTLE
Definition enums.h:1801
@ DAMAGE_TYPE_SHOCK
Definition enums.h:2856
@ 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
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
Definition evt.c:1846
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
EvtScript EVS_Enemy_ScareAway
EvtScript EVS_Enemy_Hit
EvtScript EVS_Enemy_Death
EvtScript EVS_Enemy_SpinSmashHit
EvtScript EVS_Enemy_AirLift
EvtScript EVS_Enemy_BlowAway
EvtScript EVS_Enemy_Recover
EvtScript EVS_Enemy_BurnHit
EvtScript EVS_Enemy_NoDamageHit
ApiStatus SetCamEnabled(Evt *script, b32 isInitialCall)
ApiStatus SetCamViewport(Evt *script, b32 isInitialCall)
ApiStatus SetCamLookTarget(Evt *script, b32 isInitialCall)
ApiStatus RandInt(Evt *script, b32 isInitialCall)
ApiStatus ShakeCam(Evt *script, b32 isInitialCall)
ApiStatus SetNoInterpCamParams(Evt *script, b32 isInitialCall)
ApiStatus SetCamNoDraw(Evt *script, b32 isInitialCall)
ApiStatus SetCamPerspective(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 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 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 NPC_DISPOSE_POS_Y
Definition macros.h:164
#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 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 EVT_IGNORE_ARG
Definition macros.h:46
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#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 A(sym)
Definition macros.h:36
#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 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 ACTOR_BY_POS(_name, _pos, _priority, args...)
Definition battle.h:230
FormationRow Formation[]
Definition battle.h:167