papermario/src/code_1f580_len_1940.c

518 lines
14 KiB
C
Raw Normal View History

2020-08-04 08:49:11 +02:00
#include "common.h"
#include "map.h"
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
ApiStatus SetEncounterStatusFlags(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
EncounterStatus* currentEncounter = &gCurrentEncounter;
EncounterStatus* currentEncounter2 = &gCurrentEncounter;
s32 a0 = *args++;
if (get_variable(script, *args)) {
currentEncounter->flags |= a0;
} else {
currentEncounter2->flags &= ~a0;
}
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-09-26 04:49:59 +02:00
ApiStatus func_800441F0(ScriptInstance* script, s32 isInitialCall) {
Bytecode arg1 = *script->ptrReadPos;
2020-09-24 05:16:13 +02:00
2020-09-26 04:49:59 +02:00
set_variable(script, arg1, func_80044148());
return ApiStatus_DONE2;
}
ApiStatus func_80044238(ScriptInstance* script, s32 isInitialCall) {
func_80072BCC(get_variable(script, *script->ptrReadPos));
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus LoadDemoBattle(ScriptInstance* script, s32 isInitialCall) {
2020-08-10 07:03:56 +02:00
load_demo_battle(get_variable(script, *script->ptrReadPos));
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-08-10 07:03:56 +02:00
}
2020-08-16 08:55:51 +02:00
ApiStatus func_80044290(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2;
2020-08-10 07:03:56 +02:00
}
2020-08-04 08:49:11 +02:00
2020-09-26 03:51:54 +02:00
INCLUDE_ASM(s32, "code_1f580_len_1940", MakeNpcs, ScriptInstance* script, s32 isInitialCall);
2020-08-04 08:49:11 +02:00
2020-09-26 03:51:54 +02:00
INCLUDE_ASM(s32, "code_1f580_len_1940", RemoveNpc, ScriptInstance* script, s32 isInitialCall);
2020-08-04 08:49:11 +02:00
2020-09-26 03:51:54 +02:00
INCLUDE_ASM(s32, "code_1f580_len_1940", RemoveEncounter, ScriptInstance* script, s32 isInitialCall);
2020-08-04 08:49:11 +02:00
2020-09-26 04:49:59 +02:00
ApiStatus GetBattleOutcome(ScriptInstance* script, s32 isInitialCall) {
set_variable(script, *script->ptrReadPos, gCurrentEncounter.battleOutcome);
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-09-26 04:49:59 +02:00
ApiStatus func_800445A8(ScriptInstance* script, s32 isInitialCall) {
2020-10-21 01:02:05 +02:00
set_variable(script, *script->ptrReadPos, script->owner1.enemy->unk_C4);
2020-09-26 04:49:59 +02:00
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-09-26 04:49:59 +02:00
ApiStatus func_800445D4(ScriptInstance* script, s32 isInitialCall) {
2020-10-21 01:02:05 +02:00
set_variable(script, *script->ptrReadPos, script->owner1.enemy->unk_C8);
2020-09-26 04:49:59 +02:00
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-09-26 03:51:54 +02:00
ApiStatus GetOwnerEncounterTrigger(ScriptInstance* script, s32 isInitialCall) {
2020-10-21 01:02:05 +02:00
set_variable(script, *script->ptrReadPos, script->owner1.enemy->encountered);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-08-10 07:03:56 +02:00
}
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
ApiStatus DoNpcDefeat(ScriptInstance* script, s32 isInitialCall) {
2020-10-21 01:02:05 +02:00
Enemy* owner = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
Npc* temp_s1 = get_npc_unsafe(owner->npcID);
ScriptInstance* newScript;
kill_script(script);
temp_s1->currentAnim = owner->animList[6];
newScript = start_script(&SCRIPT_NpcDefeat, 10, 0);
owner->defeatScript = newScript;
2020-10-20 08:40:15 +02:00
owner->defeatScriptID = newScript->id;
2020-10-21 01:02:05 +02:00
newScript->owner1.enemy = owner;
newScript->owner2.npcID = owner->npcID;
2020-10-08 21:03:58 +02:00
newScript->groupFlags = owner->scriptGroup;
return ApiStatus_FINISH;
}
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_1f580_len_1940", start_battle);
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus StartBattle(ScriptInstance* script, s32 isInitialCall) {
2020-08-10 07:03:56 +02:00
start_battle(script, -1);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE1;
2020-08-10 07:03:56 +02:00
}
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus StartBattleWith(ScriptInstance* script, s32 isInitialCall) {
2020-08-10 07:03:56 +02:00
start_battle(script, get_variable(script, *script->ptrReadPos));
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE1;
2020-08-10 07:03:56 +02:00
}
2020-08-04 08:49:11 +02:00
2020-09-26 03:51:54 +02:00
INCLUDE_ASM(s32, "code_1f580_len_1940", StartBossBattle, ScriptInstance* script, s32 isInitialCall);
2020-08-04 08:49:11 +02:00
2020-09-07 23:12:31 +02:00
ApiStatus SetBattleMusic(ScriptInstance* script, s32 isInitialCall) {
Bytecode songID = get_variable(script, *script->ptrReadPos);
EncounterStatus* currentEncounter = &gCurrentEncounter;
currentEncounter->allowFleeing = 1;
currentEncounter->songID = songID;
currentEncounter->unk_18 = -1;
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-09-26 03:51:54 +02:00
INCLUDE_ASM(s32, "code_1f580_len_1940", BindNpcAI, ScriptInstance* script, s32 isInitialCall);
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
ApiStatus BindNpcIdle(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* owner = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
NpcId npcID = get_variable(script, *args++);
Bytecode* aiBytecode = (Bytecode*)get_variable(script, *args);
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
if (npcID == NpcId_SELF) {
npcID = owner->npcID;
}
2020-08-04 08:49:11 +02:00
2020-10-10 19:24:53 +02:00
owner = get_enemy(npcID);
owner->aiBytecode = aiBytecode;
2020-10-08 21:03:58 +02:00
return ApiStatus_DONE2;
}
ApiStatus RestartNpcAI(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* npc = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
NpcId npcId = get_variable(script, *args++);
ScriptInstance* newScript;
s32 groupFlags;
if (npcId == NpcId_SELF) {
2020-10-10 19:24:53 +02:00
npcId = npc->npcID;
2020-10-08 21:03:58 +02:00
}
2020-10-10 19:24:53 +02:00
npc = get_enemy(npcId);
2020-10-08 21:03:58 +02:00
2020-10-10 19:24:53 +02:00
if (npc->flags & 1) {
2020-10-08 21:03:58 +02:00
groupFlags = 10;
} else {
groupFlags = 11;
}
2020-10-10 19:24:53 +02:00
if (npc->aiScript != NULL) {
kill_script_by_ID(npc->aiScriptID);
2020-10-08 21:03:58 +02:00
}
2020-10-10 19:24:53 +02:00
npc->unk_C8 = 100;
newScript = start_script(npc->aiBytecode, 10, 0);
npc->aiScript = newScript;
2020-10-20 08:40:15 +02:00
npc->aiScriptID = newScript->id;
2020-10-21 01:02:05 +02:00
newScript->owner1.enemy = npc;
newScript->owner2.npc = script->owner2.npc;
2020-10-08 21:03:58 +02:00
newScript->groupFlags = groupFlags;
return ApiStatus_DONE2;
}
ApiStatus EnableNpcAI(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* npc = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
NpcId npcId = get_variable(script, *args++);
s32 var2 = get_variable(script, *args);
if (npcId == NpcId_SELF) {
2020-10-10 19:24:53 +02:00
npcId = npc->npcID;
2020-10-08 21:03:58 +02:00
}
2020-10-10 19:24:53 +02:00
npc = get_enemy(npcId);
2020-10-08 21:03:58 +02:00
if (var2 != 0) {
2020-10-10 19:24:53 +02:00
if (npc->aiScript != NULL) {
resume_all_script(npc->aiScriptID);
2020-10-08 21:03:58 +02:00
}
2020-10-10 19:24:53 +02:00
} else if (npc->aiScript != NULL) {
suspend_all_script(npc->aiScriptID);
2020-10-08 21:03:58 +02:00
}
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-09-26 03:51:54 +02:00
INCLUDE_ASM(s32, "code_1f580_len_1940", SetNpcAux, ScriptInstance* script, s32 isInitialCall);
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
ApiStatus BindNpcAux(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* npc = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
NpcId npcId = get_variable(script, *args++);
Bytecode* auxBytecode = (Bytecode*)get_variable(script, *args);
if (npcId == NpcId_SELF) {
2020-10-10 19:24:53 +02:00
npcId = npc->npcID;
2020-10-08 21:03:58 +02:00
}
2020-10-10 19:24:53 +02:00
npc = get_enemy(npcId);
npc->auxBytecode = auxBytecode;
2020-10-08 21:03:58 +02:00
return ApiStatus_DONE2;
}
ApiStatus RestartNpcAux(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* npc = script->owner1.enemy;
NpcId npcID = get_variable(script, *args++);
2020-10-08 21:03:58 +02:00
ScriptInstance* newScript;
s32 groupFlags;
2020-10-21 01:02:05 +02:00
if (npcID == NpcId_SELF) {
npcID = npc->npcID;
2020-10-08 21:03:58 +02:00
}
2020-10-21 01:02:05 +02:00
npc = get_enemy(npcID);
2020-10-08 21:03:58 +02:00
2020-10-10 05:09:28 +02:00
if (npc->flags & 1) {
2020-10-08 21:03:58 +02:00
groupFlags = 10;
} else {
groupFlags = 11;
}
2020-10-10 05:09:28 +02:00
if (npc->auxScript != NULL) {
kill_script_by_ID(npc->auxScriptID);
2020-10-08 21:03:58 +02:00
}
2020-10-10 05:09:28 +02:00
newScript = start_script(npc->auxBytecode, 10, 0);
npc->auxScript = newScript;
2020-10-20 08:40:15 +02:00
npc->auxScriptID = newScript->id;
2020-10-21 01:02:05 +02:00
newScript->owner1.enemy = npc;
newScript->owner2.npcID = npcID;
2020-10-08 21:03:58 +02:00
newScript->groupFlags = groupFlags;
return ApiStatus_DONE2;
}
ApiStatus EnableNpcAux(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* npc = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
NpcId npcId = get_variable(script, *args++);
s32 var2 = get_variable(script, *args);
if (npcId == NpcId_SELF) {
2020-10-10 05:09:28 +02:00
npcId = npc->npcID;
2020-10-08 21:03:58 +02:00
}
2020-10-10 05:09:28 +02:00
npc = get_enemy(npcId);
2020-10-10 19:24:53 +02:00
2020-10-08 21:03:58 +02:00
if (var2 != 0) {
2020-10-10 05:09:28 +02:00
if (npc->auxScript != NULL) {
resume_all_script(npc->auxScriptID);
2020-10-08 21:03:58 +02:00
}
2020-10-10 05:09:28 +02:00
} else if (npc->auxScript != NULL) {
suspend_all_script(npc->auxScriptID);
2020-10-08 21:03:58 +02:00
}
return ApiStatus_DONE2;
}
ApiStatus BindNpcInteract(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* npc = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
NpcId npcId = get_variable(script, *args++);
Bytecode* interactBytecode = (Bytecode*)get_variable(script, *args);
if (npcId == NpcId_SELF) {
npcId = npc->npcID;
}
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
npc = get_enemy(npcId);
2020-10-10 19:24:53 +02:00
2020-10-08 21:03:58 +02:00
if (npc->interactScript != NULL) {
kill_script_by_ID(npc->interactScriptID);
}
npc->interactBytecode = interactBytecode;
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
ApiStatus BindNpcHit(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* npc = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
NpcId npcId = get_variable(script, *args++);
Bytecode* hitBytecode = (Bytecode*)get_variable(script, *args);
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
if (npcId == NpcId_SELF) {
npcId = npc->npcID;
}
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
npc = get_enemy(npcId);
2020-10-10 19:24:53 +02:00
2020-10-08 21:03:58 +02:00
if (npc->hitScript != NULL) {
kill_script_by_ID(npc->hitScriptID);
}
npc->hitBytecode = hitBytecode;
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
ApiStatus BindNpcDefeat(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* npc = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
s32 npcId = get_variable(script, *args++);
Bytecode* defeatBytecode = (Bytecode*)get_variable(script, *args);
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
if (npcId == -1) {
2020-10-10 19:24:53 +02:00
npcId = npc->npcID;
2020-10-08 21:03:58 +02:00
}
2020-10-10 19:24:53 +02:00
npc = get_enemy(npcId);
npc->defeatBytecode = defeatBytecode;
2020-10-08 21:03:58 +02:00
return ApiStatus_DONE2;
}
ApiStatus SetSelfVar(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* owner = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
s32 var1 = get_variable(script, *args++);
s32 var2 = get_variable(script, *args);
owner->varTable[var1] = var2;
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
ApiStatus GetSelfVar(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-08-04 08:49:11 +02:00
2020-10-21 01:02:05 +02:00
set_variable(script, *args, script->owner1.enemy->varTable[get_variable(script, *args++)]);
2020-10-08 21:03:58 +02:00
return ApiStatus_DONE2;
}
ApiStatus SetNpcVar(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* npc = script->owner1.enemy;
2020-10-10 19:24:53 +02:00
NpcId npcId = get_variable(script, *args++);
2020-10-08 21:03:58 +02:00
s32 varIdx = get_variable(script, *args++);
s32 val = get_variable(script, *args);
2020-10-10 19:24:53 +02:00
if (npcId == NpcId_SELF) {
npcId = npc->npcID;
2020-10-08 21:03:58 +02:00
}
2020-10-10 19:24:53 +02:00
npc = get_enemy(npcId);
npc->varTable[varIdx] = val;
2020-10-08 21:03:58 +02:00
return ApiStatus_DONE2;
}
ApiStatus GetNpcVar(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-10 19:24:53 +02:00
Enemy* npc;
2020-10-08 21:03:58 +02:00
NpcId npcID;
s32 varIdx;
s32 var3;
2020-10-21 01:02:05 +02:00
npc = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
npcID = get_variable(script, *args++);
varIdx = get_variable(script, *args++);
var3 = *args;
if (npcID == NpcId_SELF) {
2020-10-10 19:24:53 +02:00
npcID = npc->npcID;
2020-10-08 21:03:58 +02:00
}
2020-10-10 19:24:53 +02:00
npc = get_enemy(npcID);
set_variable(script, var3, npc->varTable[varIdx]);
2020-10-08 21:03:58 +02:00
return ApiStatus_DONE2;
}
ApiStatus SetSelfRotation(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Npc* self = get_npc_unsafe(script->owner2.npcID);
2020-10-08 21:03:58 +02:00
s32 rotX = get_variable(script, *args++);
s32 rotY = get_variable(script, *args++);
s32 rotZ = get_variable(script, *args++);
self->rotation.x = rotX;
self->rotation.y = rotY;
self->rotation.z = rotZ;
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus SetSelfEnemyFlags(ScriptInstance* script, s32 isInitialCall) {
2020-10-21 01:02:05 +02:00
script->owner1.enemy->flags = *script->ptrReadPos;
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-08-10 07:03:56 +02:00
}
2020-08-04 08:49:11 +02:00
2020-09-28 01:57:02 +02:00
ApiStatus SetSelfEnemyFlagBits(ScriptInstance* script, s32 isInitialCall) {
2020-10-08 21:03:58 +02:00
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* owner = script->owner1.enemy;
2020-10-10 05:09:28 +02:00
s32 bits = *args++;
2020-09-28 01:57:02 +02:00
2020-10-10 05:09:28 +02:00
if (get_variable(script, *args)) {
2020-09-28 01:57:02 +02:00
owner->flags |= bits;
} else {
owner->flags &= ~bits;
}
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
ApiStatus func_80045580(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* owner = script->owner1.enemy;
Npc* npc = get_npc_unsafe(script->owner2.npcID);
2020-10-08 21:03:58 +02:00
owner->unk_07 = get_variable(script, *args);
owner->unk_10.x = npc->pos.x;
owner->unk_10.y = npc->pos.y;
owner->unk_10.z = npc->pos.z;
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-08-16 08:55:51 +02:00
ApiStatus GetSelfNpcID(ScriptInstance* script, s32 isInitialCall) {
2020-10-21 01:02:05 +02:00
set_variable(script, *script->ptrReadPos, script->owner1.enemy->npcID);
2020-08-16 08:55:51 +02:00
return ApiStatus_DONE2;
2020-08-10 07:03:56 +02:00
}
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
ApiStatus ClearDefeatedEnemies(ScriptInstance* script, s32 isInitialCall) {
EncounterStatus* currentEncounter = &gCurrentEncounter;
s32 i;
s32 j;
for (i = 0; i < 60; i++) {
for (j = 0; j < 12; j++) {
currentEncounter->defeatFlags[i][j] = 0;
}
}
return ApiStatus_DONE2;
}
ApiStatus SetEnemyFlagBits(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* npc = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
NpcId npcId = get_variable(script, *args++);
s32 bits = *args++;
s32 var2 = get_variable(script, *args);
if (npcId == NpcId_SELF) {
2020-10-10 05:09:28 +02:00
npcId = npc->npcID;
2020-10-08 21:03:58 +02:00
}
2020-10-10 05:09:28 +02:00
npc = get_enemy(npcId);
2020-10-10 19:24:53 +02:00
2020-10-08 21:03:58 +02:00
if (var2 != NULL) {
2020-10-10 05:09:28 +02:00
npc->flags |= bits;
2020-10-08 21:03:58 +02:00
} else {
2020-10-10 05:09:28 +02:00
npc->flags &= ~bits;
2020-10-08 21:03:58 +02:00
}
2020-08-04 08:49:11 +02:00
2020-10-08 21:03:58 +02:00
return ApiStatus_DONE2;
}
2020-08-04 08:49:11 +02:00
2020-09-26 04:49:59 +02:00
ApiStatus func_8004572C(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-10-08 21:03:58 +02:00
ApiStatus GetSelfAnimationFromTable(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
2020-10-21 01:02:05 +02:00
Enemy* owner = script->owner1.enemy;
2020-10-08 21:03:58 +02:00
set_variable(script, *args, owner->animList[get_variable(script, *args++)]);
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-09-26 04:49:59 +02:00
ApiStatus func_80045798(ScriptInstance* script, s32 isInitialCall) {
D_8010EF08 = get_variable(script, *script->ptrReadPos);
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-09-26 04:49:59 +02:00
ApiStatus func_800457C4(ScriptInstance* script, s32 isInitialCall) {
2020-10-21 01:02:05 +02:00
Enemy* ownerActor = script->owner1.enemy;
2020-09-24 05:16:13 +02:00
2020-09-26 04:49:59 +02:00
ownerActor->unk_B5 = get_variable(script, *script->ptrReadPos);
2020-10-08 21:03:58 +02:00
return ApiStatus_DONE2;
2020-09-26 04:49:59 +02:00
}
2020-09-24 05:16:13 +02:00
2020-09-26 04:49:59 +02:00
ApiStatus func_800457F8(ScriptInstance* script, s32 isInitialCall) {
gCurrentEncounter.unk_12 = 1;
return ApiStatus_DONE2;
}
ApiStatus func_8004580C(ScriptInstance* script, s32 isInitialCall) {
set_variable(script, *script->ptrReadPos, gCurrentEncounter.hitTier);
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-10-08 21:03:58 +02:00
ApiStatus func_80045838(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 var1 = get_variable(script, *args++);
s32 var2 = get_variable(script, *args++);
s32 var3 = get_variable(script, *args);
2020-10-24 23:51:27 +02:00
Npc* npc = resolve_npc(script, var1);
2020-10-08 21:03:58 +02:00
2020-10-24 23:51:27 +02:00
if (npc == NULL) {
return ApiStatus_DONE2;
2020-10-08 21:03:58 +02:00
}
2020-10-24 23:51:27 +02:00
func_800494C0(npc, var2, var3);
2020-10-08 21:03:58 +02:00
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-09-26 04:49:59 +02:00
ApiStatus func_800458CC(ScriptInstance* script, s32 isInitialCall) {
2020-10-21 01:02:05 +02:00
set_variable(script, *script->ptrReadPos, script->owner1.enemy->npcSettings->unk_2A & 8);
2020-09-26 04:49:59 +02:00
return ApiStatus_DONE2;
}
2020-09-24 05:16:13 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_1f580_len_1940", func_80045900);
2020-09-24 05:16:13 +02:00
2020-10-08 21:03:58 +02:00
ApiStatus SetTattleString(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId enemyId = get_variable(script, *args++);
u32 tattleString = get_variable(script, *args);
2020-10-10 19:24:53 +02:00
Enemy* npc = get_enemy(enemyId);
2020-10-08 21:03:58 +02:00
2020-10-10 19:24:53 +02:00
npc->tattleString = tattleString;
2020-10-08 21:03:58 +02:00
return ApiStatus_DONE2;
}