Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
peach_focus.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
3#include "message_ids.h"
4#include "sprite/player.h"
5
6#define NAMESPACE battle_move_peach_focus
7
9
10enum N(ActorVars) {
11 AVAR_Twink_PowerLevel = 0,
12 AVAR_Twink_DefensePtr = 1,
13};
14
15API_CALLABLE(N(IncreaseTwinkDefense)) {
16 // a pointer to Twink's DefenseTable is stored in his actorVar1 in twink.c
17 // it has now been copied to this script var, where we can retrieve it
18 s32* twinkDefenseTable = script->varTablePtr[0];
19
20 // increment the value of the first key in the defense table
21 twinkDefenseTable[1]++;
22 return ApiStatus_DONE2;
23}
24
25EvtScript N(EVS_UsePower) = {
26 Call(UseBattleCamPreset, BTL_CAM_PLAYER_WISH)
27 Wait(10)
28 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Peach1_Run)
29 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
30 Add(LVar0, 16)
31 Call(SetActorSpeed, ACTOR_PLAYER, Float(4.0))
32 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
33 Call(PlayerRunToGoal, 0)
34 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Peach2_Startle)
35 Call(SetActorYaw, ACTOR_PLAYER, 30)
36 Wait(1)
37 Call(SetActorYaw, ACTOR_PLAYER, 60)
38 Wait(1)
39 Call(SetActorYaw, ACTOR_PLAYER, 90)
40 Wait(1)
41 Call(SetActorYaw, ACTOR_PLAYER, 120)
42 Wait(1)
43 Call(SetActorYaw, ACTOR_PLAYER, 150)
44 Wait(1)
45 Call(SetActorYaw, ACTOR_PLAYER, 180)
46 Call(UseBattleCamPreset, BTL_CAM_REPOSITION)
47 Call(SetBattleCamTarget, -105, -7, 0)
48 Call(SetBattleCamDist, 213)
49 Call(MoveBattleCamOver, 60)
50 Wait(10)
51 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Peach3_Pray)
53 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
54 Add(LVar1, 20)
55 Call(N(SpawnStarSparkleFX), LVar0, LVar1, LVar2)
57 Call(GetActorVar, ACTOR_PARTNER, AVAR_Twink_PowerLevel, LVar0)
58 IfEq(LVar0, 0)
59 Call(ActorSpeak, MSG_CH8_0096, ACTOR_PLAYER, 0, ANIM_Peach3_Pray, ANIM_Peach3_Pray)
60 EndIf
61 Wait(20)
62 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Peach1_Idle)
63 Wait(10)
65 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
66 Call(N(SpawnWishSparkleFX), LVar0, LVar1, LVar2)
67 Wait(30)
69 Call(GetActorVar, ACTOR_PARTNER, AVAR_Twink_PowerLevel, LVar0)
70 Add(LVar0, 1)
71 Call(SetActorVar, ACTOR_PARTNER, AVAR_Twink_PowerLevel, LVar0)
72 Call(ModifyActorDecoration, ACTOR_PARTNER, 1, 0, LVar0, 0, 0, 0)
73 Call(GetActorVar, ACTOR_PARTNER, AVAR_Twink_DefensePtr, LVar0)
74 Call(N(IncreaseTwinkDefense))
75 Wait(10)
76 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
77 Call(SetActorYaw, ACTOR_SELF, 150)
78 Wait(1)
79 Call(SetActorYaw, ACTOR_SELF, 120)
80 Wait(1)
81 Call(SetActorYaw, ACTOR_SELF, 90)
82 Wait(1)
83 Call(SetActorYaw, ACTOR_SELF, 60)
84 Wait(1)
85 Call(SetActorYaw, ACTOR_SELF, 30)
86 Wait(1)
87 Call(SetActorYaw, ACTOR_SELF, 0)
88 Wait(1)
89 Call(PlayerYieldTurn)
91 Wait(15)
92 Call(SetGoalToHome, ACTOR_PLAYER)
93 Call(SetActorSpeed, ACTOR_PLAYER, Float(8.0))
94 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Peach1_Run)
95 Call(PlayerRunToGoal, 0)
96 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Peach1_Walk)
97 Return
98 End
99};
Bytecode EvtScript[]
@ BTL_CAM_DEFAULT
Definition enums.h:4824
@ BTL_CAM_REPOSITION
Definition enums.h:4841
@ BTL_CAM_PLAYER_WISH
Definition enums.h:4891
@ SOUND_BEGIN_WISH
Definition enums.h:963
@ SOUND_WISH_ASCENDING
Definition enums.h:1382
@ SOUND_STAR_POWER_RECOVERY
Definition enums.h:1384
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_PARTNER
Definition enums.h:2086
@ ACTOR_SELF
Definition enums.h:2084
#define ApiStatus_DONE2
Definition evt.h:118
ApiStatus PlaySound(Evt *script, b32 isInitialCall)
ApiStatus FadeBackgroundLighten(Evt *script, b32 isInitialCall)
ApiStatus FadeBackgroundDarken(Evt *script, b32 isInitialCall)
#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 Float(DOUBLE)
Definition macros.h:51
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#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 LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217