From e43d5a7f53ca71667e4e8c6bd4f5ec58a3f4f088 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 28 Nov 2019 21:06:49 +1000 Subject: [PATCH] Decompile aiPlaySound and fix dprint --- src/game/chr/chraicommands.c | 42 ++++++++-------------------- src/include/game/chr/chraicommands.h | 2 +- src/include/game/game_066310.h | 2 +- src/include/game/game_11ecf0.h | 2 +- src/setup/setup_000000.c | 2 +- 5 files changed, 15 insertions(+), 35 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index d2fceeb6f..90965f595 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -6482,37 +6482,17 @@ glabel ai00cd /** * @cmd 00ce */ -GLOBAL_ASM( -glabel ai00ce -/* f0561f8: 3c03800a */ lui $v1,%hi(g_Vars) -/* f0561fc: 24639fc0 */ addiu $v1,$v1,%lo(g_Vars) -/* f056200: 8c6e0434 */ lw $t6,0x434($v1) -/* f056204: 8c6f0438 */ lw $t7,0x438($v1) -/* f056208: 27bdffe0 */ addiu $sp,$sp,-32 -/* f05620c: afbf001c */ sw $ra,0x1c($sp) -/* f056210: 01cf1021 */ addu $v0,$t6,$t7 -/* f056214: 90580002 */ lbu $t8,0x2($v0) -/* f056218: 90480003 */ lbu $t0,0x3($v0) -/* f05621c: 80440004 */ lb $a0,0x4($v0) -/* f056220: 0018ca00 */ sll $t9,$t8,0x8 -/* f056224: 03282825 */ or $a1,$t9,$t0 -/* f056228: 00054c00 */ sll $t1,$a1,0x10 -/* f05622c: 00092c03 */ sra $a1,$t1,0x10 -/* f056230: afa00014 */ sw $zero,0x14($sp) -/* f056234: afa00010 */ sw $zero,0x10($sp) -/* f056238: 00003025 */ or $a2,$zero,$zero -/* f05623c: 0fc25010 */ jal audioPlayFromWorldPosition -/* f056240: 00003825 */ or $a3,$zero,$zero -/* f056244: 3c03800a */ lui $v1,%hi(g_Vars) -/* f056248: 24639fc0 */ addiu $v1,$v1,%lo(g_Vars) -/* f05624c: 8c6b0438 */ lw $t3,0x438($v1) -/* f056250: 8fbf001c */ lw $ra,0x1c($sp) -/* f056254: 27bd0020 */ addiu $sp,$sp,0x20 -/* f056258: 256c0005 */ addiu $t4,$t3,0x5 -/* f05625c: ac6c0438 */ sw $t4,0x438($v1) -/* f056260: 03e00008 */ jr $ra -/* f056264: 00001025 */ or $v0,$zero,$zero -); +bool aiPlaySound(void) +{ + u8 *cmd = g_Vars.ailist + g_Vars.aioffset; + s16 audio_id = cmd[3] | (cmd[2] << 8); + + audioPlayFromWorldPosition(cmd[4], audio_id, 0, NULL, 0, 0); + + g_Vars.aioffset += 5; + + return false; +} /** * @cmd 017c diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index ddd1ad372..f5d3fd8a6 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -208,7 +208,7 @@ /*0x00cb*/ bool aiMessage(void); /*0x00cc*/ bool aiShowText2(void); /*0x00cd*/ bool ai00cd(void); -/*0x00ce*/ bool ai00ce(void); +/*0x00ce*/ bool aiPlaySound(void); /*0x00cf*/ bool ai00cf(void); /*0x00d0*/ bool ai00d0(void); /*0x00d1*/ bool ai00d1(void); diff --git a/src/include/game/game_066310.h b/src/include/game/game_066310.h index a8cb520a5..9ea73860f 100644 --- a/src/include/game/game_066310.h +++ b/src/include/game/game_066310.h @@ -6,7 +6,7 @@ void alarmActivate(void); void alarmDeactivate(void); bool alarmIsActive(void); -bool audioPlayFromWorldPosition(u8 channel_id, u16 audio_id, u8 volumemaybe, struct position *pos); +bool audioPlayFromWorldPosition(s8 channel_id, s16 audio_id, u8 volumemaybe, struct position *pos, s32 arg4, s32 arg5); float countdownTimerGetValue(void); bool countdownTimerIsHidden(void); bool countdownTimerIsRunning(void); diff --git a/src/include/game/game_11ecf0.h b/src/include/game/game_11ecf0.h index 036b5300e..26bfb4e30 100644 --- a/src/include/game/game_11ecf0.h +++ b/src/include/game/game_11ecf0.h @@ -4,7 +4,7 @@ #include "types.h" u32 calculatePlayerIndex(u32 playernum); -u32 dprint(char *); +u32 dprint(); u32 func0f11ecf0(void); bool func0f11ed70(void); bool func0f11ed78(void); diff --git a/src/setup/setup_000000.c b/src/setup/setup_000000.c index e7bb448aa..dd1940490 100644 --- a/src/setup/setup_000000.c +++ b/src/setup/setup_000000.c @@ -14338,7 +14338,7 @@ bool (*g_CommandPointers[])(void) = { /*0x00cb*/ aiMessage, /*0x00cc*/ aiShowText2, /*0x00cd*/ ai00cd, - /*0x00ce*/ ai00ce, + /*0x00ce*/ aiPlaySound, /*0x00cf*/ ai00cf, /*0x00d0*/ ai00d0, /*0x00d1*/ ai00d1,