Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
AwaitPlayerNearNpc.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "npc.h"
3
4API_CALLABLE(N(func_80240814_97BE44)) {
5 Npc* npc = get_npc_safe(script->owner2.npcID);
6
8 npc->pos.y -= (f32) npc->collisionHeight;
9
10 return ApiStatus_DONE2;
11}
12
13API_CALLABLE(N(AwaitPlayerNearNpc)) {
14 PlayerStatus* playerStatus = &gPlayerStatus;
15 Npc* npc = get_npc_safe(script->owner2.npcID);
16
17 if (dist2D(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z) < 50.0f) {
18 return ApiStatus_DONE2;
19 }
20
21 return ApiStatus_BLOCK;
22}
23
24API_CALLABLE(N(func_802408B4_97BEE4)) {
25 EncounterStatus* currentEncounter = &gCurrentEncounter;
26 Enemy* enemy = script->owner1.enemy;
27 Npc* npc = get_npc_safe(script->owner2.npcID);
28
29 if (isInitialCall) {
30 npc->verticalRenderOffset = 0;
31 }
32
33 if (npc->flags & NPC_FLAG_GROUNDED) {
34 currentEncounter->encounterList[enemy->encounterIndex]->battle = enemy->varTable[0];
35 return ApiStatus_DONE2;
36 }
37
38 return ApiStatus_BLOCK;
39}
@ NPC_FLAG_GROUNDED
Definition enums.h:3010
#define ApiStatus_DONE2
Definition evt.h:118
#define ApiStatus_BLOCK
Definition evt.h:116
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:670
s8 encounterIndex
Definition npc.h:296
Encounter * encounterList[24]
Definition npc.h:392
EncounterStatus gCurrentEncounter
Definition encounter.c:176
s16 battle
Definition npc.h:353
Npc * get_npc_safe(s32 npcID)
Definition npc.c:1010
Definition npc.h:294
s32 flags
s16 collisionHeight
s8 verticalRenderOffset
Vec3f pos
PlayerStatus gPlayerStatus
Definition 77480.c:39