From bee5e97250c967b2c2477e5a42dc8a4846760124 Mon Sep 17 00:00:00 2001 From: 3drosalia Date: Tue, 17 Dec 2024 23:28:31 -0500 Subject: [PATCH] pad overdrive works again --- Encore/src/gameplay/gameplayRenderer.cpp | 88 ++++++++++++------------ Encore/src/gameplay/gameplayRenderer.h | 1 + Encore/src/menus/GameplayMenu.cpp | 6 +- Encore/src/menus/SettingsMenu.cpp | 24 +++---- Encore/src/menus/gameMenu.cpp | 4 +- Encore/src/settings.h | 24 +++---- 6 files changed, 75 insertions(+), 72 deletions(-) diff --git a/Encore/src/gameplay/gameplayRenderer.cpp b/Encore/src/gameplay/gameplayRenderer.cpp index 5d84dea..95e2703 100644 --- a/Encore/src/gameplay/gameplayRenderer.cpp +++ b/Encore/src/gameplay/gameplayRenderer.cpp @@ -388,9 +388,12 @@ void gameplayRenderer::LoadGameplayAssets() { DrumParts.push_back(std::move(TomSides)); // Crash - Texture2D CymbalBaseTex = LoadTexture((noteModelPath / "CymbalBase.png").string().c_str()); - Texture2D CymbalColorTex = LoadTexture((noteModelPath / "CymbalColor.png").string().c_str()); - Texture2D CymbalSidesTex = LoadTexture((noteModelPath / "CymbalWhite.png").string().c_str()); + Texture2D CymbalBaseTex = + LoadTexture((noteModelPath / "CymbalBase.png").string().c_str()); + Texture2D CymbalColorTex = + LoadTexture((noteModelPath / "CymbalColor.png").string().c_str()); + Texture2D CymbalSidesTex = + LoadTexture((noteModelPath / "CymbalWhite.png").string().c_str()); Model CymbalBase = LoadModel((noteModelPath / "cymbal/base.obj").string().c_str()); CymbalBase.materials[0].maps[MATERIAL_MAP_ALBEDO].texture = CymbalBaseTex; Model CymbalColor = LoadModel((noteModelPath / "cymbal/color.obj").string().c_str()); @@ -447,8 +450,7 @@ void gameplayRenderer::LoadGameplayAssets() { std::array, 4> CameraTargetDisplacement { { { { { 0, 0, TargetDistance } } }, - { { { 0.75f, 0, TargetDistance }, - { -0.75f, 0, TargetDistance } } }, + { { { 0.75f, 0, TargetDistance }, { -0.75f, 0, TargetDistance } } }, { { { 1.25f, 0, TargetDistance }, { 0, 0, TargetDistance }, @@ -793,23 +795,20 @@ void gameplayRenderer::RenderPadNotes( } } - if (player.stats->Overdrive) { - player.stats->overdriveActiveFill += - curChart.overdrive.AddOverdrive(player.stats->curODPhrase); - if (player.stats->overdriveActiveFill > 1.0f) - player.stats->overdriveActiveFill = 1.0f; - } else { - player.stats->overdriveFill += - curChart.overdrive.AddOverdrive(player.stats->curODPhrase); - if (player.stats->overdriveFill > 1.0f) - player.stats->overdriveFill = 1.0f; - } + double HighwayEnd = length + (smasherPos * 4); curChart.solos.UpdateEventViaNote(curNote, player.stats->curSolo); curChart.overdrive.UpdateEventViaNote(curNote, player.stats->curODPhrase); curChart.sections.UpdateEventViaNote(curNote, player.stats->curSection); curChart.fills.UpdateEventViaNote(curNote, player.stats->curFill); + if (curNote.hit && curChart.overdrive.Perfect(player.stats->curODPhrase)) { + player.stats->overdriveFill += + curChart.overdrive.AddOverdrive(player.stats->curODPhrase); + if (player.stats->overdriveFill > 1.0f) + player.stats->overdriveFill = 1.0f; + } + double NoteStartPositionWorld = GetNotePos(curNote.time, curSongTime, player.NoteSpeed, HighwayEnd); double NoteEndPositionWorld = GetNotePos( @@ -834,6 +833,8 @@ void gameplayRenderer::RenderPadNotes( curNote.heldTime = curSongTime - curNote.time; if (curNote.heldTime >= curNote.len) curNote.heldTime = curNote.len; + CalculateSustainScore(stats); + /* ProcessSustainScoring( lane, curNote.beatsLen, @@ -841,7 +842,7 @@ void gameplayRenderer::RenderPadNotes( curNote.len, curNote.perfect, stats - ); + );*/ if (!stats->HeldFrets[lane] && !stats->HeldFretsAlt[lane]) { curNote.held = false; } @@ -850,10 +851,6 @@ void gameplayRenderer::RenderPadNotes( } } - if (!curNote.held && curNote.hit) { - AddSustainPoints(lane, stats); - } - nDrawSustain( curNote, NoteColor, @@ -926,13 +923,20 @@ void gameplayRenderer::CheckPlasticNotes( player.stats->overdriveFill = 1.0f; } } +void gameplayRenderer::CalculateSustainScore(PlayerGameplayStats *&stats) { + double PointsPerTick = double(SUSTAIN_POINTS_PER_BEAT) / 480.0; + stats->SustainScore += (CurrentTick - stats->LastTick) * PointsPerTick; + ThePlayerManager.BandStats.SustainScore += + (CurrentTick - stats->LastTick) * PointsPerTick; + stats->Score += (CurrentTick - stats->LastTick) * PointsPerTick; + ThePlayerManager.BandStats.Score += (CurrentTick - stats->LastTick) * PointsPerTick; +} void gameplayRenderer::RenderClassicNotes( Player &player, Chart &curChart, double curSongTime, float length ) { StartRenderTexture(); // glDisable(GL_CULL_FACE); PlayerGameplayStats *&stats = player.stats; - double PointsPerTick = double(SUSTAIN_POINTS_PER_BEAT) / 480.0; for (auto &curNote : curChart.notes) { // if (curNote.time < TheSongTime.GetFakeStartTime()) { @@ -1009,13 +1013,7 @@ void gameplayRenderer::RenderClassicNotes( if (cLane.heldTime >= cLane.length) { cLane.heldTime = cLane.length; } - stats->SustainScore += - (CurrentTick - stats->LastTick) * PointsPerTick; - ThePlayerManager.BandStats.SustainScore += - (CurrentTick - stats->LastTick) * PointsPerTick; - stats->Score += (CurrentTick - stats->LastTick) * PointsPerTick; - ThePlayerManager.BandStats.Score += - (CurrentTick - stats->LastTick) * PointsPerTick; + CalculateSustainScore(stats); /* ProcessSustainScoring( lane, @@ -1747,19 +1745,13 @@ void gameplayRenderer::RenderEmhHighway(Player &player, Song song, double curSon DrawModel( gprAssets.emhHighwaySides, - Vector3 { 0, - 0, - player.HighwayLength < 1.0f ? -(highwayPosShit * (0.875f)) - : 0 }, + Vector3 { 0, 0, player.HighwayLength < 1.0f ? -(highwayPosShit * (0.875f)) : 0 }, 1.0f, WHITE ); DrawModel( gprAssets.emhHighway, - Vector3 { 0, - 0, - player.HighwayLength < 1.0f ? -(highwayPosShit * (0.875f)) - : 0 }, + Vector3 { 0, 0, player.HighwayLength < 1.0f ? -(highwayPosShit * (0.875f)) : 0 }, 1.0f, WHITE ); @@ -1900,10 +1892,17 @@ void gameplayRenderer::DrawBeatlines( Color BeatLineColor2 = { 255, 255, 255, 255 }; Vector3 SecondaryBeatlinePos = Vector3 { 0, yPos, minorPos - AddToFrontPos }; - beatline.materials[0].maps[MATERIAL_MAP_DIFFUSE].color = BeatLineColor2; - beatline.meshes[0].colors = (unsigned char *)ColorToInt(BeatLineColor2); + beatline.materials[0].maps[MATERIAL_MAP_DIFFUSE].color = + BeatLineColor2; + beatline.meshes[0].colors = + (unsigned char *)ColorToInt(BeatLineColor2); DrawModelEx( - beatline, SecondaryBeatlinePos, { 0 }, 0, { 1, 1, 0.5 }, BeatLineColor2 + beatline, + SecondaryBeatlinePos, + { 0 }, + 0, + { 1, 1, 0.5 }, + BeatLineColor2 ); } } @@ -2356,13 +2355,16 @@ void gameplayRenderer::RenderPDrumsNotes( if (curNote.pDrumAct && player.stats->overdriveFill >= 0.25 && !player.stats->Overdrive) { NoteScale.z = 2.0f; - BaseColor = ColorBrightness(GREEN, -0.25);; + BaseColor = ColorBrightness(GREEN, -0.25); + ; ColorColor = GREEN; WhiteColor = GREEN; } CymbalParts[mBASE].materials[0].maps[MATERIAL_MAP_DIFFUSE].color = BaseColor; - CymbalParts[mCOLOR].materials[0].maps[MATERIAL_MAP_DIFFUSE].color = ColorColor; - CymbalParts[mSIDES].materials[0].maps[MATERIAL_MAP_DIFFUSE].color = WhiteColor; + CymbalParts[mCOLOR].materials[0].maps[MATERIAL_MAP_DIFFUSE].color = + ColorColor; + CymbalParts[mSIDES].materials[0].maps[MATERIAL_MAP_DIFFUSE].color = + WhiteColor; CymbalParts[mBASE].materials[0].shader = gprAssets.HighwayFade; CymbalParts[mCOLOR].materials[0].shader = gprAssets.HighwayFade; CymbalParts[mSIDES].materials[0].shader = gprAssets.HighwayFade; diff --git a/Encore/src/gameplay/gameplayRenderer.h b/Encore/src/gameplay/gameplayRenderer.h index e23761c..39a8279 100644 --- a/Encore/src/gameplay/gameplayRenderer.h +++ b/Encore/src/gameplay/gameplayRenderer.h @@ -48,6 +48,7 @@ class gameplayRenderer { double curSongTime, std::vector::value_type &curNote ); + void CalculateSustainScore(PlayerGameplayStats *&stats); void RenderClassicNotes(Player &player, Chart &curChart, double curSongTime, float length); void DrawHitwindow(Player &player, float length); void RenderPDrumsNotes(Player &player, Chart &curChart, double curSongTime, float length); diff --git a/Encore/src/menus/GameplayMenu.cpp b/Encore/src/menus/GameplayMenu.cpp index 5e9b4a3..2e25f31 100644 --- a/Encore/src/menus/GameplayMenu.cpp +++ b/Encore/src/menus/GameplayMenu.cpp @@ -217,12 +217,12 @@ void GameplayMenu::Draw() { == stream.instrument) { audioManager.SetAudioStreamVolume( stream.handle, - player.stats->Mute ? TheGameSettings.MainVolume * TheGameSettings.MuteVolume - : TheGameSettings.MainVolume * TheGameSettings.ActiveInstrumentVolume + player.stats->Mute ? TheGameSettings.avMainVolume * TheGameSettings.avMuteVolume + : TheGameSettings.avMainVolume * TheGameSettings.avActiveInstrumentVolume ); } else { audioManager.SetAudioStreamVolume( - stream.handle, TheGameSettings.MainVolume * TheGameSettings.InactiveInstrumentVolume + stream.handle, TheGameSettings.avMainVolume * TheGameSettings.avInactiveInstrumentVolume ); } } diff --git a/Encore/src/menus/SettingsMenu.cpp b/Encore/src/menus/SettingsMenu.cpp index 9ed085b..d91af91 100644 --- a/Encore/src/menus/SettingsMenu.cpp +++ b/Encore/src/menus/SettingsMenu.cpp @@ -315,23 +315,23 @@ void SettingsMenu::Draw() { WHITE ); - MainVolume = - sor.sliderEntry(MainVolume, 0, 1, 1, "Main Volume", 0.05f); + avMainVolume = + sor.sliderEntry(avMainVolume, 0, 1, 1, "Main Volume", 0.05f); - ActiveInstrumentVolume = - sor.sliderEntry(ActiveInstrumentVolume, 0, 1, 2, "Active Instrument Volume", 0.05f); + avActiveInstrumentVolume = + sor.sliderEntry(avActiveInstrumentVolume, 0, 1, 2, "Active Instrument Volume", 0.05f); - InactiveInstrumentVolume = - sor.sliderEntry(InactiveInstrumentVolume, 0, 1, 3, "Inactive Instrument Volume", 0.05f); + avInactiveInstrumentVolume = + sor.sliderEntry(avInactiveInstrumentVolume, 0, 1, 3, "Inactive Instrument Volume", 0.05f); - SoundEffectVolume = - sor.sliderEntry(SoundEffectVolume, 0, 1, 4, "SFX Volume", 0.05f); + avSoundEffectVolume = + sor.sliderEntry(avSoundEffectVolume, 0, 1, 4, "SFX Volume", 0.05f); - MuteVolume = - sor.sliderEntry(MuteVolume, 0, 1, 5, "Miss Volume", 0.05f); + avMuteVolume = + sor.sliderEntry(avMuteVolume, 0, 1, 5, "Miss Volume", 0.05f); - MenuMusicVolume = - sor.sliderEntry(MenuMusicVolume, 0, 1, 6, "Menu Music Volume", 0.05f); + avMenuMusicVolume = + sor.sliderEntry(avMenuMusicVolume, 0, 1, 6, "Menu Music Volume", 0.05f); // player.selInstVolume = settingsMain.MainVolume * // settingsMain.PlayerVolume; player.otherInstVolume = diff --git a/Encore/src/menus/gameMenu.cpp b/Encore/src/menus/gameMenu.cpp index d7401b0..0d3d49a 100644 --- a/Encore/src/menus/gameMenu.cpp +++ b/Encore/src/menus/gameMenu.cpp @@ -206,7 +206,7 @@ void MainMenu::Load() { streamsLoaded = true; for (auto &stream : menuAudioManager.loadedStreams) { menuAudioManager.SetAudioStreamVolume( - stream.handle, TheGameSettings.MainVolume * 0.15f + stream.handle, TheGameSettings.avMainVolume * 0.15f ); } menuAudioManager.BeginPlayback(menuAudioManager.loadedStreams[0].handle); @@ -434,7 +434,7 @@ void MainMenu::Draw() { for (auto &stream : menuAudioManager.loadedStreams) { menuAudioManager.SetAudioStreamVolume( - stream.handle, TheGameSettings.MainVolume * TheGameSettings.MenuMusicVolume + stream.handle, TheGameSettings.avMainVolume * TheGameSettings.avMenuMusicVolume ); } float played = menuAudioManager.GetMusicTimePlayed(); diff --git a/Encore/src/settings.h b/Encore/src/settings.h index d7431b9..0f8c8f4 100644 --- a/Encore/src/settings.h +++ b/Encore/src/settings.h @@ -13,12 +13,12 @@ #include #define SETTINGS_OPTIONS \ - OPTION(float, MainVolume, 0.5f) \ - OPTION(float, ActiveInstrumentVolume, 0.75f) \ - OPTION(float, InactiveInstrumentVolume, 0.5f) \ - OPTION(float, SoundEffectVolume, 0.5f) \ - OPTION(float, MuteVolume, 0.15f) \ - OPTION(float, MenuMusicVolume, 0.15f) \ + OPTION(float, avMainVolume, 0.5f) \ + OPTION(float, avActiveInstrumentVolume, 0.75f) \ + OPTION(float, avInactiveInstrumentVolume, 0.5f) \ + OPTION(float, avSoundEffectVolume, 0.5f) \ + OPTION(float, avMuteVolume, 0.15f) \ + OPTION(float, avMenuMusicVolume, 0.15f) \ OPTION(bool, Fullscreen, false) \ OPTION(int, AudioOffset, 0) \ OPTION(bool, DiscordRichPresence, true) @@ -34,12 +34,12 @@ namespace Encore { NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE( Settings, - MainVolume, - ActiveInstrumentVolume, - InactiveInstrumentVolume, - SoundEffectVolume, - MuteVolume, - MenuMusicVolume, + avMainVolume, + avActiveInstrumentVolume, + avInactiveInstrumentVolume, + avSoundEffectVolume, + avMuteVolume, + avMenuMusicVolume, Fullscreen, AudioOffset, DiscordRichPresence,