Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "libultraship"]
path = libultraship
url = https://github.com/kenix3/libultraship.git
url = https://github.com/balloondude2/libultraship.git
[submodule "OTRExporter"]
path = OTRExporter
url = https://github.com/louist103/OTRExporter.git
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

# 2 Ship 2 Harkinian

This is an outdated branch.

## Discord

Official Discord: https://discord.com/invite/shipofharkinian
Expand Down
2 changes: 1 addition & 1 deletion libultraship
30 changes: 29 additions & 1 deletion mm/2s2h/BenGui/SearchableMenuItems.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ typedef enum {
DISABLE_FOR_FRAME_ADVANCE_OFF,
DISABLE_FOR_WARP_POINT_NOT_SET,
DISABLE_FOR_INTRO_SKIP_OFF,
DISABLE_FOR_VOICE_OFF,
} DisableOption;

struct widgetInfo;
Expand Down Expand Up @@ -348,7 +349,12 @@ static std::map<DisableOption, disabledInfo> disabledMap = {
"Warp Point Not Saved" } },
{ DISABLE_FOR_INTRO_SKIP_OFF,
{ [](disabledInfo& info) -> bool { return !CVarGetInteger("gEnhancements.Cutscenes.SkipIntroSequence", 0); },
"Intro Skip Not Selected" } }
"Intro Skip Not Selected" } },
{ DISABLE_FOR_VOICE_OFF,
{ [](disabledInfo& info) -> bool {
return !CVarGetInteger("gEnhancements.Restorations.VoiceRecognitionUnit", 0);
},
"Voice Recognition Unit is Disabled" } }
};

std::unordered_map<int32_t, const char*> menuThemeOptions = {
Expand Down Expand Up @@ -433,6 +439,12 @@ static const std::unordered_map<int32_t, const char*> dekuGuardSearchBallsOption
{ DEKU_GUARD_SEARCH_BALLS_ALWAYS, "Always" },
};

static const std::unordered_map<int32_t, const char*> voiceWordOptions = {
{ VOICE_WORD_NONE, "None" }, { VOICE_WORD_TIME, "ato nan jikan" }, { VOICE_WORD_PICTURE, "hai chi-zu" },
{ VOICE_WORD_WAKE, "okiro-" }, { VOICE_WORD_SIT, "osuwari" }, { VOICE_WORD_MILK, "miruku" },
{ VOICE_WORD_EPONA, "haiya-" },
};

void FreeLookPitchMinMax() {
f32 maxY = CVarGetFloat("gEnhancements.Camera.FreeLook.MaxPitch", 72.0f);
f32 minY = CVarGetFloat("gEnhancements.Camera.FreeLook.MinPitch", -49.0f);
Expand Down Expand Up @@ -1391,6 +1403,22 @@ void AddEnhancements() {
WIDGET_CVAR_CHECKBOX },
{ "Tatl ISG", "gEnhancements.Restorations.TatlISG", "Restores Navi ISG from OoT, but now with Tatl.",
WIDGET_CVAR_CHECKBOX },
{ "Voice Recognition Unit", "gEnhancements.Restorations.VoiceRecognitionUnit",
"Enables VRU functionality.", WIDGET_CVAR_CHECKBOX },
{ "VRU Word Selection",
"gEnhancements.Restorations.VoiceRecognitionUnitWord",
"Choose what word to 'say' when L is pressed.\n"
"- None: No word\n"
"- ato nan jikan: What time is it? Ask Sheikah Stones.\n"
"- hai chi-zu: Say Cheese. Take a picture.\n"
"- okiro-: Wake up. Wake up a sleepy scrub.\n"
"- osuwari: Sit. Does not appear to do anything.\n"
"- miruku: Milk. Ask a cow nicely for two portions of milk.\n"
"- Haiya-: Spur Epona.",
WIDGET_CVAR_COMBOBOX,
{ .defaultVariant = VOICE_WORD_NONE, .comboBoxOptions = voiceWordOptions },
nullptr,
[](widgetInfo& info) { info.isHidden = disabledMap.at(DISABLE_FOR_VOICE_OFF).active; } },
{ "Woodfall Mountain Appearance", "gEnhancements.Restorations.WoodfallMountainAppearance",
"Restores the appearance of Woodfall mountain to not look poisoned "
"when viewed from Termina Field after clearing Woodfall Temple\n\n"
Expand Down
10 changes: 10 additions & 0 deletions mm/2s2h/Enhancements/Enhancements.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ enum DekuGuardSearchBallsOptions {
DEKU_GUARD_SEARCH_BALLS_ALWAYS,
};

enum VoiceWordOptions {
VOICE_WORD_TIME,
VOICE_WORD_PICTURE,
VOICE_WORD_WAKE,
VOICE_WORD_SIT,
VOICE_WORD_MILK,
VOICE_WORD_EPONA,
VOICE_WORD_NONE = 0xFFFF,
};

// Old Entry Point
void InitEnhancements();

Expand Down
83 changes: 83 additions & 0 deletions mm/2s2h/Enhancements/Restorations/VoiceRecognitionUnit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#include <libultraship/libultraship.h>
#include "2s2h/GameInteractor/GameInteractor.h"
#include "Enhancements/Enhancements.h"
#include "2s2h/ShipInit.hpp"

extern "C" {
OSMesgQueue* PadMgr_AcquireSerialEventQueue(void);
void PadMgr_ReleaseSerialEventQueue(OSMesgQueue* serialEventQueue);
// PlayState* gPlayState;

#include "variables.h"
#include "z64voice.h"
void func_801A4EB8(void);
}

#define CVAR_NAME "gEnhancements.Restorations.VoiceRecognitionUnit"
#define CVAR CVarGetInteger(CVAR_NAME, 0)
#define CVAR_NAME_WORD "gEnhancements.Restorations.VoiceRecognitionUnitWord"
#define CVAR_WORD CVarGetInteger(CVAR_NAME_WORD, VOICE_WORD_NONE)

// Implementation of VRU functions
int32_t osVoiceInit(OSMesgQueue* mq, OSVoiceHandle* hd, int channel) {
return 0;
}

int32_t osVoiceSetWord(OSVoiceHandle* hd, u8* word) {
return 0;
}

int32_t osVoiceCheckWord(u8* word) {
return 0;
}

int32_t osVoiceStartReadData(OSVoiceHandle* hd) {
return 0;
}

int32_t osVoiceStopReadData(OSVoiceHandle* hd) {
return 0;
}

int32_t osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* result) {

result->answer[0] = VOICE_WORD_ID_NONE;

if (gPlayState == nullptr or !CVAR) {
return 0;
}

if (CHECK_BTN_ANY(gPlayState->state.input[0].cur.button, BTN_L)) {
// These values arbitrarily chosen to meet thresholds required in voice_internal.c
result->warning = 0;
result->answerNum = 1;
result->voiceLevel = 1000;
result->voiceRelLevel = 2500;
result->distance[0] = 10;

result->answer[0] = CVAR_WORD;
}

return 0;
}

int32_t osVoiceClearDictionary(OSVoiceHandle* hd, u8 numWords) {
return 0;
}

int32_t osVoiceMaskDictionary(OSVoiceHandle* hd, u8* maskPattern, int size) {
return 0;
}

int32_t osVoiceControlGain(OSVoiceHandle* hd, s32 analog, s32 digital) {
return 0;
}

void RegisterVoiceRecognitionUnit() {
if (CVAR) {
// Start the VRU loop
func_801A4EB8();
}
}

static RegisterShipInitFunc initFunc(RegisterVoiceRecognitionUnit, { CVAR_NAME });
4 changes: 3 additions & 1 deletion mm/include/PR/os_voice.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef PR_OS_VOICE_H
#define PR_OS_VOICE_H

#include <libultraship/libultra/voice.h>
#if 0
#include "ultratypes.h"
#include "os_message.h"

Expand Down Expand Up @@ -67,3 +68,4 @@ s32 osVoiceMaskDictionary(OSVoiceHandle* hd, u8* maskPattern, int size);
s32 osVoiceControlGain(OSVoiceHandle* hd, s32 analog, s32 digital);

#endif
#endif
4 changes: 0 additions & 4 deletions mm/src/audio/voice_external.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ void func_801A4EB0(void) {
}

void func_801A4EB8(void) {
#if 0
u8* new_var;
OSMesgQueue* serialEventQueue;
s32 index;
Expand Down Expand Up @@ -66,12 +65,10 @@ void func_801A4EB8(void) {
func_801A53E8(800, 2, VOICE_WARN_TOO_SMALL, 500, 2000);
D_801D8E3C = 1;
}
#endif
}

// Used externally in code_8019AF00
void func_801A4FD8(void) {
#if 0
s32 errorCode;
OSMesgQueue* serialEventQueue;

Expand All @@ -91,7 +88,6 @@ void func_801A4FD8(void) {
func_801A5080(VOICE_WORD_ID_HIYA);
func_801A5080(VOICE_WORD_ID_CHEESE);
}
#endif
}

void func_801A5080(u16 wordId) {
Expand Down
20 changes: 0 additions & 20 deletions mm/src/audio/voice_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ s32 func_801A51F0(s32 errorCode) {
}

s32 func_801A5228(OSVoiceDictionary* dict) {
return 0;
#if 0
OSMesgQueue* serialEventQueue;
s32 errorCode;
u8 numWords;
Expand Down Expand Up @@ -97,12 +95,9 @@ s32 func_801A5228(OSVoiceDictionary* dict) {
}

return errorCode;
#endif
}

OSVoiceData* func_801A5390(void) {
return NULL;
#if 0
OSVoiceData* voiceData;
OSMesgQueue* serialEventQueue;

Expand All @@ -114,7 +109,6 @@ OSVoiceData* func_801A5390(void) {
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);

return voiceData;
#endif
}

// Unused
Expand All @@ -133,7 +127,6 @@ void func_801A53E8(u16 distance, u16 answerNum, u16 warning, u16 voiceLevel, u16
// Unused
// Could have a return? or be void return?
s32 func_801A541C(s32 analog, s32 digital) {
#if 0
s32 errorCode;
OSMesgQueue* serialEventQueue;

Expand All @@ -146,13 +139,10 @@ s32 func_801A541C(s32 analog, s32 digital) {
func_801A51F0(errorCode);
}
}
#endif
}

// Unused
s32 func_801A5488(u8* word) {
return 0;
#if 0
s32 errorCode;
OSMesgQueue* serialEventQueue;

Expand All @@ -161,16 +151,13 @@ s32 func_801A5488(u8* word) {
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);

return errorCode;
#endif
}

u8* func_801A54C4(void) {
return sVoiceMaskPattern;
}

s32 func_801A54D0(u16 wordId) {
return 0;
#if 0
s32 errorCode;
u8 phi_t0 = true;
u8 numWords;
Expand Down Expand Up @@ -211,12 +198,9 @@ s32 func_801A54D0(u16 wordId) {
}

return errorCode;
#endif
}

s32 func_801A5680(u16 wordId) {
return 0;
#if 0
s32 errorCode;
u8 phi_a3 = true;
u8 numWords;
Expand Down Expand Up @@ -257,12 +241,9 @@ s32 func_801A5680(u16 wordId) {
}

return errorCode;
#endif
}

s32 func_801A5808(void) {
return 0;
#if 0
s32 errorCode = 0;
s32 ret;
OSMesgQueue* serialEventQueue;
Expand Down Expand Up @@ -331,7 +312,6 @@ s32 func_801A5808(void) {
ret = func_801A51F0(errorCode);

return ret;
#endif
}

// Unused
Expand Down
30 changes: 30 additions & 0 deletions mm/src/overlays/actors/ovl_En_Dg/z_en_dg.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "z_en_dg.h"
#include "overlays/actors/ovl_En_Aob_01/z_en_aob_01.h"
#include "z64voice.h"

#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_800000)

Expand Down Expand Up @@ -37,6 +38,7 @@ void EnDg_Held(EnDg* this, PlayState* play);
void EnDg_Thrown(EnDg* this, PlayState* play);
void EnDg_SetupTalk(EnDg* this, PlayState* play);
void EnDg_Talk(EnDg* this, PlayState* play);
void EnDg_SitOnce(EnDg* this, PlayState* play);

ActorInit En_Dg_InitVars = {
/**/ ACTOR_EN_DG,
Expand Down Expand Up @@ -693,7 +695,35 @@ void EnDg_IdleMove(EnDg* this, PlayState* play) {
EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_BARK);
this->actionFunc = EnDg_IdleBark;
}

// voiceRegion
if (this->actor.xzDistToPlayer < 150.0f) {
if (AudioVoice_GetWord() == VOICE_WORD_ID_SIT) {
EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_SIT_DOWN_ONCE);
this->timer = 30;
this->actionFunc = EnDg_SitOnce;
}
}
}

void EnDg_SitOnce(EnDg* this, PlayState* play) {
Player* player = GET_PLAYER(play);

if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
this->actionFunc = EnDg_Fall;
}

if (this->actor.xzDistToPlayer < 50.0f) {
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xC00);
this->actor.world.rot.y = this->actor.shape.rot.y;
}

if (DECR(this->timer) == 0) {
this->timer = Rand_S16Offset(60, 60);
EnDg_SetupIdleMove(this, play);
}
}
// endregion

/**
* Stops and barks, before returning to moving along its path.
Expand Down
Loading