Skip to content

Commit

Permalink
pad overdrive works again
Browse files Browse the repository at this point in the history
  • Loading branch information
3drosalia committed Dec 18, 2024
1 parent 24aec69 commit bee5e97
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 72 deletions.
88 changes: 45 additions & 43 deletions Encore/src/gameplay/gameplayRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -447,8 +450,7 @@ void gameplayRenderer::LoadGameplayAssets() {
std::array<std::array<Vector3, 4>, 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 },
Expand Down Expand Up @@ -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(
Expand All @@ -834,14 +833,16 @@ void gameplayRenderer::RenderPadNotes(
curNote.heldTime = curSongTime - curNote.time;
if (curNote.heldTime >= curNote.len)
curNote.heldTime = curNote.len;
CalculateSustainScore(stats);
/*
ProcessSustainScoring(
lane,
curNote.beatsLen,
curNote.heldTime,
curNote.len,
curNote.perfect,
stats
);
);*/
if (!stats->HeldFrets[lane] && !stats->HeldFretsAlt[lane]) {
curNote.held = false;
}
Expand All @@ -850,10 +851,6 @@ void gameplayRenderer::RenderPadNotes(
}
}

if (!curNote.held && curNote.hit) {
AddSustainPoints(lane, stats);
}

nDrawSustain(
curNote,
NoteColor,
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
);
Expand Down Expand Up @@ -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
);
}
}
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Encore/src/gameplay/gameplayRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class gameplayRenderer {
double curSongTime,
std::vector<Note>::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);
Expand Down
6 changes: 3 additions & 3 deletions Encore/src/menus/GameplayMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
}
Expand Down
24 changes: 12 additions & 12 deletions Encore/src/menus/SettingsMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
4 changes: 2 additions & 2 deletions Encore/src/menus/gameMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
24 changes: 12 additions & 12 deletions Encore/src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
#include <nlohmann/json.hpp>

#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)
Expand All @@ -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,
Expand Down

0 comments on commit bee5e97

Please sign in to comment.