No code change just reformatting of header files.
finishing up my reformatting of the source from November/December following the guidelines that were posted. some extra things I added: * Any empty virtual declarations were kept to one line. * Enums were split up into separate lines to promote uniformity across all headers. ( each header file had a different style for enums)
This commit is contained in:
@@ -3,15 +3,15 @@
|
||||
|
||||
#include "AIPlayer.h"
|
||||
|
||||
|
||||
class AIMomirPlayer:public AIPlayerBaka{
|
||||
class AIMomirPlayer: public AIPlayerBaka
|
||||
{
|
||||
public:
|
||||
AIMomirPlayer(MTGDeck * deck, string file, string fileSmall, string avatarFile);
|
||||
int getEfficiency(AIAction * action);
|
||||
int momir();
|
||||
int computeActions();
|
||||
static MTGAbility * momirAbility;
|
||||
static MTGAbility * getMomirAbility();
|
||||
AIMomirPlayer(MTGDeck * deck, string file, string fileSmall, string avatarFile);
|
||||
int getEfficiency(AIAction * action);
|
||||
int momir();
|
||||
int computeActions();
|
||||
static MTGAbility * momirAbility;
|
||||
static MTGAbility * getMomirAbility();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,6 @@ using std::queue;
|
||||
#define INFO_CREATURESTOUGHNESS 3
|
||||
#define INFO_CREATURESATTACKINGPOWER 4
|
||||
|
||||
|
||||
class AIStats;
|
||||
|
||||
class AIAction
|
||||
@@ -35,22 +34,25 @@ public:
|
||||
MTGCardInstance * click;
|
||||
MTGCardInstance * target; // TODO Improve
|
||||
|
||||
AIAction(MTGAbility * a, MTGCardInstance * c, MTGCardInstance * t = NULL)
|
||||
: efficiency(-1), ability(a), player(NULL), click(c), target(t)
|
||||
AIAction(MTGAbility * a, MTGCardInstance * c, MTGCardInstance * t = NULL) :
|
||||
efficiency(-1), ability(a), player(NULL), click(c), target(t)
|
||||
{
|
||||
id = currentId++;
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
AIAction(MTGCardInstance * c, MTGCardInstance * t = NULL)
|
||||
: efficiency(-1), ability(NULL), player(NULL), click(c), target(t)
|
||||
AIAction(MTGCardInstance * c, MTGCardInstance * t = NULL) :
|
||||
efficiency(-1), ability(NULL), player(NULL), click(c), target(t)
|
||||
{
|
||||
id = currentId++;
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
AIAction(Player * p)
|
||||
: efficiency(-1), ability(NULL), player(p), click(NULL), target(NULL)
|
||||
AIAction(Player * p) :
|
||||
efficiency(-1), ability(NULL), player(p), click(NULL), target(NULL)
|
||||
{
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
int getEfficiency();
|
||||
int Act();
|
||||
@@ -58,22 +60,24 @@ public:
|
||||
|
||||
// compares Abilities efficiency
|
||||
class CmpAbilities
|
||||
{
|
||||
{
|
||||
public:
|
||||
bool operator()(const AIAction& a1, const AIAction& a2) const
|
||||
{
|
||||
AIAction* a1Ptr = const_cast<AIAction*>(&a1);
|
||||
AIAction* a2Ptr = const_cast<AIAction*>(&a2);
|
||||
AIAction* a1Ptr = const_cast<AIAction*> (&a1);
|
||||
AIAction* a2Ptr = const_cast<AIAction*> (&a2);
|
||||
int e1 = a1Ptr->getEfficiency();
|
||||
int e2 = a2Ptr->getEfficiency();
|
||||
if (e1 == e2) return a1Ptr->id < a2Ptr->id;
|
||||
if (e1 == e2)
|
||||
return a1Ptr->id < a2Ptr->id;
|
||||
return (e1 > e2);
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map<AIAction, int, CmpAbilities> RankingContainer;
|
||||
|
||||
class AIPlayer: public Player{
|
||||
class AIPlayer: public Player
|
||||
{
|
||||
protected:
|
||||
//Variables used by Test suite
|
||||
MTGCardInstance * nextCardToPlay;
|
||||
@@ -86,29 +90,40 @@ protected:
|
||||
int chooseBlockers();
|
||||
int canFirstStrikeKill(MTGCardInstance * card, MTGCardInstance *ennemy);
|
||||
int effectBadOrGood(MTGCardInstance * card, int mode = MODE_PUTINTOPLAY, TargetChooser * tc = NULL);
|
||||
int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES , int untapMode = 0, int canAttack = 0);
|
||||
int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES, int untapMode = 0, int canAttack = 0);
|
||||
AIStats * getStats();
|
||||
|
||||
// returns 1 if the AI algorithm supports a given cost (ex:simple mana cost), 0 otherwise (ex: cost involves Sacrificing a target)
|
||||
int CanHandleCost(ManaCost * cost);
|
||||
int CanHandleCost(ManaCost * cost);
|
||||
|
||||
public:
|
||||
AIStats * stats;
|
||||
int agressivity;
|
||||
bool Checked;
|
||||
bool forceBestAbilityUse;
|
||||
void End(){};
|
||||
virtual int displayStack() {return 0;};
|
||||
void End()
|
||||
{
|
||||
}
|
||||
;
|
||||
virtual int displayStack()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
int receiveEvent(WEvent * event);
|
||||
void Render();
|
||||
ManaCost * getPotentialMana(MTGCardInstance * card = NULL);
|
||||
AIPlayer(MTGDeck * deck, string deckFile, string deckFileSmall);
|
||||
virtual ~AIPlayer();
|
||||
virtual MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0);
|
||||
virtual int chooseTarget(TargetChooser * tc = NULL, Player * forceTarget =NULL);
|
||||
virtual int chooseTarget(TargetChooser * tc = NULL, Player * forceTarget = NULL);
|
||||
virtual int Act(float dt);
|
||||
virtual int affectCombatDamages(CombatStep);
|
||||
int isAI(){return 1;};
|
||||
int isAI()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
;
|
||||
int canHandleCost(MTGAbility * ability);
|
||||
int selectAbility();
|
||||
int createAbilityTargets(MTGAbility * a, MTGCardInstance * c, RankingContainer& ranking);
|
||||
@@ -117,24 +132,24 @@ public:
|
||||
|
||||
};
|
||||
|
||||
|
||||
class AIPlayerBaka: public AIPlayer{
|
||||
protected:
|
||||
int oldGamePhase;
|
||||
float timer;
|
||||
MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
|
||||
public:
|
||||
int deckId;
|
||||
AIPlayerBaka(MTGDeck * deck, string deckFile, string deckfileSmall, string avatarFile);
|
||||
virtual int Act(float dt);
|
||||
void initTimer();
|
||||
virtual int computeActions();
|
||||
class AIPlayerBaka: public AIPlayer
|
||||
{
|
||||
protected:
|
||||
int oldGamePhase;
|
||||
float timer;
|
||||
MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
|
||||
public:
|
||||
int deckId;
|
||||
AIPlayerBaka(MTGDeck * deck, string deckFile, string deckfileSmall, string avatarFile);
|
||||
virtual int Act(float dt);
|
||||
void initTimer();
|
||||
virtual int computeActions();
|
||||
};
|
||||
|
||||
class AIPlayerFactory{
|
||||
public:
|
||||
AIPlayer * createAIPlayer(MTGAllCards * collection, Player * opponent, int deckid = 0);
|
||||
class AIPlayerFactory
|
||||
{
|
||||
public:
|
||||
AIPlayer * createAIPlayer(MTGAllCards * collection, Player * opponent, int deckid = 0);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,31 +18,35 @@ class MTGCard;
|
||||
class Damage;
|
||||
class WEvent;
|
||||
|
||||
class AIStat{
|
||||
public:
|
||||
int source; //MTGId of the card
|
||||
int value;
|
||||
int occurences;
|
||||
bool direct;
|
||||
AIStat(int _source, int _value, int _occurences, bool _direct):source(_source), value(_value),occurences(_occurences),direct(_direct){};
|
||||
class AIStat
|
||||
{
|
||||
public:
|
||||
int source; //MTGId of the card
|
||||
int value;
|
||||
int occurences;
|
||||
bool direct;
|
||||
AIStat(int _source, int _value, int _occurences, bool _direct) :
|
||||
source(_source), value(_value), occurences(_occurences), direct(_direct)
|
||||
{
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class AIStats{
|
||||
public:
|
||||
Player * player;
|
||||
string filename;
|
||||
list<AIStat *> stats;
|
||||
AIStats(Player * _player, char * filename);
|
||||
~AIStats();
|
||||
void load(char * filename);
|
||||
void save();
|
||||
AIStat * find(MTGCard * card);
|
||||
bool isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCountsForTrue = true );
|
||||
void updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, float multiplier = 1.0);
|
||||
int receiveEvent(WEvent * event);
|
||||
void Render();
|
||||
class AIStats
|
||||
{
|
||||
public:
|
||||
Player * player;
|
||||
string filename;
|
||||
list<AIStat *> stats;
|
||||
AIStats(Player * _player, char * filename);
|
||||
~AIStats();
|
||||
void load(char * filename);
|
||||
void save();
|
||||
AIStat * find(MTGCard * card);
|
||||
bool isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCountsForTrue = true);
|
||||
void updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, float multiplier = 1.0);
|
||||
int receiveEvent(WEvent * event);
|
||||
void Render();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,43 +12,73 @@
|
||||
#define ACTION_REQUESTED 1
|
||||
#define ACTIVE 2
|
||||
|
||||
|
||||
class MTGCardInstance;
|
||||
class ManaCost;
|
||||
class Targetable;
|
||||
class TargetChooser;
|
||||
class WEvent;
|
||||
|
||||
class ActionElement: public JGuiObject{
|
||||
protected:
|
||||
int activeState;
|
||||
|
||||
class ActionElement: public JGuiObject
|
||||
{
|
||||
protected:
|
||||
int activeState;
|
||||
|
||||
public:
|
||||
int isClone;
|
||||
TargetChooser * tc;
|
||||
int currentPhase;
|
||||
int newPhase;
|
||||
int modal;
|
||||
int waitingForAnswer;
|
||||
int getActivity();
|
||||
virtual void Update(float dt){};
|
||||
virtual void Render(){};
|
||||
virtual int testDestroy()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int destroy()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual bool CheckUserInput(JButton key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
ActionElement(int id);
|
||||
virtual ~ActionElement();
|
||||
virtual int isReactingToTargetClick(Targetable * card);
|
||||
virtual int reactToTargetClick(Targetable * card);
|
||||
virtual int isReactingToClick(MTGCardInstance * card, ManaCost * man = NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int stillInUse(MTGCardInstance * card)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int receiveEvent(WEvent * event)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int reactToClick(MTGCardInstance * card)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual const char * getMenuText()
|
||||
{
|
||||
return "Ability";
|
||||
}
|
||||
;
|
||||
virtual ActionElement * clone() const = 0;
|
||||
|
||||
public:
|
||||
int isClone;
|
||||
TargetChooser * tc;
|
||||
int currentPhase;
|
||||
int newPhase;
|
||||
int modal;
|
||||
int waitingForAnswer;
|
||||
int getActivity();
|
||||
virtual void Update(float dt){};
|
||||
virtual void Render(){};
|
||||
virtual int testDestroy(){return 0;};
|
||||
virtual int destroy(){return 0;};
|
||||
virtual bool CheckUserInput(JButton key){return false;};
|
||||
ActionElement(int id);
|
||||
virtual ~ActionElement();
|
||||
virtual int isReactingToTargetClick(Targetable * card);
|
||||
virtual int reactToTargetClick(Targetable * card);
|
||||
virtual int isReactingToClick(MTGCardInstance * card, ManaCost * man = NULL){return 0;};
|
||||
virtual int stillInUse(MTGCardInstance * card){return 0;};
|
||||
virtual int receiveEvent(WEvent * event){return 0;};
|
||||
virtual int reactToClick(MTGCardInstance * card){return 0;};
|
||||
virtual const char * getMenuText(){return "Ability";};
|
||||
virtual ActionElement * clone() const = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,40 +16,39 @@ class GuiLayer;
|
||||
class Targetable;
|
||||
class WEvent;
|
||||
|
||||
class ActionLayer: public GuiLayer, public JGuiListener{
|
||||
public:
|
||||
vector <ActionElement *> garbage;
|
||||
Targetable * menuObject;
|
||||
SimpleMenu * abilitiesMenu;
|
||||
int stuffHappened;
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
bool CheckUserInput(JButton key);
|
||||
ActionLayer();
|
||||
~ActionLayer();
|
||||
int cancelCurrentAction();
|
||||
ActionElement * isWaitingForAnswer();
|
||||
int isReactingToTargetClick(Targetable * card);
|
||||
int receiveEventPlus(WEvent * event);
|
||||
int reactToTargetClick(Targetable * card);
|
||||
int isReactingToClick(MTGCardInstance * card);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int reactToClick(ActionElement * ability,MTGCardInstance * card);
|
||||
int reactToTargetClick(ActionElement * ability,Targetable * card);
|
||||
int stillInUse(MTGCardInstance * card);
|
||||
void setMenuObject(Targetable * object, bool must = false);
|
||||
void ButtonPressed(int controllerid, int controlid);
|
||||
void doReactTo(int menuIndex);
|
||||
TargetChooser * getCurrentTargetChooser();
|
||||
void setCurrentWaitingAction(ActionElement * ae);
|
||||
MTGAbility * getAbility(int type);
|
||||
int moveToGarbage(ActionElement * e);
|
||||
int cleanGarbage();
|
||||
class ActionLayer: public GuiLayer, public JGuiListener
|
||||
{
|
||||
public:
|
||||
vector<ActionElement *> garbage;
|
||||
Targetable * menuObject;
|
||||
SimpleMenu * abilitiesMenu;
|
||||
int stuffHappened;
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
bool CheckUserInput(JButton key);
|
||||
ActionLayer();
|
||||
~ActionLayer();
|
||||
int cancelCurrentAction();
|
||||
ActionElement * isWaitingForAnswer();
|
||||
int isReactingToTargetClick(Targetable * card);
|
||||
int receiveEventPlus(WEvent * event);
|
||||
int reactToTargetClick(Targetable * card);
|
||||
int isReactingToClick(MTGCardInstance * card);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
int reactToClick(ActionElement * ability, MTGCardInstance * card);
|
||||
int reactToTargetClick(ActionElement * ability, Targetable * card);
|
||||
int stillInUse(MTGCardInstance * card);
|
||||
void setMenuObject(Targetable * object, bool must = false);
|
||||
void ButtonPressed(int controllerid, int controlid);
|
||||
void doReactTo(int menuIndex);
|
||||
TargetChooser * getCurrentTargetChooser();
|
||||
void setCurrentWaitingAction(ActionElement * ae);
|
||||
MTGAbility * getAbility(int type);
|
||||
int moveToGarbage(ActionElement * e);
|
||||
int cleanGarbage();
|
||||
protected:
|
||||
ActionElement * currentWaitingAction;
|
||||
int cantCancel;
|
||||
ActionElement * currentWaitingAction;
|
||||
int cantCancel;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#define MAX_SPELL_TARGETS 10
|
||||
|
||||
|
||||
#define ACTION_SPELL 10
|
||||
#define ACTION_DAMAGE 11
|
||||
#define ACTION_DAMAGES 12
|
||||
@@ -39,161 +38,197 @@ class DamageStack;
|
||||
class ManaCost;
|
||||
class TargetChooser;
|
||||
|
||||
|
||||
#define ACTIONSTACK_STANDARD 0
|
||||
#define ACTIONSTACK_TARGET 1
|
||||
|
||||
class Interruptible: public PlayGuiObject, public Targetable{
|
||||
public:
|
||||
//TODO : remove these when they are back in PlayGuiObject
|
||||
float x, y;
|
||||
class Interruptible: public PlayGuiObject, public Targetable
|
||||
{
|
||||
public:
|
||||
//TODO : remove these when they are back in PlayGuiObject
|
||||
float x, y;
|
||||
|
||||
int state, display;
|
||||
MTGCardInstance * source;
|
||||
virtual void Entering(){mHasFocus = true;};
|
||||
virtual bool Leaving(JButton key){mHasFocus = false;return true;};
|
||||
virtual bool ButtonPressed(){return true;};
|
||||
virtual int resolve(){return 0;};
|
||||
virtual void Render(){};
|
||||
int typeAsTarget(){return TARGET_STACKACTION;};
|
||||
Interruptible(bool hasFocus = false):PlayGuiObject(40,x,y,hasFocus){state=NOT_RESOLVED;display=0;source=NULL;};
|
||||
virtual const string getDisplayName() const;
|
||||
void Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad = false);
|
||||
virtual int receiveEvent(WEvent * event) {return 0;};
|
||||
int state, display;
|
||||
MTGCardInstance * source;
|
||||
virtual void Entering()
|
||||
{
|
||||
mHasFocus = true;
|
||||
}
|
||||
;
|
||||
virtual bool Leaving(JButton key)
|
||||
{
|
||||
mHasFocus = false;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
virtual bool ButtonPressed()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
;
|
||||
virtual int resolve()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual void Render()
|
||||
{
|
||||
}
|
||||
;
|
||||
int typeAsTarget()
|
||||
{
|
||||
return TARGET_STACKACTION;
|
||||
}
|
||||
;
|
||||
Interruptible(bool hasFocus = false) :
|
||||
PlayGuiObject(40, x, y, hasFocus)
|
||||
{
|
||||
state = NOT_RESOLVED;
|
||||
display = 0;
|
||||
source = NULL;
|
||||
}
|
||||
;
|
||||
virtual const string getDisplayName() const;
|
||||
void Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad = false);
|
||||
virtual int receiveEvent(WEvent * event)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
#if defined (WIN32) || defined (LINUX) || defined (IOS)
|
||||
virtual void Dump();
|
||||
virtual void Dump();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
float GetVerticalTextOffset() const;
|
||||
float GetVerticalTextOffset() const;
|
||||
};
|
||||
|
||||
class NextGamePhase: public Interruptible {
|
||||
public:
|
||||
int resolve();
|
||||
bool extraDamagePhase();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual const string getDisplayName() const;
|
||||
NextGamePhase(int id);
|
||||
class NextGamePhase: public Interruptible
|
||||
{
|
||||
public:
|
||||
int resolve();
|
||||
bool extraDamagePhase();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual const string getDisplayName() const;
|
||||
NextGamePhase(int id);
|
||||
};
|
||||
|
||||
class Spell: public Interruptible {
|
||||
protected:
|
||||
class Spell: public Interruptible
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
MTGGameZone * from;
|
||||
TargetChooser * tc;
|
||||
ManaCost * cost;
|
||||
int payResult;
|
||||
int computeX(MTGCardInstance * card);
|
||||
int computeXX(MTGCardInstance * card);
|
||||
Spell(MTGCardInstance* _source);
|
||||
Spell(int id, MTGCardInstance* _source, TargetChooser *_tc, ManaCost * _cost, int payResult);
|
||||
~Spell();
|
||||
int resolve();
|
||||
void Render();
|
||||
bool FullfilledAlternateCost(const int &costType);
|
||||
const string getDisplayName() const;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGCardInstance * getNextCardTarget(MTGCardInstance * previous = 0);
|
||||
Player * getNextPlayerTarget(Player * previous = 0);
|
||||
Damageable * getNextDamageableTarget(Damageable * previous = 0);
|
||||
Interruptible * getNextInterruptible(Interruptible * previous, int type);
|
||||
Spell * getNextSpellTarget(Spell * previous = 0);
|
||||
Damage * getNextDamageTarget(Damage * previous = 0);
|
||||
Targetable * getNextTarget(Targetable * previous = 0, int type = -1);
|
||||
int getNbTargets();
|
||||
public:
|
||||
MTGGameZone * from;
|
||||
TargetChooser * tc;
|
||||
ManaCost * cost;
|
||||
int payResult;
|
||||
int computeX(MTGCardInstance * card);
|
||||
int computeXX(MTGCardInstance * card);
|
||||
Spell(MTGCardInstance* _source);
|
||||
Spell(int id, MTGCardInstance* _source, TargetChooser *_tc, ManaCost * _cost, int payResult);
|
||||
~Spell();
|
||||
int resolve();
|
||||
void Render();
|
||||
bool FullfilledAlternateCost(const int &costType);
|
||||
const string getDisplayName() const;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGCardInstance * getNextCardTarget(MTGCardInstance * previous = 0);
|
||||
Player * getNextPlayerTarget(Player * previous = 0);
|
||||
Damageable * getNextDamageableTarget(Damageable * previous = 0);
|
||||
Interruptible * getNextInterruptible(Interruptible * previous, int type);
|
||||
Spell * getNextSpellTarget(Spell * previous = 0);
|
||||
Damage * getNextDamageTarget(Damage * previous = 0);
|
||||
Targetable * getNextTarget(Targetable * previous = 0, int type = -1);
|
||||
int getNbTargets();
|
||||
};
|
||||
|
||||
class StackAbility: public Interruptible {
|
||||
public:
|
||||
MTGAbility * ability;
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual const string getDisplayName() const;
|
||||
StackAbility(int id, MTGAbility * _ability);
|
||||
class StackAbility: public Interruptible
|
||||
{
|
||||
public:
|
||||
MTGAbility * ability;
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual const string getDisplayName() const;
|
||||
StackAbility(int id, MTGAbility * _ability);
|
||||
};
|
||||
|
||||
class PutInGraveyard: public Interruptible {
|
||||
public:
|
||||
MTGCardInstance * card;
|
||||
int removeFromGame;
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
PutInGraveyard(int id, MTGCardInstance * _card);
|
||||
class PutInGraveyard: public Interruptible
|
||||
{
|
||||
public:
|
||||
MTGCardInstance * card;
|
||||
int removeFromGame;
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
PutInGraveyard(int id, MTGCardInstance * _card);
|
||||
};
|
||||
|
||||
|
||||
class DrawAction: public Interruptible {
|
||||
public:
|
||||
int nbcards;
|
||||
Player * player;
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
DrawAction(int id, Player * _player, int _nbcards);
|
||||
class DrawAction: public Interruptible
|
||||
{
|
||||
public:
|
||||
int nbcards;
|
||||
Player * player;
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
DrawAction(int id, Player * _player, int _nbcards);
|
||||
};
|
||||
|
||||
class ActionStack :public GuiLayer{
|
||||
protected:
|
||||
JQuad * pspIcons[8];
|
||||
GameObserver* game;
|
||||
int interruptDecision[2];
|
||||
float timer;
|
||||
int currentState;
|
||||
int mode;
|
||||
int checked;
|
||||
class ActionStack: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
JQuad * pspIcons[8];
|
||||
GameObserver* game;
|
||||
int interruptDecision[2];
|
||||
float timer;
|
||||
int currentState;
|
||||
int mode;
|
||||
int checked;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
enum
|
||||
{
|
||||
NOT_DECIDED = 0,
|
||||
INTERRUPT = -1,
|
||||
DONT_INTERRUPT = 1,
|
||||
DONT_INTERRUPT_ALL = 2,
|
||||
};
|
||||
enum
|
||||
{
|
||||
NOT_DECIDED = 0,
|
||||
INTERRUPT = -1,
|
||||
DONT_INTERRUPT = 1,
|
||||
DONT_INTERRUPT_ALL = 2,
|
||||
};
|
||||
|
||||
int setIsInterrupting(Player * player);
|
||||
int count( int type = 0 , int state = 0 , int display = -1);
|
||||
Interruptible * getPrevious(Interruptible * next, int type = 0, int state = 0 , int display = -1);
|
||||
int getPreviousIndex(Interruptible * next, int type = 0, int state = 0 , int display = -1);
|
||||
Interruptible * getNext(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
|
||||
int getNextIndex(Interruptible * previous, int type = 0, int state = 0 , int display = -1);
|
||||
void Fizzle(Interruptible * action);
|
||||
Interruptible * getAt(int id);
|
||||
void cancelInterruptOffer(int cancelMode = 1);
|
||||
void endOfInterruption();
|
||||
Interruptible * getLatest(int state);
|
||||
Player * askIfWishesToInterrupt;
|
||||
int garbageCollect();
|
||||
int addAction(Interruptible * interruptible);
|
||||
Spell * addSpell(MTGCardInstance* card, TargetChooser * tc, ManaCost * mana, int payResult, int storm);
|
||||
int AddNextGamePhase();
|
||||
int AddNextCombatStep();
|
||||
int addPutInGraveyard(MTGCardInstance * card);
|
||||
int addDraw(Player * player, int nbcards = 1);
|
||||
int addDamage(MTGCardInstance * _source, Damageable * target, int _damage);
|
||||
int addAbility(MTGAbility * ability);
|
||||
void Update(float dt);
|
||||
bool CheckUserInput(JButton key);
|
||||
virtual void Render();
|
||||
ActionStack(GameObserver* game);
|
||||
int resolve();
|
||||
int has(Interruptible * action);
|
||||
int has(MTGAbility * ability);
|
||||
int receiveEventPlus(WEvent * event);
|
||||
int setIsInterrupting(Player * player);
|
||||
int count(int type = 0, int state = 0, int display = -1);
|
||||
Interruptible * getPrevious(Interruptible * next, int type = 0, int state = 0, int display = -1);
|
||||
int getPreviousIndex(Interruptible * next, int type = 0, int state = 0, int display = -1);
|
||||
Interruptible * getNext(Interruptible * previous, int type = 0, int state = 0, int display = -1);
|
||||
int getNextIndex(Interruptible * previous, int type = 0, int state = 0, int display = -1);
|
||||
void Fizzle(Interruptible * action);
|
||||
Interruptible * getAt(int id);
|
||||
void cancelInterruptOffer(int cancelMode = 1);
|
||||
void endOfInterruption();
|
||||
Interruptible * getLatest(int state);
|
||||
Player * askIfWishesToInterrupt;
|
||||
int garbageCollect();
|
||||
int addAction(Interruptible * interruptible);
|
||||
Spell * addSpell(MTGCardInstance* card, TargetChooser * tc, ManaCost * mana, int payResult, int storm);
|
||||
int AddNextGamePhase();
|
||||
int AddNextCombatStep();
|
||||
int addPutInGraveyard(MTGCardInstance * card);
|
||||
int addDraw(Player * player, int nbcards = 1);
|
||||
int addDamage(MTGCardInstance * _source, Damageable * target, int _damage);
|
||||
int addAbility(MTGAbility * ability);
|
||||
void Update(float dt);
|
||||
bool CheckUserInput(JButton key);
|
||||
virtual void Render();
|
||||
ActionStack(GameObserver* game);
|
||||
int resolve();
|
||||
int has(Interruptible * action);
|
||||
int has(MTGAbility * ability);
|
||||
int receiveEventPlus(WEvent * event);
|
||||
#if defined (WIN32) || defined (LINUX) || defined (IOS)
|
||||
void Dump();
|
||||
void Dump();
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3177,7 +3177,7 @@ public:
|
||||
{
|
||||
for (int i = 0; i < nbOpponents; i++)
|
||||
{
|
||||
if (game->isInPlay(opponents[i]))
|
||||
if (game->isInPlay(opponents[i]))
|
||||
opponents[i]->destroy();
|
||||
}
|
||||
}
|
||||
@@ -3225,14 +3225,14 @@ public:
|
||||
_target->controller()->game->putInZone(_target, _target->controller()->game->hand, _target->controller()->game->hand);
|
||||
return MTGAbility::addToGame();
|
||||
}
|
||||
|
||||
|
||||
AResetCost * clone() const
|
||||
{
|
||||
AResetCost * a = NEW AResetCost(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
~AResetCost()
|
||||
{
|
||||
}
|
||||
@@ -3246,7 +3246,7 @@ public:
|
||||
MTGAbility(id, source, target), amount(amount)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int addToGame()
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
@@ -3260,14 +3260,14 @@ public:
|
||||
}
|
||||
return MTGAbility::addToGame();
|
||||
}
|
||||
|
||||
|
||||
ABloodThirst * clone() const
|
||||
{
|
||||
ABloodThirst * a = NEW ABloodThirst(*this);
|
||||
a->isClone = 1;
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
~ABloodThirst()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
A Filter/Mask system for Card Instances to find cards matching specific settings such as color, type, etc...
|
||||
*/
|
||||
A Filter/Mask system for Card Instances to find cards matching specific settings such as color, type, etc...
|
||||
*/
|
||||
|
||||
#ifndef _CARDDESCRIPTOR_H_
|
||||
#define _CARDDESCRIPTOR_H_
|
||||
@@ -13,41 +13,42 @@
|
||||
#define CD_AND 2
|
||||
|
||||
enum ENUM_COMPARISON_MODES
|
||||
{
|
||||
COMPARISON_NONE = 0, // Needs to remain 0 for quick if(comparison_mode) checks
|
||||
{
|
||||
COMPARISON_NONE = 0, // Needs to remain 0 for quick if(comparison_mode) checks
|
||||
COMPARISON_AT_MOST,
|
||||
COMPARISON_AT_LEAST,
|
||||
COMPARISON_EQUAL,
|
||||
COMPARISON_GREATER,
|
||||
COMPARISON_LESS,
|
||||
COMPARISON_UNEQUAL
|
||||
};
|
||||
};
|
||||
|
||||
class CardDescriptor: public MTGCardInstance{
|
||||
protected:
|
||||
MTGCardInstance * match_or(MTGCardInstance * card);
|
||||
MTGCardInstance * match_and(MTGCardInstance * card);
|
||||
bool valueInRange(int comparisonMode, int value, int criterion);
|
||||
public:
|
||||
int mode;
|
||||
int powerComparisonMode;
|
||||
int toughnessComparisonMode;
|
||||
int manacostComparisonMode;
|
||||
int counterComparisonMode;
|
||||
int convertedManacost; // might fit better into MTGCardInstance?
|
||||
int anyCounter;
|
||||
int init();
|
||||
CardDescriptor();
|
||||
void unsecureSetTapped(int i);
|
||||
void unsecuresetfresh(int k);
|
||||
void setNegativeSubtype( string value);
|
||||
int counterPower;
|
||||
int counterToughness;
|
||||
int counterNB;
|
||||
string counterName;
|
||||
MTGCardInstance * match(MTGCardInstance * card);
|
||||
MTGCardInstance * match(MTGGameZone * zone);
|
||||
MTGCardInstance * nextmatch(MTGGameZone * zone, MTGCardInstance * previous);
|
||||
class CardDescriptor: public MTGCardInstance
|
||||
{
|
||||
protected:
|
||||
MTGCardInstance * match_or(MTGCardInstance * card);
|
||||
MTGCardInstance * match_and(MTGCardInstance * card);
|
||||
bool valueInRange(int comparisonMode, int value, int criterion);
|
||||
public:
|
||||
int mode;
|
||||
int powerComparisonMode;
|
||||
int toughnessComparisonMode;
|
||||
int manacostComparisonMode;
|
||||
int counterComparisonMode;
|
||||
int convertedManacost; // might fit better into MTGCardInstance?
|
||||
int anyCounter;
|
||||
int init();
|
||||
CardDescriptor();
|
||||
void unsecureSetTapped(int i);
|
||||
void unsecuresetfresh(int k);
|
||||
void setNegativeSubtype(string value);
|
||||
int counterPower;
|
||||
int counterToughness;
|
||||
int counterNB;
|
||||
string counterName;
|
||||
MTGCardInstance * match(MTGCardInstance * card);
|
||||
MTGCardInstance * match(MTGGameZone * zone);
|
||||
MTGCardInstance * nextmatch(MTGGameZone * zone, MTGCardInstance * previous);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,28 +7,29 @@ class TargetChooser;
|
||||
class MTGGameZone;
|
||||
class MTGCardInstance;
|
||||
|
||||
class CardDisplay:public PlayGuiObjectController{
|
||||
int mId;
|
||||
GameObserver* game;
|
||||
public:
|
||||
int x, y , start_item, nb_displayed_items;
|
||||
MTGGameZone * zone;
|
||||
TargetChooser * tc;
|
||||
JGuiListener * listener;
|
||||
CardDisplay();
|
||||
CardDisplay(int id, GameObserver* game, int x, int y, JGuiListener * listener = NULL, TargetChooser * tc = NULL, int nb_displayed_items = 7);
|
||||
void AddCard(MTGCardInstance * _card);
|
||||
void rotateLeft();
|
||||
void rotateRight();
|
||||
bool CheckUserInput(JButton key);
|
||||
bool CheckUserInput(int x, int y);
|
||||
virtual void Update(float dt);
|
||||
void Render();
|
||||
void init(MTGGameZone * zone);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
class CardDisplay: public PlayGuiObjectController
|
||||
{
|
||||
int mId;
|
||||
GameObserver* game;
|
||||
public:
|
||||
int x, y, start_item, nb_displayed_items;
|
||||
MTGGameZone * zone;
|
||||
TargetChooser * tc;
|
||||
JGuiListener * listener;
|
||||
CardDisplay();
|
||||
CardDisplay(int id, GameObserver* game, int x, int y, JGuiListener * listener = NULL, TargetChooser * tc = NULL,
|
||||
int nb_displayed_items = 7);
|
||||
void AddCard(MTGCardInstance * _card);
|
||||
void rotateLeft();
|
||||
void rotateRight();
|
||||
bool CheckUserInput(JButton key);
|
||||
bool CheckUserInput(int x, int y);
|
||||
virtual void Update(float dt);
|
||||
void Render();
|
||||
void init(MTGGameZone * zone);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const CardDisplay& m);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,17 +6,16 @@
|
||||
|
||||
struct CardGui;
|
||||
|
||||
class CardEffect : public Effect
|
||||
class CardEffect: public Effect
|
||||
{
|
||||
public:
|
||||
CardEffect(CardGui* target);
|
||||
~CardEffect();
|
||||
private:
|
||||
CardGui* target;
|
||||
public:
|
||||
CardEffect(CardGui* target);
|
||||
~CardEffect();
|
||||
private:
|
||||
CardGui* target;
|
||||
|
||||
public:
|
||||
virtual void Render();
|
||||
public:
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
|
||||
#endif // _CARDEFFECT_H_
|
||||
|
||||
@@ -14,73 +14,84 @@ class PlayGuiObject;
|
||||
|
||||
namespace DrawMode
|
||||
{
|
||||
enum
|
||||
{
|
||||
kNormal = 0,
|
||||
kText,
|
||||
kHidden
|
||||
};
|
||||
const int kNumDrawModes = 3;
|
||||
enum
|
||||
{
|
||||
kNormal,
|
||||
kText,
|
||||
kHidden
|
||||
};
|
||||
const int kNumDrawModes = 3;
|
||||
}
|
||||
|
||||
struct CardGui : public PlayGuiObject {
|
||||
protected:
|
||||
struct CardGui: public PlayGuiObject
|
||||
{
|
||||
protected:
|
||||
|
||||
/*
|
||||
** Tries to render the Big version of a card picture, backups to text version in case of failure
|
||||
*/
|
||||
static void RenderBig(MTGCard * card, const Pos& pos);
|
||||
|
||||
void RenderCountersBig(const Pos& pos);
|
||||
static void AlternateRender(MTGCard * card, const Pos& pos);
|
||||
static void TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad);
|
||||
/*
|
||||
** Tries to render the Big version of a card picture, backups to text version in case of failure
|
||||
*/
|
||||
static void RenderBig(MTGCard * card, const Pos& pos);
|
||||
|
||||
public:
|
||||
static const float Width;
|
||||
static const float Height;
|
||||
static const float BigWidth;
|
||||
static const float BigHeight;
|
||||
void RenderCountersBig(const Pos& pos);
|
||||
static void AlternateRender(MTGCard * card, const Pos& pos);
|
||||
static void TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad);
|
||||
|
||||
MTGCardInstance* card;
|
||||
CardGui(MTGCardInstance* card, float x, float y);
|
||||
CardGui(MTGCardInstance* card, const Pos& ref);
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
public:
|
||||
static const float Width;
|
||||
static const float Height;
|
||||
static const float BigWidth;
|
||||
static const float BigHeight;
|
||||
|
||||
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal);
|
||||
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal);
|
||||
MTGCardInstance* card;
|
||||
CardGui(MTGCardInstance* card, float x, float y);
|
||||
CardGui(MTGCardInstance* card, const Pos& ref);
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
|
||||
static JQuad * AlternateThumbQuad(MTGCard * card);
|
||||
virtual ostream& toString(ostream&) const;
|
||||
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal);
|
||||
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal);
|
||||
|
||||
static JQuad * AlternateThumbQuad(MTGCard * card);
|
||||
virtual ostream& toString(ostream&) const;
|
||||
};
|
||||
|
||||
class CardView: public CardGui
|
||||
{
|
||||
public:
|
||||
|
||||
class CardView : public CardGui {
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
nullZone, handZone, playZone
|
||||
} SelectorZone;
|
||||
|
||||
typedef enum {
|
||||
nullZone, handZone, playZone
|
||||
} SelectorZone;
|
||||
const SelectorZone owner;
|
||||
|
||||
const SelectorZone owner;
|
||||
MTGCardInstance* getCard(); // remove this when possible
|
||||
CardView(const SelectorZone, MTGCardInstance* card, float x, float y);
|
||||
CardView(const SelectorZone, MTGCardInstance* card, const Pos& ref);
|
||||
virtual ~CardView();
|
||||
|
||||
MTGCardInstance* getCard(); // remove this when possible
|
||||
CardView(const SelectorZone, MTGCardInstance* card, float x, float y);
|
||||
CardView(const SelectorZone, MTGCardInstance* card, const Pos& ref);
|
||||
virtual ~CardView();
|
||||
void Render()
|
||||
{
|
||||
CardGui::Render();
|
||||
}
|
||||
;
|
||||
void Render(JQuad* q)
|
||||
{
|
||||
Pos::Render(q);
|
||||
}
|
||||
;
|
||||
virtual ostream& toString(ostream&) const;
|
||||
|
||||
void Render(){CardGui::Render();};
|
||||
void Render(JQuad* q){Pos::Render(q);};
|
||||
virtual ostream& toString(ostream&) const;
|
||||
|
||||
float GetCenterX();
|
||||
float GetCenterY();
|
||||
float GetCenterX();
|
||||
float GetCenterY();
|
||||
};
|
||||
|
||||
class TransientCardView : public CardGui {
|
||||
public:
|
||||
TransientCardView(MTGCardInstance* card, float x, float y);
|
||||
TransientCardView(MTGCardInstance* card, const Pos& ref);
|
||||
class TransientCardView: public CardGui
|
||||
{
|
||||
public:
|
||||
TransientCardView(MTGCardInstance* card, float x, float y);
|
||||
TransientCardView(MTGCardInstance* card, const Pos& ref);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef _CARDPRIMITIVE_H_
|
||||
#define _CARDPRIMITIVE_H_
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -10,72 +9,72 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
class CardPrimitive {
|
||||
protected:
|
||||
vector<string> ftdText;
|
||||
string lcname;
|
||||
ManaCost manaCost;
|
||||
class CardPrimitive
|
||||
{
|
||||
protected:
|
||||
vector<string> ftdText;
|
||||
string lcname;
|
||||
ManaCost manaCost;
|
||||
|
||||
public:
|
||||
string text;
|
||||
string name;
|
||||
int init();
|
||||
public:
|
||||
string text;
|
||||
string name;
|
||||
int init();
|
||||
|
||||
int colors[Constants::MTG_NB_COLORS];
|
||||
map<int,int> basicAbilities;
|
||||
map<string,string> magicTexts;
|
||||
string magicText;
|
||||
int alias;
|
||||
string spellTargetType;
|
||||
int power;
|
||||
int toughness;
|
||||
vector<int>types;
|
||||
CardPrimitive();
|
||||
CardPrimitive(CardPrimitive * source);
|
||||
int colors[Constants::MTG_NB_COLORS];
|
||||
map<int, int> basicAbilities;
|
||||
map<string, string> magicTexts;
|
||||
string magicText;
|
||||
int alias;
|
||||
string spellTargetType;
|
||||
int power;
|
||||
int toughness;
|
||||
vector<int> types;
|
||||
CardPrimitive();
|
||||
CardPrimitive(CardPrimitive * source);
|
||||
|
||||
void setColor(int _color, int removeAllOthers = 0);
|
||||
void setColor(string _color, int removeAllOthers = 0);
|
||||
void removeColor(int color);
|
||||
int getColor();
|
||||
int hasColor(int _color);
|
||||
int countColors();
|
||||
void setColor(int _color, int removeAllOthers = 0);
|
||||
void setColor(string _color, int removeAllOthers = 0);
|
||||
void removeColor(int color);
|
||||
int getColor();
|
||||
int hasColor(int _color);
|
||||
int countColors();
|
||||
|
||||
int has(int ability);
|
||||
int has(int ability);
|
||||
|
||||
void setText(const string& value);
|
||||
const char * getText();
|
||||
void setText(const string& value);
|
||||
const char * getText();
|
||||
|
||||
void addMagicText(string value);
|
||||
void addMagicText(string value, string zone);
|
||||
void addMagicText(string value);
|
||||
void addMagicText(string value, string zone);
|
||||
|
||||
void setName(const string& value);
|
||||
const string& getName() const;
|
||||
const string& getLCName() const;
|
||||
void setName(const string& value);
|
||||
const string& getName() const;
|
||||
const string& getLCName() const;
|
||||
|
||||
void addType(char * type_text);
|
||||
void addType(int id);
|
||||
void setType(const string& type_text);
|
||||
void setSubtype(const string& value);
|
||||
int removeType(string value, int removeAll = 0);
|
||||
int removeType(int value, int removeAll = 0);
|
||||
bool hasSubtype(int _subtype);
|
||||
bool hasSubtype(const char * _subtype);
|
||||
bool hasSubtype(string _subtype);
|
||||
bool hasType(int _type);
|
||||
bool hasType(const char * type);
|
||||
void addType(char * type_text);
|
||||
void addType(int id);
|
||||
void setType(const string& type_text);
|
||||
void setSubtype(const string& value);
|
||||
int removeType(string value, int removeAll = 0);
|
||||
int removeType(int value, int removeAll = 0);
|
||||
bool hasSubtype(int _subtype);
|
||||
bool hasSubtype(const char * _subtype);
|
||||
bool hasSubtype(string _subtype);
|
||||
bool hasType(int _type);
|
||||
bool hasType(const char * type);
|
||||
|
||||
void setManaCost(string value);
|
||||
ManaCost * getManaCost();
|
||||
bool isCreature();
|
||||
bool isLand();
|
||||
bool isSpell();
|
||||
void setManaCost(string value);
|
||||
ManaCost * getManaCost();
|
||||
bool isCreature();
|
||||
bool isLand();
|
||||
bool isSpell();
|
||||
|
||||
void setPower(int _power);
|
||||
int getPower();
|
||||
void setToughness(int _toughness);
|
||||
int getToughness();
|
||||
const vector<string>& formattedText();
|
||||
void setPower(int _power);
|
||||
int getPower();
|
||||
void setToughness(int _toughness);
|
||||
int getToughness();
|
||||
const vector<string>& formattedText();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,84 +12,87 @@ using std::vector;
|
||||
class PlayGuiObject;
|
||||
class DuelLayers;
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
struct LimitorFunctor
|
||||
{
|
||||
virtual bool select(T*) = 0;
|
||||
virtual bool greyout(T*) = 0;
|
||||
typedef T Target;
|
||||
virtual bool select(T*) = 0;
|
||||
virtual bool greyout(T*) = 0;
|
||||
typedef T Target;
|
||||
};
|
||||
|
||||
class CardSelectorBase : public GuiLayer
|
||||
class CardSelectorBase: public GuiLayer
|
||||
{
|
||||
public:
|
||||
|
||||
CardSelectorBase(int inDrawMode = DrawMode::kNormal) : mDrawMode(inDrawMode) {};
|
||||
virtual void Add(PlayGuiObject*) = 0;
|
||||
virtual void Remove(PlayGuiObject*) = 0;
|
||||
virtual bool CheckUserInput(JButton key) = 0;
|
||||
virtual bool CheckUserInput(int x, int y) = 0;
|
||||
virtual void PushLimitor() = 0;
|
||||
virtual void PopLimitor() = 0;
|
||||
virtual void Limit(LimitorFunctor<PlayGuiObject>* inLimitor, CardView::SelectorZone inZone) = 0;
|
||||
virtual void Push() = 0;
|
||||
virtual void Pop() = 0;
|
||||
virtual int GetDrawMode()
|
||||
{
|
||||
return mDrawMode;
|
||||
}
|
||||
CardSelectorBase(int inDrawMode = DrawMode::kNormal) :
|
||||
mDrawMode(inDrawMode)
|
||||
{
|
||||
}
|
||||
;
|
||||
virtual void Add(PlayGuiObject*) = 0;
|
||||
virtual void Remove(PlayGuiObject*) = 0;
|
||||
virtual bool CheckUserInput(JButton key) = 0;
|
||||
virtual bool CheckUserInput(int x, int y) = 0;
|
||||
virtual void PushLimitor() = 0;
|
||||
virtual void PopLimitor() = 0;
|
||||
virtual void Limit(LimitorFunctor<PlayGuiObject>* inLimitor, CardView::SelectorZone inZone) = 0;
|
||||
virtual void Push() = 0;
|
||||
virtual void Pop() = 0;
|
||||
virtual int GetDrawMode()
|
||||
{
|
||||
return mDrawMode;
|
||||
}
|
||||
|
||||
protected:
|
||||
int mDrawMode;
|
||||
int mDrawMode;
|
||||
};
|
||||
|
||||
|
||||
class CardSelector : public CardSelectorBase
|
||||
class CardSelector: public CardSelectorBase
|
||||
{
|
||||
public:
|
||||
struct SelectorMemory
|
||||
{
|
||||
PlayGuiObject* object;
|
||||
float x, y;
|
||||
SelectorMemory(PlayGuiObject* object);
|
||||
SelectorMemory();
|
||||
};
|
||||
struct SelectorMemory
|
||||
{
|
||||
PlayGuiObject* object;
|
||||
float x, y;
|
||||
SelectorMemory(PlayGuiObject* object);
|
||||
SelectorMemory();
|
||||
};
|
||||
|
||||
protected:
|
||||
vector<PlayGuiObject*> cards;
|
||||
PlayGuiObject* active;
|
||||
DuelLayers* duel;
|
||||
LimitorFunctor<PlayGuiObject>* limitor;
|
||||
Pos bigpos;
|
||||
map<const CardView::SelectorZone, SelectorMemory> lasts;
|
||||
stack< pair<LimitorFunctor<PlayGuiObject>*, CardView::SelectorZone> > limitorStack;
|
||||
stack<SelectorMemory> memoryStack;
|
||||
vector<PlayGuiObject*> cards;
|
||||
PlayGuiObject* active;
|
||||
DuelLayers* duel;
|
||||
LimitorFunctor<PlayGuiObject>* limitor;
|
||||
Pos bigpos;
|
||||
map<const CardView::SelectorZone, SelectorMemory> lasts;
|
||||
stack<pair<LimitorFunctor<PlayGuiObject>*, CardView::SelectorZone> > limitorStack;
|
||||
stack<SelectorMemory> memoryStack;
|
||||
|
||||
PlayGuiObject* fetchMemory(SelectorMemory&);
|
||||
PlayGuiObject* fetchMemory(SelectorMemory&);
|
||||
|
||||
public:
|
||||
CardSelector(DuelLayers*);
|
||||
void Add(PlayGuiObject*);
|
||||
void Remove(PlayGuiObject*);
|
||||
bool CheckUserInput(JButton key);
|
||||
bool CheckUserInput(int x, int y);
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void Push();
|
||||
void Pop();
|
||||
CardSelector(DuelLayers*);
|
||||
void Add(PlayGuiObject*);
|
||||
void Remove(PlayGuiObject*);
|
||||
bool CheckUserInput(JButton key);
|
||||
bool CheckUserInput(int x, int y);
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void Push();
|
||||
void Pop();
|
||||
|
||||
void Limit(LimitorFunctor<PlayGuiObject>* limitor, CardView::SelectorZone);
|
||||
void PushLimitor();
|
||||
void PopLimitor();
|
||||
void Limit(LimitorFunctor<PlayGuiObject>* limitor, CardView::SelectorZone);
|
||||
void PushLimitor();
|
||||
void PopLimitor();
|
||||
|
||||
typedef PlayGuiObject Target;
|
||||
typedef PlayGuiObject Target;
|
||||
};
|
||||
|
||||
typedef LimitorFunctor<CardSelector::Target> Limitor;
|
||||
|
||||
struct Exp
|
||||
{
|
||||
static inline bool test(CardSelector::Target*, CardSelector::Target*);
|
||||
static inline bool test(CardSelector::Target*, CardSelector::Target*);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,24 +7,23 @@ class DuelLayers;
|
||||
|
||||
namespace CardSelectorSingleton
|
||||
{
|
||||
/*
|
||||
** CardSelector is essentially a singleton in its usage
|
||||
** It's not enforced, but it needs to eventually migrate to the real thing
|
||||
** For now, this function will fake it out - it's up to the client caller to make sure
|
||||
** that this gets destroyed via a Terminate call (this is currently handled in DualLayers's destructor)
|
||||
*/
|
||||
CardSelectorBase* Instance();
|
||||
/*
|
||||
** CardSelector is essentially a singleton in its usage
|
||||
** It's not enforced, but it needs to eventually migrate to the real thing
|
||||
** For now, this function will fake it out - it's up to the client caller to make sure
|
||||
** that this gets destroyed via a Terminate call (this is currently handled in DualLayers's destructor)
|
||||
*/
|
||||
CardSelectorBase* Instance();
|
||||
|
||||
/*
|
||||
** Create the singleton pointer. Instance() isn't valid until this is called.
|
||||
*/
|
||||
CardSelectorBase* Create(DuelLayers* inDuelLayers);
|
||||
/*
|
||||
** Create the singleton pointer. Instance() isn't valid until this is called.
|
||||
*/
|
||||
CardSelectorBase* Create(DuelLayers* inDuelLayers);
|
||||
|
||||
/*
|
||||
** Teardown the singleton pointer instance.
|
||||
*/
|
||||
void Terminate();
|
||||
/*
|
||||
** Teardown the singleton pointer instance.
|
||||
*/
|
||||
void Terminate();
|
||||
}
|
||||
|
||||
|
||||
#endif //CARDSELECTORSINGLETON_H
|
||||
|
||||
@@ -2,43 +2,43 @@
|
||||
#define _COUNTERS_H_
|
||||
#include <string>
|
||||
|
||||
|
||||
using std::string;
|
||||
class MTGCardInstance;
|
||||
|
||||
/* One family of counters. Ex : +1/+1 */
|
||||
class Counter{
|
||||
public :
|
||||
string name;
|
||||
int nb;
|
||||
int power, toughness;
|
||||
MTGCardInstance * target;
|
||||
Counter(MTGCardInstance * _target, int _power, int _toughness);
|
||||
Counter(MTGCardInstance * _target, const char * _name,int _power = 0 , int _toughness = 0 );
|
||||
int init(MTGCardInstance * _target,const char * _name, int _power, int _toughness);
|
||||
bool sameAs(const char * _name, int _power, int _toughness);
|
||||
bool cancels(int _power, int _toughness);
|
||||
int added();
|
||||
int removed();
|
||||
class Counter
|
||||
{
|
||||
public:
|
||||
string name;
|
||||
int nb;
|
||||
int power, toughness;
|
||||
MTGCardInstance * target;
|
||||
Counter(MTGCardInstance * _target, int _power, int _toughness);
|
||||
Counter(MTGCardInstance * _target, const char * _name, int _power = 0, int _toughness = 0);
|
||||
int init(MTGCardInstance * _target, const char * _name, int _power, int _toughness);
|
||||
bool sameAs(const char * _name, int _power, int _toughness);
|
||||
bool cancels(int _power, int _toughness);
|
||||
int added();
|
||||
int removed();
|
||||
};
|
||||
|
||||
/* Various families of counters attached to an instance of a card */
|
||||
class Counters{
|
||||
public:
|
||||
int mCount;
|
||||
Counter * counters[10];
|
||||
MTGCardInstance * target;
|
||||
Counters(MTGCardInstance * _target);
|
||||
~Counters();
|
||||
int addCounter(const char * _name,int _power = 0, int _toughness = 0);
|
||||
int addCounter(int _power, int _toughness);
|
||||
int removeCounter(const char * _name,int _power = 0, int _toughness = 0);
|
||||
int removeCounter(int _power, int _toughness);
|
||||
Counter * hasCounter(const char * _name,int _power = 0, int _toughness = 0);
|
||||
Counter * hasCounter(int _power, int _toughness);
|
||||
Counter * getNext(Counter * previous = NULL);
|
||||
int init();
|
||||
class Counters
|
||||
{
|
||||
public:
|
||||
int mCount;
|
||||
Counter * counters[10];
|
||||
MTGCardInstance * target;
|
||||
Counters(MTGCardInstance * _target);
|
||||
~Counters();
|
||||
int addCounter(const char * _name, int _power = 0, int _toughness = 0);
|
||||
int addCounter(int _power, int _toughness);
|
||||
int removeCounter(const char * _name, int _power = 0, int _toughness = 0);
|
||||
int removeCounter(int _power, int _toughness);
|
||||
Counter * hasCounter(const char * _name, int _power = 0, int _toughness = 0);
|
||||
Counter * hasCounter(int _power, int _toughness);
|
||||
Counter * getNext(Counter * previous = NULL);
|
||||
int init();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef _CREDITS_H_
|
||||
#define _CREDITS_H_
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <JGE.h>
|
||||
@@ -13,42 +12,43 @@ class GameApp;
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
class CreditBonus{
|
||||
class CreditBonus
|
||||
{
|
||||
public:
|
||||
int value;
|
||||
string text;
|
||||
CreditBonus(int _value, string _text);
|
||||
void Render(float x, float y, WFont * font);
|
||||
int value;
|
||||
string text;
|
||||
CreditBonus(int _value, string _text);
|
||||
void Render(float x, float y, WFont * font);
|
||||
};
|
||||
|
||||
class Credits{
|
||||
class Credits
|
||||
{
|
||||
private:
|
||||
time_t gameLength;
|
||||
int isDifficultyUnlocked(DeckStats * stats);
|
||||
int isMomirUnlocked();
|
||||
int isEvilTwinUnlocked();
|
||||
int isRandomDeckUnlocked();
|
||||
int IsMoreAIDecksUnlocked(DeckStats * stats);
|
||||
string unlockedTextureName;
|
||||
JQuad * GetUnlockedQuad(string texturename);
|
||||
time_t gameLength;
|
||||
int isDifficultyUnlocked(DeckStats * stats);
|
||||
int isMomirUnlocked();
|
||||
int isEvilTwinUnlocked();
|
||||
int isRandomDeckUnlocked();
|
||||
int IsMoreAIDecksUnlocked(DeckStats * stats);
|
||||
string unlockedTextureName;
|
||||
JQuad * GetUnlockedQuad(string texturename);
|
||||
public:
|
||||
int value;
|
||||
Player * p1, *p2;
|
||||
GameApp * app;
|
||||
int showMsg;
|
||||
int unlocked;
|
||||
string unlockedString;
|
||||
vector<CreditBonus *> bonus;
|
||||
Credits();
|
||||
~Credits();
|
||||
void compute(Player * _p1, Player * _p2, GameApp * _app);
|
||||
void Render();
|
||||
static int unlockRandomSet(bool force = false);
|
||||
static int unlockSetByName(string name);
|
||||
static int addCreditBonus(int value);
|
||||
static int addCardToCollection(int cardId, MTGDeck * collection);
|
||||
static int addCardToCollection(int cardId);
|
||||
int value;
|
||||
Player * p1, *p2;
|
||||
GameApp * app;
|
||||
int showMsg;
|
||||
int unlocked;
|
||||
string unlockedString;
|
||||
vector<CreditBonus *> bonus;
|
||||
Credits();
|
||||
~Credits();
|
||||
void compute(Player * _p1, Player * _p2, GameApp * _app);
|
||||
void Render();
|
||||
static int unlockRandomSet(bool force = false);
|
||||
static int unlockSetByName(string name);
|
||||
static int addCreditBonus(int value);
|
||||
static int addCardToCollection(int cardId, MTGDeck * collection);
|
||||
static int addCardToCollection(int cardId);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -17,49 +17,77 @@ class GameObserver;
|
||||
#define DAMAGE_COMBAT 1
|
||||
#define DAMAGE_OTHER 2
|
||||
|
||||
class Damageable:public Targetable {
|
||||
protected:
|
||||
public:
|
||||
int life;
|
||||
int poisonCount;
|
||||
int damageCount;
|
||||
int preventable;
|
||||
int type_as_damageable;
|
||||
Damageable(int _life){life=_life;};
|
||||
int getLife(){return life;};
|
||||
virtual int dealDamage(int damage){life-=damage;return life;};
|
||||
virtual int afterDamage(){return 0;}
|
||||
virtual int poisoned(){return 0;}
|
||||
virtual int prevented(){return 0;}
|
||||
virtual JQuad * getIcon(){return NULL;};
|
||||
class Damageable: public Targetable
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
int life;
|
||||
int poisonCount;
|
||||
int damageCount;
|
||||
int preventable;
|
||||
int type_as_damageable;
|
||||
Damageable(int _life)
|
||||
{
|
||||
life = _life;
|
||||
}
|
||||
;
|
||||
int getLife()
|
||||
{
|
||||
return life;
|
||||
}
|
||||
;
|
||||
virtual int dealDamage(int damage)
|
||||
{
|
||||
life -= damage;
|
||||
return life;
|
||||
}
|
||||
;
|
||||
virtual int afterDamage()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual int poisoned()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual int prevented()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual JQuad * getIcon()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
class Damage: public Interruptible {
|
||||
protected:
|
||||
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
|
||||
public:
|
||||
Damageable * target;
|
||||
int typeOfDamage;
|
||||
int damage;
|
||||
void Render();
|
||||
Damage(MTGCardInstance* source, Damageable * target);
|
||||
Damage(MTGCardInstance* source, Damageable * target, int damage, int typeOfDamage = DAMAGE_OTHER);
|
||||
int resolve();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
class Damage: public Interruptible
|
||||
{
|
||||
protected:
|
||||
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
|
||||
public:
|
||||
Damageable * target;
|
||||
int typeOfDamage;
|
||||
int damage;
|
||||
void Render();
|
||||
Damage(MTGCardInstance* source, Damageable * target);
|
||||
Damage(MTGCardInstance* source, Damageable * target, int damage, int typeOfDamage = DAMAGE_OTHER);
|
||||
int resolve();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class DamageStack: public GuiLayer, public Interruptible
|
||||
{
|
||||
protected:
|
||||
int currentState;
|
||||
GameObserver* game;
|
||||
|
||||
class DamageStack : public GuiLayer, public Interruptible{
|
||||
protected:
|
||||
int currentState;
|
||||
GameObserver* game;
|
||||
|
||||
public:
|
||||
int receiveEvent(WEvent * event);
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
DamageStack();
|
||||
public:
|
||||
int receiveEvent(WEvent * event);
|
||||
int resolve();
|
||||
void Render();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
DamageStack();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,31 +6,33 @@
|
||||
|
||||
class Player;
|
||||
|
||||
struct DamagerDamaged : TransientCardView {
|
||||
bool show;
|
||||
Player * damageSelecter;
|
||||
vector<Damage> damages;
|
||||
int damageToDeal;
|
||||
struct DamagerDamaged: TransientCardView
|
||||
{
|
||||
bool show;
|
||||
Player * damageSelecter;
|
||||
vector<Damage> damages;
|
||||
int damageToDeal;
|
||||
|
||||
void addDamage(int damage, DamagerDamaged* source);
|
||||
int removeDamagesTo(DamagerDamaged* target);
|
||||
int removeDamagesFrom(DamagerDamaged* source);
|
||||
void clearDamage();
|
||||
int sumDamages();
|
||||
bool hasLethalDamage();
|
||||
DamagerDamaged(MTGCardInstance* card, float x, float y, bool show, Player* damageSelecter);
|
||||
DamagerDamaged(MTGCardInstance* card, const Pos& ref, bool show, Player* damageSelecter);
|
||||
void addDamage(int damage, DamagerDamaged* source);
|
||||
int removeDamagesTo(DamagerDamaged* target);
|
||||
int removeDamagesFrom(DamagerDamaged* source);
|
||||
void clearDamage();
|
||||
int sumDamages();
|
||||
bool hasLethalDamage();
|
||||
DamagerDamaged(MTGCardInstance* card, float x, float y, bool show, Player* damageSelecter);
|
||||
DamagerDamaged(MTGCardInstance* card, const Pos& ref, bool show, Player* damageSelecter);
|
||||
|
||||
~DamagerDamaged();
|
||||
void Render(CombatStep mode);
|
||||
~DamagerDamaged();
|
||||
void Render(CombatStep mode);
|
||||
};
|
||||
|
||||
typedef DamagerDamaged DefenserDamaged;
|
||||
struct AttackerDamaged : DamagerDamaged {
|
||||
vector<DefenserDamaged*> blockers;
|
||||
AttackerDamaged(MTGCardInstance* card, float x, float y, bool show, Player* damageSelecter);
|
||||
AttackerDamaged(MTGCardInstance* card, const Pos& ref, bool show, Player* damageSelecter);
|
||||
~AttackerDamaged();
|
||||
struct AttackerDamaged: DamagerDamaged
|
||||
{
|
||||
vector<DefenserDamaged*> blockers;
|
||||
AttackerDamaged(MTGCardInstance* card, float x, float y, bool show, Player* damageSelecter);
|
||||
AttackerDamaged(MTGCardInstance* card, const Pos& ref, bool show, Player* damageSelecter);
|
||||
~AttackerDamaged();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,14 +12,25 @@ using std::string;
|
||||
|
||||
class MTGDeck;
|
||||
|
||||
class DeckDataWrapper: public WSrcDeck {
|
||||
public:
|
||||
MTGDeck * parent;
|
||||
DeckDataWrapper(MTGDeck * deck);
|
||||
bool next() {currentPos++; return true;};
|
||||
bool prev() {currentPos--; return true;};
|
||||
void save();
|
||||
void save(string filepath, bool useExpandedCardNames, string &deckTitle, string &deckDesc);
|
||||
class DeckDataWrapper: public WSrcDeck
|
||||
{
|
||||
public:
|
||||
MTGDeck * parent;
|
||||
DeckDataWrapper(MTGDeck * deck);
|
||||
bool next()
|
||||
{
|
||||
currentPos++;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
bool prev()
|
||||
{
|
||||
currentPos--;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
void save();
|
||||
void save(string filepath, bool useExpandedCardNames, string &deckTitle, string &deckDesc);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,20 +3,19 @@
|
||||
#include "DeckDataWrapper.h"
|
||||
#include "DeckStats.h"
|
||||
|
||||
class DeckEditorMenu :
|
||||
public DeckMenu
|
||||
class DeckEditorMenu: public DeckMenu
|
||||
{
|
||||
protected:
|
||||
string deckTitle;
|
||||
|
||||
private:
|
||||
void drawDeckStatistics();
|
||||
void drawDeckStatistics();
|
||||
|
||||
DeckDataWrapper *selectedDeck;
|
||||
StatsWrapper *stw;
|
||||
|
||||
public:
|
||||
DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const char * _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL);
|
||||
void Render();
|
||||
~DeckEditorMenu();
|
||||
DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const char * _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL);
|
||||
void Render();
|
||||
~DeckEditorMenu();
|
||||
};
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
class DeckManager
|
||||
{
|
||||
private:
|
||||
@@ -17,24 +16,22 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
|
||||
vector<DeckMetaData *> playerDeckOrderList;
|
||||
vector<DeckMetaData *> aiDeckOrderList;
|
||||
|
||||
void updateMetaDataList(vector<DeckMetaData *>* refList, bool isAI );
|
||||
void updateMetaDataList(vector<DeckMetaData *>* refList, bool isAI);
|
||||
vector<DeckMetaData *> * getPlayerDeckOrderList();
|
||||
vector<DeckMetaData *> * getAIDeckOrderList();
|
||||
|
||||
|
||||
static DeckManager * GetInstance();
|
||||
static void EndInstance();
|
||||
|
||||
//convenience method to get the difficulty rating between two decks. This should be refined a little more
|
||||
//since the eventual move of all deck meta data should be managed by this class
|
||||
|
||||
static int getDifficultyRating( Player *statsPlayer, Player *player );
|
||||
static int getDifficultyRating(Player *statsPlayer, Player *player);
|
||||
|
||||
|
||||
~DeckManager()
|
||||
{
|
||||
instanceFlag = false;
|
||||
|
||||
@@ -56,15 +56,20 @@ public:
|
||||
JQuad * pspIcons[8];
|
||||
JTexture * pspIconsTexture;
|
||||
|
||||
|
||||
DeckMenu(int id, JGuiListener* listener, int fontId, const string _title = "", const int& startIndex = 0, bool alwaysShowDetailsButton = false);
|
||||
~DeckMenu();
|
||||
|
||||
DeckMetaData * getSelectedDeck();
|
||||
void enableDisplayDetailsOverride();
|
||||
bool showDetailsScreen();
|
||||
bool isClosed() { return mClosed; }
|
||||
int getSelectedDeckId() { return mSelectedDeckId; }
|
||||
bool showDetailsScreen();
|
||||
bool isClosed()
|
||||
{
|
||||
return mClosed;
|
||||
}
|
||||
int getSelectedDeckId()
|
||||
{
|
||||
return mSelectedDeckId;
|
||||
}
|
||||
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
|
||||
@@ -11,41 +11,53 @@ using std::string;
|
||||
class DeckMenuItem: public JGuiObject
|
||||
{
|
||||
private:
|
||||
bool mHasFocus;
|
||||
bool mScrollEnabled;
|
||||
bool mDisplayInitialized;
|
||||
bool mHasFocus;
|
||||
bool mScrollEnabled;
|
||||
bool mDisplayInitialized;
|
||||
|
||||
DeckMenu* parent;
|
||||
int fontId;
|
||||
string mText;
|
||||
float mTitleResetWidth;
|
||||
DeckMenu* parent;
|
||||
int fontId;
|
||||
string mText;
|
||||
float mTitleResetWidth;
|
||||
|
||||
public:
|
||||
string imageFilename;
|
||||
string desc;
|
||||
float mScrollerOffset;
|
||||
DeckMetaData *meta;
|
||||
string imageFilename;
|
||||
string desc;
|
||||
float mScrollerOffset;
|
||||
DeckMetaData *meta;
|
||||
|
||||
float mX;
|
||||
float mY;
|
||||
float mX;
|
||||
float mY;
|
||||
|
||||
void Relocate(float x, float y);
|
||||
float GetWidth();
|
||||
string GetText() { return mText; }
|
||||
string GetDescription() { return desc; }
|
||||
bool hasFocus();
|
||||
void Relocate(float x, float y);
|
||||
float GetWidth();
|
||||
string GetText()
|
||||
{
|
||||
return mText;
|
||||
}
|
||||
string GetDescription()
|
||||
{
|
||||
return desc;
|
||||
}
|
||||
bool hasFocus();
|
||||
|
||||
DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false, DeckMetaData *meta = NULL);
|
||||
~DeckMenuItem();
|
||||
DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false, DeckMetaData *meta = NULL);
|
||||
~DeckMenuItem();
|
||||
|
||||
void RenderWithOffset(float yOffset);
|
||||
virtual void Render();
|
||||
virtual void Update( float dt );
|
||||
virtual void Entering();
|
||||
virtual bool Leaving(JButton key);
|
||||
virtual bool ButtonPressed();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual bool getTopLeft(float& top, float& left) {top = mY; left = mX; return true;};
|
||||
void RenderWithOffset(float yOffset);
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
virtual void Entering();
|
||||
virtual bool Leaving(JButton key);
|
||||
virtual bool ButtonPressed();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual bool getTopLeft(float& top, float& left)
|
||||
{
|
||||
top = mY;
|
||||
left = mX;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <map>
|
||||
#include "DeckStats.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
enum DECK_DIFFICULTY
|
||||
{
|
||||
@@ -14,54 +13,55 @@ enum DECK_DIFFICULTY
|
||||
NORMAL = 0,
|
||||
EASY = 1
|
||||
};
|
||||
|
||||
class DeckMetaData {
|
||||
|
||||
class DeckMetaData
|
||||
{
|
||||
private:
|
||||
string _filename;
|
||||
string _filename;
|
||||
|
||||
string _desc;
|
||||
string _name;
|
||||
int _deckid;
|
||||
string _avatarFilename;
|
||||
string _desc;
|
||||
string _name;
|
||||
int _deckid;
|
||||
string _avatarFilename;
|
||||
|
||||
// statistical information
|
||||
|
||||
int _nbGamesPlayed, _victories, _percentVictories, _difficulty;
|
||||
// statistical information
|
||||
|
||||
int _nbGamesPlayed, _victories, _percentVictories, _difficulty;
|
||||
|
||||
public:
|
||||
DeckMetaData();
|
||||
DeckMetaData(string filename, Player * statsPlayer);
|
||||
void load(string filename);
|
||||
void loadStatsForPlayer( Player * statsPlayer, string deckStatsFileName = "" );
|
||||
|
||||
// Accessors
|
||||
string getFilename();
|
||||
string getDescription();
|
||||
string getName();
|
||||
string getAvatarFilename();
|
||||
int getAvatarId(int deckId);
|
||||
string getStatsSummary();
|
||||
DeckMetaData();
|
||||
DeckMetaData(string filename, Player * statsPlayer);
|
||||
void load(string filename);
|
||||
void loadStatsForPlayer(Player * statsPlayer, string deckStatsFileName = "");
|
||||
|
||||
int getDeckId();
|
||||
int getGamesPlayed();
|
||||
int getVictories();
|
||||
int getVictoryPercentage();
|
||||
int getDifficulty();
|
||||
string getDifficultyString();
|
||||
// Accessors
|
||||
string getFilename();
|
||||
string getDescription();
|
||||
string getName();
|
||||
string getAvatarFilename();
|
||||
int getAvatarId(int deckId);
|
||||
string getStatsSummary();
|
||||
|
||||
int getDeckId();
|
||||
int getGamesPlayed();
|
||||
int getVictories();
|
||||
int getVictoryPercentage();
|
||||
int getDifficulty();
|
||||
string getDifficultyString();
|
||||
|
||||
};
|
||||
|
||||
class DeckMetaDataList {
|
||||
class DeckMetaDataList
|
||||
{
|
||||
private:
|
||||
map<string,DeckMetaData *>values;
|
||||
map<string, DeckMetaData *> values;
|
||||
|
||||
public:
|
||||
void invalidate(string filename);
|
||||
DeckMetaData * get(string filename, Player * statsPlayer = NULL);
|
||||
~DeckMetaDataList();
|
||||
static DeckMetaDataList * decksMetaData;
|
||||
void invalidate(string filename);
|
||||
DeckMetaData * get(string filename, Player * statsPlayer = NULL);
|
||||
~DeckMetaDataList();
|
||||
static DeckMetaDataList * decksMetaData;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,9 +45,9 @@ public:
|
||||
|
||||
class StatsWrapper
|
||||
{
|
||||
private:
|
||||
private:
|
||||
void initValues();
|
||||
|
||||
|
||||
public:
|
||||
StatsWrapper(int deckId);
|
||||
StatsWrapper(string filename);
|
||||
|
||||
@@ -15,35 +15,36 @@ class GuiAvatars;
|
||||
class CardSelectorBase;
|
||||
struct Pos;
|
||||
|
||||
class DuelLayers {
|
||||
protected:
|
||||
int nbitems;
|
||||
vector<GuiLayer*> objects;
|
||||
vector<Pos*> waiters;
|
||||
GuiCombat* combat;
|
||||
ActionLayer* action;
|
||||
ActionStack* stack;
|
||||
GuiHandSelf *hand;
|
||||
GuiAvatars * avatars;
|
||||
class DuelLayers
|
||||
{
|
||||
protected:
|
||||
int nbitems;
|
||||
vector<GuiLayer*> objects;
|
||||
vector<Pos*> waiters;
|
||||
GuiCombat* combat;
|
||||
ActionLayer* action;
|
||||
ActionStack* stack;
|
||||
GuiHandSelf *hand;
|
||||
GuiAvatars * avatars;
|
||||
|
||||
public:
|
||||
DuelLayers();
|
||||
~DuelLayers();
|
||||
DuelLayers();
|
||||
~DuelLayers();
|
||||
|
||||
ActionLayer * actionLayer();
|
||||
ActionStack * stackLayer();
|
||||
GuiCombat * combatLayer();
|
||||
GuiAvatars * GetAvatars();
|
||||
void init();
|
||||
virtual void Update(float dt, Player * player);
|
||||
void CheckUserInput(int isAI);
|
||||
void Render();
|
||||
void Add(GuiLayer * layer);
|
||||
void Remove();
|
||||
int receiveEvent(WEvent * e);
|
||||
float RightBoundary();
|
||||
ActionLayer * actionLayer();
|
||||
ActionStack * stackLayer();
|
||||
GuiCombat * combatLayer();
|
||||
GuiAvatars * GetAvatars();
|
||||
void init();
|
||||
virtual void Update(float dt, Player * player);
|
||||
void CheckUserInput(int isAI);
|
||||
void Render();
|
||||
void Add(GuiLayer * layer);
|
||||
void Remove();
|
||||
int receiveEvent(WEvent * e);
|
||||
float RightBoundary();
|
||||
|
||||
CardSelectorBase* mCardSelector;
|
||||
CardSelectorBase* mCardSelector;
|
||||
};
|
||||
|
||||
#include "ActionLayer.h"
|
||||
@@ -52,5 +53,4 @@ public:
|
||||
#include "ActionStack.h"
|
||||
#include "Damage.h"
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
#include <JGui.h>
|
||||
|
||||
class Effect : public JGuiObject
|
||||
class Effect: public JGuiObject
|
||||
{
|
||||
static int id_counter;
|
||||
public:
|
||||
Effect() : JGuiObject(++id_counter) {};
|
||||
static int id_counter;
|
||||
public:
|
||||
Effect() : JGuiObject(++id_counter) {};
|
||||
};
|
||||
|
||||
#endif // _EFFECTS_H_
|
||||
|
||||
@@ -9,143 +9,163 @@ class TargetChooser;
|
||||
class MTGCardInstance;
|
||||
class MTGAbility;
|
||||
|
||||
class ExtraCost{
|
||||
class ExtraCost
|
||||
{
|
||||
public:
|
||||
TargetChooser * tc;
|
||||
MTGCardInstance * source;
|
||||
MTGCardInstance * target;
|
||||
std::string mCostRenderString;
|
||||
TargetChooser * tc;
|
||||
MTGCardInstance * source;
|
||||
MTGCardInstance * target;
|
||||
std::string mCostRenderString;
|
||||
|
||||
ExtraCost(const std::string& inCostRenderString, TargetChooser *_tc = NULL);
|
||||
virtual ~ExtraCost();
|
||||
virtual int setPayment(MTGCardInstance * card);
|
||||
virtual int isPaymentSet() { return (target != NULL); }
|
||||
virtual int canPay() { return 1; }
|
||||
virtual int doPay() = 0;
|
||||
virtual void Render();
|
||||
virtual int setSource(MTGCardInstance * _source);
|
||||
virtual ExtraCost* clone() const = 0;
|
||||
ExtraCost(const std::string& inCostRenderString, TargetChooser *_tc = NULL);
|
||||
virtual ~ExtraCost();
|
||||
virtual int setPayment(MTGCardInstance * card);
|
||||
virtual int isPaymentSet()
|
||||
{
|
||||
return (target != NULL);
|
||||
}
|
||||
virtual int canPay()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
virtual int doPay() = 0;
|
||||
virtual void Render();
|
||||
virtual int setSource(MTGCardInstance * _source);
|
||||
virtual ExtraCost* clone() const = 0;
|
||||
};
|
||||
|
||||
class ExtraCosts{
|
||||
class ExtraCosts
|
||||
{
|
||||
public:
|
||||
vector<ExtraCost *>costs;
|
||||
MTGCardInstance * source;
|
||||
MTGAbility * action;
|
||||
ExtraCosts();
|
||||
~ExtraCosts();
|
||||
void Render();
|
||||
int tryToSetPayment(MTGCardInstance * card);
|
||||
int isPaymentSet();
|
||||
int canPay();
|
||||
int doPay();
|
||||
int reset();
|
||||
int setAction(MTGAbility * _action, MTGCardInstance * _source);
|
||||
void Dump();
|
||||
ExtraCosts * clone() const;
|
||||
vector<ExtraCost *> costs;
|
||||
MTGCardInstance * source;
|
||||
MTGAbility * action;
|
||||
ExtraCosts();
|
||||
~ExtraCosts();
|
||||
void Render();
|
||||
int tryToSetPayment(MTGCardInstance * card);
|
||||
int isPaymentSet();
|
||||
int canPay();
|
||||
int doPay();
|
||||
int reset();
|
||||
int setAction(MTGAbility * _action, MTGCardInstance * _source);
|
||||
void Dump();
|
||||
ExtraCosts * clone() const;
|
||||
};
|
||||
|
||||
class SacrificeCost: public ExtraCost{
|
||||
class SacrificeCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
SacrificeCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual SacrificeCost * clone() const;
|
||||
SacrificeCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual SacrificeCost * clone() const;
|
||||
};
|
||||
|
||||
//life cost
|
||||
class LifeCost: public ExtraCost{
|
||||
class LifeCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
LifeCost(TargetChooser *_tc = NULL);
|
||||
LifeCost(TargetChooser *_tc = NULL);
|
||||
|
||||
virtual int doPay();
|
||||
virtual LifeCost * clone() const;
|
||||
virtual int doPay();
|
||||
virtual LifeCost * clone() const;
|
||||
};
|
||||
|
||||
//Discard a random card cost
|
||||
class DiscardRandomCost: public ExtraCost{
|
||||
class DiscardRandomCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
DiscardRandomCost(TargetChooser *_tc = NULL);
|
||||
virtual int canPay();
|
||||
virtual int doPay();
|
||||
virtual DiscardRandomCost * clone() const;
|
||||
DiscardRandomCost(TargetChooser *_tc = NULL);
|
||||
virtual int canPay();
|
||||
virtual int doPay();
|
||||
virtual DiscardRandomCost * clone() const;
|
||||
};
|
||||
|
||||
//a choosen discard
|
||||
class DiscardCost: public ExtraCost{
|
||||
class DiscardCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
DiscardCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual DiscardCost * clone() const;
|
||||
DiscardCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual DiscardCost * clone() const;
|
||||
};
|
||||
|
||||
//tolibrary cost
|
||||
class ToLibraryCost: public ExtraCost{
|
||||
class ToLibraryCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
ToLibraryCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual ToLibraryCost * clone() const;
|
||||
ToLibraryCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual ToLibraryCost * clone() const;
|
||||
};
|
||||
|
||||
//Millyourself cost
|
||||
class MillCost: public ExtraCost{
|
||||
class MillCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
MillCost(TargetChooser *_tc = NULL);
|
||||
virtual int canPay();
|
||||
virtual int doPay();
|
||||
virtual MillCost * clone() const;
|
||||
MillCost(TargetChooser *_tc = NULL);
|
||||
virtual int canPay();
|
||||
virtual int doPay();
|
||||
virtual MillCost * clone() const;
|
||||
};
|
||||
|
||||
//Mill to exile yourself cost
|
||||
class MillExileCost: public MillCost{
|
||||
class MillExileCost: public MillCost
|
||||
{
|
||||
public:
|
||||
MillExileCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
MillExileCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
};
|
||||
|
||||
//tap other cost
|
||||
class TapTargetCost: public ExtraCost{
|
||||
class TapTargetCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
TapTargetCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual TapTargetCost * clone() const;
|
||||
TapTargetCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual TapTargetCost * clone() const;
|
||||
};
|
||||
|
||||
//exile as cost
|
||||
class ExileTargetCost: public ExtraCost{
|
||||
class ExileTargetCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
ExileTargetCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual ExileTargetCost * clone() const;
|
||||
ExileTargetCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual ExileTargetCost * clone() const;
|
||||
};
|
||||
|
||||
//bounce cost
|
||||
class BounceTargetCost: public ExtraCost{
|
||||
class BounceTargetCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
BounceTargetCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual BounceTargetCost * clone() const;
|
||||
BounceTargetCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual BounceTargetCost * clone() const;
|
||||
};
|
||||
|
||||
//bounce cost
|
||||
class Ninja: public ExtraCost{
|
||||
class Ninja: public ExtraCost
|
||||
{
|
||||
public:
|
||||
Ninja(TargetChooser *_tc = NULL);
|
||||
virtual int isPaymentSet();
|
||||
virtual int doPay();
|
||||
virtual Ninja * clone() const;
|
||||
Ninja(TargetChooser *_tc = NULL);
|
||||
virtual int isPaymentSet();
|
||||
virtual int doPay();
|
||||
virtual Ninja * clone() const;
|
||||
};
|
||||
|
||||
class CounterCost: public ExtraCost{
|
||||
class CounterCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
Counter * counter;
|
||||
int hasCounters;
|
||||
CounterCost(Counter * _counter,TargetChooser *_tc = NULL);
|
||||
~CounterCost();
|
||||
virtual int setPayment(MTGCardInstance * card);
|
||||
virtual int isPaymentSet();
|
||||
virtual int canPay();
|
||||
virtual int doPay();
|
||||
virtual CounterCost * clone() const;
|
||||
Counter * counter;
|
||||
int hasCounters;
|
||||
CounterCost(Counter * _counter, TargetChooser *_tc = NULL);
|
||||
~CounterCost();
|
||||
virtual int setPayment(MTGCardInstance * card);
|
||||
virtual int isPaymentSet();
|
||||
virtual int canPay();
|
||||
virtual int doPay();
|
||||
virtual CounterCost * clone() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
* http://wololo.net/wagic/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _GAMEAPP_H_
|
||||
#define _GAMEAPP_H_
|
||||
|
||||
@@ -33,60 +29,57 @@
|
||||
|
||||
enum
|
||||
{
|
||||
GAME_TYPE_CLASSIC,
|
||||
GAME_TYPE_MOMIR,
|
||||
GAME_TYPE_RANDOM1,
|
||||
GAME_TYPE_RANDOM2,
|
||||
GAME_TYPE_STORY
|
||||
GAME_TYPE_CLASSIC,
|
||||
GAME_TYPE_MOMIR,
|
||||
GAME_TYPE_RANDOM1,
|
||||
GAME_TYPE_RANDOM2,
|
||||
GAME_TYPE_STORY
|
||||
};
|
||||
|
||||
class MTGAllCards;
|
||||
class TransitionBase;
|
||||
|
||||
class GameApp: public JApp
|
||||
class GameApp: public JApp
|
||||
{
|
||||
|
||||
private:
|
||||
private:
|
||||
#ifdef DEBUG
|
||||
int nbUpdates;
|
||||
float totalFPS;
|
||||
int nbUpdates;
|
||||
float totalFPS;
|
||||
#endif
|
||||
bool mShowDebugInfo;
|
||||
int mScreenShotCount;
|
||||
bool mShowDebugInfo;
|
||||
int mScreenShotCount;
|
||||
|
||||
GameState* mCurrentState;
|
||||
GameState* mNextState;
|
||||
GameState* mGameStates[GAME_STATE_MAX];
|
||||
public:
|
||||
GameState* mCurrentState;
|
||||
GameState* mNextState;
|
||||
GameState* mGameStates[GAME_STATE_MAX];
|
||||
public:
|
||||
|
||||
|
||||
int gameType;
|
||||
CardEffect *effect;
|
||||
int gameType;
|
||||
CardEffect *effect;
|
||||
|
||||
GameApp();
|
||||
virtual ~GameApp();
|
||||
|
||||
GameApp();
|
||||
virtual ~GameApp();
|
||||
virtual void Create();
|
||||
virtual void Destroy();
|
||||
virtual void Update();
|
||||
virtual void Render();
|
||||
virtual void Pause();
|
||||
virtual void Resume();
|
||||
|
||||
virtual void Create();
|
||||
virtual void Destroy();
|
||||
virtual void Update();
|
||||
virtual void Render();
|
||||
virtual void Pause();
|
||||
virtual void Resume();
|
||||
|
||||
|
||||
void LoadGameStates();
|
||||
void SetNextState(int state);
|
||||
void DoTransition(int trans, int tostate, float dur=-1, bool animonly = false);
|
||||
void DoAnimation(int trans, float dur=-1);
|
||||
static hgeParticleSystem * Particles[6];
|
||||
static int HasMusic;
|
||||
static string systemError;
|
||||
static JMusic* music;
|
||||
static string currentMusicFile;
|
||||
static void playMusic(string filename, bool loop = true);
|
||||
static MTGAllCards * collection;
|
||||
static int players[2];
|
||||
void LoadGameStates();
|
||||
void SetNextState(int state);
|
||||
void DoTransition(int trans, int tostate, float dur = -1, bool animonly = false);
|
||||
void DoAnimation(int trans, float dur = -1);
|
||||
static hgeParticleSystem * Particles[6];
|
||||
static int HasMusic;
|
||||
static string systemError;
|
||||
static JMusic* music;
|
||||
static string currentMusicFile;
|
||||
static void playMusic(string filename, bool loop = true);
|
||||
static MTGAllCards * collection;
|
||||
static int players[2];
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -22,69 +22,70 @@ class TargetChooser;
|
||||
class Rules;
|
||||
using namespace std;
|
||||
|
||||
class GameObserver{
|
||||
protected:
|
||||
static GameObserver * mInstance;
|
||||
MTGCardInstance * cardWaitingForTargets;
|
||||
queue<WEvent *> eventsQueue;
|
||||
class GameObserver
|
||||
{
|
||||
protected:
|
||||
static GameObserver * mInstance;
|
||||
MTGCardInstance * cardWaitingForTargets;
|
||||
queue<WEvent *> eventsQueue;
|
||||
|
||||
int nbPlayers;
|
||||
int untap(MTGCardInstance * card);
|
||||
bool WaitForExtraPayment(MTGCardInstance* card);
|
||||
int nbPlayers;
|
||||
int untap(MTGCardInstance * card);
|
||||
bool WaitForExtraPayment(MTGCardInstance* card);
|
||||
|
||||
public:
|
||||
int currentPlayerId;
|
||||
CombatStep combatStep;
|
||||
int turn;
|
||||
int forceShuffleLibraries();
|
||||
int targetListIsSet(MTGCardInstance * card);
|
||||
PhaseRing * phaseRing;
|
||||
int cancelCurrentAction();
|
||||
int currentGamePhase;
|
||||
ExtraCosts * mExtraPayment;
|
||||
int oldGamePhase;
|
||||
TargetChooser * targetChooser;
|
||||
DuelLayers * mLayers;
|
||||
ReplacementEffects *replacementEffects;
|
||||
Player * gameOver;
|
||||
Player * players[2]; //created outside
|
||||
time_t startedAt;
|
||||
Rules * mRules;
|
||||
public:
|
||||
int currentPlayerId;
|
||||
CombatStep combatStep;
|
||||
int turn;
|
||||
int forceShuffleLibraries();
|
||||
int targetListIsSet(MTGCardInstance * card);
|
||||
PhaseRing * phaseRing;
|
||||
int cancelCurrentAction();
|
||||
int currentGamePhase;
|
||||
ExtraCosts * mExtraPayment;
|
||||
int oldGamePhase;
|
||||
TargetChooser * targetChooser;
|
||||
DuelLayers * mLayers;
|
||||
ReplacementEffects *replacementEffects;
|
||||
Player * gameOver;
|
||||
Player * players[2]; //created outside
|
||||
time_t startedAt;
|
||||
Rules * mRules;
|
||||
|
||||
TargetChooser * getCurrentTargetChooser();
|
||||
void stackObjectClicked(Interruptible * action);
|
||||
TargetChooser * getCurrentTargetChooser();
|
||||
void stackObjectClicked(Interruptible * action);
|
||||
|
||||
int cardClick(MTGCardInstance * card,Targetable * _object = NULL );
|
||||
int getCurrentGamePhase();
|
||||
void nextCombatStep();
|
||||
void userRequestNextGamePhase();
|
||||
void nextGamePhase();
|
||||
void cleanupPhase();
|
||||
void nextPlayer();
|
||||
static void Init(Player * _players[], int _nbplayers);
|
||||
static GameObserver * GetInstance();
|
||||
static void EndInstance();
|
||||
Player * currentPlayer;
|
||||
Player * currentActionPlayer;
|
||||
Player * isInterrupting;
|
||||
Player * opponent();
|
||||
Player * currentlyActing();
|
||||
GameObserver(Player * _players[], int _nbplayers);
|
||||
~GameObserver();
|
||||
void gameStateBasedEffects();
|
||||
void eventOccured();
|
||||
void addObserver(MTGAbility * observer);
|
||||
void removeObserver(ActionElement * observer);
|
||||
void startGame(Rules * rules);
|
||||
void untapPhase();
|
||||
void draw();
|
||||
int isInPlay(MTGCardInstance * card);
|
||||
int cardClick(MTGCardInstance * card, Targetable * _object = NULL);
|
||||
int getCurrentGamePhase();
|
||||
void nextCombatStep();
|
||||
void userRequestNextGamePhase();
|
||||
void nextGamePhase();
|
||||
void cleanupPhase();
|
||||
void nextPlayer();
|
||||
static void Init(Player * _players[], int _nbplayers);
|
||||
static GameObserver * GetInstance();
|
||||
static void EndInstance();
|
||||
Player * currentPlayer;
|
||||
Player * currentActionPlayer;
|
||||
Player * isInterrupting;
|
||||
Player * opponent();
|
||||
Player * currentlyActing();
|
||||
GameObserver(Player * _players[], int _nbplayers);
|
||||
~GameObserver();
|
||||
void gameStateBasedEffects();
|
||||
void eventOccured();
|
||||
void addObserver(MTGAbility * observer);
|
||||
void removeObserver(ActionElement * observer);
|
||||
void startGame(Rules * rules);
|
||||
void untapPhase();
|
||||
void draw();
|
||||
int isInPlay(MTGCardInstance * card);
|
||||
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void ButtonPressed(PlayGuiObject*);
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void ButtonPressed(PlayGuiObject*);
|
||||
|
||||
int receiveEvent(WEvent * event);
|
||||
int receiveEvent(WEvent * event);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,251 +23,339 @@ class WStyle;
|
||||
class StyleManager;
|
||||
class Player;
|
||||
|
||||
class Options {
|
||||
class Options
|
||||
{
|
||||
public:
|
||||
friend class GameSettings;
|
||||
enum {
|
||||
//Global settings
|
||||
ACTIVE_PROFILE,
|
||||
LANG,
|
||||
LAST_GLOBAL = LANG, //This must be the value above, to keep ordering.
|
||||
//Values /must/ match ordering in optionNames, or everything loads wrong.
|
||||
//Profile settings
|
||||
ACTIVE_THEME,
|
||||
ACTIVE_MODE,
|
||||
MUSICVOLUME,
|
||||
SFXVOLUME,
|
||||
DIFFICULTY,
|
||||
CHEATMODE,
|
||||
OPTIMIZE_HAND,
|
||||
CHEATMODEAIDECK,
|
||||
OSD,
|
||||
CLOSEDHAND,
|
||||
HANDDIRECTION,
|
||||
MANADISPLAY,
|
||||
REVERSETRIGGERS,
|
||||
DISABLECARDS,
|
||||
MAX_GRADE,
|
||||
ASPHASES,
|
||||
ECON_DIFFICULTY,
|
||||
TRANSITIONS,
|
||||
GUI_STYLE,
|
||||
INTERRUPT_SECONDS,
|
||||
KEY_BINDINGS,
|
||||
AIDECKS_UNLOCKED,
|
||||
//My interrupts
|
||||
INTERRUPTMYSPELLS,
|
||||
INTERRUPTMYABILITIES,
|
||||
//Other interrupts
|
||||
INTERRUPT_BEFOREBEGIN,
|
||||
INTERRUPT_UNTAP,
|
||||
INTERRUPT_UPKEEP,
|
||||
INTERRUPT_DRAW,
|
||||
INTERRUPT_FIRSTMAIN,
|
||||
INTERRUPT_BEGINCOMBAT,
|
||||
INTERRUPT_ATTACKERS,
|
||||
INTERRUPT_BLOCKERS,
|
||||
INTERRUPT_DAMAGE,
|
||||
INTERRUPT_ENDCOMBAT,
|
||||
INTERRUPT_SECONDMAIN,
|
||||
INTERRUPT_ENDTURN,
|
||||
INTERRUPT_CLEANUP,
|
||||
INTERRUPT_AFTEREND,
|
||||
BEGIN_AWARDS, //Options after this use the GameOptionAward struct, which includes a timestamp.
|
||||
DIFFICULTY_MODE_UNLOCKED = BEGIN_AWARDS,
|
||||
MOMIR_MODE_UNLOCKED,
|
||||
EVILTWIN_MODE_UNLOCKED,
|
||||
RANDOMDECK_MODE_UNLOCKED,
|
||||
AWARD_COLLECTOR,
|
||||
LAST_NAMED, //Any option after this does not look up in optionNames.
|
||||
SET_UNLOCKS = LAST_NAMED + 1, //For sets.
|
||||
friend class GameSettings;
|
||||
enum
|
||||
{
|
||||
//Global settings
|
||||
ACTIVE_PROFILE,
|
||||
LANG,
|
||||
LAST_GLOBAL = LANG, //This must be the value above, to keep ordering.
|
||||
//Values /must/ match ordering in optionNames, or everything loads wrong.
|
||||
//Profile settings
|
||||
ACTIVE_THEME,
|
||||
ACTIVE_MODE,
|
||||
MUSICVOLUME,
|
||||
SFXVOLUME,
|
||||
DIFFICULTY,
|
||||
CHEATMODE,
|
||||
OPTIMIZE_HAND,
|
||||
CHEATMODEAIDECK,
|
||||
OSD,
|
||||
CLOSEDHAND,
|
||||
HANDDIRECTION,
|
||||
MANADISPLAY,
|
||||
REVERSETRIGGERS,
|
||||
DISABLECARDS,
|
||||
MAX_GRADE,
|
||||
ASPHASES,
|
||||
ECON_DIFFICULTY,
|
||||
TRANSITIONS,
|
||||
GUI_STYLE,
|
||||
INTERRUPT_SECONDS,
|
||||
KEY_BINDINGS,
|
||||
AIDECKS_UNLOCKED,
|
||||
//My interrupts
|
||||
INTERRUPTMYSPELLS,
|
||||
INTERRUPTMYABILITIES,
|
||||
//Other interrupts
|
||||
INTERRUPT_BEFOREBEGIN,
|
||||
INTERRUPT_UNTAP,
|
||||
INTERRUPT_UPKEEP,
|
||||
INTERRUPT_DRAW,
|
||||
INTERRUPT_FIRSTMAIN,
|
||||
INTERRUPT_BEGINCOMBAT,
|
||||
INTERRUPT_ATTACKERS,
|
||||
INTERRUPT_BLOCKERS,
|
||||
INTERRUPT_DAMAGE,
|
||||
INTERRUPT_ENDCOMBAT,
|
||||
INTERRUPT_SECONDMAIN,
|
||||
INTERRUPT_ENDTURN,
|
||||
INTERRUPT_CLEANUP,
|
||||
INTERRUPT_AFTEREND,
|
||||
BEGIN_AWARDS, //Options after this use the GameOptionAward struct, which includes a timestamp.
|
||||
DIFFICULTY_MODE_UNLOCKED = BEGIN_AWARDS,
|
||||
MOMIR_MODE_UNLOCKED,
|
||||
EVILTWIN_MODE_UNLOCKED,
|
||||
RANDOMDECK_MODE_UNLOCKED,
|
||||
AWARD_COLLECTOR,
|
||||
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 getID(string name);
|
||||
static string getName(int option);
|
||||
static int optionSet(int setID);
|
||||
static int optionInterrupt(int gamePhase);
|
||||
|
||||
static int getID(string name);
|
||||
static string getName(int option);
|
||||
|
||||
private:
|
||||
static const string optionNames[];
|
||||
static const string optionNames[];
|
||||
};
|
||||
|
||||
class GameOption {
|
||||
class GameOption
|
||||
{
|
||||
public:
|
||||
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 ~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"
|
||||
virtual string menuStr(); //The string we'll use for GameStateOptions.
|
||||
virtual bool write(std::ofstream * file, string name);
|
||||
virtual bool read(string input);
|
||||
virtual bool isDefault(); //Returns true when number is 0 and string is "" or "Default"
|
||||
virtual string menuStr(); //The string we'll use for GameStateOptions.
|
||||
virtual bool write(std::ofstream * file, string name);
|
||||
virtual bool read(string input);
|
||||
|
||||
GameOption(int value = 0);
|
||||
GameOption(string);
|
||||
GameOption(int, string);
|
||||
GameOption(int value = 0);
|
||||
GameOption(string);
|
||||
GameOption(int, string);
|
||||
};
|
||||
|
||||
struct EnumDefinition {
|
||||
int findIndex(int value);
|
||||
struct EnumDefinition
|
||||
{
|
||||
int findIndex(int value);
|
||||
|
||||
typedef pair<int, string> assoc;
|
||||
vector<assoc> values;
|
||||
typedef pair<int, string> assoc;
|
||||
vector<assoc> values;
|
||||
};
|
||||
|
||||
class GameOptionEnum: public GameOption {
|
||||
class GameOptionEnum: public GameOption
|
||||
{
|
||||
public:
|
||||
virtual string menuStr();
|
||||
virtual bool write(std::ofstream * file, string name);
|
||||
virtual bool read(string input);
|
||||
EnumDefinition * def;
|
||||
virtual string menuStr();
|
||||
virtual bool write(std::ofstream * file, string name);
|
||||
virtual bool read(string input);
|
||||
EnumDefinition * def;
|
||||
};
|
||||
|
||||
class GameOptionAward: public GameOption {
|
||||
class GameOptionAward: public GameOption
|
||||
{
|
||||
public:
|
||||
GameOptionAward();
|
||||
virtual string menuStr();
|
||||
virtual bool write(std::ofstream * file, string name);
|
||||
virtual bool read(string input);
|
||||
virtual bool giveAward(); //Returns false if already awarded
|
||||
virtual bool isViewed();
|
||||
virtual void setViewed(bool v = true) {viewed = v;};
|
||||
GameOptionAward();
|
||||
virtual string menuStr();
|
||||
virtual bool write(std::ofstream * file, string name);
|
||||
virtual bool read(string input);
|
||||
virtual bool giveAward(); //Returns false if already awarded
|
||||
virtual bool isViewed();
|
||||
virtual void setViewed(bool v = true)
|
||||
{
|
||||
viewed = v;
|
||||
}
|
||||
;
|
||||
private:
|
||||
time_t achieved; //When was it awarded?
|
||||
bool viewed; //Flag it as "New!" or not.
|
||||
time_t achieved; //When was it awarded?
|
||||
bool viewed; //Flag it as "New!" or not.
|
||||
};
|
||||
|
||||
class GameOptionKeyBindings : public GameOption {
|
||||
virtual bool read(string input);
|
||||
virtual bool write(std::ofstream*, string);
|
||||
class GameOptionKeyBindings: public GameOption
|
||||
{
|
||||
virtual bool read(string input);
|
||||
virtual bool write(std::ofstream*, string);
|
||||
};
|
||||
|
||||
class OptionVolume: public EnumDefinition{
|
||||
class OptionVolume: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
enum { MUTE = 0, MAX = 100 };
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
enum
|
||||
{
|
||||
MUTE = 0, MAX = 100
|
||||
};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionVolume();
|
||||
static OptionVolume mDef;
|
||||
OptionVolume();
|
||||
static OptionVolume mDef;
|
||||
};
|
||||
|
||||
|
||||
class OptionClosedHand: public EnumDefinition {
|
||||
class OptionClosedHand: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
enum { INVISIBLE = 0, VISIBLE = 1 };
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
private:
|
||||
OptionClosedHand();
|
||||
static OptionClosedHand mDef;
|
||||
};
|
||||
class OptionHandDirection: public EnumDefinition {
|
||||
public:
|
||||
enum { VERTICAL = 0, HORIZONTAL = 1};
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
enum
|
||||
{
|
||||
INVISIBLE = 0, VISIBLE = 1
|
||||
};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionHandDirection();
|
||||
static OptionHandDirection mDef;
|
||||
OptionClosedHand();
|
||||
static OptionClosedHand mDef;
|
||||
};
|
||||
class OptionManaDisplay: public EnumDefinition {
|
||||
class OptionHandDirection: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
enum { DYNAMIC = 0, STATIC = 1, NOSTARSDYNAMIC = 2, BOTH = 3};
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
enum
|
||||
{
|
||||
VERTICAL = 0, HORIZONTAL = 1
|
||||
};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionManaDisplay();
|
||||
static OptionManaDisplay mDef;
|
||||
OptionHandDirection();
|
||||
static OptionHandDirection mDef;
|
||||
};
|
||||
class OptionMaxGrade: public EnumDefinition {
|
||||
class OptionManaDisplay: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
enum
|
||||
{
|
||||
DYNAMIC = 0, STATIC = 1, NOSTARSDYNAMIC = 2, BOTH = 3
|
||||
};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionMaxGrade();
|
||||
static OptionMaxGrade mDef;
|
||||
OptionManaDisplay();
|
||||
static OptionManaDisplay mDef;
|
||||
};
|
||||
class OptionASkipPhase: public EnumDefinition {
|
||||
class OptionMaxGrade: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionASkipPhase();
|
||||
static OptionASkipPhase mDef;
|
||||
OptionMaxGrade();
|
||||
static OptionMaxGrade mDef;
|
||||
};
|
||||
class OptionEconDifficulty: public EnumDefinition {
|
||||
class OptionASkipPhase: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionEconDifficulty();
|
||||
static OptionEconDifficulty mDef;
|
||||
OptionASkipPhase();
|
||||
static OptionASkipPhase mDef;
|
||||
};
|
||||
class OptionDifficulty: public EnumDefinition {
|
||||
class OptionEconDifficulty: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
enum { NORMAL = 0, HARD = 1, HARDER = 2, EVIL = 3};
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionDifficulty();
|
||||
static OptionDifficulty mDef;
|
||||
OptionEconDifficulty();
|
||||
static OptionEconDifficulty 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{
|
||||
class OptionDifficulty: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
friend class GameApp;
|
||||
GameSettings();
|
||||
~GameSettings();
|
||||
int save();
|
||||
enum
|
||||
{
|
||||
NORMAL = 0, HARD = 1, HARDER = 2, EVIL = 3
|
||||
};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionDifficulty();
|
||||
static OptionDifficulty mDef;
|
||||
};
|
||||
|
||||
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();
|
||||
class GameOptions
|
||||
{
|
||||
public:
|
||||
string mFilename;
|
||||
int save();
|
||||
int load();
|
||||
|
||||
//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);
|
||||
GameOption * get(int);
|
||||
GameOption& operator[](int);
|
||||
GameOptions(string filename);
|
||||
~GameOptions();
|
||||
|
||||
private:
|
||||
GameApp * theGame;
|
||||
SimplePad * keypad;
|
||||
StyleManager * styleMan;
|
||||
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;
|
||||
|
||||
@@ -15,7 +15,7 @@ class JGE;
|
||||
using namespace std;
|
||||
|
||||
enum ENUM_GAME_STATE
|
||||
{
|
||||
{
|
||||
GAME_STATE_NONE = -1,
|
||||
GAME_STATE_MENU = 1,
|
||||
GAME_STATE_DUEL = 2,
|
||||
@@ -26,14 +26,14 @@ enum ENUM_GAME_STATE
|
||||
GAME_STATE_STORY = 7,
|
||||
GAME_STATE_TRANSITION = 8,
|
||||
GAME_STATE_MAX = 9,
|
||||
};
|
||||
};
|
||||
|
||||
enum ENUM_GS_TRANSITION
|
||||
{
|
||||
{
|
||||
TRANSITION_FADE = 0,
|
||||
TRANSITION_FADE_IN = 1,
|
||||
MAX_TRANSITION
|
||||
};
|
||||
};
|
||||
|
||||
class GameApp;
|
||||
class SimpleMenu;
|
||||
@@ -41,48 +41,48 @@ class Player;
|
||||
|
||||
class GameState
|
||||
{
|
||||
protected:
|
||||
GameApp* mParent;
|
||||
JGE* mEngine;
|
||||
protected:
|
||||
GameApp* mParent;
|
||||
JGE* mEngine;
|
||||
|
||||
public:
|
||||
GameState(GameApp* parent);
|
||||
virtual ~GameState() {}
|
||||
public:
|
||||
GameState(GameApp* parent);
|
||||
virtual ~GameState(){}
|
||||
|
||||
virtual void Create() {}
|
||||
virtual void Destroy() {}
|
||||
virtual void Create(){}
|
||||
virtual void Destroy(){}
|
||||
|
||||
virtual void Start() {}
|
||||
virtual void End() {}
|
||||
virtual void Start(){}
|
||||
virtual void End(){}
|
||||
|
||||
virtual void Update(float dt) = 0;
|
||||
virtual void Render() = 0;
|
||||
virtual void Update(float dt) = 0;
|
||||
virtual void Render() = 0;
|
||||
|
||||
// deck manipulation methods
|
||||
// 2010/09/15:
|
||||
// this was originally one method to do everything. That has been split up into two distinct
|
||||
// methods since the original was building a menu and returning a value. The first
|
||||
// creates the vector containing the deck information. The second will render that information
|
||||
// it makes it easier to manipulate the deck information menus.
|
||||
|
||||
// generate the Deck Meta Data and build the menu items of the menu given
|
||||
static vector<DeckMetaData *> fillDeckMenu(SimpleMenu * _menu, const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL);
|
||||
// deck manipulation methods
|
||||
// 2010/09/15:
|
||||
// this was originally one method to do everything. That has been split up into two distinct
|
||||
// methods since the original was building a menu and returning a value. The first
|
||||
// creates the vector containing the deck information. The second will render that information
|
||||
// it makes it easier to manipulate the deck information menus.
|
||||
|
||||
// generate the Deck Meta Data and build the menu items of the menu given
|
||||
// Will display up to maxDecks if maxDecks is non 0,all decks in path otherwise
|
||||
static vector<DeckMetaData *> fillDeckMenu(DeckMenu * _menu, const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL, int maxDecks = 0);
|
||||
|
||||
// build a vector of decks with the information passsed in.
|
||||
static vector<DeckMetaData *> getValidDeckMetaData(const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL, int maxDecks = 0);
|
||||
|
||||
// build menu items based on the vector<DeckMetaData *>
|
||||
static void renderDeckMenu(SimpleMenu * _menu, const vector<DeckMetaData *>& deckMetaDataList);
|
||||
// generate the Deck Meta Data and build the menu items of the menu given
|
||||
static vector<DeckMetaData *> fillDeckMenu(SimpleMenu * _menu, const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL);
|
||||
|
||||
// generate the Deck Meta Data and build the menu items of the menu given
|
||||
// Will display up to maxDecks if maxDecks is non 0,all decks in path otherwise
|
||||
static vector<DeckMetaData *> fillDeckMenu(DeckMenu * _menu, const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL, int maxDecks = 0);
|
||||
|
||||
// build a vector of decks with the information passsed in.
|
||||
static vector<DeckMetaData *> getValidDeckMetaData(const string& path, const string& smallDeckPrefix = "", Player * statsPlayer = NULL, int maxDecks = 0);
|
||||
|
||||
// build menu items based on the vector<DeckMetaData *>
|
||||
static void renderDeckMenu(DeckMenu * _menu, const vector<DeckMetaData *>& deckMetaDataList);
|
||||
static void renderDeckMenu(SimpleMenu * _menu, const vector<DeckMetaData *>& deckMetaDataList);
|
||||
|
||||
};
|
||||
bool sortByName( DeckMetaData * d1, DeckMetaData * d2 );
|
||||
// build menu items based on the vector<DeckMetaData *>
|
||||
static void renderDeckMenu(DeckMenu * _menu, const vector<DeckMetaData *>& deckMetaDataList);
|
||||
|
||||
};
|
||||
bool sortByName(DeckMetaData * d1, DeckMetaData * d2);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -11,30 +11,30 @@ class WSrcCards;
|
||||
|
||||
class GameStateAwards: public GameState, public JGuiListener
|
||||
{
|
||||
private:
|
||||
WGuiList * listview;
|
||||
WGuiMenu * detailview;
|
||||
WSrcCards * setSrc;
|
||||
SimpleMenu * menu;
|
||||
bool showMenu;
|
||||
bool showAlt;
|
||||
bool saveMe;
|
||||
int mState;
|
||||
int mDetailItem;
|
||||
private:
|
||||
WGuiList * listview;
|
||||
WGuiMenu * detailview;
|
||||
WSrcCards * setSrc;
|
||||
SimpleMenu * menu;
|
||||
bool showMenu;
|
||||
bool showAlt;
|
||||
bool saveMe;
|
||||
int mState;
|
||||
int mDetailItem;
|
||||
|
||||
public:
|
||||
GameStateAwards(GameApp* parent);
|
||||
bool enterSet(int setid);
|
||||
bool enterStats(int option);
|
||||
virtual ~GameStateAwards();
|
||||
public:
|
||||
GameStateAwards(GameApp* parent);
|
||||
bool enterSet(int setid);
|
||||
bool enterStats(int option);
|
||||
virtual ~GameStateAwards();
|
||||
|
||||
virtual void Start();
|
||||
virtual void End();
|
||||
virtual void Create();
|
||||
virtual void Destroy();
|
||||
virtual void Update(float dt);
|
||||
virtual void Render();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
virtual void Start();
|
||||
virtual void End();
|
||||
virtual void Create();
|
||||
virtual void Destroy();
|
||||
virtual void Update(float dt);
|
||||
virtual void Render();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -149,5 +149,4 @@ public:
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,73 +9,73 @@
|
||||
|
||||
class GameStateMenu: public GameState, public JGuiListener
|
||||
{
|
||||
private:
|
||||
TextScroller * scroller;
|
||||
int scrollerSet;
|
||||
JGuiController* mGuiController;
|
||||
SimpleMenu* subMenuController;
|
||||
SimpleMenu* gameTypeMenu;
|
||||
int hasChosenGameType;
|
||||
JQuad * mIcons[10];
|
||||
JTexture * bgTexture;
|
||||
JQuad * mBg;
|
||||
JQuad * mSplash;
|
||||
JTexture * splashTex;
|
||||
float mCreditsYPos;
|
||||
int currentState;
|
||||
//JMusic * bgMusic;
|
||||
int mVolume;
|
||||
char nbcardsStr[400];
|
||||
vector<string> langs;
|
||||
vector<string> primitives;
|
||||
string wallpaper;
|
||||
int primitivesLoadCounter;
|
||||
private:
|
||||
TextScroller * scroller;
|
||||
int scrollerSet;
|
||||
JGuiController* mGuiController;
|
||||
SimpleMenu* subMenuController;
|
||||
SimpleMenu* gameTypeMenu;
|
||||
int hasChosenGameType;
|
||||
JQuad * mIcons[10];
|
||||
JTexture * bgTexture;
|
||||
JQuad * mBg;
|
||||
JQuad * mSplash;
|
||||
JTexture * splashTex;
|
||||
float mCreditsYPos;
|
||||
int currentState;
|
||||
//JMusic * bgMusic;
|
||||
int mVolume;
|
||||
char nbcardsStr[400];
|
||||
vector<string> langs;
|
||||
vector<string> primitives;
|
||||
string wallpaper;
|
||||
int primitivesLoadCounter;
|
||||
|
||||
DIR *mDip;
|
||||
struct dirent *mDit;
|
||||
char mCurrentSetName[32];
|
||||
char mCurrentSetFileName[512];
|
||||
DIR *mDip;
|
||||
struct dirent *mDit;
|
||||
char mCurrentSetName[32];
|
||||
char mCurrentSetFileName[512];
|
||||
|
||||
int mReadConf;
|
||||
float timeIndex;
|
||||
float angleMultiplier;
|
||||
float angleW;
|
||||
float yW;
|
||||
void fillScroller();
|
||||
int mReadConf;
|
||||
float timeIndex;
|
||||
float angleMultiplier;
|
||||
float angleW;
|
||||
float yW;
|
||||
void fillScroller();
|
||||
|
||||
void setLang(int id);
|
||||
string getLang(string s);
|
||||
void loadLangMenu();
|
||||
bool langChoices;
|
||||
void runTest(); //!!
|
||||
void listPrimitives();
|
||||
void genNbCardsStr(); //computes the contents of nbCardsStr
|
||||
void ensureMGuiController(); //creates the MGuiController if it doesn't exist
|
||||
string loadRandomWallpaper(); //loads a list of string of textures that can be randolmy shown on the loading screen
|
||||
public:
|
||||
GameStateMenu(GameApp* parent);
|
||||
virtual ~GameStateMenu();
|
||||
virtual void Create();
|
||||
virtual void Destroy();
|
||||
virtual void Start();
|
||||
virtual void End();
|
||||
virtual void Update(float dt);
|
||||
virtual void Render();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
void setLang(int id);
|
||||
string getLang(string s);
|
||||
void loadLangMenu();
|
||||
bool langChoices;
|
||||
void runTest(); //!!
|
||||
void listPrimitives();
|
||||
void genNbCardsStr(); //computes the contents of nbCardsStr
|
||||
void ensureMGuiController(); //creates the MGuiController if it doesn't exist
|
||||
string loadRandomWallpaper(); //loads a list of string of textures that can be randolmy shown on the loading screen
|
||||
public:
|
||||
GameStateMenu(GameApp* parent);
|
||||
virtual ~GameStateMenu();
|
||||
virtual void Create();
|
||||
virtual void Destroy();
|
||||
virtual void Start();
|
||||
virtual void End();
|
||||
virtual void Update(float dt);
|
||||
virtual void Render();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
|
||||
int nextDirectory(const char * root, const char * file); // Retrieves the next directory to have matching file
|
||||
void resetDirectory();
|
||||
void createUsersFirstDeck(int setId);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
int nextDirectory(const char * root, const char * file); // Retrieves the next directory to have matching file
|
||||
void resetDirectory();
|
||||
void createUsersFirstDeck(int setId);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
|
||||
enum
|
||||
{
|
||||
MENU_CARD_PURCHASE = 2,
|
||||
MENU_DECK_SELECTION = 10,
|
||||
MENU_DECK_BUILDER = 11,
|
||||
MENU_FIRST_DUEL_SUBMENU = 102,
|
||||
MENU_LANGUAGE_SELECTION = 103,
|
||||
};
|
||||
enum
|
||||
{
|
||||
MENU_CARD_PURCHASE = 2,
|
||||
MENU_DECK_SELECTION = 10,
|
||||
MENU_DECK_BUILDER = 11,
|
||||
MENU_FIRST_DUEL_SUBMENU = 102,
|
||||
MENU_LANGUAGE_SELECTION = 103,
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,40 +10,42 @@ class WGuiTabMenu;
|
||||
class SimpleMenu;
|
||||
class SimplePad;
|
||||
|
||||
struct KeybGrabber {
|
||||
virtual void KeyPressed(LocalKeySym) = 0;
|
||||
struct KeybGrabber
|
||||
{
|
||||
virtual void KeyPressed(LocalKeySym) = 0;
|
||||
};
|
||||
|
||||
class GameStateOptions: public GameState, public JGuiListener {
|
||||
class GameStateOptions: public GameState, public JGuiListener
|
||||
{
|
||||
private:
|
||||
enum {
|
||||
SHOW_OPTIONS,
|
||||
SHOW_OPTIONS_MENU,
|
||||
SAVE
|
||||
};
|
||||
float timer;
|
||||
bool mReload;
|
||||
KeybGrabber* grabber;
|
||||
enum
|
||||
{
|
||||
SHOW_OPTIONS,
|
||||
SHOW_OPTIONS_MENU,
|
||||
SAVE
|
||||
};
|
||||
float timer;
|
||||
bool mReload;
|
||||
KeybGrabber* grabber;
|
||||
|
||||
public:
|
||||
SimpleMenu * optionsMenu;
|
||||
WGuiTabMenu * optionsTabs;
|
||||
int mState;
|
||||
public:
|
||||
SimpleMenu * optionsMenu;
|
||||
WGuiTabMenu * optionsTabs;
|
||||
int mState;
|
||||
|
||||
GameStateOptions(GameApp* parent);
|
||||
virtual ~GameStateOptions();
|
||||
GameStateOptions(GameApp* parent);
|
||||
virtual ~GameStateOptions();
|
||||
|
||||
virtual void Start();
|
||||
virtual void End();
|
||||
virtual void Update(float dt);
|
||||
virtual void Render();
|
||||
virtual void GrabKeyboard(KeybGrabber*);
|
||||
virtual void UngrabKeyboard(const KeybGrabber*);
|
||||
void ButtonPressed(int controllerId, int ControlId);
|
||||
virtual void Start();
|
||||
virtual void End();
|
||||
virtual void Update(float dt);
|
||||
virtual void Render();
|
||||
virtual void GrabKeyboard(KeybGrabber*);
|
||||
virtual void UngrabKeyboard(const KeybGrabber*);
|
||||
void ButtonPressed(int controllerId, int ControlId);
|
||||
|
||||
string newProfile;
|
||||
string newProfile;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "DeckDataWrapper.h"
|
||||
#include "Tasks.h"
|
||||
|
||||
|
||||
#define STATE_BUY 1
|
||||
#define STATE_SELL 2
|
||||
#define STAGE_SHOP_MENU 3
|
||||
@@ -30,94 +29,96 @@
|
||||
class MTGPack;
|
||||
class MTGPacks;
|
||||
|
||||
class BoosterDisplay:public CardDisplay {
|
||||
class BoosterDisplay: public CardDisplay
|
||||
{
|
||||
public:
|
||||
BoosterDisplay(int id, GameObserver* game, int x, int y, JGuiListener * listener = NULL, TargetChooser * tc = NULL, int nb_displayed_items = 7);
|
||||
bool CheckUserInput(JButton key);
|
||||
BoosterDisplay(int id, GameObserver* game, int x, int y, JGuiListener * listener = NULL, TargetChooser * tc = NULL,
|
||||
int nb_displayed_items = 7);
|
||||
bool CheckUserInput(JButton key);
|
||||
};
|
||||
|
||||
class ShopBooster{
|
||||
class ShopBooster
|
||||
{
|
||||
public:
|
||||
ShopBooster();
|
||||
string getName();
|
||||
void randomize(MTGPacks * packlist);
|
||||
int basePrice();
|
||||
int maxInventory();
|
||||
void addToDeck(MTGDeck * d, WSrcCards * srcCards);
|
||||
string getSort();
|
||||
ShopBooster();
|
||||
string getName();
|
||||
void randomize(MTGPacks * packlist);
|
||||
int basePrice();
|
||||
int maxInventory();
|
||||
void addToDeck(MTGDeck * d, WSrcCards * srcCards);
|
||||
string getSort();
|
||||
#ifdef TESTSUITE
|
||||
bool unitTest();
|
||||
bool unitTest();
|
||||
#endif
|
||||
private:
|
||||
void randomCustom(MTGPacks * packlist);
|
||||
void randomStandard();
|
||||
MTGPack * pack;
|
||||
MTGSetInfo * mainSet;
|
||||
MTGSetInfo * altSet;
|
||||
void randomCustom(MTGPacks * packlist);
|
||||
void randomStandard();
|
||||
MTGPack * pack;
|
||||
MTGSetInfo * mainSet;
|
||||
MTGSetInfo * altSet;
|
||||
};
|
||||
|
||||
class GameStateShop: public GameState, public JGuiListener
|
||||
{
|
||||
private:
|
||||
JQuad * pspIcons[8];
|
||||
WSrcCards * srcCards;
|
||||
JTexture * altThumb[8];
|
||||
JQuad * mBack;
|
||||
TaskList * taskList;
|
||||
float mElapsed;
|
||||
WGuiMenu * shopMenu;
|
||||
WGuiFilters * filterMenu; //Filter menu slides in sideways from right, or up from bottom.
|
||||
WGuiCardImage * bigDisplay;
|
||||
BoosterDisplay * boosterDisplay;
|
||||
vector<MTGCardInstance*> subBooster;
|
||||
MTGDeck * booster;
|
||||
bool bListCards;
|
||||
private:
|
||||
JQuad * pspIcons[8];
|
||||
WSrcCards * srcCards;
|
||||
JTexture * altThumb[8];
|
||||
JQuad * mBack;
|
||||
TaskList * taskList;
|
||||
float mElapsed;
|
||||
WGuiMenu * shopMenu;
|
||||
WGuiFilters * filterMenu; //Filter menu slides in sideways from right, or up from bottom.
|
||||
WGuiCardImage * bigDisplay;
|
||||
BoosterDisplay * boosterDisplay;
|
||||
vector<MTGCardInstance*> subBooster;
|
||||
MTGDeck * booster;
|
||||
bool bListCards;
|
||||
|
||||
void beginFilters();
|
||||
void deleteDisplay();
|
||||
void beginFilters();
|
||||
void deleteDisplay();
|
||||
|
||||
WSyncable bigSync;
|
||||
SimpleMenu * menu;
|
||||
PriceList * pricelist;
|
||||
PlayerData * playerdata;
|
||||
MTGPacks * packlist;
|
||||
bool mTouched;
|
||||
bool needLoad;
|
||||
int mPrices[SHOP_ITEMS];
|
||||
int mCounts[SHOP_ITEMS];
|
||||
int mInventory[SHOP_ITEMS];
|
||||
int lightAlpha;
|
||||
int alphaChange;
|
||||
int mBuying;
|
||||
WSyncable bigSync;
|
||||
SimpleMenu * menu;
|
||||
PriceList * pricelist;
|
||||
PlayerData * playerdata;
|
||||
MTGPacks * packlist;
|
||||
bool mTouched;
|
||||
bool needLoad;
|
||||
int mPrices[SHOP_ITEMS];
|
||||
int mCounts[SHOP_ITEMS];
|
||||
int mInventory[SHOP_ITEMS];
|
||||
int lightAlpha;
|
||||
int alphaChange;
|
||||
int mBuying;
|
||||
|
||||
DeckDataWrapper * myCollection;
|
||||
|
||||
int mStage;
|
||||
ShopBooster mBooster[BOOSTER_SLOTS];
|
||||
|
||||
void load();
|
||||
void save(bool force=false);
|
||||
void updateCounts();
|
||||
void beginPurchase(int controlId);
|
||||
void purchaseCard(int controlId);
|
||||
void purchaseBooster(int controlId);
|
||||
void cancelCard(int controlId);
|
||||
void cancelBooster(int controlId);
|
||||
int purchasePrice(int offset);
|
||||
string descPurchase(int controlId, bool tiny = false);
|
||||
public:
|
||||
GameStateShop(GameApp* parent);
|
||||
virtual ~GameStateShop();
|
||||
virtual void Start();
|
||||
virtual void End();
|
||||
virtual void Create();
|
||||
virtual void Destroy();
|
||||
virtual void Update(float dt);
|
||||
virtual void Render();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
static float _x1[],_y1[],_x2[],_y2[],_x3[],_y3[],_x4[],_y4[];
|
||||
DeckDataWrapper * myCollection;
|
||||
|
||||
int mStage;
|
||||
ShopBooster mBooster[BOOSTER_SLOTS];
|
||||
|
||||
void load();
|
||||
void save(bool force = false);
|
||||
void updateCounts();
|
||||
void beginPurchase(int controlId);
|
||||
void purchaseCard(int controlId);
|
||||
void purchaseBooster(int controlId);
|
||||
void cancelCard(int controlId);
|
||||
void cancelBooster(int controlId);
|
||||
int purchasePrice(int offset);
|
||||
string descPurchase(int controlId, bool tiny = false);
|
||||
public:
|
||||
GameStateShop(GameApp* parent);
|
||||
virtual ~GameStateShop();
|
||||
virtual void Start();
|
||||
virtual void End();
|
||||
virtual void Create();
|
||||
virtual void Destroy();
|
||||
virtual void Update(float dt);
|
||||
virtual void Render();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
static float _x1[], _y1[], _x2[], _y2[], _x3[], _y3[], _x4[], _y4[];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
#ifndef _GAME_STATE_STORY_H_
|
||||
#define _GAME_STATE_STORY_H_
|
||||
|
||||
|
||||
#include "GameState.h"
|
||||
#include <JGui.h>
|
||||
|
||||
class StoryFlow;
|
||||
class SimpleMenu;
|
||||
|
||||
class GameStateStory: public GameState, public JGuiListener {
|
||||
class GameStateStory: public GameState, public JGuiListener
|
||||
{
|
||||
private:
|
||||
StoryFlow * flow;
|
||||
SimpleMenu * menu;
|
||||
vector<string> stories;
|
||||
void loadStoriesMenu(const char * root);
|
||||
public:
|
||||
GameStateStory(GameApp* parent);
|
||||
~GameStateStory();
|
||||
void Start();
|
||||
void End();
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void ButtonPressed(int controllerId, int controlId);
|
||||
StoryFlow * flow;
|
||||
SimpleMenu * menu;
|
||||
vector<string> stories;
|
||||
void loadStoriesMenu(const char * root);
|
||||
public:
|
||||
GameStateStory(GameApp* parent);
|
||||
~GameStateStory();
|
||||
void Start();
|
||||
void End();
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void ButtonPressed(int controllerId, int controlId);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,30 +5,36 @@
|
||||
#include <JGui.h>
|
||||
#include "GameState.h"
|
||||
|
||||
class TransitionBase: public GameState, public JGuiListener{
|
||||
class TransitionBase: public GameState, public JGuiListener
|
||||
{
|
||||
public:
|
||||
TransitionBase(GameApp* parent, GameState* _from, GameState* _to, float duration);
|
||||
~TransitionBase();
|
||||
virtual void Start();
|
||||
virtual void End();
|
||||
TransitionBase(GameApp* parent, GameState* _from, GameState* _to, float duration);
|
||||
~TransitionBase();
|
||||
virtual void Start();
|
||||
virtual void End();
|
||||
|
||||
virtual bool Finished() {return (mElapsed >= mDuration);};
|
||||
virtual void Update(float dt);
|
||||
virtual void Render() = 0;
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
virtual bool Finished()
|
||||
{
|
||||
return (mElapsed >= mDuration);
|
||||
}
|
||||
;
|
||||
virtual void Update(float dt);
|
||||
virtual void Render() = 0;
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
|
||||
float mElapsed;
|
||||
float mDuration;
|
||||
GameState* from;
|
||||
GameState* to;
|
||||
bool bAnimationOnly; //Does not call start or end on subordinates.
|
||||
float mElapsed;
|
||||
float mDuration;
|
||||
GameState* from;
|
||||
GameState* to;
|
||||
bool bAnimationOnly; //Does not call start or end on subordinates.
|
||||
};
|
||||
|
||||
class TransitionFade: public TransitionBase {
|
||||
class TransitionFade: public TransitionBase
|
||||
{
|
||||
public:
|
||||
TransitionFade(GameApp* p, GameState* f, GameState* t, float dur, bool reversed);
|
||||
virtual void Render();
|
||||
bool mReversed;
|
||||
TransitionFade(GameApp* p, GameState* f, GameState* t, float dur, bool reversed);
|
||||
virtual void Render();
|
||||
bool mReversed;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,31 +7,30 @@ struct GuiAvatar;
|
||||
class GuiGraveyard;
|
||||
class GuiLibrary;
|
||||
class GuiOpponentHand;
|
||||
class GuiAvatars : public GuiLayer
|
||||
class GuiAvatars: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
GuiAvatar* self, *opponent;
|
||||
GuiGraveyard* selfGraveyard, *opponentGraveyard;
|
||||
GuiLibrary* selfLibrary, *opponentLibrary;
|
||||
GuiOpponentHand *opponentHand;
|
||||
GuiAvatar* active;
|
||||
|
||||
protected:
|
||||
GuiAvatar* self, *opponent;
|
||||
GuiGraveyard* selfGraveyard, *opponentGraveyard;
|
||||
GuiLibrary* selfLibrary, *opponentLibrary;
|
||||
GuiOpponentHand *opponentHand;
|
||||
GuiAvatar* active;
|
||||
|
||||
public:
|
||||
GuiAvatars();
|
||||
~GuiAvatars();
|
||||
public:
|
||||
GuiAvatars();
|
||||
~GuiAvatars();
|
||||
|
||||
GuiAvatar* GetSelf();
|
||||
GuiAvatar* GetOpponent();
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void Activate(PlayGuiObject* c);
|
||||
void Deactivate(PlayGuiObject* c);
|
||||
int receiveEventPlus(WEvent*);
|
||||
int receiveEventMinus(WEvent*);
|
||||
bool CheckUserInput(JButton key);
|
||||
bool CheckUserInput(int x, int y);
|
||||
float LeftBoundarySelf();
|
||||
GuiAvatar* GetSelf();
|
||||
GuiAvatar* GetOpponent();
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void Activate(PlayGuiObject* c);
|
||||
void Deactivate(PlayGuiObject* c);
|
||||
int receiveEventPlus(WEvent*);
|
||||
int receiveEventMinus(WEvent*);
|
||||
bool CheckUserInput(JButton key);
|
||||
bool CheckUserInput(int x, int y);
|
||||
float LeftBoundarySelf();
|
||||
};
|
||||
|
||||
#endif // _GUIAVATARS_H_
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
#include "GuiLayers.h"
|
||||
#include "WEvent.h"
|
||||
|
||||
class GuiBackground : public GuiLayer
|
||||
class GuiBackground: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
JQuad* quad;
|
||||
protected:
|
||||
JQuad* quad;
|
||||
|
||||
public:
|
||||
GuiBackground();
|
||||
~GuiBackground();
|
||||
virtual void Render();
|
||||
public:
|
||||
GuiBackground();
|
||||
~GuiBackground();
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
#endif // _GUIBACKGROUND_H_
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef _GUI_CARDS_CONTROLLER_H_
|
||||
#define _GUI_CARDS_CONTROLLER_H_
|
||||
|
||||
|
||||
#include "PlayGuiObjectController.h"
|
||||
|
||||
class GuiCardsController : public PlayGuiObjectController{
|
||||
public:
|
||||
GuiCardsController(){};
|
||||
class GuiCardsController: public PlayGuiObjectController
|
||||
{
|
||||
public:
|
||||
GuiCardsController(){}
|
||||
;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,38 +7,45 @@
|
||||
#include "MTGCardInstance.h"
|
||||
#include "DamagerDamaged.h"
|
||||
|
||||
class GuiCombat : public GuiLayer
|
||||
class GuiCombat: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
GameObserver* go;
|
||||
DamagerDamaged* active;
|
||||
AttackerDamaged* activeAtk;
|
||||
static JTexture* ok_tex;
|
||||
Pos ok, enemy_avatar;
|
||||
DamagerDamaged* current;
|
||||
enum { BLK, ATK, OK, NONE } cursor_pos;
|
||||
CombatStep step;
|
||||
void validateDamage();
|
||||
void addOne(DefenserDamaged* blocker, CombatStep);
|
||||
void removeOne(DefenserDamaged* blocker, CombatStep);
|
||||
void remaskBlkViews(AttackerDamaged* before, AttackerDamaged* after);
|
||||
int resolve();
|
||||
protected:
|
||||
GameObserver* go;
|
||||
DamagerDamaged* active;
|
||||
AttackerDamaged* activeAtk;
|
||||
static JTexture* ok_tex;
|
||||
Pos ok, enemy_avatar;
|
||||
DamagerDamaged* current;
|
||||
enum
|
||||
{
|
||||
BLK,
|
||||
ATK,
|
||||
OK,
|
||||
NONE
|
||||
} cursor_pos;
|
||||
|
||||
public:
|
||||
CombatStep step;
|
||||
void validateDamage();
|
||||
void addOne(DefenserDamaged* blocker, CombatStep);
|
||||
void removeOne(DefenserDamaged* blocker, CombatStep);
|
||||
void remaskBlkViews(AttackerDamaged* before, AttackerDamaged* after);
|
||||
int resolve();
|
||||
|
||||
vector<AttackerDamaged*> attackers;
|
||||
void autoaffectDamage(AttackerDamaged* attacker, CombatStep);
|
||||
public:
|
||||
|
||||
GuiCombat(GameObserver* go);
|
||||
~GuiCombat();
|
||||
virtual void Update(float dt);
|
||||
virtual void Render();
|
||||
bool clickOK();
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual int receiveEventPlus(WEvent* e);
|
||||
virtual int receiveEventMinus(WEvent* e);
|
||||
vector<AttackerDamaged*> attackers;
|
||||
void autoaffectDamage(AttackerDamaged* attacker, CombatStep);
|
||||
|
||||
typedef vector<AttackerDamaged*>::iterator inner_iterator;
|
||||
GuiCombat(GameObserver* go);
|
||||
~GuiCombat();
|
||||
virtual void Update(float dt);
|
||||
virtual void Render();
|
||||
bool clickOK();
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual int receiveEventPlus(WEvent* e);
|
||||
virtual int receiveEventMinus(WEvent* e);
|
||||
|
||||
typedef vector<AttackerDamaged*>::iterator inner_iterator;
|
||||
};
|
||||
|
||||
#endif // _GUICOMBAT_H_
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
|
||||
#include "GuiLayers.h"
|
||||
|
||||
class GuiFrame : public GuiLayer
|
||||
class GuiFrame: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
JQuad* wood;
|
||||
JQuad* gold1, *gold2, *goldGlow;
|
||||
float step;
|
||||
protected:
|
||||
JQuad* wood;
|
||||
JQuad* gold1, *gold2, *goldGlow;
|
||||
float step;
|
||||
|
||||
public:
|
||||
GuiFrame();
|
||||
~GuiFrame();
|
||||
virtual void Render();
|
||||
void Update(float dt);
|
||||
public:
|
||||
GuiFrame();
|
||||
~GuiFrame();
|
||||
virtual void Render();
|
||||
void Update(float dt);
|
||||
};
|
||||
|
||||
#endif // _GUIFRAME_H_
|
||||
|
||||
@@ -9,79 +9,79 @@
|
||||
|
||||
class GuiHand;
|
||||
|
||||
struct HandLimitor : public Limitor
|
||||
struct HandLimitor: public Limitor
|
||||
{
|
||||
GuiHand* hand;
|
||||
virtual bool select(Target*);
|
||||
virtual bool greyout(Target*);
|
||||
GuiHand* hand;
|
||||
virtual bool select(Target*);
|
||||
virtual bool greyout(Target*);
|
||||
|
||||
HandLimitor(GuiHand* hand);
|
||||
HandLimitor(GuiHand* hand);
|
||||
};
|
||||
|
||||
class GuiHand : public GuiLayer
|
||||
class GuiHand: public GuiLayer
|
||||
{
|
||||
public:
|
||||
static const float ClosedRowX;
|
||||
static const float LeftRowX;
|
||||
static const float RightRowX;
|
||||
public:
|
||||
static const float ClosedRowX;
|
||||
static const float LeftRowX;
|
||||
static const float RightRowX;
|
||||
|
||||
static const float OpenX;
|
||||
static const float ClosedX;
|
||||
static const float OpenY;
|
||||
static const float ClosedY;
|
||||
static const float OpenX;
|
||||
static const float ClosedX;
|
||||
static const float OpenY;
|
||||
static const float ClosedY;
|
||||
|
||||
protected:
|
||||
const MTGHand* hand;
|
||||
JQuad *back;
|
||||
vector<CardView*> cards;
|
||||
protected:
|
||||
const MTGHand* hand;
|
||||
JQuad *back;
|
||||
vector<CardView*> cards;
|
||||
|
||||
public:
|
||||
GuiHand(MTGHand* hand);
|
||||
~GuiHand();
|
||||
void Update(float dt);
|
||||
bool isInHand(CardView*);
|
||||
public:
|
||||
GuiHand(MTGHand* hand);
|
||||
~GuiHand();
|
||||
void Update(float dt);
|
||||
bool isInHand(CardView*);
|
||||
|
||||
friend struct HandLimitor;
|
||||
friend struct HandLimitor;
|
||||
};
|
||||
|
||||
class GuiHandOpponent : public GuiHand
|
||||
class GuiHandOpponent: public GuiHand
|
||||
{
|
||||
public:
|
||||
GuiHandOpponent(MTGHand* hand);
|
||||
virtual void Render();
|
||||
virtual int receiveEventPlus(WEvent* e);
|
||||
virtual int receiveEventMinus(WEvent* e);
|
||||
public:
|
||||
GuiHandOpponent(MTGHand* hand);
|
||||
virtual void Render();
|
||||
virtual int receiveEventPlus(WEvent* e);
|
||||
virtual int receiveEventMinus(WEvent* e);
|
||||
};
|
||||
|
||||
class GuiHandSelf : public GuiHand
|
||||
class GuiHandSelf: public GuiHand
|
||||
{
|
||||
protected:
|
||||
typedef enum
|
||||
{
|
||||
Open,
|
||||
Closed
|
||||
} HandState;
|
||||
HandState state;
|
||||
Pos backpos;
|
||||
protected:
|
||||
typedef enum
|
||||
{
|
||||
Open, Closed
|
||||
} HandState;
|
||||
HandState state;
|
||||
Pos backpos;
|
||||
|
||||
public:
|
||||
GuiHandSelf(MTGHand* hand);
|
||||
~GuiHandSelf();
|
||||
virtual int receiveEventPlus(WEvent* e);
|
||||
virtual int receiveEventMinus(WEvent* e);
|
||||
public:
|
||||
GuiHandSelf(MTGHand* hand);
|
||||
~GuiHandSelf();
|
||||
virtual int receiveEventPlus(WEvent* e);
|
||||
virtual int receiveEventMinus(WEvent* e);
|
||||
|
||||
void Repos();
|
||||
bool CheckUserInput(JButton key);
|
||||
virtual void Render();
|
||||
void Update(float dt);
|
||||
float LeftBoundary();
|
||||
void Repos();
|
||||
bool CheckUserInput(JButton key);
|
||||
virtual void Render();
|
||||
void Update(float dt);
|
||||
float LeftBoundary();
|
||||
|
||||
HandState GetState()
|
||||
{
|
||||
return state;
|
||||
};
|
||||
HandState GetState()
|
||||
{
|
||||
return state;
|
||||
}
|
||||
;
|
||||
|
||||
HandLimitor* limitor;
|
||||
HandLimitor* limitor;
|
||||
};
|
||||
|
||||
#endif // _GUIHAND_H_
|
||||
|
||||
@@ -12,33 +12,48 @@
|
||||
class GameObserver;
|
||||
class Player;
|
||||
|
||||
class GuiLayer{
|
||||
protected:
|
||||
JButton mActionButton;
|
||||
public:
|
||||
int mCount;
|
||||
int mCurr;
|
||||
vector<JGuiObject *> mObjects;
|
||||
void Add(JGuiObject * object);
|
||||
int Remove(JGuiObject * object);
|
||||
int modal;
|
||||
bool hasFocus;
|
||||
virtual void resetObjects();
|
||||
int getMaxId();
|
||||
GuiLayer();
|
||||
virtual ~GuiLayer();
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(JButton key){ return false; };
|
||||
int getIndexOf(JGuiObject * object);
|
||||
JGuiObject * getByIndex (int index);
|
||||
virtual void Render();
|
||||
int empty(){
|
||||
if (mCount) return 0;
|
||||
return 1;
|
||||
};
|
||||
class GuiLayer
|
||||
{
|
||||
protected:
|
||||
JButton mActionButton;
|
||||
public:
|
||||
int mCount;
|
||||
int mCurr;
|
||||
vector<JGuiObject *> mObjects;
|
||||
void Add(JGuiObject * object);
|
||||
int Remove(JGuiObject * object);
|
||||
int modal;
|
||||
bool hasFocus;
|
||||
virtual void resetObjects();
|
||||
int getMaxId();
|
||||
GuiLayer();
|
||||
virtual ~GuiLayer();
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(JButton key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int getIndexOf(JGuiObject * object);
|
||||
JGuiObject * getByIndex(int index);
|
||||
virtual void Render();
|
||||
int empty()
|
||||
{
|
||||
if (mCount)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual int receiveEventPlus(WEvent * e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int receiveEventMinus(WEvent * e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int receiveEventPlus(WEvent * e){return 0;};
|
||||
virtual int receiveEventMinus(WEvent * e){return 0;};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,40 +6,47 @@
|
||||
#include "GameApp.h"
|
||||
#include "GuiLayers.h"
|
||||
|
||||
class ManaIcon : public Pos
|
||||
class ManaIcon: public Pos
|
||||
{
|
||||
hgeParticleSystem* particleSys;
|
||||
JQuad* icon;
|
||||
hgeParticleSystem* particleSys;
|
||||
JQuad* icon;
|
||||
|
||||
float zoomP1, zoomP2, zoomP3, zoomP4, zoomP5, zoomP6;
|
||||
float xP1, xP2, xP3;
|
||||
float yP1, yP2, yP3;
|
||||
float tP1;
|
||||
float f;
|
||||
float destx,desty;
|
||||
public:
|
||||
enum { ALIVE, WITHERING, DROPPING, DEAD } mode;
|
||||
int color;
|
||||
void Render();
|
||||
void Update(float dt, float shift);
|
||||
void Wither();
|
||||
void Drop();
|
||||
ManaIcon(int color, float x, float y,float destx, float desty);
|
||||
~ManaIcon();
|
||||
float zoomP1, zoomP2, zoomP3, zoomP4, zoomP5, zoomP6;
|
||||
float xP1, xP2, xP3;
|
||||
float yP1, yP2, yP3;
|
||||
float tP1;
|
||||
float f;
|
||||
float destx, desty;
|
||||
public:
|
||||
enum
|
||||
{
|
||||
ALIVE,
|
||||
WITHERING,
|
||||
DROPPING,
|
||||
DEAD
|
||||
} mode;
|
||||
|
||||
int color;
|
||||
void Render();
|
||||
void Update(float dt, float shift);
|
||||
void Wither();
|
||||
void Drop();
|
||||
ManaIcon(int color, float x, float y, float destx, float desty);
|
||||
~ManaIcon();
|
||||
};
|
||||
|
||||
class GuiMana : public GuiLayer
|
||||
class GuiMana: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
vector<ManaIcon*> manas;
|
||||
float x, y;
|
||||
Player * owner;
|
||||
void RenderStatic();
|
||||
public:
|
||||
GuiMana(float x, float y, Player *p);
|
||||
~GuiMana();
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
virtual int receiveEventPlus(WEvent * e);
|
||||
virtual int receiveEventMinus(WEvent * e);
|
||||
protected:
|
||||
vector<ManaIcon*> manas;
|
||||
float x, y;
|
||||
Player * owner;
|
||||
void RenderStatic();
|
||||
public:
|
||||
GuiMana(float x, float y, Player *p);
|
||||
~GuiMana();
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
virtual int receiveEventPlus(WEvent * e);
|
||||
virtual int receiveEventMinus(WEvent * e);
|
||||
};
|
||||
|
||||
@@ -5,18 +5,18 @@
|
||||
#include "PhaseRing.h"
|
||||
#include "WEvent.h"
|
||||
|
||||
class GuiPhaseBar : public GuiLayer
|
||||
class GuiPhaseBar: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
Phase* phase;
|
||||
float angle;
|
||||
protected:
|
||||
Phase* phase;
|
||||
float angle;
|
||||
|
||||
public:
|
||||
GuiPhaseBar();
|
||||
~GuiPhaseBar();
|
||||
void Update(float dt);
|
||||
virtual void Render();
|
||||
virtual int receiveEventMinus(WEvent * e);
|
||||
public:
|
||||
GuiPhaseBar();
|
||||
~GuiPhaseBar();
|
||||
void Update(float dt);
|
||||
virtual void Render();
|
||||
virtual int receiveEventMinus(WEvent * e);
|
||||
};
|
||||
|
||||
#endif // _GUIPHASEBAR_H_
|
||||
|
||||
@@ -4,85 +4,89 @@
|
||||
#include "GuiLayers.h"
|
||||
#include "CardGui.h"
|
||||
|
||||
class GuiPlay : public GuiLayer
|
||||
class GuiPlay: public GuiLayer
|
||||
{
|
||||
public:
|
||||
static const float HORZWIDTH;
|
||||
static const float VERTHEIGHT;
|
||||
typedef vector<CardView*>::iterator iterator;
|
||||
public:
|
||||
static const float HORZWIDTH;
|
||||
static const float VERTHEIGHT;
|
||||
typedef vector<CardView*>::iterator iterator;
|
||||
|
||||
protected:
|
||||
class CardStack {
|
||||
protected:
|
||||
unsigned total;
|
||||
float baseX, baseY;
|
||||
float x, y;
|
||||
protected:
|
||||
class CardStack
|
||||
{
|
||||
protected:
|
||||
unsigned total;
|
||||
float baseX, baseY;
|
||||
float x, y;
|
||||
|
||||
public:
|
||||
void reset(unsigned total, float x, float y);
|
||||
void Enstack(CardView*);
|
||||
void RenderSpell(MTGCardInstance*, iterator begin, iterator end, float x, float y);
|
||||
};
|
||||
public:
|
||||
void reset(unsigned total, float x, float y);
|
||||
void Enstack(CardView*);
|
||||
void RenderSpell(MTGCardInstance*, iterator begin, iterator end, float x, float y);
|
||||
};
|
||||
|
||||
class HorzStack : public CardStack {
|
||||
public:
|
||||
HorzStack();
|
||||
void Render(CardView*, iterator begin, iterator end);
|
||||
void Enstack(CardView*);
|
||||
};
|
||||
class VertStack : public CardStack {
|
||||
protected:
|
||||
unsigned count;
|
||||
public:
|
||||
VertStack();
|
||||
void reset(unsigned total, float x, float y);
|
||||
void Render(CardView*, iterator begin, iterator end);
|
||||
void Enstack(CardView*);
|
||||
inline float nextX();
|
||||
};
|
||||
class BattleField : public HorzStack {
|
||||
static const float HEIGHT;
|
||||
unsigned attackers;
|
||||
unsigned blockers;
|
||||
unsigned currentAttacker;
|
||||
float height;
|
||||
class HorzStack: public CardStack
|
||||
{
|
||||
public:
|
||||
HorzStack();
|
||||
void Render(CardView*, iterator begin, iterator end);
|
||||
void Enstack(CardView*);
|
||||
};
|
||||
class VertStack: public CardStack
|
||||
{
|
||||
protected:
|
||||
unsigned count;
|
||||
public:
|
||||
VertStack();
|
||||
void reset(unsigned total, float x, float y);
|
||||
void Render(CardView*, iterator begin, iterator end);
|
||||
void Enstack(CardView*);
|
||||
inline float nextX();
|
||||
};
|
||||
class BattleField: public HorzStack
|
||||
{
|
||||
static const float HEIGHT;
|
||||
unsigned attackers;
|
||||
unsigned blockers;
|
||||
unsigned currentAttacker;
|
||||
float height;
|
||||
|
||||
public:
|
||||
int red;
|
||||
int colorFlow;
|
||||
public:
|
||||
int red;
|
||||
int colorFlow;
|
||||
|
||||
void addAttacker(MTGCardInstance*);
|
||||
void removeAttacker(MTGCardInstance*);
|
||||
void reset(float x, float y);
|
||||
BattleField();
|
||||
void EnstackAttacker(CardView*);
|
||||
void EnstackBlocker(CardView*);
|
||||
void addAttacker(MTGCardInstance*);
|
||||
void removeAttacker(MTGCardInstance*);
|
||||
void reset(float x, float y);
|
||||
BattleField();
|
||||
void EnstackAttacker(CardView*);
|
||||
void EnstackBlocker(CardView*);
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
};
|
||||
|
||||
class Lands: public HorzStack {};
|
||||
class Creatures: public HorzStack {};
|
||||
class Spells: public VertStack {};
|
||||
|
||||
protected:
|
||||
GameObserver* game;
|
||||
Creatures selfCreatures, opponentCreatures;
|
||||
BattleField battleField;
|
||||
Lands selfLands, opponentLands;
|
||||
Spells selfSpells, opponentSpells;
|
||||
iterator end_spells;
|
||||
|
||||
vector<CardView*> cards;
|
||||
|
||||
public:
|
||||
GuiPlay(GameObserver*);
|
||||
~GuiPlay();
|
||||
virtual void Render();
|
||||
void Replace();
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
};
|
||||
|
||||
class Lands : public HorzStack {};
|
||||
class Creatures : public HorzStack {};
|
||||
class Spells : public VertStack {};
|
||||
|
||||
protected:
|
||||
GameObserver* game;
|
||||
Creatures selfCreatures, opponentCreatures;
|
||||
BattleField battleField;
|
||||
Lands selfLands, opponentLands;
|
||||
Spells selfSpells, opponentSpells;
|
||||
iterator end_spells;
|
||||
|
||||
vector<CardView*> cards;
|
||||
|
||||
public:
|
||||
GuiPlay(GameObserver*);
|
||||
~GuiPlay();
|
||||
virtual void Render();
|
||||
void Replace();
|
||||
void Update(float dt);
|
||||
virtual int receiveEventPlus(WEvent * e);
|
||||
virtual int receiveEventMinus(WEvent * e);
|
||||
virtual int receiveEventPlus(WEvent * e);
|
||||
virtual int receiveEventMinus(WEvent * e);
|
||||
};
|
||||
|
||||
#endif // _GUIPLAY_H_
|
||||
|
||||
@@ -9,73 +9,84 @@
|
||||
|
||||
class CardView;
|
||||
|
||||
struct GuiStatic : public PlayGuiObject{
|
||||
GuiAvatars* parent;
|
||||
GuiStatic(float desiredHeight, float x, float y, bool hasFocus, GuiAvatars* parent);
|
||||
virtual void Entering();
|
||||
virtual bool Leaving(JButton key);
|
||||
struct GuiStatic: public PlayGuiObject
|
||||
{
|
||||
GuiAvatars* parent;
|
||||
GuiStatic(float desiredHeight, float x, float y, bool hasFocus, GuiAvatars* parent);
|
||||
virtual void Entering();
|
||||
virtual bool Leaving(JButton key);
|
||||
};
|
||||
|
||||
struct GuiAvatar : public GuiStatic{
|
||||
typedef enum { TOP_LEFT, BOTTOM_RIGHT } Corner;
|
||||
static const unsigned Width = 35;
|
||||
static const unsigned Height = 50;
|
||||
struct GuiAvatar: public GuiStatic
|
||||
{
|
||||
typedef enum
|
||||
{
|
||||
TOP_LEFT,
|
||||
BOTTOM_RIGHT
|
||||
} Corner;
|
||||
|
||||
protected:
|
||||
int avatarRed;
|
||||
int currentLife;
|
||||
int currentpoisonCount;
|
||||
Corner corner;
|
||||
public:
|
||||
Player * player;
|
||||
virtual void Render();
|
||||
GuiAvatar(float x, float y, bool hasFocus, Player * player, Corner corner, GuiAvatars* parent);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
static const unsigned Width = 35;
|
||||
static const unsigned Height = 50;
|
||||
|
||||
struct GuiGameZone : public GuiStatic{
|
||||
static const int Width = 20;
|
||||
static const int Height = 25;
|
||||
vector<CardView*> cards;
|
||||
|
||||
public:
|
||||
MTGGameZone * zone;
|
||||
CardDisplay * cd;
|
||||
int showCards;
|
||||
virtual void Render();
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual bool CheckUserInput(int x, int y);
|
||||
virtual void Update(float dt);
|
||||
GuiGameZone(float x, float y, bool hasFocus, MTGGameZone * zone, GuiAvatars* parent);
|
||||
~GuiGameZone();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
void toggleDisplay();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
//opponenthand
|
||||
class GuiOpponentHand: public GuiGameZone{
|
||||
protected:
|
||||
int avatarRed;
|
||||
int currentLife;
|
||||
int currentpoisonCount;
|
||||
Corner corner;
|
||||
public:
|
||||
Player * player;
|
||||
GuiOpponentHand(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* Parent);
|
||||
int receiveEventPlus(WEvent*);
|
||||
int receiveEventMinus(WEvent*);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
//end of my addition
|
||||
class GuiGraveyard: public GuiGameZone{
|
||||
public:
|
||||
Player * player;
|
||||
GuiGraveyard(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
|
||||
int receiveEventPlus(WEvent*);
|
||||
int receiveEventMinus(WEvent*);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual void Render();
|
||||
GuiAvatar(float x, float y, bool hasFocus, Player * player, Corner corner, GuiAvatars* parent);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class GuiLibrary: public GuiGameZone{
|
||||
public:
|
||||
Player * player;
|
||||
GuiLibrary(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
struct GuiGameZone: public GuiStatic
|
||||
{
|
||||
static const int Width = 20;
|
||||
static const int Height = 25;
|
||||
vector<CardView*> cards;
|
||||
|
||||
public:
|
||||
MTGGameZone * zone;
|
||||
CardDisplay * cd;
|
||||
int showCards;
|
||||
virtual void Render();
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual bool CheckUserInput(int x, int y);
|
||||
virtual void Update(float dt);
|
||||
GuiGameZone(float x, float y, bool hasFocus, MTGGameZone * zone, GuiAvatars* parent);
|
||||
~GuiGameZone();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
void toggleDisplay();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
//opponenthand
|
||||
class GuiOpponentHand: public GuiGameZone
|
||||
{
|
||||
public:
|
||||
Player * player;
|
||||
GuiOpponentHand(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* Parent);
|
||||
int receiveEventPlus(WEvent*);
|
||||
int receiveEventMinus(WEvent*);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
//end of my addition
|
||||
class GuiGraveyard: public GuiGameZone
|
||||
{
|
||||
public:
|
||||
Player * player;
|
||||
GuiGraveyard(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
|
||||
int receiveEventPlus(WEvent*);
|
||||
int receiveEventMinus(WEvent*);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class GuiLibrary: public GuiGameZone
|
||||
{
|
||||
public:
|
||||
Player * player;
|
||||
GuiLibrary(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
#endif // _GUISTATIC_H_
|
||||
|
||||
@@ -22,7 +22,6 @@ class Counter;
|
||||
using std::string;
|
||||
using std::map;
|
||||
|
||||
|
||||
//stupid variables used to give a hint to the AI:
|
||||
// Should I cast a spell on an enemy or friendly unit ?
|
||||
#define BAKA_EFFECT_GOOD 1
|
||||
@@ -63,22 +62,38 @@ public:
|
||||
MTGAbility(int id, MTGCardInstance* _source, Targetable* _target);
|
||||
virtual int testDestroy();
|
||||
virtual ~MTGAbility();
|
||||
virtual void Render(){};
|
||||
virtual int isReactingToClick(MTGCardInstance* card, ManaCost* mana = NULL){return 0;};
|
||||
virtual int reactToClick(MTGCardInstance* card){return 0;};
|
||||
virtual int receiveEvent(WEvent* event){return 0;};
|
||||
virtual void Update(float dt){};
|
||||
virtual void Render() {}
|
||||
virtual int isReactingToClick(MTGCardInstance* card, ManaCost* mana = NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int reactToClick(MTGCardInstance* card)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int receiveEvent(WEvent* event)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual void Update(float dt) {};
|
||||
virtual int fireAbility();
|
||||
virtual int stillInUse(MTGCardInstance* card);
|
||||
virtual int resolve(){return 0;};
|
||||
virtual MTGAbility* clone() const = 0;
|
||||
virtual int resolve()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual MTGAbility* clone() const = 0;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual int addToGame();
|
||||
virtual int removeFromGame();
|
||||
|
||||
/*Poor man's casting */
|
||||
/* Todo replace that crap with dynamic casting */
|
||||
enum
|
||||
enum
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
MANA_PRODUCER = 1,
|
||||
@@ -116,26 +131,35 @@ public:
|
||||
NestedAbility(MTGAbility* _ability);
|
||||
};
|
||||
|
||||
class TriggeredAbility:public MTGAbility
|
||||
class TriggeredAbility: public MTGAbility
|
||||
{
|
||||
public:
|
||||
TriggeredAbility(int id, MTGCardInstance* card);
|
||||
TriggeredAbility(int id, MTGCardInstance* _source, Targetable* _target);
|
||||
virtual void Update(float dt);
|
||||
virtual void Render(){};
|
||||
virtual int trigger(){return 0;};
|
||||
virtual int triggerOnEvent(WEvent* e){return 0;};
|
||||
virtual void Render() {}
|
||||
;
|
||||
virtual int trigger()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int triggerOnEvent(WEvent* e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
int receiveEvent(WEvent* e);
|
||||
virtual int resolve() = 0;
|
||||
virtual TriggeredAbility* clone() const = 0;
|
||||
virtual TriggeredAbility* clone() const = 0;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
|
||||
class ActivatedAbility:public MTGAbility
|
||||
class ActivatedAbility: public MTGAbility
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
NO_RESTRICTION = 0,
|
||||
PLAYER_TURN_ONLY = 1,
|
||||
AS_SORCERY = 2,
|
||||
@@ -190,21 +214,21 @@ public:
|
||||
ManaCost* abilityCost;
|
||||
int restrictions;
|
||||
int needsTapping;
|
||||
ActivatedAbility(int id, MTGCardInstance* card,ManaCost* _cost = NULL, int _restrictions = NO_RESTRICTION,int tap = 1);
|
||||
ActivatedAbility(int id, MTGCardInstance* card, ManaCost* _cost = NULL, int _restrictions = NO_RESTRICTION, int tap = 1);
|
||||
virtual ~ActivatedAbility();
|
||||
virtual int reactToClick(MTGCardInstance* card);
|
||||
virtual int isReactingToClick(MTGCardInstance* card, ManaCost* mana = NULL);
|
||||
virtual int reactToTargetClick(Targetable* object);
|
||||
virtual int resolve() = 0;
|
||||
virtual ActivatedAbility* clone() const = 0;
|
||||
virtual ActivatedAbility* clone() const = 0;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class TargetAbility:public ActivatedAbility, public NestedAbility
|
||||
class TargetAbility: public ActivatedAbility, public NestedAbility
|
||||
{
|
||||
public:
|
||||
TargetAbility(int id, MTGCardInstance* card, TargetChooser* _tc,ManaCost* _cost = NULL, int _playerturnonly = 0,int tap = 1);
|
||||
TargetAbility(int id, MTGCardInstance* card,ManaCost* _cost = NULL, int _playerturnonly = 0,int tap = 1);
|
||||
TargetAbility(int id, MTGCardInstance* card, TargetChooser* _tc, ManaCost* _cost = NULL, int _playerturnonly = 0, int tap = 1);
|
||||
TargetAbility(int id, MTGCardInstance* card, ManaCost* _cost = NULL, int _playerturnonly = 0, int tap = 1);
|
||||
virtual int reactToClick(MTGCardInstance* card);
|
||||
virtual int reactToTargetClick(Targetable* object);
|
||||
virtual TargetAbility* clone() const = 0;
|
||||
@@ -215,71 +239,100 @@ public:
|
||||
~TargetAbility();
|
||||
};
|
||||
|
||||
class InstantAbility:public MTGAbility
|
||||
class InstantAbility: public MTGAbility
|
||||
{
|
||||
public:
|
||||
int init;
|
||||
virtual void Update(float dt);
|
||||
virtual int testDestroy();
|
||||
InstantAbility(int _id, MTGCardInstance* source);
|
||||
InstantAbility(int _id, MTGCardInstance* source,Damageable* _target);
|
||||
virtual int resolve(){return 0;};
|
||||
InstantAbility(int _id, MTGCardInstance* source, Damageable* _target);
|
||||
virtual int resolve()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual InstantAbility* clone() const = 0;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
/* State based effects. This class works ONLY for InPlay and needs to be extended for other areas of the game !!! */
|
||||
class ListMaintainerAbility:public MTGAbility
|
||||
class ListMaintainerAbility: public MTGAbility
|
||||
{
|
||||
public:
|
||||
map<MTGCardInstance *,bool> cards;
|
||||
map<Player *,bool> players;
|
||||
ListMaintainerAbility(int _id):MTGAbility(_id,NULL){};
|
||||
ListMaintainerAbility(int _id, MTGCardInstance *_source):MTGAbility(_id, _source){};
|
||||
ListMaintainerAbility(int _id, MTGCardInstance *_source,Damageable* _target):MTGAbility(_id, _source, _target){};
|
||||
map<MTGCardInstance *, bool> cards;
|
||||
map<Player *, bool> players;
|
||||
ListMaintainerAbility(int _id) : MTGAbility(_id, NULL)
|
||||
{
|
||||
}
|
||||
;
|
||||
ListMaintainerAbility(int _id, MTGCardInstance *_source) : MTGAbility(_id, _source)
|
||||
{
|
||||
}
|
||||
;
|
||||
ListMaintainerAbility(int _id, MTGCardInstance *_source, Damageable* _target) : MTGAbility(_id, _source, _target)
|
||||
{
|
||||
}
|
||||
;
|
||||
virtual void Update(float dt);
|
||||
void updateTargets();
|
||||
virtual bool canTarget(MTGGameZone* zone);
|
||||
virtual int canBeInList(MTGCardInstance* card) = 0;
|
||||
virtual int added(MTGCardInstance* card) = 0;
|
||||
virtual int removed(MTGCardInstance* card) = 0;
|
||||
virtual int canBeInList(Player* p){return 0;};
|
||||
virtual int added(Player* p){return 0;};
|
||||
virtual int removed(Player* p){return 0;};
|
||||
virtual int canBeInList(Player* p)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int added(Player* p)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int removed(Player* p)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int destroy();
|
||||
virtual ListMaintainerAbility* clone() const = 0;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class TriggerAtPhase:public TriggeredAbility
|
||||
class TriggerAtPhase: public TriggeredAbility
|
||||
{
|
||||
public:
|
||||
int phaseId;
|
||||
int who;
|
||||
TriggerAtPhase(int id, MTGCardInstance* source, Targetable* target,int _phaseId, int who = 0);
|
||||
TriggerAtPhase(int id, MTGCardInstance* source, Targetable* target, int _phaseId, int who = 0);
|
||||
virtual int trigger();
|
||||
int resolve(){return 0;};
|
||||
int resolve()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual TriggerAtPhase* clone() const;
|
||||
};
|
||||
|
||||
class TriggerNextPhase:public TriggerAtPhase
|
||||
class TriggerNextPhase: public TriggerAtPhase
|
||||
{
|
||||
public:
|
||||
int destroyActivated;
|
||||
TriggerNextPhase(int id, MTGCardInstance* source, Targetable* target,int _phaseId, int who = 0);
|
||||
TriggerNextPhase(int id, MTGCardInstance* source, Targetable* target, int _phaseId, int who = 0);
|
||||
virtual TriggerNextPhase* clone() const;
|
||||
virtual int testDestroy();
|
||||
|
||||
};
|
||||
|
||||
|
||||
class GenericTriggeredAbility:public TriggeredAbility, public NestedAbility
|
||||
class GenericTriggeredAbility: public TriggeredAbility, public NestedAbility
|
||||
{
|
||||
public:
|
||||
TriggeredAbility* t;
|
||||
queue<Targetable *> targets;
|
||||
MTGAbility* destroyCondition;
|
||||
GenericTriggeredAbility(int id, MTGCardInstance* _source, TriggeredAbility* _t, MTGAbility* a,MTGAbility* dc = NULL, Targetable* _target = NULL);
|
||||
GenericTriggeredAbility(int id, MTGCardInstance* _source, TriggeredAbility* _t, MTGAbility* a, MTGAbility* dc = NULL,
|
||||
Targetable* _target = NULL);
|
||||
virtual int trigger();
|
||||
virtual int triggerOnEvent(WEvent* e);
|
||||
virtual int resolve();
|
||||
@@ -301,17 +354,19 @@ private:
|
||||
int countCards(TargetChooser* tc, Player* player = NULL, int option = 0);
|
||||
TriggeredAbility* parseTrigger(string s, string magicText, int id, Spell* spell, MTGCardInstance *card, Targetable* target);
|
||||
int parseRestriction(string s);
|
||||
MTGAbility* getAlternateCost( string s, int id, Spell *spell, MTGCardInstance *card );
|
||||
MTGAbility* getAlternateCost(string s, int id, Spell *spell, MTGCardInstance *card);
|
||||
MTGAbility* getManaReduxAbility(string s, int id, Spell *spell, MTGCardInstance *card, MTGCardInstance *target);
|
||||
|
||||
public:
|
||||
Counter* parseCounter(string s, MTGCardInstance* target, Spell* spell = NULL);
|
||||
int parsePowerToughness(string s, int* power, int* toughness);
|
||||
int getAbilities(vector<MTGAbility *>* v, Spell* spell, MTGCardInstance* card = NULL, int id = 0,MTGGameZone* dest = NULL);
|
||||
MTGAbility* parseMagicLine(string s, int id, Spell* spell, MTGCardInstance *card, int activated = 0, int forceUEOT = 0,int oneShot = 0,int forceForever = 0, MTGGameZone* dest = NULL);
|
||||
int parsePowerToughness(string s, int* power, int* toughness);
|
||||
int getAbilities(vector<MTGAbility *>* v, Spell* spell, MTGCardInstance* card = NULL, int id = 0, MTGGameZone* dest = NULL);
|
||||
MTGAbility* parseMagicLine(string s, int id, Spell* spell, MTGCardInstance *card, int activated = 0, int forceUEOT = 0,
|
||||
int oneShot = 0, int forceForever = 0, MTGGameZone* dest = NULL);
|
||||
|
||||
int abilityEfficiency(MTGAbility* a, Player* p, int mode = MODE_ABILITY, TargetChooser* tc = NULL);
|
||||
int magicText(int id, Spell* spell, MTGCardInstance* card = NULL, int mode = MODE_PUTINTOPLAY, TargetChooser* tc = NULL, MTGGameZone* dest = NULL);
|
||||
int magicText(int id, Spell* spell, MTGCardInstance* card = NULL, int mode = MODE_PUTINTOPLAY, TargetChooser* tc = NULL,
|
||||
MTGGameZone* dest = NULL);
|
||||
static int computeX(Spell* spell, MTGCardInstance* card);
|
||||
static int computeXX(Spell* spell, MTGCardInstance* card);
|
||||
static MTGAbility* getCoreAbility(MTGAbility* a);
|
||||
@@ -323,12 +378,12 @@ public:
|
||||
void addAbilities(int _id, Spell* spell);
|
||||
};
|
||||
|
||||
|
||||
class ActivatedAbilityTP:public ActivatedAbility
|
||||
class ActivatedAbilityTP: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
int who;
|
||||
ActivatedAbilityTP(int id, MTGCardInstance* card, Targetable* _target = NULL, ManaCost* cost=NULL, int doTap = 0, int who = TargetChooser::UNSET);
|
||||
ActivatedAbilityTP(int id, MTGCardInstance* card, Targetable* _target = NULL, ManaCost* cost = NULL, int doTap = 0, int who =
|
||||
TargetChooser::UNSET);
|
||||
Targetable* getTarget();
|
||||
};
|
||||
|
||||
@@ -343,9 +398,9 @@ public:
|
||||
ManaCost* output;
|
||||
int tap;
|
||||
AManaProducer(int id, MTGCardInstance* card, Targetable* t, ManaCost* _output, ManaCost* _cost = NULL, int doTap = 1, int who = TargetChooser::UNSET);
|
||||
int isReactingToClick(MTGCardInstance* _card, ManaCost* mana = NULL);
|
||||
int isReactingToClick(MTGCardInstance* _card, ManaCost* mana = NULL);
|
||||
int resolve();
|
||||
int reactToClick(MTGCardInstance* _card);
|
||||
int reactToClick(MTGCardInstance* _card);
|
||||
const char* getMenuText();
|
||||
~AManaProducer();
|
||||
virtual AManaProducer* clone() const;
|
||||
|
||||
@@ -17,34 +17,32 @@ class CardPrimitive;
|
||||
|
||||
using namespace std;
|
||||
|
||||
class MTGCard {
|
||||
protected:
|
||||
friend class MTGSetInfo;
|
||||
int mtgid;
|
||||
char rarity;
|
||||
char image_name[MTGCARD_NAME_SIZE];
|
||||
int init();
|
||||
class MTGCard
|
||||
{
|
||||
protected:
|
||||
friend class MTGSetInfo;
|
||||
int mtgid;
|
||||
char rarity;
|
||||
char image_name[MTGCARD_NAME_SIZE];
|
||||
int init();
|
||||
|
||||
public:
|
||||
int setId;
|
||||
CardPrimitive * data;
|
||||
|
||||
MTGCard();
|
||||
MTGCard(int set_id);
|
||||
MTGCard(MTGCard * source);
|
||||
public:
|
||||
int setId;
|
||||
CardPrimitive * data;
|
||||
|
||||
void setMTGId(int id);
|
||||
void setRarity(char _rarity);
|
||||
//void setImageName( char * value);
|
||||
void setPrimitive(CardPrimitive * cp);
|
||||
MTGCard();
|
||||
MTGCard(int set_id);
|
||||
MTGCard(MTGCard * source);
|
||||
|
||||
int getMTGId() const;
|
||||
int getId() const;
|
||||
char getRarity() const;
|
||||
char * getImageName();
|
||||
void setMTGId(int id);
|
||||
void setRarity(char _rarity);
|
||||
//void setImageName( char * value);
|
||||
void setPrimitive(CardPrimitive * cp);
|
||||
|
||||
int getMTGId() const;
|
||||
int getId() const;
|
||||
char getRarity() const;
|
||||
char * getImageName();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "Damage.h"
|
||||
#include "Targetable.h"
|
||||
|
||||
|
||||
class MTGCardInstance;
|
||||
class MTGPlayerCards;
|
||||
class MTGAbility;
|
||||
@@ -24,149 +23,150 @@ struct Pos;
|
||||
#include <list>
|
||||
using namespace std;
|
||||
|
||||
class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
protected:
|
||||
int untapping;
|
||||
int nb_damages;
|
||||
string sample;
|
||||
int tapped;
|
||||
class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable
|
||||
{
|
||||
protected:
|
||||
int untapping;
|
||||
int nb_damages;
|
||||
string sample;
|
||||
int tapped;
|
||||
|
||||
int lifeOrig;
|
||||
MTGPlayerCards * belongs_to;
|
||||
MTGCardInstance * getNextPartner();
|
||||
void initMTGCI();
|
||||
int setDefenser(MTGCardInstance * c);
|
||||
int addBlocker(MTGCardInstance * c);
|
||||
int removeBlocker(MTGCardInstance * c);
|
||||
int init();
|
||||
public:
|
||||
int setAttacker(int value);
|
||||
MTGGameZone * currentZone;
|
||||
Pos* view;
|
||||
int X;
|
||||
int XX;
|
||||
int alternateCostPaid[ManaCost::MANA_PAID_WITH_RETRACE + 1];
|
||||
int paymenttype;
|
||||
int frozen;
|
||||
int sunburst;
|
||||
int equipment;
|
||||
int reduxamount;
|
||||
int flanked;
|
||||
int regenerateTokens;
|
||||
int isToken;
|
||||
int stillInUse();
|
||||
int didattacked;
|
||||
int didblocked;
|
||||
int notblocked;
|
||||
int fresh;
|
||||
int MaxLevelUp;
|
||||
Player * lastController;
|
||||
MTGGameZone * getCurrentZone();
|
||||
MTGGameZone * previousZone;
|
||||
MTGCardInstance * previous;
|
||||
MTGCardInstance * next;
|
||||
int doDamageTest;
|
||||
int summoningSickness;
|
||||
// The recommended method to test for summoning Sickness !
|
||||
int hasSummoningSickness();
|
||||
MTGCardInstance * changeController(Player * newcontroller);
|
||||
Player * owner;
|
||||
Counters * counters;
|
||||
int typeAsTarget(){return TARGET_CARD;}
|
||||
const string getDisplayName() const;
|
||||
MTGCardInstance * target;
|
||||
int lifeOrig;
|
||||
MTGPlayerCards * belongs_to;
|
||||
MTGCardInstance * getNextPartner();
|
||||
void initMTGCI();
|
||||
int setDefenser(MTGCardInstance * c);
|
||||
int addBlocker(MTGCardInstance * c);
|
||||
int removeBlocker(MTGCardInstance * c);
|
||||
int init();
|
||||
public:
|
||||
int setAttacker(int value);
|
||||
MTGGameZone * currentZone;
|
||||
Pos* view;
|
||||
int X;
|
||||
int XX;
|
||||
int alternateCostPaid[ManaCost::MANA_PAID_WITH_RETRACE + 1];
|
||||
int paymenttype;
|
||||
int frozen;
|
||||
int sunburst;
|
||||
int equipment;
|
||||
int reduxamount;
|
||||
int flanked;
|
||||
int regenerateTokens;
|
||||
int isToken;
|
||||
int stillInUse();
|
||||
int didattacked;
|
||||
int didblocked;
|
||||
int notblocked;
|
||||
int fresh;
|
||||
int MaxLevelUp;
|
||||
Player * lastController;
|
||||
MTGGameZone * getCurrentZone();
|
||||
MTGGameZone * previousZone;
|
||||
MTGCardInstance * previous;
|
||||
MTGCardInstance * next;
|
||||
int doDamageTest;
|
||||
int summoningSickness;
|
||||
// The recommended method to test for summoning Sickness !
|
||||
int hasSummoningSickness();
|
||||
MTGCardInstance * changeController(Player * newcontroller);
|
||||
Player * owner;
|
||||
Counters * counters;
|
||||
int typeAsTarget()
|
||||
{
|
||||
return TARGET_CARD;
|
||||
}
|
||||
const string getDisplayName() const;
|
||||
MTGCardInstance * target;
|
||||
|
||||
//types
|
||||
void addType(char * type_text);
|
||||
virtual void addType(int id);
|
||||
void setType(const char * type_text);
|
||||
void setSubtype(string value);
|
||||
int removeType(string value, int removeAll = 0);
|
||||
int removeType(int value, int removeAll = 0);
|
||||
|
||||
//types
|
||||
void addType(char * type_text);
|
||||
virtual void addType(int id);
|
||||
void setType(const char * type_text);
|
||||
void setSubtype( string value);
|
||||
int removeType(string value, int removeAll = 0);
|
||||
int removeType(int value, int removeAll = 0);
|
||||
//dangerranking is a hint to Ai which creatures are the ones it should be targetting for effects.
|
||||
int DangerRanking();
|
||||
//Combat
|
||||
bool blocked; //Blocked this turn or not?
|
||||
MTGCardInstance * defenser;
|
||||
list<MTGCardInstance *> blockers;
|
||||
int attacker;
|
||||
int toggleDefenser(MTGCardInstance * opponent);
|
||||
int raiseBlockerRankOrder(MTGCardInstance * blocker);
|
||||
|
||||
//dangerranking is a hint to Ai which creatures are the ones it should be targetting for effects.
|
||||
int DangerRanking();
|
||||
//Combat
|
||||
bool blocked; //Blocked this turn or not?
|
||||
MTGCardInstance * defenser;
|
||||
list<MTGCardInstance *>blockers;
|
||||
int attacker;
|
||||
int toggleDefenser(MTGCardInstance * opponent);
|
||||
int raiseBlockerRankOrder(MTGCardInstance * blocker);
|
||||
//Returns rank of the card in blockers if it is a blocker of this (starting at 1), 0 otherwise
|
||||
int getDefenserRank(MTGCardInstance * blocker);
|
||||
int toggleAttacker();
|
||||
MTGCardInstance * banding; // If belongs to a band when attacking
|
||||
int canBlock();
|
||||
int canBlock(MTGCardInstance * opponent);
|
||||
int canAttack();
|
||||
int isAttacker();
|
||||
MTGCardInstance * isDefenser();
|
||||
int initAttackersDefensers();
|
||||
MTGCardInstance * getNextOpponent(MTGCardInstance * previous = NULL);
|
||||
int nbOpponents();
|
||||
int stepPower(CombatStep step);
|
||||
int afterDamage();
|
||||
int has(int ability);
|
||||
int cleanup();
|
||||
|
||||
//Returns rank of the card in blockers if it is a blocker of this (starting at 1), 0 otherwise
|
||||
int getDefenserRank(MTGCardInstance * blocker);
|
||||
int toggleAttacker();
|
||||
MTGCardInstance * banding; // If belongs to a band when attacking
|
||||
int canBlock();
|
||||
int canBlock(MTGCardInstance * opponent);
|
||||
int canAttack();
|
||||
int isAttacker();
|
||||
MTGCardInstance * isDefenser();
|
||||
int initAttackersDefensers();
|
||||
MTGCardInstance * getNextOpponent(MTGCardInstance * previous=NULL);
|
||||
int nbOpponents();
|
||||
int stepPower(CombatStep step);
|
||||
int afterDamage();
|
||||
int has(int ability);
|
||||
int cleanup();
|
||||
MTGCard * model;
|
||||
MTGCardInstance();
|
||||
MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to);
|
||||
int regenerate();
|
||||
int triggerRegenerate();
|
||||
Player * controller();
|
||||
|
||||
MTGCard * model;
|
||||
MTGCardInstance();
|
||||
MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to);
|
||||
int regenerate();
|
||||
int triggerRegenerate();
|
||||
Player * controller();
|
||||
virtual ~MTGCardInstance();
|
||||
int bury();
|
||||
int destroy();
|
||||
|
||||
virtual ~MTGCardInstance();
|
||||
int bury();
|
||||
int destroy();
|
||||
int addToToughness(int value);
|
||||
int setToughness(int value);
|
||||
|
||||
vector<TargetChooser *> protections;
|
||||
int addProtection(TargetChooser * tc);
|
||||
int removeProtection(TargetChooser *tc, int erase = 0);
|
||||
int protectedAgainst(MTGCardInstance * card);
|
||||
|
||||
int addToToughness(int value);
|
||||
int setToughness(int value);
|
||||
vector<TargetChooser *> cantBeBlockedBys;
|
||||
int addCantBeBlockedBy(TargetChooser * tc);
|
||||
int removeCantBeBlockedBy(TargetChooser *tc, int erase = 0);
|
||||
int cantBeBlockedBy(MTGCardInstance * card);
|
||||
|
||||
vector<TargetChooser *>protections;
|
||||
int addProtection(TargetChooser * tc);
|
||||
int removeProtection(TargetChooser *tc, int erase = 0);
|
||||
int protectedAgainst(MTGCardInstance * card);
|
||||
void copy(MTGCardInstance * card);
|
||||
|
||||
vector<TargetChooser *>cantBeBlockedBys;
|
||||
int addCantBeBlockedBy(TargetChooser * tc);
|
||||
int removeCantBeBlockedBy(TargetChooser *tc, int erase = 0);
|
||||
int cantBeBlockedBy(MTGCardInstance * card);
|
||||
void setUntapping();
|
||||
int isUntapping();
|
||||
int isTapped();
|
||||
void untap();
|
||||
void tap();
|
||||
void attemptUntap();
|
||||
|
||||
void copy(MTGCardInstance * card);
|
||||
void eventattacked();
|
||||
void eventattackedAlone();
|
||||
void eventattackednotblocked();
|
||||
void eventattackedblocked();
|
||||
void eventblocked();
|
||||
|
||||
void setUntapping();
|
||||
int isUntapping();
|
||||
int isTapped();
|
||||
void untap();
|
||||
void tap();
|
||||
void attemptUntap();
|
||||
int isInPlay();
|
||||
JSample * getSample();
|
||||
|
||||
void eventattacked();
|
||||
void eventattackedAlone();
|
||||
void eventattackednotblocked();
|
||||
void eventattackedblocked();
|
||||
void eventblocked();
|
||||
JQuad * getIcon();
|
||||
|
||||
int isInPlay();
|
||||
JSample * getSample();
|
||||
ostream& toString(ostream&) const;
|
||||
|
||||
JQuad * getIcon();
|
||||
static MTGCardInstance AnyCard;
|
||||
static MTGCardInstance NoCard;
|
||||
|
||||
ostream& toString(ostream&) const;
|
||||
|
||||
static MTGCardInstance AnyCard;
|
||||
static MTGCardInstance NoCard;
|
||||
|
||||
static MTGCardInstance ExtraRules[2];
|
||||
static MTGCardInstance ExtraRules[2];
|
||||
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream&, const MTGCardInstance&);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "GameApp.h"
|
||||
#include "WResourceManager.h"
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
using std::string;
|
||||
@@ -15,145 +14,150 @@ class GameApp;
|
||||
class MTGCard;
|
||||
class CardPrimitive;
|
||||
class MTGPack;
|
||||
class MTGSetInfo{
|
||||
class MTGSetInfo
|
||||
{
|
||||
public:
|
||||
MTGSetInfo(string _id);
|
||||
~MTGSetInfo();
|
||||
string id; //Short name: 10E, RAV, etc. Automatic from folder.
|
||||
string author; //Author of set, for crediting mod makers, etc.
|
||||
string name; //Long name: Tenth Edition
|
||||
int block; //For future use by tournament mode, etc.
|
||||
int year; //The year the set was released.
|
||||
//TODO Way to group cards by name, rather than mtgid.
|
||||
MTGSetInfo(string _id);
|
||||
~MTGSetInfo();
|
||||
string id; //Short name: 10E, RAV, etc. Automatic from folder.
|
||||
string author; //Author of set, for crediting mod makers, etc.
|
||||
string name; //Long name: Tenth Edition
|
||||
int block; //For future use by tournament mode, etc.
|
||||
int year; //The year the set was released.
|
||||
//TODO Way to group cards by name, rather than mtgid.
|
||||
|
||||
void count(MTGCard * c);
|
||||
void count(MTGCard * c);
|
||||
|
||||
int totalCards();
|
||||
string getName();
|
||||
string getBlock();
|
||||
void processConfLine(string line);
|
||||
int totalCards();
|
||||
string getName();
|
||||
string getBlock();
|
||||
void processConfLine(string line);
|
||||
|
||||
enum {
|
||||
//For memoized counts
|
||||
LAND = 0,
|
||||
COMMON = 1,
|
||||
UNCOMMON = 2,
|
||||
RARE = 3,
|
||||
MAX_RARITY = 4, //For boosters, mythic is part of rare... always.
|
||||
MYTHIC = 4,
|
||||
TOTAL_CARDS = 5,
|
||||
MAX_COUNT = 6
|
||||
};
|
||||
enum
|
||||
{
|
||||
//For memoized counts
|
||||
LAND = 0,
|
||||
COMMON = 1,
|
||||
UNCOMMON = 2,
|
||||
RARE = 3,
|
||||
MAX_RARITY = 4, //For boosters, mythic is part of rare... always.
|
||||
MYTHIC = 4,
|
||||
TOTAL_CARDS = 5,
|
||||
MAX_COUNT = 6
|
||||
};
|
||||
|
||||
MTGPack * mPack; //Does it use a specialized booster pack?
|
||||
bool bZipped; //Is this set's images present as a zip file?
|
||||
bool bThemeZipped; //[...] in the theme?
|
||||
int counts[MTGSetInfo::MAX_COUNT];
|
||||
MTGPack * mPack; //Does it use a specialized booster pack?
|
||||
bool bZipped; //Is this set's images present as a zip file?
|
||||
bool bThemeZipped; //[...] in the theme?
|
||||
int counts[MTGSetInfo::MAX_COUNT];
|
||||
};
|
||||
|
||||
class MTGSets{
|
||||
class MTGSets
|
||||
{
|
||||
public:
|
||||
|
||||
//These values have to be < 0
|
||||
// A setID with a value >=0 will be looked into the sets table,
|
||||
// Negative values will be compared to these enums throughout the code (shop, filters...)
|
||||
enum {
|
||||
INTERNAL_SET = -1,
|
||||
ALL_SETS = -2,
|
||||
};
|
||||
//These values have to be < 0
|
||||
// A setID with a value >=0 will be looked into the sets table,
|
||||
// Negative values will be compared to these enums throughout the code (shop, filters...)
|
||||
enum
|
||||
{
|
||||
INTERNAL_SET = -1, ALL_SETS = -2,
|
||||
};
|
||||
|
||||
friend class MTGSetInfo;
|
||||
MTGSets();
|
||||
~MTGSets();
|
||||
|
||||
int Add(const char * subtype);
|
||||
int findSet(string value);
|
||||
int findBlock(string s);
|
||||
int size();
|
||||
friend class MTGSetInfo;
|
||||
MTGSets();
|
||||
~MTGSets();
|
||||
|
||||
int getSetNum(MTGSetInfo*i);
|
||||
int Add(const char * subtype);
|
||||
int findSet(string value);
|
||||
int findBlock(string s);
|
||||
int size();
|
||||
|
||||
int getSetNum(MTGSetInfo*i);
|
||||
|
||||
int operator[](string id); //Returns set id index, -1 for failure.
|
||||
string operator[](int id); //Returns set id name, "" for failure.
|
||||
|
||||
MTGSetInfo* getInfo(int setID);
|
||||
MTGSetInfo* randomSet(int blockId = -1, int atleast = -1); //Tries to match, otherwise 100% random unlocked set
|
||||
|
||||
int operator[](string id); //Returns set id index, -1 for failure.
|
||||
string operator[](int id); //Returns set id name, "" for failure.
|
||||
|
||||
MTGSetInfo* getInfo(int setID);
|
||||
MTGSetInfo* randomSet(int blockId = -1, int atleast = -1); //Tries to match, otherwise 100% random unlocked set
|
||||
|
||||
protected:
|
||||
vector<string> blocks;
|
||||
vector<MTGSetInfo*> setinfo;
|
||||
vector<string> blocks;
|
||||
vector<MTGSetInfo*> setinfo;
|
||||
};
|
||||
|
||||
extern MTGSets setlist;
|
||||
|
||||
class MTGAllCards {
|
||||
class MTGAllCards
|
||||
{
|
||||
private:
|
||||
MTGCard * tempCard; //used by parser
|
||||
CardPrimitive * tempPrimitive; //used by parser
|
||||
int currentGrade; //used by Parser (we don't want an additional attribute for the primitives for that as it is only used at load time)
|
||||
protected:
|
||||
int conf_read_mode;
|
||||
int colorsCount[Constants::MTG_NB_COLORS];
|
||||
int total_cards;
|
||||
GameApp * parent;
|
||||
void init();
|
||||
void initCounters();
|
||||
public:
|
||||
enum {
|
||||
READ_ANYTHING = 0,
|
||||
READ_CARD = 1,
|
||||
READ_METADATA = 2,
|
||||
};
|
||||
vector<int> ids;
|
||||
map<int, MTGCard *> collection;
|
||||
map<string,CardPrimitive *>primitives;
|
||||
MTGAllCards();
|
||||
~MTGAllCards();
|
||||
MTGCard * _(int id);
|
||||
void destroyAllCards();
|
||||
MTGAllCards(const char * config_file, const char * set_name);
|
||||
MTGCard * getCardById(int id);
|
||||
MTGCard * getCardByName(string name);
|
||||
int load(const char * config_file, const char * setName = NULL, int autoload = 1);
|
||||
int countByType(const char * _type);
|
||||
int countByColor(int color);
|
||||
int countBySet(int setId);
|
||||
int totalCards();
|
||||
int randomCardId();
|
||||
private:
|
||||
int processConfLine(string &s, MTGCard* card, CardPrimitive * primitive);
|
||||
bool addCardToCollection(MTGCard * card, int setId);
|
||||
CardPrimitive * addPrimitive(CardPrimitive * primitive, MTGCard * card = NULL);
|
||||
MTGCard * tempCard; //used by parser
|
||||
CardPrimitive * tempPrimitive; //used by parser
|
||||
int currentGrade; //used by Parser (we don't want an additional attribute for the primitives for that as it is only used at load time)
|
||||
protected:
|
||||
int conf_read_mode;
|
||||
int colorsCount[Constants::MTG_NB_COLORS];
|
||||
int total_cards;
|
||||
GameApp * parent;
|
||||
void init();
|
||||
void initCounters();
|
||||
public:
|
||||
enum
|
||||
{
|
||||
READ_ANYTHING = 0,
|
||||
READ_CARD = 1,
|
||||
READ_METADATA = 2,
|
||||
};
|
||||
vector<int> ids;
|
||||
map<int, MTGCard *> collection;
|
||||
map<string, CardPrimitive *> primitives;
|
||||
MTGAllCards();
|
||||
~MTGAllCards();
|
||||
MTGCard * _(int id);
|
||||
void destroyAllCards();
|
||||
MTGAllCards(const char * config_file, const char * set_name);
|
||||
MTGCard * getCardById(int id);
|
||||
MTGCard * getCardByName(string name);
|
||||
int load(const char * config_file, const char * setName = NULL, int autoload = 1);
|
||||
int countByType(const char * _type);
|
||||
int countByColor(int color);
|
||||
int countBySet(int setId);
|
||||
int totalCards();
|
||||
int randomCardId();
|
||||
private:
|
||||
int processConfLine(string &s, MTGCard* card, CardPrimitive * primitive);
|
||||
bool addCardToCollection(MTGCard * card, int setId);
|
||||
CardPrimitive * addPrimitive(CardPrimitive * primitive, MTGCard * card = NULL);
|
||||
};
|
||||
|
||||
class MTGDeck
|
||||
{
|
||||
protected:
|
||||
string filename;
|
||||
int total_cards;
|
||||
|
||||
class MTGDeck{
|
||||
protected:
|
||||
string filename;
|
||||
int total_cards;
|
||||
public:
|
||||
MTGAllCards * database;
|
||||
map<int, int> cards;
|
||||
string meta_desc;
|
||||
string meta_name;
|
||||
int totalCards();
|
||||
int totalPrice();
|
||||
MTGDeck(MTGAllCards * _allcards);
|
||||
MTGDeck(const char * config_file, MTGAllCards * _allcards, int meta_only = 0);
|
||||
int addRandomCards(int howmany, int * setIds = NULL, int nbSets = 0, int rarity = -1, const char * subtype = NULL,
|
||||
int * colors = NULL, int nbcolors = 0);
|
||||
int add(int cardid);
|
||||
int add(MTGDeck * deck); // adds the contents of "deck" into myself
|
||||
int complete();
|
||||
int remove(int cardid);
|
||||
int removeAll();
|
||||
int add(MTGCard * card);
|
||||
int remove(MTGCard * card);
|
||||
int save();
|
||||
int save(string destFileName, bool useExpandedDescriptions, string &deckTitle, string &deckDesc);
|
||||
MTGCard * getCardById(int id);
|
||||
|
||||
public:
|
||||
MTGAllCards * database;
|
||||
map <int,int> cards;
|
||||
string meta_desc;
|
||||
string meta_name;
|
||||
int totalCards();
|
||||
int totalPrice();
|
||||
MTGDeck(MTGAllCards * _allcards);
|
||||
MTGDeck(const char * config_file, MTGAllCards * _allcards, int meta_only = 0);
|
||||
int addRandomCards(int howmany, int * setIds = NULL, int nbSets = 0, int rarity = -1, const char * subtype = NULL, int * colors = NULL, int nbcolors = 0);
|
||||
int add(int cardid);
|
||||
int add(MTGDeck * deck); // adds the contents of "deck" into myself
|
||||
int complete();
|
||||
int remove(int cardid);
|
||||
int removeAll();
|
||||
int add(MTGCard * card);
|
||||
int remove(MTGCard * card);
|
||||
int save();
|
||||
int save(string destFileName, bool useExpandedDescriptions, string &deckTitle, string &deckDesc);
|
||||
MTGCard * getCardById(int id);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,222 +9,217 @@ const float DEFAULT_TEXT_FONT_SCALE = 1.0f;
|
||||
using std::string;
|
||||
class Constants
|
||||
{
|
||||
public:
|
||||
// Exception Codes
|
||||
public:
|
||||
// Exception Codes
|
||||
|
||||
/* Exception codes */
|
||||
const static int PARSER_FAILED_INSTANTIATION = 1000;
|
||||
const static int PARSER_KEYWORD_NOT_MATCHED = 2000;
|
||||
const static int PARSER_INVALID_KEYWORD = 3000;
|
||||
/* Exception codes */
|
||||
const static int PARSER_FAILED_INSTANTIATION = 1000;
|
||||
const static int PARSER_KEYWORD_NOT_MATCHED = 2000;
|
||||
const static int PARSER_INVALID_KEYWORD = 3000;
|
||||
|
||||
// color constants
|
||||
static const string kManaColorless;
|
||||
static const string kManaGreen;
|
||||
static const string kManaBlue;
|
||||
static const string kManaRed;
|
||||
static const string kManaBlack;
|
||||
static const string kManaWhite;
|
||||
|
||||
// color constants
|
||||
static const string kManaColorless;
|
||||
static const string kManaGreen;
|
||||
static const string kManaBlue;
|
||||
static const string kManaRed;
|
||||
static const string kManaBlack;
|
||||
static const string kManaWhite;
|
||||
// alternative costs constants
|
||||
|
||||
// alternative costs constants
|
||||
static const string kAlternativeKeyword;
|
||||
static const string kBuyBackKeyword;
|
||||
static const string kFlashBackKeyword;
|
||||
static const string kRetraceKeyword;
|
||||
static const string kKickerKeyword;
|
||||
|
||||
static const string kAlternativeKeyword;
|
||||
static const string kBuyBackKeyword;
|
||||
static const string kFlashBackKeyword;
|
||||
static const string kRetraceKeyword;
|
||||
static const string kKickerKeyword;
|
||||
// used for deck statistics
|
||||
static const int STATS_FOR_TURNS = 8;
|
||||
static const int STATS_MAX_MANA_COST = 9;
|
||||
|
||||
// used for deck statistics
|
||||
static const int STATS_FOR_TURNS = 8;
|
||||
static const int STATS_MAX_MANA_COST = 9;
|
||||
|
||||
enum
|
||||
{
|
||||
MTG_COLOR_ARTIFACT = 0,
|
||||
MTG_COLOR_GREEN = 1,
|
||||
MTG_COLOR_BLUE = 2,
|
||||
MTG_COLOR_RED = 3,
|
||||
MTG_COLOR_BLACK = 4,
|
||||
MTG_COLOR_WHITE = 5,
|
||||
MTG_COLOR_LAND = 6,
|
||||
enum
|
||||
{
|
||||
MTG_COLOR_ARTIFACT = 0,
|
||||
MTG_COLOR_GREEN = 1,
|
||||
MTG_COLOR_BLUE = 2,
|
||||
MTG_COLOR_RED = 3,
|
||||
MTG_COLOR_BLACK = 4,
|
||||
MTG_COLOR_WHITE = 5,
|
||||
MTG_COLOR_LAND = 6,
|
||||
|
||||
MTG_NB_COLORS = 7,
|
||||
MTG_NB_COLORS = 7,
|
||||
|
||||
MTG_UNCOLORED = 0,
|
||||
MTG_FOREST = 1,
|
||||
MTG_ISLAND = 2,
|
||||
MTG_MOUNTAIN = 3,
|
||||
MTG_SWAMP = 4,
|
||||
MTG_PLAIN = 5,
|
||||
|
||||
MTG_UNCOLORED = 0,
|
||||
MTG_FOREST = 1,
|
||||
MTG_ISLAND = 2,
|
||||
MTG_MOUNTAIN = 3,
|
||||
MTG_SWAMP = 4,
|
||||
MTG_PLAIN = 5,
|
||||
MTG_TYPE_CREATURE = 10,
|
||||
MTG_TYPE_ARTIFACT = 11,
|
||||
MTG_TYPE_ENCHANTMENT = 12,
|
||||
MTG_TYPE_SORCERY = 13,
|
||||
MTG_TYPE_LAND = 14,
|
||||
MTG_TYPE_INSTANT = 15,
|
||||
|
||||
MTG_PHASE_BEFORE_BEGIN = 0,
|
||||
MTG_PHASE_UNTAP = 1,
|
||||
MTG_PHASE_UPKEEP = 2,
|
||||
MTG_PHASE_DRAW = 3,
|
||||
MTG_PHASE_FIRSTMAIN = 4,
|
||||
MTG_PHASE_COMBATBEGIN = 5,
|
||||
MTG_PHASE_COMBATATTACKERS = 6,
|
||||
MTG_PHASE_COMBATBLOCKERS = 7,
|
||||
MTG_PHASE_COMBATDAMAGE = 8,
|
||||
MTG_PHASE_COMBATEND = 9,
|
||||
MTG_PHASE_SECONDMAIN = 10,
|
||||
MTG_PHASE_ENDOFTURN = 11,
|
||||
MTG_PHASE_EOT = 11,
|
||||
MTG_PHASE_CLEANUP = 12,
|
||||
MTG_PHASE_AFTER_EOT = 13,
|
||||
NB_MTG_PHASES = 14,
|
||||
|
||||
MTG_TYPE_CREATURE = 10,
|
||||
MTG_TYPE_ARTIFACT = 11,
|
||||
MTG_TYPE_ENCHANTMENT = 12,
|
||||
MTG_TYPE_SORCERY = 13,
|
||||
MTG_TYPE_LAND = 14,
|
||||
MTG_TYPE_INSTANT = 15,
|
||||
TRAMPLE = 0,
|
||||
FORESTWALK = 1,
|
||||
ISLANDWALK = 2,
|
||||
MOUNTAINWALK = 3,
|
||||
SWAMPWALK = 4,
|
||||
PLAINSWALK = 5,
|
||||
FLYING = 6,
|
||||
FIRSTSTRIKE = 7,
|
||||
DOUBLESTRIKE = 8,
|
||||
FEAR = 9,
|
||||
FLASH = 10,
|
||||
HASTE = 11,
|
||||
LIFELINK = 12,
|
||||
REACH = 13,
|
||||
SHROUD = 14,
|
||||
VIGILANCE = 15,
|
||||
DEFENSER = 16,
|
||||
DEFENDER = 16,
|
||||
BANDING = 17,
|
||||
PROTECTIONGREEN = 18,
|
||||
PROTECTIONBLUE = 19,
|
||||
PROTECTIONRED = 20,
|
||||
PROTECTIONBLACK = 21,
|
||||
PROTECTIONWHITE = 22,
|
||||
UNBLOCKABLE = 23,
|
||||
WITHER = 24,
|
||||
PERSIST = 25,
|
||||
RETRACE = 26,
|
||||
EXALTED = 27,
|
||||
NOFIZZLE = 28,
|
||||
SHADOW = 29,
|
||||
REACHSHADOW = 30,
|
||||
FORESTHOME = 31,
|
||||
ISLANDHOME = 32,
|
||||
MOUNTAINHOME = 33,
|
||||
SWAMPHOME = 34,
|
||||
PLAINSHOME = 35,
|
||||
CLOUD = 36,
|
||||
CANTATTACK = 37,
|
||||
MUSTATTACK = 38,
|
||||
CANTBLOCK = 39,
|
||||
DOESNOTUNTAP = 40,
|
||||
OPPONENTSHROUD = 41,
|
||||
INDESTRUCTIBLE = 42,
|
||||
INTIMIDATE = 43,
|
||||
DEATHTOUCH = 44,
|
||||
HORSEMANSHIP = 45,
|
||||
CANTREGEN = 46,
|
||||
ONEBLOCKER = 47,
|
||||
INFECT = 48,
|
||||
POISONTOXIC = 49,
|
||||
POISONTWOTOXIC = 50,
|
||||
POISONTHREETOXIC = 51,
|
||||
PHANTOM = 52,
|
||||
WILTING = 53,
|
||||
VIGOR = 54,
|
||||
CHANGELING = 55,
|
||||
ABSORB = 56,//this need to be coded for players too "If a source would deal damage"
|
||||
TREASON = 57,
|
||||
UNEARTH = 58,
|
||||
CANTLOSE = 59,
|
||||
CANTLIFELOSE = 60,
|
||||
CANTMILLLOSE = 61,
|
||||
CANTCASTCREATURE = 62,
|
||||
CANTCAST = 63,
|
||||
CANTCASTTWO = 64,
|
||||
STORM = 65,
|
||||
BOTHCANTCAST = 66,
|
||||
BOTHNOCREATURE = 67,
|
||||
ONLYONEBOTH = 68,
|
||||
AFFINITYARTIFACTS = 69,
|
||||
AFFINITYPLAINS = 70,
|
||||
AFFINITYFOREST = 71,
|
||||
AFFINITYISLAND = 72,
|
||||
AFFINITYMOUNTAIN = 73,
|
||||
AFFINITYSWAMP = 74,
|
||||
AFFINITYGREENCREATURES = 75,
|
||||
CANTWIN = 76,
|
||||
NOMAXHAND = 77,
|
||||
LEYLINE = 78,
|
||||
PLAYERSHROUD = 79,
|
||||
CONTROLLERSHROUD = 80,
|
||||
SUNBURST = 81,
|
||||
FLANKING = 82,
|
||||
EXILEDEATH = 83,
|
||||
|
||||
NB_BASIC_ABILITIES = 84,
|
||||
|
||||
MTG_PHASE_BEFORE_BEGIN = 0,
|
||||
MTG_PHASE_UNTAP = 1,
|
||||
MTG_PHASE_UPKEEP = 2,
|
||||
MTG_PHASE_DRAW = 3,
|
||||
MTG_PHASE_FIRSTMAIN = 4,
|
||||
MTG_PHASE_COMBATBEGIN = 5,
|
||||
MTG_PHASE_COMBATATTACKERS = 6,
|
||||
MTG_PHASE_COMBATBLOCKERS = 7,
|
||||
MTG_PHASE_COMBATDAMAGE = 8,
|
||||
MTG_PHASE_COMBATEND = 9,
|
||||
MTG_PHASE_SECONDMAIN = 10,
|
||||
MTG_PHASE_ENDOFTURN = 11,
|
||||
MTG_PHASE_EOT = 11,
|
||||
MTG_PHASE_CLEANUP = 12,
|
||||
MTG_PHASE_AFTER_EOT = 13,
|
||||
NB_MTG_PHASES = 14,
|
||||
RARITY_S = 'S', //Special Rarity
|
||||
RARITY_M = 'M', //Mythics
|
||||
RARITY_R = 'R', //Rares
|
||||
RARITY_U = 'U', //Uncommons
|
||||
RARITY_C = 'C', //Commons
|
||||
RARITY_L = 'L', //Lands
|
||||
RARITY_T = 'T', //Tokens
|
||||
|
||||
TRAMPLE = 0,
|
||||
FORESTWALK = 1,
|
||||
ISLANDWALK = 2,
|
||||
MOUNTAINWALK = 3,
|
||||
SWAMPWALK = 4,
|
||||
PLAINSWALK = 5,
|
||||
FLYING = 6,
|
||||
FIRSTSTRIKE = 7,
|
||||
DOUBLESTRIKE = 8,
|
||||
FEAR = 9,
|
||||
FLASH = 10,
|
||||
HASTE = 11,
|
||||
LIFELINK = 12,
|
||||
REACH = 13,
|
||||
SHROUD = 14,
|
||||
VIGILANCE = 15,
|
||||
DEFENSER = 16,
|
||||
DEFENDER = 16,
|
||||
BANDING = 17,
|
||||
PROTECTIONGREEN = 18,
|
||||
PROTECTIONBLUE = 19,
|
||||
PROTECTIONRED = 20,
|
||||
PROTECTIONBLACK = 21,
|
||||
PROTECTIONWHITE = 22,
|
||||
UNBLOCKABLE = 23,
|
||||
WITHER = 24,
|
||||
PERSIST = 25,
|
||||
RETRACE = 26,
|
||||
EXALTED = 27,
|
||||
NOFIZZLE = 28,
|
||||
SHADOW = 29,
|
||||
REACHSHADOW = 30,
|
||||
FORESTHOME = 31,
|
||||
ISLANDHOME = 32,
|
||||
MOUNTAINHOME = 33,
|
||||
SWAMPHOME = 34,
|
||||
PLAINSHOME = 35,
|
||||
CLOUD = 36,
|
||||
CANTATTACK = 37,
|
||||
MUSTATTACK = 38,
|
||||
CANTBLOCK = 39,
|
||||
DOESNOTUNTAP = 40,
|
||||
OPPONENTSHROUD = 41,
|
||||
INDESTRUCTIBLE = 42,
|
||||
INTIMIDATE = 43,
|
||||
DEATHTOUCH = 44,
|
||||
HORSEMANSHIP = 45,
|
||||
CANTREGEN = 46,
|
||||
ONEBLOCKER = 47,
|
||||
INFECT = 48,
|
||||
POISONTOXIC = 49,
|
||||
POISONTWOTOXIC = 50,
|
||||
POISONTHREETOXIC = 51,
|
||||
PHANTOM = 52,
|
||||
WILTING = 53,
|
||||
VIGOR = 54,
|
||||
CHANGELING = 55,
|
||||
ABSORB = 56,//this need to be coded for players too "If a source would deal damage"
|
||||
TREASON = 57,
|
||||
UNEARTH = 58,
|
||||
CANTLOSE = 59,
|
||||
CANTLIFELOSE = 60,
|
||||
CANTMILLLOSE = 61,
|
||||
CANTCASTCREATURE = 62,
|
||||
CANTCAST = 63,
|
||||
CANTCASTTWO = 64,
|
||||
STORM = 65,
|
||||
BOTHCANTCAST = 66,
|
||||
BOTHNOCREATURE = 67,
|
||||
ONLYONEBOTH = 68,
|
||||
AFFINITYARTIFACTS = 69,
|
||||
AFFINITYPLAINS = 70,
|
||||
AFFINITYFOREST = 71,
|
||||
AFFINITYISLAND = 72,
|
||||
AFFINITYMOUNTAIN = 73,
|
||||
AFFINITYSWAMP = 74,
|
||||
AFFINITYGREENCREATURES = 75,
|
||||
CANTWIN = 76,
|
||||
NOMAXHAND = 77,
|
||||
LEYLINE = 78,
|
||||
PLAYERSHROUD = 79,
|
||||
CONTROLLERSHROUD = 80,
|
||||
SUNBURST = 81,
|
||||
FLANKING = 82,
|
||||
EXILEDEATH = 83,
|
||||
ECON_NORMAL = 0, //Options default to 0.
|
||||
ECON_HARD = 1,
|
||||
ECON_LUCK = 2,
|
||||
ECON_EASY = 3,
|
||||
|
||||
NB_BASIC_ABILITIES = 84,
|
||||
//Price for singles
|
||||
PRICE_1M = 3000,
|
||||
PRICE_1R = 500,
|
||||
PRICE_1S = 200,
|
||||
PRICE_1U = 100,
|
||||
PRICE_1C = 20,
|
||||
PRICE_1L = 5,
|
||||
|
||||
//Price in booster
|
||||
PRICE_BOOSTER = 700,
|
||||
PRICE_MIXED_BOOSTER = 800,
|
||||
CHANCE_CUSTOM_PACK = 15,
|
||||
CHANCE_PURE_OVERRIDE = 50,
|
||||
CHANCE_MIXED_OVERRIDE = 25,
|
||||
|
||||
RARITY_S = 'S', //Special Rarity
|
||||
RARITY_M = 'M', //Mythics
|
||||
RARITY_R = 'R', //Rares
|
||||
RARITY_U = 'U', //Uncommons
|
||||
RARITY_C = 'C', //Commons
|
||||
RARITY_L = 'L', //Lands
|
||||
RARITY_T = 'T', //Tokens
|
||||
GRADE_SUPPORTED = 0,
|
||||
GRADE_BORDERLINE = 1,
|
||||
GRADE_UNOFFICIAL = 2,
|
||||
GRADE_CRAPPY = 3,
|
||||
GRADE_UNSUPPORTED = 4,
|
||||
GRADE_DANGEROUS = 5,
|
||||
|
||||
ECON_NORMAL = 0, //Options default to 0.
|
||||
ECON_HARD = 1,
|
||||
ECON_LUCK = 2,
|
||||
ECON_EASY = 3,
|
||||
ASKIP_NONE = 0,
|
||||
ASKIP_SAFE = 1,
|
||||
ASKIP_FULL = 2,
|
||||
};
|
||||
|
||||
//Price for singles
|
||||
PRICE_1M = 3000,
|
||||
PRICE_1R = 500,
|
||||
PRICE_1S = 200,
|
||||
PRICE_1U = 100,
|
||||
PRICE_1C = 20,
|
||||
PRICE_1L = 5,
|
||||
static char MTGColorChars[];
|
||||
static const char* MTGColorStrings[];
|
||||
static int _r[], _g[], _b[];
|
||||
|
||||
//Price in booster
|
||||
PRICE_BOOSTER = 700,
|
||||
PRICE_MIXED_BOOSTER = 800,
|
||||
CHANCE_CUSTOM_PACK = 15,
|
||||
CHANCE_PURE_OVERRIDE = 50,
|
||||
CHANCE_MIXED_OVERRIDE = 25,
|
||||
static map<string, int> MTGBasicAbilitiesMap;
|
||||
static const char* MTGBasicAbilities[];
|
||||
static const char* MTGPhaseNames[];
|
||||
static const char* MTGPhaseCodeNames[];
|
||||
|
||||
GRADE_SUPPORTED = 0,
|
||||
GRADE_BORDERLINE = 1,
|
||||
GRADE_UNOFFICIAL = 2,
|
||||
GRADE_CRAPPY = 3,
|
||||
GRADE_UNSUPPORTED = 4,
|
||||
GRADE_DANGEROUS = 5,
|
||||
static int GetBasicAbilityIndex(string mtgAbility);
|
||||
static int GetColorStringIndex(string mtgColor);
|
||||
|
||||
ASKIP_NONE=0,
|
||||
ASKIP_SAFE=1,
|
||||
ASKIP_FULL=2,
|
||||
};
|
||||
|
||||
static char MTGColorChars[];
|
||||
static const char* MTGColorStrings[];
|
||||
static int _r[], _g[], _b[];
|
||||
|
||||
static map<string,int> MTGBasicAbilitiesMap;
|
||||
static const char* MTGBasicAbilities[];
|
||||
static const char* MTGPhaseNames[];
|
||||
static const char* MTGPhaseCodeNames[];
|
||||
|
||||
static int GetBasicAbilityIndex(string mtgAbility);
|
||||
static int GetColorStringIndex(string mtgColor);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,19 +7,18 @@
|
||||
#include <JGui.h>
|
||||
#include "WFont.h"
|
||||
|
||||
|
||||
class MTGGamePhase: public ActionElement {
|
||||
protected:
|
||||
float animation;
|
||||
int currentState;
|
||||
WFont * mFont;
|
||||
public:
|
||||
MTGGamePhase(int id);
|
||||
virtual void Update(float dt);
|
||||
bool CheckUserInput(JButton key);
|
||||
virtual MTGGamePhase * clone() const;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
class MTGGamePhase: public ActionElement
|
||||
{
|
||||
protected:
|
||||
float animation;
|
||||
int currentState;
|
||||
WFont * mFont;
|
||||
public:
|
||||
MTGGamePhase(int id);
|
||||
virtual void Update(float dt);
|
||||
bool CheckUserInput(JButton key);
|
||||
virtual MTGGamePhase * clone() const;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,161 +14,191 @@ class MTGDeck;
|
||||
class MTGCardInstance;
|
||||
class Player;
|
||||
|
||||
class MTGGameZone {
|
||||
protected:
|
||||
class MTGGameZone
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
enum{
|
||||
ALL_ZONES = -1,
|
||||
enum
|
||||
{
|
||||
ALL_ZONES = -1,
|
||||
|
||||
MY_GRAVEYARD = 11,
|
||||
OPPONENT_GRAVEYARD = 12,
|
||||
TARGET_OWNER_GRAVEYARD = 13,
|
||||
TARGET_CONTROLLER_GRAVEYARD = 14,
|
||||
GRAVEYARD = 15,
|
||||
OWNER_GRAVEYARD = 16,
|
||||
MY_GRAVEYARD = 11,
|
||||
OPPONENT_GRAVEYARD = 12,
|
||||
TARGET_OWNER_GRAVEYARD = 13,
|
||||
TARGET_CONTROLLER_GRAVEYARD = 14,
|
||||
GRAVEYARD = 15,
|
||||
OWNER_GRAVEYARD = 16,
|
||||
|
||||
MY_BATTLEFIELD = 21,
|
||||
OPPONENT_BATTLEFIELD = 22,
|
||||
TARGET_OWNER_BATTLEFIELD = 23,
|
||||
TARGET_CONTROLLER_BATTLEFIELD = 24,
|
||||
BATTLEFIELD = 25,
|
||||
OWNER_BATTLEFIELD = 26,
|
||||
MY_BATTLEFIELD = 21,
|
||||
OPPONENT_BATTLEFIELD = 22,
|
||||
TARGET_OWNER_BATTLEFIELD = 23,
|
||||
TARGET_CONTROLLER_BATTLEFIELD = 24,
|
||||
BATTLEFIELD = 25,
|
||||
OWNER_BATTLEFIELD = 26,
|
||||
|
||||
MY_HAND = 31,
|
||||
OPPONENT_HAND = 32,
|
||||
TARGET_OWNER_HAND = 33,
|
||||
TARGET_CONTROLLER_HAND = 34,
|
||||
HAND = 35,
|
||||
OWNER_HAND = 36,
|
||||
MY_HAND = 31,
|
||||
OPPONENT_HAND = 32,
|
||||
TARGET_OWNER_HAND = 33,
|
||||
TARGET_CONTROLLER_HAND = 34,
|
||||
HAND = 35,
|
||||
OWNER_HAND = 36,
|
||||
|
||||
MY_EXILE = 41,
|
||||
OPPONENT_EXILE = 42,
|
||||
TARGET_OWNER_EXILE = 43,
|
||||
TARGET_CONTROLLER_EXILE = 44,
|
||||
EXILE = 45,
|
||||
OWNER_EXILE = 46,
|
||||
MY_EXILE = 41,
|
||||
OPPONENT_EXILE = 42,
|
||||
TARGET_OWNER_EXILE = 43,
|
||||
TARGET_CONTROLLER_EXILE = 44,
|
||||
EXILE = 45,
|
||||
OWNER_EXILE = 46,
|
||||
|
||||
MY_LIBRARY = 51,
|
||||
OPPONENT_LIBRARY = 52,
|
||||
TARGET_OWNER_LIBRARY = 53,
|
||||
TARGET_CONTROLLER_LIBRARY = 54,
|
||||
LIBRARY = 55,
|
||||
OWNER_LIBRARY = 56,
|
||||
MY_LIBRARY = 51,
|
||||
OPPONENT_LIBRARY = 52,
|
||||
TARGET_OWNER_LIBRARY = 53,
|
||||
TARGET_CONTROLLER_LIBRARY = 54,
|
||||
LIBRARY = 55,
|
||||
OWNER_LIBRARY = 56,
|
||||
|
||||
MY_STACK = 61,
|
||||
OPPONENT_STACK = 62,
|
||||
TARGET_OWNER_STACK = 63,
|
||||
TARGET_CONTROLLER_STACK = 64,
|
||||
STACK = 65,
|
||||
OWNER_STACK = 66,
|
||||
MY_STACK = 61,
|
||||
OPPONENT_STACK = 62,
|
||||
TARGET_OWNER_STACK = 63,
|
||||
TARGET_CONTROLLER_STACK = 64,
|
||||
STACK = 65,
|
||||
OWNER_STACK = 66,
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
Player * owner;
|
||||
//Both cards and cardsMap contain the cards of a zone. The long term objective is to get rid of the array
|
||||
vector<MTGCardInstance *> cards; //[MTG_MAX_PLAYER_CARDS];
|
||||
map<MTGCardInstance *,int> cardsMap;
|
||||
int nb_cards;
|
||||
MTGGameZone();
|
||||
~MTGGameZone();
|
||||
void shuffle();
|
||||
void addCard(MTGCardInstance * card);
|
||||
void debugPrint();
|
||||
MTGCardInstance * removeCard(MTGCardInstance * card, int createCopy = 1);
|
||||
MTGCardInstance * hasCard(MTGCardInstance * card);
|
||||
void cleanupPhase();
|
||||
int countByType(const char * value);
|
||||
MTGCardInstance * findByName(string name);
|
||||
int hasAbility(int ability); //returns 1 if one of the cards in the zone has the ability, 0 otherwise
|
||||
int hasType(const char * value); //returns 1 if one of the cards in the zone has the type, 0 otherwise
|
||||
int hasColor(int value); //returns 1 if one of the cards in the zone has the color, 0 otherwise
|
||||
int hasX();
|
||||
void setOwner(Player * player);
|
||||
MTGCardInstance * lastCardDrawn;
|
||||
static MTGGameZone * stringToZone(string zoneName, MTGCardInstance * source, MTGCardInstance * target);
|
||||
static int zoneStringToId(string zoneName);
|
||||
static MTGGameZone *intToZone(int zoneId, MTGCardInstance * source = NULL,MTGCardInstance * target = NULL);
|
||||
bool needShuffle;
|
||||
virtual const char * getName(){return "zone";};
|
||||
virtual ostream& toString(ostream&) const;
|
||||
Player * owner;
|
||||
//Both cards and cardsMap contain the cards of a zone. The long term objective is to get rid of the array
|
||||
vector<MTGCardInstance *> cards; //[MTG_MAX_PLAYER_CARDS];
|
||||
map<MTGCardInstance *, int> cardsMap;
|
||||
int nb_cards;
|
||||
MTGGameZone();
|
||||
~MTGGameZone();
|
||||
void shuffle();
|
||||
void addCard(MTGCardInstance * card);
|
||||
void debugPrint();
|
||||
MTGCardInstance * removeCard(MTGCardInstance * card, int createCopy = 1);
|
||||
MTGCardInstance * hasCard(MTGCardInstance * card);
|
||||
void cleanupPhase();
|
||||
int countByType(const char * value);
|
||||
MTGCardInstance * findByName(string name);
|
||||
int hasAbility(int ability); //returns 1 if one of the cards in the zone has the ability, 0 otherwise
|
||||
int hasType(const char * value); //returns 1 if one of the cards in the zone has the type, 0 otherwise
|
||||
int hasColor(int value); //returns 1 if one of the cards in the zone has the color, 0 otherwise
|
||||
int hasX();
|
||||
void setOwner(Player * player);
|
||||
MTGCardInstance * lastCardDrawn;
|
||||
static MTGGameZone * stringToZone(string zoneName, MTGCardInstance * source, MTGCardInstance * target);
|
||||
static int zoneStringToId(string zoneName);
|
||||
static MTGGameZone *intToZone(int zoneId, MTGCardInstance * source = NULL, MTGCardInstance * target = NULL);
|
||||
bool needShuffle;
|
||||
virtual const char * getName()
|
||||
{
|
||||
return "zone";
|
||||
}
|
||||
;
|
||||
virtual ostream& toString(ostream&) const;
|
||||
};
|
||||
|
||||
class MTGLibrary: public MTGGameZone {
|
||||
public:
|
||||
void shuffleTopToBottom(int nbcards);
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "library";}
|
||||
class MTGLibrary: public MTGGameZone
|
||||
{
|
||||
public:
|
||||
void shuffleTopToBottom(int nbcards);
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName()
|
||||
{
|
||||
return "library";
|
||||
}
|
||||
};
|
||||
|
||||
class MTGGraveyard: public MTGGameZone {
|
||||
public:
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "graveyard";}
|
||||
class MTGGraveyard: public MTGGameZone
|
||||
{
|
||||
public:
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName()
|
||||
{
|
||||
return "graveyard";
|
||||
}
|
||||
};
|
||||
|
||||
class MTGHand: public MTGGameZone {
|
||||
public:
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "hand";}
|
||||
class MTGHand: public MTGGameZone
|
||||
{
|
||||
public:
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName()
|
||||
{
|
||||
return "hand";
|
||||
}
|
||||
};
|
||||
|
||||
class MTGRemovedFromGame: public MTGGameZone {
|
||||
public:
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "exile";}
|
||||
class MTGRemovedFromGame: public MTGGameZone
|
||||
{
|
||||
public:
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName()
|
||||
{
|
||||
return "exile";
|
||||
}
|
||||
};
|
||||
|
||||
class MTGStack: public MTGGameZone {
|
||||
public:
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "stack";}
|
||||
class MTGStack: public MTGGameZone
|
||||
{
|
||||
public:
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName()
|
||||
{
|
||||
return "stack";
|
||||
}
|
||||
};
|
||||
|
||||
class MTGInPlay: public MTGGameZone {
|
||||
public:
|
||||
void untapAll();
|
||||
MTGCardInstance * getNextAttacker(MTGCardInstance * previous);
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "battlefield";}
|
||||
class MTGInPlay: public MTGGameZone
|
||||
{
|
||||
public:
|
||||
void untapAll();
|
||||
MTGCardInstance * getNextAttacker(MTGCardInstance * previous);
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName()
|
||||
{
|
||||
return "battlefield";
|
||||
}
|
||||
};
|
||||
|
||||
class MTGPlayerCards
|
||||
{
|
||||
protected:
|
||||
void init();
|
||||
|
||||
class MTGPlayerCards {
|
||||
protected:
|
||||
void init();
|
||||
public:
|
||||
MTGLibrary * library;
|
||||
MTGGraveyard * graveyard;
|
||||
MTGHand * hand;
|
||||
MTGInPlay * inPlay;
|
||||
MTGInPlay * battlefield; //alias to inPlay
|
||||
|
||||
public:
|
||||
MTGLibrary * library;
|
||||
MTGGraveyard * graveyard;
|
||||
MTGHand * hand;
|
||||
MTGInPlay * inPlay;
|
||||
MTGInPlay * battlefield; //alias to inPlay
|
||||
MTGStack * stack;
|
||||
MTGRemovedFromGame * removedFromGame;
|
||||
MTGRemovedFromGame * exile; //alias to removedFromZone
|
||||
MTGGameZone * garbage;
|
||||
MTGGameZone * temp;
|
||||
|
||||
MTGStack * stack;
|
||||
MTGRemovedFromGame * removedFromGame;
|
||||
MTGRemovedFromGame * exile; //alias to removedFromZone
|
||||
MTGGameZone * garbage;
|
||||
MTGGameZone * temp;
|
||||
|
||||
MTGPlayerCards(int * idList, int idListSize);
|
||||
MTGPlayerCards(MTGDeck * deck);
|
||||
~MTGPlayerCards();
|
||||
void initGame(int shuffle = 1, int draw = 1);
|
||||
void OptimizedHand(Player * who,int amount = 7,int lands = 3,int creatures = 0,int othercards = 4);
|
||||
void setOwner(Player * player);
|
||||
void discardRandom(MTGGameZone * from,MTGCardInstance * source);
|
||||
void drawFromLibrary();
|
||||
void showHand();
|
||||
void resetLibrary();
|
||||
void initDeck(MTGDeck * deck);
|
||||
MTGCardInstance * putInGraveyard(MTGCardInstance * card);
|
||||
MTGCardInstance * putInExile(MTGCardInstance * card);
|
||||
MTGCardInstance * putInLibrary(MTGCardInstance * card);
|
||||
MTGCardInstance * putInHand(MTGCardInstance * card);
|
||||
MTGCardInstance * putInZone(MTGCardInstance * card, MTGGameZone * from, MTGGameZone * to);
|
||||
int isInPlay(MTGCardInstance * card);
|
||||
MTGPlayerCards(int * idList, int idListSize);
|
||||
MTGPlayerCards(MTGDeck * deck);
|
||||
~MTGPlayerCards();
|
||||
void initGame(int shuffle = 1, int draw = 1);
|
||||
void OptimizedHand(Player * who, int amount = 7, int lands = 3, int creatures = 0, int othercards = 4);
|
||||
void setOwner(Player * player);
|
||||
void discardRandom(MTGGameZone * from, MTGCardInstance * source);
|
||||
void drawFromLibrary();
|
||||
void showHand();
|
||||
void resetLibrary();
|
||||
void initDeck(MTGDeck * deck);
|
||||
MTGCardInstance * putInGraveyard(MTGCardInstance * card);
|
||||
MTGCardInstance * putInExile(MTGCardInstance * card);
|
||||
MTGCardInstance * putInLibrary(MTGCardInstance * card);
|
||||
MTGCardInstance * putInHand(MTGCardInstance * card);
|
||||
MTGCardInstance * putInZone(MTGCardInstance * card, MTGGameZone * from, MTGGameZone * to);
|
||||
int isInPlay(MTGCardInstance * card);
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream&, const MTGGameZone&);
|
||||
|
||||
@@ -3,86 +3,138 @@
|
||||
|
||||
class ShopBooster;
|
||||
|
||||
class MTGPackEntry{
|
||||
class MTGPackEntry
|
||||
{
|
||||
public:
|
||||
virtual ~MTGPackEntry() {};
|
||||
virtual int addCard(WSrcCards * pool,MTGDeck * to) = 0;
|
||||
int copies;
|
||||
virtual ~MTGPackEntry()
|
||||
{
|
||||
}
|
||||
;
|
||||
virtual int addCard(WSrcCards * pool, MTGDeck * to) = 0;
|
||||
int copies;
|
||||
};
|
||||
|
||||
class MTGPackEntryRandom: public MTGPackEntry{
|
||||
class MTGPackEntryRandom: public MTGPackEntry
|
||||
{
|
||||
public:
|
||||
MTGPackEntryRandom() {filter = ""; copies=1;};
|
||||
MTGPackEntryRandom(string f, int c=1) {filter = f; copies = c;};
|
||||
int addCard(WSrcCards * pool,MTGDeck * to);
|
||||
string filter;
|
||||
MTGPackEntryRandom()
|
||||
{
|
||||
filter = "";
|
||||
copies = 1;
|
||||
}
|
||||
;
|
||||
MTGPackEntryRandom(string f, int c = 1)
|
||||
{
|
||||
filter = f;
|
||||
copies = c;
|
||||
}
|
||||
;
|
||||
int addCard(WSrcCards * pool, MTGDeck * to);
|
||||
string filter;
|
||||
};
|
||||
class MTGPackEntrySpecific: public MTGPackEntry{
|
||||
class MTGPackEntrySpecific: public MTGPackEntry
|
||||
{
|
||||
public:
|
||||
int addCard(WSrcCards * pool,MTGDeck * to);
|
||||
MTGCard * card;
|
||||
int addCard(WSrcCards * pool, MTGDeck * to);
|
||||
MTGCard * card;
|
||||
};
|
||||
|
||||
class MTGPackEntryNothing: public MTGPackEntry{
|
||||
class MTGPackEntryNothing: public MTGPackEntry
|
||||
{
|
||||
public:
|
||||
int addCard(WSrcCards * pool,MTGDeck * to) {return 0;};
|
||||
int addCard(WSrcCards * pool, MTGDeck * to)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
class MTGPackSlot{
|
||||
class MTGPackSlot
|
||||
{
|
||||
public:
|
||||
~MTGPackSlot();
|
||||
int add(WSrcCards * ocean, MTGDeck * to, int carryover);
|
||||
void addEntry(MTGPackEntry*item);
|
||||
int copies;
|
||||
string pool;
|
||||
vector<MTGPackEntry*> entries;
|
||||
~MTGPackSlot();
|
||||
int add(WSrcCards * ocean, MTGDeck * to, int carryover);
|
||||
void addEntry(MTGPackEntry*item);
|
||||
int copies;
|
||||
string pool;
|
||||
vector<MTGPackEntry*> entries;
|
||||
};
|
||||
|
||||
class MTGPack{
|
||||
class MTGPack
|
||||
{
|
||||
public:
|
||||
friend class MTGPacks;
|
||||
friend class ShopBooster;
|
||||
friend class MTGSetInfo;
|
||||
bool meetsRequirements(); //Check if pool contains locked cards.
|
||||
bool isUnlocked();
|
||||
bool isValid() {return bValid;};
|
||||
void load(string filename);
|
||||
int assemblePack(MTGDeck * to);
|
||||
|
||||
MTGPack() {bValid = false; unlockStatus = 0; price=Constants::PRICE_BOOSTER;};
|
||||
MTGPack(string s) {bValid = false; load(s); unlockStatus = 0;};
|
||||
~MTGPack();
|
||||
string getName();
|
||||
string getSort() {return sort;};
|
||||
int getPrice() {return price;};
|
||||
static WSrcCards * getPool(string poolstr);
|
||||
friend class MTGPacks;
|
||||
friend class ShopBooster;
|
||||
friend class MTGSetInfo;
|
||||
bool meetsRequirements(); //Check if pool contains locked cards.
|
||||
bool isUnlocked();
|
||||
bool isValid()
|
||||
{
|
||||
return bValid;
|
||||
}
|
||||
;
|
||||
void load(string filename);
|
||||
int assemblePack(MTGDeck * to);
|
||||
|
||||
MTGPack()
|
||||
{
|
||||
bValid = false;
|
||||
unlockStatus = 0;
|
||||
price = Constants::PRICE_BOOSTER;
|
||||
}
|
||||
;
|
||||
MTGPack(string s)
|
||||
{
|
||||
bValid = false;
|
||||
load(s);
|
||||
unlockStatus = 0;
|
||||
}
|
||||
;
|
||||
~MTGPack();
|
||||
string getName();
|
||||
string getSort()
|
||||
{
|
||||
return sort;
|
||||
}
|
||||
;
|
||||
int getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
;
|
||||
static WSrcCards * getPool(string poolstr);
|
||||
protected:
|
||||
void countCards();
|
||||
string name; //Name of the pack.
|
||||
string type; //"Booster", "Deck", "Whatever"
|
||||
string pool; //The starting pool.
|
||||
string sort; //The sorting method.
|
||||
string check; //Unlock requirements.
|
||||
string desc; //Big card description.
|
||||
bool bValid;
|
||||
int unlockStatus;
|
||||
void countCards();
|
||||
string name; //Name of the pack.
|
||||
string type; //"Booster", "Deck", "Whatever"
|
||||
string pool; //The starting pool.
|
||||
string sort; //The sorting method.
|
||||
string check; //Unlock requirements.
|
||||
string desc; //Big card description.
|
||||
bool bValid;
|
||||
int unlockStatus;
|
||||
|
||||
int price; //Base price.
|
||||
int minCards, maxCards;
|
||||
vector<MTGPackSlot*> slotss;
|
||||
int price; //Base price.
|
||||
int minCards, maxCards;
|
||||
vector<MTGPackSlot*> slotss;
|
||||
};
|
||||
|
||||
class MTGPacks{
|
||||
class MTGPacks
|
||||
{
|
||||
public:
|
||||
~MTGPacks();
|
||||
MTGPack * randomPack(int key=0);
|
||||
void loadAll();
|
||||
int size() {return (int)packs.size();};
|
||||
void refreshUnlocked();
|
||||
|
||||
static MTGPack * getDefault();
|
||||
~MTGPacks();
|
||||
MTGPack * randomPack(int key = 0);
|
||||
void loadAll();
|
||||
int size()
|
||||
{
|
||||
return (int) packs.size();
|
||||
}
|
||||
;
|
||||
void refreshUnlocked();
|
||||
|
||||
static MTGPack * getDefault();
|
||||
private:
|
||||
static MTGPack defaultBooster;
|
||||
vector<MTGPack*> packs;
|
||||
static MTGPack defaultBooster;
|
||||
vector<MTGPack*> packs;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -39,10 +39,10 @@ class MTGAlternativeCostRule: public MTGAbility
|
||||
public:
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
|
||||
int isReactingToClick(MTGCardInstance * card, ManaCost * mana, ManaCost *alternateManaCost);
|
||||
|
||||
|
||||
int reactToClick(MTGCardInstance * card, ManaCost * alternateManaCost, int paymentType = ManaCost::MANA_PAID);
|
||||
int reactToClick(MTGCardInstance * card);
|
||||
|
||||
|
||||
int testDestroy();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
MTGAlternativeCostRule(int _id);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "utils.h"
|
||||
#include "MTGDefinitions.h"
|
||||
|
||||
|
||||
class ManaCostHybrid;
|
||||
class ExtraCosts;
|
||||
class ExtraCost;
|
||||
@@ -12,87 +11,90 @@ class MTGAbility;
|
||||
class MTGCardInstance;
|
||||
class Player;
|
||||
|
||||
class ManaCost{
|
||||
protected:
|
||||
int cost[Constants::MTG_NB_COLORS+1];
|
||||
ManaCostHybrid * hybrids[10];
|
||||
unsigned int nbhybrids;
|
||||
int extraCostsIsCopy;
|
||||
|
||||
public:
|
||||
enum{
|
||||
MANA_UNPAID = 0,
|
||||
MANA_PAID = 1,
|
||||
MANA_PAID_WITH_KICKER = 2,
|
||||
MANA_PAID_WITH_ALTERNATIVE = 3,
|
||||
MANA_PAID_WITH_BUYBACK = 4,
|
||||
MANA_PAID_WITH_FLASHBACK = 5,
|
||||
MANA_PAID_WITH_RETRACE = 6
|
||||
class ManaCost
|
||||
{
|
||||
protected:
|
||||
int cost[Constants::MTG_NB_COLORS + 1];
|
||||
ManaCostHybrid * hybrids[10];
|
||||
unsigned int nbhybrids;
|
||||
int extraCostsIsCopy;
|
||||
|
||||
};
|
||||
ExtraCosts * extraCosts;
|
||||
ManaCost * kicker;
|
||||
ManaCost * alternative;
|
||||
ManaCost * BuyBack;
|
||||
ManaCost * FlashBack;
|
||||
ManaCost * Retrace;
|
||||
static ManaCost * parseManaCost(string value, ManaCost * _manacost = NULL, MTGCardInstance * c = NULL);
|
||||
virtual void init();
|
||||
void x();
|
||||
int hasX();
|
||||
ManaCost(int _cost[], int nb_elems = 1);
|
||||
ManaCost();
|
||||
~ManaCost();
|
||||
ManaCost(ManaCost * _manaCost);
|
||||
void copy (ManaCost * _manaCost);
|
||||
int isNull();
|
||||
int getConvertedCost();
|
||||
string toString();
|
||||
int getCost(int color);
|
||||
//Returns NULL if i is greater than nbhybrids
|
||||
ManaCostHybrid * getHybridCost(unsigned int i);
|
||||
int hasColor(int color);
|
||||
int remove (int color, int value);
|
||||
int add(int color, int value);
|
||||
public:
|
||||
enum
|
||||
{
|
||||
MANA_UNPAID = 0,
|
||||
MANA_PAID = 1,
|
||||
MANA_PAID_WITH_KICKER = 2,
|
||||
MANA_PAID_WITH_ALTERNATIVE = 3,
|
||||
MANA_PAID_WITH_BUYBACK = 4,
|
||||
MANA_PAID_WITH_FLASHBACK = 5,
|
||||
MANA_PAID_WITH_RETRACE = 6
|
||||
|
||||
//
|
||||
// Extra Costs (sacrifice,counters...)
|
||||
//
|
||||
int addExtraCost(ExtraCost * _cost);
|
||||
int setExtraCostsAction(MTGAbility * action, MTGCardInstance * card);
|
||||
int isExtraPaymentSet();
|
||||
int canPayExtra();
|
||||
int doPayExtra();
|
||||
};
|
||||
ExtraCosts * extraCosts;
|
||||
ManaCost * kicker;
|
||||
ManaCost * alternative;
|
||||
ManaCost * BuyBack;
|
||||
ManaCost * FlashBack;
|
||||
ManaCost * Retrace;
|
||||
static ManaCost * parseManaCost(string value, ManaCost * _manacost = NULL, MTGCardInstance * c = NULL);
|
||||
virtual void init();
|
||||
void x();
|
||||
int hasX();
|
||||
ManaCost(int _cost[], int nb_elems = 1);
|
||||
ManaCost();
|
||||
~ManaCost();
|
||||
ManaCost(ManaCost * _manaCost);
|
||||
void copy(ManaCost * _manaCost);
|
||||
int isNull();
|
||||
int getConvertedCost();
|
||||
string toString();
|
||||
int getCost(int color);
|
||||
//Returns NULL if i is greater than nbhybrids
|
||||
ManaCostHybrid * getHybridCost(unsigned int i);
|
||||
int hasColor(int color);
|
||||
int remove(int color, int value);
|
||||
int add(int color, int value);
|
||||
|
||||
int addHybrid(int c1, int v1, int c2, int v2);
|
||||
int tryToPayHybrids(ManaCostHybrid * _hybrids[], int _nbhybrids, int diff[]);
|
||||
void randomDiffHybrids(ManaCost * _cost, int diff[]);
|
||||
int add(ManaCost * _cost);
|
||||
int pay (ManaCost * _cost);
|
||||
//
|
||||
// Extra Costs (sacrifice,counters...)
|
||||
//
|
||||
int addExtraCost(ExtraCost * _cost);
|
||||
int setExtraCostsAction(MTGAbility * action, MTGCardInstance * card);
|
||||
int isExtraPaymentSet();
|
||||
int canPayExtra();
|
||||
int doPayExtra();
|
||||
|
||||
//return 1 if _cost can be paid with current data, 0 otherwise
|
||||
int canAfford(ManaCost * _cost);
|
||||
int addHybrid(int c1, int v1, int c2, int v2);
|
||||
int tryToPayHybrids(ManaCostHybrid * _hybrids[], int _nbhybrids, int diff[]);
|
||||
void randomDiffHybrids(ManaCost * _cost, int diff[]);
|
||||
int add(ManaCost * _cost);
|
||||
int pay(ManaCost * _cost);
|
||||
|
||||
int isPositive();
|
||||
ManaCost * Diff(ManaCost * _cost);
|
||||
//return 1 if _cost can be paid with current data, 0 otherwise
|
||||
int canAfford(ManaCost * _cost);
|
||||
|
||||
int isPositive();
|
||||
ManaCost * Diff(ManaCost * _cost);
|
||||
#ifdef WIN32
|
||||
void Dump();
|
||||
void Dump();
|
||||
#endif
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const ManaCost& m);
|
||||
|
||||
class ManaPool:public ManaCost{
|
||||
class ManaPool: public ManaCost
|
||||
{
|
||||
protected:
|
||||
Player * player;
|
||||
Player * player;
|
||||
public:
|
||||
void init();
|
||||
ManaPool(Player * player);
|
||||
ManaPool(ManaCost * _manaCost, Player * player);
|
||||
int remove (int color, int value);
|
||||
int add(int color, int value, MTGCardInstance * source = NULL);
|
||||
int add(ManaCost * _cost, MTGCardInstance * source = NULL);
|
||||
int pay (ManaCost * _cost);
|
||||
void init();
|
||||
ManaPool(Player * player);
|
||||
ManaPool(ManaCost * _manaCost, Player * player);
|
||||
int remove(int color, int value);
|
||||
int add(int color, int value, MTGCardInstance * source = NULL);
|
||||
int add(ManaCost * _cost, MTGCardInstance * source = NULL);
|
||||
int pay(ManaCost * _cost);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
#ifndef _MANACOST_HYBRID_H_
|
||||
#define _MANACOST_HYBRID_H_
|
||||
|
||||
class ManaCostHybrid{
|
||||
public:
|
||||
int color1;
|
||||
int color2;
|
||||
int value1;
|
||||
int value2;
|
||||
ManaCostHybrid();
|
||||
int hasColor(int color);
|
||||
ManaCostHybrid(int c1,int v1,int c2,int v2);
|
||||
void init(int c1,int v1,int c2,int v2);
|
||||
int getConvertedCost();
|
||||
class ManaCostHybrid
|
||||
{
|
||||
public:
|
||||
int color1;
|
||||
int color2;
|
||||
int value1;
|
||||
int value2;
|
||||
ManaCostHybrid();
|
||||
int hasColor(int color);
|
||||
ManaCostHybrid(int c1, int v1, int c2, int v2);
|
||||
void init(int c1, int v1, int c2, int v2);
|
||||
int getConvertedCost();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,34 +14,39 @@ class hgeParticleSystem;
|
||||
|
||||
class MenuItem: public JGuiObject
|
||||
{
|
||||
private:
|
||||
bool mHasFocus;
|
||||
WFont *mFont;
|
||||
string mText;
|
||||
float mX;
|
||||
float mY;
|
||||
int updatedSinceLastRender;
|
||||
float lastDt;
|
||||
private:
|
||||
bool mHasFocus;
|
||||
WFont *mFont;
|
||||
string mText;
|
||||
float mX;
|
||||
float mY;
|
||||
int updatedSinceLastRender;
|
||||
float lastDt;
|
||||
|
||||
float mScale;
|
||||
float mTargetScale;
|
||||
JQuad * onQuad;
|
||||
JQuad * offQuad;
|
||||
hgeParticleSystem* mParticleSys;
|
||||
float mScale;
|
||||
float mTargetScale;
|
||||
JQuad * onQuad;
|
||||
JQuad * offQuad;
|
||||
hgeParticleSystem* mParticleSys;
|
||||
|
||||
public:
|
||||
MenuItem(int id, WFont *font, string text, float x, float y, JQuad * _off, JQuad * _on, const char * particle, JQuad * particleQuad, bool hasFocus = false);
|
||||
~MenuItem();
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
|
||||
public:
|
||||
MenuItem(int id, WFont *font, string text, float x, float y, JQuad * _off, JQuad * _on, const char * particle, JQuad * particleQuad, bool hasFocus = false);
|
||||
~MenuItem();
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
virtual void Entering();
|
||||
virtual bool Leaving(JButton key);
|
||||
virtual bool ButtonPressed();
|
||||
virtual bool getTopLeft(float& top, float& left)
|
||||
{
|
||||
top = mY;
|
||||
left = mX;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
|
||||
virtual void Entering();
|
||||
virtual bool Leaving(JButton key);
|
||||
virtual bool ButtonPressed();
|
||||
virtual bool getTopLeft(float& top, float& left) {top = mY; left = mX; return true;};
|
||||
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,52 +9,51 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
// private class only used by Navigator, see implementation file
|
||||
class CardZone;
|
||||
|
||||
class Navigator : public CardSelectorBase
|
||||
|
||||
class Navigator: public CardSelectorBase
|
||||
{
|
||||
public:
|
||||
|
||||
Navigator(DuelLayers* inDuelLayers);
|
||||
virtual ~Navigator();
|
||||
Navigator(DuelLayers* inDuelLayers);
|
||||
virtual ~Navigator();
|
||||
|
||||
// Inherited functions from GuiLayer
|
||||
bool CheckUserInput(JButton inKey);
|
||||
bool CheckUserInput(int x, int y);
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
// Inherited functions from GuiLayer
|
||||
bool CheckUserInput(JButton inKey);
|
||||
bool CheckUserInput(int x, int y);
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
|
||||
//Limitor operations
|
||||
void PushLimitor();
|
||||
void PopLimitor();
|
||||
void Limit(LimitorFunctor<PlayGuiObject>* inLimitor, CardView::SelectorZone inZone);
|
||||
//Limitor operations
|
||||
void PushLimitor();
|
||||
void PopLimitor();
|
||||
void Limit(LimitorFunctor<PlayGuiObject>* inLimitor, CardView::SelectorZone inZone);
|
||||
|
||||
virtual void Add(PlayGuiObject*);
|
||||
virtual void Remove(PlayGuiObject*);
|
||||
virtual void Push() {}
|
||||
virtual void Pop() {}
|
||||
virtual void Add(PlayGuiObject*);
|
||||
virtual void Remove(PlayGuiObject*);
|
||||
virtual void Push() {}
|
||||
virtual void Pop() {}
|
||||
|
||||
protected:
|
||||
PlayGuiObject* GetCurrentCard();
|
||||
PlayGuiObject* GetCurrentCard();
|
||||
|
||||
/**
|
||||
** Helper function that translates a card type into an internal zone ID (used as the index for the card zone map)
|
||||
*/
|
||||
int CardToCardZone(PlayGuiObject* card);
|
||||
/**
|
||||
** Helper function that translates a card type into an internal zone ID (used as the index for the card zone map)
|
||||
*/
|
||||
int CardToCardZone(PlayGuiObject* card);
|
||||
|
||||
void HandleKeyStroke(JButton inKey);
|
||||
void HandleKeyStroke(JButton inKey);
|
||||
|
||||
private:
|
||||
std::map<int, CardZone*> mCardZones;
|
||||
CardZone* mCurrentZone;
|
||||
Pos mDrawPosition;
|
||||
std::map<int, CardZone*> mCardZones;
|
||||
CardZone* mCurrentZone;
|
||||
Pos mDrawPosition;
|
||||
|
||||
DuelLayers* mDuelLayers;
|
||||
DuelLayers* mDuelLayers;
|
||||
|
||||
bool mLimitorEnabled;
|
||||
std::stack<CardZone*> mCurrentZoneStack;
|
||||
bool mLimitorEnabled;
|
||||
std::stack<CardZone*> mCurrentZoneStack;
|
||||
};
|
||||
|
||||
#endif //NAVIGATOR_H
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef _OSD_H_
|
||||
#define _OSD_H_
|
||||
|
||||
class OSDLayer : public PlayGuiObjectController
|
||||
class OSDLayer: public PlayGuiObjectController
|
||||
{
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,144 +20,206 @@ using std::string;
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
class OptionItem: public WGuiItem{
|
||||
class OptionItem: public WGuiItem
|
||||
{
|
||||
public:
|
||||
OptionItem( int _id, string _displayValue);
|
||||
virtual ~OptionItem() {};
|
||||
OptionItem(int _id, string _displayValue);
|
||||
virtual ~OptionItem() {};
|
||||
|
||||
//Accessors
|
||||
virtual int getId() {return id;};
|
||||
virtual void setId(int _id){id = _id;};
|
||||
//Accessors
|
||||
virtual int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
virtual void setId(int _id)
|
||||
{
|
||||
id = _id;
|
||||
}
|
||||
|
||||
protected:
|
||||
int id;
|
||||
int id;
|
||||
};
|
||||
|
||||
class OptionInteger:public OptionItem{
|
||||
public:
|
||||
int value; //Current value.
|
||||
int defValue; //Default value.
|
||||
string strDefault; //What to call the default value.
|
||||
int maxValue, increment, minValue;
|
||||
class OptionInteger: public OptionItem
|
||||
{
|
||||
public:
|
||||
int value; //Current value.
|
||||
int defValue; //Default value.
|
||||
string strDefault; //What to call the default value.
|
||||
int maxValue, increment, minValue;
|
||||
|
||||
OptionInteger(int _id, string _displayValue, int _maxValue = 1, int _increment = 1, int _defV = 0, string _sDef = "", int _minValue = 0);
|
||||
OptionInteger(int _id, string _displayValue, int _maxValue = 1, int _increment = 1, int _defV = 0, string _sDef = "", int _minValue = 0);
|
||||
|
||||
virtual void Reload()
|
||||
{
|
||||
if (id != INVALID_OPTION)
|
||||
value = options[id].number;
|
||||
}
|
||||
|
||||
virtual bool Changed()
|
||||
{
|
||||
return value != options[id].number;
|
||||
}
|
||||
|
||||
virtual void Render();
|
||||
virtual void setData();
|
||||
virtual void updateValue()
|
||||
{
|
||||
value += increment;
|
||||
if (value > maxValue)
|
||||
value = minValue;
|
||||
}
|
||||
|
||||
virtual void Reload() {if(id != INVALID_OPTION) value = options[id].number;};
|
||||
virtual bool Changed() {return value != options[id].number;};
|
||||
virtual void Render();
|
||||
virtual void setData();
|
||||
virtual void updateValue(){value+=increment; if (value>maxValue) value=minValue;};
|
||||
};
|
||||
|
||||
class OptionSelect:public OptionItem{
|
||||
public:
|
||||
size_t value;
|
||||
vector<string> selections;
|
||||
class OptionSelect: public OptionItem
|
||||
{
|
||||
public:
|
||||
size_t value;
|
||||
vector<string> selections;
|
||||
|
||||
virtual void addSelection(string s);
|
||||
OptionSelect(int _id, string _displayValue): OptionItem(_id, _displayValue) {value = 0;};
|
||||
virtual void Reload(){initSelections();};
|
||||
virtual void Render();
|
||||
virtual bool Selectable();
|
||||
virtual void Entering(JButton key);
|
||||
virtual bool Changed() {return (value != prior_value);};
|
||||
virtual void setData();
|
||||
virtual void initSelections();
|
||||
virtual void updateValue(){value++; if (value > selections.size() - 1) value=0;};
|
||||
protected:
|
||||
size_t prior_value;
|
||||
};
|
||||
virtual void addSelection(string s);
|
||||
OptionSelect(int _id, string _displayValue) :
|
||||
OptionItem(_id, _displayValue)
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
;
|
||||
virtual void Reload()
|
||||
{
|
||||
initSelections();
|
||||
}
|
||||
;
|
||||
virtual void Render();
|
||||
virtual bool Selectable();
|
||||
virtual void Entering(JButton key);
|
||||
virtual bool Changed()
|
||||
{
|
||||
return (value != prior_value);
|
||||
}
|
||||
|
||||
class OptionLanguage: public OptionSelect{
|
||||
public:
|
||||
OptionLanguage(string _displayValue);
|
||||
|
||||
virtual void addSelection(string s) {addSelection(s,s);};
|
||||
virtual void addSelection(string s,string show);
|
||||
virtual void initSelections();
|
||||
virtual void confirmChange(bool confirmed);
|
||||
virtual void Reload();
|
||||
virtual bool Visible();
|
||||
virtual bool Selectable();
|
||||
virtual void setData();
|
||||
virtual void setData();
|
||||
virtual void initSelections();
|
||||
virtual void updateValue()
|
||||
{
|
||||
value++;
|
||||
if (value > selections.size() - 1)
|
||||
value = 0;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
vector<string> actual_data;
|
||||
size_t prior_value;
|
||||
};
|
||||
|
||||
class OptionThemeStyle: public OptionSelect{
|
||||
public:
|
||||
virtual bool Visible();
|
||||
virtual void Reload();
|
||||
virtual void confirmChange(bool confirmed);
|
||||
OptionThemeStyle(string _displayValue);
|
||||
};
|
||||
class OptionDirectory:public OptionSelect{
|
||||
public:
|
||||
virtual void Reload();
|
||||
OptionDirectory(string root, int id, string displayValue, const string type);
|
||||
protected:
|
||||
const string root;
|
||||
const string type;
|
||||
};
|
||||
|
||||
class OptionTheme:public OptionDirectory{
|
||||
private:
|
||||
static const string DIRTESTER;
|
||||
public:
|
||||
OptionTheme(OptionThemeStyle * style = NULL);
|
||||
JQuad * getImage();
|
||||
virtual void updateValue();
|
||||
virtual float getHeight();
|
||||
virtual void Render();
|
||||
virtual void confirmChange(bool confirmed);
|
||||
virtual bool Visible();
|
||||
class OptionLanguage: public OptionSelect
|
||||
{
|
||||
public:
|
||||
OptionLanguage(string _displayValue);
|
||||
|
||||
virtual void addSelection(string s)
|
||||
{
|
||||
addSelection(s, s);
|
||||
}
|
||||
;
|
||||
virtual void addSelection(string s, string show);
|
||||
virtual void initSelections();
|
||||
virtual void confirmChange(bool confirmed);
|
||||
virtual void Reload();
|
||||
virtual bool Visible();
|
||||
virtual bool Selectable();
|
||||
virtual void setData();
|
||||
protected:
|
||||
OptionThemeStyle * ts;
|
||||
string author;
|
||||
bool bChecked;
|
||||
vector<string> actual_data;
|
||||
};
|
||||
|
||||
class OptionProfile:public OptionDirectory{
|
||||
private:
|
||||
static const string DIRTESTER;
|
||||
public:
|
||||
OptionProfile(GameApp * _app, JGuiListener * jgl);
|
||||
virtual void addSelection(string s);
|
||||
virtual bool Selectable() {return canSelect;};
|
||||
virtual bool Changed() {return (initialValue != value);};
|
||||
virtual void Entering(JButton key);
|
||||
virtual void Reload();
|
||||
virtual void Render();
|
||||
virtual void initSelections();
|
||||
virtual void confirmChange(bool confirmed);
|
||||
virtual void updateValue();
|
||||
void populate();
|
||||
class OptionThemeStyle: public OptionSelect
|
||||
{
|
||||
public:
|
||||
virtual bool Visible();
|
||||
virtual void Reload();
|
||||
virtual void confirmChange(bool confirmed);
|
||||
OptionThemeStyle(string _displayValue);
|
||||
};
|
||||
class OptionDirectory: public OptionSelect
|
||||
{
|
||||
public:
|
||||
virtual void Reload();
|
||||
OptionDirectory(string root, int id, string displayValue, const string type);
|
||||
protected:
|
||||
const string root;
|
||||
const string type;
|
||||
};
|
||||
|
||||
class OptionTheme: public OptionDirectory
|
||||
{
|
||||
private:
|
||||
GameApp * app;
|
||||
JGuiListener * listener;
|
||||
bool canSelect;
|
||||
string preview;
|
||||
size_t initialValue;
|
||||
static const string DIRTESTER;
|
||||
public:
|
||||
OptionTheme(OptionThemeStyle * style = NULL);
|
||||
JQuad * getImage();
|
||||
virtual void updateValue();
|
||||
virtual float getHeight();
|
||||
virtual void Render();
|
||||
virtual void confirmChange(bool confirmed);
|
||||
virtual bool Visible();
|
||||
|
||||
protected:
|
||||
OptionThemeStyle * ts;
|
||||
string author;
|
||||
bool bChecked;
|
||||
};
|
||||
|
||||
class OptionKey : public WGuiItem, public KeybGrabber {
|
||||
public:
|
||||
OptionKey(GameStateOptions* g, LocalKeySym, JButton);
|
||||
LocalKeySym from;
|
||||
JButton to;
|
||||
virtual void Render();
|
||||
virtual void Update(float);
|
||||
virtual void Overlay();
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual void KeyPressed(LocalKeySym key);
|
||||
virtual bool isModal();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
virtual bool Visible();
|
||||
virtual bool Selectable();
|
||||
protected:
|
||||
bool grabbed;
|
||||
GameStateOptions* g;
|
||||
SimpleMenu* btnMenu;
|
||||
class OptionProfile: public OptionDirectory
|
||||
{
|
||||
private:
|
||||
static const string DIRTESTER;
|
||||
public:
|
||||
OptionProfile(GameApp * _app, JGuiListener * jgl);
|
||||
virtual void addSelection(string s);
|
||||
virtual bool Selectable()
|
||||
{
|
||||
return canSelect;
|
||||
}
|
||||
;
|
||||
virtual bool Changed()
|
||||
{
|
||||
return (initialValue != value);
|
||||
}
|
||||
;
|
||||
virtual void Entering(JButton key);
|
||||
virtual void Reload();
|
||||
virtual void Render();
|
||||
virtual void initSelections();
|
||||
virtual void confirmChange(bool confirmed);
|
||||
virtual void updateValue();
|
||||
void populate();
|
||||
private:
|
||||
GameApp * app;
|
||||
JGuiListener * listener;
|
||||
bool canSelect;
|
||||
string preview;
|
||||
size_t initialValue;
|
||||
};
|
||||
|
||||
class OptionKey: public WGuiItem, public KeybGrabber
|
||||
{
|
||||
public:
|
||||
OptionKey(GameStateOptions* g, LocalKeySym, JButton);
|
||||
LocalKeySym from;
|
||||
JButton to;
|
||||
virtual void Render();
|
||||
virtual void Update(float);
|
||||
virtual void Overlay();
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual void KeyPressed(LocalKeySym key);
|
||||
virtual bool isModal();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
virtual bool Visible();
|
||||
virtual bool Selectable();
|
||||
protected:
|
||||
bool grabbed;
|
||||
GameStateOptions* g;
|
||||
SimpleMenu* btnMenu;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -6,36 +6,52 @@
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
The class that handles the phases of a turn
|
||||
*/
|
||||
The class that handles the phases of a turn
|
||||
*/
|
||||
|
||||
class Player;
|
||||
|
||||
typedef enum { BLOCKERS, TRIGGERS, ORDER, FIRST_STRIKE, END_FIRST_STRIKE, DAMAGE, END_DAMAGE } CombatStep;
|
||||
class Phase{
|
||||
public:
|
||||
int id;
|
||||
Player * player;
|
||||
Phase(int id, Player *player):id(id),player(player){};
|
||||
typedef enum
|
||||
{
|
||||
BLOCKERS,
|
||||
TRIGGERS,
|
||||
ORDER,
|
||||
FIRST_STRIKE,
|
||||
END_FIRST_STRIKE,
|
||||
DAMAGE,
|
||||
END_DAMAGE
|
||||
} CombatStep;
|
||||
|
||||
class Phase
|
||||
{
|
||||
public:
|
||||
int id;
|
||||
Player * player;
|
||||
Phase(int id, Player *player) :
|
||||
id(id), player(player)
|
||||
{
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
class PhaseRing{
|
||||
class PhaseRing
|
||||
{
|
||||
private:
|
||||
static bool extraDamagePhase(int id);
|
||||
public:
|
||||
list<Phase *> ring;
|
||||
list<Phase *>::iterator current;
|
||||
Phase * getCurrentPhase();
|
||||
Phase * forward(bool sendEvents = true);
|
||||
Phase * goToPhase(int id, Player * player,bool sendEvents = true);
|
||||
PhaseRing(Player* players[], int nbPlayers=2);
|
||||
~PhaseRing();
|
||||
int addPhase(Phase * phase);
|
||||
int addPhaseBefore(int id, Player* player,int after_id, Player * after_player, int allOccurences = 1);
|
||||
int removePhase (int id, Player * player, int allOccurences = 1);
|
||||
static const char * phaseName(int id);
|
||||
static int phaseStrToInt(string s);
|
||||
|
||||
static bool extraDamagePhase(int id);
|
||||
public:
|
||||
list<Phase *> ring;
|
||||
list<Phase *>::iterator current;
|
||||
Phase * getCurrentPhase();
|
||||
Phase * forward(bool sendEvents = true);
|
||||
Phase * goToPhase(int id, Player * player, bool sendEvents = true);
|
||||
PhaseRing(Player* players[], int nbPlayers = 2);
|
||||
~PhaseRing();
|
||||
int addPhase(Phase * phase);
|
||||
int addPhaseBefore(int id, Player* player, int after_id, Player * after_player, int allOccurences = 1);
|
||||
int removePhase(int id, Player * player, int allOccurences = 1);
|
||||
static const char * phaseName(int id);
|
||||
static int phaseStrToInt(string s);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
A class for all interactive objects in the play area (cards, avatars, etc...)
|
||||
*/
|
||||
A class for all interactive objects in the play area (cards, avatars, etc...)
|
||||
*/
|
||||
|
||||
#ifndef _PLAYGUIOBJECT_H_
|
||||
#define _PLAYGUIOBJECT_H_
|
||||
@@ -16,27 +16,53 @@
|
||||
#include "WEvent.h"
|
||||
#include "Pos.h"
|
||||
|
||||
class PlayGuiObject: public JGuiObject, public JGuiListener, public Pos{
|
||||
protected:
|
||||
class PlayGuiObject: public JGuiObject, public JGuiListener, public Pos
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
int wave;
|
||||
float mHeight;
|
||||
float defaultHeight;
|
||||
bool mHasFocus;
|
||||
int type;
|
||||
virtual void Entering(){mHasFocus = true; zoom = 1.4f;};
|
||||
virtual bool Leaving(JButton key){mHasFocus = false; zoom = 1.0; return true;};
|
||||
virtual bool CheckUserInput(JButton key) {return false;};
|
||||
virtual bool ButtonPressed(){return true;};
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
PlayGuiObject(float desiredHeight, float x, float y, bool hasFocus);
|
||||
PlayGuiObject(float desiredHeight, const Pos& ref, bool hasFocus);
|
||||
virtual void ButtonPressed(int controllerId, int controlId){};
|
||||
virtual bool getTopLeft(float& top, float& left) {top = actY; left = actX; return true;};
|
||||
virtual ~PlayGuiObject(){};
|
||||
vector<Effect*> effects;
|
||||
public:
|
||||
int wave;
|
||||
float mHeight;
|
||||
float defaultHeight;
|
||||
bool mHasFocus;
|
||||
int type;
|
||||
virtual void Entering()
|
||||
{
|
||||
mHasFocus = true;
|
||||
zoom = 1.4f;
|
||||
}
|
||||
;
|
||||
virtual bool Leaving(JButton key)
|
||||
{
|
||||
mHasFocus = false;
|
||||
zoom = 1.0;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
virtual bool CheckUserInput(JButton key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
virtual bool ButtonPressed()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
;
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
PlayGuiObject(float desiredHeight, float x, float y, bool hasFocus);
|
||||
PlayGuiObject(float desiredHeight, const Pos& ref, bool hasFocus);
|
||||
virtual void ButtonPressed(int controllerId, int controlId) {}
|
||||
virtual bool getTopLeft(float& top, float& left)
|
||||
{
|
||||
top = actY;
|
||||
left = actX;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
virtual ~PlayGuiObject() {};
|
||||
vector<Effect*> effects;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,19 +5,26 @@
|
||||
|
||||
#include "GuiLayers.h"
|
||||
|
||||
class PlayGuiObjectController : public GuiLayer{
|
||||
protected:
|
||||
float last_user_move;
|
||||
int getClosestItem(int direction);
|
||||
int getClosestItem(int direction, float tolerance);
|
||||
static int showBigCards;// 0 hide, 1 show, 2 show text
|
||||
public:
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
PlayGuiObjectController(){last_user_move=0;};
|
||||
virtual void Render(){GuiLayer::Render();};
|
||||
class PlayGuiObjectController: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
float last_user_move;
|
||||
int getClosestItem(int direction);
|
||||
int getClosestItem(int direction, float tolerance);
|
||||
static int showBigCards;// 0 hide, 1 show, 2 show text
|
||||
public:
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
PlayGuiObjectController()
|
||||
{
|
||||
last_user_move = 0;
|
||||
}
|
||||
;
|
||||
virtual void Render()
|
||||
{
|
||||
GuiLayer::Render();
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,9 @@ protected:
|
||||
public:
|
||||
enum ENUM_PLAY_MODE
|
||||
{
|
||||
MODE_TEST_SUITE, MODE_HUMAN, MODE_AI,
|
||||
MODE_TEST_SUITE,
|
||||
MODE_HUMAN,
|
||||
MODE_AI
|
||||
};
|
||||
|
||||
JTexture * mAvatarTex;
|
||||
|
||||
@@ -4,18 +4,19 @@
|
||||
#include "MTGDeck.h"
|
||||
#include "Tasks.h"
|
||||
|
||||
class PlayerData{
|
||||
protected:
|
||||
void init();
|
||||
public:
|
||||
int credits;
|
||||
map<string,string>storySaves;
|
||||
MTGDeck * collection;
|
||||
TaskList * taskList;
|
||||
PlayerData(); //This doesn't init the collection, do not use it to manipulate the player's collection
|
||||
PlayerData(MTGAllCards * allcards);
|
||||
~PlayerData();
|
||||
int save();
|
||||
class PlayerData
|
||||
{
|
||||
protected:
|
||||
void init();
|
||||
public:
|
||||
int credits;
|
||||
map<string, string> storySaves;
|
||||
MTGDeck * collection;
|
||||
TaskList * taskList;
|
||||
PlayerData(); //This doesn't init the collection, do not use it to manipulate the player's collection
|
||||
PlayerData(MTGAllCards * allcards);
|
||||
~PlayerData();
|
||||
int save();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,14 +3,15 @@
|
||||
|
||||
#include "JGE.h"
|
||||
|
||||
struct Pos {
|
||||
float actX, actY, actZ, actT, actA;
|
||||
float x, y, zoom, t, alpha;
|
||||
Pos(float, float, float, float, float);
|
||||
virtual void Update(float dt);
|
||||
void UpdateNow();
|
||||
virtual void Render();
|
||||
void Render(JQuad*);
|
||||
struct Pos
|
||||
{
|
||||
float actX, actY, actZ, actT, actA;
|
||||
float x, y, zoom, t, alpha;
|
||||
Pos(float, float, float, float, float);
|
||||
virtual void Update(float dt);
|
||||
void UpdateNow();
|
||||
virtual void Render();
|
||||
void Render(JQuad*);
|
||||
};
|
||||
|
||||
#endif // _POS_H_
|
||||
|
||||
@@ -8,23 +8,28 @@
|
||||
|
||||
class MTGAllCards;
|
||||
|
||||
class PriceList{
|
||||
private:
|
||||
MTGAllCards * collection;
|
||||
string filename;
|
||||
map<int,int> prices;
|
||||
static int randomKey;
|
||||
public:
|
||||
PriceList(const char * file, MTGAllCards * _collection);
|
||||
~PriceList();
|
||||
int save();
|
||||
int getSellPrice(int cardid);
|
||||
int getPurchasePrice(int cardid);
|
||||
int getPrice(int cardId);
|
||||
int setPrice(int cardId,int price);
|
||||
int getOtherPrice(int amt);
|
||||
static float difficultyScalar(float price, int cardid=0);
|
||||
static void updateKey() {randomKey = rand();};
|
||||
class PriceList
|
||||
{
|
||||
private:
|
||||
MTGAllCards * collection;
|
||||
string filename;
|
||||
map<int, int> prices;
|
||||
static int randomKey;
|
||||
public:
|
||||
PriceList(const char * file, MTGAllCards * _collection);
|
||||
~PriceList();
|
||||
int save();
|
||||
int getSellPrice(int cardid);
|
||||
int getPurchasePrice(int cardid);
|
||||
int getPrice(int cardId);
|
||||
int setPrice(int cardId, int price);
|
||||
int getOtherPrice(int amt);
|
||||
static float difficultyScalar(float price, int cardid = 0);
|
||||
static void updateKey()
|
||||
{
|
||||
randomKey = rand();
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,35 +9,42 @@ using namespace std;
|
||||
class TargetChooser;
|
||||
class MTGAbility;
|
||||
|
||||
class ReplacementEffect {
|
||||
class ReplacementEffect
|
||||
{
|
||||
public:
|
||||
virtual WEvent * replace (WEvent * e) {return e;};
|
||||
virtual ~ReplacementEffect(){};
|
||||
virtual WEvent * replace(WEvent * e)
|
||||
{
|
||||
return e;
|
||||
}
|
||||
;
|
||||
virtual ~ReplacementEffect() {}
|
||||
};
|
||||
|
||||
class REDamagePrevention: public ReplacementEffect {
|
||||
class REDamagePrevention: public ReplacementEffect
|
||||
{
|
||||
protected:
|
||||
MTGAbility * source;
|
||||
TargetChooser * tcSource;
|
||||
TargetChooser * tcTarget;
|
||||
int damage;
|
||||
bool oneShot;
|
||||
int typeOfDamage;
|
||||
MTGAbility * source;
|
||||
TargetChooser * tcSource;
|
||||
TargetChooser * tcTarget;
|
||||
int damage;
|
||||
bool oneShot;
|
||||
int typeOfDamage;
|
||||
public:
|
||||
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL,TargetChooser *_tcTarget = NULL, int _damage = -1, bool _oneShot = true, int typeOfDamage = DAMAGE_ALL_TYPES);
|
||||
WEvent * replace (WEvent *e);
|
||||
~REDamagePrevention();
|
||||
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL, int _damage = -1, bool _oneShot = true, int typeOfDamage = DAMAGE_ALL_TYPES);
|
||||
WEvent * replace(WEvent *e);
|
||||
~REDamagePrevention();
|
||||
};
|
||||
|
||||
class ReplacementEffects {
|
||||
class ReplacementEffects
|
||||
{
|
||||
protected:
|
||||
list<ReplacementEffect *>modifiers;
|
||||
list<ReplacementEffect *> modifiers;
|
||||
public:
|
||||
ReplacementEffects();
|
||||
WEvent * replace(WEvent *e);
|
||||
int add(ReplacementEffect * re);
|
||||
int remove (ReplacementEffect * re);
|
||||
~ReplacementEffects();
|
||||
ReplacementEffects();
|
||||
WEvent * replace(WEvent *e);
|
||||
int add(ReplacementEffect * re);
|
||||
int remove(ReplacementEffect * re);
|
||||
~ReplacementEffects();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,70 +13,74 @@ class MTGCardInstance;
|
||||
|
||||
#define MAX_RULES_CARDS 4096;
|
||||
|
||||
class RulesPlayerZone{
|
||||
public:
|
||||
vector<int> cards;
|
||||
void add(int cardid);
|
||||
RulesPlayerZone();
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
class RulesPlayerData{
|
||||
public:
|
||||
vector <string> extraRules;
|
||||
int life;
|
||||
int poisonCount;
|
||||
int damageCount;
|
||||
int preventable;
|
||||
string avatar;
|
||||
ManaCost * manapool;
|
||||
RulesPlayerZone zones[5];
|
||||
RulesPlayerData();
|
||||
~RulesPlayerData();
|
||||
void cleanup();
|
||||
|
||||
};
|
||||
|
||||
class RulesState{
|
||||
public:
|
||||
int phase;
|
||||
int player;
|
||||
void parsePlayerState(int playerId, string s);
|
||||
RulesState();
|
||||
RulesPlayerData playerData[2];
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
|
||||
class Rules{
|
||||
protected:
|
||||
Player * loadPlayerMomir(int isAI);
|
||||
Player * loadPlayerRandom(int isAI, int mode);
|
||||
Player * initPlayer(int playerId);
|
||||
MTGDeck * buildDeck( int playerId);
|
||||
int strToGameMode(string s);
|
||||
class RulesPlayerZone
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
PARSE_UNDEFINED,
|
||||
PARSE_INIT,
|
||||
PARSE_PLAYER1,
|
||||
PARSE_PLAYER2,
|
||||
PARSE_PLAYERS
|
||||
};
|
||||
vector<int> cards;
|
||||
void add(int cardid);
|
||||
RulesPlayerZone();
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
string bg;
|
||||
class RulesPlayerData
|
||||
{
|
||||
public:
|
||||
vector<string> extraRules;
|
||||
int life;
|
||||
int poisonCount;
|
||||
int damageCount;
|
||||
int preventable;
|
||||
string avatar;
|
||||
ManaCost * manapool;
|
||||
RulesPlayerZone zones[5];
|
||||
RulesPlayerData();
|
||||
~RulesPlayerData();
|
||||
void cleanup();
|
||||
|
||||
Rules(string filename, string bg = "");
|
||||
int load(string filename);
|
||||
int gamemode;
|
||||
void initPlayers();
|
||||
void addExtraRules();
|
||||
void initGame();
|
||||
void cleanup();
|
||||
vector <string> extraRules;
|
||||
RulesState initState;
|
||||
static int getMTGId(string name);
|
||||
static MTGCardInstance * getCardByMTGId(int mtgid);
|
||||
};
|
||||
|
||||
class RulesState
|
||||
{
|
||||
public:
|
||||
int phase;
|
||||
int player;
|
||||
void parsePlayerState(int playerId, string s);
|
||||
RulesState();
|
||||
RulesPlayerData playerData[2];
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
class Rules
|
||||
{
|
||||
protected:
|
||||
Player * loadPlayerMomir(int isAI);
|
||||
Player * loadPlayerRandom(int isAI, int mode);
|
||||
Player * initPlayer(int playerId);
|
||||
MTGDeck * buildDeck(int playerId);
|
||||
int strToGameMode(string s);
|
||||
public:
|
||||
enum
|
||||
{
|
||||
PARSE_UNDEFINED,
|
||||
PARSE_INIT,
|
||||
PARSE_PLAYER1,
|
||||
PARSE_PLAYER2,
|
||||
PARSE_PLAYERS
|
||||
};
|
||||
|
||||
string bg;
|
||||
|
||||
Rules(string filename, string bg = "");
|
||||
int load(string filename);
|
||||
int gamemode;
|
||||
void initPlayers();
|
||||
void addExtraRules();
|
||||
void initGame();
|
||||
void cleanup();
|
||||
vector<string> extraRules;
|
||||
RulesState initState;
|
||||
static int getMTGId(string name);
|
||||
static MTGCardInstance * getCardByMTGId(int mtgid);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
A class for very simple menus structure
|
||||
*/
|
||||
A class for very simple menus structure
|
||||
*/
|
||||
#ifndef _SIMPLEMENU_H_
|
||||
#define _SIMPLEMENU_H_
|
||||
|
||||
@@ -9,39 +9,42 @@
|
||||
#include "WFont.h"
|
||||
#include "hge/hgeparticle.h"
|
||||
|
||||
class SimpleMenu:public JGuiController{
|
||||
private:
|
||||
float mHeight, mWidth, mX, mY;
|
||||
int fontId;
|
||||
std::string title;
|
||||
int displaytitle;
|
||||
int maxItems,startId;
|
||||
float selectionT, selectionY;
|
||||
float timeOpen;
|
||||
bool mClosed;
|
||||
class SimpleMenu: public JGuiController
|
||||
{
|
||||
private:
|
||||
float mHeight, mWidth, mX, mY;
|
||||
int fontId;
|
||||
std::string title;
|
||||
int displaytitle;
|
||||
int maxItems, startId;
|
||||
float selectionT, selectionY;
|
||||
float timeOpen;
|
||||
bool mClosed;
|
||||
|
||||
static JQuad *spadeR, *spadeL, *jewel, *side;
|
||||
static JTexture *spadeRTex, *spadeLTex, *jewelTex, *sideTex;
|
||||
static WFont* titleFont;
|
||||
static hgeParticleSystem* stars;
|
||||
static JQuad *spadeR, *spadeL, *jewel, *side;
|
||||
static JTexture *spadeRTex, *spadeLTex, *jewelTex, *sideTex;
|
||||
static WFont* titleFont;
|
||||
static hgeParticleSystem* stars;
|
||||
|
||||
inline void MogrifyJewel();
|
||||
void drawHorzPole(float x, float y, float width);
|
||||
void drawVertPole(float x, float y, float height);
|
||||
inline void MogrifyJewel();
|
||||
void drawHorzPole(float x, float y, float width);
|
||||
void drawVertPole(float x, float y, float height);
|
||||
|
||||
public:
|
||||
bool autoTranslate;
|
||||
SimpleMenu(int id, JGuiListener* listener, int fontId, float x, float y, const char * _title = "", int _maxItems = 7);
|
||||
virtual ~SimpleMenu();
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
void Add(int id, const char * Text,string desc = "", bool forceFocus = false);
|
||||
void Close();
|
||||
public:
|
||||
bool autoTranslate;
|
||||
SimpleMenu(int id, JGuiListener* listener, int fontId, float x, float y, const char * _title = "", int _maxItems = 7);
|
||||
virtual ~SimpleMenu();
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
void Add(int id, const char * Text, string desc = "", bool forceFocus = false);
|
||||
void Close();
|
||||
|
||||
float selectionTargetY;
|
||||
bool isClosed() { return mClosed; }
|
||||
static void destroy();
|
||||
float selectionTargetY;
|
||||
bool isClosed()
|
||||
{
|
||||
return mClosed;
|
||||
}
|
||||
static void destroy();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,37 +11,42 @@ using std::string;
|
||||
#define SCALE_SELECTED 1.2f
|
||||
#define SCALE_NORMAL 1.0f
|
||||
|
||||
|
||||
class SimpleMenuItem: public JGuiObject
|
||||
{
|
||||
private:
|
||||
bool mHasFocus;
|
||||
SimpleMenu* parent;
|
||||
int fontId;
|
||||
string mText;
|
||||
float mScale;
|
||||
float mTargetScale;
|
||||
private:
|
||||
bool mHasFocus;
|
||||
SimpleMenu* parent;
|
||||
int fontId;
|
||||
string mText;
|
||||
float mScale;
|
||||
float mTargetScale;
|
||||
|
||||
public:
|
||||
string desc;
|
||||
SimpleMenuItem(SimpleMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false);
|
||||
public:
|
||||
string desc;
|
||||
SimpleMenuItem(SimpleMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false);
|
||||
|
||||
float mX;
|
||||
float mY;
|
||||
float mX;
|
||||
float mY;
|
||||
|
||||
void Relocate(float x, float y);
|
||||
float GetWidth();
|
||||
bool hasFocus();
|
||||
void Relocate(float x, float y);
|
||||
float GetWidth();
|
||||
bool hasFocus();
|
||||
|
||||
void RenderWithOffset(float yOffset);
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
void RenderWithOffset(float yOffset);
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
|
||||
virtual void Entering();
|
||||
virtual bool Leaving(JButton key);
|
||||
virtual bool ButtonPressed();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual bool getTopLeft(float& top, float& left) {top = mY; left = mX; return true;};
|
||||
virtual void Entering();
|
||||
virtual bool Leaving(JButton key);
|
||||
virtual bool ButtonPressed();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual bool getTopLeft(float& top, float& left)
|
||||
{
|
||||
top = mY;
|
||||
left = mX;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,51 +19,54 @@ enum SIMPLE_KEYS{
|
||||
KPD_INPUT = 255,
|
||||
};
|
||||
|
||||
struct SimpleKey{
|
||||
SimpleKey( string _ds, int _id);
|
||||
string displayValue;
|
||||
unsigned char id;
|
||||
unsigned char adjacency[4];
|
||||
struct SimpleKey
|
||||
{
|
||||
SimpleKey(string _ds, int _id);
|
||||
string displayValue;
|
||||
unsigned char id;
|
||||
unsigned char adjacency[4];
|
||||
};
|
||||
|
||||
class SimplePad{
|
||||
public:
|
||||
friend class GameSettings;
|
||||
class SimplePad
|
||||
{
|
||||
public:
|
||||
friend class GameSettings;
|
||||
|
||||
string buffer;
|
||||
string title;
|
||||
unsigned int cursorPos();
|
||||
bool isActive() {return bActive;};
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
void pressKey(unsigned char id);
|
||||
string buffer;
|
||||
string title;
|
||||
unsigned int cursorPos();
|
||||
bool isActive()
|
||||
{
|
||||
return bActive;
|
||||
}
|
||||
;
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
void pressKey(unsigned char id);
|
||||
|
||||
SimplePad();
|
||||
~SimplePad();
|
||||
|
||||
float mX, mY;
|
||||
|
||||
SimplePad();
|
||||
~SimplePad();
|
||||
private:
|
||||
void linkKeys(int from, int to, int dir);
|
||||
SimpleKey * Add(string display, unsigned char id);
|
||||
void MoveSelection(unsigned char dir);
|
||||
void Start(string value, string * _dest = NULL);
|
||||
string Finish();
|
||||
|
||||
float mX, mY;
|
||||
|
||||
private:
|
||||
void linkKeys(int from, int to, int dir);
|
||||
SimpleKey * Add(string display, unsigned char id);
|
||||
void MoveSelection(unsigned char dir);
|
||||
void Start(string value, string * _dest=NULL);
|
||||
string Finish();
|
||||
|
||||
bool bActive;
|
||||
bool bCapslock;
|
||||
bool bShowCancel, bShowNumpad;
|
||||
bool bCanceled;
|
||||
int nbitems;
|
||||
unsigned int cursor;
|
||||
int selected;
|
||||
int priorKey; //The prior key from those places.
|
||||
SimpleKey * keys[KPD_MAX];
|
||||
string * dest;
|
||||
string original; //For cancelling.
|
||||
bool bActive;
|
||||
bool bCapslock;
|
||||
bool bShowCancel, bShowNumpad;
|
||||
bool bCanceled;
|
||||
int nbitems;
|
||||
unsigned int cursor;
|
||||
int selected;
|
||||
int priorKey; //The prior key from those places.
|
||||
SimpleKey * keys[KPD_MAX];
|
||||
string * dest;
|
||||
string original; //For cancelling.
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,12 +35,17 @@ private:
|
||||
public:
|
||||
bool autoTranslate;
|
||||
|
||||
|
||||
SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title = "", DeckMetaData* deckInfo = NULL, MTGAllCards * collection = NULL);
|
||||
~SimplePopup(void);
|
||||
void drawBoundingBox( float x, float y, float width, float height );
|
||||
bool isClosed() { return mClosed; }
|
||||
MTGAllCards* getCollection() { return mCollection; }
|
||||
void drawBoundingBox(float x, float y, float width, float height);
|
||||
bool isClosed()
|
||||
{
|
||||
return mClosed;
|
||||
}
|
||||
MTGAllCards* getCollection()
|
||||
{
|
||||
return mCollection;
|
||||
}
|
||||
void Render();
|
||||
void Update(DeckMetaData* deckMetaData);
|
||||
|
||||
|
||||
@@ -11,143 +11,168 @@ class GameObserver;
|
||||
class MTGDeck;
|
||||
#define CAMPAIGNS_FOLDER "campaigns/"
|
||||
|
||||
|
||||
class StoryDialogElement:public JGuiObject {
|
||||
class StoryDialogElement: public JGuiObject
|
||||
{
|
||||
public:
|
||||
float mX;
|
||||
float mY;
|
||||
StoryDialogElement(float x, float y, int id = 0);
|
||||
void Entering(){};
|
||||
bool Leaving(JButton key) {return false;};
|
||||
bool ButtonPressed() {return false;};
|
||||
bool hasFocus() {return false;};
|
||||
virtual float getHeight() = 0;
|
||||
float mX;
|
||||
float mY;
|
||||
StoryDialogElement(float x, float y, int id = 0);
|
||||
void Entering()
|
||||
{
|
||||
}
|
||||
;
|
||||
bool Leaving(JButton key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
bool ButtonPressed()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
bool hasFocus()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
virtual float getHeight() = 0;
|
||||
};
|
||||
|
||||
class StoryText:public StoryDialogElement {
|
||||
public :
|
||||
string text;
|
||||
int align;
|
||||
int font;
|
||||
StoryText(string text, float mX, float mY, string align = "center", int font = 0, int id = 0);
|
||||
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
float getHeight();
|
||||
};
|
||||
class StoryImage:public StoryDialogElement {
|
||||
public :
|
||||
string img;
|
||||
StoryImage(string img, float mX, float mY);
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
float getHeight();
|
||||
};
|
||||
|
||||
class StoryReward:public StoryText {
|
||||
class StoryText: public StoryDialogElement
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
STORY_REWARD_CREDITS,
|
||||
STORY_REWARD_SET,
|
||||
STORY_REWARD_CARD,
|
||||
};
|
||||
string text;
|
||||
int align;
|
||||
int font;
|
||||
StoryText(string text, float mX, float mY, string align = "center", int font = 0, int id = 0);
|
||||
|
||||
int rewardDone;
|
||||
string value;
|
||||
int type;
|
||||
|
||||
StoryReward(string _type, string _value, string text, float _mX, float _mY, string align = "center", int font = 0, int id = 0);
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
|
||||
static bool rewardSoundPlayed;
|
||||
static bool rewardsEnabled;
|
||||
static MTGDeck * collection;
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
float getHeight();
|
||||
};
|
||||
class StoryImage: public StoryDialogElement
|
||||
{
|
||||
public:
|
||||
string img;
|
||||
StoryImage(string img, float mX, float mY);
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
float getHeight();
|
||||
};
|
||||
|
||||
class StoryChoice:public StoryText {
|
||||
class StoryReward: public StoryText
|
||||
{
|
||||
public:
|
||||
string pageId;
|
||||
enum
|
||||
{
|
||||
STORY_REWARD_CREDITS,
|
||||
STORY_REWARD_SET,
|
||||
STORY_REWARD_CARD,
|
||||
};
|
||||
|
||||
bool mHasFocus;
|
||||
float mScale;
|
||||
float mTargetScale;
|
||||
StoryChoice(string id, string text, int JGOid, float mX, float mY, string _align, int _font, bool hasFocus);
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
int rewardDone;
|
||||
string value;
|
||||
int type;
|
||||
|
||||
void Entering();
|
||||
bool Leaving(JButton key);
|
||||
bool ButtonPressed();
|
||||
bool hasFocus();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
float getHeight();
|
||||
StoryReward(string _type, string _value, string text, float _mX, float _mY, string align = "center", int font = 0, int id = 0);
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
|
||||
static bool rewardSoundPlayed;
|
||||
static bool rewardsEnabled;
|
||||
static MTGDeck * collection;
|
||||
};
|
||||
|
||||
class StoryChoice: public StoryText
|
||||
{
|
||||
public:
|
||||
string pageId;
|
||||
|
||||
bool mHasFocus;
|
||||
float mScale;
|
||||
float mTargetScale;
|
||||
StoryChoice(string id, string text, int JGOid, float mX, float mY, string _align, int _font, bool hasFocus);
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
|
||||
void Entering();
|
||||
bool Leaving(JButton key);
|
||||
bool ButtonPressed();
|
||||
bool hasFocus();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
float getHeight();
|
||||
};
|
||||
|
||||
class StoryFlow;
|
||||
class StoryPage {
|
||||
class StoryPage
|
||||
{
|
||||
protected:
|
||||
string safeAttribute(TiXmlElement* element, string attribute);
|
||||
public:
|
||||
StoryFlow * mParent;
|
||||
string musicFile;
|
||||
StoryPage(StoryFlow * mParent);
|
||||
virtual void Update(float dt)=0;
|
||||
virtual void Render()=0;
|
||||
virtual ~StoryPage(){};
|
||||
int loadElement(TiXmlElement* element);
|
||||
};
|
||||
|
||||
class StoryDialog:public StoryPage, public JGuiListener,public JGuiController {
|
||||
private:
|
||||
vector<StoryDialogElement *>graphics;
|
||||
void RenderElement(StoryDialogElement * elmt);
|
||||
public:
|
||||
StoryDialog(TiXmlElement* el,StoryFlow * mParent);
|
||||
~StoryDialog();
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void ButtonPressed(int,int);
|
||||
|
||||
static float currentY;
|
||||
static float previousY;
|
||||
StoryFlow * mParent;
|
||||
string musicFile;
|
||||
StoryPage(StoryFlow * mParent);
|
||||
virtual void Update(float dt)=0;
|
||||
virtual void Render()=0;
|
||||
virtual ~StoryPage()
|
||||
{
|
||||
}
|
||||
;
|
||||
int loadElement(TiXmlElement* element);
|
||||
};
|
||||
|
||||
class StoryDialog: public StoryPage, public JGuiListener, public JGuiController
|
||||
{
|
||||
private:
|
||||
vector<StoryDialogElement *> graphics;
|
||||
void RenderElement(StoryDialogElement * elmt);
|
||||
public:
|
||||
StoryDialog(TiXmlElement* el, StoryFlow * mParent);
|
||||
~StoryDialog();
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void ButtonPressed(int, int);
|
||||
|
||||
static float currentY;
|
||||
static float previousY;
|
||||
};
|
||||
|
||||
class Rules;
|
||||
class StoryDuel:public StoryPage {
|
||||
class StoryDuel: public StoryPage
|
||||
{
|
||||
public:
|
||||
string pageId;
|
||||
string onWin, onLose;
|
||||
string bg; //background file
|
||||
GameObserver * game;
|
||||
Rules * rules;
|
||||
StoryDuel(TiXmlElement* el,StoryFlow * mParent);
|
||||
virtual ~StoryDuel();
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void init();
|
||||
string pageId;
|
||||
string onWin, onLose;
|
||||
string bg; //background file
|
||||
GameObserver * game;
|
||||
Rules * rules;
|
||||
StoryDuel(TiXmlElement* el, StoryFlow * mParent);
|
||||
virtual ~StoryDuel();
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void init();
|
||||
};
|
||||
|
||||
class StoryFlow{
|
||||
class StoryFlow
|
||||
{
|
||||
private:
|
||||
map<string,StoryPage *>pages;
|
||||
bool parse(string filename);
|
||||
StoryPage * loadPage(TiXmlElement* element);
|
||||
bool _gotoPage(string id);
|
||||
public:
|
||||
string currentPageId;
|
||||
string folder;
|
||||
StoryFlow(string folder);
|
||||
~StoryFlow();
|
||||
map<string, StoryPage *> pages;
|
||||
bool parse(string filename);
|
||||
StoryPage * loadPage(TiXmlElement* element);
|
||||
bool _gotoPage(string id);
|
||||
public:
|
||||
string currentPageId;
|
||||
string folder;
|
||||
StoryFlow(string folder);
|
||||
~StoryFlow();
|
||||
|
||||
bool gotoPage(string id);
|
||||
bool loadPageId(string id);
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
bool gotoPage(string id);
|
||||
bool loadPageId(string id);
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,32 +1,36 @@
|
||||
class WStyle{
|
||||
class WStyle
|
||||
{
|
||||
public:
|
||||
friend class StyleManager;
|
||||
string stylized(string filename);
|
||||
protected:
|
||||
map<string,string> mapping;
|
||||
map<string, string> mapping;
|
||||
};
|
||||
|
||||
class WStyleRule{
|
||||
class WStyleRule
|
||||
{
|
||||
public:
|
||||
string filter; //The condition
|
||||
string style; //The style to use.
|
||||
string filter; //The condition
|
||||
string style; //The style to use.
|
||||
};
|
||||
class MTGDeck;
|
||||
class StyleManager{
|
||||
class StyleManager
|
||||
{
|
||||
public:
|
||||
friend class OptionThemeStyle;
|
||||
friend class OptionTheme;
|
||||
StyleManager();
|
||||
~StyleManager();
|
||||
void determineActive(MTGDeck * p1, MTGDeck * p2);
|
||||
WStyle * get();
|
||||
friend class OptionThemeStyle;
|
||||
friend class OptionTheme;
|
||||
StyleManager();
|
||||
~StyleManager();
|
||||
void determineActive(MTGDeck * p1, MTGDeck * p2);
|
||||
WStyle * get();
|
||||
protected:
|
||||
int topRule; int topSize;
|
||||
int playerSrc;
|
||||
int topRule;
|
||||
int topSize;
|
||||
int playerSrc;
|
||||
|
||||
void loadRules();
|
||||
void killRules();
|
||||
vector<WStyleRule*> rules;
|
||||
string activeStyle;
|
||||
map<string,WStyle*> styles;
|
||||
void loadRules();
|
||||
void killRules();
|
||||
vector<WStyleRule*> rules;
|
||||
string activeStyle;
|
||||
map<string, WStyle*> styles;
|
||||
};
|
||||
|
||||
@@ -1,38 +1,36 @@
|
||||
#ifndef _SUBTYPES_H_
|
||||
#define _SUBTYPES_H_
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
|
||||
class Subtypes{
|
||||
class Subtypes
|
||||
{
|
||||
public:
|
||||
//A list of commonly used types
|
||||
enum {
|
||||
TYPE_CREATURE = 1,
|
||||
TYPE_ENCHANTMENT = 2,
|
||||
TYPE_SORCERY = 3,
|
||||
TYPE_INSTANT = 4,
|
||||
TYPE_LAND = 5,
|
||||
TYPE_ARTIFACT = 6,
|
||||
TYPE_LEGENDARY = 7,
|
||||
LAST_TYPE = TYPE_LEGENDARY,
|
||||
};
|
||||
//A list of commonly used types
|
||||
enum
|
||||
{
|
||||
TYPE_CREATURE = 1,
|
||||
TYPE_ENCHANTMENT = 2,
|
||||
TYPE_SORCERY = 3,
|
||||
TYPE_INSTANT = 4,
|
||||
TYPE_LAND = 5,
|
||||
TYPE_ARTIFACT = 6,
|
||||
TYPE_LEGENDARY = 7,
|
||||
LAST_TYPE = TYPE_LEGENDARY,
|
||||
};
|
||||
|
||||
|
||||
protected:
|
||||
map<string,int> values;
|
||||
vector<string> valuesById;
|
||||
public:
|
||||
static Subtypes * subtypesList;
|
||||
Subtypes();
|
||||
int find(const char * subtype, bool forceAdd = true);
|
||||
int find(string subtype, bool forceAdd = true);
|
||||
string find(unsigned int id);
|
||||
protected:
|
||||
map<string, int> values;
|
||||
vector<string> valuesById;
|
||||
public:
|
||||
static Subtypes * subtypesList;
|
||||
Subtypes();
|
||||
int find(const char * subtype, bool forceAdd = true);
|
||||
int find(string subtype, bool forceAdd = true);
|
||||
string find(unsigned int id);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,160 +20,197 @@ class Damageable;
|
||||
class Targetable;
|
||||
class CardDescriptor;
|
||||
|
||||
class TargetChooser: public TargetsList
|
||||
{
|
||||
protected:
|
||||
int forceTargetListReady;
|
||||
|
||||
|
||||
class TargetChooser: public TargetsList {
|
||||
protected:
|
||||
int forceTargetListReady;
|
||||
|
||||
public:
|
||||
enum{
|
||||
UNSET = 0,
|
||||
OPPONENT = -1,
|
||||
CONTROLLER = 1,
|
||||
TARGET_CONTROLLER = 2,
|
||||
OWNER = 3
|
||||
};
|
||||
public:
|
||||
enum
|
||||
{
|
||||
UNSET = 0,
|
||||
OPPONENT = -1,
|
||||
CONTROLLER = 1,
|
||||
TARGET_CONTROLLER = 2,
|
||||
OWNER = 3
|
||||
};
|
||||
bool other;
|
||||
|
||||
TargetChooser(MTGCardInstance * card = NULL, int _maxtargets = -1, bool other = false);
|
||||
TargetChooser(MTGCardInstance * card = NULL, int _maxtargets = -1, bool other = false);
|
||||
|
||||
MTGCardInstance * source;
|
||||
MTGCardInstance * targetter; //Optional, usually equals source, used for protection from...
|
||||
|
||||
int maxtargets; //Set to -1 for "unlimited"
|
||||
bool validTargetsExist();
|
||||
virtual int setAllZones(){return 0;}
|
||||
virtual bool targetsZone(MTGGameZone * z){return false;};
|
||||
int ForceTargetListReady();
|
||||
int targetsReadyCheck();
|
||||
virtual int addTarget(Targetable * target);
|
||||
virtual bool canTarget(Targetable * _target);
|
||||
virtual int full(){if (maxtargets != -1 && cursor>=maxtargets) {return 1;} else{return 0;}};
|
||||
virtual int ready(){return cursor;};
|
||||
virtual ~TargetChooser(){};
|
||||
int targetListSet();
|
||||
virtual TargetChooser* clone() const = 0;
|
||||
MTGCardInstance * source;
|
||||
MTGCardInstance * targetter; //Optional, usually equals source, used for protection from...
|
||||
|
||||
int maxtargets; //Set to -1 for "unlimited"
|
||||
bool validTargetsExist();
|
||||
virtual int setAllZones()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual bool targetsZone(MTGGameZone * z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
int ForceTargetListReady();
|
||||
int targetsReadyCheck();
|
||||
virtual int addTarget(Targetable * target);
|
||||
virtual bool canTarget(Targetable * _target);
|
||||
virtual int full()
|
||||
{
|
||||
if (maxtargets != -1 && cursor >= maxtargets)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
;
|
||||
virtual int ready()
|
||||
{
|
||||
return cursor;
|
||||
}
|
||||
;
|
||||
virtual ~TargetChooser()
|
||||
{
|
||||
}
|
||||
;
|
||||
int targetListSet();
|
||||
virtual TargetChooser* clone() const = 0;
|
||||
};
|
||||
|
||||
|
||||
class TargetChooserFactory{
|
||||
public:
|
||||
TargetChooser * createTargetChooser(string s, MTGCardInstance * card, MTGAbility * ability = NULL);
|
||||
TargetChooser * createTargetChooser(MTGCardInstance * card);
|
||||
};
|
||||
|
||||
|
||||
class TargetZoneChooser:public TargetChooser{
|
||||
public:
|
||||
int zones[15];
|
||||
int nbzones;
|
||||
int init(int * _zones, int _nbzones);
|
||||
bool targetsZone(MTGGameZone * z);
|
||||
TargetZoneChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
TargetZoneChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * _card);
|
||||
int setAllZones();
|
||||
virtual TargetZoneChooser * clone() const;
|
||||
};
|
||||
|
||||
class CardTargetChooser:public TargetZoneChooser {
|
||||
protected:
|
||||
MTGCardInstance * validTarget;
|
||||
class TargetChooserFactory
|
||||
{
|
||||
public:
|
||||
CardTargetChooser(MTGCardInstance * card, MTGCardInstance * source, int * zones = NULL, int nbzones = 0);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual CardTargetChooser * clone() const;
|
||||
TargetChooser * createTargetChooser(string s, MTGCardInstance * card, MTGAbility * ability = NULL);
|
||||
TargetChooser * createTargetChooser(MTGCardInstance * card);
|
||||
};
|
||||
|
||||
|
||||
class CreatureTargetChooser:public TargetZoneChooser{
|
||||
public:
|
||||
CreatureTargetChooser(int * _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
CreatureTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * _card);
|
||||
virtual CreatureTargetChooser * clone() const;
|
||||
|
||||
class TargetZoneChooser: public TargetChooser
|
||||
{
|
||||
public:
|
||||
int zones[15];
|
||||
int nbzones;
|
||||
int init(int * _zones, int _nbzones);
|
||||
bool targetsZone(MTGGameZone * z);
|
||||
TargetZoneChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
TargetZoneChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * _card);
|
||||
int setAllZones();
|
||||
virtual TargetZoneChooser * clone() const;
|
||||
};
|
||||
|
||||
|
||||
class DamageableTargetChooser:public CreatureTargetChooser{
|
||||
public:
|
||||
DamageableTargetChooser(int * _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false):CreatureTargetChooser( _zones,_nbzones, card, _maxtargets,other){};
|
||||
DamageableTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false):CreatureTargetChooser(card, _maxtargets,other){};
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual DamageableTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
|
||||
class PlayerTargetChooser:public TargetChooser{
|
||||
class CardTargetChooser: public TargetZoneChooser
|
||||
{
|
||||
protected:
|
||||
Player * p; //In Case we can only target a specific player
|
||||
public:
|
||||
PlayerTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, Player *_p = NULL);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual PlayerTargetChooser * clone() const;
|
||||
MTGCardInstance * validTarget;
|
||||
public:
|
||||
CardTargetChooser(MTGCardInstance * card, MTGCardInstance * source, int * zones = NULL, int nbzones = 0);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual CardTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
class TypeTargetChooser:public TargetZoneChooser{
|
||||
public:
|
||||
int nbtypes;
|
||||
int types[10];
|
||||
TypeTargetChooser(const char * _type, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
TypeTargetChooser(const char * _type, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
void addType(int type);
|
||||
void addType(const char * type);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual TypeTargetChooser * clone() const;
|
||||
class CreatureTargetChooser: public TargetZoneChooser
|
||||
{
|
||||
public:
|
||||
CreatureTargetChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
CreatureTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * _card);
|
||||
virtual CreatureTargetChooser * clone() const;
|
||||
|
||||
};
|
||||
|
||||
class DescriptorTargetChooser:public TargetZoneChooser{
|
||||
public:
|
||||
CardDescriptor * cd;
|
||||
DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
DescriptorTargetChooser(CardDescriptor * _cd, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
~DescriptorTargetChooser();
|
||||
virtual DescriptorTargetChooser * clone() const;
|
||||
class DamageableTargetChooser: public CreatureTargetChooser
|
||||
{
|
||||
public:
|
||||
DamageableTargetChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false) :
|
||||
CreatureTargetChooser(_zones, _nbzones, card, _maxtargets, other)
|
||||
{
|
||||
}
|
||||
;
|
||||
DamageableTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false) :
|
||||
CreatureTargetChooser(card, _maxtargets, other)
|
||||
{
|
||||
}
|
||||
;
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual DamageableTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
|
||||
class SpellTargetChooser:public TargetChooser{
|
||||
public:
|
||||
int color;
|
||||
SpellTargetChooser( MTGCardInstance * card = NULL,int _color = -1, int _maxtargets = 1 , bool other = false);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual SpellTargetChooser * clone() const;
|
||||
class PlayerTargetChooser: public TargetChooser
|
||||
{
|
||||
protected:
|
||||
Player * p; //In Case we can only target a specific player
|
||||
public:
|
||||
PlayerTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, Player *_p = NULL);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual PlayerTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
class SpellOrPermanentTargetChooser:public TargetZoneChooser{
|
||||
public:
|
||||
int color;
|
||||
SpellOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual SpellOrPermanentTargetChooser * clone() const;
|
||||
class TypeTargetChooser: public TargetZoneChooser
|
||||
{
|
||||
public:
|
||||
int nbtypes;
|
||||
int types[10];
|
||||
TypeTargetChooser(const char * _type, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
TypeTargetChooser(const char * _type, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
void addType(int type);
|
||||
void addType(const char * type);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual TypeTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
class DescriptorTargetChooser: public TargetZoneChooser
|
||||
{
|
||||
public:
|
||||
CardDescriptor * cd;
|
||||
DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
DescriptorTargetChooser(CardDescriptor * _cd, int * _zones, int nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
~DescriptorTargetChooser();
|
||||
virtual DescriptorTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
class SpellTargetChooser: public TargetChooser
|
||||
{
|
||||
public:
|
||||
int color;
|
||||
SpellTargetChooser(MTGCardInstance * card = NULL, int _color = -1, int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual SpellTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
class DamageTargetChooser:public TargetChooser{
|
||||
public:
|
||||
int color;
|
||||
int state;
|
||||
DamageTargetChooser( MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, int state = NOT_RESOLVED);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual DamageTargetChooser * clone() const;
|
||||
class SpellOrPermanentTargetChooser: public TargetZoneChooser
|
||||
{
|
||||
public:
|
||||
int color;
|
||||
SpellOrPermanentTargetChooser(MTGCardInstance * card = NULL, int _color = -1, int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual SpellOrPermanentTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
class DamageTargetChooser: public TargetChooser
|
||||
{
|
||||
public:
|
||||
int color;
|
||||
int state;
|
||||
DamageTargetChooser(MTGCardInstance * card = NULL, int _color = -1, int _maxtargets = 1, int state = NOT_RESOLVED);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual DamageTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
//Should only be used for triggered abilities.
|
||||
class TriggerTargetChooser:public TargetChooser{
|
||||
class TriggerTargetChooser: public TargetChooser
|
||||
{
|
||||
public:
|
||||
Targetable * target;
|
||||
int triggerTarget;
|
||||
TriggerTargetChooser(int _triggerTarget);
|
||||
virtual bool targetsZone(MTGGameZone * z);
|
||||
virtual bool canTarget(Targetable * _target);
|
||||
virtual TriggerTargetChooser * clone() const;
|
||||
Targetable * target;
|
||||
int triggerTarget;
|
||||
TriggerTargetChooser(int _triggerTarget);
|
||||
virtual bool targetsZone(MTGGameZone * z);
|
||||
virtual bool canTarget(Targetable * _target);
|
||||
virtual TriggerTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
#define TARGET_PLAYER 2
|
||||
#define TARGET_STACKACTION 3
|
||||
|
||||
class Targetable{
|
||||
public:
|
||||
virtual int typeAsTarget() = 0;
|
||||
virtual const string getDisplayName() const = 0;
|
||||
class Targetable
|
||||
{
|
||||
public:
|
||||
virtual int typeAsTarget() = 0;
|
||||
virtual const string getDisplayName() const = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,24 +11,29 @@ class Spell;
|
||||
class Interruptible;
|
||||
class Damage;
|
||||
|
||||
class TargetsList{
|
||||
public:
|
||||
int cursor;
|
||||
TargetsList();
|
||||
TargetsList(Targetable * _targets[], int nbtargets);
|
||||
Targetable* targets[MAX_TARGETS];
|
||||
int alreadyHasTarget(Targetable * target);
|
||||
int removeTarget(Targetable * _card);
|
||||
int toggleTarget(Targetable * _card);
|
||||
virtual int addTarget(Targetable * _target);
|
||||
MTGCardInstance * getNextCardTarget(MTGCardInstance * previous = 0);
|
||||
Player * getNextPlayerTarget(Player * previous = 0);
|
||||
Damageable * getNextDamageableTarget(Damageable * previous = 0);
|
||||
Interruptible * getNextInterruptible(Interruptible * previous, int type);
|
||||
Spell * getNextSpellTarget(Spell * previous = 0);
|
||||
Damage * getNextDamageTarget(Damage * previous = 0);
|
||||
Targetable * getNextTarget(Targetable * previous = 0, int type = -1);
|
||||
void initTargets(){cursor = 0;};
|
||||
class TargetsList
|
||||
{
|
||||
public:
|
||||
int cursor;
|
||||
TargetsList();
|
||||
TargetsList(Targetable * _targets[], int nbtargets);
|
||||
Targetable* targets[MAX_TARGETS];
|
||||
int alreadyHasTarget(Targetable * target);
|
||||
int removeTarget(Targetable * _card);
|
||||
int toggleTarget(Targetable * _card);
|
||||
virtual int addTarget(Targetable * _target);
|
||||
MTGCardInstance * getNextCardTarget(MTGCardInstance * previous = 0);
|
||||
Player * getNextPlayerTarget(Player * previous = 0);
|
||||
Damageable * getNextDamageableTarget(Damageable * previous = 0);
|
||||
Interruptible * getNextInterruptible(Interruptible * previous, int type);
|
||||
Spell * getNextSpellTarget(Spell * previous = 0);
|
||||
Damage * getNextDamageTarget(Damage * previous = 0);
|
||||
Targetable * getNextTarget(Targetable * previous = 0, int type = -1);
|
||||
void initTargets()
|
||||
{
|
||||
cursor = 0;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,211 +20,223 @@
|
||||
|
||||
#define COMMON_ATTRIBS_COUNT 7
|
||||
|
||||
class Task {
|
||||
class Task
|
||||
{
|
||||
protected:
|
||||
int reward; // TODO: Complex rewards. Be consistent with other planned modes with rewards.
|
||||
int opponent;
|
||||
bool accepted;
|
||||
char type;
|
||||
int expiresIn;
|
||||
string description;
|
||||
string opponentName;
|
||||
vector<string> persistentAttribs; // persistentAttributes
|
||||
int reward; // TODO: Complex rewards. Be consistent with other planned modes with rewards.
|
||||
int opponent;
|
||||
bool accepted;
|
||||
char type;
|
||||
int expiresIn;
|
||||
string description;
|
||||
string opponentName;
|
||||
vector<string> persistentAttribs; // persistentAttributes
|
||||
|
||||
void storeCommonAttribs();
|
||||
int restoreCommonAttribs();
|
||||
string getOpponentName();
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
void storeCommonAttribs();
|
||||
int restoreCommonAttribs();
|
||||
string getOpponentName();
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
|
||||
virtual int computeReward() = 0;
|
||||
virtual int computeReward() = 0;
|
||||
|
||||
public:
|
||||
// variable to store and method to obtain names of AI decks
|
||||
//!! Todo: This should _really_ be handled elsewhere (dedicated class?)
|
||||
static vector<string> sAIDeckNames;
|
||||
static void LoadAIDeckNames();
|
||||
static int getAIDeckCount();
|
||||
static string getAIDeckName(int id);
|
||||
// End of AI deck buffering code
|
||||
// variable to store and method to obtain names of AI decks
|
||||
//!! Todo: This should _really_ be handled elsewhere (dedicated class?)
|
||||
static vector<string> sAIDeckNames;
|
||||
static void LoadAIDeckNames();
|
||||
static int getAIDeckCount();
|
||||
static string getAIDeckName(int id);
|
||||
// End of AI deck buffering code
|
||||
|
||||
Task(char _type = ' ');
|
||||
Task(char _type = ' ');
|
||||
|
||||
static Task* createFromStr(string params, bool rand = false);
|
||||
virtual string toString();
|
||||
string getDesc();
|
||||
virtual string createDesc() = 0;
|
||||
virtual string getShortDesc() = 0;
|
||||
int getExpiration();
|
||||
int getReward();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app) = 0;
|
||||
bool isExpired();
|
||||
void setExpiration(int _expiresIn);
|
||||
void passOneDay();
|
||||
static Task* createFromStr(string params, bool rand = false);
|
||||
virtual string toString();
|
||||
string getDesc();
|
||||
virtual string createDesc() = 0;
|
||||
virtual string getShortDesc() = 0;
|
||||
int getExpiration();
|
||||
int getReward();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app) = 0;
|
||||
bool isExpired();
|
||||
void setExpiration(int _expiresIn);
|
||||
void passOneDay();
|
||||
};
|
||||
|
||||
class TaskList {
|
||||
class TaskList
|
||||
{
|
||||
protected:
|
||||
string fileName;
|
||||
float vPos;
|
||||
float mElapsed;
|
||||
int mState;
|
||||
JQuad * mBg[9];
|
||||
JTexture * mBgTex;
|
||||
float sH, sW;
|
||||
|
||||
string fileName;
|
||||
float vPos;
|
||||
float mElapsed;
|
||||
int mState;
|
||||
JQuad * mBg[9];
|
||||
JTexture * mBgTex;
|
||||
float sH, sW;
|
||||
|
||||
public:
|
||||
vector<Task*> tasks;
|
||||
vector<Task*> tasks;
|
||||
|
||||
enum{
|
||||
TASKS_IN,
|
||||
TASKS_ACTIVE,
|
||||
TASKS_OUT,
|
||||
TASKS_INACTIVE,
|
||||
};
|
||||
enum
|
||||
{
|
||||
TASKS_IN,
|
||||
TASKS_ACTIVE,
|
||||
TASKS_OUT,
|
||||
TASKS_INACTIVE,
|
||||
};
|
||||
|
||||
TaskList(string _fileName = "");
|
||||
int load(string _fileName = "");
|
||||
int save(string _fileName = "");
|
||||
int getState() {return mState;};
|
||||
void addTask(string params, bool rand = false);
|
||||
void addTask(Task *task);
|
||||
void addRandomTask(int diff = 100);
|
||||
void removeTask(Task *task);
|
||||
void passOneDay();
|
||||
void getDoneTasks(Player * _p1, Player * _p2, GameApp * _app, vector<Task*>* result);
|
||||
int getTaskCount();
|
||||
TaskList(string _fileName = "");
|
||||
int load(string _fileName = "");
|
||||
int save(string _fileName = "");
|
||||
int getState()
|
||||
{
|
||||
return mState;
|
||||
}
|
||||
;
|
||||
void addTask(string params, bool rand = false);
|
||||
void addTask(Task *task);
|
||||
void addRandomTask(int diff = 100);
|
||||
void removeTask(Task *task);
|
||||
void passOneDay();
|
||||
void getDoneTasks(Player * _p1, Player * _p2, GameApp * _app, vector<Task*>* result);
|
||||
int getTaskCount();
|
||||
|
||||
void Start();
|
||||
void End();
|
||||
void Start();
|
||||
void End();
|
||||
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
//!!virtual void ButtonPressed(int controllerId, int controlId);
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
//!!virtual void ButtonPressed(int controllerId, int controlId);
|
||||
|
||||
~TaskList();
|
||||
~TaskList();
|
||||
};
|
||||
|
||||
class TaskWinAgainst : public Task {
|
||||
class TaskWinAgainst: public Task
|
||||
{
|
||||
protected:
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskWinAgainst(int _opponent = 0);
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
};
|
||||
|
||||
class TaskSlaughter : public TaskWinAgainst {
|
||||
protected:
|
||||
int targetLife;
|
||||
virtual int computeReward();
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskSlaughter(int _opponent = 0, int _targetLife = -15);
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
TaskWinAgainst(int _opponent = 0);
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
};
|
||||
|
||||
class TaskDelay : public TaskWinAgainst {
|
||||
class TaskSlaughter: public TaskWinAgainst
|
||||
{
|
||||
protected:
|
||||
int turn;
|
||||
bool afterTurn;
|
||||
virtual int computeReward();
|
||||
int targetLife;
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskDelay(int _opponent = 0, int _turn = 20);
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
TaskSlaughter(int _opponent = 0, int _targetLife = -15);
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskImmortal : public Task {
|
||||
class TaskDelay: public TaskWinAgainst
|
||||
{
|
||||
protected:
|
||||
int targetLife;
|
||||
int level;
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskImmortal(int _targetLife = 20);
|
||||
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskMassiveBurial : public Task {
|
||||
protected:
|
||||
int color;
|
||||
int bodyCount;
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskMassiveBurial(int _color = 0, int _bodyCount = 0);
|
||||
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
int turn;
|
||||
bool afterTurn;
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskDelay(int _opponent = 0, int _turn = 20);
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskWisdom : public Task {
|
||||
class TaskImmortal: public Task
|
||||
{
|
||||
protected:
|
||||
int color;
|
||||
int cardCount;
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskWisdom(int _color = 0, int _cardCount = 0);
|
||||
int targetLife;
|
||||
int level;
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskImmortal(int _targetLife = 20);
|
||||
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskPacifism : public Task {
|
||||
class TaskMassiveBurial: public Task
|
||||
{
|
||||
protected:
|
||||
virtual int computeReward();
|
||||
int lifeSlashCardMin;
|
||||
public:
|
||||
TaskPacifism(int _lifeSlashCardMin = 0);
|
||||
int color;
|
||||
int bodyCount;
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskMassiveBurial(int _color = 0, int _bodyCount = 0);
|
||||
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskWisdom: public Task
|
||||
{
|
||||
protected:
|
||||
int color;
|
||||
int cardCount;
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskWisdom(int _color = 0, int _cardCount = 0);
|
||||
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskPacifism: public Task
|
||||
{
|
||||
protected:
|
||||
virtual int computeReward();
|
||||
int lifeSlashCardMin;
|
||||
public:
|
||||
TaskPacifism(int _lifeSlashCardMin = 0);
|
||||
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
/* ------------ Task template ------------
|
||||
|
||||
class TaskXX : public Task {
|
||||
protected:
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskXX();
|
||||
class TaskXX : public Task {
|
||||
protected:
|
||||
virtual int computeReward();
|
||||
public:
|
||||
TaskXX();
|
||||
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
*/
|
||||
virtual string createDesc();
|
||||
virtual string getShortDesc();
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,96 +8,98 @@
|
||||
|
||||
#include "AIPlayer.h"
|
||||
|
||||
class TestSuiteActions{
|
||||
public:
|
||||
int nbitems;
|
||||
string actions[MAX_TESTSUITE_ACTIONS];
|
||||
void add(string action);
|
||||
TestSuiteActions();
|
||||
void cleanup();
|
||||
class TestSuiteActions
|
||||
{
|
||||
public:
|
||||
int nbitems;
|
||||
string actions[MAX_TESTSUITE_ACTIONS];
|
||||
void add(string action);
|
||||
TestSuiteActions();
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
class TestSuitePlayerZone{
|
||||
public:
|
||||
int cards[MAX_TESTUITE_CARDS];
|
||||
int nbitems;
|
||||
void add(int cardid);
|
||||
TestSuitePlayerZone();
|
||||
void cleanup();
|
||||
class TestSuitePlayerZone
|
||||
{
|
||||
public:
|
||||
int cards[MAX_TESTUITE_CARDS];
|
||||
int nbitems;
|
||||
void add(int cardid);
|
||||
TestSuitePlayerZone();
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
class TestSuitePlayerData{
|
||||
public:
|
||||
int life;
|
||||
ManaCost * manapool;
|
||||
TestSuitePlayerZone zones[5];
|
||||
TestSuitePlayerData();
|
||||
~TestSuitePlayerData();
|
||||
void cleanup();
|
||||
class TestSuitePlayerData
|
||||
{
|
||||
public:
|
||||
int life;
|
||||
ManaCost * manapool;
|
||||
TestSuitePlayerZone zones[5];
|
||||
TestSuitePlayerData();
|
||||
~TestSuitePlayerData();
|
||||
void cleanup();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class TestSuite;
|
||||
class TestSuiteState{
|
||||
public:
|
||||
int phase;
|
||||
void parsePlayerState(int playerId, string s);
|
||||
TestSuiteState();
|
||||
TestSuitePlayerData playerData[2];
|
||||
void cleanup();
|
||||
class TestSuiteState
|
||||
{
|
||||
public:
|
||||
int phase;
|
||||
void parsePlayerState(int playerId, string s);
|
||||
TestSuiteState();
|
||||
TestSuitePlayerData playerData[2];
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
|
||||
class TestSuitePregame{
|
||||
public:
|
||||
virtual void performTest() = 0;
|
||||
class TestSuitePregame
|
||||
{
|
||||
public:
|
||||
virtual void performTest() = 0;
|
||||
};
|
||||
|
||||
class TestSuite{
|
||||
public:
|
||||
MTGAllCards* collection;
|
||||
int summoningSickness;
|
||||
bool forceAbility;
|
||||
int gameType;
|
||||
float timerLimit;
|
||||
unsigned int seed;
|
||||
int aiMaxCalls;
|
||||
int currentAction;
|
||||
TestSuiteState initState;
|
||||
TestSuiteState endState;
|
||||
TestSuiteActions actions;
|
||||
string files[1024];
|
||||
int nbfiles;
|
||||
int currentfile;
|
||||
int nbFailed, nbTests, nbAIFailed, nbAITests;
|
||||
int load(const char * filename);
|
||||
TestSuite(const char * filename,MTGAllCards* _collection);
|
||||
void initGame();
|
||||
void pregameTests();
|
||||
int assertGame();
|
||||
MTGPlayerCards * buildDeck(int playerId);
|
||||
string getNextAction();
|
||||
Interruptible * getActionByMTGId(int mtgid);
|
||||
int loadNext();
|
||||
void cleanup();
|
||||
static int Log(const char * text);
|
||||
class TestSuite
|
||||
{
|
||||
public:
|
||||
MTGAllCards* collection;
|
||||
int summoningSickness;
|
||||
bool forceAbility;
|
||||
int gameType;
|
||||
float timerLimit;
|
||||
unsigned int seed;
|
||||
int aiMaxCalls;
|
||||
int currentAction;
|
||||
TestSuiteState initState;
|
||||
TestSuiteState endState;
|
||||
TestSuiteActions actions;
|
||||
string files[1024];
|
||||
int nbfiles;
|
||||
int currentfile;
|
||||
int nbFailed, nbTests, nbAIFailed, nbAITests;
|
||||
int load(const char * filename);
|
||||
TestSuite(const char * filename,MTGAllCards* _collection);
|
||||
void initGame();
|
||||
void pregameTests();
|
||||
int assertGame();
|
||||
MTGPlayerCards * buildDeck(int playerId);
|
||||
string getNextAction();
|
||||
Interruptible * getActionByMTGId(int mtgid);
|
||||
int loadNext();
|
||||
void cleanup();
|
||||
static int Log(const char * text);
|
||||
|
||||
};
|
||||
|
||||
class TestSuiteAI:public AIPlayerBaka{
|
||||
public:
|
||||
TestSuite * suite;
|
||||
float timer;
|
||||
|
||||
TestSuiteAI(TestSuite * suite, int playerId);
|
||||
virtual int Act(float dt);
|
||||
MTGCardInstance * getCard(string action);
|
||||
virtual int displayStack();
|
||||
class TestSuiteAI:public AIPlayerBaka
|
||||
{
|
||||
public:
|
||||
TestSuite * suite;
|
||||
float timer;
|
||||
|
||||
TestSuiteAI(TestSuite * suite, int playerId);
|
||||
virtual int Act(float dt);
|
||||
MTGCardInstance * getCard(string action);
|
||||
virtual int displayStack();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -7,49 +7,49 @@ class JLBFont;
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
class TextScroller: public JGuiObject{
|
||||
class TextScroller: public JGuiObject
|
||||
{
|
||||
protected:
|
||||
string mText;
|
||||
string tempText;
|
||||
int fontId;
|
||||
float mWidth; // width of the text scroller object
|
||||
float mScrollSpeed;
|
||||
float mX;
|
||||
float mY;
|
||||
float start;
|
||||
int timer;
|
||||
|
||||
vector<string> strings;
|
||||
unsigned int currentId;
|
||||
int mRandom;
|
||||
int scrollDirection;
|
||||
string mText;
|
||||
string tempText;
|
||||
int fontId;
|
||||
float mWidth; // width of the text scroller object
|
||||
float mScrollSpeed;
|
||||
float mX;
|
||||
float mY;
|
||||
float start;
|
||||
int timer;
|
||||
|
||||
vector<string> strings;
|
||||
unsigned int currentId;
|
||||
int mRandom;
|
||||
int scrollDirection;
|
||||
|
||||
public:
|
||||
TextScroller(int fontId, float x, float y, float width, float speed = 30);
|
||||
void Add(string text);
|
||||
void Reset();
|
||||
void setRandom(int mode = 1);
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
TextScroller(int fontId, float x, float y, float width, float speed = 30);
|
||||
void Add(string text);
|
||||
void Reset();
|
||||
void setRandom(int mode = 1);
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class VerticalTextScroller:
|
||||
public TextScroller
|
||||
class VerticalTextScroller: public TextScroller
|
||||
{
|
||||
private:
|
||||
size_t mNbItemsShown;
|
||||
float mHeight; // maximum height availble for display
|
||||
float mMarginX;
|
||||
float mMarginY; // margin used to allow text to scroll off screen without
|
||||
// affecting look and feel. Should be enough
|
||||
// for at least one line of text ( mY - line height of current font )
|
||||
float mOriginalY; // mY initially, used to restore scroller to original position after update
|
||||
size_t mNbItemsShown;
|
||||
float mHeight; // maximum height availble for display
|
||||
float mMarginX;
|
||||
float mMarginY; // margin used to allow text to scroll off screen without
|
||||
// affecting look and feel. Should be enough
|
||||
// for at least one line of text ( mY - line height of current font )
|
||||
float mOriginalY; // mY initially, used to restore scroller to original position after update
|
||||
|
||||
public:
|
||||
VerticalTextScroller(int fontId, float x, float y, float width, float height, float scrollSpeed = 30, size_t _minimumItems = 1);
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
void Add(string text);
|
||||
VerticalTextScroller(int fontId, float x, float y, float width, float height, float scrollSpeed = 30, size_t _minimumItems = 1);
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
void Add(string text);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Filter-like system for determining if a card meats certain criteria, for this and thisforeach autos
|
||||
*/
|
||||
Filter-like system for determining if a card meats certain criteria, for this and thisforeach autos
|
||||
*/
|
||||
|
||||
#ifndef _THISDESCRIPTOR_H_
|
||||
#define _THISDESCRIPTOR_H_
|
||||
@@ -10,91 +10,102 @@
|
||||
#include "MTGCardInstance.h"
|
||||
#include "CardDescriptor.h"
|
||||
|
||||
class ThisDescriptor{
|
||||
public:
|
||||
int comparisonMode;
|
||||
int comparisonCriterion;
|
||||
virtual int match(MTGCardInstance * card) = 0;
|
||||
int matchValue(int value);
|
||||
virtual ~ThisDescriptor();
|
||||
};
|
||||
|
||||
class ThisDescriptorFactory{
|
||||
class ThisDescriptor
|
||||
{
|
||||
public:
|
||||
ThisDescriptor * createThisDescriptor(string s);
|
||||
int comparisonMode;
|
||||
int comparisonCriterion;
|
||||
virtual int match(MTGCardInstance * card) = 0;
|
||||
int matchValue(int value);
|
||||
virtual ~ThisDescriptor();
|
||||
};
|
||||
|
||||
class ThisCounter:public ThisDescriptor{
|
||||
public:
|
||||
Counter * counter;
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
ThisCounter(Counter * _counter);
|
||||
ThisCounter(int power, int toughness, int nb, const char * name);
|
||||
~ThisCounter();
|
||||
class ThisDescriptorFactory
|
||||
{
|
||||
public:
|
||||
ThisDescriptor * createThisDescriptor(string s);
|
||||
};
|
||||
|
||||
class ThisCounterAny:public ThisDescriptor{
|
||||
public:
|
||||
virtual int match(MTGCardInstance *card);
|
||||
|
||||
ThisCounterAny(int nb);
|
||||
};
|
||||
|
||||
class ThisControllerlife:public ThisDescriptor{
|
||||
public:
|
||||
class ThisCounter: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
Counter * counter;
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
|
||||
ThisCounter(Counter * _counter);
|
||||
ThisCounter(int power, int toughness, int nb, const char * name);
|
||||
~ThisCounter();
|
||||
};
|
||||
|
||||
class ThisCounterAny: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
virtual int match(MTGCardInstance *card);
|
||||
|
||||
ThisCounterAny(int nb);
|
||||
};
|
||||
|
||||
class ThisControllerlife: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
ThisControllerlife(int life);
|
||||
};
|
||||
|
||||
class ThisOpponentlife:public ThisDescriptor{
|
||||
public:
|
||||
class ThisOpponentlife: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
|
||||
ThisOpponentlife(int olife);
|
||||
};
|
||||
|
||||
class ThisEquip:public ThisDescriptor{
|
||||
public:
|
||||
class ThisEquip: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
|
||||
ThisEquip(int equipment);
|
||||
};
|
||||
|
||||
|
||||
class ThisAttacked:public ThisDescriptor{
|
||||
public:
|
||||
class ThisAttacked: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
ThisAttacked(int attack);
|
||||
ThisAttacked(int attack);
|
||||
};
|
||||
|
||||
class ThisNotBlocked:public ThisDescriptor{
|
||||
public:
|
||||
class ThisNotBlocked: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
ThisNotBlocked(int unblocked);
|
||||
ThisNotBlocked(int unblocked);
|
||||
};
|
||||
|
||||
class ThisPower:public ThisDescriptor{
|
||||
public:
|
||||
class ThisPower: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
|
||||
ThisPower(int power);
|
||||
};
|
||||
|
||||
class ThisToughness:public ThisDescriptor{
|
||||
public:
|
||||
class ThisToughness: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
|
||||
ThisToughness(int toughness);
|
||||
};
|
||||
|
||||
class ThisX:public ThisDescriptor{
|
||||
public:
|
||||
class ThisX: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
ThisX(int x);
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef THREADING_H
|
||||
#define THREADING_H
|
||||
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
|
||||
#include <boost/date_time.hpp>
|
||||
@@ -18,7 +17,8 @@ namespace boost
|
||||
public:
|
||||
struct scoped_lock
|
||||
{
|
||||
scoped_lock(mutex& inMutex) : mID(inMutex.mID)
|
||||
scoped_lock(mutex& inMutex) :
|
||||
mID(inMutex.mID)
|
||||
{
|
||||
sceKernelWaitSema(mID, 1, 0);
|
||||
}
|
||||
@@ -43,9 +43,9 @@ namespace boost
|
||||
|
||||
int mID;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // THREADING_H
|
||||
#endif // THREADING_H
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
|
||||
#include "MTGCardInstance.h"
|
||||
|
||||
class Token: public MTGCardInstance{
|
||||
MTGCardInstance * tokenSource;
|
||||
class Token: public MTGCardInstance
|
||||
{
|
||||
MTGCardInstance * tokenSource;
|
||||
public:
|
||||
Token(string _name, MTGCardInstance * source, int _power=0, int _toughness=0);
|
||||
Token(string _name, MTGCardInstance * source, int _power = 0, int _toughness = 0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,37 +4,37 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
|
||||
#if defined _DEBUG
|
||||
#define DEBUG_TRANSLATE
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Translator{
|
||||
protected:
|
||||
static Translator * mInstance;
|
||||
bool initDone;
|
||||
|
||||
void load(string filename, map<string,string> * dictionary);
|
||||
class Translator
|
||||
{
|
||||
protected:
|
||||
static Translator * mInstance;
|
||||
bool initDone;
|
||||
|
||||
void load(string filename, map<string, string> * dictionary);
|
||||
public:
|
||||
map<string,string> values;
|
||||
map<string,string> tempValues;
|
||||
map<string,string> deckValues;
|
||||
map<string, string> values;
|
||||
map<string, string> tempValues;
|
||||
map<string, string> deckValues;
|
||||
#if defined DEBUG_TRANSLATE
|
||||
map<string,int> missingValues;
|
||||
map<string,int> dontCareValues;
|
||||
int checkMisses;
|
||||
map<string,int> missingValues;
|
||||
map<string,int> dontCareValues;
|
||||
int checkMisses;
|
||||
#endif
|
||||
string translate(string toTranslate);
|
||||
Translator();
|
||||
~Translator();
|
||||
int Add(string from, string to);
|
||||
void initCards();
|
||||
void initDecks();
|
||||
void init();
|
||||
static Translator * GetInstance();
|
||||
static void EndInstance();
|
||||
string translate(string toTranslate);
|
||||
Translator();
|
||||
~Translator();
|
||||
int Add(string from, string to);
|
||||
void initCards();
|
||||
void initDecks();
|
||||
void init();
|
||||
static Translator * GetInstance();
|
||||
static void EndInstance();
|
||||
};
|
||||
|
||||
string _(string toTranslate);
|
||||
|
||||
@@ -5,21 +5,21 @@
|
||||
#include "Pos.h"
|
||||
#include "WEvent.h"
|
||||
|
||||
template <class T> void trash(T*);
|
||||
template<class T> void trash(T*);
|
||||
class Trash
|
||||
{
|
||||
public:
|
||||
static void cleanup();
|
||||
public:
|
||||
static void cleanup();
|
||||
};
|
||||
|
||||
template <class T>
|
||||
template<class T>
|
||||
class TrashBin
|
||||
{
|
||||
std::vector<T*> bin;
|
||||
void put_out();
|
||||
int receiveEvent(WEvent* e);
|
||||
template <class Q> friend void trash(Q*);
|
||||
friend class Trash;
|
||||
std::vector<T*> bin;
|
||||
void put_out();
|
||||
int receiveEvent(WEvent* e);
|
||||
template<class Q> friend void trash(Q*);
|
||||
friend class Trash;
|
||||
};
|
||||
|
||||
#endif // _TRASH_H_
|
||||
|
||||
@@ -8,114 +8,132 @@
|
||||
#define INVALID_MTEX -1
|
||||
#endif
|
||||
|
||||
class WResource{
|
||||
class WResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
friend struct WCacheSort;
|
||||
template<class cacheItem,class cacheActual> friend class WCache;
|
||||
friend class WResourceManager;
|
||||
friend struct WCacheSort;
|
||||
template<class cacheItem, class cacheActual> friend class WCache;
|
||||
|
||||
WResource();
|
||||
virtual ~WResource();
|
||||
|
||||
virtual unsigned long size()=0; //Size of cached item in bytes.
|
||||
virtual bool isGood()=0; //Return true if this has data.
|
||||
virtual bool isLocked(); //Is the resource locked?
|
||||
virtual void lock(); //Lock it.
|
||||
virtual void unlock(bool force = false); //Unlock it. Forcing a lock will also remove "permanent" status.
|
||||
WResource();
|
||||
virtual ~WResource();
|
||||
|
||||
bool isPermanent(); //Is the resource permanent?
|
||||
void deadbolt(); //Make it permanent.
|
||||
void hit(); //Update resource's last used time.
|
||||
virtual unsigned long size()=0; //Size of cached item in bytes.
|
||||
virtual bool isGood()=0; //Return true if this has data.
|
||||
virtual bool isLocked(); //Is the resource locked?
|
||||
virtual void lock(); //Lock it.
|
||||
virtual void unlock(bool force = false); //Unlock it. Forcing a lock will also remove "permanent" status.
|
||||
|
||||
bool isPermanent(); //Is the resource permanent?
|
||||
void deadbolt(); //Make it permanent.
|
||||
void hit(); //Update resource's last used time.
|
||||
|
||||
protected:
|
||||
int loadedMode; //What submode settings were we loaded with? (For refresh)
|
||||
unsigned int lastTime; //When was the last time we were hit?
|
||||
unsigned char locks; //Remember to unlock when we're done using locked stuff, or else this'll be useless.
|
||||
int loadedMode; //What submode settings were we loaded with? (For refresh)
|
||||
unsigned int lastTime; //When was the last time we were hit?
|
||||
unsigned char locks; //Remember to unlock when we're done using locked stuff, or else this'll be useless.
|
||||
};
|
||||
|
||||
class WCachedResource: public WResource {
|
||||
class WCachedResource: public WResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
template<class cacheItem,class cacheActual> friend class WCache;
|
||||
friend class WResourceManager;
|
||||
template<class cacheItem, class cacheActual> friend class WCache;
|
||||
|
||||
virtual ~WCachedResource();
|
||||
virtual ~WCachedResource();
|
||||
|
||||
string mFilename;
|
||||
virtual void Refresh()=0; //Basically calls Attempt(filename) and remaps in situ.
|
||||
virtual bool Attempt(string filename, int submode, int & error)=0; //Returns true if we've loaded our data and isGood().
|
||||
string mFilename;
|
||||
virtual void Refresh()=0; //Basically calls Attempt(filename) and remaps in situ.
|
||||
virtual bool Attempt(string filename, int submode, int & error)=0; //Returns true if we've loaded our data and isGood().
|
||||
};
|
||||
|
||||
|
||||
class WTrackedQuad: public WResource {
|
||||
class WTrackedQuad: public WResource
|
||||
{
|
||||
public:
|
||||
WTrackedQuad(string _resname);
|
||||
~WTrackedQuad();
|
||||
bool isGood();
|
||||
unsigned long size();
|
||||
string resname;
|
||||
JQuad * quad;
|
||||
WTrackedQuad(string _resname);
|
||||
~WTrackedQuad();
|
||||
bool isGood();
|
||||
unsigned long size();
|
||||
string resname;
|
||||
JQuad * quad;
|
||||
};
|
||||
|
||||
class WCachedTexture: public WCachedResource{
|
||||
class WCachedTexture: public WCachedResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
template<class cacheItem,class cacheActual> friend class WCache;
|
||||
WCachedTexture();
|
||||
~WCachedTexture();
|
||||
friend class WResourceManager;
|
||||
template<class cacheItem, class cacheActual> friend class WCache;
|
||||
WCachedTexture();
|
||||
~WCachedTexture();
|
||||
|
||||
void Refresh();
|
||||
unsigned long size();
|
||||
bool isGood();
|
||||
bool isLocked(); //Is the resource locked?
|
||||
bool Attempt(string filename, int submode, int & error);
|
||||
bool compare(JTexture * t) {return (t == texture);};
|
||||
JTexture * Actual(); //Return this texture as is. Does not make a new one.
|
||||
JQuad * GetQuad(string resname);
|
||||
|
||||
WTrackedQuad* GetTrackedQuad(float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f,string resname=""); //Get us a new/existing quad.
|
||||
void Refresh();
|
||||
unsigned long size();
|
||||
bool isGood();
|
||||
bool isLocked(); //Is the resource locked?
|
||||
bool Attempt(string filename, int submode, int & error);
|
||||
bool compare(JTexture * t)
|
||||
{
|
||||
return (t == texture);
|
||||
}
|
||||
;
|
||||
JTexture * Actual(); //Return this texture as is. Does not make a new one.
|
||||
JQuad * GetQuad(string resname);
|
||||
|
||||
JQuad * GetQuad(float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f,string resname=""); //Alias to GetTrackedQuad.
|
||||
JQuad * GetCard(float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f,string resname=""); //Same as above, but centered when new.
|
||||
WTrackedQuad
|
||||
* GetTrackedQuad(float offX = 0.0f, float offY = 0.0f, float width = 0.0f, float height = 0.0f, string resname = ""); //Get us a new/existing quad.
|
||||
|
||||
bool ReleaseQuad(JQuad* quad); //We're done with this quad, so delete and stop tracking. True if existed.
|
||||
protected:
|
||||
JTexture * texture;
|
||||
vector<WTrackedQuad*> trackedQuads;
|
||||
JQuad * GetQuad(float offX = 0.0f, float offY = 0.0f, float width = 0.0f, float height = 0.0f, string resname = ""); //Alias to GetTrackedQuad.
|
||||
JQuad * GetCard(float offX = 0.0f, float offY = 0.0f, float width = 0.0f, float height = 0.0f, string resname = ""); //Same as above, but centered when new.
|
||||
|
||||
bool ReleaseQuad(JQuad* quad); //We're done with this quad, so delete and stop tracking. True if existed.
|
||||
protected:
|
||||
JTexture * texture;
|
||||
vector<WTrackedQuad*> trackedQuads;
|
||||
};
|
||||
|
||||
class WCachedParticles: public WCachedResource{
|
||||
class WCachedParticles: public WCachedResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
template<class cacheItem,class cacheActual> friend class WCache;
|
||||
WCachedParticles();
|
||||
~WCachedParticles();
|
||||
void Refresh();
|
||||
unsigned long size();
|
||||
|
||||
bool isGood();
|
||||
bool Attempt(string filename, int submode, int & error);
|
||||
bool compare(hgeParticleSystemInfo * p) {return (p == particles);};
|
||||
friend class WResourceManager;
|
||||
template<class cacheItem, class cacheActual> friend class WCache;
|
||||
WCachedParticles();
|
||||
~WCachedParticles();
|
||||
void Refresh();
|
||||
unsigned long size();
|
||||
|
||||
hgeParticleSystemInfo * Actual();
|
||||
protected:
|
||||
hgeParticleSystemInfo * particles;
|
||||
bool isGood();
|
||||
bool Attempt(string filename, int submode, int & error);
|
||||
bool compare(hgeParticleSystemInfo * p)
|
||||
{
|
||||
return (p == particles);
|
||||
}
|
||||
;
|
||||
|
||||
hgeParticleSystemInfo * Actual();
|
||||
protected:
|
||||
hgeParticleSystemInfo * particles;
|
||||
};
|
||||
|
||||
class WCachedSample: public WCachedResource{
|
||||
class WCachedSample: public WCachedResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
template<class cacheItem,class cacheActual> friend class WCache;
|
||||
WCachedSample();
|
||||
~WCachedSample();
|
||||
bool compare(JSample * s) {return (s == sample);};
|
||||
unsigned long size();
|
||||
bool isGood();
|
||||
void Refresh();
|
||||
bool Attempt(string filename, int submode, int & error);
|
||||
friend class WResourceManager;
|
||||
template<class cacheItem, class cacheActual> friend class WCache;
|
||||
WCachedSample();
|
||||
~WCachedSample();
|
||||
bool compare(JSample * s)
|
||||
{
|
||||
return (s == sample);
|
||||
}
|
||||
;
|
||||
unsigned long size();
|
||||
bool isGood();
|
||||
void Refresh();
|
||||
bool Attempt(string filename, int submode, int & error);
|
||||
|
||||
JSample * Actual(); //Return this sample.
|
||||
protected:
|
||||
JSample * sample;
|
||||
JSample * Actual(); //Return this sample.
|
||||
protected:
|
||||
JSample * sample;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,191 +10,383 @@ class MTGDeck;
|
||||
class MTGAllCards;
|
||||
class JQuad;
|
||||
|
||||
class WSyncable{
|
||||
class WSyncable
|
||||
{
|
||||
public:
|
||||
WSyncable(int i=0) {hooked = NULL;currentPos = 0;};
|
||||
virtual ~WSyncable() {};
|
||||
//Local
|
||||
virtual bool Hook(WSyncable* s);
|
||||
virtual int getOffset() {return currentPos;};
|
||||
virtual bool setOffset(int i) {currentPos = i; return true;};
|
||||
//Recursive
|
||||
virtual int getPos();
|
||||
virtual bool next();
|
||||
virtual bool prev();
|
||||
WSyncable(int i = 0)
|
||||
{
|
||||
hooked = NULL;
|
||||
currentPos = 0;
|
||||
}
|
||||
;
|
||||
virtual ~WSyncable()
|
||||
{
|
||||
}
|
||||
;
|
||||
//Local
|
||||
virtual bool Hook(WSyncable* s);
|
||||
virtual int getOffset()
|
||||
{
|
||||
return currentPos;
|
||||
}
|
||||
;
|
||||
virtual bool setOffset(int i)
|
||||
{
|
||||
currentPos = i;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
//Recursive
|
||||
virtual int getPos();
|
||||
virtual bool next();
|
||||
virtual bool prev();
|
||||
protected:
|
||||
WSyncable * hooked; //Simple link list
|
||||
int currentPos;
|
||||
WSyncable * hooked; //Simple link list
|
||||
int currentPos;
|
||||
};
|
||||
|
||||
class WDataSource: public WSyncable{
|
||||
class WDataSource: public WSyncable
|
||||
{
|
||||
public:
|
||||
WDataSource() {};
|
||||
virtual JQuad * getImage(int offset=0) {return NULL;};
|
||||
virtual JQuad * getThumb(int offset=0) {return NULL;};
|
||||
virtual MTGCard * getCard(int offset=0, bool ignore=false) {return NULL;};
|
||||
virtual MTGDeck * getDeck(int offset=0) {return NULL;};
|
||||
virtual WDistort * getDistort(int offset=0) {return NULL;};
|
||||
virtual bool thisCard(int mtgid) {return false;};
|
||||
virtual int getControlID() {return -1;}; //TODO FIXME: Need a "not a valid button" define.
|
||||
virtual void Update(float dt) {mLastInput += dt;};
|
||||
virtual void Touch() {mLastInput = 0;};
|
||||
virtual float getElapsed() {return mLastInput;};
|
||||
virtual void setElapsed(float f) {mLastInput = f;};
|
||||
WDataSource()
|
||||
{
|
||||
}
|
||||
;
|
||||
virtual JQuad * getImage(int offset = 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
;
|
||||
virtual JQuad * getThumb(int offset = 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
;
|
||||
virtual MTGCard * getCard(int offset = 0, bool ignore = false)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
;
|
||||
virtual MTGDeck * getDeck(int offset = 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
;
|
||||
virtual WDistort * getDistort(int offset = 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
;
|
||||
virtual bool thisCard(int mtgid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
virtual int getControlID()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
; //TODO FIXME: Need a "not a valid button" define.
|
||||
virtual void Update(float dt)
|
||||
{
|
||||
mLastInput += dt;
|
||||
}
|
||||
;
|
||||
virtual void Touch()
|
||||
{
|
||||
mLastInput = 0;
|
||||
}
|
||||
;
|
||||
virtual float getElapsed()
|
||||
{
|
||||
return mLastInput;
|
||||
}
|
||||
;
|
||||
virtual void setElapsed(float f)
|
||||
{
|
||||
mLastInput = f;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
float mLastInput;
|
||||
float mLastInput;
|
||||
};
|
||||
|
||||
class WSrcImage: public WDataSource{
|
||||
class WSrcImage: public WDataSource
|
||||
{
|
||||
public:
|
||||
virtual JQuad * getImage(int offset=0);
|
||||
WSrcImage(string s);
|
||||
virtual JQuad * getImage(int offset = 0);
|
||||
WSrcImage(string s);
|
||||
|
||||
protected:
|
||||
string filename;
|
||||
string filename;
|
||||
};
|
||||
|
||||
class WSrcCards: public WDataSource{
|
||||
class WSrcCards: public WDataSource
|
||||
{
|
||||
protected:
|
||||
vector<MTGCard*> cards;
|
||||
vector<size_t> validated;
|
||||
WCardFilter * filtersRoot;
|
||||
float mDelay;
|
||||
vector<MTGCard*> cards;
|
||||
vector<size_t> validated;
|
||||
WCardFilter * filtersRoot;
|
||||
float mDelay;
|
||||
|
||||
public:
|
||||
WSrcCards(float delay=0.2);
|
||||
~WSrcCards();
|
||||
|
||||
virtual JQuad * getImage(int offset=0);
|
||||
virtual JQuad * getThumb(int offset=0);
|
||||
virtual MTGCard * getCard(int offset=0, bool ignore=false);
|
||||
WSrcCards(float delay = 0.2);
|
||||
~WSrcCards();
|
||||
|
||||
virtual int Size(bool all=false); //Returns the number of cards, or the number of cards that match the filter.
|
||||
virtual JQuad * getImage(int offset = 0);
|
||||
virtual JQuad * getThumb(int offset = 0);
|
||||
virtual MTGCard * getCard(int offset = 0, bool ignore = false);
|
||||
|
||||
virtual void Shuffle();
|
||||
virtual bool thisCard(int mtgid);
|
||||
virtual bool next();
|
||||
virtual bool prev();
|
||||
|
||||
virtual void Sort(int method);
|
||||
virtual bool setOffset(int pos);
|
||||
virtual bool isEmptySet(WCardFilter * f);
|
||||
virtual void addFilter(WCardFilter * f);
|
||||
virtual void clearFilters();
|
||||
virtual WCardFilter* unhookFilters();
|
||||
virtual bool matchesFilters(MTGCard * c);
|
||||
virtual void validate();
|
||||
virtual void bakeFilters(); //Discards all invalidated cards.
|
||||
virtual float filterFee();
|
||||
|
||||
virtual void updateCounts() {};
|
||||
virtual void clearCounts() {};
|
||||
virtual void addCount(MTGCard * c, int qty=1) {};
|
||||
virtual int Size(bool all = false); //Returns the number of cards, or the number of cards that match the filter.
|
||||
|
||||
//Loads into us. Calls validate()
|
||||
virtual int loadMatches(MTGAllCards* ac); //loadMatches adds the cards from something
|
||||
virtual int loadMatches(MTGDeck * deck); //into this, if it matches our filter
|
||||
virtual int loadMatches(WSrcCards* src, bool all=false); //If all==true, ignore filters on src.
|
||||
|
||||
//We put it into something else
|
||||
virtual int addRandomCards(MTGDeck * i, int howmany=1);
|
||||
virtual int addToDeck(MTGDeck * i, int num=-1); //Returns num that didn't add
|
||||
virtual WCardFilter * getFiltersRoot(){return filtersRoot;};
|
||||
virtual void Shuffle();
|
||||
virtual bool thisCard(int mtgid);
|
||||
virtual bool next();
|
||||
virtual bool prev();
|
||||
|
||||
enum {
|
||||
MAX_CYCLES = 4, //How many cycles to search, for addToDeck
|
||||
SORT_COLLECTOR,
|
||||
SORT_ALPHA,
|
||||
SORT_RARITY
|
||||
};
|
||||
virtual void Sort(int method);
|
||||
virtual bool setOffset(int pos);
|
||||
virtual bool isEmptySet(WCardFilter * f);
|
||||
virtual void addFilter(WCardFilter * f);
|
||||
virtual void clearFilters();
|
||||
virtual WCardFilter* unhookFilters();
|
||||
virtual bool matchesFilters(MTGCard * c);
|
||||
virtual void validate();
|
||||
virtual void bakeFilters(); //Discards all invalidated cards.
|
||||
virtual float filterFee();
|
||||
|
||||
virtual void updateCounts() {};
|
||||
virtual void clearCounts() {};
|
||||
virtual void addCount(MTGCard * c, int qty = 1) {};
|
||||
|
||||
//Loads into us. Calls validate()
|
||||
virtual int loadMatches(MTGAllCards* ac); //loadMatches adds the cards from something
|
||||
virtual int loadMatches(MTGDeck * deck); //into this, if it matches our filter
|
||||
virtual int loadMatches(WSrcCards* src, bool all = false); //If all==true, ignore filters on src.
|
||||
|
||||
//We put it into something else
|
||||
virtual int addRandomCards(MTGDeck * i, int howmany = 1);
|
||||
virtual int addToDeck(MTGDeck * i, int num = -1); //Returns num that didn't add
|
||||
virtual WCardFilter * getFiltersRoot()
|
||||
{
|
||||
return filtersRoot;
|
||||
}
|
||||
;
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_CYCLES = 4, //How many cycles to search, for addToDeck
|
||||
SORT_COLLECTOR,
|
||||
SORT_ALPHA,
|
||||
SORT_RARITY
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class WSrcDeckViewer: public WSrcCards{
|
||||
class WSrcDeckViewer: public WSrcCards
|
||||
{
|
||||
public:
|
||||
WSrcDeckViewer(WSrcCards * _active, WSrcCards * _inactive);
|
||||
~WSrcDeckViewer();
|
||||
void swapSrc();
|
||||
WSrcDeckViewer(WSrcCards * _active, WSrcCards * _inactive);
|
||||
~WSrcDeckViewer();
|
||||
void swapSrc();
|
||||
|
||||
//Wrapped functions
|
||||
JQuad * getImage(int offset=0) {return active->getImage(offset);};
|
||||
JQuad * getThumb(int offset=0) {return active->getThumb(offset);};
|
||||
MTGCard * getCard(int offset=0, bool ignore=false) {return active->getCard(offset,ignore);};
|
||||
int Size(bool all=false) {return active->Size();};
|
||||
WCardFilter * getfiltersRoot() {return active->getFiltersRoot();};
|
||||
void Shuffle() {active->Shuffle();};
|
||||
bool thisCard(int mtgid) {return active->thisCard(mtgid);};
|
||||
bool next() {return active->next();};
|
||||
bool prev() {return active->prev();};
|
||||
void Sort(int method) {active->Sort(method);};
|
||||
bool setOffset(int pos) {return active->setOffset(pos);};
|
||||
bool isEmptySet(WCardFilter * f) {return active->isEmptySet(f);};
|
||||
void addFilter(WCardFilter * f) {active->addFilter(f);};
|
||||
void clearFilters() {active->clearFilters();};
|
||||
WCardFilter* unhookFilters() {return active->unhookFilters();};
|
||||
bool matchesFilters(MTGCard * c) {return active->matchesFilters(c);};
|
||||
void validate() {active->validate();};
|
||||
void bakeFilters() {active->bakeFilters();}; //Discards all invalidated cards.
|
||||
float filterFee() {return active->filterFee();};
|
||||
void updateCounts() {active->updateCounts();};
|
||||
void clearCounts() {active->clearCounts();};
|
||||
void addCount(MTGCard * c, int qty=1) { active->addCount(c,qty); };
|
||||
int loadMatches(MTGAllCards* ac) {return active->loadMatches(ac);};
|
||||
int loadMatches(MTGDeck * deck) {return active->loadMatches(deck);};
|
||||
int loadMatches(WSrcCards* src, bool all=false) {return loadMatches(src,all);};
|
||||
int addRandomCards(MTGDeck * i, int howmany=1) {return active->addRandomCards(i,howmany);};
|
||||
int addToDeck(MTGDeck * i, int num=-1) {return active->addToDeck(i,num);};
|
||||
//Wrapped functions
|
||||
JQuad * getImage(int offset = 0)
|
||||
{
|
||||
return active->getImage(offset);
|
||||
}
|
||||
;
|
||||
JQuad * getThumb(int offset = 0)
|
||||
{
|
||||
return active->getThumb(offset);
|
||||
}
|
||||
;
|
||||
MTGCard * getCard(int offset = 0, bool ignore = false)
|
||||
{
|
||||
return active->getCard(offset, ignore);
|
||||
}
|
||||
;
|
||||
int Size(bool all = false)
|
||||
{
|
||||
return active->Size();
|
||||
}
|
||||
;
|
||||
WCardFilter * getfiltersRoot()
|
||||
{
|
||||
return active->getFiltersRoot();
|
||||
}
|
||||
;
|
||||
void Shuffle()
|
||||
{
|
||||
active->Shuffle();
|
||||
}
|
||||
;
|
||||
bool thisCard(int mtgid)
|
||||
{
|
||||
return active->thisCard(mtgid);
|
||||
}
|
||||
;
|
||||
bool next()
|
||||
{
|
||||
return active->next();
|
||||
}
|
||||
;
|
||||
bool prev()
|
||||
{
|
||||
return active->prev();
|
||||
}
|
||||
;
|
||||
void Sort(int method)
|
||||
{
|
||||
active->Sort(method);
|
||||
}
|
||||
;
|
||||
bool setOffset(int pos)
|
||||
{
|
||||
return active->setOffset(pos);
|
||||
}
|
||||
;
|
||||
bool isEmptySet(WCardFilter * f)
|
||||
{
|
||||
return active->isEmptySet(f);
|
||||
}
|
||||
;
|
||||
void addFilter(WCardFilter * f)
|
||||
{
|
||||
active->addFilter(f);
|
||||
}
|
||||
;
|
||||
void clearFilters()
|
||||
{
|
||||
active->clearFilters();
|
||||
}
|
||||
;
|
||||
WCardFilter* unhookFilters()
|
||||
{
|
||||
return active->unhookFilters();
|
||||
}
|
||||
;
|
||||
bool matchesFilters(MTGCard * c)
|
||||
{
|
||||
return active->matchesFilters(c);
|
||||
}
|
||||
;
|
||||
void validate()
|
||||
{
|
||||
active->validate();
|
||||
}
|
||||
;
|
||||
void bakeFilters()
|
||||
{
|
||||
active->bakeFilters();
|
||||
}
|
||||
; //Discards all invalidated cards.
|
||||
float filterFee()
|
||||
{
|
||||
return active->filterFee();
|
||||
}
|
||||
;
|
||||
void updateCounts()
|
||||
{
|
||||
active->updateCounts();
|
||||
}
|
||||
;
|
||||
void clearCounts()
|
||||
{
|
||||
active->clearCounts();
|
||||
}
|
||||
;
|
||||
void addCount(MTGCard * c, int qty = 1)
|
||||
{
|
||||
active->addCount(c, qty);
|
||||
}
|
||||
;
|
||||
int loadMatches(MTGAllCards* ac)
|
||||
{
|
||||
return active->loadMatches(ac);
|
||||
}
|
||||
;
|
||||
int loadMatches(MTGDeck * deck)
|
||||
{
|
||||
return active->loadMatches(deck);
|
||||
}
|
||||
;
|
||||
int loadMatches(WSrcCards* src, bool all = false)
|
||||
{
|
||||
return loadMatches(src, all);
|
||||
}
|
||||
;
|
||||
int addRandomCards(MTGDeck * i, int howmany = 1)
|
||||
{
|
||||
return active->addRandomCards(i, howmany);
|
||||
}
|
||||
;
|
||||
int addToDeck(MTGDeck * i, int num = -1)
|
||||
{
|
||||
return active->addToDeck(i, num);
|
||||
}
|
||||
;
|
||||
protected:
|
||||
WSrcCards * active;
|
||||
WSrcCards * inactive;
|
||||
WSrcCards * active;
|
||||
WSrcCards * inactive;
|
||||
};
|
||||
|
||||
class WSrcUnlockedCards: public WSrcCards{ //Only unlocked cards.
|
||||
class WSrcUnlockedCards: public WSrcCards
|
||||
{ //Only unlocked cards.
|
||||
public:
|
||||
WSrcUnlockedCards(float mDelay=0.2);
|
||||
WSrcUnlockedCards(float mDelay = 0.2);
|
||||
};
|
||||
|
||||
class WSrcDeck: public WSrcCards{
|
||||
class WSrcDeck: public WSrcCards
|
||||
{
|
||||
public:
|
||||
WSrcDeck(float delay=0.2) : WSrcCards(delay) {clearCounts();};
|
||||
virtual int loadMatches(MTGDeck * deck);
|
||||
virtual int Add(MTGCard * c, int quantity=1);
|
||||
virtual int Remove(MTGCard * c, int quantity=1, bool erase=false);
|
||||
void Rebuild(MTGDeck * d);
|
||||
int count(MTGCard * c);
|
||||
int countByName(MTGCard * card, bool editions=false);
|
||||
int totalPrice();
|
||||
enum {
|
||||
//0 to MTG_NB_COLORS are colors. See MTG_COLOR_ in Constants::.
|
||||
UNFILTERED_COPIES = Constants::MTG_NB_COLORS,
|
||||
UNFILTERED_UNIQUE,
|
||||
UNFILTERED_MIN_COPIES, //For 'unlock all' cheat, awards screen
|
||||
UNFILTERED_MAX_COPIES, //future use in format restriction, awards screen
|
||||
FILTERED_COPIES,
|
||||
FILTERED_UNIQUE,
|
||||
MAX_COUNTS
|
||||
};
|
||||
void clearCounts();
|
||||
void updateCounts();
|
||||
void addCount(MTGCard * c, int qty=1);
|
||||
int getCount(int count=UNFILTERED_COPIES);
|
||||
WSrcDeck(float delay = 0.2) :
|
||||
WSrcCards(delay)
|
||||
{
|
||||
clearCounts();
|
||||
}
|
||||
;
|
||||
virtual int loadMatches(MTGDeck * deck);
|
||||
virtual int Add(MTGCard * c, int quantity = 1);
|
||||
virtual int Remove(MTGCard * c, int quantity = 1, bool erase = false);
|
||||
void Rebuild(MTGDeck * d);
|
||||
int count(MTGCard * c);
|
||||
int countByName(MTGCard * card, bool editions = false);
|
||||
int totalPrice();
|
||||
enum
|
||||
{
|
||||
//0 to MTG_NB_COLORS are colors. See MTG_COLOR_ in Constants::.
|
||||
UNFILTERED_COPIES = Constants::MTG_NB_COLORS,
|
||||
UNFILTERED_UNIQUE,
|
||||
UNFILTERED_MIN_COPIES, //For 'unlock all' cheat, awards screen
|
||||
UNFILTERED_MAX_COPIES, //future use in format restriction, awards screen
|
||||
FILTERED_COPIES,
|
||||
FILTERED_UNIQUE,
|
||||
MAX_COUNTS
|
||||
};
|
||||
void clearCounts();
|
||||
void updateCounts();
|
||||
void addCount(MTGCard * c, int qty = 1);
|
||||
int getCount(int count = UNFILTERED_COPIES);
|
||||
protected:
|
||||
map<int,int> copies; //Maps MTGID to card counts.
|
||||
int counts[MAX_COUNTS];
|
||||
map<int, int> copies; //Maps MTGID to card counts.
|
||||
int counts[MAX_COUNTS];
|
||||
};
|
||||
|
||||
struct WCSortCollector{
|
||||
bool operator()(const MTGCard*l, const MTGCard*r);
|
||||
struct WCSortCollector
|
||||
{
|
||||
bool operator()(const MTGCard*l, const MTGCard*r);
|
||||
};
|
||||
|
||||
struct WCSortAlpha{
|
||||
bool operator()(const MTGCard*l, const MTGCard*r);
|
||||
struct WCSortAlpha
|
||||
{
|
||||
bool operator()(const MTGCard*l, const MTGCard*r);
|
||||
};
|
||||
|
||||
struct WCSortRarity{
|
||||
int rareToInt(char r);
|
||||
bool operator()(const MTGCard*l, const MTGCard*r);
|
||||
struct WCSortRarity
|
||||
{
|
||||
int rareToInt(char r);
|
||||
bool operator()(const MTGCard*l, const MTGCard*r);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,189 +26,217 @@ public:
|
||||
TARGET_FROM,
|
||||
};
|
||||
int type; //Deprecated, use dynamic casting instead
|
||||
WEvent(int type = NOT_SPECIFIED);
|
||||
virtual ~WEvent() {};
|
||||
virtual std::ostream& toString(std::ostream& out) const;
|
||||
virtual int getValue() {return 0;};
|
||||
virtual Targetable * getTarget(int target) {return 0;};
|
||||
WEvent(int type = NOT_SPECIFIED);
|
||||
virtual ~WEvent() {};
|
||||
virtual std::ostream& toString(std::ostream& out) const;
|
||||
virtual int getValue()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual Targetable * getTarget(int target)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
struct WEventZoneChange : public WEvent {
|
||||
MTGCardInstance * card;
|
||||
MTGGameZone * from;
|
||||
MTGGameZone * to;
|
||||
WEventZoneChange(MTGCardInstance * card, MTGGameZone * from, MTGGameZone *to);
|
||||
virtual ~WEventZoneChange() {};
|
||||
virtual std::ostream& toString(std::ostream& out) const;
|
||||
virtual Targetable * getTarget(int target);
|
||||
struct WEventZoneChange: public WEvent
|
||||
{
|
||||
MTGCardInstance * card;
|
||||
MTGGameZone * from;
|
||||
MTGGameZone * to;
|
||||
WEventZoneChange(MTGCardInstance * card, MTGGameZone * from, MTGGameZone *to);
|
||||
virtual ~WEventZoneChange() {};
|
||||
virtual std::ostream& toString(std::ostream& out) const;
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
|
||||
struct WEventDamage : public WEvent {
|
||||
Damage * damage;
|
||||
WEventDamage(Damage * damage);
|
||||
virtual std::ostream& toString(std::ostream& out) const;
|
||||
virtual int getValue();
|
||||
virtual Targetable * getTarget(int target);
|
||||
struct WEventDamage: public WEvent
|
||||
{
|
||||
Damage * damage;
|
||||
WEventDamage(Damage * damage);
|
||||
virtual std::ostream& toString(std::ostream& out) const;
|
||||
virtual int getValue();
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
struct WEventDamageStackResolved : public WEvent {
|
||||
WEventDamageStackResolved();
|
||||
struct WEventDamageStackResolved: public WEvent
|
||||
{
|
||||
WEventDamageStackResolved();
|
||||
};
|
||||
|
||||
struct WEventPhaseChange : public WEvent {
|
||||
Phase * from;
|
||||
Phase * to;
|
||||
WEventPhaseChange(Phase * from, Phase * to);
|
||||
struct WEventPhaseChange: public WEvent
|
||||
{
|
||||
Phase * from;
|
||||
Phase * to;
|
||||
WEventPhaseChange(Phase * from, Phase * to);
|
||||
};
|
||||
|
||||
|
||||
//Abstract class of event when a card's status changes
|
||||
struct WEventCardUpdate : public WEvent {
|
||||
MTGCardInstance * card;
|
||||
WEventCardUpdate(MTGCardInstance * card);
|
||||
struct WEventCardUpdate: public WEvent
|
||||
{
|
||||
MTGCardInstance * card;
|
||||
WEventCardUpdate(MTGCardInstance * card);
|
||||
};
|
||||
|
||||
//Event when a card gains/looses types
|
||||
struct WEventCardChangeType : public WEventCardUpdate {
|
||||
int type;
|
||||
bool before;
|
||||
bool after;
|
||||
WEventCardChangeType(MTGCardInstance * card, int type, bool before, bool after);
|
||||
struct WEventCardChangeType: public WEventCardUpdate
|
||||
{
|
||||
int type;
|
||||
bool before;
|
||||
bool after;
|
||||
WEventCardChangeType(MTGCardInstance * card, int type, bool before, bool after);
|
||||
};
|
||||
|
||||
//Event when a card is tapped/untapped
|
||||
struct WEventCardTap : public WEventCardUpdate {
|
||||
bool before;
|
||||
bool after;
|
||||
WEventCardTap(MTGCardInstance * card, bool before, bool after);
|
||||
virtual Targetable * getTarget(int target);
|
||||
struct WEventCardTap: public WEventCardUpdate
|
||||
{
|
||||
bool before;
|
||||
bool after;
|
||||
WEventCardTap(MTGCardInstance * card, bool before, bool after);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
struct WEventCardTappedForMana : public WEventCardUpdate {
|
||||
bool before;
|
||||
bool after;
|
||||
WEventCardTappedForMana(MTGCardInstance * card, bool before, bool after);
|
||||
virtual Targetable * getTarget(int target);
|
||||
struct WEventCardTappedForMana: public WEventCardUpdate
|
||||
{
|
||||
bool before;
|
||||
bool after;
|
||||
WEventCardTappedForMana(MTGCardInstance * card, bool before, bool after);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
|
||||
//Event when a card's "attacker" status changes
|
||||
//before:Player/Planeswalker that card was attacking previously
|
||||
//after: Player/Planeswalker that card is attacking now
|
||||
struct WEventCreatureAttacker : public WEventCardUpdate {
|
||||
Targetable * before;
|
||||
Targetable * after;
|
||||
WEventCreatureAttacker(MTGCardInstance * card, Targetable * from, Targetable * to);
|
||||
struct WEventCreatureAttacker: public WEventCardUpdate
|
||||
{
|
||||
Targetable * before;
|
||||
Targetable * after;
|
||||
WEventCreatureAttacker(MTGCardInstance * card, Targetable * from, Targetable * to);
|
||||
};
|
||||
|
||||
//event when card attacks.
|
||||
struct WEventCardAttacked : public WEventCardUpdate {
|
||||
WEventCardAttacked(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
struct WEventCardAttacked: public WEventCardUpdate
|
||||
{
|
||||
WEventCardAttacked(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card attacks alone.
|
||||
struct WEventCardAttackedAlone : public WEventCardUpdate {
|
||||
WEventCardAttackedAlone(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
struct WEventCardAttackedAlone: public WEventCardUpdate
|
||||
{
|
||||
WEventCardAttackedAlone(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card attacks but is not blocked.
|
||||
struct WEventCardAttackedNotBlocked : public WEventCardUpdate {
|
||||
WEventCardAttackedNotBlocked(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
struct WEventCardAttackedNotBlocked: public WEventCardUpdate
|
||||
{
|
||||
WEventCardAttackedNotBlocked(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card attacks but is blocked.
|
||||
struct WEventCardAttackedBlocked : public WEventCardUpdate {
|
||||
WEventCardAttackedBlocked(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
struct WEventCardAttackedBlocked: public WEventCardUpdate
|
||||
{
|
||||
WEventCardAttackedBlocked(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card blocked.
|
||||
struct WEventCardBlocked : public WEventCardUpdate {
|
||||
WEventCardBlocked(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
struct WEventCardBlocked: public WEventCardUpdate
|
||||
{
|
||||
WEventCardBlocked(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card is sacrificed.
|
||||
struct WEventCardSacrifice : public WEventCardUpdate {
|
||||
WEventCardSacrifice(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
struct WEventCardSacrifice: public WEventCardUpdate
|
||||
{
|
||||
WEventCardSacrifice(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card is discarded.
|
||||
struct WEventCardDiscard : public WEventCardUpdate {
|
||||
WEventCardDiscard(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
struct WEventCardDiscard: public WEventCardUpdate
|
||||
{
|
||||
WEventCardDiscard(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//Event when a card's "defenser" status changes
|
||||
//before : attacker that card was blocking previously
|
||||
//after: attacker that card is blocking now
|
||||
struct WEventCreatureBlocker : public WEventCardUpdate {
|
||||
MTGCardInstance * before;
|
||||
MTGCardInstance * after;
|
||||
WEventCreatureBlocker(MTGCardInstance * card,MTGCardInstance * from,MTGCardInstance * to);
|
||||
struct WEventCreatureBlocker: public WEventCardUpdate
|
||||
{
|
||||
MTGCardInstance * before;
|
||||
MTGCardInstance * after;
|
||||
WEventCreatureBlocker(MTGCardInstance * card, MTGCardInstance * from, MTGCardInstance * to);
|
||||
};
|
||||
|
||||
//Event sent when attackers have been chosen and they
|
||||
//cannot be changed any more.
|
||||
struct WEventAttackersChosen : public WEvent {
|
||||
struct WEventAttackersChosen: public WEvent
|
||||
{
|
||||
};
|
||||
|
||||
//Event sent when blockers have been chosen and they
|
||||
//cannot be changed any more.
|
||||
struct WEventBlockersChosen : public WEvent {
|
||||
struct WEventBlockersChosen: public WEvent
|
||||
{
|
||||
};
|
||||
|
||||
struct WEventcardDraw : public WEvent {
|
||||
WEventcardDraw(Player * player,int nb_cards);
|
||||
Player * player;
|
||||
int nb_cards;
|
||||
virtual Targetable * getTarget(Player * player);
|
||||
struct WEventcardDraw: public WEvent
|
||||
{
|
||||
WEventcardDraw(Player * player, int nb_cards);
|
||||
Player * player;
|
||||
int nb_cards;
|
||||
virtual Targetable * getTarget(Player * player);
|
||||
};
|
||||
|
||||
//Event when a blocker is reordered
|
||||
//exchangeWith: exchange card's position with exchangeWith's position
|
||||
//attacker:both card and exchangeWith *should* be in attacker's "blockers" list.
|
||||
struct WEventCreatureBlockerRank : public WEventCardUpdate {
|
||||
MTGCardInstance * exchangeWith;
|
||||
MTGCardInstance * attacker;
|
||||
WEventCreatureBlockerRank(MTGCardInstance * card,MTGCardInstance * exchangeWith, MTGCardInstance * attacker);
|
||||
struct WEventCreatureBlockerRank: public WEventCardUpdate
|
||||
{
|
||||
MTGCardInstance * exchangeWith;
|
||||
MTGCardInstance * attacker;
|
||||
WEventCreatureBlockerRank(MTGCardInstance * card, MTGCardInstance * exchangeWith, MTGCardInstance * attacker);
|
||||
};
|
||||
|
||||
//Event when a combat phase step ends
|
||||
struct WEventCombatStepChange : public WEvent
|
||||
struct WEventCombatStepChange: public WEvent
|
||||
{
|
||||
CombatStep step;
|
||||
WEventCombatStepChange(CombatStep);
|
||||
CombatStep step;
|
||||
WEventCombatStepChange(CombatStep);
|
||||
};
|
||||
|
||||
|
||||
//Event when a mana is engaged
|
||||
//color : color
|
||||
struct WEventEngageMana : public WEvent {
|
||||
int color;
|
||||
MTGCardInstance* card;
|
||||
ManaPool * destination;
|
||||
WEventEngageMana(int color, MTGCardInstance* card, ManaPool * destination);
|
||||
struct WEventEngageMana: public WEvent
|
||||
{
|
||||
int color;
|
||||
MTGCardInstance* card;
|
||||
ManaPool * destination;
|
||||
WEventEngageMana(int color, MTGCardInstance* card, ManaPool * destination);
|
||||
};
|
||||
|
||||
//Event when a mana is consumed
|
||||
//color : color
|
||||
struct WEventConsumeMana : public WEvent {
|
||||
int color;
|
||||
ManaPool * source;
|
||||
WEventConsumeMana(int color, ManaPool * source);
|
||||
struct WEventConsumeMana: public WEvent
|
||||
{
|
||||
int color;
|
||||
ManaPool * source;
|
||||
WEventConsumeMana(int color, ManaPool * source);
|
||||
};
|
||||
|
||||
//Event when a manapool is emptied
|
||||
//color : color
|
||||
struct WEventEmptyManaPool : public WEvent {
|
||||
ManaPool * source;
|
||||
WEventEmptyManaPool(ManaPool * source);
|
||||
struct WEventEmptyManaPool: public WEvent
|
||||
{
|
||||
ManaPool * source;
|
||||
WEventEmptyManaPool(ManaPool * source);
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream&, const WEvent&);
|
||||
|
||||
@@ -3,192 +3,344 @@
|
||||
|
||||
class WCardFilter;
|
||||
|
||||
class WCFilterFactory{
|
||||
class WCFilterFactory
|
||||
{
|
||||
public:
|
||||
WCFilterFactory() {};
|
||||
static WCFilterFactory * GetInstance();
|
||||
static void Destroy();
|
||||
WCardFilter * Construct(string src);
|
||||
WCFilterFactory(){};
|
||||
static WCFilterFactory * GetInstance();
|
||||
static void Destroy();
|
||||
WCardFilter * Construct(string src);
|
||||
private:
|
||||
size_t findNext(string src, size_t start, char open='(', char close=')');
|
||||
WCardFilter * Leaf(string src);
|
||||
WCardFilter * Terminal(string src, string arg);
|
||||
static WCFilterFactory * me;
|
||||
size_t findNext(string src, size_t start, char open = '(', char close = ')');
|
||||
WCardFilter * Leaf(string src);
|
||||
WCardFilter * Terminal(string src, string arg);
|
||||
static WCFilterFactory * me;
|
||||
};
|
||||
|
||||
class WCardFilter{
|
||||
class WCardFilter
|
||||
{
|
||||
public:
|
||||
WCardFilter() {};
|
||||
virtual ~WCardFilter() {};
|
||||
virtual bool isMatch(MTGCard * c) {return true;};
|
||||
virtual string getCode() = 0;
|
||||
virtual float filterFee() {return 0.0f;};
|
||||
WCardFilter() {};
|
||||
virtual ~WCardFilter() {};
|
||||
virtual bool isMatch(MTGCard * c)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
;
|
||||
virtual string getCode() = 0;
|
||||
virtual float filterFee()
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
class WCFBranch: public WCardFilter{
|
||||
class WCFBranch: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFBranch(WCardFilter * a, WCardFilter * b) {lhs=a;rhs=b;};
|
||||
~WCFBranch() {SAFE_DELETE(lhs); SAFE_DELETE(rhs);};
|
||||
virtual bool isMatch(MTGCard * c) = 0;
|
||||
virtual string getCode() = 0;
|
||||
virtual WCardFilter * Right(){return rhs;};
|
||||
virtual WCardFilter * Left(){return lhs;};
|
||||
WCFBranch(WCardFilter * a, WCardFilter * b)
|
||||
{
|
||||
lhs = a;
|
||||
rhs = b;
|
||||
}
|
||||
;
|
||||
~WCFBranch()
|
||||
{
|
||||
SAFE_DELETE(lhs);
|
||||
SAFE_DELETE(rhs);
|
||||
}
|
||||
;
|
||||
virtual bool isMatch(MTGCard * c) = 0;
|
||||
virtual string getCode() = 0;
|
||||
virtual WCardFilter * Right()
|
||||
{
|
||||
return rhs;
|
||||
}
|
||||
;
|
||||
virtual WCardFilter * Left()
|
||||
{
|
||||
return lhs;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
WCardFilter *lhs, *rhs;
|
||||
WCardFilter *lhs, *rhs;
|
||||
};
|
||||
|
||||
class WCFilterOR: public WCFBranch{
|
||||
class WCFilterOR: public WCFBranch
|
||||
{
|
||||
public:
|
||||
WCFilterOR(WCardFilter * a, WCardFilter * b): WCFBranch(a,b) {};
|
||||
bool isMatch(MTGCard *c);
|
||||
string getCode();
|
||||
float filterFee();
|
||||
WCFilterOR(WCardFilter * a, WCardFilter * b) :
|
||||
WCFBranch(a, b)
|
||||
{
|
||||
}
|
||||
;
|
||||
bool isMatch(MTGCard *c);
|
||||
string getCode();
|
||||
float filterFee();
|
||||
};
|
||||
|
||||
class WCFilterAND: public WCFBranch{
|
||||
class WCFilterAND: public WCFBranch
|
||||
{
|
||||
public:
|
||||
WCFilterAND(WCardFilter * a, WCardFilter * b): WCFBranch(a,b) {};
|
||||
bool isMatch(MTGCard *c) {return (lhs->isMatch(c) && rhs->isMatch(c));};
|
||||
string getCode();
|
||||
float filterFee();
|
||||
WCFilterAND(WCardFilter * a, WCardFilter * b) :
|
||||
WCFBranch(a, b)
|
||||
{
|
||||
}
|
||||
;
|
||||
bool isMatch(MTGCard *c)
|
||||
{
|
||||
return (lhs->isMatch(c) && rhs->isMatch(c));
|
||||
}
|
||||
;
|
||||
string getCode();
|
||||
float filterFee();
|
||||
};
|
||||
|
||||
class WCFilterGROUP: public WCardFilter{
|
||||
class WCFilterGROUP: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterGROUP(WCardFilter * _k) {kid = _k;};
|
||||
~WCFilterGROUP() {SAFE_DELETE(kid);};
|
||||
bool isMatch(MTGCard *c) {return kid->isMatch(c);};
|
||||
string getCode();
|
||||
float filterFee() {return kid->filterFee();};
|
||||
WCFilterGROUP(WCardFilter * _k)
|
||||
{
|
||||
kid = _k;
|
||||
}
|
||||
;
|
||||
~WCFilterGROUP()
|
||||
{
|
||||
SAFE_DELETE(kid);
|
||||
}
|
||||
;
|
||||
bool isMatch(MTGCard *c)
|
||||
{
|
||||
return kid->isMatch(c);
|
||||
}
|
||||
;
|
||||
string getCode();
|
||||
float filterFee()
|
||||
{
|
||||
return kid->filterFee();
|
||||
}
|
||||
;
|
||||
protected:
|
||||
WCardFilter * kid;
|
||||
WCardFilter * kid;
|
||||
};
|
||||
|
||||
class WCFilterNOT: public WCardFilter{
|
||||
class WCFilterNOT: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterNOT(WCardFilter * _k) {kid = _k;};
|
||||
~WCFilterNOT() {SAFE_DELETE(kid);};
|
||||
bool isMatch(MTGCard *c) {return !kid->isMatch(c);};
|
||||
string getCode();
|
||||
WCFilterNOT(WCardFilter * _k)
|
||||
{
|
||||
kid = _k;
|
||||
}
|
||||
;
|
||||
~WCFilterNOT()
|
||||
{
|
||||
SAFE_DELETE(kid);
|
||||
}
|
||||
;
|
||||
bool isMatch(MTGCard *c)
|
||||
{
|
||||
return !kid->isMatch(c);
|
||||
}
|
||||
;
|
||||
string getCode();
|
||||
protected:
|
||||
WCardFilter * kid;
|
||||
WCardFilter * kid;
|
||||
};
|
||||
|
||||
class WCFilterNULL: public WCardFilter{
|
||||
class WCFilterNULL: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterNULL() {};
|
||||
string getCode() {return "NULL";};
|
||||
bool isMatch(MTGCard *c) {return true;};
|
||||
WCFilterNULL()
|
||||
{
|
||||
}
|
||||
;
|
||||
string getCode()
|
||||
{
|
||||
return "NULL";
|
||||
}
|
||||
;
|
||||
bool isMatch(MTGCard *c)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
|
||||
//Filter terminals:
|
||||
class WCFilterSet: public WCardFilter{
|
||||
class WCFilterSet: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterSet(int _setid=MTGSets::ALL_SETS) {setid=_setid;};
|
||||
WCFilterSet(string arg);
|
||||
bool isMatch(MTGCard *c) {return (setid==MTGSets::ALL_SETS || c->setId == setid);};
|
||||
string getCode();
|
||||
float filterFee() {return 0.2f;};
|
||||
WCFilterSet(int _setid = MTGSets::ALL_SETS)
|
||||
{
|
||||
setid = _setid;
|
||||
}
|
||||
;
|
||||
WCFilterSet(string arg);
|
||||
bool isMatch(MTGCard *c)
|
||||
{
|
||||
return (setid == MTGSets::ALL_SETS || c->setId == setid);
|
||||
}
|
||||
;
|
||||
string getCode();
|
||||
float filterFee()
|
||||
{
|
||||
return 0.2f;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
int setid;
|
||||
int setid;
|
||||
};
|
||||
class WCFilterLetter: public WCardFilter{
|
||||
class WCFilterLetter: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterLetter(string arg);
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee() {return 4.0f;}; //Alpha searches are expensive!
|
||||
WCFilterLetter(string arg);
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee()
|
||||
{
|
||||
return 4.0f;
|
||||
}
|
||||
; //Alpha searches are expensive!
|
||||
protected:
|
||||
char alpha;
|
||||
char alpha;
|
||||
};
|
||||
class WCFilterColor: public WCardFilter{
|
||||
class WCFilterColor: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterColor(int _c) {color = _c;};
|
||||
WCFilterColor(string arg);
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee() {return 0.2f;};
|
||||
WCFilterColor(int _c)
|
||||
{
|
||||
color = _c;
|
||||
}
|
||||
;
|
||||
WCFilterColor(string arg);
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee()
|
||||
{
|
||||
return 0.2f;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
int color;
|
||||
int color;
|
||||
};
|
||||
class WCFilterOnlyColor: public WCFilterColor{
|
||||
class WCFilterOnlyColor: public WCFilterColor
|
||||
{
|
||||
public:
|
||||
WCFilterOnlyColor(int _c) : WCFilterColor(_c) {};
|
||||
WCFilterOnlyColor(string arg) : WCFilterColor(arg) {};
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
WCFilterOnlyColor(int _c) : WCFilterColor(_c) {};
|
||||
WCFilterOnlyColor(string arg) : WCFilterColor(arg) {};
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
};
|
||||
class WCFilterProducesColor: public WCFilterColor{
|
||||
class WCFilterProducesColor: public WCFilterColor
|
||||
{
|
||||
public:
|
||||
WCFilterProducesColor(int _c) : WCFilterColor(_c) {};
|
||||
WCFilterProducesColor(string arg) : WCFilterColor(arg) {};
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
WCFilterProducesColor(int _c) : WCFilterColor(_c) {};
|
||||
WCFilterProducesColor(string arg) : WCFilterColor(arg) {};
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
};
|
||||
class WCFilterNumeric: public WCardFilter{
|
||||
class WCFilterNumeric: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterNumeric(int _num) {number = _num;};
|
||||
WCFilterNumeric(string arg);
|
||||
bool isMatch(MTGCard * c) = 0;
|
||||
string getCode() = 0;
|
||||
float filterFee() = 0;
|
||||
WCFilterNumeric(int _num)
|
||||
{
|
||||
number = _num;
|
||||
}
|
||||
;
|
||||
WCFilterNumeric(string arg);
|
||||
bool isMatch(MTGCard * c) = 0;
|
||||
string getCode() = 0;
|
||||
float filterFee() = 0;
|
||||
protected:
|
||||
int number;
|
||||
int number;
|
||||
};
|
||||
class WCFilterCMC: public WCFilterNumeric{
|
||||
class WCFilterCMC: public WCFilterNumeric
|
||||
{
|
||||
public:
|
||||
WCFilterCMC(int amt) : WCFilterNumeric(amt) {};
|
||||
WCFilterCMC(string arg) : WCFilterNumeric(arg) {};
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee() {return number/20.0f;};
|
||||
WCFilterCMC(int amt) : WCFilterNumeric(amt) {};
|
||||
WCFilterCMC(string arg) : WCFilterNumeric(arg) {};
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee()
|
||||
{
|
||||
return number / 20.0f;
|
||||
}
|
||||
;
|
||||
};
|
||||
class WCFilterPower: public WCFilterNumeric{
|
||||
class WCFilterPower: public WCFilterNumeric
|
||||
{
|
||||
public:
|
||||
WCFilterPower(int amt) : WCFilterNumeric(amt) {};
|
||||
WCFilterPower(string arg) : WCFilterNumeric(arg) {};
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee() {return 2*number/12.0f;};
|
||||
WCFilterPower(int amt) : WCFilterNumeric(amt) {};
|
||||
WCFilterPower(string arg) : WCFilterNumeric(arg) {};
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee()
|
||||
{
|
||||
return 2 * number / 12.0f;
|
||||
}
|
||||
;
|
||||
};
|
||||
class WCFilterToughness: public WCFilterNumeric{
|
||||
class WCFilterToughness: public WCFilterNumeric
|
||||
{
|
||||
public:
|
||||
WCFilterToughness(int amt) : WCFilterNumeric(amt) {};
|
||||
WCFilterToughness(string arg) : WCFilterNumeric(arg) {};
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee() {return 2*number/12.0f;};
|
||||
WCFilterToughness(int amt) : WCFilterNumeric(amt) {};
|
||||
WCFilterToughness(string arg) : WCFilterNumeric(arg) {};
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee()
|
||||
{
|
||||
return 2 * number / 12.0f;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
class WCFilterType: public WCardFilter{
|
||||
class WCFilterType: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterType(string arg) {type = arg;};
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee() {return 0.4f;};
|
||||
WCFilterType(string arg)
|
||||
{
|
||||
type = arg;
|
||||
}
|
||||
;
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee()
|
||||
{
|
||||
return 0.4f;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
string type;
|
||||
string type;
|
||||
};
|
||||
class WCFilterRarity: public WCardFilter{
|
||||
class WCFilterRarity: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterRarity(char _r) {rarity = _r;};
|
||||
WCFilterRarity(string arg);
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee();
|
||||
WCFilterRarity(char _r)
|
||||
{
|
||||
rarity = _r;
|
||||
}
|
||||
;
|
||||
WCFilterRarity(string arg);
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee();
|
||||
protected:
|
||||
char rarity;
|
||||
char rarity;
|
||||
};
|
||||
class WCFilterAbility: public WCardFilter{
|
||||
class WCFilterAbility: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterAbility(int _a) {ability = _a;};
|
||||
WCFilterAbility(string arg);
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee();
|
||||
WCFilterAbility(int _a)
|
||||
{
|
||||
ability = _a;
|
||||
}
|
||||
;
|
||||
WCFilterAbility(string arg);
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee();
|
||||
protected:
|
||||
int ability;
|
||||
int ability;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,151 +8,198 @@
|
||||
|
||||
namespace Fonts
|
||||
{
|
||||
enum Font_Type
|
||||
{
|
||||
MAIN_FONT = 0,
|
||||
MENU_FONT = 1,
|
||||
OPTION_FONT = 1,
|
||||
MAGIC_FONT = 2,
|
||||
SMALLFACE_FONT = 3
|
||||
};
|
||||
enum Font_Type
|
||||
{
|
||||
MAIN_FONT = 0,
|
||||
MENU_FONT = 1,
|
||||
OPTION_FONT = 1,
|
||||
MAGIC_FONT = 2,
|
||||
SMALLFACE_FONT = 3
|
||||
};
|
||||
|
||||
// when using gbk languages and we need to keep around single byte font variants,
|
||||
// the single byte fonts will be offset by this value
|
||||
const unsigned int kSingleByteFontOffset = 100;
|
||||
// when using gbk languages and we need to keep around single byte font variants,
|
||||
// the single byte fonts will be offset by this value
|
||||
const unsigned int kSingleByteFontOffset = 100;
|
||||
}
|
||||
|
||||
|
||||
class WFont
|
||||
{
|
||||
public:
|
||||
int mFontID;
|
||||
// Rendering text to screen.
|
||||
// Note:
|
||||
// align=JGETEXT_LEFT, string region (x-leftOffset, x-leftOffset+StringWidth), display window (x, x+displayWidth)
|
||||
// align=JGETEXT_CENTER, string region (x-leftOffset-StringWidth/2, x-leftOffset+StringWidth/2), display window (x-displayWidth/2, x+displayWidth/2)
|
||||
// align=JGETEXT_RIGHT, string region (x-leftOffset-StringWidth, x-leftOffset), display window (x-displayWidth, x)
|
||||
// Only when width is NOT zero, characters outside the display window are not rendered.
|
||||
//
|
||||
virtual void DrawString(const char *s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float displayWidth = 0) = 0;
|
||||
virtual void DrawString(std::string s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float displayWidth = 0) = 0;
|
||||
// Set font color.
|
||||
virtual void SetColor(PIXEL_TYPE color) = 0;
|
||||
// Get font color.
|
||||
virtual PIXEL_TYPE GetColor() const = 0;
|
||||
// Set scale for rendering.
|
||||
virtual void SetScale(float scale) = 0;
|
||||
// Get rendering scale.
|
||||
virtual float GetScale() const = 0;
|
||||
// Get height of font.
|
||||
virtual float GetHeight() const = 0;
|
||||
// Get width of rendering string on screen.
|
||||
virtual float GetStringWidth(const char *s) const = 0;
|
||||
// Set font tracking.
|
||||
virtual void SetTracking(float tracking) = 0;
|
||||
// Set Base for the character set to use.
|
||||
virtual void SetBase(int base) = 0;
|
||||
// Format text.
|
||||
virtual void FormatText(string &s, vector<string>& output) = 0;
|
||||
WFont(int inID) : mFontID(inID) {};
|
||||
virtual ~WFont() {};
|
||||
int mFontID;
|
||||
// Rendering text to screen.
|
||||
// Note:
|
||||
// align=JGETEXT_LEFT, string region (x-leftOffset, x-leftOffset+StringWidth), display window (x, x+displayWidth)
|
||||
// align=JGETEXT_CENTER, string region (x-leftOffset-StringWidth/2, x-leftOffset+StringWidth/2), display window (x-displayWidth/2, x+displayWidth/2)
|
||||
// align=JGETEXT_RIGHT, string region (x-leftOffset-StringWidth, x-leftOffset), display window (x-displayWidth, x)
|
||||
// Only when width is NOT zero, characters outside the display window are not rendered.
|
||||
//
|
||||
virtual void DrawString(const char *s, float x, float y, int align = JGETEXT_LEFT, float leftOffset = 0, float displayWidth = 0) = 0;
|
||||
virtual void DrawString(std::string s, float x, float y, int align = JGETEXT_LEFT, float leftOffset = 0, float displayWidth = 0) = 0;
|
||||
// Set font color.
|
||||
virtual void SetColor(PIXEL_TYPE color) = 0;
|
||||
// Get font color.
|
||||
virtual PIXEL_TYPE GetColor() const = 0;
|
||||
// Set scale for rendering.
|
||||
virtual void SetScale(float scale) = 0;
|
||||
// Get rendering scale.
|
||||
virtual float GetScale() const = 0;
|
||||
// Get height of font.
|
||||
virtual float GetHeight() const = 0;
|
||||
// Get width of rendering string on screen.
|
||||
virtual float GetStringWidth(const char *s) const = 0;
|
||||
// Set font tracking.
|
||||
virtual void SetTracking(float tracking) = 0;
|
||||
// Set Base for the character set to use.
|
||||
virtual void SetBase(int base) = 0;
|
||||
// Format text.
|
||||
virtual void FormatText(string &s, vector<string>& output) = 0;
|
||||
WFont(int inID) : mFontID(inID) {};
|
||||
virtual ~WFont() {};
|
||||
};
|
||||
|
||||
class WLBFont : public WFont
|
||||
class WLBFont: public WFont
|
||||
{
|
||||
public:
|
||||
WLBFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM=false);
|
||||
~WLBFont() {SAFE_DELETE(it);};
|
||||
WLBFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM = false);
|
||||
~WLBFont()
|
||||
{
|
||||
SAFE_DELETE(it);
|
||||
}
|
||||
;
|
||||
|
||||
void DrawString(const char *s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0) {it->DrawString(s,x,y,align,leftOffset,width);};
|
||||
void DrawString(std::string s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0) {it->DrawString(s,x,y,align,leftOffset,width);};
|
||||
void SetColor(PIXEL_TYPE color) {it->SetColor(color);};
|
||||
PIXEL_TYPE GetColor() const {return it->GetColor();};
|
||||
void SetScale(float scale) {it->SetScale(scale);};
|
||||
float GetScale() const {return it->GetScale();};
|
||||
float GetHeight() const {return it->GetHeight();};
|
||||
float GetStringWidth(const char *s) const {return it->GetStringWidth(s);};
|
||||
void SetTracking(float tracking) {it->SetTracking(tracking);};
|
||||
void SetBase(int base) {it->SetBase(base);};
|
||||
void FormatText(string &s, vector<string>& output);
|
||||
void DrawString(const char *s, float x, float y, int align = JGETEXT_LEFT, float leftOffset = 0, float width = 0)
|
||||
{
|
||||
it->DrawString(s, x, y, align, leftOffset, width);
|
||||
}
|
||||
;
|
||||
void DrawString(std::string s, float x, float y, int align = JGETEXT_LEFT, float leftOffset = 0, float width = 0)
|
||||
{
|
||||
it->DrawString(s, x, y, align, leftOffset, width);
|
||||
}
|
||||
;
|
||||
void SetColor(PIXEL_TYPE color)
|
||||
{
|
||||
it->SetColor(color);
|
||||
}
|
||||
;
|
||||
PIXEL_TYPE GetColor() const
|
||||
{
|
||||
return it->GetColor();
|
||||
}
|
||||
;
|
||||
void SetScale(float scale)
|
||||
{
|
||||
it->SetScale(scale);
|
||||
}
|
||||
;
|
||||
float GetScale() const
|
||||
{
|
||||
return it->GetScale();
|
||||
}
|
||||
;
|
||||
float GetHeight() const
|
||||
{
|
||||
return it->GetHeight();
|
||||
}
|
||||
;
|
||||
float GetStringWidth(const char *s) const
|
||||
{
|
||||
return it->GetStringWidth(s);
|
||||
}
|
||||
;
|
||||
void SetTracking(float tracking)
|
||||
{
|
||||
it->SetTracking(tracking);
|
||||
}
|
||||
;
|
||||
void SetBase(int base)
|
||||
{
|
||||
it->SetBase(base);
|
||||
}
|
||||
;
|
||||
void FormatText(string &s, vector<string>& output);
|
||||
|
||||
private:
|
||||
JLBFont * it;
|
||||
JLBFont * it;
|
||||
};
|
||||
|
||||
class WFBFont : public WFont
|
||||
class WFBFont: public WFont
|
||||
{
|
||||
public:
|
||||
WFBFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM=false);
|
||||
WFBFont(int inFontID) : WFont(inFontID) {}; // Legacy : remove it when possible
|
||||
~WFBFont();
|
||||
WFBFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM = false);
|
||||
WFBFont(int inFontID) : WFont(inFontID) {}; // Legacy : remove it when possible
|
||||
~WFBFont();
|
||||
|
||||
void DrawString(std::string s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0);
|
||||
void SetColor(PIXEL_TYPE color);
|
||||
PIXEL_TYPE GetColor() const {return mColor0;};
|
||||
void SetScale(float scale);
|
||||
float GetScale() const;
|
||||
float GetHeight() const;
|
||||
virtual float GetStringWidth(const char *s) const;
|
||||
void SetTracking(float tracking) {};
|
||||
void SetBase(int base) {};
|
||||
void FormatText(string &s, vector<string>& output) {};
|
||||
void DrawString(std::string s, float x, float y, int align = JGETEXT_LEFT, float leftOffset = 0, float width = 0);
|
||||
void SetColor(PIXEL_TYPE color);
|
||||
PIXEL_TYPE GetColor() const
|
||||
{
|
||||
return mColor0;
|
||||
}
|
||||
;
|
||||
void SetScale(float scale);
|
||||
float GetScale() const;
|
||||
float GetHeight() const;
|
||||
virtual float GetStringWidth(const char *s) const;
|
||||
void SetTracking(float tracking) {};
|
||||
void SetBase(int base) {};
|
||||
void FormatText(string &s, vector<string>& output) {};
|
||||
|
||||
virtual void DrawString(const char *s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0);
|
||||
virtual int GetCode(const u8 *ch, int *charLength) const = 0;
|
||||
virtual int GetMana(const u8 *ch) const = 0;
|
||||
virtual void DrawString(const char *s, float x, float y, int align = JGETEXT_LEFT, float leftOffset = 0, float width = 0);
|
||||
virtual int GetCode(const u8 *ch, int *charLength) const = 0;
|
||||
virtual int GetMana(const u8 *ch) const = 0;
|
||||
|
||||
protected:
|
||||
static JRenderer* mRenderer;
|
||||
protected:
|
||||
static JRenderer* mRenderer;
|
||||
|
||||
u16* mIndex;
|
||||
u8* mStdFont;
|
||||
u8* mExtraFont;
|
||||
u16* mIndex;
|
||||
u8* mStdFont;
|
||||
u8* mExtraFont;
|
||||
|
||||
PIXEL_TYPE mColor0;
|
||||
PIXEL_TYPE mColor;
|
||||
unsigned int mFontSize;
|
||||
float mScale;
|
||||
unsigned int mBytesPerChar;
|
||||
unsigned int mBytesPerRow;
|
||||
PIXEL_TYPE mColor0;
|
||||
PIXEL_TYPE mColor;
|
||||
unsigned int mFontSize;
|
||||
float mScale;
|
||||
unsigned int mBytesPerChar;
|
||||
unsigned int mBytesPerRow;
|
||||
|
||||
int mCacheImageWidth;
|
||||
int mCacheImageHeight;
|
||||
int mCol;
|
||||
int mRow;
|
||||
int mCacheSize;
|
||||
JTexture * mTexture;
|
||||
JQuad ** mSprites;
|
||||
int *mGBCode;
|
||||
int mCurr;
|
||||
int mCacheImageWidth;
|
||||
int mCacheImageHeight;
|
||||
int mCol;
|
||||
int mRow;
|
||||
int mCacheSize;
|
||||
JTexture * mTexture;
|
||||
JQuad ** mSprites;
|
||||
int *mGBCode;
|
||||
int mCurr;
|
||||
|
||||
u32 * mCharBuffer;
|
||||
u32 * mCharBuffer;
|
||||
|
||||
virtual int PreCacheChar(const u8 *ch);
|
||||
virtual int PreCacheChar(const u8 *ch);
|
||||
};
|
||||
|
||||
class WGBKFont : public WFBFont
|
||||
class WGBKFont: public WFBFont
|
||||
{
|
||||
public:
|
||||
WGBKFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM = false);
|
||||
WGBKFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM = false);
|
||||
|
||||
int PreCacheChar(const u8 *ch);
|
||||
float GetStringWidth(const char *s) const;
|
||||
void DrawString(const char *s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0);
|
||||
int GetCode(const u8 *ch, int *charLength) const;
|
||||
int GetMana(const u8 *ch) const;
|
||||
void FormatText(string &s, vector<string>& output);
|
||||
int PreCacheChar(const u8 *ch);
|
||||
float GetStringWidth(const char *s) const;
|
||||
void DrawString(const char *s, float x, float y, int align = JGETEXT_LEFT, float leftOffset = 0, float width = 0);
|
||||
int GetCode(const u8 *ch, int *charLength) const;
|
||||
int GetMana(const u8 *ch) const;
|
||||
void FormatText(string &s, vector<string>& output);
|
||||
};
|
||||
|
||||
class WUFont : public WFBFont
|
||||
class WUFont: public WFBFont
|
||||
{
|
||||
public:
|
||||
WUFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM = false)
|
||||
: WFBFont(inFontID, fontname, lineheight, useVideoRAM) {};
|
||||
WUFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM = false) :
|
||||
WFBFont(inFontID, fontname, lineheight, useVideoRAM) {};
|
||||
|
||||
int GetCode(const u8 *ch, int *charLength) const;
|
||||
int GetMana(const u8 *ch) const;
|
||||
void FormatText(string &s, vector<string>& output);
|
||||
int GetCode(const u8 *ch, int *charLength) const;
|
||||
int GetMana(const u8 *ch) const;
|
||||
void FormatText(string &s, vector<string>& output);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,6 @@
|
||||
#define MAX_CACHE_TIME 2000000000
|
||||
#endif
|
||||
|
||||
|
||||
#define THUMBNAILS_OFFSET 100000000
|
||||
#define OTHERS_OFFSET 2000000000
|
||||
|
||||
@@ -31,54 +30,61 @@
|
||||
#define MAX_CACHED_SAMPLES 50
|
||||
#define MAX_CACHE_GARBAGE 10
|
||||
|
||||
|
||||
enum ENUM_WRES_INFO{
|
||||
WRES_UNLOCKED = 0, //Resource is unlocked.
|
||||
WRES_MAX_LOCK = 250, //Maximum number of locks for a resource.
|
||||
WRES_PERMANENT = 251, //Resource is permanent (ie, managed)
|
||||
WRES_UNDERLOCKED = 252, //Resource was released too many times.
|
||||
enum ENUM_WRES_INFO
|
||||
{
|
||||
WRES_UNLOCKED = 0, //Resource is unlocked.
|
||||
WRES_MAX_LOCK = 250, //Maximum number of locks for a resource.
|
||||
WRES_PERMANENT = 251, //Resource is permanent (ie, managed)
|
||||
WRES_UNDERLOCKED = 252,
|
||||
//Resource was released too many times.
|
||||
};
|
||||
|
||||
enum ENUM_RETRIEVE_STYLE{
|
||||
RETRIEVE_EXISTING, //Only returns a resource if it already exists. Does not lock or unlock.
|
||||
RETRIEVE_NORMAL, //Returns or creates a resource. Does not change lock status.
|
||||
RETRIEVE_LOCK, //As above, locks cached resource. Not for quads.
|
||||
RETRIEVE_UNLOCK, //As above, unlocks cached resource. Not for quads.
|
||||
RETRIEVE_RESOURCE, //Only retrieves a managed resource. Does not make a new one.
|
||||
RETRIEVE_MANAGE, //Makes resource permanent.
|
||||
RETRIEVE_THUMB, //Retrieve it as a thumbnail.
|
||||
CACHE_THUMB = RETRIEVE_THUMB, //Backwords compatibility.
|
||||
enum ENUM_RETRIEVE_STYLE
|
||||
{
|
||||
RETRIEVE_EXISTING, //Only returns a resource if it already exists. Does not lock or unlock.
|
||||
RETRIEVE_NORMAL, //Returns or creates a resource. Does not change lock status.
|
||||
RETRIEVE_LOCK, //As above, locks cached resource. Not for quads.
|
||||
RETRIEVE_UNLOCK, //As above, unlocks cached resource. Not for quads.
|
||||
RETRIEVE_RESOURCE, //Only retrieves a managed resource. Does not make a new one.
|
||||
RETRIEVE_MANAGE, //Makes resource permanent.
|
||||
RETRIEVE_THUMB, //Retrieve it as a thumbnail.
|
||||
CACHE_THUMB = RETRIEVE_THUMB,
|
||||
//Backwords compatibility.
|
||||
};
|
||||
|
||||
enum ENUM_CACHE_SUBTYPE{
|
||||
CACHE_NORMAL = (1<<0), //Use default values. Not really a flag.
|
||||
CACHE_EXISTING = (1<<1), //Retrieve it only if it already exists
|
||||
enum ENUM_CACHE_SUBTYPE
|
||||
{
|
||||
CACHE_NORMAL = (1 << 0), //Use default values. Not really a flag.
|
||||
CACHE_EXISTING = (1 << 1), //Retrieve it only if it already exists
|
||||
|
||||
//Because these bits only modify how a cached resource's Attempt() is called,
|
||||
//We can use them over and over for each resource type.
|
||||
TEXTURE_SUB_EXACT = (1<<2), //Don't do any fiddling with the filename.
|
||||
TEXTURE_SUB_CARD = (1<<3), //Retrieve using cardFile, not graphicsFile.
|
||||
TEXTURE_SUB_AVATAR = (1<<4), //Retrieve using avatarFile, not graphicsFile.
|
||||
TEXTURE_SUB_THUMB = (1<<5),//Retrieve prepending "thumbnails\" to the filename.
|
||||
TEXTURE_SUB_5551 = (1<<6), //For textures. If we have to allocate, use RGBA5551.
|
||||
TEXTURE_SUB_EXACT = (1 << 2), //Don't do any fiddling with the filename.
|
||||
TEXTURE_SUB_CARD = (1 << 3), //Retrieve using cardFile, not graphicsFile.
|
||||
TEXTURE_SUB_AVATAR = (1 << 4), //Retrieve using avatarFile, not graphicsFile.
|
||||
TEXTURE_SUB_THUMB = (1 << 5),//Retrieve prepending "thumbnails\" to the filename.
|
||||
TEXTURE_SUB_5551 = (1 << 6),
|
||||
//For textures. If we have to allocate, use RGBA5551.
|
||||
|
||||
};
|
||||
|
||||
enum ENUM_CACHE_ERROR{
|
||||
enum ENUM_CACHE_ERROR
|
||||
{
|
||||
CACHE_ERROR_NONE = 0,
|
||||
CACHE_ERROR_NOT_CACHED = CACHE_ERROR_NONE,
|
||||
CACHE_ERROR_404,
|
||||
CACHE_ERROR_BAD, //Something went wrong with item->attempt()
|
||||
CACHE_ERROR_BAD, //Something went wrong with item->attempt()
|
||||
CACHE_ERROR_BAD_ALLOC, //Couldn't allocate item
|
||||
CACHE_ERROR_LOST,
|
||||
CACHE_ERROR_NOT_MANAGED,
|
||||
};
|
||||
|
||||
struct WCacheSort{
|
||||
struct WCacheSort
|
||||
{
|
||||
bool operator()(const WResource * l, const WResource * r); //Predicate for use in sorting. See flatten().
|
||||
};
|
||||
|
||||
template <class cacheItem, class cacheActual>
|
||||
template<class cacheItem, class cacheActual>
|
||||
class WCache
|
||||
{
|
||||
public:
|
||||
@@ -87,13 +93,13 @@ public:
|
||||
WCache();
|
||||
~WCache();
|
||||
|
||||
cacheItem* Retrieve(int id, const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); //Primary interface function.
|
||||
bool Release(cacheActual* actual); //Releases an item, and deletes it if unlocked.
|
||||
bool RemoveMiss(int id=0); //Removes a cache miss.
|
||||
bool RemoveOldest(); //Remove oldest unlocked item.
|
||||
bool Cleanup(); //Repeats RemoveOldest() until cache fits in size limits
|
||||
void ClearUnlocked(); //Remove all unlocked items.
|
||||
void Refresh(); //Refreshes all cache items.
|
||||
cacheItem* Retrieve(int id, const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); //Primary interface function.
|
||||
bool Release(cacheActual* actual); //Releases an item, and deletes it if unlocked.
|
||||
bool RemoveMiss(int id = 0); //Removes a cache miss.
|
||||
bool RemoveOldest(); //Remove oldest unlocked item.
|
||||
bool Cleanup(); //Repeats RemoveOldest() until cache fits in size limits
|
||||
void ClearUnlocked(); //Remove all unlocked items.
|
||||
void Refresh(); //Refreshes all cache items.
|
||||
unsigned int Flatten(); //Ensures that the times don't loop. Returns new lastTime.
|
||||
void Resize(unsigned long size, int items); //Sets new limits, then enforces them. Lock safe, so not a "hard limit".
|
||||
protected:
|
||||
@@ -101,25 +107,24 @@ protected:
|
||||
bool UnlinkCache(cacheItem * item); //Removes an item from our cache, does not delete it. Use with care.
|
||||
bool Delete(cacheItem * item); //SAFE_DELETE and garbage collect. If maxCached == 0, nullify first. (This means you have to free that cacheActual later!)
|
||||
cacheItem* Get(int id, const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); //Subordinate to Retrieve.
|
||||
cacheItem* AttemptNew(const string& filename, int submode); //Attempts a new cache item, progressively clearing cache if it fails.
|
||||
cacheItem* AttemptNew(const string& filename, int submode); //Attempts a new cache item, progressively clearing cache if it fails.
|
||||
|
||||
int makeID(int id, const string& filename, int submode); //Makes an ID appropriate to the submode.
|
||||
int makeID(int id, const string& filename, int submode); //Makes an ID appropriate to the submode.
|
||||
|
||||
map<string,int> ids;
|
||||
map<int,cacheItem*> cache;
|
||||
map<int,cacheItem*> managed; //Cache can be arbitrarily large, so managed items are seperate.
|
||||
map<string, int> ids;
|
||||
map<int, cacheItem*> cache;
|
||||
map<int, cacheItem*> managed; //Cache can be arbitrarily large, so managed items are seperate.
|
||||
unsigned long totalSize;
|
||||
unsigned long cacheSize;
|
||||
|
||||
//Applies to cacheSize only.
|
||||
unsigned long maxCacheSize;
|
||||
unsigned long maxCacheSize;
|
||||
unsigned int maxCached;
|
||||
|
||||
unsigned int cacheItems;
|
||||
int mError;
|
||||
};
|
||||
|
||||
|
||||
struct WManagedQuad
|
||||
{
|
||||
WCachedTexture * texture;
|
||||
@@ -149,10 +154,10 @@ public:
|
||||
virtual ~WResourceManager();
|
||||
|
||||
void Unmiss(string filename);
|
||||
JQuad * RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL);
|
||||
JQuad * RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||
JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||
JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||
JQuad * RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_LOCK, int submode = CACHE_NORMAL, int id = 0);
|
||||
JQuad * RetrieveQuad(const string& filename, float offX = 0.0f, float offY = 0.0f, float width = 0.0f, float height = 0.0f, string resname = "", int style = RETRIEVE_LOCK, int submode = CACHE_NORMAL, int id = 0);
|
||||
JQuad * RetrieveTempQuad(const string& filename, int submode = CACHE_NORMAL);
|
||||
hgeParticleSystemInfo * RetrievePSI(const string& filename, JQuad * texture, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||
int RetrieveError();
|
||||
@@ -161,19 +166,19 @@ public:
|
||||
void Release(JSample * sample);
|
||||
bool RemoveOldest();
|
||||
|
||||
bool Cleanup(); //Force a cleanup. Return false if nothing removed.
|
||||
bool Cleanup(); //Force a cleanup. Return false if nothing removed.
|
||||
void ClearUnlocked(); //Remove unlocked items.
|
||||
void Refresh(); //Refreshes all files in cache, for when mode/profile changes.
|
||||
void Refresh(); //Refreshes all files in cache, for when mode/profile changes.
|
||||
|
||||
unsigned int nowTime();
|
||||
|
||||
unsigned long Size();
|
||||
unsigned long SizeCached();
|
||||
unsigned long SizeManaged();
|
||||
unsigned long SizeManaged();
|
||||
|
||||
unsigned int Count();
|
||||
unsigned int CountCached();
|
||||
unsigned int CountManaged();
|
||||
unsigned int CountManaged();
|
||||
|
||||
int CreateQuad(const string &quadName, const string &textureName, float x, float y, float width, float height);
|
||||
JQuad* GetQuad(const string &quadName);
|
||||
@@ -206,7 +211,7 @@ public:
|
||||
JMusic * ssLoadMusic(const char *fileName);
|
||||
|
||||
//Resets the cache limits on when it starts to purge data.
|
||||
void ResetCacheLimits();
|
||||
void ResetCacheLimits();
|
||||
|
||||
void DebugRender();
|
||||
|
||||
@@ -217,17 +222,17 @@ public:
|
||||
|
||||
private:
|
||||
/*
|
||||
** Singleton object only accessibly via Instance(), constructor is private
|
||||
*/
|
||||
** Singleton object only accessibly via Instance(), constructor is private
|
||||
*/
|
||||
WResourceManager();
|
||||
|
||||
bool bThemedCards; //Does the theme have a "sets" directory for overwriting cards?
|
||||
bool bThemedCards; //Does the theme have a "sets" directory for overwriting cards?
|
||||
void FlattenTimes(); //To prevent bad cache timing on int overflow
|
||||
|
||||
//For cached stuff
|
||||
WCache<WCachedTexture,JTexture> textureWCache;
|
||||
WCache<WCachedSample,JSample> sampleWCache;
|
||||
WCache<WCachedParticles,hgeParticleSystemInfo> psiWCache;
|
||||
WCache<WCachedTexture, JTexture> textureWCache;
|
||||
WCache<WCachedSample, JSample> sampleWCache;
|
||||
WCache<WCachedParticles, hgeParticleSystemInfo> psiWCache;
|
||||
|
||||
typedef std::map<std::string, WManagedQuad> ManagedQuadMap;
|
||||
ManagedQuadMap mManagedQuads;
|
||||
@@ -239,7 +244,7 @@ private:
|
||||
unsigned int lastTime;
|
||||
int lastError;
|
||||
|
||||
typedef std::map<int, WFont*> FontMap;
|
||||
typedef std::map<int, WFont*> FontMap;
|
||||
FontMap mWFontMap;
|
||||
std::string mFontFileExtension;
|
||||
|
||||
|
||||
@@ -12,12 +12,8 @@
|
||||
#define OutputDebugString(val) {}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#include "limits.h"
|
||||
|
||||
|
||||
#if defined (_DEBUG) && defined (WIN32)
|
||||
#include "crtdbg.h"
|
||||
#define NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
@@ -38,7 +34,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef RESPATH
|
||||
#define RESPATH "Res"
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user