This commit is contained in:
Ethan Roseman 2020-10-16 23:47:10 -04:00
parent 36f2fc2f86
commit 890fd346e9
13 changed files with 160 additions and 117 deletions

View File

@ -1,15 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel OverrideBattleDmaDest
/* 181ED8 802535F8 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 181EDC 802535FC AFBF0010 */ sw $ra, 0x10($sp)
/* 181EE0 80253600 8C82000C */ lw $v0, 0xc($a0)
/* 181EE4 80253604 0C0B1EAF */ jal get_variable
/* 181EE8 80253608 8C450000 */ lw $a1, ($v0)
/* 181EEC 8025360C 8FBF0010 */ lw $ra, 0x10($sp)
/* 181EF0 80253610 3C018028 */ lui $at, 0x8028
/* 181EF4 80253614 AC224000 */ sw $v0, 0x4000($at)
/* 181EF8 80253618 24020002 */ addiu $v0, $zero, 2
/* 181EFC 8025361C 03E00008 */ jr $ra
/* 181F00 80253620 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,23 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel SetForegroundModelsVisible
/* 1823CC 80253AEC 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 1823D0 80253AF0 AFBF0010 */ sw $ra, 0x10($sp)
/* 1823D4 80253AF4 8C82000C */ lw $v0, 0xc($a0)
/* 1823D8 80253AF8 0C0B1EAF */ jal get_variable
/* 1823DC 80253AFC 8C450000 */ lw $a1, ($v0)
/* 1823E0 80253B00 10400005 */ beqz $v0, .L80253B18
/* 1823E4 80253B04 00000000 */ nop
/* 1823E8 80253B08 0C099F4A */ jal show_foreground_models
/* 1823EC 80253B0C 00000000 */ nop
/* 1823F0 80253B10 08094EC8 */ j .L80253B20
/* 1823F4 80253B14 00000000 */ nop
.L80253B18:
/* 1823F8 80253B18 0C099F2D */ jal hide_foreground_models
/* 1823FC 80253B1C 00000000 */ nop
.L80253B20:
/* 182400 80253B20 8FBF0010 */ lw $ra, 0x10($sp)
/* 182404 80253B24 24020002 */ addiu $v0, $zero, 2
/* 182408 80253B28 03E00008 */ jr $ra
/* 18240C 80253B2C 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,23 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel SetForegroundModelsVisibleUnchecked
/* 182388 80253AA8 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 18238C 80253AAC AFBF0010 */ sw $ra, 0x10($sp)
/* 182390 80253AB0 8C82000C */ lw $v0, 0xc($a0)
/* 182394 80253AB4 0C0B1EAF */ jal get_variable
/* 182398 80253AB8 8C450000 */ lw $a1, ($v0)
/* 18239C 80253ABC 10400005 */ beqz $v0, .L80253AD4
/* 1823A0 80253AC0 00000000 */ nop
/* 1823A4 80253AC4 0C099F12 */ jal show_foreground_models_unsafe
/* 1823A8 80253AC8 00000000 */ nop
/* 1823AC 80253ACC 08094EB7 */ j .L80253ADC
/* 1823B0 80253AD0 00000000 */ nop
.L80253AD4:
/* 1823B4 80253AD4 0C099EF7 */ jal hide_foreground_models_unsafe
/* 1823B8 80253AD8 00000000 */ nop
.L80253ADC:
/* 1823BC 80253ADC 8FBF0010 */ lw $ra, 0x10($sp)
/* 1823C0 80253AE0 24020002 */ addiu $v0, $zero, 2
/* 1823C4 80253AE4 03E00008 */ jr $ra
/* 1823C8 80253AE8 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,18 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel StartRumble
/* 182AF8 80254218 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 182AFC 8025421C AFBF0010 */ sw $ra, 0x10($sp)
/* 182B00 80254220 8C82000C */ lw $v0, 0xc($a0)
/* 182B04 80254224 0C0B1EAF */ jal get_variable
/* 182B08 80254228 8C450000 */ lw $a1, ($v0)
/* 182B0C 8025422C 0C099F7D */ jal start_rumble_type
/* 182B10 80254230 0040202D */ daddu $a0, $v0, $zero
/* 182B14 80254234 8FBF0010 */ lw $ra, 0x10($sp)
/* 182B18 80254238 24020002 */ addiu $v0, $zero, 2
/* 182B1C 8025423C 03E00008 */ jr $ra
/* 182B20 80254240 27BD0018 */ addiu $sp, $sp, 0x18
/* 182B24 80254244 00000000 */ nop
/* 182B28 80254248 00000000 */ nop
/* 182B2C 8025424C 00000000 */ nop

View File

@ -1,29 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_80253B30
/* 182410 80253B30 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 182414 80253B34 AFB00010 */ sw $s0, 0x10($sp)
/* 182418 80253B38 0080802D */ daddu $s0, $a0, $zero
/* 18241C 80253B3C AFBF001C */ sw $ra, 0x1c($sp)
/* 182420 80253B40 AFB20018 */ sw $s2, 0x18($sp)
/* 182424 80253B44 AFB10014 */ sw $s1, 0x14($sp)
/* 182428 80253B48 8E02000C */ lw $v0, 0xc($s0)
/* 18242C 80253B4C 8C510000 */ lw $s1, ($v0)
/* 182430 80253B50 24420004 */ addiu $v0, $v0, 4
/* 182434 80253B54 8C450004 */ lw $a1, 4($v0)
/* 182438 80253B58 0C0B1EAF */ jal get_variable
/* 18243C 80253B5C 8C520000 */ lw $s2, ($v0)
/* 182440 80253B60 0200202D */ daddu $a0, $s0, $zero
/* 182444 80253B64 0220282D */ daddu $a1, $s1, $zero
/* 182448 80253B68 00021200 */ sll $v0, $v0, 8
/* 18244C 80253B6C 344200FE */ ori $v0, $v0, 0xfe
/* 182450 80253B70 0C0B2026 */ jal set_variable
/* 182454 80253B74 02423025 */ or $a2, $s2, $v0
/* 182458 80253B78 8FBF001C */ lw $ra, 0x1c($sp)
/* 18245C 80253B7C 8FB20018 */ lw $s2, 0x18($sp)
/* 182460 80253B80 8FB10014 */ lw $s1, 0x14($sp)
/* 182464 80253B84 8FB00010 */ lw $s0, 0x10($sp)
/* 182468 80253B88 24020002 */ addiu $v0, $zero, 2
/* 18246C 80253B8C 03E00008 */ jr $ra
/* 182470 80253B90 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1263,7 +1263,7 @@ typedef struct Actor {
/* 0x137 */ char unk_137;
/* 0x138 */ struct Vec3f homePos;
/* 0x144 */ struct Vec3f currentPos;
/* 0x150 */ s16 otherPosheadOffset[3];
/* 0x150 */ Vec3s otherPosheadOffset;
/* 0x156 */ s16 healthBarPosition[3];
/* 0x15C */ f32 rotation[3];
/* 0x168 */ s16 rotationPivotOffset[3];

View File

@ -21,6 +21,10 @@ void render_player_model();
f32 integrate_gravity(void);
// Text
PrintContext* load_string(s32 stringID, s32* a1);
void get_screen_coords(Cam camID, f32 x, f32 y, f32 z, f32* outX, f32* outY, f32* outZ);
void parent_collider_to_model(s32 colliderID, s16 modelIndex);
void clone_model(u16 srcModelID, u16 newModelID);
Model* get_model_from_list_index(s32 listIndex);
@ -36,6 +40,7 @@ Trigger* create_trigger(TriggerDefinition* def);
s32 _bound_script_trigger_handler(Trigger* trigger);
Actor* get_actor(s32 actorID);
ActorPart* get_actor_part(Actor* actor, s32 partIndex);
s32 func_800494C0(Npc* npc, s32 arg1, s32 arg2);

View File

@ -22,6 +22,7 @@ extern UNK_FUN_PTR(gCurrentUpdateFunction);
extern s32 gBattleState;
extern BattleStatus gBattleStatus;
extern s32 gBattleDmaDest;
extern ScriptList gWorldScriptList;
extern ScriptList gBattleScriptList;

View File

@ -1,6 +1,106 @@
#include "common.h"
// typedef struct DialogueState {
// /* 0x00 */ PrintContext* printCtx;
// /* 0x04 */ s32 unk_04;
// /* 0x08 */ s32 unk_08;
// /* 0x0C */ s32 talkAnim;
// /* 0x10 */ s32 idleAnim;
// /* 0x14 */ Actor* actor;
// /* 0x18 */ ActorPart* part;
// } DialogueState; // 0x8029FA60 size = unknown
// extern DialogueState gDialogueState;
extern PrintContext* gSpeakingActorPrintCtx;
extern s32 gSpeakingActorPrintIsDone; // unk_08
extern s32 gSpeakingActorTalkAnim;
extern s32 gSpeakingActorIdleAnim;
extern Actor* gSpeakingActor;
extern ActorPart* gSpeakingActorPart;
INCLUDE_ASM(s32, "code_181810", ActorSpeak);
/*ApiStatus ActorSpeak(ScriptInstance *script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
Actor *actor;
ActorPart *part;
s32 stringID;
s32 actorID;
s32 partIndex;
PrintContext *printContext;
f32 speakerMouthY;
s32 anim;
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;
if ((actor->flags & 0x8000) == 0) {
speakerMouthY = actor->otherPosheadOffset.y + actor->currentPos.y + actor->size[1];
} else {
speakerMouthY = actor->otherPosheadOffset.y + actor->currentPos.y + (actor->size[1] / 2);
}
get_screen_coords(Cam_BATTLE, actor->currentPos.x + actor->otherPosheadOffset.x, speakerMouthY, actor->currentPos.z + actor->otherPosheadOffset.z, &screenX, &screenY, &screenZ);
gSpeakingActorPrintIsDone = 0;
gSpeakingActorPrintCtx = load_string(stringID, &gSpeakingActorPrintIsDone);
clamp_printer_coords(gSpeakingActorPrintCtx, screenX, screenY);
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;
if ((actor->flags & 0x8000) == 0) {
speakerMouthY = actor->currentPos.y + actor->otherPosheadOffset.y + actor->size[1];
} else {
speakerMouthY = actor->currentPos.y + actor->otherPosheadOffset.y + (actor->size[1] / 2);
}
get_screen_coords(Cam_BATTLE, actor->currentPos.x + actor->otherPosheadOffset.x, speakerMouthY, actor->currentPos.z + actor->otherPosheadOffset.z, &screenX, &screenY, &screenZ);
clamp_printer_coords(printContext = gSpeakingActorPrintCtx, screenX, screenY);
if (printContext->stateFlags & 0x40) {
decrement_status_menu_disabled();
return ApiStatus_DONE1;
}
if (printContext->stateFlags & 0x80) { // "is talking" flag
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;
}*/
INCLUDE_ASM(s32, "code_181810", EndActorSpeech);
@ -8,7 +108,10 @@ INCLUDE_ASM(s32, "code_181810", ShowBattleChoice);
INCLUDE_ASM(s32, "code_181810", func_802535B4);
INCLUDE_ASM(s32, "code_181810", OverrideBattleDmaDest);
ApiStatus OverrideBattleDmaDest(ScriptInstance* script, s32 isInitialCall) {
gBattleDmaDest = get_variable(script, *script->ptrReadPos);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_181810", LoadBattleDmaData);
@ -26,11 +129,33 @@ INCLUDE_ASM(s32, "code_181810", PlayLoopingSoundAtActor);
INCLUDE_ASM(s32, "code_181810", StopLoopingSoundAtActor);
INCLUDE_ASM(s32, "code_181810", SetForegroundModelsVisibleUnchecked);
ApiStatus SetForegroundModelsVisibleUnsafe(ScriptInstance* script, s32 isInitialCall) {
if (get_variable(script, *script->ptrReadPos)) {
show_foreground_models_unsafe();
} else {
hide_foreground_models_unsafe();
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_181810", SetForegroundModelsVisible);
ApiStatus SetForegroundModelsVisible(ScriptInstance* script, s32 isInitialCall) {
if (get_variable(script, *script->ptrReadPos)) {
show_foreground_models();
} else {
hide_foreground_models();
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_181810", func_80253B30);
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;
}
INCLUDE_ASM(s32, "code_181810", MakeStatusField);
@ -52,4 +177,7 @@ INCLUDE_ASM(s32, "code_181810", MultiplyVec3ByActorScale);
INCLUDE_ASM(s32, "code_181810", ApplyShrinkFromOwner);
INCLUDE_ASM(s32, "code_181810", StartRumble);
ApiStatus StartRumble(ScriptInstance* script, s32 isInitialCall) {
start_rumble_type(get_variable(script, *script->ptrReadPos));
return ApiStatus_DONE2;
}

View File

@ -26,7 +26,8 @@ INCLUDE_ASM(void, "code_8230_len_1ae0", set_cam_viewport, s16 id, s16 x, s16 y,
INCLUDE_ASM(s32, "code_8230_len_1ae0", get_cam_viewport);
INCLUDE_ASM(s32, "code_8230_len_1ae0", get_screen_coords);
INCLUDE_ASM(void, "code_8230_len_1ae0", get_screen_coords, Cam camID, f32 x, f32 y, f32 z, f32* outX, f32* outY,
f32* outZ);
INCLUDE_ASM(s32, "code_8230_len_1ae0", func_8002E754);

View File

@ -107,7 +107,7 @@ INCLUDE_ASM(s32, "code_b72b0_len_15ed0", dma_load_string);
INCLUDE_ASM(s32, "code_b72b0_len_15ed0", load_message_to_buffer);
INCLUDE_ASM(s32, "code_b72b0_len_15ed0", load_string);
INCLUDE_ASM(PrintContext*, "code_b72b0_len_15ed0", load_string, s32 stringId, s32* a1);
INCLUDE_ASM(s32, "code_b72b0_len_15ed0", _load_string);

View File

@ -1782,7 +1782,7 @@ PeachScriptDispatcher;0x80285010
ExecutePlayerAction;0x8028505C
ExecutePeachAction;0x80285174
HandleEvent_Player;0x802852D4
SetForegroundModelsVisibleUnchecked;0x80253AA8
SetForegroundModelsVisibleUnsafe;0x80253AA8
JumpToGoalSimple2;0x80279420
LandJumpPart;0x8027AB5C
_advance_rng;0x80029900
@ -1884,3 +1884,11 @@ gStaticScriptCounter;0x802D9CA0
D_802D9CA4;0x802D9CA4
gGlobalTimeSpace;0x802D9CA8
gBattleState;0x800DC068
gBattleDmaDest;0x80284000
gDialogueState;0x8029FA60
gSpeakingActorPrintCtx;0x8029FA60
gSpeakingActorPrintIsDone;0x8029FA68
gSpeakingActorTalkAnim;0x8029FA6C
gSpeakingActorIdleAnim;0x8029FA70
gSpeakingActor;0x8029FA74
gSpeakingActorPart;0x8029FA7C

View File

@ -56,6 +56,14 @@ D_8010F094 = 0x8010F094;
D_800D9620 = 0x800D9620;
gSpeakingActorPrintCtx = 0x8029FA60;
gSpeakingActorPrintIsDone = 0x8029FA68;
gSpeakingActorTalkAnim = 0x8029FA6C;
gSpeakingActorIdleAnim = 0x8029FA70;
gSpeakingActor = 0x8029FA74;
gSpeakingActorPart = 0x8029FA7C;
gBattleDmaDest = 0x80284000;
gBattleState = 0x800DC068;
gBattleStatus = 0x800DC070;