Formatting cleanup. No code changes here.
This commit is contained in:
@@ -24,261 +24,382 @@ class Player;
|
|||||||
class GameApp;
|
class GameApp;
|
||||||
|
|
||||||
|
|
||||||
class Options {
|
class Options
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
friend class GameSettings;
|
friend class GameSettings;
|
||||||
enum {
|
enum
|
||||||
//Global settings
|
{
|
||||||
ACTIVE_PROFILE,
|
//Global settings
|
||||||
LANG,
|
ACTIVE_PROFILE,
|
||||||
LAST_GLOBAL = LANG, //This must be the value above, to keep ordering.
|
LANG,
|
||||||
//Values /must/ match ordering in optionNames, or everything loads wrong.
|
LAST_GLOBAL = LANG, //This must be the value above, to keep ordering.
|
||||||
//Profile settings
|
//Values /must/ match ordering in optionNames, or everything loads wrong.
|
||||||
ACTIVE_THEME,
|
//Profile settings
|
||||||
ACTIVE_MODE,
|
ACTIVE_THEME,
|
||||||
MUSICVOLUME,
|
ACTIVE_MODE,
|
||||||
SFXVOLUME,
|
MUSICVOLUME,
|
||||||
DIFFICULTY,
|
SFXVOLUME,
|
||||||
CHEATMODE,
|
DIFFICULTY,
|
||||||
OPTIMIZE_HAND,
|
CHEATMODE,
|
||||||
CHEATMODEAIDECK,
|
OPTIMIZE_HAND,
|
||||||
OSD,
|
CHEATMODEAIDECK,
|
||||||
CLOSEDHAND,
|
OSD,
|
||||||
HANDDIRECTION,
|
CLOSEDHAND,
|
||||||
MANADISPLAY,
|
HANDDIRECTION,
|
||||||
REVERSETRIGGERS,
|
MANADISPLAY,
|
||||||
DISABLECARDS,
|
REVERSETRIGGERS,
|
||||||
MAX_GRADE,
|
DISABLECARDS,
|
||||||
ASPHASES,
|
MAX_GRADE,
|
||||||
FIRSTPLAYER,
|
ASPHASES,
|
||||||
ECON_DIFFICULTY,
|
FIRSTPLAYER,
|
||||||
TRANSITIONS,
|
ECON_DIFFICULTY,
|
||||||
GUI_STYLE,
|
TRANSITIONS,
|
||||||
INTERRUPT_SECONDS,
|
GUI_STYLE,
|
||||||
KEY_BINDINGS,
|
INTERRUPT_SECONDS,
|
||||||
AIDECKS_UNLOCKED,
|
KEY_BINDINGS,
|
||||||
//My interrupts
|
AIDECKS_UNLOCKED,
|
||||||
INTERRUPTMYSPELLS,
|
//My interrupts
|
||||||
INTERRUPTMYABILITIES,
|
INTERRUPTMYSPELLS,
|
||||||
SAVEDETAILEDDECKINFO,
|
INTERRUPTMYABILITIES,
|
||||||
//Other interrupts
|
SAVEDETAILEDDECKINFO,
|
||||||
INTERRUPT_BEFOREBEGIN,
|
//Other interrupts
|
||||||
INTERRUPT_UNTAP,
|
INTERRUPT_BEFOREBEGIN,
|
||||||
INTERRUPT_UPKEEP,
|
INTERRUPT_UNTAP,
|
||||||
INTERRUPT_DRAW,
|
INTERRUPT_UPKEEP,
|
||||||
INTERRUPT_FIRSTMAIN,
|
INTERRUPT_DRAW,
|
||||||
INTERRUPT_BEGINCOMBAT,
|
INTERRUPT_FIRSTMAIN,
|
||||||
INTERRUPT_ATTACKERS,
|
INTERRUPT_BEGINCOMBAT,
|
||||||
INTERRUPT_BLOCKERS,
|
INTERRUPT_ATTACKERS,
|
||||||
INTERRUPT_DAMAGE,
|
INTERRUPT_BLOCKERS,
|
||||||
INTERRUPT_ENDCOMBAT,
|
INTERRUPT_DAMAGE,
|
||||||
INTERRUPT_SECONDMAIN,
|
INTERRUPT_ENDCOMBAT,
|
||||||
INTERRUPT_ENDTURN,
|
INTERRUPT_SECONDMAIN,
|
||||||
INTERRUPT_CLEANUP,
|
INTERRUPT_ENDTURN,
|
||||||
INTERRUPT_AFTEREND,
|
INTERRUPT_CLEANUP,
|
||||||
BEGIN_AWARDS, //Options after this use the GameOptionAward struct, which includes a timestamp.
|
INTERRUPT_AFTEREND,
|
||||||
DIFFICULTY_MODE_UNLOCKED = BEGIN_AWARDS,
|
BEGIN_AWARDS, //Options after this use the GameOptionAward struct, which includes a timestamp.
|
||||||
MOMIR_MODE_UNLOCKED,
|
DIFFICULTY_MODE_UNLOCKED = BEGIN_AWARDS,
|
||||||
EVILTWIN_MODE_UNLOCKED,
|
MOMIR_MODE_UNLOCKED,
|
||||||
RANDOMDECK_MODE_UNLOCKED,
|
EVILTWIN_MODE_UNLOCKED,
|
||||||
AWARD_COLLECTOR,
|
RANDOMDECK_MODE_UNLOCKED,
|
||||||
LAST_NAMED, //Any option after this does not look up in optionNames.
|
AWARD_COLLECTOR,
|
||||||
SET_UNLOCKS = LAST_NAMED + 1, //For sets.
|
LAST_NAMED, //Any option after this does not look up in optionNames.
|
||||||
|
SET_UNLOCKS = LAST_NAMED + 1, //For sets.
|
||||||
|
};
|
||||||
|
|
||||||
};
|
static int optionSet(int setID);
|
||||||
|
static int optionInterrupt(int gamePhase);
|
||||||
static int optionSet(int setID);
|
|
||||||
static int optionInterrupt(int gamePhase);
|
|
||||||
|
|
||||||
static int getID(string name);
|
static int getID(string name);
|
||||||
static string getName(int option);
|
static string getName(int option);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const string optionNames[];
|
static const string optionNames[];
|
||||||
};
|
};
|
||||||
|
|
||||||
class GameOption {
|
class GameOption
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~GameOption() {};
|
virtual ~GameOption()
|
||||||
int number;
|
{
|
||||||
string str;
|
}
|
||||||
//All calls to asColor should include a fallback color for people without a theme.
|
|
||||||
PIXEL_TYPE asColor(PIXEL_TYPE fallback = ARGB(255,255,255,255));
|
|
||||||
|
|
||||||
virtual bool isDefault(); //Returns true when number is 0 and string is "" or "Default"
|
int number;
|
||||||
virtual string menuStr(); //The string we'll use for GameStateOptions.
|
string str;
|
||||||
virtual bool write(std::ofstream * file, string name);
|
//All calls to asColor should include a fallback color for people without a theme.
|
||||||
virtual bool read(string input);
|
PIXEL_TYPE asColor(PIXEL_TYPE fallback = ARGB(255,255,255,255));
|
||||||
|
|
||||||
GameOption(int value = 0);
|
virtual bool isDefault(); //Returns true when number is 0 and string is "" or "Default"
|
||||||
GameOption(string);
|
virtual string menuStr(); //The string we'll use for GameStateOptions.
|
||||||
GameOption(int, string);
|
virtual bool write(std::ofstream * file, string name);
|
||||||
|
virtual bool read(string input);
|
||||||
|
|
||||||
|
GameOption(int value = 0);
|
||||||
|
GameOption(string);
|
||||||
|
GameOption(int, string);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EnumDefinition {
|
struct EnumDefinition
|
||||||
int findIndex(int value);
|
{
|
||||||
|
int findIndex(int value);
|
||||||
|
|
||||||
typedef pair<int, string> assoc;
|
typedef pair<int, string> assoc;
|
||||||
vector<assoc> values;
|
vector<assoc> values;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GameOptionEnum: public GameOption {
|
class GameOptionEnum : public GameOption
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
virtual string menuStr();
|
virtual string menuStr();
|
||||||
virtual bool write(std::ofstream * file, string name);
|
virtual bool write(std::ofstream * file, string name);
|
||||||
virtual bool read(string input);
|
virtual bool read(string input);
|
||||||
EnumDefinition * def;
|
EnumDefinition * def;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GameOptionAward: public GameOption {
|
class GameOptionAward : public GameOption
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
GameOptionAward();
|
GameOptionAward();
|
||||||
virtual string menuStr();
|
virtual string menuStr();
|
||||||
virtual bool write(std::ofstream * file, string name);
|
virtual bool write(std::ofstream * file, string name);
|
||||||
virtual bool read(string input);
|
virtual bool read(string input);
|
||||||
virtual bool giveAward(); //Returns false if already awarded
|
virtual bool giveAward(); //Returns false if already awarded
|
||||||
virtual bool isViewed();
|
virtual bool isViewed();
|
||||||
virtual void setViewed(bool v = true) {viewed = v;};
|
|
||||||
|
virtual void setViewed(bool v = true)
|
||||||
|
{
|
||||||
|
viewed = v;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
time_t achieved; //When was it awarded?
|
time_t achieved; //When was it awarded?
|
||||||
bool viewed; //Flag it as "New!" or not.
|
bool viewed; //Flag it as "New!" or not.
|
||||||
};
|
};
|
||||||
|
|
||||||
class GameOptionKeyBindings : public GameOption {
|
class GameOptionKeyBindings : public GameOption
|
||||||
virtual bool read(string input);
|
{
|
||||||
virtual bool write(std::ofstream*, string);
|
virtual bool read(string input);
|
||||||
|
virtual bool write(std::ofstream*, string);
|
||||||
};
|
};
|
||||||
|
|
||||||
class OptionVolume: public EnumDefinition{
|
class OptionVolume : public EnumDefinition
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
enum { MUTE = 0, MAX = 100 };
|
enum
|
||||||
static EnumDefinition * getInstance() {return &mDef;};
|
{
|
||||||
|
MUTE = 0,
|
||||||
|
MAX = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
static EnumDefinition * getInstance()
|
||||||
|
{
|
||||||
|
return &mDef;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OptionVolume();
|
OptionVolume();
|
||||||
static OptionVolume mDef;
|
static OptionVolume mDef;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class OptionClosedHand: public EnumDefinition {
|
class OptionClosedHand : public EnumDefinition
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
enum { INVISIBLE = 0, VISIBLE = 1 };
|
enum
|
||||||
static EnumDefinition * getInstance() {return &mDef;};
|
{
|
||||||
|
INVISIBLE = 0,
|
||||||
|
VISIBLE = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
static EnumDefinition* getInstance()
|
||||||
|
{
|
||||||
|
return &mDef;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OptionClosedHand();
|
OptionClosedHand();
|
||||||
static OptionClosedHand mDef;
|
static OptionClosedHand mDef;
|
||||||
};
|
};
|
||||||
class OptionHandDirection: public EnumDefinition {
|
|
||||||
|
class OptionHandDirection : public EnumDefinition
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
enum { VERTICAL = 0, HORIZONTAL = 1};
|
enum
|
||||||
static EnumDefinition * getInstance() {return &mDef;};
|
{
|
||||||
private:
|
VERTICAL = 0,
|
||||||
OptionHandDirection();
|
HORIZONTAL = 1
|
||||||
static OptionHandDirection mDef;
|
};
|
||||||
};
|
|
||||||
class OptionManaDisplay: public EnumDefinition {
|
|
||||||
public:
|
|
||||||
enum { DYNAMIC = 0, STATIC = 1, NOSTARSDYNAMIC = 2, BOTH = 3};
|
|
||||||
static EnumDefinition * getInstance() {return &mDef;};
|
|
||||||
private:
|
|
||||||
OptionManaDisplay();
|
|
||||||
static OptionManaDisplay mDef;
|
|
||||||
};
|
|
||||||
class OptionMaxGrade: public EnumDefinition {
|
|
||||||
public:
|
|
||||||
static EnumDefinition * getInstance() {return &mDef;};
|
|
||||||
private:
|
|
||||||
OptionMaxGrade();
|
|
||||||
static OptionMaxGrade mDef;
|
|
||||||
};
|
|
||||||
class OptionASkipPhase: public EnumDefinition {
|
|
||||||
public:
|
|
||||||
static EnumDefinition * getInstance() {return &mDef;};
|
|
||||||
private:
|
|
||||||
OptionASkipPhase();
|
|
||||||
static OptionASkipPhase mDef;
|
|
||||||
};
|
|
||||||
class OptionWhosFirst: public EnumDefinition {
|
|
||||||
public:
|
|
||||||
enum { WHO_P = 0, WHO_O = 1, WHO_R = 2};
|
|
||||||
static EnumDefinition * getInstance() {return &mDef;};
|
|
||||||
private:
|
|
||||||
OptionWhosFirst();
|
|
||||||
static OptionWhosFirst mDef;
|
|
||||||
};
|
|
||||||
class OptionEconDifficulty: public EnumDefinition {
|
|
||||||
public:
|
|
||||||
static EnumDefinition * getInstance() {return &mDef;};
|
|
||||||
private:
|
|
||||||
OptionEconDifficulty();
|
|
||||||
static OptionEconDifficulty mDef;
|
|
||||||
};
|
|
||||||
class OptionDifficulty: public EnumDefinition {
|
|
||||||
public:
|
|
||||||
enum { NORMAL = 0, HARD = 1, HARDER = 2, EVIL = 3};
|
|
||||||
static EnumDefinition * getInstance() {return &mDef;};
|
|
||||||
private:
|
|
||||||
OptionDifficulty();
|
|
||||||
static OptionDifficulty mDef;
|
|
||||||
};
|
|
||||||
|
|
||||||
class GameOptions {
|
static EnumDefinition * getInstance()
|
||||||
public:
|
{
|
||||||
string mFilename;
|
return &mDef;
|
||||||
int save();
|
}
|
||||||
int load();
|
|
||||||
|
|
||||||
GameOption * get(int);
|
|
||||||
GameOption& operator[](int);
|
|
||||||
GameOptions(string filename);
|
|
||||||
~GameOptions();
|
|
||||||
|
|
||||||
private:
|
|
||||||
vector<GameOption*> values;
|
|
||||||
vector<string> unknown;
|
|
||||||
};
|
|
||||||
|
|
||||||
class GameSettings{
|
|
||||||
public:
|
|
||||||
friend class GameApp;
|
|
||||||
GameSettings();
|
|
||||||
~GameSettings();
|
|
||||||
int save();
|
|
||||||
|
|
||||||
SimplePad * keypadStart(string input, string * _dest = NULL, bool _cancel=true, bool _numpad=false, int _x = SCREEN_WIDTH/2, int _y = SCREEN_HEIGHT/2);
|
|
||||||
string keypadFinish();
|
|
||||||
void keypadShutdown();
|
|
||||||
void keypadTitle(string set);
|
|
||||||
bool keypadActive() {if(keypad) return keypad->isActive(); return false;};
|
|
||||||
void keypadUpdate(float dt) {if(keypad) keypad->Update(dt);};
|
|
||||||
void keypadRender() {if(keypad) keypad->Render();};
|
|
||||||
|
|
||||||
bool newAward();
|
|
||||||
|
|
||||||
//These return a filepath accurate to the current mode/profile/theme, and can
|
|
||||||
//optionally fallback to a file within a certain directory.
|
|
||||||
//The sanity=false option returns the adjusted path even if the file doesn't exist.
|
|
||||||
string profileFile(string filename="", string fallback="", bool sanity=false,bool relative=false);
|
|
||||||
|
|
||||||
void reloadProfile(); //Reloads profile using current options[ACTIVE_PROFILE]
|
|
||||||
void checkProfile(); //Confirms that a profile is loaded and contains a collection.
|
|
||||||
void createUsersFirstDeck(int setId);
|
|
||||||
|
|
||||||
GameOption * get(int);
|
|
||||||
GameOption& operator[](int);
|
|
||||||
|
|
||||||
GameOptions* profileOptions;
|
|
||||||
GameOptions* globalOptions;
|
|
||||||
|
|
||||||
static GameOption invalid_option;
|
|
||||||
|
|
||||||
WStyle * getStyle();
|
|
||||||
StyleManager * getStyleMan();
|
|
||||||
void automaticStyle(Player * p1, Player * p2);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GameApp * theGame;
|
OptionHandDirection();
|
||||||
SimplePad * keypad;
|
static OptionHandDirection mDef;
|
||||||
StyleManager * styleMan;
|
};
|
||||||
|
|
||||||
|
class OptionManaDisplay : public EnumDefinition
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
DYNAMIC = 0,
|
||||||
|
STATIC = 1,
|
||||||
|
NOSTARSDYNAMIC = 2,
|
||||||
|
BOTH = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
static EnumDefinition * getInstance()
|
||||||
|
{
|
||||||
|
return &mDef;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
OptionManaDisplay();
|
||||||
|
static OptionManaDisplay mDef;
|
||||||
|
};
|
||||||
|
|
||||||
|
class OptionMaxGrade : public EnumDefinition
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static EnumDefinition * getInstance()
|
||||||
|
{
|
||||||
|
return &mDef;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
OptionMaxGrade();
|
||||||
|
static OptionMaxGrade mDef;
|
||||||
|
};
|
||||||
|
|
||||||
|
class OptionASkipPhase : public EnumDefinition
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static EnumDefinition * getInstance()
|
||||||
|
{
|
||||||
|
return &mDef;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
OptionASkipPhase();
|
||||||
|
static OptionASkipPhase mDef;
|
||||||
|
};
|
||||||
|
|
||||||
|
class OptionWhosFirst : public EnumDefinition
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
WHO_P = 0,
|
||||||
|
WHO_O = 1,
|
||||||
|
WHO_R = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
static EnumDefinition * getInstance()
|
||||||
|
{
|
||||||
|
return &mDef;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
OptionWhosFirst();
|
||||||
|
static OptionWhosFirst mDef;
|
||||||
|
};
|
||||||
|
|
||||||
|
class OptionEconDifficulty : public EnumDefinition
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static EnumDefinition * getInstance()
|
||||||
|
{
|
||||||
|
return &mDef;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
OptionEconDifficulty();
|
||||||
|
static OptionEconDifficulty mDef;
|
||||||
|
};
|
||||||
|
|
||||||
|
class OptionDifficulty: public EnumDefinition
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
NORMAL = 0,
|
||||||
|
HARD = 1,
|
||||||
|
HARDER = 2,
|
||||||
|
EVIL = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
static EnumDefinition* getInstance()
|
||||||
|
{
|
||||||
|
return &mDef;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
OptionDifficulty();
|
||||||
|
static OptionDifficulty mDef;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GameOptions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
string mFilename;
|
||||||
|
int save();
|
||||||
|
int load();
|
||||||
|
|
||||||
|
GameOption * get(int);
|
||||||
|
GameOption& operator[](int);
|
||||||
|
GameOptions(string filename);
|
||||||
|
~GameOptions();
|
||||||
|
|
||||||
|
private:
|
||||||
|
vector<GameOption*> values;
|
||||||
|
vector<string> unknown;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GameSettings
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
friend class GameApp;
|
||||||
|
|
||||||
|
GameSettings();
|
||||||
|
~GameSettings();
|
||||||
|
int save();
|
||||||
|
|
||||||
|
SimplePad * keypadStart(string input, string * _dest = NULL, bool _cancel=true, bool _numpad=false, int _x = SCREEN_WIDTH/2, int _y = SCREEN_HEIGHT/2);
|
||||||
|
string keypadFinish();
|
||||||
|
void keypadShutdown();
|
||||||
|
void keypadTitle(string set);
|
||||||
|
|
||||||
|
bool keypadActive()
|
||||||
|
{
|
||||||
|
if(keypad)
|
||||||
|
return keypad->isActive();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void keypadUpdate(float dt)
|
||||||
|
{
|
||||||
|
if(keypad)
|
||||||
|
keypad->Update(dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void keypadRender()
|
||||||
|
{
|
||||||
|
if(keypad)
|
||||||
|
keypad->Render();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool newAward();
|
||||||
|
|
||||||
|
//These return a filepath accurate to the current mode/profile/theme, and can
|
||||||
|
//optionally fallback to a file within a certain directory.
|
||||||
|
//The sanity=false option returns the adjusted path even if the file doesn't exist.
|
||||||
|
string profileFile(string filename="", string fallback="", bool sanity=false,bool relative=false);
|
||||||
|
|
||||||
|
void reloadProfile(); //Reloads profile using current options[ACTIVE_PROFILE]
|
||||||
|
void checkProfile(); //Confirms that a profile is loaded and contains a collection.
|
||||||
|
void createUsersFirstDeck(int setId);
|
||||||
|
|
||||||
|
GameOption* get(int);
|
||||||
|
GameOption& operator[](int);
|
||||||
|
|
||||||
|
GameOptions* profileOptions;
|
||||||
|
GameOptions* globalOptions;
|
||||||
|
|
||||||
|
static GameOption invalid_option;
|
||||||
|
|
||||||
|
WStyle * getStyle();
|
||||||
|
StyleManager * getStyleMan();
|
||||||
|
void automaticStyle(Player* p1, Player* p2);
|
||||||
|
|
||||||
|
private:
|
||||||
|
GameApp* theGame;
|
||||||
|
SimplePad* keypad;
|
||||||
|
StyleManager* styleMan;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GameSettings options;
|
extern GameSettings options;
|
||||||
|
|||||||
Reference in New Issue
Block a user