papermario/src/code_f2470_len_27f0.c

112 lines
3.1 KiB
C
Raw Normal View History

2020-08-04 08:49:11 +02:00
#include "common.h"
2020-08-16 07:13:03 +02:00
Npc* resolve_npc(ScriptInstance* script, NpcId npcIdOrPtr) {
2020-08-16 06:24:20 +02:00
if (npcIdOrPtr == NpcId_SELF) {
2020-08-15 06:25:36 +02:00
return get_npc_safe(script->ownerID);
2020-08-16 06:24:20 +02:00
} else if (npcIdOrPtr >= -270000000) {
return get_npc_safe(npcIdOrPtr);
2020-08-15 06:25:36 +02:00
} else {
2020-08-16 06:24:20 +02:00
return (Npc*) npcIdOrPtr;
2020-08-15 06:25:36 +02:00
}
}
2020-08-04 08:49:11 +02:00
INCLUDE_ASM("code_f2470_len_27f0", set_npc_animation);
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus DeleteNpc(ScriptInstance* script, s32 isInitialCall) {
2020-08-16 05:23:40 +02:00
Bytecode* ptrReadPos = script->ptrReadPos;
2020-08-16 05:19:00 +02:00
Npc* npcPtr = get_npc_unsafe(get_variable(script, *ptrReadPos++));
2020-08-04 08:49:11 +02:00
2020-08-15 18:57:33 +02:00
if (npcPtr) {
free_npc(npcPtr);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-08-15 18:57:33 +02:00
}
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-08-15 18:57:33 +02:00
}
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus GetNpcPointer(ScriptInstance* script, s32 isInitialCall) {
2020-08-16 05:23:40 +02:00
Bytecode* ptrReadPos = script->ptrReadPos;
2020-08-16 06:24:20 +02:00
NpcId npcID = get_variable(script, *ptrReadPos++);
2020-08-16 05:23:40 +02:00
Bytecode varNPC = *ptrReadPos++;
2020-08-15 19:59:48 +02:00
set_variable(script, varNPC, get_npc_safe(npcID));
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-08-15 19:59:48 +02:00
}
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", SetNpcPos);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", SetNpcRotation);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", SetNpcScale);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", SetNpcCollisionSize);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", SetNpcSpeed);
// TODO: Fix issue with BNEZL vs BNEZ
/*
2020-08-16 08:55:51 +02:00
ApiStatus SetNpcSpeed(ScriptInstance* script, s32 isInitialCall) {
Vytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
f32 speed = get_float_variable(script, *ptrReadPos);
2020-08-16 08:55:51 +02:00
Npc* npcPtr = resolve_npc(script, npcID);
npcPtr->moveSpeed = speed;
if(npcPtr != NULL) {
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
}
}
*/
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", SetNpcJumpscale);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", SetNpcAnimation);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", GetNpcAnimation);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", NpcMoveTo);
2020-08-04 08:49:11 +02:00
INCLUDE_ASM("code_f2470_len_27f0", _npc_jump_to);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", NpcJump0);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", NpcJump1);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", NpcFlyTo);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", GetNpcYaw);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", SetNpcYaw);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", InterpNpcYaw);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", NpcFacePlayer);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", NpcFaceNpc);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", SetNpcFlagBits);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", GetNpcPos);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", EnableNpcShadow);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", EnableNpcBlur);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", ClearPartnerMoveHistory);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", NpcSetHomePosToCurrent);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", GetPartnerPos);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", DisablePartnerAI);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", EnablePartnerAI);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", BringPartnerOut);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", PutPartnerAway);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", GetCurrentPartnerID);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", SetNpcEffect);
2020-08-04 08:49:11 +02:00
INCLUDE_API_ASM("code_f2470_len_27f0", PlaySoundAtNpc);