papermario/src/code_f2470_len_27f0.c

581 lines
16 KiB
C
Raw Normal View History

2020-08-04 08:49:11 +02:00
#include "common.h"
2020-12-27 15:23:36 +01:00
#include "map.h"
2020-08-04 08:49:11 +02:00
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-10-21 01:02:05 +02:00
return get_npc_safe(script->owner2.npcID);
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
2020-12-27 15:23:36 +01:00
void set_npc_animation(Npc* npc, u32 arg1) {
PlayerData* playerData = PLAYER_DATA;
2020-08-04 08:49:11 +02:00
2020-12-27 15:23:36 +01:00
if (arg1 - 0x101 < 9) {
npc->currentAnim = gPartnerAnimations[playerData->currentPartner].anims[arg1 - 0x101];
} else if ((arg1 - 0x201) < 0x10) {
npc->currentAnim = get_enemy(npc->npcID)->animList[arg1 - 0x201];
} else {
npc->currentAnim = arg1;
}
}
INCLUDE_ASM(ApiStatus, "code_f2470_len_27f0", CreateNpc, ScriptInstance* script, s32 isInitialCall);
2020-09-24 05:16:13 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus DeleteNpc(ScriptInstance* script, s32 isInitialCall) {
2020-10-14 18:45:54 +02:00
Bytecode* args = script->ptrReadPos;
Npc* npc = get_npc_unsafe(get_variable(script, *args++));
2020-08-04 08:49:11 +02:00
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-08-15 18:57:33 +02:00
}
2020-10-24 23:51:27 +02:00
free_npc(npc);
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-10-14 18:45:54 +02:00
Bytecode* args = script->ptrReadPos;
NpcId npcID = get_variable(script, *args++);
Bytecode varNPC = *args++;
2020-08-15 19:59:48 +02:00
2020-08-19 02:23:52 +02:00
set_variable(script, varNPC, (s32)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
2020-10-28 07:42:14 +01:00
ApiStatus SetNpcPos(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcID = get_variable(script, *args++);
f32 x = get_variable(script, *args++);
f32 y = get_variable(script, *args++);
f32 z = get_variable(script, *args++);
Npc* npc = resolve_npc(script, npcID);
if (npc == NULL) {
return ApiStatus_DONE2;
}
npc->pos.x = x;
npc->pos.y = y;
npc->pos.z = z;
2020-10-28 20:52:09 +01:00
npc->colliderPos.x = npc->pos.x;
npc->colliderPos.y = npc->pos.y;
npc->colliderPos.z = npc->pos.z;
2020-10-28 07:42:14 +01:00
npc->flags |= 0x10000;
2020-10-28 21:00:45 +01:00
2020-10-28 07:42:14 +01:00
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-10-24 23:51:27 +02:00
ApiStatus SetNpcRotation(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-28 07:42:14 +01:00
NpcId npcID = get_variable(script, *args++);
2020-10-24 23:51:27 +02:00
f32 rotX = get_float_variable(script, *args++);
f32 rotY = get_float_variable(script, *args++);
f32 rotZ = get_float_variable(script, *args++);
Npc* npc = resolve_npc(script, npcID);
if (npc == NULL) {
return ApiStatus_DONE2;
}
npc->rotation.x = rotX;
npc->rotation.y = rotY;
npc->rotation.z = rotZ;
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-10-14 18:45:54 +02:00
ApiStatus func_802CDE68(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
f32 var1 = get_float_variable(script, *args++);
Npc* npc;
npc = resolve_npc(script, npcId);
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
2020-10-14 18:45:54 +02:00
}
2020-10-24 23:51:27 +02:00
npc->unk_50 = var1;
2020-10-14 18:45:54 +02:00
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-08-18 23:12:26 +02:00
ApiStatus SetNpcScale(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
f32 sizeX = get_float_variable(script, *ptrReadPos++);
f32 sizeY = get_float_variable(script, *ptrReadPos++);
f32 sizeZ = get_float_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
2020-08-18 23:12:26 +02:00
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
2020-08-18 23:12:26 +02:00
}
2020-10-24 23:51:27 +02:00
npc->scale.x = sizeX;
npc->scale.y = sizeY;
npc->scale.z = sizeZ;
2020-08-18 23:12:26 +02:00
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
ApiStatus SetNpcCollisionSize(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
s32 height = get_variable(script, *ptrReadPos++);
s32 radius = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
2020-10-24 23:51:27 +02:00
npc->collisionHeight = height;
npc->collisionRadius = radius;
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus SetNpcSpeed(ScriptInstance* script, s32 isInitialCall) {
2020-08-18 21:38:25 +02:00
Bytecode* ptrReadPos = script->ptrReadPos;
2020-08-16 08:55:51 +02:00
NpcId npcID = get_variable(script, *ptrReadPos++);
f32 speed = get_float_variable(script, *ptrReadPos);
Npc* npc = resolve_npc(script, npcID);
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
2020-10-24 23:51:27 +02:00
npc->moveSpeed = speed;
2020-08-18 21:38:25 +02:00
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-08-18 23:12:26 +02:00
ApiStatus SetNpcJumpscale(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
f32 jumpScale = get_float_variable(script, *ptrReadPos);
Npc* npc = resolve_npc(script, npcID);
2020-08-18 23:12:26 +02:00
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
2020-08-18 23:12:26 +02:00
}
2020-10-24 23:51:27 +02:00
npc->jumpScale = jumpScale;
2020-08-18 23:12:26 +02:00
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
ApiStatus SetNpcAnimation(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
s32 animation = get_variable(script, *ptrReadPos);
Npc* npc = resolve_npc(script, npcID);
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
2020-10-24 23:51:27 +02:00
set_npc_animation(npc, animation);
return ApiStatus_DONE2;
}
ApiStatus GetNpcAnimation(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
Bytecode outVar = *ptrReadPos++;
Npc* npc = resolve_npc(script, npcID);
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
2020-10-24 23:51:27 +02:00
set_variable(script, outVar, npc->currentAnim);
return ApiStatus_DONE2;
}
ApiStatus SetNpcAnimationSpeed(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
f32 animationSpeed = get_float_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
2020-08-04 08:49:11 +02:00
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
2020-10-24 23:51:27 +02:00
npc->animationSpeed = animationSpeed;
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-09-26 03:51:54 +02:00
INCLUDE_ASM(s32, "code_f2470_len_27f0", NpcMoveTo, ScriptInstance* script, s32 isInitialCall);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_f2470_len_27f0", _npc_jump_to);
2020-08-04 08:49:11 +02:00
2020-12-27 15:23:36 +01:00
ApiStatus NpcJump0(ScriptInstance* script, s32 isInitialCall) {
return _npc_jump_to(script, isInitialCall, 0);
}
2020-08-04 08:49:11 +02:00
2020-12-27 15:23:36 +01:00
ApiStatus NpcJump1(ScriptInstance* script, s32 isInitialCall) {
return _npc_jump_to(script, isInitialCall, 1);
}
2020-08-04 08:49:11 +02:00
2020-09-26 03:51:54 +02:00
INCLUDE_ASM(s32, "code_f2470_len_27f0", NpcFlyTo, ScriptInstance* script, s32 isInitialCall);
2020-08-04 08:49:11 +02:00
ApiStatus GetNpcYaw(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
Bytecode outVar = *ptrReadPos++;
Npc* npc = resolve_npc(script, npcID);
2020-08-04 08:49:11 +02:00
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
2020-10-24 23:51:27 +02:00
set_variable(script, outVar, clamp_angle(npc->yaw));
return ApiStatus_DONE2;
}
ApiStatus SetNpcYaw(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
2020-08-20 04:51:36 +02:00
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
2020-10-24 23:51:27 +02:00
set_npc_yaw(npc, get_variable(script, *ptrReadPos++));
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-09-26 03:51:54 +02:00
INCLUDE_ASM(s32, "code_f2470_len_27f0", InterpNpcYaw, ScriptInstance* script, s32 isInitialCall);
2020-08-04 08:49:11 +02:00
2020-09-26 03:51:54 +02:00
INCLUDE_ASM(s32, "code_f2470_len_27f0", NpcFacePlayer, ScriptInstance* script, s32 isInitialCall);
2020-08-04 08:49:11 +02:00
2020-09-26 03:51:54 +02:00
INCLUDE_ASM(s32, "code_f2470_len_27f0", NpcFaceNpc, ScriptInstance* script, s32 isInitialCall);
2020-08-04 08:49:11 +02:00
2020-11-08 05:33:15 +01:00
ApiStatus SetNpcFlagBits(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcID = get_variable(script, *args++);
s32 flagBits = *args++;
2020-11-08 23:38:16 +01:00
s32 enable = get_variable(script, *args++);
2020-11-08 05:33:15 +01:00
Npc* npc = resolve_npc(script, npcID);
if (npc == NULL) {
return ApiStatus_DONE2;
}
2020-11-08 23:38:16 +01:00
if (enable) {
2020-11-08 05:33:15 +01:00
npc->flags |= flagBits;
} else {
npc->flags &= ~flagBits;
}
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-10-25 00:14:57 +02:00
ApiStatus GetNpcPos(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcID = get_variable(script, *args++);
s32 a1 = *args++;
s32 a2 = *args++;
s32 a3 = *args++;
Npc* npc = resolve_npc(script, npcID);
if (npc == NULL) {
return ApiStatus_DONE2;
}
set_variable(script, a1, npc->pos.x);
set_variable(script, a2, npc->pos.y);
set_variable(script, a3, npc->pos.z);
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-10-14 18:45:54 +02:00
ApiStatus func_802CF1B4(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
Bytecode arg1 = *args;
2020-10-24 23:51:27 +02:00
Npc* npc = resolve_npc(script, npcId);
2020-09-24 05:16:13 +02:00
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
2020-10-14 18:45:54 +02:00
}
2020-10-24 23:51:27 +02:00
npc->unk_80 = arg1;
2020-10-14 18:45:54 +02:00
return ApiStatus_DONE2;
}
ApiStatus func_802CF208(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
Bytecode arg1 = *args;
2020-10-24 23:51:27 +02:00
Npc* npc = resolve_npc(script, npcId);
2020-10-14 18:45:54 +02:00
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
2020-10-14 18:45:54 +02:00
}
2020-10-24 23:51:27 +02:00
func_8003AC5C(npc, arg1, 0);
2020-10-14 18:45:54 +02:00
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
ApiStatus EnableNpcShadow(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
s32 enableShadow = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
if (enableShadow) {
enable_npc_shadow(npc);
} else {
2020-08-20 04:32:54 +02:00
disable_npc_shadow(npc);
}
return ApiStatus_DONE2;
}
ApiStatus EnableNpcBlur(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
s32 enableBlur = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
2020-08-04 08:49:11 +02:00
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
if (enableBlur) {
enable_npc_blur(npc);
} else {
disable_npc_blur(npc);
}
return ApiStatus_DONE2;
}
ApiStatus ClearPartnerMoveHistory(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
2020-10-24 23:51:27 +02:00
clear_partner_move_history(npc);
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-10-24 23:51:27 +02:00
ApiStatus NpcSetHomePosToCurrent(ScriptInstance* script, s32 isInitialCall) {
Npc* npc = resolve_npc(script, get_variable(script, *script->ptrReadPos));
if (npc == NULL) {
return ApiStatus_DONE2;
}
npc->homePos.x = npc->pos.x;
npc->homePos.y = npc->pos.y;
npc->homePos.z = npc->pos.z;
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
ApiStatus GetPartnerPos(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
Bytecode posX = *ptrReadPos++;
Bytecode posY = *ptrReadPos++;
Bytecode posZ = *ptrReadPos++;
Npc* npc = get_npc_unsafe(-4);
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
2020-10-24 23:51:27 +02:00
set_variable(script, posX, npc->pos.x);
set_variable(script, posY, npc->pos.y);
set_variable(script, posZ, npc->pos.z);
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
ApiStatus DisablePartnerAI(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
2020-08-04 08:49:11 +02:00
if (get_variable(script, *ptrReadPos++) == 0) {
func_800EF314();
} else {
func_800EF300();
}
return ApiStatus_DONE2;
}
ApiStatus EnablePartnerAI(ScriptInstance* script, s32 isInitialCall) {
enable_partner_ai();
return ApiStatus_DONE2;
}
ApiStatus func_802CF54C(ScriptInstance* script, s32 isInitialCall) {
func_800EF43C();
return ApiStatus_DONE2;
}
ApiStatus func_802CF56C(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
2020-08-20 04:51:36 +02:00
s32 value = get_variable(script, *ptrReadPos++);
2020-08-20 04:51:36 +02:00
if (value == 2) {
func_800EF3E4();
} else {
func_800EF3D4(value);
}
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-12-27 15:23:36 +01:00
INCLUDE_ASM(ApiStatus, "code_f2470_len_27f0", BringPartnerOut, ScriptInstance* script, s32 isInitialCall);
2020-09-24 05:16:13 +02:00
2020-12-27 15:23:36 +01:00
INCLUDE_ASM(ApiStatus, "code_f2470_len_27f0", PutPartnerAway, ScriptInstance* script, s32 isInitialCall);
2020-09-24 05:16:13 +02:00
2020-10-14 18:45:54 +02:00
ApiStatus GetCurrentPartnerID(ScriptInstance* script, s32 isInitialCall) {
set_variable(script, *script->ptrReadPos, gPlayerData.currentPartner);
return ApiStatus_DONE2;
}
ApiStatus PartnerCanUseAbility(ScriptInstance* script, s32 isInitialCall) {
Bytecode arg0 = *script->ptrReadPos;
set_variable(script, arg0, partner_can_use_ability());
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-10-14 18:45:54 +02:00
ApiStatus PartnerIsFlying(ScriptInstance* script, s32 isInitialCall) {
Bytecode arg0 = *script->ptrReadPos;
2020-09-24 05:16:13 +02:00
2020-10-14 18:45:54 +02:00
set_variable(script, arg0, is_current_partner_flying());
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-10-28 07:42:14 +01:00
ApiStatus func_802CFD30(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
Bytecode var1 = get_variable(script, *args++);
Bytecode var2 = get_variable(script, *args++);
Bytecode var3 = get_variable(script, *args++);
Bytecode var4 = get_variable(script, *args++);
Bytecode var5 = get_variable(script, *args++);
Npc* npc = resolve_npc(script, npcId);
if (npc == NULL) {
return ApiStatus_DONE2;
}
func_8003D624(npc, var1, var2, var3, var4, var5, npc->unk_A2);
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-10-14 18:45:54 +02:00
ApiStatus func_802CFE2C(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
Bytecode arg1 = *args;
2020-10-24 23:51:27 +02:00
Npc* npc = resolve_npc(script, npcId);
2020-10-14 18:45:54 +02:00
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
2020-10-14 18:45:54 +02:00
}
2020-10-24 23:51:27 +02:00
npc->unk_A2 = arg1;
2020-10-14 18:45:54 +02:00
return ApiStatus_DONE2;
}
ApiStatus func_802CFE80(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
Bytecode var1 = get_variable(script, *args++);
2020-10-24 23:51:27 +02:00
Npc* npc = resolve_npc(script, npcId);
2020-09-24 05:16:13 +02:00
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
2020-10-14 18:45:54 +02:00
}
2020-10-24 23:51:27 +02:00
func_8003B3D0(npc, var1);
2020-10-14 18:45:54 +02:00
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-10-28 07:42:14 +01:00
ApiStatus func_802CFEEC(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
Bytecode var1 = get_variable(script, *args++);
Bytecode var2 = get_variable(script, *args++);
Bytecode var3 = get_variable(script, *args++);
Bytecode var4 = get_variable(script, *args++);
Npc* npc = resolve_npc(script, npcId);
if (npc == NULL) {
return ApiStatus_DONE2;
}
func_8003B44C(npc, var1, var2, var3, var4);
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-10-28 07:42:14 +01:00
ApiStatus func_802CFFC0(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
Bytecode var1 = get_variable(script, *args++);
Bytecode var2 = get_variable(script, *args++);
Bytecode var3 = get_variable(script, *args++);
Bytecode var4 = get_variable(script, *args++);
Bytecode var5 = get_variable(script, *args++);
Bytecode var6 = get_variable(script, *args++);
Bytecode var7 = get_variable(script, *args++);
Bytecode var8 = get_variable(script, *args++);
Npc* npc = resolve_npc(script, npcId);
if (npc == NULL) {
return ApiStatus_DONE2;
}
func_8003B44C(npc, var1, var2, var3, var4);
func_8003B464(npc, var5, var6, var7, var8);
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
ApiStatus SetNpcEffect(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
s32 value1 = get_variable(script, *ptrReadPos++);
s32 value2 = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
2020-10-24 23:51:27 +02:00
func_8003C3D8(npc, value1, value2);
return ApiStatus_DONE2;
}
ApiStatus PlaySoundAtNpc(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
SoundId soundID = get_variable(script, *ptrReadPos++);
s32 value2 = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
}
2020-10-24 23:51:27 +02:00
play_sound_at_position(soundID, value2, npc->pos.x, npc->pos.y, npc->pos.z);
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
ApiStatus func_802D0244(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
u8 renderMode = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
npc->renderMode = renderMode;
return ApiStatus_DONE2;
}