Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
sleepy_sheep.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
3#include "entity.h"
4#include "ld_addrs.h"
5#include "effects.h"
6#include "sprite/player.h"
7#include "include_asset.h"
8
9#define NAMESPACE battle_item_sleepy_sheep
10
12
17
18extern s32 D_802A3E88_7214D8[];
20extern f32 D_802A3F00_721550[];
21
22BSS s32 D_802A3F54; // unused?
24BSS s32 D_802A3F80[2]; // unused?
26
27API_CALLABLE(N(func_802A123C_71E88C)) {
30 f32 x, y, z;
31 s32 cond;
32 s32 i;
33
34 if (isInitialCall) {
35 script->functionTemp[0] = 0;
36 }
37
38 switch (script->functionTemp[0]) {
39 case 0:
40 posPtr->x = -200.0f;
41 posPtr->z = 10.0f;
42 for (i = 0; i < ARRAY_COUNT(D_802A3F58); i++) {
44 x = D_802A3E88_7214D8[i * 3] + posPtr->x;
45 y = D_802A3E88_7214D8[i * 3 + 1];
46 z = D_802A3E88_7214D8[i * 3 + 2] + posPtr->z;
49 }
50 script->functionTemp[1] = (gGameStatusPtr->frameCounter % 10) & 0xFFFF;
51 script->functionTemp[0] = 1;
52 break;
53 case 1:
54 posPtr->x += 6.0f;
55 cond = false;
56 if (!((gGameStatusPtr->frameCounter % 3) & 0xFFFF)) {
57 script->functionTemp[1] = (script->functionTemp[1] + 1) % 10;
58 }
59
60 for (i = 0; i < ARRAY_COUNT(D_802A3F58); i++) {
62 x = D_802A3E88_7214D8[i * 3] + posPtr->x;
63 y = D_802A3E88_7214D8[i * 3 + 1];
64 z = D_802A3E88_7214D8[i * 3 + 2] + posPtr->z;
66 if (!cond && script->functionTemp[1] == i && !((gGameStatusPtr->frameCounter % 5) & 0xFFFF)) {
67 if (x > 0.0f) {
68 y = x;
69 if (x > 100.0f) {
70 y = x - 50.0f;
71 }
72 y = rand_int(y);
73 }
74
75 if (x > 40.0f) {
76 x = -(x - 40.0f);
77 }
78 fx_landing_dust(3, x, y, z, 0.0f);
79 cond = true;
80 }
81 }
83 s32 randIdx = rand_int(9);
84
85 x = D_802A3E88_7214D8[randIdx * 3] + posPtr->x;
86 y = D_802A3E88_7214D8[randIdx * 3 + 1];
87 z = D_802A3E88_7214D8[randIdx * 3 + 2] + posPtr->z;
88
89 fx_landing_dust(2, x, y, z, 0.0f);
90 }
91 if (posPtr->x >= 320.0f) {
92 script->functionTemp[0] = 2;
93 }
94 break;
95 case 2:
96 for (i = 0; i < ARRAY_COUNT(D_802A3F58); i++) {
98 }
99 return ApiStatus_DONE2;
100 }
101 return ApiStatus_BLOCK;
102}
103
104API_CALLABLE(N(func_802A1740_71ED90)) {
106 Actor* player = battleStatus->playerActor;
107 s32 i;
108
109 if (isInitialCall) {
110 script->functionTemp[0] = 0;
111 script->functionTemp[1] = 90;
112 }
113
114 for (i = 0; i < player->targetListLength; i++) {
115 s8 targetIdx = player->targetIndexList[i];
117 Actor* targetActor = get_actor(target->actorID);
119
120 if (targetActor->transparentStatus == 0 && !(targetPart->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY)) {
121 targetActor->yaw += 33.0f;
123 }
124 }
125
126 if (script->functionTemp[1] != 0) {
127 script->functionTemp[1]--;
128 return ApiStatus_BLOCK;
129 }
130
131 return ApiStatus_DONE2;
132}
133
134API_CALLABLE(N(func_802A1848_71EE98)) {
136 Actor* player = battleStatus->playerActor;
137 s32 i;
138 s32 cond;
139
140 if (isInitialCall) {
141 script->functionTemp[0] = 0;
142 }
143
144 cond = false;
145
146 for (i = 0; i < player->targetListLength; i++) {
147 s8 targetIdx = player->targetIndexList[i];
149 Actor* targetActor = get_actor(target->actorID);
150
151 if (targetActor != nullptr) {
153 if ((targetActor->transparentStatus == 0) && !(targetPart->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY)) {
154 if (targetActor->yaw < 360.0f) {
155 targetActor->yaw += 33.0f;
156 if (targetActor->yaw >= 360.0f) {
157 targetActor->yaw = 360.0f;
158 }
159 cond = true;
160 }
161 }
162 }
163 }
164
165 if (!cond) {
166 return ApiStatus_DONE2;
167 }
168 return ApiStatus_BLOCK;
169}
170
172
173
174#include "battle/move/item/sleepy_sheep1.png.h"
175INCLUDE_IMG("battle/move/item/sleepy_sheep1.png", battle_item_sleepy_sheep1_png);
176INCLUDE_PAL("battle/move/item/sleepy_sheep1.pal", battle_item_sleepy_sheep1_pal);
177
178#include "battle/move/item/sleepy_sheep2.png.h"
179INCLUDE_IMG("battle/move/item/sleepy_sheep2.png", battle_item_sleepy_sheep2_png);
180INCLUDE_PAL("battle/move/item/sleepy_sheep2.pal", battle_item_sleepy_sheep2_pal);
181
182#include "battle/move/item/sleepy_sheep3.png.h"
183INCLUDE_IMG("battle/move/item/sleepy_sheep3.png", battle_item_sleepy_sheep3_png);
184INCLUDE_PAL("battle/move/item/sleepy_sheep3.pal", battle_item_sleepy_sheep3_pal);
185
186Vtx N(model)[] = {
187 { .v = {{ -28, 0, 0 }, false, { 0, 1536 }, { 0, 0, 0, 255 }}},
188 { .v = {{ 27, 0, 0 }, false, { 1792, 1536 }, { 0, 0, 0, 255 }}},
189 { .v = {{ 27, 47, 0 }, false, { 1792, 0 }, { 0, 0, 0, 255 }}},
190 { .v = {{ -28, 47, 0 }, false, { 0, 0 }, { 0, 0, 0, 255 }}},
191};
192
193Gfx N(frame1_displayList)[] = {
194 gsDPPipeSync(),
195 gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
208 gsSPVertex(N(model), ARRAY_COUNT(N(model)), 0),
209 gsSP1Triangle(0, 1, 2, 0),
210 gsSP1Triangle(0, 2, 3, 0),
211 gsDPPipeSync(),
213};
214
215Gfx N(frame2_displayList)[] = {
216 gsDPPipeSync(),
217 gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
230 gsSPVertex(N(model), ARRAY_COUNT(N(model)), 0),
231 gsSP1Triangle(0, 1, 2, 0),
232 gsSP1Triangle(0, 2, 3, 0),
233 gsDPPipeSync(),
235};
236
237Gfx N(frame3_displayList)[] = {
238 gsDPPipeSync(),
239 gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
252 gsSPVertex(N(model), ARRAY_COUNT(N(model)), 0),
253 gsSP1Triangle(0, 1, 2, 0),
254 gsSP1Triangle(0, 2, 3, 0),
255 gsDPPipeSync(),
257};
258
266 ems_End
267};
268
276 ems_End
277};
278
286 ems_End
287};
288
293 Call(SetBattleCamTarget, -67, -15, -5)
297 Thread
299 Loop(7)
301 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.5))
302 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.5))
303 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.5))
304 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.2))
305 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.5))
306 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(2.0))
307 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.5))
308 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.0))
309 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.5))
310 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.25))
311 Wait(2)
312 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.5))
313 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.5))
314 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.5))
315 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.2))
316 EndLoop
318 Wait(20)
321 Add(LVar1, 32)
323 Wait(30)
325 Wait(1)
327 Wait(1)
329 Wait(1)
331 Wait(1)
333 Wait(1)
335 Thread
339 Thread
340 Wait(40)
346 Wait(8)
351 Call(PlayerHopToGoal, 15, 0, 0)
352 Thread
353 Wait(5)
355 Wait(1)
357 Wait(1)
359 Wait(1)
361 Wait(1)
363 Wait(1)
366 Wait(40)
368 Set(LVar7, -200)
369 Set(LVar8, 0)
370 Set(LVar9, 0)
372 Call(SetVirtualEntityScale, LVarA, Float(0.711), Float(0.711), Float(0.711))
378 Sub(LVar0, 60)
383 Thread
385 Call(SetActorScale, ACTOR_PLAYER, Float(1.2), Float(0.9), Float(1.0))
386 Wait(1)
387 Call(SetActorScale, ACTOR_PLAYER, Float(1.3), Float(0.8), Float(1.0))
388 Wait(3)
389 Call(SetActorScale, ACTOR_PLAYER, Float(1.2), Float(0.9), Float(1.0))
390 Wait(1)
391 Call(SetActorScale, ACTOR_PLAYER, Float(1.0), Float(1.0), Float(1.0))
394 Wait(2)
397 Add(LVar0, 60)
401 Add(LVar0, 20)
404 Add(LVar0, 10)
407 Wait(5)
408 Thread
410 Add(LVar0, 270)
414 Wait(30)
418 Label(0)
422 Goto(1)
423 EndIf
427 Label(1)
428 Wait(5)
431 Goto(0)
432 EndIf
433 Wait(30)
435 Return
436 End
437};
438
440 0, 0, 0,
441 -30, 0, -50,
442 -27, 0, 30,
443 -70, 0, -5,
444 -105, 0, 30,
445 -110, 0, -50,
446 -145, 0, -5,
447 -170, 0, -50,
448 -190, 0, -30,
449 -210, 0, -10,
450};
451
452f32 D_802A3F00_721550[] = { 1.0f, 1.0f, 0.75f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.75f, 0.75f };
453
BSS s32 PopupMenu_SelectedIndex
struct SelectableTarget targetData[24]
s8 targetIndexList[24]
Bytecode EvtScript[]
s8 targetListLength
#define rand_int
#define clamp_angle
s32 EntityModelScript[]
Definition entity.h:7
#define ems_Restart
Definition entity.h:49
#define ems_SetRenderMode(mode)
Definition entity.h:51
#define ems_End
Definition entity.h:47
#define ems_Draw(dlist, holdTime)
Definition entity.h:48
@ EMOTE_QUESTION
Definition enums.h:497
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3608
@ ITER_NO_MORE
Definition enums.h:2063
@ ITER_NEXT
Definition enums.h:2058
@ ACTOR_EVENT_FLAG_ILLUSORY
Player attacks pass through and miss.
Definition enums.h:3408
@ HIT_RESULT_MISS
Definition enums.h:1982
@ BTL_CAM_DEFAULT
Definition enums.h:4409
@ BTL_CAM_REPOSITION
Definition enums.h:4426
@ BTL_CAM_VIEW_ENEMIES
Definition enums.h:4410
@ EMOTER_POS
Definition enums.h:506
@ STATUS_FLAG_SLEEP
Definition enums.h:2846
@ SOUND_HIT_BLOCK
Definition enums.h:771
@ SOUND_SHEEP_STAMPEDE
Definition enums.h:1175
@ RENDER_MODE_ALPHATEST
Definition enums.h:3310
@ BTL_RUMBLE_HIT_MIN
Definition enums.h:3853
@ ACTOR_PLAYER
Definition enums.h:2118
@ ACTOR_SELF
Definition enums.h:2117
@ CAM_BATTLE
Definition enums.h:1827
@ DAMAGE_TYPE_STATUS_ALWAYS_HITS
Definition enums.h:2914
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2912
#define ApiStatus_DONE2
Definition evt.h:119
#define ApiStatus_BLOCK
Definition evt.h:117
ActorPart * get_actor_part(Actor *actor, s32 partID)
Definition 190B20.c:923
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
#define INCLUDE_PAL(FILENAME, SYMBOLNAME)
#define INCLUDE_IMG(FILENAME, SYMBOLNAME)
ApiStatus CreateVirtualEntity(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityMoveSpeed(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityPosition(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityJumpGravity(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityScale(Evt *script, b32 isInitialCall)
ApiStatus ShakeCam(Evt *script, b32 isInitialCall)
ApiStatus ShowEmote(Evt *script, b32 isInitialCall)
ApiStatus DeleteVirtualEntity(Evt *script, b32 isInitialCall)
ApiStatus GetItemPower(Evt *script, b32 isInitialCall)
ApiStatus VirtualEntityJumpTo(Evt *script, b32 isInitialCall)
ApiStatus VirtualEntityMoveTo(Evt *script, b32 isInitialCall)
#define Ref(sym)
Address/pointer constant.
Definition macros.h:61
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:366
#define Sub(VAR, INT_VALUE)
Definition macros.h:378
#define IfNe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR != RVAR.
Definition macros.h:273
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:214
#define Add(VAR, INT_VALUE)
Definition macros.h:377
#define EndLoop
Marks the end of a loop.
Definition macros.h:249
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:233
#define BSS
Definition macros.h:6
#define ARRAY_COUNT(arr)
Definition macros.h:39
#define Float(DOUBLE)
Definition macros.h:52
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:228
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:299
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:476
#define LVar7
Definition macros.h:156
#define Thread
Marks the start of a thread block.
Definition macros.h:545
#define EndThread
Marks the end of a thread block.
Definition macros.h:548
#define LVar8
Definition macros.h:157
#define LVar2
Definition macros.h:151
#define LVar1
Definition macros.h:150
#define LVarA
Definition macros.h:159
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:255
#define LVar9
Definition macros.h:158
#define PlayEffect(args...)
Definition macros.h:811
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:270
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:577
#define Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:246
#define LVar0
Definition macros.h:149
#define SetConst(VAR, CONST)
Sets the given variable to a given value, skipping the evt_get_variable call.
Definition macros.h:371
#define Return
Kills the current EVT thread.
Definition macros.h:218
BSS Vec3f D_802A3F88
BSS s32 D_802A3F54
BSS s32 D_802A3F80[2]
BSS s32 D_802A3F58[10]
EntityModelScript * D_802A3F28_721578[10]
void virtual_entity_set_pos(s32, s32, s32, s32)
s32 virtual_entity_create(EntityModelScript *)
f32 D_802A3F00_721550[]
void virtual_entity_delete_by_index(s32)
void virtual_entity_set_scale(s32, f32, f32, f32)
s32 D_802A3E88_7214D8[]
GameStatus * gGameStatusPtr
Definition main_loop.c:31
BattleStatus gBattleStatus
Definition battle.cpp:14