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,8 +3,8 @@
|
||||
|
||||
#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);
|
||||
|
||||
@@ -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();
|
||||
@@ -62,18 +64,20 @@ 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,7 +90,7 @@ 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)
|
||||
@@ -97,18 +101,29 @@ public:
|
||||
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,13 +132,13 @@ public:
|
||||
|
||||
};
|
||||
|
||||
|
||||
class AIPlayerBaka: public AIPlayer{
|
||||
protected:
|
||||
class AIPlayerBaka: public AIPlayer
|
||||
{
|
||||
protected:
|
||||
int oldGamePhase;
|
||||
float timer;
|
||||
MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
|
||||
public:
|
||||
public:
|
||||
int deckId;
|
||||
AIPlayerBaka(MTGDeck * deck, string deckFile, string deckfileSmall, string avatarFile);
|
||||
virtual int Act(float dt);
|
||||
@@ -131,10 +146,10 @@ class AIPlayerBaka: public AIPlayer{
|
||||
virtual int computeActions();
|
||||
};
|
||||
|
||||
class AIPlayerFactory{
|
||||
public:
|
||||
class AIPlayerFactory
|
||||
{
|
||||
public:
|
||||
AIPlayer * createAIPlayer(MTGAllCards * collection, Player * opponent, int deckid = 0);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,19 +18,23 @@ class MTGCard;
|
||||
class Damage;
|
||||
class WEvent;
|
||||
|
||||
class AIStat{
|
||||
public:
|
||||
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){};
|
||||
AIStat(int _source, int _value, int _occurences, bool _direct) :
|
||||
source(_source), value(_value), occurences(_occurences), direct(_direct)
|
||||
{
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class AIStats{
|
||||
public:
|
||||
class AIStats
|
||||
{
|
||||
public:
|
||||
Player * player;
|
||||
string filename;
|
||||
list<AIStat *> stats;
|
||||
@@ -39,7 +43,7 @@ class AIStats{
|
||||
void load(char * filename);
|
||||
void save();
|
||||
AIStat * find(MTGCard * card);
|
||||
bool isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCountsForTrue = true );
|
||||
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();
|
||||
|
||||
@@ -12,20 +12,18 @@
|
||||
#define ACTION_REQUESTED 1
|
||||
#define ACTIVE 2
|
||||
|
||||
|
||||
class MTGCardInstance;
|
||||
class ManaCost;
|
||||
class Targetable;
|
||||
class TargetChooser;
|
||||
class WEvent;
|
||||
|
||||
class ActionElement: public JGuiObject{
|
||||
protected:
|
||||
class ActionElement: public JGuiObject
|
||||
{
|
||||
protected:
|
||||
int activeState;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
public:
|
||||
int isClone;
|
||||
TargetChooser * tc;
|
||||
int currentPhase;
|
||||
@@ -35,20 +33,52 @@ class ActionElement: public JGuiObject{
|
||||
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;};
|
||||
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 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,9 +16,10 @@ class GuiLayer;
|
||||
class Targetable;
|
||||
class WEvent;
|
||||
|
||||
class ActionLayer: public GuiLayer, public JGuiListener{
|
||||
public:
|
||||
vector <ActionElement *> garbage;
|
||||
class ActionLayer: public GuiLayer, public JGuiListener
|
||||
{
|
||||
public:
|
||||
vector<ActionElement *> garbage;
|
||||
Targetable * menuObject;
|
||||
SimpleMenu * abilitiesMenu;
|
||||
int stuffHappened;
|
||||
@@ -34,8 +35,8 @@ class ActionLayer: public GuiLayer, public JGuiListener{
|
||||
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 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);
|
||||
@@ -50,6 +51,4 @@ protected:
|
||||
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,27 +38,62 @@ class DamageStack;
|
||||
class ManaCost;
|
||||
class TargetChooser;
|
||||
|
||||
|
||||
#define ACTIONSTACK_STANDARD 0
|
||||
#define ACTIONSTACK_TARGET 1
|
||||
|
||||
class Interruptible: public PlayGuiObject, public Targetable{
|
||||
public:
|
||||
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 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;};
|
||||
virtual int receiveEvent(WEvent * event)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
#if defined (WIN32) || defined (LINUX) || defined (IOS)
|
||||
virtual void Dump();
|
||||
#endif
|
||||
@@ -68,8 +102,9 @@ protected:
|
||||
float GetVerticalTextOffset() const;
|
||||
};
|
||||
|
||||
class NextGamePhase: public Interruptible {
|
||||
public:
|
||||
class NextGamePhase: public Interruptible
|
||||
{
|
||||
public:
|
||||
int resolve();
|
||||
bool extraDamagePhase();
|
||||
void Render();
|
||||
@@ -78,10 +113,11 @@ class NextGamePhase: public Interruptible {
|
||||
NextGamePhase(int id);
|
||||
};
|
||||
|
||||
class Spell: public Interruptible {
|
||||
protected:
|
||||
class Spell: public Interruptible
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
public:
|
||||
MTGGameZone * from;
|
||||
TargetChooser * tc;
|
||||
ManaCost * cost;
|
||||
@@ -106,8 +142,9 @@ class Spell: public Interruptible {
|
||||
int getNbTargets();
|
||||
};
|
||||
|
||||
class StackAbility: public Interruptible {
|
||||
public:
|
||||
class StackAbility: public Interruptible
|
||||
{
|
||||
public:
|
||||
MTGAbility * ability;
|
||||
int resolve();
|
||||
void Render();
|
||||
@@ -116,8 +153,9 @@ class StackAbility: public Interruptible {
|
||||
StackAbility(int id, MTGAbility * _ability);
|
||||
};
|
||||
|
||||
class PutInGraveyard: public Interruptible {
|
||||
public:
|
||||
class PutInGraveyard: public Interruptible
|
||||
{
|
||||
public:
|
||||
MTGCardInstance * card;
|
||||
int removeFromGame;
|
||||
int resolve();
|
||||
@@ -126,9 +164,9 @@ class PutInGraveyard: public Interruptible {
|
||||
PutInGraveyard(int id, MTGCardInstance * _card);
|
||||
};
|
||||
|
||||
|
||||
class DrawAction: public Interruptible {
|
||||
public:
|
||||
class DrawAction: public Interruptible
|
||||
{
|
||||
public:
|
||||
int nbcards;
|
||||
Player * player;
|
||||
int resolve();
|
||||
@@ -137,8 +175,9 @@ class DrawAction: public Interruptible {
|
||||
DrawAction(int id, Player * _player, int _nbcards);
|
||||
};
|
||||
|
||||
class ActionStack :public GuiLayer{
|
||||
protected:
|
||||
class ActionStack: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
JQuad * pspIcons[8];
|
||||
GameObserver* game;
|
||||
int interruptDecision[2];
|
||||
@@ -147,7 +186,7 @@ class ActionStack :public GuiLayer{
|
||||
int mode;
|
||||
int checked;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -158,11 +197,11 @@ class ActionStack :public GuiLayer{
|
||||
};
|
||||
|
||||
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);
|
||||
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);
|
||||
@@ -192,8 +231,4 @@ class ActionStack :public GuiLayer{
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
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,7 +13,7 @@
|
||||
#define CD_AND 2
|
||||
|
||||
enum ENUM_COMPARISON_MODES
|
||||
{
|
||||
{
|
||||
COMPARISON_NONE = 0, // Needs to remain 0 for quick if(comparison_mode) checks
|
||||
COMPARISON_AT_MOST,
|
||||
COMPARISON_AT_LEAST,
|
||||
@@ -21,14 +21,15 @@ enum ENUM_COMPARISON_MODES
|
||||
COMPARISON_GREATER,
|
||||
COMPARISON_LESS,
|
||||
COMPARISON_UNEQUAL
|
||||
};
|
||||
};
|
||||
|
||||
class CardDescriptor: public MTGCardInstance{
|
||||
protected:
|
||||
class CardDescriptor: public MTGCardInstance
|
||||
{
|
||||
protected:
|
||||
MTGCardInstance * match_or(MTGCardInstance * card);
|
||||
MTGCardInstance * match_and(MTGCardInstance * card);
|
||||
bool valueInRange(int comparisonMode, int value, int criterion);
|
||||
public:
|
||||
public:
|
||||
int mode;
|
||||
int powerComparisonMode;
|
||||
int toughnessComparisonMode;
|
||||
@@ -40,7 +41,7 @@ class CardDescriptor: public MTGCardInstance{
|
||||
CardDescriptor();
|
||||
void unsecureSetTapped(int i);
|
||||
void unsecuresetfresh(int k);
|
||||
void setNegativeSubtype( string value);
|
||||
void setNegativeSubtype(string value);
|
||||
int counterPower;
|
||||
int counterToughness;
|
||||
int counterNB;
|
||||
|
||||
@@ -7,16 +7,18 @@ class TargetChooser;
|
||||
class MTGGameZone;
|
||||
class MTGCardInstance;
|
||||
|
||||
class CardDisplay:public PlayGuiObjectController{
|
||||
class CardDisplay: public PlayGuiObjectController
|
||||
{
|
||||
int mId;
|
||||
GameObserver* game;
|
||||
public:
|
||||
int x, y , start_item, nb_displayed_items;
|
||||
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);
|
||||
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();
|
||||
@@ -28,7 +30,6 @@ class CardDisplay:public PlayGuiObjectController{
|
||||
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:
|
||||
public:
|
||||
CardEffect(CardGui* target);
|
||||
~CardEffect();
|
||||
private:
|
||||
private:
|
||||
CardGui* target;
|
||||
|
||||
public:
|
||||
public:
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
|
||||
#endif // _CARDEFFECT_H_
|
||||
|
||||
@@ -16,15 +16,16 @@ namespace DrawMode
|
||||
{
|
||||
enum
|
||||
{
|
||||
kNormal = 0,
|
||||
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
|
||||
@@ -35,7 +36,7 @@ struct CardGui : public PlayGuiObject {
|
||||
static void AlternateRender(MTGCard * card, const Pos& pos);
|
||||
static void TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad);
|
||||
|
||||
public:
|
||||
public:
|
||||
static const float Width;
|
||||
static const float Height;
|
||||
static const float BigWidth;
|
||||
@@ -54,11 +55,12 @@ struct CardGui : public PlayGuiObject {
|
||||
virtual ostream& toString(ostream&) const;
|
||||
};
|
||||
|
||||
class CardView: public CardGui
|
||||
{
|
||||
public:
|
||||
|
||||
class CardView : public CardGui {
|
||||
public:
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
nullZone, handZone, playZone
|
||||
} SelectorZone;
|
||||
|
||||
@@ -69,16 +71,25 @@ class CardView : public CardGui {
|
||||
CardView(const SelectorZone, MTGCardInstance* card, const Pos& ref);
|
||||
virtual ~CardView();
|
||||
|
||||
void Render(){CardGui::Render();};
|
||||
void Render(JQuad* q){Pos::Render(q);};
|
||||
void Render()
|
||||
{
|
||||
CardGui::Render();
|
||||
}
|
||||
;
|
||||
void Render(JQuad* q)
|
||||
{
|
||||
Pos::Render(q);
|
||||
}
|
||||
;
|
||||
virtual ostream& toString(ostream&) const;
|
||||
|
||||
float GetCenterX();
|
||||
float GetCenterY();
|
||||
};
|
||||
|
||||
class TransientCardView : public CardGui {
|
||||
public:
|
||||
class TransientCardView: public CardGui
|
||||
{
|
||||
public:
|
||||
TransientCardView(MTGCardInstance* card, float x, float y);
|
||||
TransientCardView(MTGCardInstance* card, const Pos& ref);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef _CARDPRIMITIVE_H_
|
||||
#define _CARDPRIMITIVE_H_
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -10,26 +9,27 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
class CardPrimitive {
|
||||
protected:
|
||||
class CardPrimitive
|
||||
{
|
||||
protected:
|
||||
vector<string> ftdText;
|
||||
string lcname;
|
||||
ManaCost manaCost;
|
||||
|
||||
public:
|
||||
public:
|
||||
string text;
|
||||
string name;
|
||||
int init();
|
||||
|
||||
int colors[Constants::MTG_NB_COLORS];
|
||||
map<int,int> basicAbilities;
|
||||
map<string,string> magicTexts;
|
||||
map<int, int> basicAbilities;
|
||||
map<string, string> magicTexts;
|
||||
string magicText;
|
||||
int alias;
|
||||
string spellTargetType;
|
||||
int power;
|
||||
int toughness;
|
||||
vector<int>types;
|
||||
vector<int> types;
|
||||
CardPrimitive();
|
||||
CardPrimitive(CardPrimitive * source);
|
||||
|
||||
@@ -77,5 +77,4 @@ class CardPrimitive {
|
||||
const vector<string>& formattedText();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@ using std::vector;
|
||||
class PlayGuiObject;
|
||||
class DuelLayers;
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
struct LimitorFunctor
|
||||
{
|
||||
virtual bool select(T*) = 0;
|
||||
@@ -20,11 +20,15 @@ struct LimitorFunctor
|
||||
typedef T Target;
|
||||
};
|
||||
|
||||
class CardSelectorBase : public GuiLayer
|
||||
class CardSelectorBase: public GuiLayer
|
||||
{
|
||||
public:
|
||||
|
||||
CardSelectorBase(int inDrawMode = DrawMode::kNormal) : mDrawMode(inDrawMode) {};
|
||||
CardSelectorBase(int inDrawMode = DrawMode::kNormal) :
|
||||
mDrawMode(inDrawMode)
|
||||
{
|
||||
}
|
||||
;
|
||||
virtual void Add(PlayGuiObject*) = 0;
|
||||
virtual void Remove(PlayGuiObject*) = 0;
|
||||
virtual bool CheckUserInput(JButton key) = 0;
|
||||
@@ -43,8 +47,7 @@ protected:
|
||||
int mDrawMode;
|
||||
};
|
||||
|
||||
|
||||
class CardSelector : public CardSelectorBase
|
||||
class CardSelector: public CardSelectorBase
|
||||
{
|
||||
public:
|
||||
struct SelectorMemory
|
||||
@@ -62,7 +65,7 @@ protected:
|
||||
LimitorFunctor<PlayGuiObject>* limitor;
|
||||
Pos bigpos;
|
||||
map<const CardView::SelectorZone, SelectorMemory> lasts;
|
||||
stack< pair<LimitorFunctor<PlayGuiObject>*, CardView::SelectorZone> > limitorStack;
|
||||
stack<pair<LimitorFunctor<PlayGuiObject>*, CardView::SelectorZone> > limitorStack;
|
||||
stack<SelectorMemory> memoryStack;
|
||||
|
||||
PlayGuiObject* fetchMemory(SelectorMemory&);
|
||||
|
||||
@@ -26,5 +26,4 @@ namespace CardSelectorSingleton
|
||||
void Terminate();
|
||||
}
|
||||
|
||||
|
||||
#endif //CARDSELECTORSINGLETON_H
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
#define _COUNTERS_H_
|
||||
#include <string>
|
||||
|
||||
|
||||
using std::string;
|
||||
class MTGCardInstance;
|
||||
|
||||
/* One family of counters. Ex : +1/+1 */
|
||||
class Counter{
|
||||
public :
|
||||
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);
|
||||
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();
|
||||
@@ -23,22 +23,22 @@ class Counter{
|
||||
};
|
||||
|
||||
/* Various families of counters attached to an instance of a card */
|
||||
class Counters{
|
||||
public:
|
||||
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(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(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(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,8 +12,8 @@ class GameApp;
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
class CreditBonus{
|
||||
class CreditBonus
|
||||
{
|
||||
public:
|
||||
int value;
|
||||
string text;
|
||||
@@ -22,7 +21,8 @@ public:
|
||||
void Render(float x, float y, WFont * font);
|
||||
};
|
||||
|
||||
class Credits{
|
||||
class Credits
|
||||
{
|
||||
private:
|
||||
time_t gameLength;
|
||||
int isDifficultyUnlocked(DeckStats * stats);
|
||||
|
||||
@@ -17,27 +17,55 @@ class GameObserver;
|
||||
#define DAMAGE_COMBAT 1
|
||||
#define DAMAGE_OTHER 2
|
||||
|
||||
class Damageable:public Targetable {
|
||||
protected:
|
||||
public:
|
||||
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;};
|
||||
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:
|
||||
class Damage: public Interruptible
|
||||
{
|
||||
protected:
|
||||
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
|
||||
public:
|
||||
public:
|
||||
Damageable * target;
|
||||
int typeOfDamage;
|
||||
int damage;
|
||||
@@ -48,13 +76,13 @@ class Damage: public Interruptible {
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
|
||||
class DamageStack : public GuiLayer, public Interruptible{
|
||||
protected:
|
||||
class DamageStack: public GuiLayer, public Interruptible
|
||||
{
|
||||
protected:
|
||||
int currentState;
|
||||
GameObserver* game;
|
||||
|
||||
public:
|
||||
public:
|
||||
int receiveEvent(WEvent * event);
|
||||
int resolve();
|
||||
void Render();
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
class Player;
|
||||
|
||||
struct DamagerDamaged : TransientCardView {
|
||||
struct DamagerDamaged: TransientCardView
|
||||
{
|
||||
bool show;
|
||||
Player * damageSelecter;
|
||||
vector<Damage> damages;
|
||||
@@ -26,7 +27,8 @@ struct DamagerDamaged : TransientCardView {
|
||||
};
|
||||
|
||||
typedef DamagerDamaged DefenserDamaged;
|
||||
struct AttackerDamaged : DamagerDamaged {
|
||||
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);
|
||||
|
||||
@@ -12,12 +12,23 @@ using std::string;
|
||||
|
||||
class MTGDeck;
|
||||
|
||||
class DeckDataWrapper: public WSrcDeck {
|
||||
public:
|
||||
class DeckDataWrapper: public WSrcDeck
|
||||
{
|
||||
public:
|
||||
MTGDeck * parent;
|
||||
DeckDataWrapper(MTGDeck * deck);
|
||||
bool next() {currentPos++; return true;};
|
||||
bool prev() {currentPos--; return true;};
|
||||
bool next()
|
||||
{
|
||||
currentPos++;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
bool prev()
|
||||
{
|
||||
currentPos--;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
void save();
|
||||
void save(string filepath, bool useExpandedCardNames, string &deckTitle, string &deckDesc);
|
||||
};
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "DeckDataWrapper.h"
|
||||
#include "DeckStats.h"
|
||||
|
||||
class DeckEditorMenu :
|
||||
public DeckMenu
|
||||
class DeckEditorMenu: public DeckMenu
|
||||
{
|
||||
protected:
|
||||
string deckTitle;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
class DeckManager
|
||||
{
|
||||
private:
|
||||
@@ -18,11 +17,10 @@ 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();
|
||||
|
||||
@@ -32,8 +30,7 @@ public:
|
||||
//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()
|
||||
{
|
||||
|
||||
@@ -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 isClosed()
|
||||
{
|
||||
return mClosed;
|
||||
}
|
||||
int getSelectedDeckId()
|
||||
{
|
||||
return mSelectedDeckId;
|
||||
}
|
||||
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
|
||||
@@ -31,8 +31,14 @@ public:
|
||||
|
||||
void Relocate(float x, float y);
|
||||
float GetWidth();
|
||||
string GetText() { return mText; }
|
||||
string GetDescription() { return desc; }
|
||||
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);
|
||||
@@ -40,12 +46,18 @@ public:
|
||||
|
||||
void RenderWithOffset(float yOffset);
|
||||
virtual void Render();
|
||||
virtual void Update( float dt );
|
||||
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 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
|
||||
{
|
||||
@@ -15,7 +14,8 @@ enum DECK_DIFFICULTY
|
||||
EASY = 1
|
||||
};
|
||||
|
||||
class DeckMetaData {
|
||||
class DeckMetaData
|
||||
{
|
||||
private:
|
||||
string _filename;
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
DeckMetaData();
|
||||
DeckMetaData(string filename, Player * statsPlayer);
|
||||
void load(string filename);
|
||||
void loadStatsForPlayer( Player * statsPlayer, string deckStatsFileName = "" );
|
||||
void loadStatsForPlayer(Player * statsPlayer, string deckStatsFileName = "");
|
||||
|
||||
// Accessors
|
||||
string getFilename();
|
||||
@@ -51,9 +51,10 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class DeckMetaDataList {
|
||||
class DeckMetaDataList
|
||||
{
|
||||
private:
|
||||
map<string,DeckMetaData *>values;
|
||||
map<string, DeckMetaData *> values;
|
||||
|
||||
public:
|
||||
void invalidate(string filename);
|
||||
@@ -61,7 +62,6 @@ public:
|
||||
~DeckMetaDataList();
|
||||
static DeckMetaDataList * decksMetaData;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,8 +15,9 @@ class GuiAvatars;
|
||||
class CardSelectorBase;
|
||||
struct Pos;
|
||||
|
||||
class DuelLayers {
|
||||
protected:
|
||||
class DuelLayers
|
||||
{
|
||||
protected:
|
||||
int nbitems;
|
||||
vector<GuiLayer*> objects;
|
||||
vector<Pos*> waiters;
|
||||
@@ -52,5 +53,4 @@ public:
|
||||
#include "ActionStack.h"
|
||||
#include "Damage.h"
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#include <JGui.h>
|
||||
|
||||
class Effect : public JGuiObject
|
||||
class Effect: public JGuiObject
|
||||
{
|
||||
static int id_counter;
|
||||
public:
|
||||
public:
|
||||
Effect() : JGuiObject(++id_counter) {};
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ class TargetChooser;
|
||||
class MTGCardInstance;
|
||||
class MTGAbility;
|
||||
|
||||
class ExtraCost{
|
||||
class ExtraCost
|
||||
{
|
||||
public:
|
||||
TargetChooser * tc;
|
||||
MTGCardInstance * source;
|
||||
@@ -19,17 +20,24 @@ public:
|
||||
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 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;
|
||||
vector<ExtraCost *> costs;
|
||||
MTGCardInstance * source;
|
||||
MTGAbility * action;
|
||||
ExtraCosts();
|
||||
@@ -45,7 +53,8 @@ public:
|
||||
ExtraCosts * clone() const;
|
||||
};
|
||||
|
||||
class SacrificeCost: public ExtraCost{
|
||||
class SacrificeCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
SacrificeCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
@@ -53,7 +62,8 @@ public:
|
||||
};
|
||||
|
||||
//life cost
|
||||
class LifeCost: public ExtraCost{
|
||||
class LifeCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
LifeCost(TargetChooser *_tc = NULL);
|
||||
|
||||
@@ -62,7 +72,8 @@ public:
|
||||
};
|
||||
|
||||
//Discard a random card cost
|
||||
class DiscardRandomCost: public ExtraCost{
|
||||
class DiscardRandomCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
DiscardRandomCost(TargetChooser *_tc = NULL);
|
||||
virtual int canPay();
|
||||
@@ -71,7 +82,8 @@ public:
|
||||
};
|
||||
|
||||
//a choosen discard
|
||||
class DiscardCost: public ExtraCost{
|
||||
class DiscardCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
DiscardCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
@@ -79,7 +91,8 @@ public:
|
||||
};
|
||||
|
||||
//tolibrary cost
|
||||
class ToLibraryCost: public ExtraCost{
|
||||
class ToLibraryCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
ToLibraryCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
@@ -87,7 +100,8 @@ public:
|
||||
};
|
||||
|
||||
//Millyourself cost
|
||||
class MillCost: public ExtraCost{
|
||||
class MillCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
MillCost(TargetChooser *_tc = NULL);
|
||||
virtual int canPay();
|
||||
@@ -96,14 +110,16 @@ public:
|
||||
};
|
||||
|
||||
//Mill to exile yourself cost
|
||||
class MillExileCost: public MillCost{
|
||||
class MillExileCost: public MillCost
|
||||
{
|
||||
public:
|
||||
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();
|
||||
@@ -111,7 +127,8 @@ public:
|
||||
};
|
||||
|
||||
//exile as cost
|
||||
class ExileTargetCost: public ExtraCost{
|
||||
class ExileTargetCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
ExileTargetCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
@@ -119,7 +136,8 @@ public:
|
||||
};
|
||||
|
||||
//bounce cost
|
||||
class BounceTargetCost: public ExtraCost{
|
||||
class BounceTargetCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
BounceTargetCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
@@ -127,7 +145,8 @@ public:
|
||||
};
|
||||
|
||||
//bounce cost
|
||||
class Ninja: public ExtraCost{
|
||||
class Ninja: public ExtraCost
|
||||
{
|
||||
public:
|
||||
Ninja(TargetChooser *_tc = NULL);
|
||||
virtual int isPaymentSet();
|
||||
@@ -135,11 +154,12 @@ public:
|
||||
virtual Ninja * clone() const;
|
||||
};
|
||||
|
||||
class CounterCost: public ExtraCost{
|
||||
class CounterCost: public ExtraCost
|
||||
{
|
||||
public:
|
||||
Counter * counter;
|
||||
int hasCounters;
|
||||
CounterCost(Counter * _counter,TargetChooser *_tc = NULL);
|
||||
CounterCost(Counter * _counter, TargetChooser *_tc = NULL);
|
||||
~CounterCost();
|
||||
virtual int setPayment(MTGCardInstance * card);
|
||||
virtual int isPaymentSet();
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
* http://wololo.net/wagic/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _GAMEAPP_H_
|
||||
#define _GAMEAPP_H_
|
||||
|
||||
@@ -46,7 +42,7 @@ class TransitionBase;
|
||||
class GameApp: public JApp
|
||||
{
|
||||
|
||||
private:
|
||||
private:
|
||||
#ifdef DEBUG
|
||||
int nbUpdates;
|
||||
float totalFPS;
|
||||
@@ -57,13 +53,11 @@ class GameApp: public JApp
|
||||
GameState* mCurrentState;
|
||||
GameState* mNextState;
|
||||
GameState* mGameStates[GAME_STATE_MAX];
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
int gameType;
|
||||
CardEffect *effect;
|
||||
|
||||
|
||||
GameApp();
|
||||
virtual ~GameApp();
|
||||
|
||||
@@ -74,11 +68,10 @@ class GameApp: public JApp
|
||||
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);
|
||||
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;
|
||||
|
||||
@@ -22,8 +22,9 @@ class TargetChooser;
|
||||
class Rules;
|
||||
using namespace std;
|
||||
|
||||
class GameObserver{
|
||||
protected:
|
||||
class GameObserver
|
||||
{
|
||||
protected:
|
||||
static GameObserver * mInstance;
|
||||
MTGCardInstance * cardWaitingForTargets;
|
||||
queue<WEvent *> eventsQueue;
|
||||
@@ -32,7 +33,7 @@ class GameObserver{
|
||||
int untap(MTGCardInstance * card);
|
||||
bool WaitForExtraPayment(MTGCardInstance* card);
|
||||
|
||||
public:
|
||||
public:
|
||||
int currentPlayerId;
|
||||
CombatStep combatStep;
|
||||
int turn;
|
||||
@@ -54,7 +55,7 @@ class GameObserver{
|
||||
TargetChooser * getCurrentTargetChooser();
|
||||
void stackObjectClicked(Interruptible * action);
|
||||
|
||||
int cardClick(MTGCardInstance * card,Targetable * _object = NULL );
|
||||
int cardClick(MTGCardInstance * card, Targetable * _object = NULL);
|
||||
int getCurrentGamePhase();
|
||||
void nextCombatStep();
|
||||
void userRequestNextGamePhase();
|
||||
|
||||
@@ -23,10 +23,12 @@ class WStyle;
|
||||
class StyleManager;
|
||||
class Player;
|
||||
|
||||
class Options {
|
||||
class Options
|
||||
{
|
||||
public:
|
||||
friend class GameSettings;
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
//Global settings
|
||||
ACTIVE_PROFILE,
|
||||
LANG,
|
||||
@@ -80,7 +82,8 @@ public:
|
||||
RANDOMDECK_MODE_UNLOCKED,
|
||||
AWARD_COLLECTOR,
|
||||
LAST_NAMED, //Any option after this does not look up in optionNames.
|
||||
SET_UNLOCKS = LAST_NAMED + 1, //For sets.
|
||||
SET_UNLOCKS = LAST_NAMED + 1,
|
||||
//For sets.
|
||||
|
||||
};
|
||||
|
||||
@@ -94,9 +97,13 @@ private:
|
||||
static const string optionNames[];
|
||||
};
|
||||
|
||||
class GameOption {
|
||||
class GameOption
|
||||
{
|
||||
public:
|
||||
virtual ~GameOption() {};
|
||||
virtual ~GameOption()
|
||||
{
|
||||
}
|
||||
;
|
||||
int number;
|
||||
string str;
|
||||
//All calls to asColor should include a fallback color for people without a theme.
|
||||
@@ -112,14 +119,16 @@ public:
|
||||
GameOption(int, string);
|
||||
};
|
||||
|
||||
struct EnumDefinition {
|
||||
struct EnumDefinition
|
||||
{
|
||||
int findIndex(int value);
|
||||
|
||||
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);
|
||||
@@ -127,7 +136,8 @@ public:
|
||||
EnumDefinition * def;
|
||||
};
|
||||
|
||||
class GameOptionAward: public GameOption {
|
||||
class GameOptionAward: public GameOption
|
||||
{
|
||||
public:
|
||||
GameOptionAward();
|
||||
virtual string menuStr();
|
||||
@@ -135,83 +145,143 @@ public:
|
||||
virtual bool read(string input);
|
||||
virtual bool giveAward(); //Returns false if already awarded
|
||||
virtual bool isViewed();
|
||||
virtual void setViewed(bool v = true) {viewed = v;};
|
||||
virtual void setViewed(bool v = true)
|
||||
{
|
||||
viewed = v;
|
||||
}
|
||||
;
|
||||
private:
|
||||
time_t achieved; //When was it awarded?
|
||||
bool viewed; //Flag it as "New!" or not.
|
||||
};
|
||||
|
||||
class GameOptionKeyBindings : public GameOption {
|
||||
class GameOptionKeyBindings: public GameOption
|
||||
{
|
||||
virtual bool read(string input);
|
||||
virtual bool write(std::ofstream*, string);
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
class OptionClosedHand: public EnumDefinition {
|
||||
class OptionClosedHand: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
enum { INVISIBLE = 0, VISIBLE = 1 };
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
enum
|
||||
{
|
||||
INVISIBLE = 0, VISIBLE = 1
|
||||
};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionClosedHand();
|
||||
static OptionClosedHand mDef;
|
||||
};
|
||||
class OptionHandDirection: public EnumDefinition {
|
||||
class OptionHandDirection: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
enum { VERTICAL = 0, HORIZONTAL = 1};
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
enum
|
||||
{
|
||||
VERTICAL = 0, HORIZONTAL = 1
|
||||
};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionHandDirection();
|
||||
static OptionHandDirection mDef;
|
||||
};
|
||||
class OptionManaDisplay: public EnumDefinition {
|
||||
class OptionManaDisplay: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
enum { DYNAMIC = 0, STATIC = 1, NOSTARSDYNAMIC = 2, BOTH = 3};
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
enum
|
||||
{
|
||||
DYNAMIC = 0, STATIC = 1, NOSTARSDYNAMIC = 2, BOTH = 3
|
||||
};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionManaDisplay();
|
||||
static OptionManaDisplay mDef;
|
||||
};
|
||||
class OptionMaxGrade: public EnumDefinition {
|
||||
class OptionMaxGrade: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionMaxGrade();
|
||||
static OptionMaxGrade mDef;
|
||||
};
|
||||
class OptionASkipPhase: public EnumDefinition {
|
||||
class OptionASkipPhase: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionASkipPhase();
|
||||
static OptionASkipPhase mDef;
|
||||
};
|
||||
class OptionEconDifficulty: public EnumDefinition {
|
||||
class OptionEconDifficulty: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionEconDifficulty();
|
||||
static OptionEconDifficulty mDef;
|
||||
};
|
||||
class OptionDifficulty: public EnumDefinition {
|
||||
class OptionDifficulty: public EnumDefinition
|
||||
{
|
||||
public:
|
||||
enum { NORMAL = 0, HARD = 1, HARDER = 2, EVIL = 3};
|
||||
static EnumDefinition * getInstance() {return &mDef;};
|
||||
enum
|
||||
{
|
||||
NORMAL = 0, HARD = 1, HARDER = 2, EVIL = 3
|
||||
};
|
||||
static EnumDefinition * getInstance()
|
||||
{
|
||||
return &mDef;
|
||||
}
|
||||
;
|
||||
private:
|
||||
OptionDifficulty();
|
||||
static OptionDifficulty mDef;
|
||||
};
|
||||
|
||||
class GameOptions {
|
||||
public:
|
||||
class GameOptions
|
||||
{
|
||||
public:
|
||||
string mFilename;
|
||||
int save();
|
||||
int load();
|
||||
@@ -221,32 +291,50 @@ class GameOptions {
|
||||
GameOptions(string filename);
|
||||
~GameOptions();
|
||||
|
||||
private:
|
||||
private:
|
||||
vector<GameOption*> values;
|
||||
vector<string> unknown;
|
||||
};
|
||||
|
||||
class GameSettings{
|
||||
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);
|
||||
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 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);
|
||||
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.
|
||||
|
||||
@@ -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,19 +41,19 @@ class Player;
|
||||
|
||||
class GameState
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
GameApp* mParent;
|
||||
JGE* mEngine;
|
||||
|
||||
public:
|
||||
public:
|
||||
GameState(GameApp* parent);
|
||||
virtual ~GameState() {}
|
||||
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;
|
||||
@@ -81,8 +81,8 @@ class GameState
|
||||
// build menu items based on the vector<DeckMetaData *>
|
||||
static void renderDeckMenu(DeckMenu * _menu, const vector<DeckMetaData *>& deckMetaDataList);
|
||||
|
||||
};
|
||||
bool sortByName( DeckMetaData * d1, DeckMetaData * d2 );
|
||||
};
|
||||
bool sortByName(DeckMetaData * d1, DeckMetaData * d2);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class WSrcCards;
|
||||
|
||||
class GameStateAwards: public GameState, public JGuiListener
|
||||
{
|
||||
private:
|
||||
private:
|
||||
WGuiList * listview;
|
||||
WGuiMenu * detailview;
|
||||
WSrcCards * setSrc;
|
||||
@@ -22,7 +22,7 @@ class GameStateAwards: public GameState, public JGuiListener
|
||||
int mState;
|
||||
int mDetailItem;
|
||||
|
||||
public:
|
||||
public:
|
||||
GameStateAwards(GameApp* parent);
|
||||
bool enterSet(int setid);
|
||||
bool enterStats(int option);
|
||||
|
||||
@@ -149,5 +149,4 @@ public:
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
class GameStateMenu: public GameState, public JGuiListener
|
||||
{
|
||||
private:
|
||||
private:
|
||||
TextScroller * scroller;
|
||||
int scrollerSet;
|
||||
JGuiController* mGuiController;
|
||||
@@ -52,7 +52,7 @@ class GameStateMenu: public GameState, public JGuiListener
|
||||
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:
|
||||
public:
|
||||
GameStateMenu(GameApp* parent);
|
||||
virtual ~GameStateMenu();
|
||||
virtual void Create();
|
||||
@@ -69,13 +69,13 @@ class GameStateMenu: public GameState, public JGuiListener
|
||||
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,
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,13 +10,16 @@ class WGuiTabMenu;
|
||||
class SimpleMenu;
|
||||
class SimplePad;
|
||||
|
||||
struct KeybGrabber {
|
||||
struct KeybGrabber
|
||||
{
|
||||
virtual void KeyPressed(LocalKeySym) = 0;
|
||||
};
|
||||
|
||||
class GameStateOptions: public GameState, public JGuiListener {
|
||||
class GameStateOptions: public GameState, public JGuiListener
|
||||
{
|
||||
private:
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
SHOW_OPTIONS,
|
||||
SHOW_OPTIONS_MENU,
|
||||
SAVE
|
||||
@@ -25,7 +28,7 @@ private:
|
||||
bool mReload;
|
||||
KeybGrabber* grabber;
|
||||
|
||||
public:
|
||||
public:
|
||||
SimpleMenu * optionsMenu;
|
||||
WGuiTabMenu * optionsTabs;
|
||||
int mState;
|
||||
@@ -45,5 +48,4 @@ private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#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,13 +29,16 @@
|
||||
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);
|
||||
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();
|
||||
@@ -58,7 +60,7 @@ private:
|
||||
|
||||
class GameStateShop: public GameState, public JGuiListener
|
||||
{
|
||||
private:
|
||||
private:
|
||||
JQuad * pspIcons[8];
|
||||
WSrcCards * srcCards;
|
||||
JTexture * altThumb[8];
|
||||
@@ -96,7 +98,7 @@ class GameStateShop: public GameState, public JGuiListener
|
||||
ShopBooster mBooster[BOOSTER_SLOTS];
|
||||
|
||||
void load();
|
||||
void save(bool force=false);
|
||||
void save(bool force = false);
|
||||
void updateCounts();
|
||||
void beginPurchase(int controlId);
|
||||
void purchaseCard(int controlId);
|
||||
@@ -105,7 +107,7 @@ class GameStateShop: public GameState, public JGuiListener
|
||||
void cancelBooster(int controlId);
|
||||
int purchasePrice(int offset);
|
||||
string descPurchase(int controlId, bool tiny = false);
|
||||
public:
|
||||
public:
|
||||
GameStateShop(GameApp* parent);
|
||||
virtual ~GameStateShop();
|
||||
virtual void Start();
|
||||
@@ -115,9 +117,8 @@ class GameStateShop: public GameState, public JGuiListener
|
||||
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[];
|
||||
static float _x1[], _y1[], _x2[], _y2[], _x3[], _y3[], _x4[], _y4[];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#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:
|
||||
public:
|
||||
GameStateStory(GameApp* parent);
|
||||
~GameStateStory();
|
||||
void Start();
|
||||
@@ -25,5 +25,4 @@ private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,14 +5,19 @@
|
||||
#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();
|
||||
|
||||
virtual bool Finished() {return (mElapsed >= mDuration);};
|
||||
virtual bool Finished()
|
||||
{
|
||||
return (mElapsed >= mDuration);
|
||||
}
|
||||
;
|
||||
virtual void Update(float dt);
|
||||
virtual void Render() = 0;
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
@@ -24,7 +29,8 @@ public:
|
||||
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();
|
||||
|
||||
@@ -7,17 +7,16 @@ struct GuiAvatar;
|
||||
class GuiGraveyard;
|
||||
class GuiLibrary;
|
||||
class GuiOpponentHand;
|
||||
class GuiAvatars : public GuiLayer
|
||||
class GuiAvatars: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
GuiAvatar* self, *opponent;
|
||||
GuiGraveyard* selfGraveyard, *opponentGraveyard;
|
||||
GuiLibrary* selfLibrary, *opponentLibrary;
|
||||
GuiOpponentHand *opponentHand;
|
||||
GuiAvatar* active;
|
||||
|
||||
|
||||
public:
|
||||
public:
|
||||
GuiAvatars();
|
||||
~GuiAvatars();
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include "GuiLayers.h"
|
||||
#include "WEvent.h"
|
||||
|
||||
class GuiBackground : public GuiLayer
|
||||
class GuiBackground: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
JQuad* quad;
|
||||
|
||||
public:
|
||||
public:
|
||||
GuiBackground();
|
||||
~GuiBackground();
|
||||
virtual void Render();
|
||||
|
||||
@@ -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,16 +7,23 @@
|
||||
#include "MTGCardInstance.h"
|
||||
#include "DamagerDamaged.h"
|
||||
|
||||
class GuiCombat : public GuiLayer
|
||||
class GuiCombat: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
GameObserver* go;
|
||||
DamagerDamaged* active;
|
||||
AttackerDamaged* activeAtk;
|
||||
static JTexture* ok_tex;
|
||||
Pos ok, enemy_avatar;
|
||||
DamagerDamaged* current;
|
||||
enum { BLK, ATK, OK, NONE } cursor_pos;
|
||||
enum
|
||||
{
|
||||
BLK,
|
||||
ATK,
|
||||
OK,
|
||||
NONE
|
||||
} cursor_pos;
|
||||
|
||||
CombatStep step;
|
||||
void validateDamage();
|
||||
void addOne(DefenserDamaged* blocker, CombatStep);
|
||||
@@ -24,7 +31,7 @@ class GuiCombat : public GuiLayer
|
||||
void remaskBlkViews(AttackerDamaged* before, AttackerDamaged* after);
|
||||
int resolve();
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
vector<AttackerDamaged*> attackers;
|
||||
void autoaffectDamage(AttackerDamaged* attacker, CombatStep);
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
|
||||
#include "GuiLayers.h"
|
||||
|
||||
class GuiFrame : public GuiLayer
|
||||
class GuiFrame: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
JQuad* wood;
|
||||
JQuad* gold1, *gold2, *goldGlow;
|
||||
float step;
|
||||
|
||||
public:
|
||||
public:
|
||||
GuiFrame();
|
||||
~GuiFrame();
|
||||
virtual void Render();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
class GuiHand;
|
||||
|
||||
struct HandLimitor : public Limitor
|
||||
struct HandLimitor: public Limitor
|
||||
{
|
||||
GuiHand* hand;
|
||||
virtual bool select(Target*);
|
||||
@@ -18,9 +18,9 @@ struct HandLimitor : public Limitor
|
||||
HandLimitor(GuiHand* hand);
|
||||
};
|
||||
|
||||
class GuiHand : public GuiLayer
|
||||
class GuiHand: public GuiLayer
|
||||
{
|
||||
public:
|
||||
public:
|
||||
static const float ClosedRowX;
|
||||
static const float LeftRowX;
|
||||
static const float RightRowX;
|
||||
@@ -30,12 +30,12 @@ class GuiHand : public GuiLayer
|
||||
static const float OpenY;
|
||||
static const float ClosedY;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
const MTGHand* hand;
|
||||
JQuad *back;
|
||||
vector<CardView*> cards;
|
||||
|
||||
public:
|
||||
public:
|
||||
GuiHand(MTGHand* hand);
|
||||
~GuiHand();
|
||||
void Update(float dt);
|
||||
@@ -44,27 +44,26 @@ class GuiHand : public GuiLayer
|
||||
friend struct HandLimitor;
|
||||
};
|
||||
|
||||
class GuiHandOpponent : public GuiHand
|
||||
class GuiHandOpponent: public GuiHand
|
||||
{
|
||||
public:
|
||||
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:
|
||||
protected:
|
||||
typedef enum
|
||||
{
|
||||
Open,
|
||||
Closed
|
||||
Open, Closed
|
||||
} HandState;
|
||||
HandState state;
|
||||
Pos backpos;
|
||||
|
||||
public:
|
||||
public:
|
||||
GuiHandSelf(MTGHand* hand);
|
||||
~GuiHandSelf();
|
||||
virtual int receiveEventPlus(WEvent* e);
|
||||
@@ -79,7 +78,8 @@ class GuiHandSelf : public GuiHand
|
||||
HandState GetState()
|
||||
{
|
||||
return state;
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
HandLimitor* limitor;
|
||||
};
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
class GameObserver;
|
||||
class Player;
|
||||
|
||||
class GuiLayer{
|
||||
protected:
|
||||
class GuiLayer
|
||||
{
|
||||
protected:
|
||||
JButton mActionButton;
|
||||
public:
|
||||
public:
|
||||
int mCount;
|
||||
int mCurr;
|
||||
vector<JGuiObject *> mObjects;
|
||||
@@ -28,17 +29,31 @@ class GuiLayer{
|
||||
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 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,7 +6,7 @@
|
||||
#include "GameApp.h"
|
||||
#include "GuiLayers.h"
|
||||
|
||||
class ManaIcon : public Pos
|
||||
class ManaIcon: public Pos
|
||||
{
|
||||
hgeParticleSystem* particleSys;
|
||||
JQuad* icon;
|
||||
@@ -16,26 +16,33 @@ class ManaIcon : public Pos
|
||||
float yP1, yP2, yP3;
|
||||
float tP1;
|
||||
float f;
|
||||
float destx,desty;
|
||||
public:
|
||||
enum { ALIVE, WITHERING, DROPPING, DEAD } mode;
|
||||
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(int color, float x, float y, float destx, float desty);
|
||||
~ManaIcon();
|
||||
};
|
||||
|
||||
class GuiMana : public GuiLayer
|
||||
class GuiMana: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
vector<ManaIcon*> manas;
|
||||
float x, y;
|
||||
Player * owner;
|
||||
void RenderStatic();
|
||||
public:
|
||||
public:
|
||||
GuiMana(float x, float y, Player *p);
|
||||
~GuiMana();
|
||||
virtual void Render();
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
#include "PhaseRing.h"
|
||||
#include "WEvent.h"
|
||||
|
||||
class GuiPhaseBar : public GuiLayer
|
||||
class GuiPhaseBar: public GuiLayer
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
Phase* phase;
|
||||
float angle;
|
||||
|
||||
public:
|
||||
public:
|
||||
GuiPhaseBar();
|
||||
~GuiPhaseBar();
|
||||
void Update(float dt);
|
||||
|
||||
@@ -4,15 +4,16 @@
|
||||
#include "GuiLayers.h"
|
||||
#include "CardGui.h"
|
||||
|
||||
class GuiPlay : public GuiLayer
|
||||
class GuiPlay: public GuiLayer
|
||||
{
|
||||
public:
|
||||
public:
|
||||
static const float HORZWIDTH;
|
||||
static const float VERTHEIGHT;
|
||||
typedef vector<CardView*>::iterator iterator;
|
||||
|
||||
protected:
|
||||
class CardStack {
|
||||
protected:
|
||||
class CardStack
|
||||
{
|
||||
protected:
|
||||
unsigned total;
|
||||
float baseX, baseY;
|
||||
@@ -24,13 +25,15 @@ class GuiPlay : public GuiLayer
|
||||
void RenderSpell(MTGCardInstance*, iterator begin, iterator end, float x, float y);
|
||||
};
|
||||
|
||||
class HorzStack : public CardStack {
|
||||
class HorzStack: public CardStack
|
||||
{
|
||||
public:
|
||||
HorzStack();
|
||||
void Render(CardView*, iterator begin, iterator end);
|
||||
void Enstack(CardView*);
|
||||
};
|
||||
class VertStack : public CardStack {
|
||||
class VertStack: public CardStack
|
||||
{
|
||||
protected:
|
||||
unsigned count;
|
||||
public:
|
||||
@@ -40,7 +43,8 @@ class GuiPlay : public GuiLayer
|
||||
void Enstack(CardView*);
|
||||
inline float nextX();
|
||||
};
|
||||
class BattleField : public HorzStack {
|
||||
class BattleField: public HorzStack
|
||||
{
|
||||
static const float HEIGHT;
|
||||
unsigned attackers;
|
||||
unsigned blockers;
|
||||
@@ -61,11 +65,11 @@ class GuiPlay : public GuiLayer
|
||||
void Render();
|
||||
};
|
||||
|
||||
class Lands : public HorzStack {};
|
||||
class Creatures : public HorzStack {};
|
||||
class Spells : public VertStack {};
|
||||
class Lands: public HorzStack {};
|
||||
class Creatures: public HorzStack {};
|
||||
class Spells: public VertStack {};
|
||||
|
||||
protected:
|
||||
protected:
|
||||
GameObserver* game;
|
||||
Creatures selfCreatures, opponentCreatures;
|
||||
BattleField battleField;
|
||||
@@ -75,7 +79,7 @@ class GuiPlay : public GuiLayer
|
||||
|
||||
vector<CardView*> cards;
|
||||
|
||||
public:
|
||||
public:
|
||||
GuiPlay(GameObserver*);
|
||||
~GuiPlay();
|
||||
virtual void Render();
|
||||
|
||||
@@ -9,36 +9,44 @@
|
||||
|
||||
class CardView;
|
||||
|
||||
struct GuiStatic : public PlayGuiObject{
|
||||
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;
|
||||
struct GuiAvatar: public GuiStatic
|
||||
{
|
||||
typedef enum
|
||||
{
|
||||
TOP_LEFT,
|
||||
BOTTOM_RIGHT
|
||||
} Corner;
|
||||
|
||||
static const unsigned Width = 35;
|
||||
static const unsigned Height = 50;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
int avatarRed;
|
||||
int currentLife;
|
||||
int currentpoisonCount;
|
||||
Corner corner;
|
||||
public:
|
||||
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;
|
||||
};
|
||||
|
||||
struct GuiGameZone : public GuiStatic{
|
||||
struct GuiGameZone: public GuiStatic
|
||||
{
|
||||
static const int Width = 20;
|
||||
static const int Height = 25;
|
||||
vector<CardView*> cards;
|
||||
|
||||
public:
|
||||
public:
|
||||
MTGGameZone * zone;
|
||||
CardDisplay * cd;
|
||||
int showCards;
|
||||
@@ -53,7 +61,8 @@ struct GuiGameZone : public GuiStatic{
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
//opponenthand
|
||||
class GuiOpponentHand: public GuiGameZone{
|
||||
class GuiOpponentHand: public GuiGameZone
|
||||
{
|
||||
public:
|
||||
Player * player;
|
||||
GuiOpponentHand(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* Parent);
|
||||
@@ -62,8 +71,9 @@ public:
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
//end of my addition
|
||||
class GuiGraveyard: public GuiGameZone{
|
||||
public:
|
||||
class GuiGraveyard: public GuiGameZone
|
||||
{
|
||||
public:
|
||||
Player * player;
|
||||
GuiGraveyard(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
|
||||
int receiveEventPlus(WEvent*);
|
||||
@@ -71,8 +81,9 @@ class GuiGraveyard: public GuiGameZone{
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class GuiLibrary: public GuiGameZone{
|
||||
public:
|
||||
class GuiLibrary: public GuiGameZone
|
||||
{
|
||||
public:
|
||||
Player * player;
|
||||
GuiLibrary(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
|
||||
@@ -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,14 +62,30 @@ 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 int resolve()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual MTGAbility* clone() const = 0;
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
virtual int addToGame();
|
||||
@@ -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 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,7 +214,7 @@ 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);
|
||||
@@ -200,11 +224,11 @@ public:
|
||||
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 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();
|
||||
};
|
||||
|
||||
|
||||
@@ -17,15 +17,16 @@ class CardPrimitive;
|
||||
|
||||
using namespace std;
|
||||
|
||||
class MTGCard {
|
||||
protected:
|
||||
class MTGCard
|
||||
{
|
||||
protected:
|
||||
friend class MTGSetInfo;
|
||||
int mtgid;
|
||||
char rarity;
|
||||
char image_name[MTGCARD_NAME_SIZE];
|
||||
int init();
|
||||
|
||||
public:
|
||||
public:
|
||||
int setId;
|
||||
CardPrimitive * data;
|
||||
|
||||
@@ -44,7 +45,4 @@ class MTGCard {
|
||||
char * getImageName();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "Damage.h"
|
||||
#include "Targetable.h"
|
||||
|
||||
|
||||
class MTGCardInstance;
|
||||
class MTGPlayerCards;
|
||||
class MTGAbility;
|
||||
@@ -24,8 +23,9 @@ struct Pos;
|
||||
#include <list>
|
||||
using namespace std;
|
||||
|
||||
class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
protected:
|
||||
class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable
|
||||
{
|
||||
protected:
|
||||
int untapping;
|
||||
int nb_damages;
|
||||
string sample;
|
||||
@@ -39,7 +39,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
int addBlocker(MTGCardInstance * c);
|
||||
int removeBlocker(MTGCardInstance * c);
|
||||
int init();
|
||||
public:
|
||||
public:
|
||||
int setAttacker(int value);
|
||||
MTGGameZone * currentZone;
|
||||
Pos* view;
|
||||
@@ -72,16 +72,18 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
MTGCardInstance * changeController(Player * newcontroller);
|
||||
Player * owner;
|
||||
Counters * counters;
|
||||
int typeAsTarget(){return TARGET_CARD;}
|
||||
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);
|
||||
void setSubtype(string value);
|
||||
int removeType(string value, int removeAll = 0);
|
||||
int removeType(int value, int removeAll = 0);
|
||||
|
||||
@@ -90,7 +92,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
//Combat
|
||||
bool blocked; //Blocked this turn or not?
|
||||
MTGCardInstance * defenser;
|
||||
list<MTGCardInstance *>blockers;
|
||||
list<MTGCardInstance *> blockers;
|
||||
int attacker;
|
||||
int toggleDefenser(MTGCardInstance * opponent);
|
||||
int raiseBlockerRankOrder(MTGCardInstance * blocker);
|
||||
@@ -105,7 +107,7 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
int isAttacker();
|
||||
MTGCardInstance * isDefenser();
|
||||
int initAttackersDefensers();
|
||||
MTGCardInstance * getNextOpponent(MTGCardInstance * previous=NULL);
|
||||
MTGCardInstance * getNextOpponent(MTGCardInstance * previous = NULL);
|
||||
int nbOpponents();
|
||||
int stepPower(CombatStep step);
|
||||
int afterDamage();
|
||||
@@ -123,16 +125,15 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
int bury();
|
||||
int destroy();
|
||||
|
||||
|
||||
int addToToughness(int value);
|
||||
int setToughness(int value);
|
||||
|
||||
vector<TargetChooser *>protections;
|
||||
vector<TargetChooser *> protections;
|
||||
int addProtection(TargetChooser * tc);
|
||||
int removeProtection(TargetChooser *tc, int erase = 0);
|
||||
int protectedAgainst(MTGCardInstance * card);
|
||||
|
||||
vector<TargetChooser *>cantBeBlockedBys;
|
||||
vector<TargetChooser *> cantBeBlockedBys;
|
||||
int addCantBeBlockedBy(TargetChooser * tc);
|
||||
int removeCantBeBlockedBy(TargetChooser *tc, int erase = 0);
|
||||
int cantBeBlockedBy(MTGCardInstance * card);
|
||||
@@ -168,5 +169,4 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
|
||||
ostream& operator<<(ostream&, const MTGCardInstance&);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "GameApp.h"
|
||||
#include "WResourceManager.h"
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
using std::string;
|
||||
@@ -15,7 +14,8 @@ class GameApp;
|
||||
class MTGCard;
|
||||
class CardPrimitive;
|
||||
class MTGPack;
|
||||
class MTGSetInfo{
|
||||
class MTGSetInfo
|
||||
{
|
||||
public:
|
||||
MTGSetInfo(string _id);
|
||||
~MTGSetInfo();
|
||||
@@ -33,7 +33,8 @@ public:
|
||||
string getBlock();
|
||||
void processConfLine(string line);
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
//For memoized counts
|
||||
LAND = 0,
|
||||
COMMON = 1,
|
||||
@@ -51,15 +52,16 @@ public:
|
||||
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,
|
||||
enum
|
||||
{
|
||||
INTERNAL_SET = -1, ALL_SETS = -2,
|
||||
};
|
||||
|
||||
friend class MTGSetInfo;
|
||||
@@ -86,27 +88,29 @@ protected:
|
||||
|
||||
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:
|
||||
protected:
|
||||
int conf_read_mode;
|
||||
int colorsCount[Constants::MTG_NB_COLORS];
|
||||
int total_cards;
|
||||
GameApp * parent;
|
||||
void init();
|
||||
void initCounters();
|
||||
public:
|
||||
enum {
|
||||
public:
|
||||
enum
|
||||
{
|
||||
READ_ANYTHING = 0,
|
||||
READ_CARD = 1,
|
||||
READ_METADATA = 2,
|
||||
};
|
||||
vector<int> ids;
|
||||
map<int, MTGCard *> collection;
|
||||
map<string,CardPrimitive *>primitives;
|
||||
map<string, CardPrimitive *> primitives;
|
||||
MTGAllCards();
|
||||
~MTGAllCards();
|
||||
MTGCard * _(int id);
|
||||
@@ -120,28 +124,29 @@ private:
|
||||
int countBySet(int setId);
|
||||
int totalCards();
|
||||
int randomCardId();
|
||||
private:
|
||||
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:
|
||||
class MTGDeck
|
||||
{
|
||||
protected:
|
||||
string filename;
|
||||
int total_cards;
|
||||
|
||||
public:
|
||||
public:
|
||||
MTGAllCards * database;
|
||||
map <int,int> cards;
|
||||
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 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();
|
||||
@@ -155,5 +160,4 @@ class MTGDeck{
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,15 +9,14 @@ const float DEFAULT_TEXT_FONT_SCALE = 1.0f;
|
||||
using std::string;
|
||||
class Constants
|
||||
{
|
||||
public:
|
||||
public:
|
||||
// Exception Codes
|
||||
|
||||
/* 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;
|
||||
|
||||
|
||||
// color constants
|
||||
static const string kManaColorless;
|
||||
static const string kManaGreen;
|
||||
@@ -50,7 +49,6 @@ class Constants
|
||||
|
||||
MTG_NB_COLORS = 7,
|
||||
|
||||
|
||||
MTG_UNCOLORED = 0,
|
||||
MTG_FOREST = 1,
|
||||
MTG_ISLAND = 2,
|
||||
@@ -58,7 +56,6 @@ class Constants
|
||||
MTG_SWAMP = 4,
|
||||
MTG_PLAIN = 5,
|
||||
|
||||
|
||||
MTG_TYPE_CREATURE = 10,
|
||||
MTG_TYPE_ARTIFACT = 11,
|
||||
MTG_TYPE_ENCHANTMENT = 12,
|
||||
@@ -66,7 +63,6 @@ class Constants
|
||||
MTG_TYPE_LAND = 14,
|
||||
MTG_TYPE_INSTANT = 15,
|
||||
|
||||
|
||||
MTG_PHASE_BEFORE_BEGIN = 0,
|
||||
MTG_PHASE_UNTAP = 1,
|
||||
MTG_PHASE_UPKEEP = 2,
|
||||
@@ -172,7 +168,6 @@ class Constants
|
||||
|
||||
NB_BASIC_ABILITIES = 84,
|
||||
|
||||
|
||||
RARITY_S = 'S', //Special Rarity
|
||||
RARITY_M = 'M', //Mythics
|
||||
RARITY_R = 'R', //Rares
|
||||
@@ -208,16 +203,16 @@ class Constants
|
||||
GRADE_UNSUPPORTED = 4,
|
||||
GRADE_DANGEROUS = 5,
|
||||
|
||||
ASKIP_NONE=0,
|
||||
ASKIP_SAFE=1,
|
||||
ASKIP_FULL=2,
|
||||
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 map<string, int> MTGBasicAbilitiesMap;
|
||||
static const char* MTGBasicAbilities[];
|
||||
static const char* MTGPhaseNames[];
|
||||
static const char* MTGPhaseCodeNames[];
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
#include <JGui.h>
|
||||
#include "WFont.h"
|
||||
|
||||
|
||||
class MTGGamePhase: public ActionElement {
|
||||
protected:
|
||||
class MTGGamePhase: public ActionElement
|
||||
{
|
||||
protected:
|
||||
float animation;
|
||||
int currentState;
|
||||
WFont * mFont;
|
||||
public:
|
||||
public:
|
||||
MTGGamePhase(int id);
|
||||
virtual void Update(float dt);
|
||||
bool CheckUserInput(JButton key);
|
||||
@@ -21,5 +21,4 @@ class MTGGamePhase: public ActionElement {
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,12 +14,14 @@ class MTGDeck;
|
||||
class MTGCardInstance;
|
||||
class Player;
|
||||
|
||||
class MTGGameZone {
|
||||
protected:
|
||||
class MTGGameZone
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
enum{
|
||||
enum
|
||||
{
|
||||
ALL_ZONES = -1,
|
||||
|
||||
MY_GRAVEYARD = 11,
|
||||
@@ -69,7 +71,7 @@ class MTGGameZone {
|
||||
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;
|
||||
map<MTGCardInstance *, int> cardsMap;
|
||||
int nb_cards;
|
||||
MTGGameZone();
|
||||
~MTGGameZone();
|
||||
@@ -89,57 +91,85 @@ class MTGGameZone {
|
||||
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);
|
||||
static MTGGameZone *intToZone(int zoneId, MTGCardInstance * source = NULL, MTGCardInstance * target = NULL);
|
||||
bool needShuffle;
|
||||
virtual const char * getName(){return "zone";};
|
||||
virtual const char * getName()
|
||||
{
|
||||
return "zone";
|
||||
}
|
||||
;
|
||||
virtual ostream& toString(ostream&) const;
|
||||
};
|
||||
|
||||
class MTGLibrary: public MTGGameZone {
|
||||
public:
|
||||
class MTGLibrary: public MTGGameZone
|
||||
{
|
||||
public:
|
||||
void shuffleTopToBottom(int nbcards);
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "library";}
|
||||
const char * getName()
|
||||
{
|
||||
return "library";
|
||||
}
|
||||
};
|
||||
|
||||
class MTGGraveyard: public MTGGameZone {
|
||||
public:
|
||||
class MTGGraveyard: public MTGGameZone
|
||||
{
|
||||
public:
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "graveyard";}
|
||||
const char * getName()
|
||||
{
|
||||
return "graveyard";
|
||||
}
|
||||
};
|
||||
|
||||
class MTGHand: public MTGGameZone {
|
||||
public:
|
||||
class MTGHand: public MTGGameZone
|
||||
{
|
||||
public:
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "hand";}
|
||||
const char * getName()
|
||||
{
|
||||
return "hand";
|
||||
}
|
||||
};
|
||||
|
||||
class MTGRemovedFromGame: public MTGGameZone {
|
||||
public:
|
||||
class MTGRemovedFromGame: public MTGGameZone
|
||||
{
|
||||
public:
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "exile";}
|
||||
const char * getName()
|
||||
{
|
||||
return "exile";
|
||||
}
|
||||
};
|
||||
|
||||
class MTGStack: public MTGGameZone {
|
||||
public:
|
||||
class MTGStack: public MTGGameZone
|
||||
{
|
||||
public:
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "stack";}
|
||||
const char * getName()
|
||||
{
|
||||
return "stack";
|
||||
}
|
||||
};
|
||||
|
||||
class MTGInPlay: public MTGGameZone {
|
||||
public:
|
||||
class MTGInPlay: public MTGGameZone
|
||||
{
|
||||
public:
|
||||
void untapAll();
|
||||
MTGCardInstance * getNextAttacker(MTGCardInstance * previous);
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "battlefield";}
|
||||
const char * getName()
|
||||
{
|
||||
return "battlefield";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class MTGPlayerCards {
|
||||
protected:
|
||||
class MTGPlayerCards
|
||||
{
|
||||
protected:
|
||||
void init();
|
||||
|
||||
public:
|
||||
public:
|
||||
MTGLibrary * library;
|
||||
MTGGraveyard * graveyard;
|
||||
MTGHand * hand;
|
||||
@@ -156,9 +186,9 @@ class MTGPlayerCards {
|
||||
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 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 discardRandom(MTGGameZone * from, MTGCardInstance * source);
|
||||
void drawFromLibrary();
|
||||
void showHand();
|
||||
void resetLibrary();
|
||||
|
||||
@@ -3,32 +3,54 @@
|
||||
|
||||
class ShopBooster;
|
||||
|
||||
class MTGPackEntry{
|
||||
class MTGPackEntry
|
||||
{
|
||||
public:
|
||||
virtual ~MTGPackEntry() {};
|
||||
virtual int addCard(WSrcCards * pool,MTGDeck * to) = 0;
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
@@ -38,23 +60,48 @@ public:
|
||||
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;};
|
||||
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()
|
||||
{
|
||||
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;};
|
||||
string getSort()
|
||||
{
|
||||
return sort;
|
||||
}
|
||||
;
|
||||
int getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
;
|
||||
static WSrcCards * getPool(string poolstr);
|
||||
protected:
|
||||
void countCards();
|
||||
@@ -72,12 +119,17 @@ protected:
|
||||
vector<MTGPackSlot*> slotss;
|
||||
};
|
||||
|
||||
class MTGPacks{
|
||||
class MTGPacks
|
||||
{
|
||||
public:
|
||||
~MTGPacks();
|
||||
MTGPack * randomPack(int key=0);
|
||||
MTGPack * randomPack(int key = 0);
|
||||
void loadAll();
|
||||
int size() {return (int)packs.size();};
|
||||
int size()
|
||||
{
|
||||
return (int) packs.size();
|
||||
}
|
||||
;
|
||||
void refreshUnlocked();
|
||||
|
||||
static MTGPack * getDefault();
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "utils.h"
|
||||
#include "MTGDefinitions.h"
|
||||
|
||||
|
||||
class ManaCostHybrid;
|
||||
class ExtraCosts;
|
||||
class ExtraCost;
|
||||
@@ -12,15 +11,17 @@ class MTGAbility;
|
||||
class MTGCardInstance;
|
||||
class Player;
|
||||
|
||||
class ManaCost{
|
||||
protected:
|
||||
int cost[Constants::MTG_NB_COLORS+1];
|
||||
class ManaCost
|
||||
{
|
||||
protected:
|
||||
int cost[Constants::MTG_NB_COLORS + 1];
|
||||
ManaCostHybrid * hybrids[10];
|
||||
unsigned int nbhybrids;
|
||||
int extraCostsIsCopy;
|
||||
|
||||
public:
|
||||
enum{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
MANA_UNPAID = 0,
|
||||
MANA_PAID = 1,
|
||||
MANA_PAID_WITH_KICKER = 2,
|
||||
@@ -44,7 +45,7 @@ class ManaCost{
|
||||
ManaCost();
|
||||
~ManaCost();
|
||||
ManaCost(ManaCost * _manaCost);
|
||||
void copy (ManaCost * _manaCost);
|
||||
void copy(ManaCost * _manaCost);
|
||||
int isNull();
|
||||
int getConvertedCost();
|
||||
string toString();
|
||||
@@ -52,7 +53,7 @@ class ManaCost{
|
||||
//Returns NULL if i is greater than nbhybrids
|
||||
ManaCostHybrid * getHybridCost(unsigned int i);
|
||||
int hasColor(int color);
|
||||
int remove (int color, int value);
|
||||
int remove(int color, int value);
|
||||
int add(int color, int value);
|
||||
|
||||
//
|
||||
@@ -68,7 +69,7 @@ class ManaCost{
|
||||
int tryToPayHybrids(ManaCostHybrid * _hybrids[], int _nbhybrids, int diff[]);
|
||||
void randomDiffHybrids(ManaCost * _cost, int diff[]);
|
||||
int add(ManaCost * _cost);
|
||||
int pay (ManaCost * _cost);
|
||||
int pay(ManaCost * _cost);
|
||||
|
||||
//return 1 if _cost can be paid with current data, 0 otherwise
|
||||
int canAfford(ManaCost * _cost);
|
||||
@@ -82,17 +83,18 @@ class ManaCost{
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const ManaCost& m);
|
||||
|
||||
class ManaPool:public ManaCost{
|
||||
class ManaPool: public ManaCost
|
||||
{
|
||||
protected:
|
||||
Player * player;
|
||||
public:
|
||||
void init();
|
||||
ManaPool(Player * player);
|
||||
ManaPool(ManaCost * _manaCost, Player * player);
|
||||
int remove (int color, int value);
|
||||
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);
|
||||
int pay(ManaCost * _cost);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
#ifndef _MANACOST_HYBRID_H_
|
||||
#define _MANACOST_HYBRID_H_
|
||||
|
||||
class ManaCostHybrid{
|
||||
public:
|
||||
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);
|
||||
ManaCostHybrid(int c1, int v1, int c2, int v2);
|
||||
void init(int c1, int v1, int c2, int v2);
|
||||
int getConvertedCost();
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class hgeParticleSystem;
|
||||
|
||||
class MenuItem: public JGuiObject
|
||||
{
|
||||
private:
|
||||
private:
|
||||
bool mHasFocus;
|
||||
WFont *mFont;
|
||||
string mText;
|
||||
@@ -29,8 +29,7 @@ class MenuItem: public JGuiObject
|
||||
JQuad * offQuad;
|
||||
hgeParticleSystem* mParticleSys;
|
||||
|
||||
|
||||
public:
|
||||
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();
|
||||
@@ -39,7 +38,13 @@ class MenuItem: public JGuiObject
|
||||
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 bool getTopLeft(float& top, float& left)
|
||||
{
|
||||
top = mY;
|
||||
left = mX;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
@@ -9,11 +9,10 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
// private class only used by Navigator, see implementation file
|
||||
class CardZone;
|
||||
|
||||
class Navigator : public CardSelectorBase
|
||||
class Navigator: public CardSelectorBase
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _OSD_H_
|
||||
#define _OSD_H_
|
||||
|
||||
class OSDLayer : public PlayGuiObjectController
|
||||
class OSDLayer: public PlayGuiObjectController
|
||||
{
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
|
||||
@@ -20,21 +20,30 @@ using std::string;
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
class OptionItem: public WGuiItem{
|
||||
class OptionItem: public WGuiItem
|
||||
{
|
||||
public:
|
||||
OptionItem( int _id, string _displayValue);
|
||||
OptionItem(int _id, string _displayValue);
|
||||
virtual ~OptionItem() {};
|
||||
|
||||
//Accessors
|
||||
virtual int getId() {return id;};
|
||||
virtual void setId(int _id){id = _id;};
|
||||
virtual int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
virtual void setId(int _id)
|
||||
{
|
||||
id = _id;
|
||||
}
|
||||
|
||||
protected:
|
||||
int id;
|
||||
};
|
||||
|
||||
class OptionInteger:public OptionItem{
|
||||
public:
|
||||
class OptionInteger: public OptionItem
|
||||
{
|
||||
public:
|
||||
int value; //Current value.
|
||||
int defValue; //Default value.
|
||||
string strDefault; //What to call the default value.
|
||||
@@ -42,38 +51,78 @@ class OptionInteger:public OptionItem{
|
||||
|
||||
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 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 updateValue()
|
||||
{
|
||||
value += increment;
|
||||
if (value > maxValue)
|
||||
value = minValue;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class OptionSelect:public OptionItem{
|
||||
public:
|
||||
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();};
|
||||
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 bool Changed()
|
||||
{
|
||||
return (value != prior_value);
|
||||
}
|
||||
|
||||
virtual void setData();
|
||||
virtual void initSelections();
|
||||
virtual void updateValue(){value++; if (value > selections.size() - 1) value=0;};
|
||||
protected:
|
||||
virtual void updateValue()
|
||||
{
|
||||
value++;
|
||||
if (value > selections.size() - 1)
|
||||
value = 0;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
size_t prior_value;
|
||||
};
|
||||
|
||||
class OptionLanguage: public OptionSelect{
|
||||
public:
|
||||
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 addSelection(string s)
|
||||
{
|
||||
addSelection(s, s);
|
||||
}
|
||||
;
|
||||
virtual void addSelection(string s, string show);
|
||||
virtual void initSelections();
|
||||
virtual void confirmChange(bool confirmed);
|
||||
virtual void Reload();
|
||||
@@ -84,26 +133,29 @@ protected:
|
||||
vector<string> actual_data;
|
||||
};
|
||||
|
||||
class OptionThemeStyle: public OptionSelect{
|
||||
public:
|
||||
class OptionThemeStyle: public OptionSelect
|
||||
{
|
||||
public:
|
||||
virtual bool Visible();
|
||||
virtual void Reload();
|
||||
virtual void confirmChange(bool confirmed);
|
||||
OptionThemeStyle(string _displayValue);
|
||||
};
|
||||
class OptionDirectory:public OptionSelect{
|
||||
public:
|
||||
class OptionDirectory: public OptionSelect
|
||||
{
|
||||
public:
|
||||
virtual void Reload();
|
||||
OptionDirectory(string root, int id, string displayValue, const string type);
|
||||
protected:
|
||||
protected:
|
||||
const string root;
|
||||
const string type;
|
||||
};
|
||||
|
||||
class OptionTheme:public OptionDirectory{
|
||||
private:
|
||||
class OptionTheme: public OptionDirectory
|
||||
{
|
||||
private:
|
||||
static const string DIRTESTER;
|
||||
public:
|
||||
public:
|
||||
OptionTheme(OptionThemeStyle * style = NULL);
|
||||
JQuad * getImage();
|
||||
virtual void updateValue();
|
||||
@@ -118,14 +170,23 @@ protected:
|
||||
bool bChecked;
|
||||
};
|
||||
|
||||
class OptionProfile:public OptionDirectory{
|
||||
private:
|
||||
class OptionProfile: public OptionDirectory
|
||||
{
|
||||
private:
|
||||
static const string DIRTESTER;
|
||||
public:
|
||||
public:
|
||||
OptionProfile(GameApp * _app, JGuiListener * jgl);
|
||||
virtual void addSelection(string s);
|
||||
virtual bool Selectable() {return canSelect;};
|
||||
virtual bool Changed() {return (initialValue != value);};
|
||||
virtual bool Selectable()
|
||||
{
|
||||
return canSelect;
|
||||
}
|
||||
;
|
||||
virtual bool Changed()
|
||||
{
|
||||
return (initialValue != value);
|
||||
}
|
||||
;
|
||||
virtual void Entering(JButton key);
|
||||
virtual void Reload();
|
||||
virtual void Render();
|
||||
@@ -141,8 +202,9 @@ private:
|
||||
size_t initialValue;
|
||||
};
|
||||
|
||||
class OptionKey : public WGuiItem, public KeybGrabber {
|
||||
public:
|
||||
class OptionKey: public WGuiItem, public KeybGrabber
|
||||
{
|
||||
public:
|
||||
OptionKey(GameStateOptions* g, LocalKeySym, JButton);
|
||||
LocalKeySym from;
|
||||
JButton to;
|
||||
@@ -155,7 +217,7 @@ class OptionKey : public WGuiItem, public KeybGrabber {
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
virtual bool Visible();
|
||||
virtual bool Selectable();
|
||||
protected:
|
||||
protected:
|
||||
bool grabbed;
|
||||
GameStateOptions* g;
|
||||
SimpleMenu* btnMenu;
|
||||
|
||||
@@ -7,32 +7,48 @@ using namespace std;
|
||||
|
||||
/*
|
||||
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:
|
||||
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){};
|
||||
Phase(int id, Player *player) :
|
||||
id(id), player(player)
|
||||
{
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
class PhaseRing{
|
||||
class PhaseRing
|
||||
{
|
||||
private:
|
||||
static bool extraDamagePhase(int id);
|
||||
public:
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
A class for all interactive objects in the play area (cards, avatars, etc...)
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifndef _PLAYGUIOBJECT_H_
|
||||
#define _PLAYGUIOBJECT_H_
|
||||
@@ -16,26 +16,52 @@
|
||||
#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:
|
||||
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 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(){};
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
@@ -5,19 +5,26 @@
|
||||
|
||||
#include "GuiLayers.h"
|
||||
|
||||
class PlayGuiObjectController : public GuiLayer{
|
||||
protected:
|
||||
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:
|
||||
public:
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
PlayGuiObjectController(){last_user_move=0;};
|
||||
virtual void Render(){GuiLayer::Render();};
|
||||
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,12 +4,13 @@
|
||||
#include "MTGDeck.h"
|
||||
#include "Tasks.h"
|
||||
|
||||
class PlayerData{
|
||||
protected:
|
||||
class PlayerData
|
||||
{
|
||||
protected:
|
||||
void init();
|
||||
public:
|
||||
public:
|
||||
int credits;
|
||||
map<string,string>storySaves;
|
||||
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
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
#include "JGE.h"
|
||||
|
||||
struct Pos {
|
||||
struct Pos
|
||||
{
|
||||
float actX, actY, actZ, actT, actA;
|
||||
float x, y, zoom, t, alpha;
|
||||
Pos(float, float, float, float, float);
|
||||
|
||||
@@ -8,23 +8,28 @@
|
||||
|
||||
class MTGAllCards;
|
||||
|
||||
class PriceList{
|
||||
private:
|
||||
class PriceList
|
||||
{
|
||||
private:
|
||||
MTGAllCards * collection;
|
||||
string filename;
|
||||
map<int,int> prices;
|
||||
map<int, int> prices;
|
||||
static int randomKey;
|
||||
public:
|
||||
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 setPrice(int cardId, int price);
|
||||
int getOtherPrice(int amt);
|
||||
static float difficultyScalar(float price, int cardid=0);
|
||||
static void updateKey() {randomKey = rand();};
|
||||
static float difficultyScalar(float price, int cardid = 0);
|
||||
static void updateKey()
|
||||
{
|
||||
randomKey = rand();
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,13 +9,19 @@ 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;
|
||||
@@ -24,19 +30,20 @@ protected:
|
||||
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(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);
|
||||
int remove(ReplacementEffect * re);
|
||||
~ReplacementEffects();
|
||||
};
|
||||
|
||||
|
||||
@@ -13,17 +13,19 @@ class MTGCardInstance;
|
||||
|
||||
#define MAX_RULES_CARDS 4096;
|
||||
|
||||
class RulesPlayerZone{
|
||||
public:
|
||||
class RulesPlayerZone
|
||||
{
|
||||
public:
|
||||
vector<int> cards;
|
||||
void add(int cardid);
|
||||
RulesPlayerZone();
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
class RulesPlayerData{
|
||||
public:
|
||||
vector <string> extraRules;
|
||||
class RulesPlayerData
|
||||
{
|
||||
public:
|
||||
vector<string> extraRules;
|
||||
int life;
|
||||
int poisonCount;
|
||||
int damageCount;
|
||||
@@ -37,8 +39,9 @@ class RulesPlayerData{
|
||||
|
||||
};
|
||||
|
||||
class RulesState{
|
||||
public:
|
||||
class RulesState
|
||||
{
|
||||
public:
|
||||
int phase;
|
||||
int player;
|
||||
void parsePlayerState(int playerId, string s);
|
||||
@@ -47,16 +50,17 @@ class RulesState{
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
|
||||
class Rules{
|
||||
class Rules
|
||||
{
|
||||
protected:
|
||||
Player * loadPlayerMomir(int isAI);
|
||||
Player * loadPlayerRandom(int isAI, int mode);
|
||||
Player * initPlayer(int playerId);
|
||||
MTGDeck * buildDeck( int playerId);
|
||||
MTGDeck * buildDeck(int playerId);
|
||||
int strToGameMode(string s);
|
||||
public:
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
PARSE_UNDEFINED,
|
||||
PARSE_INIT,
|
||||
PARSE_PLAYER1,
|
||||
@@ -73,7 +77,7 @@ public:
|
||||
void addExtraRules();
|
||||
void initGame();
|
||||
void cleanup();
|
||||
vector <string> extraRules;
|
||||
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
|
||||
*/
|
||||
*/
|
||||
#ifndef _SIMPLEMENU_H_
|
||||
#define _SIMPLEMENU_H_
|
||||
|
||||
@@ -9,13 +9,14 @@
|
||||
#include "WFont.h"
|
||||
#include "hge/hgeparticle.h"
|
||||
|
||||
class SimpleMenu:public JGuiController{
|
||||
private:
|
||||
class SimpleMenu: public JGuiController
|
||||
{
|
||||
private:
|
||||
float mHeight, mWidth, mX, mY;
|
||||
int fontId;
|
||||
std::string title;
|
||||
int displaytitle;
|
||||
int maxItems,startId;
|
||||
int maxItems, startId;
|
||||
float selectionT, selectionY;
|
||||
float timeOpen;
|
||||
bool mClosed;
|
||||
@@ -29,19 +30,21 @@ class SimpleMenu:public JGuiController{
|
||||
void drawHorzPole(float x, float y, float width);
|
||||
void drawVertPole(float x, float y, float height);
|
||||
|
||||
public:
|
||||
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 Add(int id, const char * Text, string desc = "", bool forceFocus = false);
|
||||
void Close();
|
||||
|
||||
float selectionTargetY;
|
||||
bool isClosed() { return mClosed; }
|
||||
bool isClosed()
|
||||
{
|
||||
return mClosed;
|
||||
}
|
||||
static void destroy();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,10 +11,9 @@ using std::string;
|
||||
#define SCALE_SELECTED 1.2f
|
||||
#define SCALE_NORMAL 1.0f
|
||||
|
||||
|
||||
class SimpleMenuItem: public JGuiObject
|
||||
{
|
||||
private:
|
||||
private:
|
||||
bool mHasFocus;
|
||||
SimpleMenu* parent;
|
||||
int fontId;
|
||||
@@ -22,7 +21,7 @@ class SimpleMenuItem: public JGuiObject
|
||||
float mScale;
|
||||
float mTargetScale;
|
||||
|
||||
public:
|
||||
public:
|
||||
string desc;
|
||||
SimpleMenuItem(SimpleMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false);
|
||||
|
||||
@@ -41,7 +40,13 @@ class SimpleMenuItem: public JGuiObject
|
||||
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 bool getTopLeft(float& top, float& left)
|
||||
{
|
||||
top = mY;
|
||||
left = mX;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,27 +19,31 @@ enum SIMPLE_KEYS{
|
||||
KPD_INPUT = 255,
|
||||
};
|
||||
|
||||
struct SimpleKey{
|
||||
SimpleKey( string _ds, int _id);
|
||||
struct SimpleKey
|
||||
{
|
||||
SimpleKey(string _ds, int _id);
|
||||
string displayValue;
|
||||
unsigned char id;
|
||||
unsigned char adjacency[4];
|
||||
};
|
||||
|
||||
class SimplePad{
|
||||
class SimplePad
|
||||
{
|
||||
public:
|
||||
friend class GameSettings;
|
||||
|
||||
string buffer;
|
||||
string title;
|
||||
unsigned int cursorPos();
|
||||
bool isActive() {return bActive;};
|
||||
bool isActive()
|
||||
{
|
||||
return bActive;
|
||||
}
|
||||
;
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
void pressKey(unsigned char id);
|
||||
|
||||
|
||||
|
||||
SimplePad();
|
||||
~SimplePad();
|
||||
|
||||
@@ -49,7 +53,7 @@ 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);
|
||||
void Start(string value, string * _dest = NULL);
|
||||
string Finish();
|
||||
|
||||
bool bActive;
|
||||
@@ -65,5 +69,4 @@ private:
|
||||
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,44 +11,63 @@ 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;};
|
||||
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 :
|
||||
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);
|
||||
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 StoryImage: public StoryDialogElement
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
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
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
STORY_REWARD_CREDITS,
|
||||
STORY_REWARD_SET,
|
||||
STORY_REWARD_CARD,
|
||||
@@ -67,7 +86,8 @@ public:
|
||||
static MTGDeck * collection;
|
||||
};
|
||||
|
||||
class StoryChoice:public StoryText {
|
||||
class StoryChoice: public StoryText
|
||||
{
|
||||
public:
|
||||
string pageId;
|
||||
|
||||
@@ -87,7 +107,8 @@ public:
|
||||
};
|
||||
|
||||
class StoryFlow;
|
||||
class StoryPage {
|
||||
class StoryPage
|
||||
{
|
||||
protected:
|
||||
string safeAttribute(TiXmlElement* element, string attribute);
|
||||
public:
|
||||
@@ -96,44 +117,49 @@ public:
|
||||
StoryPage(StoryFlow * mParent);
|
||||
virtual void Update(float dt)=0;
|
||||
virtual void Render()=0;
|
||||
virtual ~StoryPage(){};
|
||||
virtual ~StoryPage()
|
||||
{
|
||||
}
|
||||
;
|
||||
int loadElement(TiXmlElement* element);
|
||||
};
|
||||
|
||||
class StoryDialog:public StoryPage, public JGuiListener,public JGuiController {
|
||||
class StoryDialog: public StoryPage, public JGuiListener, public JGuiController
|
||||
{
|
||||
private:
|
||||
vector<StoryDialogElement *>graphics;
|
||||
vector<StoryDialogElement *> graphics;
|
||||
void RenderElement(StoryDialogElement * elmt);
|
||||
public:
|
||||
StoryDialog(TiXmlElement* el,StoryFlow * mParent);
|
||||
StoryDialog(TiXmlElement* el, StoryFlow * mParent);
|
||||
~StoryDialog();
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void ButtonPressed(int,int);
|
||||
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);
|
||||
StoryDuel(TiXmlElement* el, StoryFlow * mParent);
|
||||
virtual ~StoryDuel();
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
void init();
|
||||
};
|
||||
|
||||
class StoryFlow{
|
||||
class StoryFlow
|
||||
{
|
||||
private:
|
||||
map<string,StoryPage *>pages;
|
||||
map<string, StoryPage *> pages;
|
||||
bool parse(string filename);
|
||||
StoryPage * loadPage(TiXmlElement* element);
|
||||
bool _gotoPage(string id);
|
||||
@@ -149,5 +175,4 @@ public:
|
||||
void Render();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
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.
|
||||
};
|
||||
class MTGDeck;
|
||||
class StyleManager{
|
||||
class StyleManager
|
||||
{
|
||||
public:
|
||||
friend class OptionThemeStyle;
|
||||
friend class OptionTheme;
|
||||
@@ -21,12 +24,13 @@ public:
|
||||
void determineActive(MTGDeck * p1, MTGDeck * p2);
|
||||
WStyle * get();
|
||||
protected:
|
||||
int topRule; int topSize;
|
||||
int topRule;
|
||||
int topSize;
|
||||
int playerSrc;
|
||||
|
||||
void loadRules();
|
||||
void killRules();
|
||||
vector<WStyleRule*> rules;
|
||||
string activeStyle;
|
||||
map<string,WStyle*> styles;
|
||||
map<string, WStyle*> styles;
|
||||
};
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#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 {
|
||||
enum
|
||||
{
|
||||
TYPE_CREATURE = 1,
|
||||
TYPE_ENCHANTMENT = 2,
|
||||
TYPE_SORCERY = 3,
|
||||
@@ -22,11 +22,10 @@ public:
|
||||
LAST_TYPE = TYPE_LEGENDARY,
|
||||
};
|
||||
|
||||
|
||||
protected:
|
||||
map<string,int> values;
|
||||
protected:
|
||||
map<string, int> values;
|
||||
vector<string> valuesById;
|
||||
public:
|
||||
public:
|
||||
static Subtypes * subtypesList;
|
||||
Subtypes();
|
||||
int find(const char * subtype, bool forceAdd = true);
|
||||
@@ -34,5 +33,4 @@ public:
|
||||
string find(unsigned int id);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,14 +20,14 @@ class Damageable;
|
||||
class Targetable;
|
||||
class CardDescriptor;
|
||||
|
||||
|
||||
|
||||
class TargetChooser: public TargetsList {
|
||||
protected:
|
||||
class TargetChooser: public TargetsList
|
||||
{
|
||||
protected:
|
||||
int forceTargetListReady;
|
||||
|
||||
public:
|
||||
enum{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
UNSET = 0,
|
||||
OPPONENT = -1,
|
||||
CONTROLLER = 1,
|
||||
@@ -43,29 +43,54 @@ class TargetChooser: public TargetsList {
|
||||
|
||||
int maxtargets; //Set to -1 for "unlimited"
|
||||
bool validTargetsExist();
|
||||
virtual int setAllZones(){return 0;}
|
||||
virtual bool targetsZone(MTGGameZone * z){return false;};
|
||||
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(){};
|
||||
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:
|
||||
class TargetChooserFactory
|
||||
{
|
||||
public:
|
||||
TargetChooser * createTargetChooser(string s, MTGCardInstance * card, MTGAbility * ability = NULL);
|
||||
TargetChooser * createTargetChooser(MTGCardInstance * card);
|
||||
};
|
||||
|
||||
|
||||
class TargetZoneChooser:public TargetChooser{
|
||||
public:
|
||||
class TargetZoneChooser: public TargetChooser
|
||||
{
|
||||
public:
|
||||
int zones[15];
|
||||
int nbzones;
|
||||
int init(int * _zones, int _nbzones);
|
||||
@@ -77,7 +102,8 @@ class TargetZoneChooser:public TargetChooser{
|
||||
virtual TargetZoneChooser * clone() const;
|
||||
};
|
||||
|
||||
class CardTargetChooser:public TargetZoneChooser {
|
||||
class CardTargetChooser: public TargetZoneChooser
|
||||
{
|
||||
protected:
|
||||
MTGCardInstance * validTarget;
|
||||
public:
|
||||
@@ -86,37 +112,46 @@ public:
|
||||
virtual CardTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
|
||||
class CreatureTargetChooser:public TargetZoneChooser{
|
||||
public:
|
||||
CreatureTargetChooser(int * _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
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 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){};
|
||||
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 PlayerTargetChooser: public TargetChooser
|
||||
{
|
||||
protected:
|
||||
Player * p; //In Case we can only target a specific player
|
||||
public:
|
||||
public:
|
||||
PlayerTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, Player *_p = NULL);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual PlayerTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
class TypeTargetChooser:public TargetZoneChooser{
|
||||
public:
|
||||
class TypeTargetChooser: public TargetZoneChooser
|
||||
{
|
||||
public:
|
||||
int nbtypes;
|
||||
int types[10];
|
||||
TypeTargetChooser(const char * _type, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
|
||||
@@ -127,8 +162,9 @@ class TypeTargetChooser:public TargetZoneChooser{
|
||||
virtual TypeTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
class DescriptorTargetChooser:public TargetZoneChooser{
|
||||
public:
|
||||
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);
|
||||
@@ -137,36 +173,37 @@ class DescriptorTargetChooser:public TargetZoneChooser{
|
||||
virtual DescriptorTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
|
||||
class SpellTargetChooser:public TargetChooser{
|
||||
public:
|
||||
class SpellTargetChooser: public TargetChooser
|
||||
{
|
||||
public:
|
||||
int color;
|
||||
SpellTargetChooser( MTGCardInstance * card = NULL,int _color = -1, int _maxtargets = 1 , bool other = false);
|
||||
SpellTargetChooser(MTGCardInstance * card = NULL, int _color = -1, int _maxtargets = 1, bool other = false);
|
||||
virtual bool canTarget(Targetable * target);
|
||||
virtual SpellTargetChooser * clone() const;
|
||||
};
|
||||
|
||||
class SpellOrPermanentTargetChooser:public TargetZoneChooser{
|
||||
public:
|
||||
class SpellOrPermanentTargetChooser: public TargetZoneChooser
|
||||
{
|
||||
public:
|
||||
int color;
|
||||
SpellOrPermanentTargetChooser(MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, bool other = false);
|
||||
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:
|
||||
class DamageTargetChooser: public TargetChooser
|
||||
{
|
||||
public:
|
||||
int color;
|
||||
int state;
|
||||
DamageTargetChooser( MTGCardInstance * card = NULL,int _color = -1 , int _maxtargets = 1, int state = NOT_RESOLVED);
|
||||
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;
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
#define TARGET_PLAYER 2
|
||||
#define TARGET_STACKACTION 3
|
||||
|
||||
class Targetable{
|
||||
public:
|
||||
class Targetable
|
||||
{
|
||||
public:
|
||||
virtual int typeAsTarget() = 0;
|
||||
virtual const string getDisplayName() const = 0;
|
||||
};
|
||||
|
||||
@@ -11,8 +11,9 @@ class Spell;
|
||||
class Interruptible;
|
||||
class Damage;
|
||||
|
||||
class TargetsList{
|
||||
public:
|
||||
class TargetsList
|
||||
{
|
||||
public:
|
||||
int cursor;
|
||||
TargetsList();
|
||||
TargetsList(Targetable * _targets[], int nbtargets);
|
||||
@@ -28,7 +29,11 @@ class TargetsList{
|
||||
Spell * getNextSpellTarget(Spell * previous = 0);
|
||||
Damage * getNextDamageTarget(Damage * previous = 0);
|
||||
Targetable * getNextTarget(Targetable * previous = 0, int type = -1);
|
||||
void initTargets(){cursor = 0;};
|
||||
void initTargets()
|
||||
{
|
||||
cursor = 0;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
|
||||
#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;
|
||||
@@ -64,7 +65,8 @@ public:
|
||||
void passOneDay();
|
||||
};
|
||||
|
||||
class TaskList {
|
||||
class TaskList
|
||||
{
|
||||
protected:
|
||||
string fileName;
|
||||
float vPos;
|
||||
@@ -74,11 +76,11 @@ protected:
|
||||
JTexture * mBgTex;
|
||||
float sH, sW;
|
||||
|
||||
|
||||
public:
|
||||
vector<Task*> tasks;
|
||||
|
||||
enum{
|
||||
enum
|
||||
{
|
||||
TASKS_IN,
|
||||
TASKS_ACTIVE,
|
||||
TASKS_OUT,
|
||||
@@ -88,7 +90,11 @@ public:
|
||||
TaskList(string _fileName = "");
|
||||
int load(string _fileName = "");
|
||||
int save(string _fileName = "");
|
||||
int getState() {return mState;};
|
||||
int getState()
|
||||
{
|
||||
return mState;
|
||||
}
|
||||
;
|
||||
void addTask(string params, bool rand = false);
|
||||
void addTask(Task *task);
|
||||
void addRandomTask(int diff = 100);
|
||||
@@ -107,7 +113,8 @@ public:
|
||||
~TaskList();
|
||||
};
|
||||
|
||||
class TaskWinAgainst : public Task {
|
||||
class TaskWinAgainst: public Task
|
||||
{
|
||||
protected:
|
||||
virtual int computeReward();
|
||||
public:
|
||||
@@ -117,7 +124,8 @@ public:
|
||||
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
|
||||
};
|
||||
|
||||
class TaskSlaughter : public TaskWinAgainst {
|
||||
class TaskSlaughter: public TaskWinAgainst
|
||||
{
|
||||
protected:
|
||||
int targetLife;
|
||||
virtual int computeReward();
|
||||
@@ -131,7 +139,8 @@ public:
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskDelay : public TaskWinAgainst {
|
||||
class TaskDelay: public TaskWinAgainst
|
||||
{
|
||||
protected:
|
||||
int turn;
|
||||
bool afterTurn;
|
||||
@@ -146,7 +155,8 @@ public:
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskImmortal : public Task {
|
||||
class TaskImmortal: public Task
|
||||
{
|
||||
protected:
|
||||
int targetLife;
|
||||
int level;
|
||||
@@ -162,7 +172,8 @@ public:
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskMassiveBurial : public Task {
|
||||
class TaskMassiveBurial: public Task
|
||||
{
|
||||
protected:
|
||||
int color;
|
||||
int bodyCount;
|
||||
@@ -178,7 +189,8 @@ public:
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskWisdom : public Task {
|
||||
class TaskWisdom: public Task
|
||||
{
|
||||
protected:
|
||||
int color;
|
||||
int cardCount;
|
||||
@@ -194,7 +206,8 @@ public:
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
class TaskPacifism : public Task {
|
||||
class TaskPacifism: public Task
|
||||
{
|
||||
protected:
|
||||
virtual int computeReward();
|
||||
int lifeSlashCardMin;
|
||||
@@ -209,13 +222,12 @@ public:
|
||||
virtual void randomize();
|
||||
};
|
||||
|
||||
|
||||
/* ------------ Task template ------------
|
||||
|
||||
class TaskXX : public Task {
|
||||
protected:
|
||||
class TaskXX : public Task {
|
||||
protected:
|
||||
virtual int computeReward();
|
||||
public:
|
||||
public:
|
||||
TaskXX();
|
||||
|
||||
virtual string createDesc();
|
||||
@@ -224,7 +236,7 @@ public:
|
||||
virtual void storeCustomAttribs();
|
||||
virtual void restoreCustomAttribs();
|
||||
virtual void randomize();
|
||||
};
|
||||
*/
|
||||
};
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
|
||||
#include "AIPlayer.h"
|
||||
|
||||
class TestSuiteActions{
|
||||
public:
|
||||
class TestSuiteActions
|
||||
{
|
||||
public:
|
||||
int nbitems;
|
||||
string actions[MAX_TESTSUITE_ACTIONS];
|
||||
void add(string action);
|
||||
@@ -17,8 +18,9 @@ class TestSuiteActions{
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
class TestSuitePlayerZone{
|
||||
public:
|
||||
class TestSuitePlayerZone
|
||||
{
|
||||
public:
|
||||
int cards[MAX_TESTUITE_CARDS];
|
||||
int nbitems;
|
||||
void add(int cardid);
|
||||
@@ -26,8 +28,9 @@ class TestSuitePlayerZone{
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
class TestSuitePlayerData{
|
||||
public:
|
||||
class TestSuitePlayerData
|
||||
{
|
||||
public:
|
||||
int life;
|
||||
ManaCost * manapool;
|
||||
TestSuitePlayerZone zones[5];
|
||||
@@ -37,11 +40,10 @@ class TestSuitePlayerData{
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class TestSuite;
|
||||
class TestSuiteState{
|
||||
public:
|
||||
class TestSuiteState
|
||||
{
|
||||
public:
|
||||
int phase;
|
||||
void parsePlayerState(int playerId, string s);
|
||||
TestSuiteState();
|
||||
@@ -49,14 +51,15 @@ class TestSuiteState{
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
|
||||
class TestSuitePregame{
|
||||
public:
|
||||
class TestSuitePregame
|
||||
{
|
||||
public:
|
||||
virtual void performTest() = 0;
|
||||
};
|
||||
|
||||
class TestSuite{
|
||||
public:
|
||||
class TestSuite
|
||||
{
|
||||
public:
|
||||
MTGAllCards* collection;
|
||||
int summoningSickness;
|
||||
bool forceAbility;
|
||||
@@ -86,8 +89,9 @@ class TestSuite{
|
||||
|
||||
};
|
||||
|
||||
class TestSuiteAI:public AIPlayerBaka{
|
||||
public:
|
||||
class TestSuiteAI:public AIPlayerBaka
|
||||
{
|
||||
public:
|
||||
TestSuite * suite;
|
||||
float timer;
|
||||
|
||||
@@ -97,7 +101,5 @@ class TestSuiteAI:public AIPlayerBaka{
|
||||
virtual int displayStack();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,8 @@ class JLBFont;
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
class TextScroller: public JGuiObject{
|
||||
class TextScroller: public JGuiObject
|
||||
{
|
||||
protected:
|
||||
string mText;
|
||||
string tempText;
|
||||
@@ -34,8 +35,7 @@ public:
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
};
|
||||
|
||||
class VerticalTextScroller:
|
||||
public TextScroller
|
||||
class VerticalTextScroller: public TextScroller
|
||||
{
|
||||
private:
|
||||
size_t mNbItemsShown;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Filter-like system for determining if a card meats certain criteria, for this and thisforeach autos
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifndef _THISDESCRIPTOR_H_
|
||||
#define _THISDESCRIPTOR_H_
|
||||
@@ -10,8 +10,9 @@
|
||||
#include "MTGCardInstance.h"
|
||||
#include "CardDescriptor.h"
|
||||
|
||||
class ThisDescriptor{
|
||||
public:
|
||||
class ThisDescriptor
|
||||
{
|
||||
public:
|
||||
int comparisonMode;
|
||||
int comparisonCriterion;
|
||||
virtual int match(MTGCardInstance * card) = 0;
|
||||
@@ -19,13 +20,15 @@ class ThisDescriptor{
|
||||
virtual ~ThisDescriptor();
|
||||
};
|
||||
|
||||
class ThisDescriptorFactory{
|
||||
class ThisDescriptorFactory
|
||||
{
|
||||
public:
|
||||
ThisDescriptor * createThisDescriptor(string s);
|
||||
};
|
||||
|
||||
class ThisCounter:public ThisDescriptor{
|
||||
public:
|
||||
class ThisCounter: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
Counter * counter;
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
@@ -34,65 +37,73 @@ class ThisCounter:public ThisDescriptor{
|
||||
~ThisCounter();
|
||||
};
|
||||
|
||||
class ThisCounterAny:public ThisDescriptor{
|
||||
public:
|
||||
class ThisCounterAny: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
virtual int match(MTGCardInstance *card);
|
||||
|
||||
ThisCounterAny(int nb);
|
||||
};
|
||||
|
||||
class ThisControllerlife:public ThisDescriptor{
|
||||
public:
|
||||
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);
|
||||
};
|
||||
|
||||
class ThisNotBlocked:public ThisDescriptor{
|
||||
public:
|
||||
class ThisNotBlocked: public ThisDescriptor
|
||||
{
|
||||
public:
|
||||
virtual int match(MTGCardInstance * card);
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
|
||||
#include "MTGCardInstance.h"
|
||||
|
||||
class Token: public MTGCardInstance{
|
||||
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,23 +4,23 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
|
||||
#if defined _DEBUG
|
||||
#define DEBUG_TRANSLATE
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Translator{
|
||||
protected:
|
||||
class Translator
|
||||
{
|
||||
protected:
|
||||
static Translator * mInstance;
|
||||
bool initDone;
|
||||
|
||||
void load(string filename, map<string,string> * dictionary);
|
||||
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;
|
||||
|
||||
@@ -5,20 +5,20 @@
|
||||
#include "Pos.h"
|
||||
#include "WEvent.h"
|
||||
|
||||
template <class T> void trash(T*);
|
||||
template<class T> void trash(T*);
|
||||
class Trash
|
||||
{
|
||||
public:
|
||||
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*);
|
||||
template<class Q> friend void trash(Q*);
|
||||
friend class Trash;
|
||||
};
|
||||
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
#define INVALID_MTEX -1
|
||||
#endif
|
||||
|
||||
class WResource{
|
||||
class WResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
friend struct WCacheSort;
|
||||
template<class cacheItem,class cacheActual> friend class WCache;
|
||||
template<class cacheItem, class cacheActual> friend class WCache;
|
||||
|
||||
WResource();
|
||||
virtual ~WResource();
|
||||
@@ -33,10 +34,11 @@ protected:
|
||||
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;
|
||||
template<class cacheItem, class cacheActual> friend class WCache;
|
||||
|
||||
virtual ~WCachedResource();
|
||||
|
||||
@@ -45,8 +47,8 @@ public:
|
||||
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();
|
||||
@@ -56,10 +58,11 @@ public:
|
||||
JQuad * quad;
|
||||
};
|
||||
|
||||
class WCachedTexture: public WCachedResource{
|
||||
class WCachedTexture: public WCachedResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
template<class cacheItem,class cacheActual> friend class WCache;
|
||||
template<class cacheItem, class cacheActual> friend class WCache;
|
||||
WCachedTexture();
|
||||
~WCachedTexture();
|
||||
|
||||
@@ -68,14 +71,19 @@ public:
|
||||
bool isGood();
|
||||
bool isLocked(); //Is the resource locked?
|
||||
bool Attempt(string filename, int submode, int & error);
|
||||
bool compare(JTexture * t) {return (t == texture);};
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
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:
|
||||
@@ -83,10 +91,11 @@ protected:
|
||||
vector<WTrackedQuad*> trackedQuads;
|
||||
};
|
||||
|
||||
class WCachedParticles: public WCachedResource{
|
||||
class WCachedParticles: public WCachedResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
template<class cacheItem,class cacheActual> friend class WCache;
|
||||
template<class cacheItem, class cacheActual> friend class WCache;
|
||||
WCachedParticles();
|
||||
~WCachedParticles();
|
||||
void Refresh();
|
||||
@@ -94,20 +103,29 @@ public:
|
||||
|
||||
bool isGood();
|
||||
bool Attempt(string filename, int submode, int & error);
|
||||
bool compare(hgeParticleSystemInfo * p) {return (p == particles);};
|
||||
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;
|
||||
template<class cacheItem, class cacheActual> friend class WCache;
|
||||
WCachedSample();
|
||||
~WCachedSample();
|
||||
bool compare(JSample * s) {return (s == sample);};
|
||||
bool compare(JSample * s)
|
||||
{
|
||||
return (s == sample);
|
||||
}
|
||||
;
|
||||
unsigned long size();
|
||||
bool isGood();
|
||||
void Refresh();
|
||||
|
||||
+268
-76
@@ -10,14 +10,32 @@ class MTGDeck;
|
||||
class MTGAllCards;
|
||||
class JQuad;
|
||||
|
||||
class WSyncable{
|
||||
class WSyncable
|
||||
{
|
||||
public:
|
||||
WSyncable(int i=0) {hooked = NULL;currentPos = 0;};
|
||||
virtual ~WSyncable() {};
|
||||
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;};
|
||||
virtual int getOffset()
|
||||
{
|
||||
return currentPos;
|
||||
}
|
||||
;
|
||||
virtual bool setOffset(int i)
|
||||
{
|
||||
currentPos = i;
|
||||
return true;
|
||||
}
|
||||
;
|
||||
//Recursive
|
||||
virtual int getPos();
|
||||
virtual bool next();
|
||||
@@ -27,34 +45,84 @@ protected:
|
||||
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;
|
||||
};
|
||||
|
||||
class WSrcImage: public WDataSource{
|
||||
class WSrcImage: public WDataSource
|
||||
{
|
||||
public:
|
||||
virtual JQuad * getImage(int offset=0);
|
||||
virtual JQuad * getImage(int offset = 0);
|
||||
WSrcImage(string s);
|
||||
|
||||
protected:
|
||||
string filename;
|
||||
};
|
||||
|
||||
class WSrcCards: public WDataSource{
|
||||
class WSrcCards: public WDataSource
|
||||
{
|
||||
protected:
|
||||
vector<MTGCard*> cards;
|
||||
vector<size_t> validated;
|
||||
@@ -62,14 +130,14 @@ protected:
|
||||
float mDelay;
|
||||
|
||||
public:
|
||||
WSrcCards(float delay=0.2);
|
||||
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);
|
||||
virtual JQuad * getImage(int offset = 0);
|
||||
virtual JQuad * getThumb(int offset = 0);
|
||||
virtual MTGCard * getCard(int offset = 0, bool ignore = false);
|
||||
|
||||
virtual int Size(bool all=false); //Returns the number of cards, or the number of cards that match the filter.
|
||||
virtual int Size(bool all = false); //Returns the number of cards, or the number of cards that match the filter.
|
||||
|
||||
virtual void Shuffle();
|
||||
virtual bool thisCard(int mtgid);
|
||||
@@ -89,19 +157,24 @@ public:
|
||||
|
||||
virtual void updateCounts() {};
|
||||
virtual void clearCounts() {};
|
||||
virtual void addCount(MTGCard * c, int qty=1) {};
|
||||
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.
|
||||
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 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 {
|
||||
enum
|
||||
{
|
||||
MAX_CYCLES = 4, //How many cycles to search, for addToDeck
|
||||
SORT_COLLECTOR,
|
||||
SORT_ALPHA,
|
||||
@@ -110,61 +183,178 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class WSrcDeckViewer: public WSrcCards{
|
||||
class WSrcDeckViewer: public WSrcCards
|
||||
{
|
||||
public:
|
||||
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;
|
||||
};
|
||||
|
||||
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();};
|
||||
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);
|
||||
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 countByName(MTGCard * card, bool editions = false);
|
||||
int totalPrice();
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
//0 to MTG_NB_COLORS are colors. See MTG_COLOR_ in Constants::.
|
||||
UNFILTERED_COPIES = Constants::MTG_NB_COLORS,
|
||||
UNFILTERED_UNIQUE,
|
||||
@@ -176,25 +366,27 @@ public:
|
||||
};
|
||||
void clearCounts();
|
||||
void updateCounts();
|
||||
void addCount(MTGCard * c, int qty=1);
|
||||
int getCount(int count=UNFILTERED_COPIES);
|
||||
void addCount(MTGCard * c, int qty = 1);
|
||||
int getCount(int count = UNFILTERED_COPIES);
|
||||
protected:
|
||||
map<int,int> copies; //Maps MTGID to card counts.
|
||||
map<int, int> copies; //Maps MTGID to card counts.
|
||||
int counts[MAX_COUNTS];
|
||||
};
|
||||
|
||||
struct WCSortCollector{
|
||||
struct WCSortCollector
|
||||
{
|
||||
bool operator()(const MTGCard*l, const MTGCard*r);
|
||||
};
|
||||
|
||||
struct WCSortAlpha{
|
||||
struct WCSortAlpha
|
||||
{
|
||||
bool operator()(const MTGCard*l, const MTGCard*r);
|
||||
};
|
||||
|
||||
struct WCSortRarity{
|
||||
struct WCSortRarity
|
||||
{
|
||||
int rareToInt(char r);
|
||||
bool operator()(const MTGCard*l, const MTGCard*r);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,11 +29,20 @@ public:
|
||||
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;};
|
||||
virtual int getValue()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual Targetable * getTarget(int target)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
struct WEventZoneChange : public WEvent {
|
||||
struct WEventZoneChange: public WEvent
|
||||
{
|
||||
MTGCardInstance * card;
|
||||
MTGGameZone * from;
|
||||
MTGGameZone * to;
|
||||
@@ -43,8 +52,8 @@ struct WEventZoneChange : public WEvent {
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
|
||||
struct WEventDamage : public WEvent {
|
||||
struct WEventDamage: public WEvent
|
||||
{
|
||||
Damage * damage;
|
||||
WEventDamage(Damage * damage);
|
||||
virtual std::ostream& toString(std::ostream& out) const;
|
||||
@@ -52,25 +61,28 @@ struct WEventDamage : public WEvent {
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
struct WEventDamageStackResolved : public WEvent {
|
||||
struct WEventDamageStackResolved: public WEvent
|
||||
{
|
||||
WEventDamageStackResolved();
|
||||
};
|
||||
|
||||
struct WEventPhaseChange : public WEvent {
|
||||
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 {
|
||||
struct WEventCardUpdate: public WEvent
|
||||
{
|
||||
MTGCardInstance * card;
|
||||
WEventCardUpdate(MTGCardInstance * card);
|
||||
};
|
||||
|
||||
//Event when a card gains/looses types
|
||||
struct WEventCardChangeType : public WEventCardUpdate {
|
||||
struct WEventCardChangeType: public WEventCardUpdate
|
||||
{
|
||||
int type;
|
||||
bool before;
|
||||
bool after;
|
||||
@@ -78,68 +90,77 @@ struct WEventCardChangeType : public WEventCardUpdate {
|
||||
};
|
||||
|
||||
//Event when a card is tapped/untapped
|
||||
struct WEventCardTap : public WEventCardUpdate {
|
||||
struct WEventCardTap: public WEventCardUpdate
|
||||
{
|
||||
bool before;
|
||||
bool after;
|
||||
WEventCardTap(MTGCardInstance * card, bool before, bool after);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
struct WEventCardTappedForMana : public WEventCardUpdate {
|
||||
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 {
|
||||
struct WEventCreatureAttacker: public WEventCardUpdate
|
||||
{
|
||||
Targetable * before;
|
||||
Targetable * after;
|
||||
WEventCreatureAttacker(MTGCardInstance * card, Targetable * from, Targetable * to);
|
||||
};
|
||||
|
||||
//event when card attacks.
|
||||
struct WEventCardAttacked : public WEventCardUpdate {
|
||||
struct WEventCardAttacked: public WEventCardUpdate
|
||||
{
|
||||
WEventCardAttacked(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card attacks alone.
|
||||
struct WEventCardAttackedAlone : public WEventCardUpdate {
|
||||
struct WEventCardAttackedAlone: public WEventCardUpdate
|
||||
{
|
||||
WEventCardAttackedAlone(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card attacks but is not blocked.
|
||||
struct WEventCardAttackedNotBlocked : public WEventCardUpdate {
|
||||
struct WEventCardAttackedNotBlocked: public WEventCardUpdate
|
||||
{
|
||||
WEventCardAttackedNotBlocked(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card attacks but is blocked.
|
||||
struct WEventCardAttackedBlocked : public WEventCardUpdate {
|
||||
struct WEventCardAttackedBlocked: public WEventCardUpdate
|
||||
{
|
||||
WEventCardAttackedBlocked(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card blocked.
|
||||
struct WEventCardBlocked : public WEventCardUpdate {
|
||||
struct WEventCardBlocked: public WEventCardUpdate
|
||||
{
|
||||
WEventCardBlocked(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card is sacrificed.
|
||||
struct WEventCardSacrifice : public WEventCardUpdate {
|
||||
struct WEventCardSacrifice: public WEventCardUpdate
|
||||
{
|
||||
WEventCardSacrifice(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card is discarded.
|
||||
struct WEventCardDiscard : public WEventCardUpdate {
|
||||
struct WEventCardDiscard: public WEventCardUpdate
|
||||
{
|
||||
WEventCardDiscard(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
@@ -147,24 +168,28 @@ struct WEventCardDiscard : public WEventCardUpdate {
|
||||
//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 {
|
||||
struct WEventCreatureBlocker: public WEventCardUpdate
|
||||
{
|
||||
MTGCardInstance * before;
|
||||
MTGCardInstance * after;
|
||||
WEventCreatureBlocker(MTGCardInstance * card,MTGCardInstance * from,MTGCardInstance * to);
|
||||
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);
|
||||
struct WEventcardDraw: public WEvent
|
||||
{
|
||||
WEventcardDraw(Player * player, int nb_cards);
|
||||
Player * player;
|
||||
int nb_cards;
|
||||
virtual Targetable * getTarget(Player * player);
|
||||
@@ -173,23 +198,24 @@ struct WEventcardDraw : public WEvent {
|
||||
//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 {
|
||||
struct WEventCreatureBlockerRank: public WEventCardUpdate
|
||||
{
|
||||
MTGCardInstance * exchangeWith;
|
||||
MTGCardInstance * attacker;
|
||||
WEventCreatureBlockerRank(MTGCardInstance * card,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);
|
||||
};
|
||||
|
||||
|
||||
//Event when a mana is engaged
|
||||
//color : color
|
||||
struct WEventEngageMana : public WEvent {
|
||||
struct WEventEngageMana: public WEvent
|
||||
{
|
||||
int color;
|
||||
MTGCardInstance* card;
|
||||
ManaPool * destination;
|
||||
@@ -198,7 +224,8 @@ struct WEventEngageMana : public WEvent {
|
||||
|
||||
//Event when a mana is consumed
|
||||
//color : color
|
||||
struct WEventConsumeMana : public WEvent {
|
||||
struct WEventConsumeMana: public WEvent
|
||||
{
|
||||
int color;
|
||||
ManaPool * source;
|
||||
WEventConsumeMana(int color, ManaPool * source);
|
||||
@@ -206,7 +233,8 @@ struct WEventConsumeMana : public WEvent {
|
||||
|
||||
//Event when a manapool is emptied
|
||||
//color : color
|
||||
struct WEventEmptyManaPool : public WEvent {
|
||||
struct WEventEmptyManaPool: public WEvent
|
||||
{
|
||||
ManaPool * source;
|
||||
WEventEmptyManaPool(ManaPool * source);
|
||||
};
|
||||
|
||||
+208
-56
@@ -3,132 +3,250 @@
|
||||
|
||||
class WCardFilter;
|
||||
|
||||
class WCFilterFactory{
|
||||
class WCFilterFactory
|
||||
{
|
||||
public:
|
||||
WCFilterFactory() {};
|
||||
WCFilterFactory(){};
|
||||
static WCFilterFactory * GetInstance();
|
||||
static void Destroy();
|
||||
WCardFilter * Construct(string src);
|
||||
private:
|
||||
size_t findNext(string src, size_t start, char open='(', char close=')');
|
||||
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 bool isMatch(MTGCard * c)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
;
|
||||
virtual string getCode() = 0;
|
||||
virtual float filterFee() {return 0.0f;};
|
||||
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);};
|
||||
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;};
|
||||
virtual WCardFilter * Right()
|
||||
{
|
||||
return rhs;
|
||||
}
|
||||
;
|
||||
virtual WCardFilter * Left()
|
||||
{
|
||||
return lhs;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
WCardFilter *lhs, *rhs;
|
||||
};
|
||||
|
||||
class WCFilterOR: public WCFBranch{
|
||||
class WCFilterOR: public WCFBranch
|
||||
{
|
||||
public:
|
||||
WCFilterOR(WCardFilter * a, WCardFilter * b): WCFBranch(a,b) {};
|
||||
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));};
|
||||
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);};
|
||||
WCFilterGROUP(WCardFilter * _k)
|
||||
{
|
||||
kid = _k;
|
||||
}
|
||||
;
|
||||
~WCFilterGROUP()
|
||||
{
|
||||
SAFE_DELETE(kid);
|
||||
}
|
||||
;
|
||||
bool isMatch(MTGCard *c)
|
||||
{
|
||||
return kid->isMatch(c);
|
||||
}
|
||||
;
|
||||
string getCode();
|
||||
float filterFee() {return kid->filterFee();};
|
||||
float filterFee()
|
||||
{
|
||||
return kid->filterFee();
|
||||
}
|
||||
;
|
||||
protected:
|
||||
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);};
|
||||
WCFilterNOT(WCardFilter * _k)
|
||||
{
|
||||
kid = _k;
|
||||
}
|
||||
;
|
||||
~WCFilterNOT()
|
||||
{
|
||||
SAFE_DELETE(kid);
|
||||
}
|
||||
;
|
||||
bool isMatch(MTGCard *c)
|
||||
{
|
||||
return !kid->isMatch(c);
|
||||
}
|
||||
;
|
||||
string getCode();
|
||||
protected:
|
||||
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(int _setid = MTGSets::ALL_SETS)
|
||||
{
|
||||
setid = _setid;
|
||||
}
|
||||
;
|
||||
WCFilterSet(string arg);
|
||||
bool isMatch(MTGCard *c) {return (setid==MTGSets::ALL_SETS || c->setId == setid);};
|
||||
bool isMatch(MTGCard *c)
|
||||
{
|
||||
return (setid == MTGSets::ALL_SETS || c->setId == setid);
|
||||
}
|
||||
;
|
||||
string getCode();
|
||||
float filterFee() {return 0.2f;};
|
||||
float filterFee()
|
||||
{
|
||||
return 0.2f;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
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!
|
||||
float filterFee()
|
||||
{
|
||||
return 4.0f;
|
||||
}
|
||||
; //Alpha searches are expensive!
|
||||
protected:
|
||||
char alpha;
|
||||
};
|
||||
class WCFilterColor: public WCardFilter{
|
||||
class WCFilterColor: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterColor(int _c) {color = _c;};
|
||||
WCFilterColor(int _c)
|
||||
{
|
||||
color = _c;
|
||||
}
|
||||
;
|
||||
WCFilterColor(string arg);
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee() {return 0.2f;};
|
||||
float filterFee()
|
||||
{
|
||||
return 0.2f;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
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();
|
||||
};
|
||||
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();
|
||||
};
|
||||
class WCFilterNumeric: public WCardFilter{
|
||||
class WCFilterNumeric: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterNumeric(int _num) {number = _num;};
|
||||
WCFilterNumeric(int _num)
|
||||
{
|
||||
number = _num;
|
||||
}
|
||||
;
|
||||
WCFilterNumeric(string arg);
|
||||
bool isMatch(MTGCard * c) = 0;
|
||||
string getCode() = 0;
|
||||
@@ -136,43 +254,72 @@ public:
|
||||
protected:
|
||||
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;};
|
||||
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;};
|
||||
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;};
|
||||
float filterFee()
|
||||
{
|
||||
return 2 * number / 12.0f;
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
class WCFilterType: public WCardFilter{
|
||||
class WCFilterType: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterType(string arg) {type = arg;};
|
||||
WCFilterType(string arg)
|
||||
{
|
||||
type = arg;
|
||||
}
|
||||
;
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
float filterFee() {return 0.4f;};
|
||||
float filterFee()
|
||||
{
|
||||
return 0.4f;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
string type;
|
||||
};
|
||||
class WCFilterRarity: public WCardFilter{
|
||||
class WCFilterRarity: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterRarity(char _r) {rarity = _r;};
|
||||
WCFilterRarity(char _r)
|
||||
{
|
||||
rarity = _r;
|
||||
}
|
||||
;
|
||||
WCFilterRarity(string arg);
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
@@ -180,9 +327,14 @@ public:
|
||||
protected:
|
||||
char rarity;
|
||||
};
|
||||
class WCFilterAbility: public WCardFilter{
|
||||
class WCFilterAbility: public WCardFilter
|
||||
{
|
||||
public:
|
||||
WCFilterAbility(int _a) {ability = _a;};
|
||||
WCFilterAbility(int _a)
|
||||
{
|
||||
ability = _a;
|
||||
}
|
||||
;
|
||||
WCFilterAbility(string arg);
|
||||
bool isMatch(MTGCard * c);
|
||||
string getCode();
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace Fonts
|
||||
const unsigned int kSingleByteFontOffset = 100;
|
||||
}
|
||||
|
||||
|
||||
class WFont
|
||||
{
|
||||
public:
|
||||
@@ -34,8 +33,8 @@ public:
|
||||
// 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;
|
||||
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.
|
||||
@@ -58,38 +57,86 @@ public:
|
||||
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 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;
|
||||
};
|
||||
|
||||
class WFBFont : public WFont
|
||||
class WFBFont: public WFont
|
||||
{
|
||||
public:
|
||||
WFBFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM=false);
|
||||
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 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;};
|
||||
PIXEL_TYPE GetColor() const
|
||||
{
|
||||
return mColor0;
|
||||
}
|
||||
;
|
||||
void SetScale(float scale);
|
||||
float GetScale() const;
|
||||
float GetHeight() const;
|
||||
@@ -98,11 +145,11 @@ public:
|
||||
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 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:
|
||||
protected:
|
||||
static JRenderer* mRenderer;
|
||||
|
||||
u16* mIndex;
|
||||
@@ -131,24 +178,24 @@ public:
|
||||
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);
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
+477
-152
@@ -5,11 +5,12 @@
|
||||
class hgeDistortionMesh;
|
||||
class GameStateOptions;
|
||||
|
||||
class WGuiColor{
|
||||
class WGuiColor
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
SCROLLBAR,
|
||||
SCROLLBUTTON,
|
||||
enum
|
||||
{
|
||||
SCROLLBAR, SCROLLBUTTON,
|
||||
//Foregrounds only after this
|
||||
TEXT,
|
||||
TEXT_HEADER,
|
||||
@@ -25,7 +26,8 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
struct WDistort {
|
||||
struct WDistort
|
||||
{
|
||||
WDistort();
|
||||
WDistort(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
|
||||
float & operator[](int p);
|
||||
@@ -34,39 +36,62 @@ protected:
|
||||
};
|
||||
|
||||
//Complete item interface
|
||||
class WGuiBase: public JGuiListener {
|
||||
class WGuiBase: public JGuiListener
|
||||
{
|
||||
public:
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
CONFIRM_NEED, // Still needs confirmation
|
||||
CONFIRM_OK, // Is okay (no need to confirm, or has been confirmed)
|
||||
CONFIRM_CANCEL, // Is not okay, must cancel save
|
||||
CONFIRM_CANCEL,
|
||||
// Is not okay, must cancel save
|
||||
} CONFIRM_TYPE;
|
||||
|
||||
WGuiBase() {};
|
||||
virtual ~WGuiBase() {};
|
||||
|
||||
virtual bool Selectable() {return true;};
|
||||
virtual bool isModal() {return false;};
|
||||
virtual bool Visible() {return true;};
|
||||
virtual bool Selectable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
;
|
||||
virtual bool isModal()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
virtual bool Visible()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
;
|
||||
|
||||
virtual bool Changed() {return false;};
|
||||
virtual bool Changed()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
virtual void confirmChange(bool confirmed) {};
|
||||
virtual CONFIRM_TYPE needsConfirm();
|
||||
virtual bool yieldFocus();
|
||||
virtual PIXEL_TYPE getColor(int type);
|
||||
virtual float getMargin(int type) {return 4;};
|
||||
virtual float getMargin(int type)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
;
|
||||
|
||||
virtual void Entering(JButton key)=0;
|
||||
virtual bool Leaving(JButton key)=0;
|
||||
|
||||
virtual void Update(float dt)=0;
|
||||
virtual void updateValue(){};
|
||||
virtual void updateValue() {};
|
||||
virtual void Render()=0;
|
||||
virtual void setData()=0;
|
||||
virtual void ButtonPressed(int controllerId, int controlId){};
|
||||
virtual void Reload(){};
|
||||
virtual void Overlay(){};
|
||||
virtual void Underlay(){};
|
||||
virtual void ButtonPressed(int controllerId, int controlId) {};
|
||||
virtual void Reload() {};
|
||||
virtual void Overlay() {};
|
||||
virtual void Underlay() {};
|
||||
|
||||
virtual bool hasFocus()=0;
|
||||
virtual void setFocus(bool bFocus)=0;
|
||||
@@ -74,31 +99,51 @@ public:
|
||||
virtual float getY()=0;
|
||||
virtual float getWidth()=0;
|
||||
virtual float getHeight()=0;
|
||||
virtual int getId() {return INVALID_ID;};
|
||||
virtual string getDisplay() const {return "";};
|
||||
virtual float minWidth(){return getWidth();};
|
||||
virtual float minHeight(){return getHeight();};
|
||||
virtual int getId()
|
||||
{
|
||||
return INVALID_ID;
|
||||
}
|
||||
;
|
||||
virtual string getDisplay() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
;
|
||||
virtual float minWidth()
|
||||
{
|
||||
return getWidth();
|
||||
}
|
||||
;
|
||||
virtual float minHeight()
|
||||
{
|
||||
return getHeight();
|
||||
}
|
||||
;
|
||||
|
||||
virtual void setModal(bool val){};
|
||||
virtual void setDisplay(string s){};
|
||||
virtual void setX(float _x){};
|
||||
virtual void setY(float _y){};
|
||||
virtual void setWidth(float _w){};
|
||||
virtual void setHeight(float _h){};
|
||||
virtual void setId(int _id){};
|
||||
virtual void setHidden(bool bHidden) {};
|
||||
virtual void setModal(bool val) {};
|
||||
virtual void setDisplay(string s) {};
|
||||
virtual void setX(float _x) {};
|
||||
virtual void setY(float _y) {};
|
||||
virtual void setWidth(float _w) {};
|
||||
virtual void setHeight(float _h) {};
|
||||
virtual void setId(int _id) {};
|
||||
virtual void setHidden(bool bHidden){};
|
||||
virtual void setVisible(bool bVisisble) {};
|
||||
|
||||
virtual void renderBack(WGuiBase * it);
|
||||
virtual void subBack(WGuiBase * item) {};
|
||||
|
||||
virtual bool CheckUserInput(JButton key) {return false;};
|
||||
protected:
|
||||
virtual bool CheckUserInput(JButton key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
vector<WGuiBase*> items;
|
||||
};
|
||||
|
||||
//This is our base class for concrete items.
|
||||
class WGuiItem: public WGuiBase{
|
||||
class WGuiItem: public WGuiBase
|
||||
{
|
||||
public:
|
||||
virtual void Entering(JButton key);
|
||||
virtual bool Leaving(JButton key);
|
||||
@@ -111,28 +156,81 @@ public:
|
||||
|
||||
string _(string input); //Override global with our flag checker.
|
||||
|
||||
virtual void setData(){};
|
||||
virtual void setData() {};
|
||||
|
||||
virtual bool hasFocus() {return mFocus;};
|
||||
virtual void setFocus(bool bFocus) {mFocus = bFocus;};
|
||||
virtual bool hasFocus()
|
||||
{
|
||||
return mFocus;
|
||||
}
|
||||
;
|
||||
virtual void setFocus(bool bFocus)
|
||||
{
|
||||
mFocus = bFocus;
|
||||
}
|
||||
;
|
||||
|
||||
virtual string getDisplay() const {return displayValue;};
|
||||
virtual void setDisplay(string s){displayValue=s;};
|
||||
virtual string getDisplay() const
|
||||
{
|
||||
return displayValue;
|
||||
}
|
||||
;
|
||||
virtual void setDisplay(string s)
|
||||
{
|
||||
displayValue = s;
|
||||
}
|
||||
;
|
||||
|
||||
virtual int getId() {return INVALID_ID;};
|
||||
virtual float getX() {return x;};
|
||||
virtual float getY() {return y;};
|
||||
virtual float getWidth() {return width;};
|
||||
virtual float getHeight() {return height;};
|
||||
virtual int getId()
|
||||
{
|
||||
return INVALID_ID;
|
||||
}
|
||||
;
|
||||
virtual float getX()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
;
|
||||
virtual float getY()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
;
|
||||
virtual float getWidth()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
;
|
||||
virtual float getHeight()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
;
|
||||
virtual float minWidth();
|
||||
virtual float minHeight();
|
||||
virtual void setId(int _id){};
|
||||
virtual void setX(float _x){x = _x;};
|
||||
virtual void setY(float _y){y = _y;};
|
||||
virtual void setWidth(float _w){width = _w;};
|
||||
virtual void setHeight(float _h){height = _h;};
|
||||
enum {
|
||||
NO_TRANSLATE = (1<<1),
|
||||
virtual void setId(int _id) {};
|
||||
virtual void setX(float _x)
|
||||
{
|
||||
x = _x;
|
||||
}
|
||||
;
|
||||
virtual void setY(float _y)
|
||||
{
|
||||
y = _y;
|
||||
}
|
||||
;
|
||||
virtual void setWidth(float _w)
|
||||
{
|
||||
width = _w;
|
||||
}
|
||||
;
|
||||
virtual void setHeight(float _h)
|
||||
{
|
||||
height = _h;
|
||||
}
|
||||
;
|
||||
enum
|
||||
{
|
||||
NO_TRANSLATE = (1 << 1),
|
||||
};
|
||||
|
||||
u8 mFlags;
|
||||
@@ -144,99 +242,277 @@ protected:
|
||||
string displayValue;
|
||||
};
|
||||
|
||||
class WGuiImage: public WGuiItem{
|
||||
class WGuiImage: public WGuiItem
|
||||
{
|
||||
public:
|
||||
WGuiImage(WDataSource * wds, float _w = 0, float _h = 0, int _margin = 0);
|
||||
virtual bool Selectable() {return false;};
|
||||
virtual bool Selectable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
virtual void Render();
|
||||
virtual float getHeight();
|
||||
virtual void imageScale(float _w, float _h);
|
||||
virtual void setSource(WDataSource *s) {source = s;};
|
||||
virtual void setSource(WDataSource *s)
|
||||
{
|
||||
source = s;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
int margin;
|
||||
float imgW, imgH;
|
||||
WDataSource * source;};
|
||||
WDataSource * source;
|
||||
};
|
||||
|
||||
class WGuiCardImage: public WGuiImage{
|
||||
class WGuiCardImage: public WGuiImage
|
||||
{
|
||||
public:
|
||||
WGuiCardImage(WDataSource * wds, bool _thumb=false);
|
||||
WGuiCardImage(WDataSource * wds, bool _thumb = false);
|
||||
virtual void Render();
|
||||
WSyncable mOffset;
|
||||
protected:
|
||||
bool bThumb;
|
||||
};
|
||||
|
||||
class WGuiCardDistort: public WGuiCardImage{
|
||||
class WGuiCardDistort: public WGuiCardImage
|
||||
{
|
||||
public:
|
||||
WGuiCardDistort(WDataSource * wds, bool _thumb=false, WDataSource * _distort=NULL);
|
||||
WGuiCardDistort(WDataSource * wds, bool _thumb = false, WDataSource * _distort = NULL);
|
||||
~WGuiCardDistort();
|
||||
virtual void Render();
|
||||
WDistort xy;
|
||||
/* we assume first xy is the top left of the distorted card */
|
||||
virtual float getX() {return xy[0];};
|
||||
virtual float getY() {return xy[1];};
|
||||
virtual float getX()
|
||||
{
|
||||
return xy[0];
|
||||
}
|
||||
;
|
||||
virtual float getY()
|
||||
{
|
||||
return xy[1];
|
||||
}
|
||||
;
|
||||
protected:
|
||||
hgeDistortionMesh* mesh;
|
||||
WDataSource * distortSrc;
|
||||
};
|
||||
|
||||
//This is our base class for decorators. It wraps everything about WGuiBase.
|
||||
class WGuiDeco: public WGuiBase{
|
||||
class WGuiDeco: public WGuiBase
|
||||
{
|
||||
public:
|
||||
WGuiDeco(WGuiBase* _it) {it = _it;};
|
||||
virtual ~WGuiDeco() {SAFE_DELETE(it);};
|
||||
WGuiDeco(WGuiBase* _it)
|
||||
{
|
||||
it = _it;
|
||||
}
|
||||
;
|
||||
virtual ~WGuiDeco()
|
||||
{
|
||||
SAFE_DELETE(it);
|
||||
}
|
||||
;
|
||||
|
||||
virtual bool Selectable() {return it->Selectable();};
|
||||
virtual bool Visible() {return it->Visible();};
|
||||
virtual bool Changed() {return it->Changed();};
|
||||
virtual void confirmChange(bool confirmed) {it->confirmChange(confirmed);};
|
||||
virtual CONFIRM_TYPE needsConfirm() { return it->needsConfirm();};
|
||||
virtual bool yieldFocus() {return it->yieldFocus();};
|
||||
virtual bool Selectable()
|
||||
{
|
||||
return it->Selectable();
|
||||
}
|
||||
;
|
||||
virtual bool Visible()
|
||||
{
|
||||
return it->Visible();
|
||||
}
|
||||
;
|
||||
virtual bool Changed()
|
||||
{
|
||||
return it->Changed();
|
||||
}
|
||||
;
|
||||
virtual void confirmChange(bool confirmed)
|
||||
{
|
||||
it->confirmChange(confirmed);
|
||||
}
|
||||
;
|
||||
virtual CONFIRM_TYPE needsConfirm()
|
||||
{
|
||||
return it->needsConfirm();
|
||||
}
|
||||
;
|
||||
virtual bool yieldFocus()
|
||||
{
|
||||
return it->yieldFocus();
|
||||
}
|
||||
;
|
||||
|
||||
virtual void Entering(JButton key) {it->Entering(key);};
|
||||
virtual bool Leaving(JButton key) {return it->Leaving(key);};
|
||||
virtual void Update(float dt) {it->Update(dt);};
|
||||
virtual void updateValue() {it->updateValue();};
|
||||
virtual void Reload() {it->Reload();};
|
||||
virtual void Overlay() {it->Overlay();};
|
||||
virtual void Underlay() {it->Underlay();};
|
||||
virtual void Render() {it->Render();};
|
||||
virtual void setData() {it->setData();};
|
||||
virtual void Entering(JButton key)
|
||||
{
|
||||
it->Entering(key);
|
||||
}
|
||||
;
|
||||
virtual bool Leaving(JButton key)
|
||||
{
|
||||
return it->Leaving(key);
|
||||
}
|
||||
;
|
||||
virtual void Update(float dt)
|
||||
{
|
||||
it->Update(dt);
|
||||
}
|
||||
;
|
||||
virtual void updateValue()
|
||||
{
|
||||
it->updateValue();
|
||||
}
|
||||
;
|
||||
virtual void Reload()
|
||||
{
|
||||
it->Reload();
|
||||
}
|
||||
;
|
||||
virtual void Overlay()
|
||||
{
|
||||
it->Overlay();
|
||||
}
|
||||
;
|
||||
virtual void Underlay()
|
||||
{
|
||||
it->Underlay();
|
||||
}
|
||||
;
|
||||
virtual void Render()
|
||||
{
|
||||
it->Render();
|
||||
}
|
||||
;
|
||||
virtual void setData()
|
||||
{
|
||||
it->setData();
|
||||
}
|
||||
;
|
||||
|
||||
virtual void ButtonPressed(int controllerId, int controlId) {it->ButtonPressed(controllerId, controlId);};
|
||||
virtual void ButtonPressed(int controllerId, int controlId)
|
||||
{
|
||||
it->ButtonPressed(controllerId, controlId);
|
||||
}
|
||||
;
|
||||
|
||||
virtual bool hasFocus() {return it->hasFocus();};
|
||||
virtual string getDisplay() const {return it->getDisplay();};
|
||||
virtual int getId() {return it->getId();};
|
||||
virtual float getX() {return it->getX();};
|
||||
virtual float getY() {return it->getY();};
|
||||
virtual float getWidth() {return it->getWidth();};
|
||||
virtual float getHeight() {return it->getHeight();};
|
||||
virtual PIXEL_TYPE getColor(int type) {return it->getColor(type);};
|
||||
WGuiBase * getDecorated() {return it;};
|
||||
virtual bool hasFocus()
|
||||
{
|
||||
return it->hasFocus();
|
||||
}
|
||||
;
|
||||
virtual string getDisplay() const
|
||||
{
|
||||
return it->getDisplay();
|
||||
}
|
||||
;
|
||||
virtual int getId()
|
||||
{
|
||||
return it->getId();
|
||||
}
|
||||
;
|
||||
virtual float getX()
|
||||
{
|
||||
return it->getX();
|
||||
}
|
||||
;
|
||||
virtual float getY()
|
||||
{
|
||||
return it->getY();
|
||||
}
|
||||
;
|
||||
virtual float getWidth()
|
||||
{
|
||||
return it->getWidth();
|
||||
}
|
||||
;
|
||||
virtual float getHeight()
|
||||
{
|
||||
return it->getHeight();
|
||||
}
|
||||
;
|
||||
virtual PIXEL_TYPE getColor(int type)
|
||||
{
|
||||
return it->getColor(type);
|
||||
}
|
||||
;
|
||||
WGuiBase * getDecorated()
|
||||
{
|
||||
return it;
|
||||
}
|
||||
;
|
||||
|
||||
virtual void setFocus(bool bFocus) {it->setFocus(bFocus);};
|
||||
virtual void setDisplay(string s) {it->setDisplay(s);};
|
||||
virtual void setId(int _id) {it->setId(_id);};
|
||||
virtual void setX(float _x) {it->setX(_x);};
|
||||
virtual void setY(float _y) {it->setY(_y);};
|
||||
virtual void setWidth(float _w) {it->setWidth(_w);};
|
||||
virtual void setHeight(float _h) {it->setHeight(_h);};
|
||||
virtual void setHidden(bool bHidden) {it->setHidden(bHidden);};
|
||||
virtual void setVisible(bool bVisisble) {it->setVisible(bVisisble);};
|
||||
virtual bool CheckUserInput(JButton key) {return it->CheckUserInput(key);};
|
||||
virtual void setFocus(bool bFocus)
|
||||
{
|
||||
it->setFocus(bFocus);
|
||||
}
|
||||
;
|
||||
virtual void setDisplay(string s)
|
||||
{
|
||||
it->setDisplay(s);
|
||||
}
|
||||
;
|
||||
virtual void setId(int _id)
|
||||
{
|
||||
it->setId(_id);
|
||||
}
|
||||
;
|
||||
virtual void setX(float _x)
|
||||
{
|
||||
it->setX(_x);
|
||||
}
|
||||
;
|
||||
virtual void setY(float _y)
|
||||
{
|
||||
it->setY(_y);
|
||||
}
|
||||
;
|
||||
virtual void setWidth(float _w)
|
||||
{
|
||||
it->setWidth(_w);
|
||||
}
|
||||
;
|
||||
virtual void setHeight(float _h)
|
||||
{
|
||||
it->setHeight(_h);
|
||||
}
|
||||
;
|
||||
virtual void setHidden(bool bHidden)
|
||||
{
|
||||
it->setHidden(bHidden);
|
||||
}
|
||||
;
|
||||
virtual void setVisible(bool bVisisble)
|
||||
{
|
||||
it->setVisible(bVisisble);
|
||||
}
|
||||
;
|
||||
virtual bool CheckUserInput(JButton key)
|
||||
{
|
||||
return it->CheckUserInput(key);
|
||||
}
|
||||
;
|
||||
protected:
|
||||
WGuiBase * it;
|
||||
};
|
||||
|
||||
class WGuiAward: public WGuiItem{
|
||||
class WGuiAward: public WGuiItem
|
||||
{
|
||||
public:
|
||||
WGuiAward(int _id, string name, string _text, string _details="");
|
||||
WGuiAward(int _id, string name, string _text, string _details = "");
|
||||
virtual ~WGuiAward();
|
||||
virtual void Render();
|
||||
virtual bool Selectable() {return Visible();};
|
||||
virtual bool Selectable()
|
||||
{
|
||||
return Visible();
|
||||
}
|
||||
;
|
||||
virtual bool Visible();
|
||||
virtual int getId() {return id;};
|
||||
virtual int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
;
|
||||
virtual void Underlay();
|
||||
virtual void Overlay();
|
||||
|
||||
@@ -246,9 +522,10 @@ protected:
|
||||
string text;
|
||||
};
|
||||
|
||||
class WGuiSplit: public WGuiItem{
|
||||
class WGuiSplit: public WGuiItem
|
||||
{
|
||||
public:
|
||||
WGuiSplit(WGuiBase* _left,WGuiBase* _right);
|
||||
WGuiSplit(WGuiBase* _left, WGuiBase* _right);
|
||||
virtual ~WGuiSplit();
|
||||
|
||||
virtual bool yieldFocus();
|
||||
@@ -278,7 +555,8 @@ public:
|
||||
WGuiBase* left;
|
||||
};
|
||||
|
||||
class WDecoConfirm: public WGuiDeco{
|
||||
class WDecoConfirm: public WGuiDeco
|
||||
{
|
||||
public:
|
||||
WDecoConfirm(JGuiListener * _listener, WGuiBase * it);
|
||||
virtual ~WDecoConfirm();
|
||||
@@ -296,27 +574,31 @@ public:
|
||||
string confirm;
|
||||
string cancel;
|
||||
protected:
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
OP_UNCONFIRMED,
|
||||
OP_CONFIRMING,
|
||||
OP_CONFIRMED,
|
||||
} mState;
|
||||
|
||||
SimpleMenu * confirmMenu;
|
||||
JGuiListener * listener;
|
||||
bool bModal;
|
||||
};
|
||||
|
||||
class WDecoEnum : public WGuiDeco {
|
||||
public:
|
||||
WDecoEnum(WGuiBase * _it,EnumDefinition *_edef = NULL);
|
||||
class WDecoEnum: public WGuiDeco
|
||||
{
|
||||
public:
|
||||
WDecoEnum(WGuiBase * _it, EnumDefinition *_edef = NULL);
|
||||
virtual void Render();
|
||||
string lookupVal(int value);
|
||||
protected:
|
||||
protected:
|
||||
EnumDefinition * edef;
|
||||
};
|
||||
|
||||
class WDecoCheat: public WGuiDeco {
|
||||
public:
|
||||
class WDecoCheat: public WGuiDeco
|
||||
{
|
||||
public:
|
||||
WDecoCheat(WGuiBase * _it);
|
||||
virtual bool Visible();
|
||||
bool Selectable();
|
||||
@@ -325,49 +607,71 @@ protected:
|
||||
bool bVisible;
|
||||
};
|
||||
|
||||
class WGuiButton: public WGuiDeco{
|
||||
class WGuiButton: public WGuiDeco
|
||||
{
|
||||
public:
|
||||
WGuiButton( WGuiBase* _it, int _controller, int _control, JGuiListener * jgl);
|
||||
WGuiButton(WGuiBase* _it, int _controller, int _control, JGuiListener * jgl);
|
||||
virtual void updateValue();
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual bool Selectable() {return Visible();};
|
||||
virtual bool Selectable()
|
||||
{
|
||||
return Visible();
|
||||
}
|
||||
;
|
||||
virtual PIXEL_TYPE getColor(int type);
|
||||
virtual int getControlID() {return control;};
|
||||
virtual int getControllerID() {return controller;};
|
||||
virtual int getControlID()
|
||||
{
|
||||
return control;
|
||||
}
|
||||
;
|
||||
virtual int getControllerID()
|
||||
{
|
||||
return controller;
|
||||
}
|
||||
;
|
||||
protected:
|
||||
int control, controller;
|
||||
JGuiListener * mListener;
|
||||
};
|
||||
|
||||
class WGuiHeader:public WGuiItem{
|
||||
public:
|
||||
WGuiHeader(string _displayValue): WGuiItem(_displayValue) {};
|
||||
virtual bool Selectable() {return false;};
|
||||
class WGuiHeader: public WGuiItem
|
||||
{
|
||||
public:
|
||||
WGuiHeader(string _displayValue) : WGuiItem(_displayValue) {};
|
||||
virtual bool Selectable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
class WDecoStyled: public WGuiDeco{
|
||||
class WDecoStyled: public WGuiDeco
|
||||
{
|
||||
public:
|
||||
WDecoStyled(WGuiItem * _it) : WGuiDeco(_it) {mStyle=DS_DEFAULT;};
|
||||
WDecoStyled(WGuiItem * _it) :
|
||||
WGuiDeco(_it)
|
||||
{
|
||||
mStyle = DS_DEFAULT;
|
||||
}
|
||||
;
|
||||
PIXEL_TYPE getColor(int type);
|
||||
void subBack(WGuiBase * item);
|
||||
enum {
|
||||
DS_DEFAULT = (1<<0),
|
||||
DS_COLOR_BRIGHT = (1<<1),
|
||||
DS_COLOR_DARK = (1<<2),
|
||||
DS_STYLE_ALERT = (1<<3),
|
||||
DS_STYLE_EDGED = (1<<4),
|
||||
DS_STYLE_BACKLESS = (1<<5),
|
||||
enum
|
||||
{
|
||||
DS_DEFAULT = (1 << 0), DS_COLOR_BRIGHT = (1 << 1), DS_COLOR_DARK = (1 << 2), DS_STYLE_ALERT = (1 << 3),
|
||||
DS_STYLE_EDGED = (1 << 4), DS_STYLE_BACKLESS = (1 << 5),
|
||||
};
|
||||
|
||||
u8 mStyle;
|
||||
};
|
||||
|
||||
class WGuiMenu: public WGuiItem{
|
||||
class WGuiMenu: public WGuiItem
|
||||
{
|
||||
public:
|
||||
friend class WGuiFilters;
|
||||
virtual ~WGuiMenu();
|
||||
WGuiMenu(JButton next, JButton prev, bool mDPad = false, WSyncable * syncme=NULL);
|
||||
WGuiMenu(JButton next, JButton prev, bool mDPad = false, WSyncable * syncme = NULL);
|
||||
|
||||
virtual bool yieldFocus();
|
||||
virtual void Render();
|
||||
@@ -381,9 +685,17 @@ public:
|
||||
virtual void subBack(WGuiBase * item);
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
WGuiBase * Current();
|
||||
virtual int getSelected() {return currentItem;};
|
||||
virtual void setSelected(vector<WGuiBase*>::iterator& it) {
|
||||
int c = it - items.begin();setSelected(c);};
|
||||
virtual int getSelected()
|
||||
{
|
||||
return currentItem;
|
||||
}
|
||||
;
|
||||
virtual void setSelected(vector<WGuiBase*>::iterator& it)
|
||||
{
|
||||
int c = it - items.begin();
|
||||
setSelected(c);
|
||||
}
|
||||
;
|
||||
virtual void setSelected(int newItem);
|
||||
virtual bool nextItem();
|
||||
virtual bool prevItem();
|
||||
@@ -403,8 +715,9 @@ protected:
|
||||
float duration;
|
||||
};
|
||||
|
||||
class WGuiList: public WGuiMenu{
|
||||
public:
|
||||
class WGuiList: public WGuiMenu
|
||||
{
|
||||
public:
|
||||
WGuiList(string name, WSyncable * syncme = NULL);
|
||||
|
||||
string failMsg;
|
||||
@@ -417,21 +730,24 @@ class WGuiList: public WGuiMenu{
|
||||
protected:
|
||||
bool mFocus;
|
||||
};
|
||||
class WGuiTabMenu: public WGuiMenu {
|
||||
public:
|
||||
class WGuiTabMenu: public WGuiMenu
|
||||
{
|
||||
public:
|
||||
WGuiTabMenu() : WGuiMenu(JGE_BTN_NEXT, JGE_BTN_PREV) {};
|
||||
virtual void Render();
|
||||
virtual void Add(WGuiBase * it);
|
||||
void save();
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
};
|
||||
class WGuiListRow: public WGuiList{
|
||||
public:
|
||||
class WGuiListRow: public WGuiList
|
||||
{
|
||||
public:
|
||||
WGuiListRow(string n, WSyncable * s = NULL);
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
class WGuiFilters: public WGuiItem {
|
||||
class WGuiFilters: public WGuiItem
|
||||
{
|
||||
public:
|
||||
friend class WGuiFilterItem;
|
||||
WGuiFilters(string header, WSrcCards * src);
|
||||
@@ -446,14 +762,18 @@ public:
|
||||
bool isAvailable(int type);
|
||||
bool isAvailableCode(string code);
|
||||
bool Finish(bool emptyset = false); //Returns true if card set reasonably expected to be changed.
|
||||
bool isFinished() {return bFinished;};
|
||||
bool isFinished()
|
||||
{
|
||||
return bFinished;
|
||||
}
|
||||
;
|
||||
void ButtonPressed(int controllerId, int controlId);
|
||||
void buildList();
|
||||
void setSrc(WSrcCards * wsc);
|
||||
protected:
|
||||
void clearArgs();
|
||||
void addArg(string display, string code);
|
||||
vector< pair<string,string> > tempArgs; //TODO FIXME this is inefficient
|
||||
vector<pair<string, string> > tempArgs; //TODO FIXME this is inefficient
|
||||
bool bFinished;
|
||||
int recolorTo;
|
||||
WSrcCards* source;
|
||||
@@ -461,7 +781,8 @@ protected:
|
||||
WGuiList * list;
|
||||
};
|
||||
|
||||
class WGuiFilterItem: public WGuiItem {
|
||||
class WGuiFilterItem: public WGuiItem
|
||||
{
|
||||
public:
|
||||
friend class WGuiFilters;
|
||||
friend struct WLFiltersSort;
|
||||
@@ -470,7 +791,8 @@ public:
|
||||
void ButtonPressed(int controllerId, int controlId);
|
||||
string getCode();
|
||||
bool isModal();
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
STATE_UNSET,
|
||||
STATE_CHOOSE_TYPE,
|
||||
STATE_CHOOSE_VAL,
|
||||
@@ -500,16 +822,19 @@ protected:
|
||||
WGuiFilters * mParent;
|
||||
};
|
||||
|
||||
struct WListSort{
|
||||
struct WListSort
|
||||
{
|
||||
virtual bool operator()(const WGuiBase*l, const WGuiBase*r);
|
||||
};
|
||||
|
||||
struct WLFiltersSort{
|
||||
struct WLFiltersSort
|
||||
{
|
||||
bool operator()(const WGuiBase*l, const WGuiBase*r);
|
||||
};
|
||||
|
||||
class WGuiKeyBinder : public WGuiList {
|
||||
public:
|
||||
class WGuiKeyBinder: public WGuiList
|
||||
{
|
||||
public:
|
||||
WGuiKeyBinder(string name, GameStateOptions* parent);
|
||||
virtual bool isModal();
|
||||
virtual bool CheckUserInput(JButton);
|
||||
@@ -519,7 +844,7 @@ class WGuiKeyBinder : public WGuiList {
|
||||
virtual CONFIRM_TYPE needsConfirm();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
virtual bool yieldFocus();
|
||||
protected:
|
||||
protected:
|
||||
GameStateOptions* parent;
|
||||
SimpleMenu* confirmMenu;
|
||||
bool modal;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#define MAX_CACHE_TIME 2000000000
|
||||
#endif
|
||||
|
||||
|
||||
#define THUMBNAILS_OFFSET 100000000
|
||||
#define OTHERS_OFFSET 2000000000
|
||||
|
||||
@@ -31,15 +30,17 @@
|
||||
#define MAX_CACHED_SAMPLES 50
|
||||
#define MAX_CACHE_GARBAGE 10
|
||||
|
||||
|
||||
enum ENUM_WRES_INFO{
|
||||
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.
|
||||
WRES_UNDERLOCKED = 252,
|
||||
//Resource was released too many times.
|
||||
};
|
||||
|
||||
enum ENUM_RETRIEVE_STYLE{
|
||||
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.
|
||||
@@ -47,24 +48,28 @@ enum ENUM_RETRIEVE_STYLE{
|
||||
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.
|
||||
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,
|
||||
@@ -74,11 +79,12 @@ enum ENUM_CACHE_ERROR{
|
||||
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:
|
||||
@@ -89,7 +95,7 @@ public:
|
||||
|
||||
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 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.
|
||||
@@ -105,9 +111,9 @@ protected:
|
||||
|
||||
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;
|
||||
|
||||
@@ -119,7 +125,6 @@ protected:
|
||||
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();
|
||||
@@ -225,9 +230,9 @@ private:
|
||||
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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
@@ -65,14 +64,13 @@ namespace wagic
|
||||
};
|
||||
|
||||
#else
|
||||
typedef std::ifstream ifstream;
|
||||
typedef std::ifstream ifstream;
|
||||
#endif
|
||||
|
||||
} //namespace wagic
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
//string manipulation methods
|
||||
string& trim(string& str);
|
||||
string& ltrim(string& str);
|
||||
@@ -93,7 +91,6 @@ int WRand();
|
||||
void dumpStack();
|
||||
#endif
|
||||
|
||||
|
||||
/* RAM simple check functions header */
|
||||
|
||||
// *** DEFINES ***
|
||||
@@ -106,8 +103,8 @@ void dumpStack();
|
||||
|
||||
// *** FUNCTIONS DECLARATIONS ***
|
||||
|
||||
u32 ramAvailableLineareMax (void);
|
||||
u32 ramAvailable (void);
|
||||
u32 ramAvailableLineareMax(void);
|
||||
u32 ramAvailable(void);
|
||||
|
||||
#ifdef WIN32
|
||||
#include <direct.h>
|
||||
|
||||
Reference in New Issue
Block a user