Skip to content

Commit ffc2a4a

Browse files
committed
more thoroughly deprecate settings-old.h
1 parent f7c4c12 commit ffc2a4a

25 files changed

+319
-229
lines changed

Encore/src/keybinds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
#include "raylib.h"
33
#include "GLFW/glfw3.h"
4-
#include "settings-old.h"
4+
#include "settings/settings-old.h"
55
#include <unordered_map>
66
#include <string>
77

Encore/src/main.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "util/enclog.h"
77
#include "gameplay/enctime.h"
88
#include <cassert>
9+
10+
#include "settings/keybinds.h"
911
#define assertm(exp, msg) assert((void(msg), exp))
1012

1113
#define RAYGUI_IMPLEMENTATION
@@ -34,8 +36,8 @@
3436

3537
#include "menus/uiUnits.h"
3638

37-
#include "settings.h"
38-
#include "settings-old.h"
39+
#include "settings/settings.h"
40+
// #include "settings-old.h"
3941
#include "menus/SettingsAudioVideo.h"
4042
#include "menus/SettingsController.h"
4143
#include "menus/SettingsCredits.h"
@@ -54,6 +56,7 @@ PlayerManager ThePlayerManager;
5456
Assets &assets = Assets::getInstance();
5557
Encore::AudioManager TheAudioManager;
5658
Encore::Settings TheGameSettings;
59+
Encore::Keybinds TheGameKeybinds;
5760
Encore::SettingsGameplay TheGameplaySettings;
5861
Encore::SettingsAudioVideo TheAudioVideoSettings;
5962
Encore::SettingsController TheControllerSettings;

Encore/src/menus/GameplayMenu.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
#include "users/playerManager.h"
2020
#include "MenuManager.h"
2121
#include "OvershellHelper.h"
22-
#include "settings-old.h"
23-
#include "settings.h"
22+
// #include "settings-old.h"
23+
#include "../settings/settings.h"
2424
#include "timingvalues.h"
2525

2626
#include <raylib.h>
2727

28+
#include "settings/keybinds.h"
29+
2830
GameplayMenu::GameplayMenu() {}
2931
GameplayMenu::~GameplayMenu() {}
3032

@@ -58,7 +60,7 @@ void GameplayMenu::KeyboardInputCallback(int key, int scancode, int action, int
5860
Player &player = ThePlayerManager.GetActivePlayer(0);
5961
Encore::RhythmEngine::BaseEngine *engine = player.engine.get();
6062
Encore::RhythmEngine::BaseStats<5> *stats = engine->stats.get();
61-
SettingsOld &settingsMain = SettingsOld::getInstance();
63+
// SettingsOld &settingsMain = SettingsOld::getInstance();
6264

6365
if (action == 2)
6466
return;
@@ -80,18 +82,18 @@ void GameplayMenu::KeyboardInputCallback(int key, int scancode, int action, int
8082
} else if (action == GLFW_RELEASE) {
8183
REaction = Encore::RhythmEngine::Action::RELEASE;
8284
}
83-
if (key == settingsMain.keybindOverdrive || key == settingsMain.keybindOverdriveAlt) {
85+
if (key == TheGameKeybinds.overdriveBinds.first || key == TheGameKeybinds.overdriveBinds.second) {
8486
Channel = Encore::RhythmEngine::InputChannel::OVERDRIVE;
8587
} else if (player.ClassicMode) {
86-
if (key == settingsMain.keybindStrumUp) {
88+
if (key == TheGameKeybinds.strumBinds.first) {
8789
Channel = Encore::RhythmEngine::InputChannel::STRUM_UP;
88-
} else if (key == settingsMain.keybindStrumDown) {
90+
} else if (key == TheGameKeybinds.strumBinds.second) {
8991
Channel = Encore::RhythmEngine::InputChannel::STRUM_DOWN;
9092
}
9193
}
9294
int DiffMax = (player.Difficulty == 3 || player.ClassicMode) ? 5 : 4;
9395
for (int i = 0; i < DiffMax; i++) {
94-
if (key == settingsMain.keybinds5K[i] || key == settingsMain.keybinds5KAlt[i]) {
96+
if (key == TheGameKeybinds.keybinds5k[i] || key == TheGameKeybinds.keybinds5kalt[i]) {
9597
Channel = Encore::RhythmEngine::IntIC(i);
9698
}
9799
}
@@ -106,7 +108,7 @@ void GameplayMenu::ControllerInputCallback(int joypadID, GLFWgamepadstate state)
106108
Player &player = ThePlayerManager.GetActivePlayer(0);
107109
Encore::RhythmEngine::BaseEngine *engine = player.engine.get();
108110
Encore::RhythmEngine::BaseStats<5> *stats = engine->stats.get();
109-
SettingsOld &settingsMain = SettingsOld::getInstance();
111+
// SettingsOld &settingsMain = SettingsOld::getInstance();
110112

111113
// if (player.Bot)
112114
// return;

Encore/src/menus/MenuManager.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#include "menu.h"
1616
#include "raygui.h"
1717
#include "resultsMenu.h"
18-
#include "settings-old.h"
19-
#include "settings.h"
18+
// #include "settings-old.h"
19+
#include "settings/settings.h"
2020
#include "sndTestMenu.h"
2121
#include "gameplay/inputCallbacks.h"
2222
#include "song/audio.h"
@@ -25,6 +25,8 @@
2525

2626
#include <cstddef>
2727

28+
#include "settings/keybinds.h"
29+
2830
void MenuManager::SwitchScreen(Screens screen) {
2931
currentScreen = screen;
3032
onNewMenu = true;
@@ -148,7 +150,7 @@ float inputFeedbackAlpha = 1.0f;
148150
void MenuManager::DrawMenu() {
149151
switch (TheMenuManager.currentScreen) {
150152
case CALIBRATION: {
151-
SettingsOld &settingsMain = SettingsOld::getInstance();
153+
// SettingsOld &settingsMain = SettingsOld::getInstance();
152154
Units &u = Units::getInstance();
153155
Assets &assets = Assets::getInstance();
154156

@@ -188,7 +190,7 @@ void MenuManager::DrawMenu() {
188190
+ calibrationStartTime;
189191
totalDifference += (tapTime - expectedClickTime);
190192
}
191-
settingsMain.avOffsetMS = 0;
193+
TheGameSettings.AudioOffset = 0;
192194
static_cast<int>((totalDifference / tapTimes.size()) * 1000);
193195
// Convert to milliseconds
194196
std::cout
@@ -210,7 +212,7 @@ void MenuManager::DrawMenu() {
210212
std::cout << "Click" << std::endl;
211213
}
212214

213-
if (IsKeyPressed(settingsMain.keybindOverdrive)) {
215+
if (IsKeyPressed(TheGameKeybinds.overdriveBinds.first)) {
214216
tapTimes.push_back(currentTime);
215217
std::cout << "Input Registered" << std::endl;
216218

@@ -253,11 +255,11 @@ void MenuManager::DrawMenu() {
253255
"Cancel"
254256
)) {
255257
isCalibrating = false;
256-
settingsMain.avOffsetMS = settingsMain.prevAvOffsetMS;
257-
settingsMain.inputOffsetMS = settingsMain.prevInputOffsetMS;
258+
// TheGameSettings.AudioOffset = settingsMain.prevAvOffsetMS;
259+
// settingsMain.inputOffsetMS = settingsMain.prevInputOffsetMS;
258260
tapTimes.clear();
259261

260-
settingsMain.saveSettings(settingsMain.getDirectory() / "settings.json");
262+
TheGameSettings.SaveToFile((TheGameSettings.directory / "settings.json").string());
261263
TheMenuManager.SwitchScreen(SETTINGS);
262264
}
263265

@@ -269,11 +271,11 @@ void MenuManager::DrawMenu() {
269271
"Apply"
270272
)) {
271273
isCalibrating = false;
272-
settingsMain.prevAvOffsetMS = settingsMain.avOffsetMS;
273-
settingsMain.prevInputOffsetMS = settingsMain.inputOffsetMS;
274+
// settingsMain.prevAvOffsetMS = settingsMain.avOffsetMS;
275+
// settingsMain.prevInputOffsetMS = settingsMain.inputOffsetMS;
274276
tapTimes.clear();
275277

276-
settingsMain.saveSettings(settingsMain.getDirectory() / "settings.json");
278+
TheGameSettings.SaveToFile((TheGameSettings.directory / "settings.json").string());
277279
TheMenuManager.SwitchScreen(SETTINGS);
278280
}
279281

Encore/src/menus/SettingsAudioVideo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "gameMenu.h"
99
#include "raygui.h"
1010
#include "assets.h"
11-
#include "settings.h"
11+
#include "settings/settings.h"
1212
#include "settingsOptionRenderer.h"
1313
#include "uiUnits.h"
1414
#include "gameplay/enctime.h"
@@ -33,7 +33,7 @@ bool VerticalSync = false;
3333
void SettingsAudioVideo::Draw() {
3434
Units &u = Units::getInstance();
3535
Assets &assets = Assets::getInstance();
36-
SettingsOld &settingsMain = SettingsOld::getInstance();
36+
// SettingsOld &settingsMain = SettingsOld::getInstance();
3737
SongTime &enctime = TheSongTime;
3838
settingsOptionRenderer sor;
3939

Encore/src/menus/SettingsAudioVideo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#pragma once
55

66
#include "menu.h"
7-
#include "settings.h"
7+
#include "settings/settings.h"
88
#include "assets.h"
99
#include "OvershellMenu.h"
1010

Encore/src/menus/SettingsController.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
static const std::vector<std::string> presets = {
1414
"Thumb", "Thumb & Index", "Index & Middle"
1515
};
16-
16+
// TODO: fuck my ass
1717
void SettingsController::resetToDefaultKeys() {
18+
/*
1819
settings.controller4K = settings.defaultController4K;
1920
settings.controller5K = settings.defaultController5K;
2021
settings.controllerOverdrive = settings.defaultControllerOverdrive;
@@ -38,9 +39,11 @@ void SettingsController::resetToDefaultKeys() {
3839
}
3940
settings.syncKeybindsToGame();
4041
TraceLog(LOG_INFO, "Reset controller bindings to defaults");
42+
*/
4143
}
4244

4345
void SettingsController::applyPreset(int presetIndex) { // i fixed this in the most janky way possible
46+
/*
4447
switch (presetIndex) {
4548
case 0: // Thumb
4649
settings.controller4K = settings.defaultController4K;
@@ -91,13 +94,14 @@ void SettingsController::applyPreset(int presetIndex) { // i fixed this in the m
9194
}
9295
settings.syncKeybindsToGame();
9396
TraceLog(LOG_INFO, "Applied preset: %s", presets[presetIndex].c_str());
97+
*/
9498
}
9599

96100
void SettingsController::Draw() {
97101
static bool dropdownActive = false;
98102
static int selectedPreset = 0;
99-
TraceLog(LOG_INFO, "SettingsController::Draw entered, options.size=%zu, selectedIndex=%d",
100-
options.size(), selectedIndex);
103+
// TraceLog(LOG_INFO, "SettingsController::Draw entered, options.size=%zu, selectedIndex=%d",
104+
// options.size(), selectedIndex);
101105
if (!TheSongList.curSong) {
102106
TraceLog(LOG_ERROR, "TheSongList.curSong is null");
103107
Units& u = Units::getInstance();
@@ -216,7 +220,7 @@ void SettingsController::Draw() {
216220

217221
Vector2 mousePos = GetMousePosition();
218222
isHovering = false;
219-
223+
/*
220224
TraceLog(LOG_INFO, "Rendering %zu controller entries", options.size());
221225
for (size_t i = 0; i < options.size(); ++i) {
222226
float optionTop = EntryTop + (EntryHeight + verticalGap) * i;
@@ -269,7 +273,7 @@ void SettingsController::Draw() {
269273
if (!isHovering) {
270274
selectedIndex = 0;
271275
}
272-
276+
*/
273277
GameMenu::DrawBottomOvershell();
274278
DrawOvershell();
275279
}
@@ -335,6 +339,7 @@ void SettingsController::KeyboardInputCallback(int key, int scancode, int action
335339
}
336340

337341
void SettingsController::ControllerInputCallback(int joypadID, GLFWgamepadstate state) {
342+
/*
338343
static GLFWgamepadstate prevState;
339344
static std::vector<float> debounceTimers(GLFW_GAMEPAD_AXIS_LAST + 1, 0.0f);
340345
const float debounceTime = 0.2f;
@@ -408,9 +413,11 @@ void SettingsController::ControllerInputCallback(int joypadID, GLFWgamepadstate
408413
TheMenuManager.SwitchScreen(SETTINGS);
409414
}
410415
prevState = state;
416+
*/
411417
}
412418

413419
void SettingsController::Load() {
420+
/*
414421
TraceLog(LOG_INFO, "SettingsController: Loaded controller binds from settings-old.json");
415422
TraceLog(LOG_INFO, "Controller Type: %d", settings.controllerType);
416423
TraceLog(LOG_INFO, "4K Controller: [%d, %d, %d, %d]",
@@ -435,7 +442,7 @@ void SettingsController::Load() {
435442
options.emplace_back("5K Lane 5", &settings.controller5K[4]);
436443
options.emplace_back("Overdrive", &settings.controllerOverdrive);
437444
options.emplace_back("Pause", &settings.controllerPause);
438-
445+
*/
439446
sidebarContents = {
440447
{"Controller Bindings", "Configure your controller bindings"},
441448
{"4K Lane 1", "TBA"},
@@ -453,7 +460,7 @@ void SettingsController::Load() {
453460
}
454461

455462
void SettingsController::Save() {
456-
settings.saveOldSettings(settings.getDirectory() / "settings-old.json");
457-
settings.syncKeybindsToGame();
463+
// settings.saveOldSettings(settings.getDirectory() / "settings-old.json");
464+
// settings.syncKeybindsToGame();
458465
TraceLog(LOG_INFO, "SettingsController: Saved controller binds to settings-old.json");
459466
}

Encore/src/menus/SettingsController.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#pragma once
55

66
#include "OvershellMenu.h"
7-
#include "settings-old.h"
7+
// #include "../settings/settings-old.h"
88
#include "keybinds.h"
99
#include <string>
1010
#include <utility>
@@ -32,14 +32,15 @@ class SettingsController : public OvershellMenu {
3232
void Save();
3333

3434
private:
35-
SettingsOld& settings = SettingsOld::getInstance();
35+
// SettingsOld& settings = SettingsOld::getInstance();
3636
Keybinds keybinds;
3737
int selectedIndex = 0;
3838
int bindingOption = -1;
3939
bool dropdownActive = false;
4040
int selectedPreset = 0;
4141
bool isHovering = false;
4242
const float boxWidthPct = 0.55f;
43+
/*
4344
std::vector<std::pair<std::string, int*>> options = {
4445
{"4K Lane 1", &settings.controller4K[0]},
4546
{"4K Lane 2", &settings.controller4K[1]},
@@ -52,7 +53,7 @@ class SettingsController : public OvershellMenu {
5253
{"5K Lane 5", &settings.controller5K[4]},
5354
{"Overdrive", &settings.controllerOverdrive},
5455
{"Pause", &settings.controllerPause}
55-
};
56+
};*/
5657
struct SidebarContent {
5758
const char* header;
5859
const char* body;

Encore/src/menus/SettingsCredits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#pragma once
66

77
#include "menu.h"
8-
#include "settings.h"
8+
#include "settings/settings.h"
99
#include "assets.h"
1010
#include "OvershellMenu.h"
1111

0 commit comments

Comments
 (0)