- Updated options system
This commit is contained in:
wagic.the.homebrew
2009-01-29 13:35:19 +00:00
parent f5693e0b6f
commit b14e6c318e
11 changed files with 74 additions and 32 deletions
+1 -1
View File
@@ -733,7 +733,7 @@ class AManaProducer: public MTGAbility{
}
if (GameOptions::GetInstance()->values[OPTIONS_SFXVOLUME] > 0 && currentlyTapping < 3){
if (GameOptions::GetInstance()->values[OPTIONS_SFXVOLUME].getIntValue() > 0 && currentlyTapping < 3){
JSample * sample = SampleCache::GetInstance()->getSample("sound/sfx/mana.wav");
if (sample) JSoundSystem::GetInstance()->PlaySample(sample);
}
+22 -5
View File
@@ -1,25 +1,42 @@
#ifndef _GAME_OPTIONS_H_
#define _GAME_OPTIONS_H_
#include <map>
#include <string>
using std::map;
using std::string;
#define OPTIONS_MUSICVOLUME "musicVolume"
#define OPTIONS_SFXVOLUME "sfxVolume"
#define MAX_OPTIONS 50
#define OPTIONS_MUSICVOLUME 0
#define OPTIONS_SFXVOLUME 1
#define OPTIONS_INTERRUPTATENDOFPHASE_OFFSET 2
#define OPTIONS_SAVEFILE RESPATH"/settings/options.txt"
class GameOption {
public:
int value;
string svalue;
int getIntValue();
GameOption(int _value = 0);
};
class GameOptions {
public:
int values[MAX_OPTIONS];
map<string,GameOption> values;
static GameOptions * GetInstance();
static void Destroy();
int save();
int load();
static const char * phaseInterrupts[];
private:
GameOptions();
~GameOptions();
static GameOptions* mInstance;
static map <string,int> optionsTypes;
};
#endif
+1 -1
View File
@@ -200,7 +200,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
}
welcome_menu->Add(10, "Cancel");
if (GameApp::HasMusic && GameOptions::GetInstance()->values[OPTIONS_MUSICVOLUME] > 0){
if (GameApp::HasMusic && GameOptions::GetInstance()->values[OPTIONS_MUSICVOLUME].getIntValue() > 0){
if (GameApp::music){
JSoundSystem::GetInstance()->StopMusic(GameApp::music);
SAFE_DELETE(GameApp::music);
+3 -3
View File
@@ -8,12 +8,12 @@ using std::string;
class OptionItem:public JGuiObject{
public:
string displayValue;
int id, value;
string displayValue, id;
int value;
int hasFocus;
int maxValue, increment;
float x, y;
OptionItem(int id, string _displayValue, int _maxValue = 1, int _increment = 1);
OptionItem(string _id, string _displayValue, int _maxValue = 1, int _increment = 1);
~OptionItem();
virtual void Render();