@ -96,7 +96,10 @@ void GameSettings::Initialize(){
std : : string loadSystemFilename = " save_file_path " _S + " system.conf " ;
std : : string loadSystemFilename = " save_file_path " _S + " system.conf " ;
if ( std : : filesystem : : exists ( loadSystemFilename ) ) utils : : datafile : : Read ( loadSystemFile , loadSystemFilename ) ;
if ( std : : filesystem : : exists ( loadSystemFilename ) ) {
std : : cout < < " Reading system data file... " < < std : : endl ;
utils : : datafile : : Read ( loadSystemFile , loadSystemFilename ) ;
}
if ( loadSystemFile . HasProperty ( " Screen Shake " ) ) {
if ( loadSystemFile . HasProperty ( " Screen Shake " ) ) {
GameSettings : : SetScreenShake ( loadSystemFile [ " Screen Shake " ] . GetBool ( ) ) ;
GameSettings : : SetScreenShake ( loadSystemFile [ " Screen Shake " ] . GetBool ( ) ) ;
@ -129,23 +132,29 @@ void GameSettings::Initialize(){
if ( loadSystemFile . HasProperty ( " SFX Level " ) ) Audio : : SetSFXVolume ( loadSystemFile [ " SFX Level " ] . GetReal ( ) ) ;
if ( loadSystemFile . HasProperty ( " SFX Level " ) ) Audio : : SetSFXVolume ( loadSystemFile [ " SFX Level " ] . GetReal ( ) ) ;
# pragma region Load up Menu Keybinds
# pragma region Load up Menu Keybinds
//NOTE: We are shadowing code from InputKeyboardWindow! If at some point the retrival method for getting input displays changes, we likely will be changing the code here as well!
//ALSO NOTE: The menu inputs are saved to the system file while gameplay inputs are per-character and saved to the character settings file!
const int menuRowCount = DATA . GetProperty ( " Inputs.Menu Input Names " ) . GetValueCount ( ) % 2 = = 0 ? DATA . GetProperty ( " Inputs.Menu Input Names " ) . GetValueCount ( ) / 2 : DATA . GetProperty ( " Inputs.Menu Input Names " ) . GetValueCount ( ) / 2 + 1 ;
const int menuRowCount = DATA . GetProperty ( " Inputs.Menu Input Names " ) . GetValueCount ( ) % 2 = = 0 ? DATA . GetProperty ( " Inputs.Menu Input Names " ) . GetValueCount ( ) / 2 : DATA . GetProperty ( " Inputs.Menu Input Names " ) . GetValueCount ( ) / 2 + 1 ;
const int menuColCount = 2 ;
const int menuColCount = 2 ;
for ( int row = 0 ; row < menuRowCount ; row + + ) {
for ( int row = 0 ; row < menuRowCount ; row + + ) {
for ( int col = 0 ; col < menuColCount ; col + + ) {
for ( int col = 0 ; col < menuColCount ; col + + ) {
int inputID = row * menuColCount + col ;
int inputID = row * menuColCount + col ;
if ( DATA . GetProperty ( " Inputs.Menu Input Names " ) . GetValueCount ( ) % 2 = = 1 & & col = = 1 & & row = = menuRowCount - 1 ) continue ; //We only continue on a blank space when we have an odd number of elements.
if ( DATA . GetProperty ( " Inputs.Menu Input Names " ) . GetValueCount ( ) % 2 = = 1 & & col = = 1 & & row = = menuRowCount - 1 ) continue ; //We only continue on a blank space when we have an odd number of elements.
if ( loadSystemFile . HasProperty ( " Menu Keyboard Input_ " + " Inputs.Menu Input Names " _s [ inputID ] ) ) {
std : : string keyName = " Menu Keyboard Input_ " + " Inputs.Menu Input Names " _s [ inputID ] ;
std : : string keyName = " Menu Keyboard Input_ " + " Inputs.Menu Input Names " _s [ inputID ] ;
if ( loadSystemFile . HasProperty ( keyName ) ) {
if ( loadSystemFile . HasProperty ( keyName ) ) {
InputGroup & group = Component < InputDisplayComponent > ( INPUT_KEY_DISPLAY , std : : format ( " Input_{}_{} Input Displayer " , row , col ) ) - > GetInput ( ) ;
InputGroup & group = Component < InputDisplayComponent > ( INPUT_KEY_DISPLAY , std : : format ( " Input_{}_{} Input Displayer " , row , col ) ) - > GetInput ( ) ;
group . SetNewPrimaryKeybind ( { KEY , loadSystemFile [ keyName ] . GetInt ( ) } ) ;
group . SetNewPrimaryKeybind ( { KEY , loadSystemFile [ keyName ] . GetInt ( ) } ) ;
}
}
keyName = " Menu Controller Input_ " + " Inputs.Menu Input Names " _s [ inputID ] ;
}
if ( loadSystemFile . HasProperty ( " Menu Controller Input_ " + " Inputs.Menu Input Names " _s [ inputID ] ) ) {
std : : string keyName = " Menu Controller Input_ " + " Inputs.Menu Input Names " _s [ inputID ] ;
if ( loadSystemFile . HasProperty ( keyName ) ) {
if ( loadSystemFile . HasProperty ( keyName ) ) {
InputGroup & group = Component < InputDisplayComponent > ( INPUT_KEY_DISPLAY , std : : format ( " Input_{}_{} Input Displayer " , row , col ) ) - > GetInput ( ) ;
InputGroup & group = Component < InputDisplayComponent > ( INPUT_KEY_DISPLAY , std : : format ( " Input_{}_{} Input Displayer " , row , col ) ) - > GetInput ( ) ;
group . SetNewPrimaryKeybind ( { CONTROLLER , loadSystemFile [ keyName ] . GetInt ( ) } ) ;
group . SetNewPrimaryKeybind ( { CONTROLLER , loadSystemFile [ keyName ] . GetInt ( ) } ) ;
}
}
}
}
}
}
}
# pragma endregion
# pragma endregion
}
}