Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
ChangeNpcToPartner.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "map.h"
3#include "npc.h"
4
5void func_800EB2A4(s32 arg0);
6
7API_CALLABLE(N(ChangeNpcToPartner)) {
8 Bytecode* args = script->ptrReadPos;
9 PlayerData* playerData = &gPlayerData;
10 s32 npcID = evt_get_variable(script, *args++);
11 s8 partnerID = evt_get_variable(script, *args++);
12 Npc* npc = get_npc_safe(npcID);
13
14 if (isInitialCall) {
16 script->functionTemp[0] = 2;
17 } else {
18 script->functionTemp[0] = 0;
19 }
20 }
21
22 switch (script->functionTemp[0]) {
23 case 0:
25 script->functionTemp[1] = 30;
26 script->functionTemp[0] = 1;
27 break;
28 case 1:
29 script->functionTemp[1]--;
30 if (script->functionTemp[1] == -1) {
31 script->functionTemp[0] = 2;
32 }
33 break;
34 case 2:
35 playerData->curPartner = partnerID;
36 playerData->partners[partnerID].enabled = TRUE;
38 func_800EB2A4(playerData->curPartner);
39 script->functionTemp[0] = 3;
40 break;
41 case 3:
43 npc->flags &= ~NPC_FLAG_INACTIVE;
45 npc->pos.y = NPC_DISPOSE_POS_Y;
46 return ApiStatus_DONE2;
47 }
48
49 return ApiStatus_BLOCK;
50}
void func_800EB2A4(s32 arg0)
Definition partners.c:949
PartnerData partners[12]
@ NPC_PARTNER
Definition enums.h:2528
@ PARTNER_NONE
Definition enums.h:2885
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
#define ApiStatus_BLOCK
Definition evt.h:116
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1690
void partner_clear_player_tracking(Npc *partner)
Definition partners.c:2436
void switch_to_partner(s32 arg0)
Definition partners.c:906
void disable_npc_shadow(Npc *npc)
Definition npc.c:1037
void set_npc_yaw(Npc *npc, f32 yaw)
Definition npc.c:1246
Npc * get_npc_safe(s32 npcID)
Definition npc.c:1010
#define NPC_DISPOSE_POS_Y
Definition macros.h:160
s32 flags
Vec3f pos
PlayerData gPlayerData
Definition 77480.c:40