Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
UnkAngleFunc005.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "npc.h"
3
4API_CALLABLE(N(UnkAngleFunc005)) {
5 Npc* npc = get_npc_safe(script->owner2.npcID);
6
7 switch (script->functionTemp[1]) {
8 case 0:
9 npc->duration = rand_int(180) + 30;
10 npc->pos.z = -430.0f;
11 npc->pos.y = rand_int(50) + 40.0f;
12 npc->moveSpeed = (2.0f * rand_float()) + 2.0f;
13 if (rand_int(100) < 50) {
14 npc->pos.x = 270.0f;
15 npc->yaw = 270.0f;
16 } else {
17 npc->pos.x = -270.0f;
18 npc->yaw = 90.0f;
19 }
20 script->functionTemp[1] = 1;
21 break;
22 case 1:
23 npc->duration--;
24 if (npc->duration == 0) {
25 script->functionTemp[1] = 2;
26 }
27 break;
28 case 2:
29 npc_move_heading(npc, npc->moveSpeed, npc->yaw);
30 if (npc->pos.x < -280.0f || npc->pos.x > 280.0f) {
31 script->functionTemp[1] = 0;
32 }
33 break;
34 }
35 return ApiStatus_DONE2;
36}
#define rand_int
#define ApiStatus_DONE2
Definition evt.h:118
f32 rand_float(void)
Definition 43F0.c:504
void npc_move_heading(Npc *npc, f32 speed, f32 yaw)
Definition npc.c:986
Npc * get_npc_safe(s32 npcID)
Definition npc.c:1010
Vec3f pos
f32 moveSpeed
s16 duration