2020-08-04 08:49:11 +02:00
|
|
|
#include "common.h"
|
|
|
|
|
2020-08-16 06:24:20 +02:00
|
|
|
Npc* resolve_npc(Script* script, NpcId npcIdOrPtr) {
|
|
|
|
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-16 05:19:00 +02:00
|
|
|
s32 DeleteNpc(Script* script, s32 initialCall) {
|
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);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
return 2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 05:19:00 +02:00
|
|
|
s32 GetNpcPointer(Script* script, s32 initialCall) {
|
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
|
|
|
|
2020-08-15 22:11:31 +02:00
|
|
|
set_variable(script, varNPC, get_npc_safe(npcID));
|
2020-08-15 19:59:48 +02:00
|
|
|
return 2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, SetNpcPos);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, SetNpcRotation);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, SetNpcScale);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, SetNpcCollisionSize);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, SetNpcSpeed);
|
2020-08-15 22:11:31 +02:00
|
|
|
// TODO: Fix issue with BNEZL vs BNEZ
|
|
|
|
/*
|
|
|
|
s32 SetNpcSpeed(script_context* script, s32 initialCall) {
|
|
|
|
bytecode* ptrReadPos = script->ptrReadPos;
|
|
|
|
bytecode npcID = get_variable(script, *ptrReadPos++);
|
|
|
|
f32 speed = get_float_variable(script, *ptrReadPos);
|
|
|
|
npc* npcPtr = resolve_npc(script, npcID);
|
|
|
|
|
|
|
|
npcPtr->moveSpeed = speed;
|
|
|
|
if(npcPtr != NULL) {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
2020-08-04 08:49:11 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, SetNpcJumpscale);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, SetNpcAnimation);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, GetNpcAnimation);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, NpcMoveTo);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, _npc_jump_to);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, NpcJump0);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, NpcJump1);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, NpcFlyTo);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, GetNpcYaw);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, SetNpcYaw);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, InterpNpcYaw);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, NpcFacePlayer);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, NpcFaceNpc);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, SetNpcFlagBits);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, GetNpcPos);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, EnableNpcShadow);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, EnableNpcBlur);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, ClearPartnerMoveHistory);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, NpcSetHomePosToCurrent);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, GetPartnerPos);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, DisablePartnerAI);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, EnablePartnerAI);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, BringPartnerOut);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, PutPartnerAway);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, GetCurrentPartnerID);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, SetNpcEffect);
|
|
|
|
|
|
|
|
INCLUDE_ASM(code_f2470_len_27f0, PlaySoundAtNpc);
|