Skip to content

Commit dfffa2e

Browse files
authored
Merge pull request #250 from Project-Funk-Engine/milestone-4
V1.1
2 parents 3285633 + c85439f commit dfffa2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1027
-304
lines changed

Classes/Events/EventDatabase.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class EventDatabase
1717
["EVENT_EVENT1_OPTION1", "EVENT_EVENT1_OPTION2", "EVENT_EVENT1_OPTION3"],
1818
["EVENT_EVENT1_OUTCOME1", "EVENT_EVENT1_OUTCOME2", "EVENT_EVENT1_OUTCOME3"],
1919
[
20-
(self, node) =>
20+
(self, _) =>
2121
{
2222
int randIndex = StageProducer.GlobalRng.RandiRange(
2323
0,
@@ -33,7 +33,7 @@ public class EventDatabase
3333
localizedName
3434
);
3535
},
36-
(self, node) =>
36+
(self, _) =>
3737
{
3838
int randIndex = StageProducer.GlobalRng.RandiRange(
3939
0,
@@ -49,12 +49,12 @@ public class EventDatabase
4949
localizedName
5050
);
5151
},
52-
(self, node) =>
52+
(self, _) =>
5353
{
5454
string stolenMoney = (StageProducer.PlayerStats.Money / 2).ToString();
5555
StageProducer.PlayerStats.Money /= 2;
5656

57-
self.OutcomeDescriptions[2] = self.OutcomeDescriptions[0] = string.Format(
57+
self.OutcomeDescriptions[2] = string.Format(
5858
TranslationServer.Translate("EVENT_EVENT1_OUTCOME3"),
5959
stolenMoney
6060
);
@@ -176,18 +176,18 @@ public class EventDatabase
176176
["EVENT_EVENT3_OPTION1", "EVENT_EVENT3_OPTION2", "EVENT_EVENT3_OPTION3"],
177177
["EVENT_EVENT3_OUTCOME1", "EVENT_EVENT3_OUTCOME2", "EVENT_EVENT3_OUTCOME3"],
178178
[
179-
(self, node) =>
179+
(_, _) =>
180180
{
181181
StageProducer.PlayerStats.CurrentHealth = Math.Min(
182182
StageProducer.PlayerStats.CurrentHealth + 10,
183183
StageProducer.PlayerStats.MaxHealth
184184
);
185185
},
186-
(self, node) =>
186+
(_, _) =>
187187
{
188188
StageProducer.PlayerStats.MaxComboBar -= 5;
189189
},
190-
(self, node) =>
190+
(_, _) =>
191191
{
192192
StageProducer.PlayerStats.Money -= 30;
193193
StageProducer.PlayerStats.AddNote(Scribe.NoteDictionary[3]);

Classes/MidiMaestro/MidiMaestro.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,12 @@ public partial class MidiMaestro : Resource
1515
private readonly NoteInfo[] _leftNotes;
1616
private readonly NoteInfo[] _rightNotes;
1717

18-
//private MidiFile strippedSong;
1918
/**
2019
* <summary>Constructor loads resource file and populates lane note arrays with NoteInfo</summary>
2120
* <param name="filePath">A string file path to a valid songMap .tres file</param>
2221
*/
2322
public MidiMaestro(NoteChart savedChart)
2423
{
25-
/*if (!OS.HasFeature("editor"))
26-
{
27-
filePath = OS.GetExecutablePath().GetBaseDir() + "/" + filePath;
28-
}
29-
30-
if (!FileAccess.FileExists(filePath))
31-
{
32-
GD.PushError("ERROR: Unable to load level songMap resource file: " + filePath);
33-
}
34-
35-
NoteChart savedChart = ResourceLoader.Load<NoteChart>(filePath);*/
36-
3724
if (savedChart != null)
3825
{
3926
_upNotes = savedChart.GetLane(ArrowType.Up).ToArray();
Lines changed: 1 addition & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* <summary>SaveSystem: Manages FileI/O of configs and save files.</summary>
99
*/
10-
public static class SaveSystem
10+
public static class Configkeeper
1111
{
1212
#region Config
1313
private const string UserConfigPath = "user://Options.cfg";
@@ -31,8 +31,6 @@ public static class SaveSystem
3131
private const bool DefaultTypeIsArrow = false;
3232
private const bool DefaultVerticalScroll = true;
3333
private const bool DefaultHighCon = false;
34-
private const bool DefaultFirstTime = true;
35-
private const bool DefaultHasWon = false;
3634

3735
public enum ConfigSettings
3836
{
@@ -53,8 +51,6 @@ public enum ConfigSettings
5351
LanguageKey,
5452
TypeIsArrow,
5553
HighContrast,
56-
FirstTime,
57-
HasWon,
5854
VerticalScroll,
5955
}
6056

@@ -81,8 +77,6 @@ private static void InitConfig()
8177
UpdateConfig(ConfigSettings.LanguageKey, DefaultLanguage);
8278
UpdateConfig(ConfigSettings.TypeIsArrow, DefaultTypeIsArrow);
8379
UpdateConfig(ConfigSettings.HighContrast, DefaultHighCon);
84-
UpdateConfig(ConfigSettings.FirstTime, DefaultFirstTime);
85-
UpdateConfig(ConfigSettings.HasWon, DefaultHasWon);
8680
UpdateConfig(ConfigSettings.VerticalScroll, DefaultVerticalScroll);
8781
}
8882

@@ -151,12 +145,6 @@ public static void UpdateConfig(ConfigSettings setting, Variant value)
151145
case ConfigSettings.HighContrast:
152146
_curConfigData.SetValue("Options", "HighContrast", value);
153147
break;
154-
case ConfigSettings.FirstTime:
155-
_curConfigData.SetValue("Game", "FirstTime", value);
156-
break;
157-
case ConfigSettings.HasWon:
158-
_curConfigData.SetValue("Game", "HasWon", value);
159-
break;
160148
default:
161149
GD.PushError("SaveSystem.UpdateConfig: Invalid config setting passed. " + setting);
162150
break;
@@ -298,10 +286,6 @@ public static Variant GetConfigValue(ConfigSettings setting)
298286
return _curConfigData.GetValue("Options", "VerticalScroll", DefaultVerticalScroll);
299287
case ConfigSettings.HighContrast:
300288
return _curConfigData.GetValue("Options", "HighContrast", DefaultHighCon);
301-
case ConfigSettings.FirstTime:
302-
return _curConfigData.GetValue("Game", "FirstTime", DefaultFirstTime);
303-
case ConfigSettings.HasWon:
304-
return _curConfigData.GetValue("Game", "HasWon", DefaultHasWon);
305289
default:
306290
GD.PushError("Invalid config setting passed. " + setting);
307291
return float.MinValue;
@@ -399,110 +383,4 @@ public static void ClearConfig()
399383
InitConfig();
400384
}
401385
#endregion
402-
403-
#region Save
404-
405-
private const string UserSavePath = "user://MidnighRiff.save";
406-
407-
public class SaveFile
408-
{
409-
public ulong RngSeed { get; init; }
410-
public ulong RngState { get; init; }
411-
public int LastRoomIdx { get; init; }
412-
public int Area { get; init; }
413-
414-
public int Money { get; init; }
415-
public int[] NoteIds { get; init; }
416-
public int[] RelicIds { get; init; }
417-
public int[] BattlePool { get; init; }
418-
public int[] EventPool { get; init; }
419-
public int PlayerHealth { get; init; }
420-
public int Shortcuts { get; init; }
421-
public int PlayerMaxCombo { get; init; }
422-
423-
public SaveFile(
424-
ulong rngSeed,
425-
ulong rngState,
426-
int lastRoomIdx,
427-
int[] noteIds,
428-
int[] relicIds,
429-
int[] battlePool,
430-
int[] eventPool,
431-
int playerHealth,
432-
int area,
433-
int money,
434-
int shortcuts,
435-
int playerMaxCombo
436-
)
437-
{
438-
RngSeed = rngSeed;
439-
RngState = rngState;
440-
LastRoomIdx = lastRoomIdx;
441-
NoteIds = noteIds;
442-
RelicIds = relicIds;
443-
BattlePool = battlePool ?? [];
444-
EventPool = eventPool ?? [];
445-
PlayerHealth = playerHealth;
446-
Area = area;
447-
Money = money;
448-
Shortcuts = shortcuts;
449-
PlayerMaxCombo = playerMaxCombo;
450-
}
451-
}
452-
453-
public static void SaveGame()
454-
{
455-
int[] relicIds = StageProducer.PlayerStats.CurRelics.Select(r => r.Id).ToArray();
456-
int[] noteIds = StageProducer.PlayerStats.CurNotes.Select(r => r.Id).ToArray();
457-
SaveFile sv = new SaveFile(
458-
StageProducer.GlobalRng.Seed,
459-
StageProducer.GlobalRng.State,
460-
StageProducer.CurRoom,
461-
noteIds,
462-
relicIds,
463-
StageProducer.BattlePool?.ToArray(),
464-
EventScene.EventPool?.ToArray(),
465-
StageProducer.PlayerStats.CurrentHealth,
466-
StageProducer.CurLevel.Id,
467-
StageProducer.PlayerStats.Money,
468-
StageProducer.PlayerStats.Shortcuts,
469-
StageProducer.PlayerStats.MaxComboBar
470-
);
471-
string json = JsonSerializer.Serialize(sv);
472-
473-
FileAccess file = FileAccess.Open(UserSavePath, FileAccess.ModeFlags.Write);
474-
475-
file.StoreLine(json);
476-
file.Close();
477-
}
478-
479-
/**
480-
* <remarks>Returns null if invalid save or save 404's.</remarks>
481-
*/
482-
public static SaveFile LoadGame()
483-
{
484-
if (!FileAccess.FileExists(UserSavePath))
485-
return null;
486-
FileAccess file = FileAccess.Open(UserSavePath, FileAccess.ModeFlags.Read);
487-
string json = file.GetAsText();
488-
489-
file.Close();
490-
SaveFile sv;
491-
try
492-
{
493-
sv = JsonSerializer.Deserialize<SaveFile>(json);
494-
}
495-
catch (JsonException)
496-
{
497-
GD.PushWarning("Cannot deserialize save file, returning null.");
498-
return null;
499-
}
500-
return sv;
501-
}
502-
503-
public static void ClearSave()
504-
{
505-
DirAccess.RemoveAbsolute(UserSavePath);
506-
}
507-
#endregion
508386
}

Globals/Configkeeper.cs.uid

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://bbkyrplc17j0w

0 commit comments

Comments
 (0)