This commit is contained in:
RevoSucks
2023-10-31 20:25:29 -04:00
23 changed files with 562 additions and 88 deletions
+26
View File
@@ -29,6 +29,32 @@ typedef struct {
/* 0x14 */ u16 distance[5]; // Distance value
} OSVoiceData; // size = 0x20
#define VOICE_STATUS_READY 0 /* stop/end */
#define VOICE_STATUS_START 1 /* Voice Undetected (no voice input) */
#define VOICE_STATUS_CANCEL 3 /* Cancel (cancel extraneous noise) */
#define VOICE_STATUS_BUSY 5 /* Detected/Detecting (voice being input, recognition processing under way) */
#define VOICE_STATUS_END 7 /* End recognition processing (enable execution of Get Recognition Results command) */
#define VOICE_WARN_TOO_SMALL 0x400 /* Voice level is too low (100 < Voice Level < 150) */
#define VOICE_WARN_TOO_LARGE 0x800 /* Voice level is too high (Voice Level > 3500) */
#define VOICE_WARN_NOT_FIT 0x4000 /* No words match recognition word (No. 1 Candidate Distance Value > 1600) */
#define VOICE_WARN_TOO_NOISY 0x8000 /* Too much ambient noise (Relative Voice Level =< 400) */
typedef struct {
/* 0x000 */ u16 words[20][15]; // 20 words, each with up to 15 syllables
/* 0x258 */ u8 numWords;
} OSVoiceDictionary; // size = 0x25C
typedef struct {
/* 0x00 */ OSVoiceDictionary* dict;
/* 0x04 */ s8 mode;
/* 0x08 */ OSVoiceData* data;
/* 0x0C */ u16 distance;
/* 0x0E */ u16 answerNum;
/* 0x10 */ u16 warning;
/* 0x12 */ u16 voiceLevel;
/* 0x14 */ u16 voiceRelLevel;
} OSVoiceUnk; // size = 0x18
s32 osVoiceInit(OSMesgQueue* mq, OSVoiceHandle* hd, int channel);
s32 osVoiceSetWord(OSVoiceHandle* hd, u8* word);
-19
View File
@@ -1194,25 +1194,6 @@ u8 func_801A3950(u8 seqPlayerIndex, u8 resetChannelIO);
u8 func_801A39F8(void);
s32 func_801A46F8(void);
void func_801A4EB0(void);
// void func_801A4EB8(void);
void func_801A4FD8(void);
void func_801A5080(u16 arg0);
u16 func_801A5100(void);
void func_801A5118(void);
UNK_TYPE func_801A51F0(UNK_TYPE arg0);
// void func_801A5228(void);
// void func_801A5390(void);
// void func_801A53E8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5);
// void func_801A541C(void);
// void func_801A5488(void);
// void func_801A54C4(void);
// void func_801A54D0(void);
// void func_801A5680(void);
// void func_801A5808(void);
void AudioVoice_ResetData(void);
// void func_801A5A1C(void);
void AudioSfx_MuteBanks(u16 muteMask);
void AudioSfx_LowerBgmVolume(u8 channelIndex);
void AudioSfx_RestoreBgmVolume(u8 channelIndex);
+3 -3
View File
@@ -305,9 +305,9 @@ extern UNK_PTR D_801D8B24;
// extern UNK_TYPE2 D_801D8BD0;
// extern UNK_TYPE4 D_801D8BD4;
// extern UNK_TYPE1 D_801D8BE0;
// extern UNK_TYPE1 D_801D8E3C;
// extern u8 D_801D8E3C;
// extern UNK_TYPE4 D_801D8E40;
// extern UNK_TYPE2 D_801D8E44;
// extern u16 sTopScoreWordId;
// extern UNK_TYPE1 D_801D8E48;
// extern UNK_TYPE1 D_801D8E50;
// extern UNK_TYPE1 D_801D8F70;
@@ -1723,7 +1723,7 @@ extern s32 D_801FD120;
// extern UNK_TYPE1 D_801FD5C4;
// extern UNK_TYPE1 D_801FD5C8;
// extern UNK_TYPE1 D_801FD5E8;
// extern UNK_TYPE1 D_801FD608;
extern u8 sVoiceMaskPattern[];
// extern UNK_TYPE1 D_801FD610;
extern ActiveSfx gActiveSfx[7][3];
extern SeqRequest sSeqRequests[][5];
+2 -3
View File
@@ -1369,11 +1369,10 @@ typedef enum {
#define WEEKEVENTREG_86_20 PACK_WEEKEVENTREG_FLAG(86, 0x20)
#define WEEKEVENTREG_86_40 PACK_WEEKEVENTREG_FLAG(86, 0x40)
#define WEEKEVENTREG_86_80 PACK_WEEKEVENTREG_FLAG(86, 0x80)
#define WEEKEVENTREG_87_01 PACK_WEEKEVENTREG_FLAG(87, 0x01)
// Currently talking to a cow using the voice recognition unit
#define WEEKEVENTREG_TALKING_TO_COW_WITH_VOICE PACK_WEEKEVENTREG_FLAG(87, 0x01)
// Set by Anju
#define WEEKEVENTREG_COUPLES_MASK_CUTSCENE_STARTED PACK_WEEKEVENTREG_FLAG(87, 0x02)
#define WEEKEVENTREG_87_04 PACK_WEEKEVENTREG_FLAG(87, 0x04)
#define WEEKEVENTREG_87_08 PACK_WEEKEVENTREG_FLAG(87, 0x08)
#define WEEKEVENTREG_87_10 PACK_WEEKEVENTREG_FLAG(87, 0x10)
+34
View File
@@ -0,0 +1,34 @@
#ifndef Z64VOICE_H
#define Z64VOICE_H
#include "PR/ultratypes.h"
#include "unk.h"
#include "PR/os_voice.h"
typedef enum {
/* 0 */ VOICE_WORD_ID_HOURS,
/* 1 */ VOICE_WORD_ID_CHEESE,
/* 2 */ VOICE_WORD_ID_WAKE_UP,
/* 3 */ VOICE_WORD_ID_SIT,
/* 4 */ VOICE_WORD_ID_MILK,
/* 5 */ VOICE_WORD_ID_HIYA,
/* 6 */ VOICE_WORD_ID_MAX,
/* -1 */ VOICE_WORD_ID_NONE = 0xFFFF
} OSVoiceWordId;
void func_801A4EB0(void);
void func_801A4FD8(void);
void func_801A5080(u16 wordId);
u16 AudioVoice_GetWord(void);
void func_801A5118(void);
s32 func_801A51F0(s32 errorCode);
s32 func_801A5228(OSVoiceDictionary* dict);
OSVoiceData* func_801A5390(void);
void func_801A53E8(u16 distance, u16 answerNum, u16 warning, u16 voiceLevel, u16 voiceRelLevel);
u8* func_801A54C4(void);
s32 func_801A54D0(u16 wordId);
s32 func_801A5680(u16 wordId);
s32 func_801A5808(void);
void AudioVoice_ResetData(void);
#endif
-3
View File
@@ -591,10 +591,7 @@ beginseg
include "build/asm/code/code_8019AEC0.text.o" // handwritten
include "build/src/audio/code_8019AF00.o"
include "build/src/audio/voice_external.o"
include "build/data/code/voice_external.data.o"
include "build/src/audio/voice_internal.o"
include "build/data/code/voice_internal.data.o"
include "build/data/code/voice_internal.bss.o"
pad_text
include "build/src/audio/sfx_params.o"
include "build/src/audio/sfx.o"
+133 -8
View File
@@ -1,17 +1,142 @@
#include "global.h"
#include "z64voice.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A4EB0.s")
extern OSVoiceHandle gVoiceHandle;
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A4EB8.s")
OSVoiceDictionary D_801D8BE0 = {
{
// "アトナンジカン" - "atonanjikan" - "How many hours"
{ 0x8341, 0x8367, 0x8369, 0x8393, 0x8357, 0x834A, 0x8393 },
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A4FD8.s")
// "ハイチーズ" - "haichīzu" - "say cheese"
{ 0x836E, 0x8343, 0x8360, 0x815B, 0x8359 },
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A5080.s")
// "オキロー" - "okirō" - "wake up"
{ 0x8349, 0x834C, 0x838D, 0x815B },
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A50C0.s")
// "オスワリ" - "osuwari" - "sit"
{ 0x8349, 0x8358, 0x838F, 0x838A },
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A5100.s")
// "ミルク" - "miruku" - "milk"
{ 0x837E, 0x838B, 0x834E },
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A510C.s")
// "ハイヤー" - "haiyā" - "hiya!"
{ 0x836E, 0x8343, 0x8384, 0x815B },
},
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A5118.s")
VOICE_WORD_ID_MAX, // number of words
};
u8 D_801D8E3C = 0;
OSVoiceData* D_801D8E40 = NULL;
u16 sTopScoreWordId = VOICE_WORD_ID_NONE;
u8 D_801D8E48 = 0;
void func_801A4EB0(void) {
}
void func_801A4EB8(void) {
u8* new_var;
OSMesgQueue* serialEventQueue;
s32 index;
u8 sp38[1];
u8 i;
if (D_801D8E3C != 0) {
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
osVoiceStopReadData(&gVoiceHandle);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
}
new_var = func_801A54C4();
for (i = 0; i < 1; i++) {
sp38[i] = new_var[i];
}
if (func_801A5228(&D_801D8BE0) == 0) {
for (i = 0; i < VOICE_WORD_ID_MAX; i++) {
index = i / 8;
if (((sp38[index] >> (i % 8)) & 1) == 1) {
func_801A54D0(i);
}
}
func_801A53E8(800, 2, VOICE_WARN_TOO_SMALL, 500, 2000);
D_801D8E3C = 1;
}
}
// Used externally in code_8019AF00
void func_801A4FD8(void) {
s32 errorCode;
OSMesgQueue* serialEventQueue;
func_801A54D0(VOICE_WORD_ID_NONE);
if (D_801D8E3C != 0) {
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
osVoiceStopReadData(&gVoiceHandle);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
errorCode = func_801A5228(&D_801D8BE0);
func_801A54D0(VOICE_WORD_ID_NONE);
if (errorCode == 0) {
func_801A53E8(800, 2, VOICE_WARN_TOO_SMALL, 500, 2000);
D_801D8E3C = 1;
}
func_801A5080(VOICE_WORD_ID_HIYA);
func_801A5080(VOICE_WORD_ID_CHEESE);
}
}
void func_801A5080(u16 wordId) {
if ((D_801D8E3C != 0) && (wordId < VOICE_WORD_ID_MAX)) {
func_801A5680(wordId);
}
}
// Unused
void func_801A50C0(u16 wordId) {
if ((D_801D8E3C != 0) && (wordId < VOICE_WORD_ID_MAX)) {
func_801A54D0(wordId);
}
}
// Used externally in many files
u16 AudioVoice_GetWord(void) {
return sTopScoreWordId;
}
// Unused
u8 func_801A510C(void) {
return D_801D8E3C;
}
// Used externally in Audio_Update (code_8019AF00)
void func_801A5118(void) {
if (D_801D8E3C & 2) {
D_801D8E3C &= 1;
func_801A4EB8();
}
if (D_801D8E3C != 0) {
if (func_801A5808() != 0) {
D_801D8E48++;
if (D_801D8E48 == 10) {
D_801D8E3C = 0;
sTopScoreWordId = VOICE_WORD_ID_NONE;
return;
}
} else {
D_801D8E48 = 0;
}
D_801D8E40 = func_801A5390();
if (D_801D8E40 != 0) {
sTopScoreWordId = D_801D8E40->answer[0];
} else {
sTopScoreWordId = VOICE_WORD_ID_NONE;
}
}
}
+329 -22
View File
@@ -1,42 +1,349 @@
#include "global.h"
#include "z64voice.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/D_801E0EC0.s")
// internal voice functions
u8* func_801A5A1C(s8* words);
UNK_TYPE func_801A51F0(UNK_TYPE arg0) {
switch (arg0) {
case 1:
case 4:
case 5:
case 11:
case 13:
case 14:
case 15:
// BSS
OSVoiceUnk D_801FD5A0;
OSVoiceHandle gVoiceHandle;
OSVoiceData D_801FD5C8; // Intermediate Voice Data during processsing?
OSVoiceData D_801FD5E8; // Best Match Voice Data?
u8 sVoiceMaskPattern[8];
char D_801FD610[256];
// Data
s8 D_801D8E50[96][3] = {
"aa", "AA", "ii", "II", "uu", "UU", "ee", "EE", "oo", "OO", "KA", "GA", "KI", "GI", "KU", "GU",
"KE", "GE", "KO", "GO", "SA", "ZA", "SI", "ZI", "SU", "ZU", "SE", "ZE", "SO", "ZO", "TA", "DA",
"TI", "DI", "tu", "TU", "DU", "TE", "DE", "TO", "DO", "NA", "NI", "NU", "NE", "NO", "HA", "BA",
"PA", "HI", "BI", "PI", "HU", "BU", "PU", "HE", "BE", "PE", "HO", "BO", "PO", "MA", "MI", "MU",
"ME", "MO", "ya", "YA", "yu", "YU", "yo", "YO", "RA", "RI", "RU", "RE", "RO", "wa", "WA", "WI",
"WE", "WO", "NN", "VU", "ka", "ke", "", "", "", "", "", "", "", "", "", "",
};
s8 D_801D8F70[96][3] = {
"aa", "AA", "ii", "II", "uu", "UU", "ee", "EE", "oo", "OO", "KA", "GA", "KI", "GI", "KU", "GU",
"KE", "GE", "KO", "GO", "SA", "ZA", "SI", "ZI", "SU", "ZU", "SE", "ZE", "SO", "ZO", "TA", "DA",
"TI", "DI", "tu", "TU", "DU", "TE", "DE", "TO", "DO", "NA", "NI", "NU", "NE", "NO", "HA", "BA",
"PA", "HI", "BI", "PI", "HU", "BU", "PU", "HE", "BE", "PE", "HO", "BO", "PO", "MA", "MI", " ",
"MU", "ME", "MO", "ya", "YA", "yu", "YU", "yo", "YO", "RA", "RI", "RU", "RE", "RO", "wa", "WA",
"WI", "WE", "WO", "NN", "VU", "ka", "ke", "", "", "", "", "", "", "", "", "",
};
const char D_801E0EC0[] = "Error %d\n";
const char D_801E0ECC[] = "NAI_VRS:osVoiceClearDictionary %d\n";
const char D_801E0EF0[] = "NAI_VRS:dict error! (%d-%d %s)\n";
const char D_801E0F10[] = "NAI_VRS:Ina_SetVruGain Error!\n";
const char D_801E0F30[] = "NAI_VRS:mask on %d\n";
const char D_801E0F48[] = "NAI_VRS:mask off %d\n";
const char D_801E0F60[] = "NAI_VRS:answer No.:%d Dist:%d Warn:%04X Level:%5d SN:%5d (Num:%d)\n";
const char D_801E0FA4[] = "NAI_VRS:error !! (ANS_MAX:%d DIST:%d WARNING:%04X LEVEL:%5d SN:%5d)\n";
s32 func_801A51F0(s32 errorCode) {
switch (errorCode) {
case CONT_ERR_NO_CONTROLLER:
case CONT_ERR_CONTRFAIL:
case CONT_ERR_INVALID:
case CONT_ERR_DEVICE:
case CONT_ERR_VOICE_MEMORY:
case CONT_ERR_VOICE_WORD:
case CONT_ERR_VOICE_NO_RESPONSE:
return -1;
default:
return 0;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5228.s")
s32 func_801A5228(OSVoiceDictionary* dict) {
OSMesgQueue* serialEventQueue;
s32 errorCode;
u8 numWords;
u8 i;
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5390.s")
D_801FD5A0.mode = 0;
D_801FD5A0.data = NULL;
D_801FD5A0.distance = 1000;
D_801FD5A0.answerNum = 5;
D_801FD5A0.warning = 0;
D_801FD5A0.dict = dict;
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A53DC.s")
numWords = dict->numWords;
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A53E8.s")
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
errorCode = osVoiceClearDictionary(&gVoiceHandle, numWords);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A541C.s")
if (errorCode != 0) {
return errorCode;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5488.s")
for (i = 0; i < (((numWords - 1) / 8) + 1); i++) {
sVoiceMaskPattern[i] = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A54C4.s")
for (i = 0; i < numWords; i++) {
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
errorCode = osVoiceSetWord(&gVoiceHandle, &dict->words[i]);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A54D0.s")
if (func_801A51F0(errorCode) != 0) {
func_801A5A1C(&dict->words[i]);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5680.s")
return errorCode;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5808.s")
OSVoiceData* func_801A5390(void) {
OSVoiceData* voiceData;
OSMesgQueue* serialEventQueue;
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/AudioVoice_ResetData.s")
voiceData = D_801FD5A0.data;
D_801FD5A0.data = NULL;
#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5A1C.s")
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
osVoiceStartReadData(&gVoiceHandle);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
return voiceData;
}
// Unused
OSVoiceDictionary* func_801A53DC(void) {
return D_801FD5A0.dict;
}
void func_801A53E8(u16 distance, u16 answerNum, u16 warning, u16 voiceLevel, u16 voiceRelLevel) {
D_801FD5A0.distance = distance;
D_801FD5A0.answerNum = answerNum;
D_801FD5A0.warning = warning;
D_801FD5A0.voiceLevel = voiceLevel;
D_801FD5A0.voiceRelLevel = voiceRelLevel;
}
// Unused
// Could have a return? or be void return?
s32 func_801A541C(s32 analog, s32 digital) {
s32 errorCode;
OSMesgQueue* serialEventQueue;
if (D_801FD5A0.dict != NULL) {
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
errorCode = osVoiceControlGain(&gVoiceHandle, analog, digital);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
if (errorCode != 0) {
func_801A51F0(errorCode);
}
}
}
// Unused
s32 func_801A5488(u8* word) {
s32 errorCode;
OSMesgQueue* serialEventQueue;
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
errorCode = osVoiceCheckWord(word);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
return errorCode;
}
u8* func_801A54C4(void) {
return sVoiceMaskPattern;
}
s32 func_801A54D0(u16 wordId) {
s32 errorCode;
u8 phi_t0 = true;
u8 numWords;
u8 i;
OSMesgQueue* serialEventQueue;
if (D_801FD5A0.dict != NULL) {
numWords = D_801FD5A0.dict->numWords;
} else {
numWords = 20;
phi_t0 = false;
}
if (wordId == VOICE_WORD_ID_NONE) {
for (i = 0; i < numWords; i++) {
sVoiceMaskPattern[i / 8] |= 1 << (i % 8);
}
} else {
if (sVoiceMaskPattern[wordId / 8] & (1 << (wordId % 8))) {
phi_t0 = false;
} else {
sVoiceMaskPattern[wordId / 8] |= (1 << (wordId % 8));
}
}
if (phi_t0) {
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
errorCode = osVoiceStopReadData(&gVoiceHandle);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
if ((errorCode == 0) || (D_801FD5A0.mode == 0)) {
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
errorCode = osVoiceMaskDictionary(&gVoiceHandle, sVoiceMaskPattern, ((numWords - 1) / 8) + 1);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
}
D_801FD5A0.mode = 0;
}
return errorCode;
}
s32 func_801A5680(u16 wordId) {
s32 errorCode;
u8 phi_a3 = true;
u8 numWords;
u8 i;
OSMesgQueue* serialEventQueue;
if (D_801FD5A0.dict != NULL) {
numWords = D_801FD5A0.dict->numWords;
} else {
numWords = 20;
phi_a3 = false;
}
if (wordId == VOICE_WORD_ID_NONE) {
for (i = 0; i < (((numWords - 1) / 8) + 1); i++) {
sVoiceMaskPattern[i] = 0;
}
} else {
if (!(sVoiceMaskPattern[wordId / 8] & (1 << (wordId % 8)))) {
phi_a3 = false;
} else {
sVoiceMaskPattern[wordId / 8] &= (1 << (wordId % 8)) ^ 0xFF;
}
}
if (phi_a3) {
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
errorCode = osVoiceStopReadData(&gVoiceHandle);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
if ((errorCode == 0) || (D_801FD5A0.mode == 0)) {
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
errorCode = osVoiceMaskDictionary(&gVoiceHandle, sVoiceMaskPattern, ((numWords - 1) / 8) + 1);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
}
D_801FD5A0.mode = 0;
}
return errorCode;
}
s32 func_801A5808(void) {
s32 errorCode = 0;
s32 ret;
OSMesgQueue* serialEventQueue;
switch (D_801FD5A0.mode) {
case 0:
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
errorCode = osVoiceStartReadData(&gVoiceHandle);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
D_801FD5A0.mode = 1;
break;
case 1:
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
errorCode = osVoiceGetReadData(&gVoiceHandle, &D_801FD5C8);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
if (func_801A51F0(errorCode) == 0) {
switch (gVoiceHandle.status) {
case VOICE_STATUS_READY:
D_801FD5A0.mode = 2;
break;
case VOICE_STATUS_START:
case 2:
case VOICE_STATUS_CANCEL:
case 4:
case VOICE_STATUS_BUSY:
case 6:
break;
case VOICE_STATUS_END:
D_801FD5A0.mode = 2;
break;
default:
break;
}
}
break;
case 2:
if (((D_801FD5C8.warning & D_801FD5A0.warning) == 0) && (D_801FD5A0.answerNum >= D_801FD5C8.answerNum) &&
(D_801FD5A0.distance >= D_801FD5C8.distance[0]) && (D_801FD5C8.voiceLevel >= D_801FD5A0.voiceLevel) &&
(D_801FD5C8.voiceRelLevel >= D_801FD5A0.voiceRelLevel)) {
D_801FD5E8 = D_801FD5C8;
D_801FD5A0.data = &D_801FD5E8;
}
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
osVoiceStopReadData(&gVoiceHandle);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
errorCode = osVoiceStartReadData(&gVoiceHandle);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
D_801FD5A0.mode = 1;
break;
default:
break;
}
ret = func_801A51F0(errorCode);
return ret;
}
// Unused
void AudioVoice_ResetData(void) {
D_801FD5A0.dict = NULL;
}
u8* func_801A5A1C(s8* words) {
u8 i;
u8 j;
u8 numSyllables = strlen(words); // technically twice the num of syllables
u8 syllable[2];
for (j = 0, i = 0; i < numSyllables; i += 2) {
syllable[0] = words[i];
syllable[1] = words[i + 1];
if (syllable[0] == 0x83) {
D_801FD610[j++] = D_801D8F70[syllable[1] - 0x40][0];
D_801FD610[j++] = D_801D8F70[syllable[1] - 0x40][1];
} else if (syllable[0] == 0x82) {
D_801FD610[j++] = D_801D8E50[syllable[1] - 0x9F][0];
D_801FD610[j++] = D_801D8E50[syllable[1] - 0x9F][1];
} else if ((syllable[0] == 0x81) && (syllable[1] == 0x5B)) {
D_801FD610[j++] = '-';
D_801FD610[j++] = '-';
} else {
D_801FD610[j++] = ' ';
D_801FD610[j++] = ' ';
}
}
D_801FD610[i] = '\0';
return D_801FD610;
}
+1
View File
@@ -35,6 +35,7 @@
#include "PR/controller.h"
#include "PR/os_motor.h"
#include "fault.h"
#include "z64voice.h"
extern FaultMgr gFaultMgr;
-1
View File
@@ -1,4 +1,3 @@
#include "prevent_bss_reordering.h"
#include "z64.h"
#include "regs.h"
#include "functions.h"
+3 -1
View File
@@ -3,6 +3,7 @@
#include "sys_cfb.h"
#include "z64snap.h"
#include "z64view.h"
#include "z64voice.h"
#include "archives/icon_item_static/icon_item_static_yar.h"
#include "interface/parameter_static/parameter_static.h"
#include "interface/do_action_static/do_action_static.h"
@@ -2345,7 +2346,8 @@ void Interface_UpdateButtonsPart1(PlayState* play) {
interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0;
restoreHudVisibility = true;
sPictoState = PICTO_BOX_STATE_OFF;
} else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || (func_801A5100() == 1)) {
} else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) ||
(AudioVoice_GetWord() == VOICE_WORD_ID_CHEESE)) {
if (!CHECK_EVENTINF(EVENTINF_41) ||
(CHECK_EVENTINF(EVENTINF_41) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE))) {
Audio_PlaySfx(NA_SE_SY_CAMERA_SHUTTER);
+2 -2
View File
@@ -33,7 +33,7 @@ s32 osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* result) {
sHandleStatus = data[0] & 7;
hd->status = sHandleStatus;
if ((sHandleStatus != 0) && (sHandleStatus != 7)) {
if ((sHandleStatus != VOICE_STATUS_READY) && (sHandleStatus != VOICE_STATUS_END)) {
return CONT_ERR_NOT_READY;
}
// fallthrough
@@ -88,7 +88,7 @@ s32 osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* result) {
}
hd->status = data[34] & 7;
if ((sHandleStatus == 0) || (hd->status == 0)) {
if ((sHandleStatus == VOICE_STATUS_READY) || (hd->status == VOICE_STATUS_READY)) {
break;
}
// fallthrough
@@ -6,6 +6,7 @@
#include "z_bg_dblue_balance.h"
#include "objects/object_dblue_object/object_dblue_object.h"
#include "prevent_bss_reordering.h"
#define FLAGS 0x00000000
@@ -48,7 +48,6 @@
* - Effect Update/Draw
* - Seaweed
*/
#include "z_boss_03.h"
#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
#include "overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h"
+13 -12
View File
@@ -6,6 +6,7 @@
#include "z_en_cow.h"
#include "z64horse.h"
#include "z64voice.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY)
@@ -132,7 +133,7 @@ void EnCow_Init(Actor* thisx, PlayState* play) {
this->actor.targetMode = TARGET_MODE_6;
gHorsePlayedEponasSong = false;
func_801A5080(4);
func_801A5080(VOICE_WORD_ID_MILK);
break;
case EN_COW_TYPE_TAIL:
@@ -158,7 +159,7 @@ void EnCow_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.01f);
this->flags = 0;
CLEAR_WEEKEVENTREG(WEEKEVENTREG_87_01);
CLEAR_WEEKEVENTREG(WEEKEVENTREG_TALKING_TO_COW_WITH_VOICE);
}
void EnCow_Destroy(Actor* thisx, PlayState* play) {
@@ -291,11 +292,11 @@ void EnCow_Idle(EnCow* this, PlayState* play) {
}
}
if (this->actor.xzDistToPlayer < 150.0f &&
ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 25000) {
if (func_801A5100() == 4) {
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_87_01)) {
SET_WEEKEVENTREG(WEEKEVENTREG_87_01);
if ((this->actor.xzDistToPlayer < 150.0f) &&
(ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x61A8)) {
if (AudioVoice_GetWord() == VOICE_WORD_ID_MILK) {
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKING_TO_COW_WITH_VOICE)) {
SET_WEEKEVENTREG(WEEKEVENTREG_TALKING_TO_COW_WITH_VOICE);
if (Inventory_HasEmptyBottle()) {
this->actor.textId = 0x32C9; // Text to give milk.
} else {
@@ -306,7 +307,7 @@ void EnCow_Idle(EnCow* this, PlayState* play) {
this->actionFunc = EnCow_Talk;
}
} else {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_87_01);
CLEAR_WEEKEVENTREG(WEEKEVENTREG_TALKING_TO_COW_WITH_VOICE);
}
}
@@ -322,8 +323,8 @@ void EnCow_DoTail(EnCow* this, PlayState* play) {
Animation_GetLastFrame(&gCowTailIdleAnim), ANIMMODE_ONCE, 1.0f);
}
if (this->actor.xzDistToPlayer < 150.0f &&
ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) > 25000) {
if ((this->actor.xzDistToPlayer < 150.0f) &&
(ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) > 0x61A8)) {
if (!(this->flags & EN_COW_FLAG_PLAYER_HAS_APPROACHED)) {
this->flags |= EN_COW_FLAG_PLAYER_HAS_APPROACHED;
if (this->skelAnime.animation == &gCowTailIdleAnim) {
@@ -360,8 +361,8 @@ void EnCow_Update(Actor* thisx, PlayState* play2) {
this->actionFunc(this, play);
if (this->actor.xzDistToPlayer < 150.0f &&
ABS_ALT(Math_Vec3f_Yaw(&thisx->world.pos, &player->actor.world.pos)) < 0xC000) {
if ((this->actor.xzDistToPlayer < 150.0f) &&
(ABS_ALT(Math_Vec3f_Yaw(&thisx->world.pos, &player->actor.world.pos)) < 0xC000)) {
targetX = Math_Vec3f_Pitch(&thisx->focus.pos, &player->actor.focus.pos);
targetY = Math_Vec3f_Yaw(&thisx->focus.pos, &player->actor.focus.pos) - this->actor.shape.rot.y;
+3 -2
View File
@@ -5,6 +5,7 @@
*/
#include "z_en_gs.h"
#include "z64voice.h"
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
#include "overlays/actors/ovl_En_Elf/z_en_elf.h"
#include "objects/object_gs/object_gs.h"
@@ -159,7 +160,7 @@ void EnGs_Init(Actor* thisx, PlayState* play) {
Math_Vec3f_Copy(&this->unk_1B0[0], &gOneVec3f);
Math_Vec3f_Copy(&this->unk_1B0[1], &gOneVec3f);
SubS_FillCutscenesList(&this->actor, this->csIdList, ARRAY_COUNT(this->csIdList));
func_801A5080(0);
func_801A5080(VOICE_WORD_ID_HOURS);
if (this->actor.params == ENGS_1) {
Actor_SetScale(&this->actor, 0.15f);
this->collider.dim.radius *= 1.5f;
@@ -946,7 +947,7 @@ void func_80999BC8(Actor* thisx, PlayState* play2) {
EnGs* this = THIS;
s32 pad;
if (this->actor.isLockedOn && !func_801A5100()) {
if (this->actor.isLockedOn && (AudioVoice_GetWord() == VOICE_WORD_ID_HOURS)) {
this->unk_19D = 0;
this->unk_19A |= 1;
func_80999AC0(this);
@@ -5,6 +5,7 @@
*/
#include "z_en_hidden_nuts.h"
#include "z64voice.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_2000000)
@@ -131,7 +132,7 @@ void EnHiddenNuts_Init(Actor* thisx, PlayState* play) {
this->path = SubS_GetPathByIndex(play, this->pathIndex, ENHIDDENNUTS_PATH_INDEX_NONE_ALT);
this->csId = this->actor.csId;
func_801A5080(2);
func_801A5080(VOICE_WORD_ID_WAKE_UP);
func_80BDB268(this);
}
@@ -213,7 +214,7 @@ void func_80BDB2B8(EnHiddenNuts* this, PlayState* play) {
if ((play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_SONATA)) {
play->msgCtx.ocarinaMode = OCARINA_MODE_END;
func_80BDB788(this);
} else if (func_801A5100() == 2) {
} else if (AudioVoice_GetWord() == VOICE_WORD_ID_WAKE_UP) {
func_80BDB788(this);
} else {
Actor_OfferTalk(&this->actor, play, BREG(13) + 100.0f);
@@ -7,6 +7,7 @@
#include "z_en_horse.h"
#include "z64horse.h"
#include "z64rumble.h"
#include "z64voice.h"
#include "overlays/actors/ovl_En_In/z_en_in.h"
#include "overlays/actors/ovl_Obj_Um/z_obj_um.h"
#include "overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h"
@@ -4016,9 +4017,9 @@ void func_80886C00(EnHorse* this, PlayState* play) {
if (((this->action == ENHORSE_ACTION_MOUNTED_WALK) || (this->action == ENHORSE_ACTION_MOUNTED_TROT) ||
(this->action == ENHORSE_ACTION_MOUNTED_GALLOP)) &&
(CHECK_BTN_ALL(input->press.button, BTN_A) || (func_801A5100() == 5)) && (play->interfaceCtx.unk_212 == 8) &&
!(this->stateFlags & ENHORSE_BOOST) && !(this->stateFlags & ENHORSE_FLAG_8) &&
!(this->stateFlags & ENHORSE_FLAG_9)) {
(CHECK_BTN_ALL(input->press.button, BTN_A) || (AudioVoice_GetWord() == VOICE_WORD_ID_HIYA)) &&
(play->interfaceCtx.unk_212 == 8) && !(this->stateFlags & ENHORSE_BOOST) &&
!(this->stateFlags & ENHORSE_FLAG_8) && !(this->stateFlags & ENHORSE_FLAG_9)) {
if (this->numBoosts > 0) {
Rumble_Request(0.0f, 180, 20, 100);
this->stateFlags |= ENHORSE_BOOST;
@@ -4,7 +4,6 @@
* Description: Breakable Pot With Grass
*/
#include "prevent_bss_reordering.h"
#include "z_obj_flowerpot.h"
#include "objects/object_flowerpot/object_flowerpot.h"
+1 -1
View File
@@ -4014,7 +4014,7 @@
0x801A4FD8:("func_801A4FD8",),
0x801A5080:("func_801A5080",),
0x801A50C0:("func_801A50C0",),
0x801A5100:("func_801A5100",),
0x801A5100:("AudioVoice_GetWord",),
0x801A510C:("func_801A510C",),
0x801A5118:("func_801A5118",),
0x801A51F0:("func_801A51F0",),

Some files were not shown because too many files have changed in this diff Show More