Skip to content

Commit

Permalink
Soundtrack fixes, but it still doesnt perform well :(
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Nov 13, 2023
1 parent d65d3e9 commit 5cd2679
Show file tree
Hide file tree
Showing 35 changed files with 1,014 additions and 411 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
"dswifi9.h": "c",
"stdio.h": "c",
"nds.h": "c",
"multiplayer.h": "c"
"multiplayer.h": "c",
"cstring": "cpp",
"list": "cpp"
},
"C_Cpp.default.compilerPath": "/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc"
}
Binary file modified nitrofiles/bgm/baby_blue.wav
Binary file not shown.
Binary file modified nitrofiles/bgm/clear_waters.wav
Binary file not shown.
Binary file removed nitrofiles/bgm/clear_waters_1.wav
Binary file not shown.
Binary file removed nitrofiles/bgm/clear_waters_2.wav
Binary file not shown.
Binary file modified nitrofiles/bgm/rodrigo_y_gabriela.wav
Binary file not shown.
Binary file modified nitrofiles/bgm/sauls_theme.wav
Binary file not shown.
Binary file modified nitrofiles/bgm/the_cousins.wav
Binary file not shown.
Binary file removed nitrofiles/bgm/the_cousins_1.wav
Binary file not shown.
Binary file removed nitrofiles/bgm/the_cousins_2.wav
Binary file not shown.
Binary file modified nitrofiles/bgm/the_final_cook.wav
Binary file not shown.
Binary file modified nitrofiles/bgm/title_hook.wav
Binary file not shown.
Binary file modified nitrofiles/bgm/title_loop.wav
Binary file not shown.
Binary file modified nitrofiles/sfx/acceptable.wav
Binary file not shown.
Binary file modified nitrofiles/sfx/click.wav
Binary file not shown.
Binary file modified nitrofiles/sfx/crank.wav
Binary file not shown.
Binary file modified nitrofiles/sfx/dialogue_bleep.wav
Binary file not shown.
Binary file modified nitrofiles/sfx/goodbye_walter.wav
Binary file not shown.
Binary file modified nitrofiles/sfx/menu_drum.wav
Binary file not shown.
Binary file modified nitrofiles/sfx/menu_select.wav
Binary file not shown.
Binary file modified nitrofiles/sfx/minerals.wav
Binary file not shown.
Binary file modified nitrofiles/sfx/pestle.wav
Binary file not shown.
Binary file modified nitrofiles/sfx/success_bell.wav
Binary file not shown.
Binary file modified nitrofiles/sfx/vaccum.wav
Binary file not shown.
Binary file modified nitrofiles/sfx/valve_turn.wav
Binary file not shown.
2 changes: 1 addition & 1 deletion sound/bgm/convert.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Converts ogg soundtrack files into metadata-stripped WAVs
for i in *.ogg; do ffmpeg -y -i "$i" -map_metadata -1 -acodec pcm_s16le -ac 2 -ar 22050 -fflags +bitexact -flags:v +bitexact -flags:a +bitexact "../../nitrofiles/bgm/${i%.*}.wav"; done
for i in *.ogg; do ffmpeg -y -i "$i" -map_metadata -1 -acodec adpcm_ima_wav -ac 2 -ar 22050 -fflags +bitexact -flags:v +bitexact -flags:a +bitexact "../../nitrofiles/bgm/${i%.*}.wav"; done
Binary file modified sound/bgm/rodrigo_y_gabriela.ogg
Binary file not shown.
2 changes: 1 addition & 1 deletion sound/sfx/convert.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Converts ogg sfx files into metadata-stripped WAVs
for i in *.ogg; do ffmpeg -y -i "$i" -map_metadata -1 -acodec pcm_s16le -ac 2 -ar 22050 -fflags +bitexact -flags:v +bitexact -flags:a +bitexact "../../nitrofiles/sfx/${i%.*}.wav"; done
for i in *.ogg; do ffmpeg -y -i "$i" -map_metadata -1 -acodec adpcm_ima_wav -ac 2 -ar 22050 -fflags +bitexact -flags:v +bitexact -flags:a +bitexact "../../nitrofiles/sfx/${i%.*}.wav"; done
14 changes: 1 addition & 13 deletions source/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ Game::Game()
// Prepare NiFi
nifiPrepare();

// Setup sound
mm_ds_system sys;
sys.mod_count = 0;
sys.samp_count = 0;
sys.mem_bank = nullptr;
sys.fifo_channel = FIFO_MAXMOD;
mmInit(&sys);
Audio::SetupAudio();

// Load global save
globalSave.loadData();
}
Expand Down Expand Up @@ -1111,9 +1102,6 @@ void Game::UpdateGameOver()
rumble(gameOverFrame % 2 == 0);
}
break;
case -10:
Audio::StopSFX();
break;
case 0:
if (!levelClear)
{
Expand Down Expand Up @@ -1584,7 +1572,7 @@ void Game::Update()
}

// Update sounds
mmStreamUpdate();
Audio::audioManager.update();

// Refresh shadow OAM copy
NF_SpriteOamSet(1);
Expand Down
5 changes: 4 additions & 1 deletion source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ int main()
// Prepare graphics
game.Prepare3DGraphics();
game.Prepare2DGraphics();


// Setup sound
Audio::LoadSFXs();

// Start the game
game.StartMenuScreen(DEBUG_MODE);

Expand Down
151 changes: 78 additions & 73 deletions source/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,14 +403,16 @@ void Menu::ShowMinerals(bool showSprites)
}
}

char* Menu::GetCharacterName(Character character) {
switch (character) {
case CHAR_WALT:
return "Walt";
case CHAR_JESSE:
return "Jesse";
case CHAR_YEPPERS:
return "Kusuri";
char *Menu::GetCharacterName(Character character)
{
switch (character)
{
case CHAR_WALT:
return "Walt";
case CHAR_JESSE:
return "Jesse";
case CHAR_YEPPERS:
return "Kusuri";
}
return "Unknown";
}
Expand All @@ -426,8 +428,7 @@ void Menu::UpdateMinerals(volatile int frame)
if (keysDown() & KEY_TOUCH)
{
touchRead(&touch);
touching = touch.px >= MINERAL_GRID_BASE_POS[0] && touch.px <= MINERAL_GRID_BASE_POS[0] + ((32 + MINERAL_GAP) * MINERALS_PER_ROW)
&& touch.py > MINERAL_GRID_BASE_POS[1] && touch.py < MINERAL_GRID_BASE_POS[1] + ((32 + MINERAL_GAP) * (MINERAL_COUNT / MINERALS_PER_ROW));
touching = touch.px >= MINERAL_GRID_BASE_POS[0] && touch.px <= MINERAL_GRID_BASE_POS[0] + ((32 + MINERAL_GAP) * MINERALS_PER_ROW) && touch.py > MINERAL_GRID_BASE_POS[1] && touch.py < MINERAL_GRID_BASE_POS[1] + ((32 + MINERAL_GAP) * (MINERAL_COUNT / MINERALS_PER_ROW));

if (!touching)
{
Expand All @@ -446,10 +447,14 @@ void Menu::UpdateMinerals(volatile int frame)

if (touching)
{
Audio::PlaySFX(SFX_MENU_SELECT);

bool touchingMineral = touch.px >= pos[0] && touch.px <= pos[0] + 32 && touch.py >= pos[1] && touch.py <= pos[1] + 32;
currentlySelectedMineral = touchingMineral ? i : currentlySelectedMineral;

int selected = touchingMineral ? i : currentlySelectedMineral;
if (currentlySelectedMineral != selected)
{
Audio::PlaySFX(SFX_MENU_SELECT);
currentlySelectedMineral = selected;
}
}

if (currentlySelectedMineral == i)
Expand Down Expand Up @@ -509,14 +514,16 @@ void Menu::Update(volatile int frame)
{
showStartSprite = !showStartSprite;
}
if (!canSave()) {
if (!canSave())
{
NF_WriteText(1, 0, 0, 0, "Cannot save game!");
}
NF_WriteText(1, 0, 26, 0, "v1.0.5");
break;

case MENU_RUMBLE:
if (!isDSiMode()) {
if (!isDSiMode())
{
NF_WriteText(1, 0, 2, 7, "A DS Rumble Pak is required.");
NF_WriteText(1, 0, 2, 8, "to enable this feature. If a");
NF_WriteText(1, 0, 2, 9, "Rumble Pak is inserted into");
Expand All @@ -525,10 +532,11 @@ void Menu::Update(volatile int frame)

NF_WriteText(1, 0, 2, 14, "Remove the Rumble Pak from");
NF_WriteText(1, 0, 2, 15, "SLOT-2 to disable rumble.");

rumble(frame % 2 == 0);
}
else {
}
else
{
NF_WriteText(1, 0, 2, 9, "Rumble support is disabled.");
NF_WriteText(1, 0, 2, 11, "You do not have a system");
NF_WriteText(1, 0, 2, 12, "that supports the rumble");
Expand Down Expand Up @@ -569,69 +577,65 @@ void Menu::Update(volatile int frame)
case MENU_MUSIC_PLAYER:
NF_WriteText(1, 0, 2, 9, "Currently playing:");
char trackNoAndTitle[50];
sprintf(trackNoAndTitle, "%d. %s", currentSoundTestTrack + 1, BGMS[currentSoundTestTrack].name);
NF_WriteText(1, 0, 2, 10, trackNoAndTitle);
// NF_WriteText(1, 0, 2, 11, GetBgmTrackProgressString());
sprintf(trackNoAndTitle, "%d. %s", currentSoundTestTrack + 1, BGMS[currentSoundTestTrack].name.c_str());
NF_WriteText(1, 0, 2, 11, trackNoAndTitle);
NF_WriteText(1, 0, 2, 13, "LEFT/RIGHT to change track.");
break;

case MENU_MP_HOST_ROOM:
case MENU_MP_JOIN_ROOM:
UpdateMultiplayer();
break;

case MENU_CUSTOM_GAME:
NF_WriteText(1, 0, 2, 2, "- Custom Cook -");

// Option config
char editorText[50];
for (int i = 0; i < CUSTOM_GAME_OPTION_COUNT; i++)
{
switch (i) {
case 0:
if (customGameValues[i] == 5) {
sprintf(
editorText,
"%s%s: Final Cook", customGameCursor == i ? "> " : "",
customGameIds[i]
);
}
else
{
sprintf(
editorText,
"%s%s: %i", customGameCursor == i ? "> " : "",
customGameIds[i],
customGameValues[i] + 1
);
}
break;
case 1:
switch (i)
{
case 0:
if (customGameValues[i] == 5)
{
sprintf(
editorText,
"%s%s: $%i", customGameCursor == i ? "> " : "",
customGameIds[i],
customGameValues[i]
);
break;
case 2:
sprintf(
editorText,
"%s%s: %s", customGameCursor == i ? "> " : "",
customGameIds[i],
GetCharacterName(static_cast<Character>(customGameValues[i]))
);
break;
default:
"%s%s: Final Cook", customGameCursor == i ? "> " : "",
customGameIds[i]);
}
else
{
sprintf(
editorText,
"%s%s: %s", customGameCursor == i ? "> " : "",
editorText,
"%s%s: %i", customGameCursor == i ? "> " : "",
customGameIds[i],
customGameValues[i] ? "On" : "Off"
);
break;
customGameValues[i] + 1);
}
break;
case 1:
sprintf(
editorText,
"%s%s: $%i", customGameCursor == i ? "> " : "",
customGameIds[i],
customGameValues[i]);
break;
case 2:
sprintf(
editorText,
"%s%s: %s", customGameCursor == i ? "> " : "",
customGameIds[i],
GetCharacterName(static_cast<Character>(customGameValues[i])));
break;
default:
sprintf(
editorText,
"%s%s: %s", customGameCursor == i ? "> " : "",
customGameIds[i],
customGameValues[i] ? "On" : "Off");
break;
}

NF_WriteText(1, 0, 3 - (customGameCursor == i ? 2 : 0), 5 + (i * 2), editorText);
}

Expand Down Expand Up @@ -691,7 +695,7 @@ MenuSelection Menu::HandleInput(volatile int frame)
currentSoundTestTrack = BGM_COUNT - 1;
}
}

Audio::PlayBGM(static_cast<BgmId>(currentSoundTestTrack), true);
rumble(currentSoundTestTrack % 2 == 0);
}
Expand All @@ -717,11 +721,10 @@ MenuSelection Menu::HandleInput(volatile int frame)
break;

case MENU_CUSTOM_GAME:
if (keysDown() & KEY_RIGHT || keysDown() & KEY_LEFT
|| keysDown() & KEY_DOWN || keysDown() & KEY_UP)
if (keysDown() & KEY_RIGHT || keysDown() & KEY_LEFT || keysDown() & KEY_DOWN || keysDown() & KEY_UP)
{
// Adjust cursor
if (keysDown() & KEY_UP)
if (keysDown() & KEY_UP)
{
customGameCursor--;
Audio::PlaySFX(SFX_MENU_SELECT);
Expand All @@ -734,8 +737,8 @@ MenuSelection Menu::HandleInput(volatile int frame)
if (customGameCursor < 0)
{
customGameCursor = CUSTOM_GAME_OPTION_COUNT - 1;
}
else if (customGameCursor >= CUSTOM_GAME_OPTION_COUNT)
}
else if (customGameCursor >= CUSTOM_GAME_OPTION_COUNT)
{
customGameCursor = 0;
}
Expand All @@ -754,7 +757,7 @@ MenuSelection Menu::HandleInput(volatile int frame)
customGameValues[customGameCursor] -= valueInc;
Audio::PlaySFX(SFX_SUCCESS_BELL);
}
if (customGameValues[customGameCursor] < valueMin)
if (customGameValues[customGameCursor] < valueMin)
{
customGameValues[customGameCursor] = valueMax;
}
Expand Down Expand Up @@ -793,7 +796,7 @@ MenuSelection Menu::HandleLayoutInput(volatile int frame, touchPosition touch)
}

if (keysDown() & KEY_B)
{
{
SetState(layout->backState, frame);
return NONE;
}
Expand Down Expand Up @@ -953,8 +956,10 @@ MenuSelection Menu::HandleClick(MenuSelection clicked, volatile int frame)
}
return NONE;
case START_STORY_MODE:
if (CheckSelection(clicked)) {
if ((keysHeld() & KEY_SELECT) && (keysHeld() & KEY_R)) {
if (CheckSelection(clicked))
{
if ((keysHeld() & KEY_SELECT) && (keysHeld() & KEY_R))
{
SetState(MENU_CUSTOM_GAME, frame);
return OPEN_CUSTOM_GAME_MENU;
}
Expand Down Expand Up @@ -1002,7 +1007,7 @@ void Menu::Draw(volatile int frame)
}
}

int* Menu::GetCustomGameValues()
int *Menu::GetCustomGameValues()
{
return customGameValues;
}
Expand Down

0 comments on commit 5cd2679

Please sign in to comment.