2020-10-15 05:49:49 +02:00
|
|
|
#include "common.h"
|
|
|
|
|
2020-10-17 05:47:10 +02:00
|
|
|
extern PrintContext* gSpeakingActorPrintCtx;
|
|
|
|
extern s32 gSpeakingActorPrintIsDone; // unk_08
|
|
|
|
extern s32 gSpeakingActorTalkAnim;
|
|
|
|
extern s32 gSpeakingActorIdleAnim;
|
|
|
|
extern Actor* gSpeakingActor;
|
|
|
|
extern ActorPart* gSpeakingActorPart;
|
|
|
|
|
2020-10-17 22:19:10 +02:00
|
|
|
#ifdef NON_MATCHING
|
|
|
|
void clamp_printer_coords(PrintContext* printer, f32 x, f32 y);
|
|
|
|
|
|
|
|
// Register allocation issues, otherwise equivalent (?)
|
|
|
|
ApiStatus ActorSpeak(ScriptInstance* script, s32 isInitialCall) {
|
2020-10-17 05:47:10 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-10-17 22:19:10 +02:00
|
|
|
Actor* actor;
|
|
|
|
ActorPart* part;
|
2020-10-17 05:47:10 +02:00
|
|
|
s32 stringID;
|
|
|
|
s32 actorID;
|
|
|
|
s32 partIndex;
|
2020-10-17 22:19:10 +02:00
|
|
|
PrintContext** printContext;
|
2020-10-17 05:47:10 +02:00
|
|
|
s32 anim;
|
|
|
|
|
2020-10-17 22:19:10 +02:00
|
|
|
f32 headX, headY, headZ;
|
2020-10-17 05:47:10 +02:00
|
|
|
f32 screenX, screenY, screenZ;
|
|
|
|
|
|
|
|
if (isInitialCall) {
|
|
|
|
stringID = get_variable(script, *args++);
|
|
|
|
actorID = get_variable(script, *args++);
|
|
|
|
partIndex = get_variable(script, *args++);
|
|
|
|
gSpeakingActorTalkAnim = get_variable(script, *args++);
|
|
|
|
gSpeakingActorIdleAnim = get_variable(script, *args++);
|
|
|
|
|
|
|
|
if (actorID == ActorId_SELF) {
|
|
|
|
actorID = script->ownerActorID;
|
|
|
|
}
|
|
|
|
actor = get_actor(actorID);
|
|
|
|
part = get_actor_part(actor, partIndex);
|
|
|
|
gSpeakingActor = actor;
|
|
|
|
gSpeakingActorPart = part;
|
|
|
|
|
2020-10-17 22:19:10 +02:00
|
|
|
headX = actor->currentPos.x + actor->headOffset.x;
|
2020-10-17 05:47:10 +02:00
|
|
|
if ((actor->flags & 0x8000) == 0) {
|
2020-10-17 22:19:10 +02:00
|
|
|
headY = actor->size.y + (actor->currentPos.y + actor->headOffset.y);
|
2020-10-17 05:47:10 +02:00
|
|
|
} else {
|
2020-10-17 22:19:10 +02:00
|
|
|
headY = actor->headOffset.y + actor->currentPos.y + (actor->size.y / 2);
|
2020-10-17 05:47:10 +02:00
|
|
|
}
|
2020-10-17 22:19:10 +02:00
|
|
|
headZ = actor->headOffset.z + actor->currentPos.z;
|
|
|
|
get_screen_coords(Cam_BATTLE, headX, headY, headZ, &screenX, &screenY, &screenZ);
|
2020-10-17 05:47:10 +02:00
|
|
|
|
2020-10-17 22:19:10 +02:00
|
|
|
{
|
|
|
|
s32* isPrintDone = &gSpeakingActorPrintIsDone;
|
|
|
|
*isPrintDone = FALSE;
|
|
|
|
gSpeakingActorPrintCtx = load_string(stringID, isPrintDone);
|
|
|
|
}
|
2020-10-17 05:47:10 +02:00
|
|
|
clamp_printer_coords(gSpeakingActorPrintCtx, screenX, screenY);
|
2020-10-17 22:19:10 +02:00
|
|
|
|
2020-10-17 05:47:10 +02:00
|
|
|
script->functionTemp[0] = 0;
|
|
|
|
D_8009A650[0] |= 0x10;
|
|
|
|
if (gSpeakingActorTalkAnim >= 0) {
|
|
|
|
func_80263E08(actor, part, gSpeakingActorTalkAnim);
|
|
|
|
}
|
|
|
|
increment_status_menu_disabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (script->functionTemp[0] == 0) {
|
|
|
|
actor = gSpeakingActor;
|
|
|
|
part = gSpeakingActorPart;
|
2020-10-17 22:19:10 +02:00
|
|
|
|
|
|
|
headX = actor->currentPos.x + actor->headOffset.x;
|
2020-10-17 05:47:10 +02:00
|
|
|
if ((actor->flags & 0x8000) == 0) {
|
2020-10-17 22:19:10 +02:00
|
|
|
headY = actor->size.y + (actor->currentPos.y + actor->headOffset.y);
|
2020-10-17 05:47:10 +02:00
|
|
|
} else {
|
2020-10-17 22:19:10 +02:00
|
|
|
headY = actor->headOffset.y + actor->currentPos.y + (actor->size.y / 2);
|
2020-10-17 05:47:10 +02:00
|
|
|
}
|
2020-10-17 22:19:10 +02:00
|
|
|
headZ = actor->headOffset.z + actor->currentPos.z;
|
|
|
|
get_screen_coords(Cam_BATTLE, headX, headY, headZ, &screenX, &screenY, &screenZ);
|
2020-10-17 05:47:10 +02:00
|
|
|
|
2020-10-17 22:19:10 +02:00
|
|
|
printContext = &gSpeakingActorPrintCtx;
|
|
|
|
clamp_printer_coords(*printContext, screenX, screenY);
|
|
|
|
|
|
|
|
if ((*printContext)->stateFlags & 0x40) {
|
2020-10-17 05:47:10 +02:00
|
|
|
decrement_status_menu_disabled();
|
|
|
|
return ApiStatus_DONE1;
|
|
|
|
}
|
|
|
|
|
2020-10-17 22:19:10 +02:00
|
|
|
if ((*printContext)->stateFlags & 0x80) { // "is talking" flag
|
2020-10-17 05:47:10 +02:00
|
|
|
anim = gSpeakingActorTalkAnim;
|
|
|
|
} else {
|
|
|
|
anim = gSpeakingActorIdleAnim;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (anim >= 0) {
|
|
|
|
func_80263E08(actor, part, anim);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gSpeakingActorPrintIsDone == 1) {
|
|
|
|
decrement_status_menu_disabled();
|
|
|
|
D_8009A650[0] &= ~0x10;
|
|
|
|
return ApiStatus_DONE1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ApiStatus_BLOCK;
|
2020-10-17 22:19:10 +02:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
INCLUDE_ASM(s32, "code_181810", ActorSpeak);
|
|
|
|
#endif
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", EndActorSpeech);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", ShowBattleChoice);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", func_802535B4);
|
|
|
|
|
2020-10-17 05:47:10 +02:00
|
|
|
ApiStatus OverrideBattleDmaDest(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
gBattleDmaDest = get_variable(script, *script->ptrReadPos);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", LoadBattleDmaData);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", func_802536A8);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", func_80253734);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", func_802537C0);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", PlaySoundAtActor);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", PlaySoundAtPart);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", PlayLoopingSoundAtActor);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", StopLoopingSoundAtActor);
|
|
|
|
|
2020-10-17 05:47:10 +02:00
|
|
|
ApiStatus SetForegroundModelsVisibleUnsafe(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
if (get_variable(script, *script->ptrReadPos)) {
|
|
|
|
show_foreground_models_unsafe();
|
|
|
|
} else {
|
|
|
|
hide_foreground_models_unsafe();
|
|
|
|
}
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus SetForegroundModelsVisible(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
if (get_variable(script, *script->ptrReadPos)) {
|
|
|
|
show_foreground_models();
|
|
|
|
} else {
|
|
|
|
hide_foreground_models();
|
|
|
|
}
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus func_80253B30(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode a0 = *args++;
|
|
|
|
Bytecode a1 = *args++;
|
|
|
|
s32 var1 = get_variable(script, *args++);
|
|
|
|
|
|
|
|
set_variable(script, a0, (a1 | 0xFE) | (var1 * 256));
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-10-15 05:49:49 +02:00
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", MakeStatusField);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", is_actor_hp_bar_visible);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", is_actortype_hpbar_visible);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", save_tattle_flags);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", load_tattle_flags);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", func_80253FB0);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", MultiplyByActorScale);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", MultiplyVec2ByActorScale);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", MultiplyVec3ByActorScale);
|
|
|
|
|
|
|
|
INCLUDE_ASM(s32, "code_181810", ApplyShrinkFromOwner);
|
|
|
|
|
2020-10-17 05:47:10 +02:00
|
|
|
ApiStatus StartRumble(ScriptInstance* script, s32 isInitialCall) {
|
|
|
|
start_rumble_type(get_variable(script, *script->ptrReadPos));
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|