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:
techdragon.nguyen@gmail.com
2011-01-21 18:01:14 +00:00
parent 6d3d4c1792
commit e53c16f700
101 changed files with 6128 additions and 4684 deletions
+2 -2
View File
@@ -3,8 +3,8 @@
#include "AIPlayer.h" #include "AIPlayer.h"
class AIMomirPlayer: public AIPlayerBaka
class AIMomirPlayer:public AIPlayerBaka{ {
public: public:
AIMomirPlayer(MTGDeck * deck, string file, string fileSmall, string avatarFile); AIMomirPlayer(MTGDeck * deck, string file, string fileSmall, string avatarFile);
int getEfficiency(AIAction * action); int getEfficiency(AIAction * action);
+34 -19
View File
@@ -18,7 +18,6 @@ using std::queue;
#define INFO_CREATURESTOUGHNESS 3 #define INFO_CREATURESTOUGHNESS 3
#define INFO_CREATURESATTACKINGPOWER 4 #define INFO_CREATURESATTACKINGPOWER 4
class AIStats; class AIStats;
class AIAction class AIAction
@@ -35,22 +34,25 @@ public:
MTGCardInstance * click; MTGCardInstance * click;
MTGCardInstance * target; // TODO Improve MTGCardInstance * target; // TODO Improve
AIAction(MTGAbility * a, MTGCardInstance * c, MTGCardInstance * t = NULL) AIAction(MTGAbility * a, MTGCardInstance * c, MTGCardInstance * t = NULL) :
: efficiency(-1), ability(a), player(NULL), click(c), target(t) efficiency(-1), ability(a), player(NULL), click(c), target(t)
{ {
id = currentId++; id = currentId++;
}; }
;
AIAction(MTGCardInstance * c, MTGCardInstance * t = NULL) AIAction(MTGCardInstance * c, MTGCardInstance * t = NULL) :
: efficiency(-1), ability(NULL), player(NULL), click(c), target(t) efficiency(-1), ability(NULL), player(NULL), click(c), target(t)
{ {
id = currentId++; id = currentId++;
}; }
;
AIAction(Player * p) AIAction(Player * p) :
: efficiency(-1), ability(NULL), player(p), click(NULL), target(NULL) efficiency(-1), ability(NULL), player(p), click(NULL), target(NULL)
{ {
}; }
;
int getEfficiency(); int getEfficiency();
int Act(); int Act();
@@ -66,14 +68,16 @@ public:
AIAction* a2Ptr = const_cast<AIAction*> (&a2); AIAction* a2Ptr = const_cast<AIAction*> (&a2);
int e1 = a1Ptr->getEfficiency(); int e1 = a1Ptr->getEfficiency();
int e2 = a2Ptr->getEfficiency(); int e2 = a2Ptr->getEfficiency();
if (e1 == e2) return a1Ptr->id < a2Ptr->id; if (e1 == e2)
return a1Ptr->id < a2Ptr->id;
return (e1 > e2); return (e1 > e2);
} }
}; };
typedef std::map<AIAction, int, CmpAbilities> RankingContainer; typedef std::map<AIAction, int, CmpAbilities> RankingContainer;
class AIPlayer: public Player{ class AIPlayer: public Player
{
protected: protected:
//Variables used by Test suite //Variables used by Test suite
MTGCardInstance * nextCardToPlay; MTGCardInstance * nextCardToPlay;
@@ -97,8 +101,15 @@ public:
int agressivity; int agressivity;
bool Checked; bool Checked;
bool forceBestAbilityUse; bool forceBestAbilityUse;
void End(){}; void End()
virtual int displayStack() {return 0;}; {
}
;
virtual int displayStack()
{
return 0;
}
;
int receiveEvent(WEvent * event); int receiveEvent(WEvent * event);
void Render(); void Render();
ManaCost * getPotentialMana(MTGCardInstance * card = NULL); ManaCost * getPotentialMana(MTGCardInstance * card = NULL);
@@ -108,7 +119,11 @@ public:
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 Act(float dt);
virtual int affectCombatDamages(CombatStep); virtual int affectCombatDamages(CombatStep);
int isAI(){return 1;}; int isAI()
{
return 1;
}
;
int canHandleCost(MTGAbility * ability); int canHandleCost(MTGAbility * ability);
int selectAbility(); int selectAbility();
int createAbilityTargets(MTGAbility * a, MTGCardInstance * c, RankingContainer& ranking); int createAbilityTargets(MTGAbility * a, MTGCardInstance * c, RankingContainer& ranking);
@@ -117,8 +132,8 @@ public:
}; };
class AIPlayerBaka: public AIPlayer
class AIPlayerBaka: public AIPlayer{ {
protected: protected:
int oldGamePhase; int oldGamePhase;
float timer; float timer;
@@ -131,10 +146,10 @@ class AIPlayerBaka: public AIPlayer{
virtual int computeActions(); virtual int computeActions();
}; };
class AIPlayerFactory{ class AIPlayerFactory
{
public: public:
AIPlayer * createAIPlayer(MTGAllCards * collection, Player * opponent, int deckid = 0); AIPlayer * createAIPlayer(MTGAllCards * collection, Player * opponent, int deckid = 0);
}; };
#endif #endif
+9 -5
View File
@@ -18,18 +18,22 @@ class MTGCard;
class Damage; class Damage;
class WEvent; class WEvent;
class AIStat{ class AIStat
{
public: public:
int source; //MTGId of the card int source; //MTGId of the card
int value; int value;
int occurences; int occurences;
bool direct; 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
{
class AIStats{
public: public:
Player * player; Player * player;
string filename; string filename;
+43 -13
View File
@@ -12,19 +12,17 @@
#define ACTION_REQUESTED 1 #define ACTION_REQUESTED 1
#define ACTIVE 2 #define ACTIVE 2
class MTGCardInstance; class MTGCardInstance;
class ManaCost; class ManaCost;
class Targetable; class Targetable;
class TargetChooser; class TargetChooser;
class WEvent; class WEvent;
class ActionElement: public JGuiObject{ class ActionElement: public JGuiObject
{
protected: protected:
int activeState; int activeState;
public: public:
int isClone; int isClone;
TargetChooser * tc; TargetChooser * tc;
@@ -35,20 +33,52 @@ class ActionElement: public JGuiObject{
int getActivity(); int getActivity();
virtual void Update(float dt){}; virtual void Update(float dt){};
virtual void Render(){}; virtual void Render(){};
virtual int testDestroy(){return 0;}; virtual int testDestroy()
virtual int destroy(){return 0;}; {
virtual bool CheckUserInput(JButton key){return false;}; return 0;
}
;
virtual int destroy()
{
return 0;
}
;
virtual bool CheckUserInput(JButton key)
{
return false;
}
;
ActionElement(int id); ActionElement(int id);
virtual ~ActionElement(); virtual ~ActionElement();
virtual int isReactingToTargetClick(Targetable * card); virtual int isReactingToTargetClick(Targetable * card);
virtual int reactToTargetClick(Targetable * card); virtual int reactToTargetClick(Targetable * card);
virtual int isReactingToClick(MTGCardInstance * card, ManaCost * man = NULL){return 0;}; virtual int isReactingToClick(MTGCardInstance * card, ManaCost * man = NULL)
virtual int stillInUse(MTGCardInstance * card){return 0;}; {
virtual int receiveEvent(WEvent * event){return 0;}; return 0;
virtual int reactToClick(MTGCardInstance * card){return 0;}; }
virtual const char * getMenuText(){return "Ability";}; ;
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; virtual ActionElement * clone() const = 0;
}; };
#endif #endif
+2 -3
View File
@@ -16,7 +16,8 @@ class GuiLayer;
class Targetable; class Targetable;
class WEvent; class WEvent;
class ActionLayer: public GuiLayer, public JGuiListener{ class ActionLayer: public GuiLayer, public JGuiListener
{
public: public:
vector<ActionElement *> garbage; vector<ActionElement *> garbage;
Targetable * menuObject; Targetable * menuObject;
@@ -50,6 +51,4 @@ protected:
int cantCancel; int cantCancel;
}; };
#endif #endif
+57 -22
View File
@@ -9,7 +9,6 @@
#define MAX_SPELL_TARGETS 10 #define MAX_SPELL_TARGETS 10
#define ACTION_SPELL 10 #define ACTION_SPELL 10
#define ACTION_DAMAGE 11 #define ACTION_DAMAGE 11
#define ACTION_DAMAGES 12 #define ACTION_DAMAGES 12
@@ -39,27 +38,62 @@ class DamageStack;
class ManaCost; class ManaCost;
class TargetChooser; class TargetChooser;
#define ACTIONSTACK_STANDARD 0 #define ACTIONSTACK_STANDARD 0
#define ACTIONSTACK_TARGET 1 #define ACTIONSTACK_TARGET 1
class Interruptible: public PlayGuiObject, public Targetable{ class Interruptible: public PlayGuiObject, public Targetable
{
public: public:
//TODO : remove these when they are back in PlayGuiObject //TODO : remove these when they are back in PlayGuiObject
float x, y; float x, y;
int state, display; int state, display;
MTGCardInstance * source; MTGCardInstance * source;
virtual void Entering(){mHasFocus = true;}; virtual void Entering()
virtual bool Leaving(JButton key){mHasFocus = false;return true;}; {
virtual bool ButtonPressed(){return true;}; mHasFocus = true;
virtual int resolve(){return 0;}; }
virtual void Render(){}; ;
int typeAsTarget(){return TARGET_STACKACTION;}; virtual bool Leaving(JButton key)
Interruptible(bool hasFocus = false):PlayGuiObject(40,x,y,hasFocus){state=NOT_RESOLVED;display=0;source=NULL;}; {
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; virtual const string getDisplayName() const;
void Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad = false); 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) #if defined (WIN32) || defined (LINUX) || defined (IOS)
virtual void Dump(); virtual void Dump();
#endif #endif
@@ -68,7 +102,8 @@ protected:
float GetVerticalTextOffset() const; float GetVerticalTextOffset() const;
}; };
class NextGamePhase: public Interruptible { class NextGamePhase: public Interruptible
{
public: public:
int resolve(); int resolve();
bool extraDamagePhase(); bool extraDamagePhase();
@@ -78,7 +113,8 @@ class NextGamePhase: public Interruptible {
NextGamePhase(int id); NextGamePhase(int id);
}; };
class Spell: public Interruptible { class Spell: public Interruptible
{
protected: protected:
public: public:
@@ -106,7 +142,8 @@ class Spell: public Interruptible {
int getNbTargets(); int getNbTargets();
}; };
class StackAbility: public Interruptible { class StackAbility: public Interruptible
{
public: public:
MTGAbility * ability; MTGAbility * ability;
int resolve(); int resolve();
@@ -116,7 +153,8 @@ class StackAbility: public Interruptible {
StackAbility(int id, MTGAbility * _ability); StackAbility(int id, MTGAbility * _ability);
}; };
class PutInGraveyard: public Interruptible { class PutInGraveyard: public Interruptible
{
public: public:
MTGCardInstance * card; MTGCardInstance * card;
int removeFromGame; int removeFromGame;
@@ -126,8 +164,8 @@ class PutInGraveyard: public Interruptible {
PutInGraveyard(int id, MTGCardInstance * _card); PutInGraveyard(int id, MTGCardInstance * _card);
}; };
class DrawAction: public Interruptible
class DrawAction: public Interruptible { {
public: public:
int nbcards; int nbcards;
Player * player; Player * player;
@@ -137,7 +175,8 @@ class DrawAction: public Interruptible {
DrawAction(int id, Player * _player, int _nbcards); DrawAction(int id, Player * _player, int _nbcards);
}; };
class ActionStack :public GuiLayer{ class ActionStack: public GuiLayer
{
protected: protected:
JQuad * pspIcons[8]; JQuad * pspIcons[8];
GameObserver* game; GameObserver* game;
@@ -192,8 +231,4 @@ class ActionStack :public GuiLayer{
}; };
#endif #endif
+2 -1
View File
@@ -23,7 +23,8 @@ enum ENUM_COMPARISON_MODES
COMPARISON_UNEQUAL COMPARISON_UNEQUAL
}; };
class CardDescriptor: public MTGCardInstance{ class CardDescriptor: public MTGCardInstance
{
protected: protected:
MTGCardInstance * match_or(MTGCardInstance * card); MTGCardInstance * match_or(MTGCardInstance * card);
MTGCardInstance * match_and(MTGCardInstance * card); MTGCardInstance * match_and(MTGCardInstance * card);
+4 -3
View File
@@ -7,7 +7,8 @@ class TargetChooser;
class MTGGameZone; class MTGGameZone;
class MTGCardInstance; class MTGCardInstance;
class CardDisplay:public PlayGuiObjectController{ class CardDisplay: public PlayGuiObjectController
{
int mId; int mId;
GameObserver* game; GameObserver* game;
public: public:
@@ -16,7 +17,8 @@ class CardDisplay:public PlayGuiObjectController{
TargetChooser * tc; TargetChooser * tc;
JGuiListener * listener; JGuiListener * listener;
CardDisplay(); 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 AddCard(MTGCardInstance * _card);
void rotateLeft(); void rotateLeft();
void rotateRight(); void rotateRight();
@@ -28,7 +30,6 @@ class CardDisplay:public PlayGuiObjectController{
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
std::ostream& operator<<(std::ostream& out, const CardDisplay& m); std::ostream& operator<<(std::ostream& out, const CardDisplay& m);
#endif #endif
-1
View File
@@ -18,5 +18,4 @@ class CardEffect : public Effect
virtual void Render(); virtual void Render();
}; };
#endif // _CARDEFFECT_H_ #endif // _CARDEFFECT_H_
+19 -8
View File
@@ -16,14 +16,15 @@ namespace DrawMode
{ {
enum enum
{ {
kNormal = 0, kNormal,
kText, kText,
kHidden kHidden
}; };
const int kNumDrawModes = 3; const int kNumDrawModes = 3;
} }
struct CardGui : public PlayGuiObject { struct CardGui: public PlayGuiObject
{
protected: protected:
/* /*
@@ -54,11 +55,12 @@ struct CardGui : public PlayGuiObject {
virtual ostream& toString(ostream&) const; virtual ostream& toString(ostream&) const;
}; };
class CardView: public CardGui
class CardView : public CardGui { {
public: public:
typedef enum { typedef enum
{
nullZone, handZone, playZone nullZone, handZone, playZone
} SelectorZone; } SelectorZone;
@@ -69,15 +71,24 @@ class CardView : public CardGui {
CardView(const SelectorZone, MTGCardInstance* card, const Pos& ref); CardView(const SelectorZone, MTGCardInstance* card, const Pos& ref);
virtual ~CardView(); virtual ~CardView();
void Render(){CardGui::Render();}; void Render()
void Render(JQuad* q){Pos::Render(q);}; {
CardGui::Render();
}
;
void Render(JQuad* q)
{
Pos::Render(q);
}
;
virtual ostream& toString(ostream&) const; virtual ostream& toString(ostream&) const;
float GetCenterX(); float GetCenterX();
float GetCenterY(); float GetCenterY();
}; };
class TransientCardView : public CardGui { class TransientCardView: public CardGui
{
public: public:
TransientCardView(MTGCardInstance* card, float x, float y); TransientCardView(MTGCardInstance* card, float x, float y);
TransientCardView(MTGCardInstance* card, const Pos& ref); TransientCardView(MTGCardInstance* card, const Pos& ref);
+2 -3
View File
@@ -1,7 +1,6 @@
#ifndef _CARDPRIMITIVE_H_ #ifndef _CARDPRIMITIVE_H_
#define _CARDPRIMITIVE_H_ #define _CARDPRIMITIVE_H_
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
@@ -10,7 +9,8 @@
using namespace std; using namespace std;
class CardPrimitive { class CardPrimitive
{
protected: protected:
vector<string> ftdText; vector<string> ftdText;
string lcname; string lcname;
@@ -77,5 +77,4 @@ class CardPrimitive {
const vector<string>& formattedText(); const vector<string>& formattedText();
}; };
#endif #endif
+5 -2
View File
@@ -24,7 +24,11 @@ class CardSelectorBase : public GuiLayer
{ {
public: public:
CardSelectorBase(int inDrawMode = DrawMode::kNormal) : mDrawMode(inDrawMode) {}; CardSelectorBase(int inDrawMode = DrawMode::kNormal) :
mDrawMode(inDrawMode)
{
}
;
virtual void Add(PlayGuiObject*) = 0; virtual void Add(PlayGuiObject*) = 0;
virtual void Remove(PlayGuiObject*) = 0; virtual void Remove(PlayGuiObject*) = 0;
virtual bool CheckUserInput(JButton key) = 0; virtual bool CheckUserInput(JButton key) = 0;
@@ -43,7 +47,6 @@ protected:
int mDrawMode; int mDrawMode;
}; };
class CardSelector: public CardSelectorBase class CardSelector: public CardSelectorBase
{ {
public: public:
@@ -26,5 +26,4 @@ namespace CardSelectorSingleton
void Terminate(); void Terminate();
} }
#endif //CARDSELECTORSINGLETON_H #endif //CARDSELECTORSINGLETON_H
+4 -4
View File
@@ -2,12 +2,12 @@
#define _COUNTERS_H_ #define _COUNTERS_H_
#include <string> #include <string>
using std::string; using std::string;
class MTGCardInstance; class MTGCardInstance;
/* One family of counters. Ex : +1/+1 */ /* One family of counters. Ex : +1/+1 */
class Counter{ class Counter
{
public: public:
string name; string name;
int nb; int nb;
@@ -23,7 +23,8 @@ class Counter{
}; };
/* Various families of counters attached to an instance of a card */ /* Various families of counters attached to an instance of a card */
class Counters{ class Counters
{
public: public:
int mCount; int mCount;
Counter * counters[10]; Counter * counters[10];
@@ -40,5 +41,4 @@ class Counters{
int init(); int init();
}; };
#endif #endif
+4 -4
View File
@@ -1,7 +1,6 @@
#ifndef _CREDITS_H_ #ifndef _CREDITS_H_
#define _CREDITS_H_ #define _CREDITS_H_
#include <vector> #include <vector>
#include <string> #include <string>
#include <JGE.h> #include <JGE.h>
@@ -13,8 +12,8 @@ class GameApp;
using namespace std; using namespace std;
class CreditBonus
class CreditBonus{ {
public: public:
int value; int value;
string text; string text;
@@ -22,7 +21,8 @@ public:
void Render(float x, float y, WFont * font); void Render(float x, float y, WFont * font);
}; };
class Credits{ class Credits
{
private: private:
time_t gameLength; time_t gameLength;
int isDifficultyUnlocked(DeckStats * stats); int isDifficultyUnlocked(DeckStats * stats);
+39 -11
View File
@@ -17,7 +17,8 @@ class GameObserver;
#define DAMAGE_COMBAT 1 #define DAMAGE_COMBAT 1
#define DAMAGE_OTHER 2 #define DAMAGE_OTHER 2
class Damageable:public Targetable { class Damageable: public Targetable
{
protected: protected:
public: public:
int life; int life;
@@ -25,16 +26,43 @@ class Damageable:public Targetable {
int damageCount; int damageCount;
int preventable; int preventable;
int type_as_damageable; int type_as_damageable;
Damageable(int _life){life=_life;}; Damageable(int _life)
int getLife(){return life;}; {
virtual int dealDamage(int damage){life-=damage;return life;}; life = _life;
virtual int afterDamage(){return 0;} }
virtual int poisoned(){return 0;} ;
virtual int prevented(){return 0;} int getLife()
virtual JQuad * getIcon(){return NULL;}; {
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 { class Damage: public Interruptible
{
protected: protected:
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage); void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
public: public:
@@ -48,8 +76,8 @@ class Damage: public Interruptible {
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
class DamageStack: public GuiLayer, public Interruptible
class DamageStack : public GuiLayer, public Interruptible{ {
protected: protected:
int currentState; int currentState;
GameObserver* game; GameObserver* game;
+4 -2
View File
@@ -6,7 +6,8 @@
class Player; class Player;
struct DamagerDamaged : TransientCardView { struct DamagerDamaged: TransientCardView
{
bool show; bool show;
Player * damageSelecter; Player * damageSelecter;
vector<Damage> damages; vector<Damage> damages;
@@ -26,7 +27,8 @@ struct DamagerDamaged : TransientCardView {
}; };
typedef DamagerDamaged DefenserDamaged; typedef DamagerDamaged DefenserDamaged;
struct AttackerDamaged : DamagerDamaged { struct AttackerDamaged: DamagerDamaged
{
vector<DefenserDamaged*> blockers; vector<DefenserDamaged*> blockers;
AttackerDamaged(MTGCardInstance* card, float x, float y, bool show, Player* damageSelecter); AttackerDamaged(MTGCardInstance* card, float x, float y, bool show, Player* damageSelecter);
AttackerDamaged(MTGCardInstance* card, const Pos& ref, bool show, Player* damageSelecter); AttackerDamaged(MTGCardInstance* card, const Pos& ref, bool show, Player* damageSelecter);
+14 -3
View File
@@ -12,12 +12,23 @@ using std::string;
class MTGDeck; class MTGDeck;
class DeckDataWrapper: public WSrcDeck { class DeckDataWrapper: public WSrcDeck
{
public: public:
MTGDeck * parent; MTGDeck * parent;
DeckDataWrapper(MTGDeck * deck); DeckDataWrapper(MTGDeck * deck);
bool next() {currentPos++; return true;}; bool next()
bool prev() {currentPos--; return true;}; {
currentPos++;
return true;
}
;
bool prev()
{
currentPos--;
return true;
}
;
void save(); void save();
void save(string filepath, bool useExpandedCardNames, string &deckTitle, string &deckDesc); void save(string filepath, bool useExpandedCardNames, string &deckTitle, string &deckDesc);
}; };
+1 -2
View File
@@ -3,8 +3,7 @@
#include "DeckDataWrapper.h" #include "DeckDataWrapper.h"
#include "DeckStats.h" #include "DeckStats.h"
class DeckEditorMenu : class DeckEditorMenu: public DeckMenu
public DeckMenu
{ {
protected: protected:
string deckTitle; string deckTitle;
-3
View File
@@ -5,7 +5,6 @@
using namespace std; using namespace std;
class DeckManager class DeckManager
{ {
private: private:
@@ -18,7 +17,6 @@ private:
public: public:
vector<DeckMetaData *> playerDeckOrderList; vector<DeckMetaData *> playerDeckOrderList;
vector<DeckMetaData *> aiDeckOrderList; vector<DeckMetaData *> aiDeckOrderList;
@@ -34,7 +32,6 @@ public:
static int getDifficultyRating(Player *statsPlayer, Player *player); static int getDifficultyRating(Player *statsPlayer, Player *player);
~DeckManager() ~DeckManager()
{ {
instanceFlag = false; instanceFlag = false;
+8 -3
View File
@@ -56,15 +56,20 @@ public:
JQuad * pspIcons[8]; JQuad * pspIcons[8];
JTexture * pspIconsTexture; JTexture * pspIconsTexture;
DeckMenu(int id, JGuiListener* listener, int fontId, const string _title = "", const int& startIndex = 0, bool alwaysShowDetailsButton = false); DeckMenu(int id, JGuiListener* listener, int fontId, const string _title = "", const int& startIndex = 0, bool alwaysShowDetailsButton = false);
~DeckMenu(); ~DeckMenu();
DeckMetaData * getSelectedDeck(); DeckMetaData * getSelectedDeck();
void enableDisplayDetailsOverride(); void enableDisplayDetailsOverride();
bool showDetailsScreen(); bool showDetailsScreen();
bool isClosed() { return mClosed; } bool isClosed()
int getSelectedDeckId() { return mSelectedDeckId; } {
return mClosed;
}
int getSelectedDeckId()
{
return mSelectedDeckId;
}
void Render(); void Render();
void Update(float dt); void Update(float dt);
+15 -3
View File
@@ -31,8 +31,14 @@ public:
void Relocate(float x, float y); void Relocate(float x, float y);
float GetWidth(); float GetWidth();
string GetText() { return mText; } string GetText()
string GetDescription() { return desc; } {
return mText;
}
string GetDescription()
{
return desc;
}
bool hasFocus(); bool hasFocus();
DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false, DeckMetaData *meta = NULL); DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false, DeckMetaData *meta = NULL);
@@ -45,7 +51,13 @@ public:
virtual bool Leaving(JButton key); virtual bool Leaving(JButton key);
virtual bool ButtonPressed(); virtual bool ButtonPressed();
virtual ostream& toString(ostream& out) const; 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 #endif
+4 -4
View File
@@ -6,7 +6,6 @@
#include <map> #include <map>
#include "DeckStats.h" #include "DeckStats.h"
using namespace std; using namespace std;
enum DECK_DIFFICULTY enum DECK_DIFFICULTY
{ {
@@ -15,7 +14,8 @@ enum DECK_DIFFICULTY
EASY = 1 EASY = 1
}; };
class DeckMetaData { class DeckMetaData
{
private: private:
string _filename; string _filename;
@@ -51,7 +51,8 @@ public:
}; };
class DeckMetaDataList { class DeckMetaDataList
{
private: private:
map<string, DeckMetaData *> values; map<string, DeckMetaData *> values;
@@ -61,7 +62,6 @@ public:
~DeckMetaDataList(); ~DeckMetaDataList();
static DeckMetaDataList * decksMetaData; static DeckMetaDataList * decksMetaData;
}; };
#endif #endif
+2 -2
View File
@@ -15,7 +15,8 @@ class GuiAvatars;
class CardSelectorBase; class CardSelectorBase;
struct Pos; struct Pos;
class DuelLayers { class DuelLayers
{
protected: protected:
int nbitems; int nbitems;
vector<GuiLayer*> objects; vector<GuiLayer*> objects;
@@ -52,5 +53,4 @@ public:
#include "ActionStack.h" #include "ActionStack.h"
#include "Damage.h" #include "Damage.h"
#endif #endif
+36 -16
View File
@@ -9,7 +9,8 @@ class TargetChooser;
class MTGCardInstance; class MTGCardInstance;
class MTGAbility; class MTGAbility;
class ExtraCost{ class ExtraCost
{
public: public:
TargetChooser * tc; TargetChooser * tc;
MTGCardInstance * source; MTGCardInstance * source;
@@ -19,15 +20,22 @@ public:
ExtraCost(const std::string& inCostRenderString, TargetChooser *_tc = NULL); ExtraCost(const std::string& inCostRenderString, TargetChooser *_tc = NULL);
virtual ~ExtraCost(); virtual ~ExtraCost();
virtual int setPayment(MTGCardInstance * card); virtual int setPayment(MTGCardInstance * card);
virtual int isPaymentSet() { return (target != NULL); } virtual int isPaymentSet()
virtual int canPay() { return 1; } {
return (target != NULL);
}
virtual int canPay()
{
return 1;
}
virtual int doPay() = 0; virtual int doPay() = 0;
virtual void Render(); virtual void Render();
virtual int setSource(MTGCardInstance * _source); virtual int setSource(MTGCardInstance * _source);
virtual ExtraCost* clone() const = 0; virtual ExtraCost* clone() const = 0;
}; };
class ExtraCosts{ class ExtraCosts
{
public: public:
vector<ExtraCost *> costs; vector<ExtraCost *> costs;
MTGCardInstance * source; MTGCardInstance * source;
@@ -45,7 +53,8 @@ public:
ExtraCosts * clone() const; ExtraCosts * clone() const;
}; };
class SacrificeCost: public ExtraCost{ class SacrificeCost: public ExtraCost
{
public: public:
SacrificeCost(TargetChooser *_tc = NULL); SacrificeCost(TargetChooser *_tc = NULL);
virtual int doPay(); virtual int doPay();
@@ -53,7 +62,8 @@ public:
}; };
//life cost //life cost
class LifeCost: public ExtraCost{ class LifeCost: public ExtraCost
{
public: public:
LifeCost(TargetChooser *_tc = NULL); LifeCost(TargetChooser *_tc = NULL);
@@ -62,7 +72,8 @@ public:
}; };
//Discard a random card cost //Discard a random card cost
class DiscardRandomCost: public ExtraCost{ class DiscardRandomCost: public ExtraCost
{
public: public:
DiscardRandomCost(TargetChooser *_tc = NULL); DiscardRandomCost(TargetChooser *_tc = NULL);
virtual int canPay(); virtual int canPay();
@@ -71,7 +82,8 @@ public:
}; };
//a choosen discard //a choosen discard
class DiscardCost: public ExtraCost{ class DiscardCost: public ExtraCost
{
public: public:
DiscardCost(TargetChooser *_tc = NULL); DiscardCost(TargetChooser *_tc = NULL);
virtual int doPay(); virtual int doPay();
@@ -79,7 +91,8 @@ public:
}; };
//tolibrary cost //tolibrary cost
class ToLibraryCost: public ExtraCost{ class ToLibraryCost: public ExtraCost
{
public: public:
ToLibraryCost(TargetChooser *_tc = NULL); ToLibraryCost(TargetChooser *_tc = NULL);
virtual int doPay(); virtual int doPay();
@@ -87,7 +100,8 @@ public:
}; };
//Millyourself cost //Millyourself cost
class MillCost: public ExtraCost{ class MillCost: public ExtraCost
{
public: public:
MillCost(TargetChooser *_tc = NULL); MillCost(TargetChooser *_tc = NULL);
virtual int canPay(); virtual int canPay();
@@ -96,14 +110,16 @@ public:
}; };
//Mill to exile yourself cost //Mill to exile yourself cost
class MillExileCost: public MillCost{ class MillExileCost: public MillCost
{
public: public:
MillExileCost(TargetChooser *_tc = NULL); MillExileCost(TargetChooser *_tc = NULL);
virtual int doPay(); virtual int doPay();
}; };
//tap other cost //tap other cost
class TapTargetCost: public ExtraCost{ class TapTargetCost: public ExtraCost
{
public: public:
TapTargetCost(TargetChooser *_tc = NULL); TapTargetCost(TargetChooser *_tc = NULL);
virtual int doPay(); virtual int doPay();
@@ -111,7 +127,8 @@ public:
}; };
//exile as cost //exile as cost
class ExileTargetCost: public ExtraCost{ class ExileTargetCost: public ExtraCost
{
public: public:
ExileTargetCost(TargetChooser *_tc = NULL); ExileTargetCost(TargetChooser *_tc = NULL);
virtual int doPay(); virtual int doPay();
@@ -119,7 +136,8 @@ public:
}; };
//bounce cost //bounce cost
class BounceTargetCost: public ExtraCost{ class BounceTargetCost: public ExtraCost
{
public: public:
BounceTargetCost(TargetChooser *_tc = NULL); BounceTargetCost(TargetChooser *_tc = NULL);
virtual int doPay(); virtual int doPay();
@@ -127,7 +145,8 @@ public:
}; };
//bounce cost //bounce cost
class Ninja: public ExtraCost{ class Ninja: public ExtraCost
{
public: public:
Ninja(TargetChooser *_tc = NULL); Ninja(TargetChooser *_tc = NULL);
virtual int isPaymentSet(); virtual int isPaymentSet();
@@ -135,7 +154,8 @@ public:
virtual Ninja * clone() const; virtual Ninja * clone() const;
}; };
class CounterCost: public ExtraCost{ class CounterCost: public ExtraCost
{
public: public:
Counter * counter; Counter * counter;
int hasCounters; int hasCounters;
-7
View File
@@ -4,10 +4,6 @@
* http://wololo.net/wagic/ * http://wololo.net/wagic/
*/ */
#ifndef _GAMEAPP_H_ #ifndef _GAMEAPP_H_
#define _GAMEAPP_H_ #define _GAMEAPP_H_
@@ -59,11 +55,9 @@ class GameApp: public JApp
GameState* mGameStates[GAME_STATE_MAX]; GameState* mGameStates[GAME_STATE_MAX];
public: public:
int gameType; int gameType;
CardEffect *effect; CardEffect *effect;
GameApp(); GameApp();
virtual ~GameApp(); virtual ~GameApp();
@@ -74,7 +68,6 @@ class GameApp: public JApp
virtual void Pause(); virtual void Pause();
virtual void Resume(); virtual void Resume();
void LoadGameStates(); void LoadGameStates();
void SetNextState(int state); void SetNextState(int state);
void DoTransition(int trans, int tostate, float dur = -1, bool animonly = false); void DoTransition(int trans, int tostate, float dur = -1, bool animonly = false);
+2 -1
View File
@@ -22,7 +22,8 @@ class TargetChooser;
class Rules; class Rules;
using namespace std; using namespace std;
class GameObserver{ class GameObserver
{
protected: protected:
static GameObserver * mInstance; static GameObserver * mInstance;
MTGCardInstance * cardWaitingForTargets; MTGCardInstance * cardWaitingForTargets;
+126 -38
View File
@@ -23,10 +23,12 @@ class WStyle;
class StyleManager; class StyleManager;
class Player; class Player;
class Options { class Options
{
public: public:
friend class GameSettings; friend class GameSettings;
enum { enum
{
//Global settings //Global settings
ACTIVE_PROFILE, ACTIVE_PROFILE,
LANG, LANG,
@@ -80,7 +82,8 @@ public:
RANDOMDECK_MODE_UNLOCKED, RANDOMDECK_MODE_UNLOCKED,
AWARD_COLLECTOR, AWARD_COLLECTOR,
LAST_NAMED, //Any option after this does not look up in optionNames. 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[]; static const string optionNames[];
}; };
class GameOption { class GameOption
{
public: public:
virtual ~GameOption() {}; virtual ~GameOption()
{
}
;
int number; int number;
string str; string str;
//All calls to asColor should include a fallback color for people without a theme. //All calls to asColor should include a fallback color for people without a theme.
@@ -112,14 +119,16 @@ public:
GameOption(int, string); GameOption(int, string);
}; };
struct EnumDefinition { struct EnumDefinition
{
int findIndex(int value); int findIndex(int value);
typedef pair<int, string> assoc; typedef pair<int, string> assoc;
vector<assoc> values; vector<assoc> values;
}; };
class GameOptionEnum: public GameOption { class GameOptionEnum: public GameOption
{
public: public:
virtual string menuStr(); virtual string menuStr();
virtual bool write(std::ofstream * file, string name); virtual bool write(std::ofstream * file, string name);
@@ -127,7 +136,8 @@ public:
EnumDefinition * def; EnumDefinition * def;
}; };
class GameOptionAward: public GameOption { class GameOptionAward: public GameOption
{
public: public:
GameOptionAward(); GameOptionAward();
virtual string menuStr(); virtual string menuStr();
@@ -135,82 +145,142 @@ public:
virtual bool read(string input); virtual bool read(string input);
virtual bool giveAward(); //Returns false if already awarded virtual bool giveAward(); //Returns false if already awarded
virtual bool isViewed(); virtual bool isViewed();
virtual void setViewed(bool v = true) {viewed = v;}; virtual void setViewed(bool v = true)
{
viewed = v;
}
;
private: private:
time_t achieved; //When was it awarded? time_t achieved; //When was it awarded?
bool viewed; //Flag it as "New!" or not. bool viewed; //Flag it as "New!" or not.
}; };
class GameOptionKeyBindings : public GameOption { class GameOptionKeyBindings: public GameOption
{
virtual bool read(string input); virtual bool read(string input);
virtual bool write(std::ofstream*, string); virtual bool write(std::ofstream*, string);
}; };
class OptionVolume: public EnumDefinition{ class OptionVolume: public EnumDefinition
{
public: public:
enum { MUTE = 0, MAX = 100 }; enum
static EnumDefinition * getInstance() {return &mDef;}; {
MUTE = 0, MAX = 100
};
static EnumDefinition * getInstance()
{
return &mDef;
}
;
private: private:
OptionVolume(); OptionVolume();
static OptionVolume mDef; static OptionVolume mDef;
}; };
class OptionClosedHand: public EnumDefinition
class OptionClosedHand: public EnumDefinition { {
public: public:
enum { INVISIBLE = 0, VISIBLE = 1 }; enum
static EnumDefinition * getInstance() {return &mDef;}; {
INVISIBLE = 0, VISIBLE = 1
};
static EnumDefinition * getInstance()
{
return &mDef;
}
;
private: private:
OptionClosedHand(); OptionClosedHand();
static OptionClosedHand mDef; static OptionClosedHand mDef;
}; };
class OptionHandDirection: public EnumDefinition { class OptionHandDirection: public EnumDefinition
{
public: public:
enum { VERTICAL = 0, HORIZONTAL = 1}; enum
static EnumDefinition * getInstance() {return &mDef;}; {
VERTICAL = 0, HORIZONTAL = 1
};
static EnumDefinition * getInstance()
{
return &mDef;
}
;
private: private:
OptionHandDirection(); OptionHandDirection();
static OptionHandDirection mDef; static OptionHandDirection mDef;
}; };
class OptionManaDisplay: public EnumDefinition { class OptionManaDisplay: public EnumDefinition
{
public: public:
enum { DYNAMIC = 0, STATIC = 1, NOSTARSDYNAMIC = 2, BOTH = 3}; enum
static EnumDefinition * getInstance() {return &mDef;}; {
DYNAMIC = 0, STATIC = 1, NOSTARSDYNAMIC = 2, BOTH = 3
};
static EnumDefinition * getInstance()
{
return &mDef;
}
;
private: private:
OptionManaDisplay(); OptionManaDisplay();
static OptionManaDisplay mDef; static OptionManaDisplay mDef;
}; };
class OptionMaxGrade: public EnumDefinition { class OptionMaxGrade: public EnumDefinition
{
public: public:
static EnumDefinition * getInstance() {return &mDef;}; static EnumDefinition * getInstance()
{
return &mDef;
}
;
private: private:
OptionMaxGrade(); OptionMaxGrade();
static OptionMaxGrade mDef; static OptionMaxGrade mDef;
}; };
class OptionASkipPhase: public EnumDefinition { class OptionASkipPhase: public EnumDefinition
{
public: public:
static EnumDefinition * getInstance() {return &mDef;}; static EnumDefinition * getInstance()
{
return &mDef;
}
;
private: private:
OptionASkipPhase(); OptionASkipPhase();
static OptionASkipPhase mDef; static OptionASkipPhase mDef;
}; };
class OptionEconDifficulty: public EnumDefinition { class OptionEconDifficulty: public EnumDefinition
{
public: public:
static EnumDefinition * getInstance() {return &mDef;}; static EnumDefinition * getInstance()
{
return &mDef;
}
;
private: private:
OptionEconDifficulty(); OptionEconDifficulty();
static OptionEconDifficulty mDef; static OptionEconDifficulty mDef;
}; };
class OptionDifficulty: public EnumDefinition { class OptionDifficulty: public EnumDefinition
{
public: public:
enum { NORMAL = 0, HARD = 1, HARDER = 2, EVIL = 3}; enum
static EnumDefinition * getInstance() {return &mDef;}; {
NORMAL = 0, HARD = 1, HARDER = 2, EVIL = 3
};
static EnumDefinition * getInstance()
{
return &mDef;
}
;
private: private:
OptionDifficulty(); OptionDifficulty();
static OptionDifficulty mDef; static OptionDifficulty mDef;
}; };
class GameOptions { class GameOptions
{
public: public:
string mFilename; string mFilename;
int save(); int save();
@@ -226,20 +296,38 @@ class GameOptions {
vector<string> unknown; vector<string> unknown;
}; };
class GameSettings{ class GameSettings
{
public: public:
friend class GameApp; friend class GameApp;
GameSettings(); GameSettings();
~GameSettings(); ~GameSettings();
int save(); 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(); string keypadFinish();
void keypadShutdown(); void keypadShutdown();
void keypadTitle(string set); void keypadTitle(string set);
bool keypadActive() {if(keypad) return keypad->isActive(); return false;}; bool keypadActive()
void keypadUpdate(float dt) {if(keypad) keypad->Update(dt);}; {
void keypadRender() {if(keypad) keypad->Render();}; if (keypad)
return keypad->isActive();
return false;
}
;
void keypadUpdate(float dt)
{
if (keypad)
keypad->Update(dt);
}
;
void keypadRender()
{
if (keypad)
keypad->Render();
}
;
bool newAward(); bool newAward();
@@ -149,5 +149,4 @@ public:
virtual void ButtonPressed(int controllerId, int controlId); virtual void ButtonPressed(int controllerId, int controlId);
}; };
#endif #endif
+6 -4
View File
@@ -10,13 +10,16 @@ class WGuiTabMenu;
class SimpleMenu; class SimpleMenu;
class SimplePad; class SimplePad;
struct KeybGrabber { struct KeybGrabber
{
virtual void KeyPressed(LocalKeySym) = 0; virtual void KeyPressed(LocalKeySym) = 0;
}; };
class GameStateOptions: public GameState, public JGuiListener { class GameStateOptions: public GameState, public JGuiListener
{
private: private:
enum { enum
{
SHOW_OPTIONS, SHOW_OPTIONS,
SHOW_OPTIONS_MENU, SHOW_OPTIONS_MENU,
SAVE SAVE
@@ -45,5 +48,4 @@ private:
}; };
#endif #endif
+6 -5
View File
@@ -11,7 +11,6 @@
#include "DeckDataWrapper.h" #include "DeckDataWrapper.h"
#include "Tasks.h" #include "Tasks.h"
#define STATE_BUY 1 #define STATE_BUY 1
#define STATE_SELL 2 #define STATE_SELL 2
#define STAGE_SHOP_MENU 3 #define STAGE_SHOP_MENU 3
@@ -30,13 +29,16 @@
class MTGPack; class MTGPack;
class MTGPacks; class MTGPacks;
class BoosterDisplay:public CardDisplay { class BoosterDisplay: public CardDisplay
{
public: 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); bool CheckUserInput(JButton key);
}; };
class ShopBooster{ class ShopBooster
{
public: public:
ShopBooster(); ShopBooster();
string getName(); string getName();
@@ -118,6 +120,5 @@ class GameStateShop: public GameState, public JGuiListener
static float _x1[], _y1[], _x2[], _y2[], _x3[], _y3[], _x4[], _y4[]; static float _x1[], _y1[], _x2[], _y2[], _x3[], _y3[], _x4[], _y4[];
}; };
#endif #endif
+2 -3
View File
@@ -1,14 +1,14 @@
#ifndef _GAME_STATE_STORY_H_ #ifndef _GAME_STATE_STORY_H_
#define _GAME_STATE_STORY_H_ #define _GAME_STATE_STORY_H_
#include "GameState.h" #include "GameState.h"
#include <JGui.h> #include <JGui.h>
class StoryFlow; class StoryFlow;
class SimpleMenu; class SimpleMenu;
class GameStateStory: public GameState, public JGuiListener { class GameStateStory: public GameState, public JGuiListener
{
private: private:
StoryFlow * flow; StoryFlow * flow;
SimpleMenu * menu; SimpleMenu * menu;
@@ -25,5 +25,4 @@ private:
}; };
#endif #endif
+9 -3
View File
@@ -5,14 +5,19 @@
#include <JGui.h> #include <JGui.h>
#include "GameState.h" #include "GameState.h"
class TransitionBase: public GameState, public JGuiListener{ class TransitionBase: public GameState, public JGuiListener
{
public: public:
TransitionBase(GameApp* parent, GameState* _from, GameState* _to, float duration); TransitionBase(GameApp* parent, GameState* _from, GameState* _to, float duration);
~TransitionBase(); ~TransitionBase();
virtual void Start(); virtual void Start();
virtual void End(); virtual void End();
virtual bool Finished() {return (mElapsed >= mDuration);}; virtual bool Finished()
{
return (mElapsed >= mDuration);
}
;
virtual void Update(float dt); virtual void Update(float dt);
virtual void Render() = 0; virtual void Render() = 0;
virtual void ButtonPressed(int controllerId, int controlId); virtual void ButtonPressed(int controllerId, int controlId);
@@ -24,7 +29,8 @@ public:
bool bAnimationOnly; //Does not call start or end on subordinates. bool bAnimationOnly; //Does not call start or end on subordinates.
}; };
class TransitionFade: public TransitionBase { class TransitionFade: public TransitionBase
{
public: public:
TransitionFade(GameApp* p, GameState* f, GameState* t, float dur, bool reversed); TransitionFade(GameApp* p, GameState* f, GameState* t, float dur, bool reversed);
virtual void Render(); virtual void Render();
-1
View File
@@ -16,7 +16,6 @@ class GuiAvatars : public GuiLayer
GuiOpponentHand *opponentHand; GuiOpponentHand *opponentHand;
GuiAvatar* active; GuiAvatar* active;
public: public:
GuiAvatars(); GuiAvatars();
~GuiAvatars(); ~GuiAvatars();
+4 -4
View File
@@ -1,13 +1,13 @@
#ifndef _GUI_CARDS_CONTROLLER_H_ #ifndef _GUI_CARDS_CONTROLLER_H_
#define _GUI_CARDS_CONTROLLER_H_ #define _GUI_CARDS_CONTROLLER_H_
#include "PlayGuiObjectController.h" #include "PlayGuiObjectController.h"
class GuiCardsController : public PlayGuiObjectController{ class GuiCardsController: public PlayGuiObjectController
{
public: public:
GuiCardsController(){}; GuiCardsController(){}
;
}; };
#endif #endif
+8 -1
View File
@@ -16,7 +16,14 @@ class GuiCombat : public GuiLayer
static JTexture* ok_tex; static JTexture* ok_tex;
Pos ok, enemy_avatar; Pos ok, enemy_avatar;
DamagerDamaged* current; DamagerDamaged* current;
enum { BLK, ATK, OK, NONE } cursor_pos; enum
{
BLK,
ATK,
OK,
NONE
} cursor_pos;
CombatStep step; CombatStep step;
void validateDamage(); void validateDamage();
void addOne(DefenserDamaged* blocker, CombatStep); void addOne(DefenserDamaged* blocker, CombatStep);
+3 -3
View File
@@ -58,8 +58,7 @@ class GuiHandSelf : public GuiHand
protected: protected:
typedef enum typedef enum
{ {
Open, Open, Closed
Closed
} HandState; } HandState;
HandState state; HandState state;
Pos backpos; Pos backpos;
@@ -79,7 +78,8 @@ class GuiHandSelf : public GuiHand
HandState GetState() HandState GetState()
{ {
return state; return state;
}; }
;
HandLimitor* limitor; HandLimitor* limitor;
}; };
+22 -7
View File
@@ -12,7 +12,8 @@
class GameObserver; class GameObserver;
class Player; class Player;
class GuiLayer{ class GuiLayer
{
protected: protected:
JButton mActionButton; JButton mActionButton;
public: public:
@@ -28,17 +29,31 @@ class GuiLayer{
GuiLayer(); GuiLayer();
virtual ~GuiLayer(); virtual ~GuiLayer();
virtual void Update(float dt); virtual void Update(float dt);
virtual bool CheckUserInput(JButton key){ return false; }; virtual bool CheckUserInput(JButton key)
{
return false;
}
int getIndexOf(JGuiObject * object); int getIndexOf(JGuiObject * object);
JGuiObject * getByIndex(int index); JGuiObject * getByIndex(int index);
virtual void Render(); virtual void Render();
int empty(){ int empty()
if (mCount) return 0; {
if (mCount)
return 0;
return 1; 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 #endif
+8 -1
View File
@@ -18,7 +18,14 @@ class ManaIcon : public Pos
float f; float f;
float destx, desty; float destx, desty;
public: public:
enum { ALIVE, WITHERING, DROPPING, DEAD } mode; enum
{
ALIVE,
WITHERING,
DROPPING,
DEAD
} mode;
int color; int color;
void Render(); void Render();
void Update(float dt, float shift); void Update(float dt, float shift);
+8 -4
View File
@@ -12,7 +12,8 @@ class GuiPlay : public GuiLayer
typedef vector<CardView*>::iterator iterator; typedef vector<CardView*>::iterator iterator;
protected: protected:
class CardStack { class CardStack
{
protected: protected:
unsigned total; unsigned total;
float baseX, baseY; float baseX, baseY;
@@ -24,13 +25,15 @@ class GuiPlay : public GuiLayer
void RenderSpell(MTGCardInstance*, iterator begin, iterator end, float x, float y); void RenderSpell(MTGCardInstance*, iterator begin, iterator end, float x, float y);
}; };
class HorzStack : public CardStack { class HorzStack: public CardStack
{
public: public:
HorzStack(); HorzStack();
void Render(CardView*, iterator begin, iterator end); void Render(CardView*, iterator begin, iterator end);
void Enstack(CardView*); void Enstack(CardView*);
}; };
class VertStack : public CardStack { class VertStack: public CardStack
{
protected: protected:
unsigned count; unsigned count;
public: public:
@@ -40,7 +43,8 @@ class GuiPlay : public GuiLayer
void Enstack(CardView*); void Enstack(CardView*);
inline float nextX(); inline float nextX();
}; };
class BattleField : public HorzStack { class BattleField: public HorzStack
{
static const float HEIGHT; static const float HEIGHT;
unsigned attackers; unsigned attackers;
unsigned blockers; unsigned blockers;
+18 -7
View File
@@ -9,15 +9,22 @@
class CardView; class CardView;
struct GuiStatic : public PlayGuiObject{ struct GuiStatic: public PlayGuiObject
{
GuiAvatars* parent; GuiAvatars* parent;
GuiStatic(float desiredHeight, float x, float y, bool hasFocus, GuiAvatars* parent); GuiStatic(float desiredHeight, float x, float y, bool hasFocus, GuiAvatars* parent);
virtual void Entering(); virtual void Entering();
virtual bool Leaving(JButton key); virtual bool Leaving(JButton key);
}; };
struct GuiAvatar : public GuiStatic{ struct GuiAvatar: public GuiStatic
typedef enum { TOP_LEFT, BOTTOM_RIGHT } Corner; {
typedef enum
{
TOP_LEFT,
BOTTOM_RIGHT
} Corner;
static const unsigned Width = 35; static const unsigned Width = 35;
static const unsigned Height = 50; static const unsigned Height = 50;
@@ -33,7 +40,8 @@ struct GuiAvatar : public GuiStatic{
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
struct GuiGameZone : public GuiStatic{ struct GuiGameZone: public GuiStatic
{
static const int Width = 20; static const int Width = 20;
static const int Height = 25; static const int Height = 25;
vector<CardView*> cards; vector<CardView*> cards;
@@ -53,7 +61,8 @@ struct GuiGameZone : public GuiStatic{
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
//opponenthand //opponenthand
class GuiOpponentHand: public GuiGameZone{ class GuiOpponentHand: public GuiGameZone
{
public: public:
Player * player; Player * player;
GuiOpponentHand(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* Parent); GuiOpponentHand(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* Parent);
@@ -62,7 +71,8 @@ public:
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
//end of my addition //end of my addition
class GuiGraveyard: public GuiGameZone{ class GuiGraveyard: public GuiGameZone
{
public: public:
Player * player; Player * player;
GuiGraveyard(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent); GuiGraveyard(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
@@ -71,7 +81,8 @@ class GuiGraveyard: public GuiGameZone{
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
class GuiLibrary: public GuiGameZone{ class GuiLibrary: public GuiGameZone
{
public: public:
Player * player; Player * player;
GuiLibrary(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent); GuiLibrary(float _x, float _y, bool hasFocus, Player * player, GuiAvatars* parent);
+80 -25
View File
@@ -22,7 +22,6 @@ class Counter;
using std::string; using std::string;
using std::map; using std::map;
//stupid variables used to give a hint to the AI: //stupid variables used to give a hint to the AI:
// Should I cast a spell on an enemy or friendly unit ? // Should I cast a spell on an enemy or friendly unit ?
#define BAKA_EFFECT_GOOD 1 #define BAKA_EFFECT_GOOD 1
@@ -63,14 +62,30 @@ public:
MTGAbility(int id, MTGCardInstance* _source, Targetable* _target); MTGAbility(int id, MTGCardInstance* _source, Targetable* _target);
virtual int testDestroy(); virtual int testDestroy();
virtual ~MTGAbility(); virtual ~MTGAbility();
virtual void Render(){}; virtual void Render() {}
virtual int isReactingToClick(MTGCardInstance* card, ManaCost* mana = NULL){return 0;}; virtual int isReactingToClick(MTGCardInstance* card, ManaCost* mana = NULL)
virtual int reactToClick(MTGCardInstance* card){return 0;}; {
virtual int receiveEvent(WEvent* event){return 0;}; return 0;
}
;
virtual int reactToClick(MTGCardInstance* card)
{
return 0;
}
;
virtual int receiveEvent(WEvent* event)
{
return 0;
}
;
virtual void Update(float dt) {}; virtual void Update(float dt) {};
virtual int fireAbility(); virtual int fireAbility();
virtual int stillInUse(MTGCardInstance* card); virtual int stillInUse(MTGCardInstance* card);
virtual int resolve(){return 0;}; virtual int resolve()
{
return 0;
}
;
virtual MTGAbility* clone() const = 0; virtual MTGAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
virtual int addToGame(); virtual int addToGame();
@@ -122,20 +137,29 @@ public:
TriggeredAbility(int id, MTGCardInstance* card); TriggeredAbility(int id, MTGCardInstance* card);
TriggeredAbility(int id, MTGCardInstance* _source, Targetable* _target); TriggeredAbility(int id, MTGCardInstance* _source, Targetable* _target);
virtual void Update(float dt); virtual void Update(float dt);
virtual void Render(){}; virtual void Render() {}
virtual int trigger(){return 0;}; ;
virtual int triggerOnEvent(WEvent* e){return 0;}; virtual int trigger()
{
return 0;
}
;
virtual int triggerOnEvent(WEvent* e)
{
return 0;
}
;
int receiveEvent(WEvent* e); int receiveEvent(WEvent* e);
virtual int resolve() = 0; virtual int resolve() = 0;
virtual TriggeredAbility* clone() const = 0; virtual TriggeredAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
class ActivatedAbility: public MTGAbility class ActivatedAbility: public MTGAbility
{ {
public: public:
enum { enum
{
NO_RESTRICTION = 0, NO_RESTRICTION = 0,
PLAYER_TURN_ONLY = 1, PLAYER_TURN_ONLY = 1,
AS_SORCERY = 2, AS_SORCERY = 2,
@@ -223,7 +247,11 @@ public:
virtual int testDestroy(); virtual int testDestroy();
InstantAbility(int _id, MTGCardInstance* source); InstantAbility(int _id, MTGCardInstance* source);
InstantAbility(int _id, MTGCardInstance* source, Damageable* _target); InstantAbility(int _id, MTGCardInstance* source, Damageable* _target);
virtual int resolve(){return 0;}; virtual int resolve()
{
return 0;
}
;
virtual InstantAbility* clone() const = 0; virtual InstantAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
@@ -234,18 +262,39 @@ class ListMaintainerAbility:public MTGAbility
public: public:
map<MTGCardInstance *, bool> cards; map<MTGCardInstance *, bool> cards;
map<Player *, bool> players; map<Player *, bool> players;
ListMaintainerAbility(int _id):MTGAbility(_id,NULL){}; 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){}; }
;
ListMaintainerAbility(int _id, MTGCardInstance *_source) : MTGAbility(_id, _source)
{
}
;
ListMaintainerAbility(int _id, MTGCardInstance *_source, Damageable* _target) : MTGAbility(_id, _source, _target)
{
}
;
virtual void Update(float dt); virtual void Update(float dt);
void updateTargets(); void updateTargets();
virtual bool canTarget(MTGGameZone* zone); virtual bool canTarget(MTGGameZone* zone);
virtual int canBeInList(MTGCardInstance* card) = 0; virtual int canBeInList(MTGCardInstance* card) = 0;
virtual int added(MTGCardInstance* card) = 0; virtual int added(MTGCardInstance* card) = 0;
virtual int removed(MTGCardInstance* card) = 0; virtual int removed(MTGCardInstance* card) = 0;
virtual int canBeInList(Player* p){return 0;}; virtual int canBeInList(Player* p)
virtual int added(Player* p){return 0;}; {
virtual int removed(Player* p){return 0;}; return 0;
}
;
virtual int added(Player* p)
{
return 0;
}
;
virtual int removed(Player* p)
{
return 0;
}
;
virtual int destroy(); virtual int destroy();
virtual ListMaintainerAbility* clone() const = 0; virtual ListMaintainerAbility* clone() const = 0;
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
@@ -258,7 +307,11 @@ public:
int who; 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(); virtual int trigger();
int resolve(){return 0;}; int resolve()
{
return 0;
}
;
virtual TriggerAtPhase* clone() const; virtual TriggerAtPhase* clone() const;
}; };
@@ -272,14 +325,14 @@ public:
}; };
class GenericTriggeredAbility: public TriggeredAbility, public NestedAbility class GenericTriggeredAbility: public TriggeredAbility, public NestedAbility
{ {
public: public:
TriggeredAbility* t; TriggeredAbility* t;
queue<Targetable *> targets; queue<Targetable *> targets;
MTGAbility* destroyCondition; 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 trigger();
virtual int triggerOnEvent(WEvent* e); virtual int triggerOnEvent(WEvent* e);
virtual int resolve(); virtual int resolve();
@@ -308,10 +361,12 @@ public:
Counter* parseCounter(string s, MTGCardInstance* target, Spell* spell = NULL); Counter* parseCounter(string s, MTGCardInstance* target, Spell* spell = NULL);
int parsePowerToughness(string s, int* power, int* toughness); int parsePowerToughness(string s, int* power, int* toughness);
int getAbilities(vector<MTGAbility *>* v, Spell* spell, MTGCardInstance* card = NULL, int id = 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); 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 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 computeX(Spell* spell, MTGCardInstance* card);
static int computeXX(Spell* spell, MTGCardInstance* card); static int computeXX(Spell* spell, MTGCardInstance* card);
static MTGAbility* getCoreAbility(MTGAbility* a); static MTGAbility* getCoreAbility(MTGAbility* a);
@@ -323,12 +378,12 @@ public:
void addAbilities(int _id, Spell* spell); void addAbilities(int _id, Spell* spell);
}; };
class ActivatedAbilityTP: public ActivatedAbility class ActivatedAbilityTP: public ActivatedAbility
{ {
public: public:
int who; 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(); Targetable* getTarget();
}; };
+2 -4
View File
@@ -17,7 +17,8 @@ class CardPrimitive;
using namespace std; using namespace std;
class MTGCard { class MTGCard
{
protected: protected:
friend class MTGSetInfo; friend class MTGSetInfo;
int mtgid; int mtgid;
@@ -44,7 +45,4 @@ class MTGCard {
char * getImageName(); char * getImageName();
}; };
#endif #endif
+6 -6
View File
@@ -10,7 +10,6 @@
#include "Damage.h" #include "Damage.h"
#include "Targetable.h" #include "Targetable.h"
class MTGCardInstance; class MTGCardInstance;
class MTGPlayerCards; class MTGPlayerCards;
class MTGAbility; class MTGAbility;
@@ -24,7 +23,8 @@ struct Pos;
#include <list> #include <list>
using namespace std; using namespace std;
class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable { class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable
{
protected: protected:
int untapping; int untapping;
int nb_damages; int nb_damages;
@@ -72,11 +72,13 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
MTGCardInstance * changeController(Player * newcontroller); MTGCardInstance * changeController(Player * newcontroller);
Player * owner; Player * owner;
Counters * counters; Counters * counters;
int typeAsTarget(){return TARGET_CARD;} int typeAsTarget()
{
return TARGET_CARD;
}
const string getDisplayName() const; const string getDisplayName() const;
MTGCardInstance * target; MTGCardInstance * target;
//types //types
void addType(char * type_text); void addType(char * type_text);
virtual void addType(int id); virtual void addType(int id);
@@ -123,7 +125,6 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
int bury(); int bury();
int destroy(); int destroy();
int addToToughness(int value); int addToToughness(int value);
int setToughness(int value); int setToughness(int value);
@@ -168,5 +169,4 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
ostream& operator<<(ostream&, const MTGCardInstance&); ostream& operator<<(ostream&, const MTGCardInstance&);
#endif #endif
+17 -13
View File
@@ -7,7 +7,6 @@
#include "GameApp.h" #include "GameApp.h"
#include "WResourceManager.h" #include "WResourceManager.h"
#include <string> #include <string>
using std::string; using std::string;
@@ -15,7 +14,8 @@ class GameApp;
class MTGCard; class MTGCard;
class CardPrimitive; class CardPrimitive;
class MTGPack; class MTGPack;
class MTGSetInfo{ class MTGSetInfo
{
public: public:
MTGSetInfo(string _id); MTGSetInfo(string _id);
~MTGSetInfo(); ~MTGSetInfo();
@@ -33,7 +33,8 @@ public:
string getBlock(); string getBlock();
void processConfLine(string line); void processConfLine(string line);
enum { enum
{
//For memoized counts //For memoized counts
LAND = 0, LAND = 0,
COMMON = 1, COMMON = 1,
@@ -51,15 +52,16 @@ public:
int counts[MTGSetInfo::MAX_COUNT]; int counts[MTGSetInfo::MAX_COUNT];
}; };
class MTGSets{ class MTGSets
{
public: public:
//These values have to be < 0 //These values have to be < 0
// A setID with a value >=0 will be looked into the sets table, // 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...) // Negative values will be compared to these enums throughout the code (shop, filters...)
enum { enum
INTERNAL_SET = -1, {
ALL_SETS = -2, INTERNAL_SET = -1, ALL_SETS = -2,
}; };
friend class MTGSetInfo; friend class MTGSetInfo;
@@ -86,7 +88,8 @@ protected:
extern MTGSets setlist; extern MTGSets setlist;
class MTGAllCards { class MTGAllCards
{
private: private:
MTGCard * tempCard; //used by parser MTGCard * tempCard; //used by parser
CardPrimitive * tempPrimitive; //used by parser CardPrimitive * tempPrimitive; //used by parser
@@ -99,7 +102,8 @@ private:
void init(); void init();
void initCounters(); void initCounters();
public: public:
enum { enum
{
READ_ANYTHING = 0, READ_ANYTHING = 0,
READ_CARD = 1, READ_CARD = 1,
READ_METADATA = 2, READ_METADATA = 2,
@@ -126,8 +130,8 @@ private:
CardPrimitive * addPrimitive(CardPrimitive * primitive, MTGCard * card = NULL); CardPrimitive * addPrimitive(CardPrimitive * primitive, MTGCard * card = NULL);
}; };
class MTGDeck
class MTGDeck{ {
protected: protected:
string filename; string filename;
int total_cards; int total_cards;
@@ -141,7 +145,8 @@ class MTGDeck{
int totalPrice(); int totalPrice();
MTGDeck(MTGAllCards * _allcards); MTGDeck(MTGAllCards * _allcards);
MTGDeck(const char * config_file, MTGAllCards * _allcards, int meta_only = 0); 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(int cardid);
int add(MTGDeck * deck); // adds the contents of "deck" into myself int add(MTGDeck * deck); // adds the contents of "deck" into myself
int complete(); int complete();
@@ -155,5 +160,4 @@ class MTGDeck{
}; };
#endif #endif
-5
View File
@@ -17,7 +17,6 @@ class Constants
const static int PARSER_KEYWORD_NOT_MATCHED = 2000; const static int PARSER_KEYWORD_NOT_MATCHED = 2000;
const static int PARSER_INVALID_KEYWORD = 3000; const static int PARSER_INVALID_KEYWORD = 3000;
// color constants // color constants
static const string kManaColorless; static const string kManaColorless;
static const string kManaGreen; static const string kManaGreen;
@@ -50,7 +49,6 @@ class Constants
MTG_NB_COLORS = 7, MTG_NB_COLORS = 7,
MTG_UNCOLORED = 0, MTG_UNCOLORED = 0,
MTG_FOREST = 1, MTG_FOREST = 1,
MTG_ISLAND = 2, MTG_ISLAND = 2,
@@ -58,7 +56,6 @@ class Constants
MTG_SWAMP = 4, MTG_SWAMP = 4,
MTG_PLAIN = 5, MTG_PLAIN = 5,
MTG_TYPE_CREATURE = 10, MTG_TYPE_CREATURE = 10,
MTG_TYPE_ARTIFACT = 11, MTG_TYPE_ARTIFACT = 11,
MTG_TYPE_ENCHANTMENT = 12, MTG_TYPE_ENCHANTMENT = 12,
@@ -66,7 +63,6 @@ class Constants
MTG_TYPE_LAND = 14, MTG_TYPE_LAND = 14,
MTG_TYPE_INSTANT = 15, MTG_TYPE_INSTANT = 15,
MTG_PHASE_BEFORE_BEGIN = 0, MTG_PHASE_BEFORE_BEGIN = 0,
MTG_PHASE_UNTAP = 1, MTG_PHASE_UNTAP = 1,
MTG_PHASE_UPKEEP = 2, MTG_PHASE_UPKEEP = 2,
@@ -172,7 +168,6 @@ class Constants
NB_BASIC_ABILITIES = 84, NB_BASIC_ABILITIES = 84,
RARITY_S = 'S', //Special Rarity RARITY_S = 'S', //Special Rarity
RARITY_M = 'M', //Mythics RARITY_M = 'M', //Mythics
RARITY_R = 'R', //Rares RARITY_R = 'R', //Rares
+2 -3
View File
@@ -7,8 +7,8 @@
#include <JGui.h> #include <JGui.h>
#include "WFont.h" #include "WFont.h"
class MTGGamePhase: public ActionElement
class MTGGamePhase: public ActionElement { {
protected: protected:
float animation; float animation;
int currentState; int currentState;
@@ -21,5 +21,4 @@ class MTGGamePhase: public ActionElement {
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
#endif #endif
+47 -17
View File
@@ -14,12 +14,14 @@ class MTGDeck;
class MTGCardInstance; class MTGCardInstance;
class Player; class Player;
class MTGGameZone { class MTGGameZone
{
protected: protected:
public: public:
enum{ enum
{
ALL_ZONES = -1, ALL_ZONES = -1,
MY_GRAVEYARD = 11, MY_GRAVEYARD = 11,
@@ -91,51 +93,79 @@ class MTGGameZone {
static int zoneStringToId(string zoneName); 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; bool needShuffle;
virtual const char * getName(){return "zone";}; virtual const char * getName()
{
return "zone";
}
;
virtual ostream& toString(ostream&) const; virtual ostream& toString(ostream&) const;
}; };
class MTGLibrary: public MTGGameZone { class MTGLibrary: public MTGGameZone
{
public: public:
void shuffleTopToBottom(int nbcards); void shuffleTopToBottom(int nbcards);
virtual ostream& toString(ostream&) const; virtual ostream& toString(ostream&) const;
const char * getName(){return "library";} const char * getName()
{
return "library";
}
}; };
class MTGGraveyard: public MTGGameZone { class MTGGraveyard: public MTGGameZone
{
public: public:
virtual ostream& toString(ostream&) const; virtual ostream& toString(ostream&) const;
const char * getName(){return "graveyard";} const char * getName()
{
return "graveyard";
}
}; };
class MTGHand: public MTGGameZone { class MTGHand: public MTGGameZone
{
public: public:
virtual ostream& toString(ostream&) const; virtual ostream& toString(ostream&) const;
const char * getName(){return "hand";} const char * getName()
{
return "hand";
}
}; };
class MTGRemovedFromGame: public MTGGameZone { class MTGRemovedFromGame: public MTGGameZone
{
public: public:
virtual ostream& toString(ostream&) const; virtual ostream& toString(ostream&) const;
const char * getName(){return "exile";} const char * getName()
{
return "exile";
}
}; };
class MTGStack: public MTGGameZone { class MTGStack: public MTGGameZone
{
public: public:
virtual ostream& toString(ostream&) const; virtual ostream& toString(ostream&) const;
const char * getName(){return "stack";} const char * getName()
{
return "stack";
}
}; };
class MTGInPlay: public MTGGameZone { class MTGInPlay: public MTGGameZone
{
public: public:
void untapAll(); void untapAll();
MTGCardInstance * getNextAttacker(MTGCardInstance * previous); MTGCardInstance * getNextAttacker(MTGCardInstance * previous);
virtual ostream& toString(ostream&) const; virtual ostream& toString(ostream&) const;
const char * getName(){return "battlefield";} const char * getName()
{
return "battlefield";
}
}; };
class MTGPlayerCards
class MTGPlayerCards { {
protected: protected:
void init(); void init();
+69 -17
View File
@@ -3,32 +3,54 @@
class ShopBooster; class ShopBooster;
class MTGPackEntry{ class MTGPackEntry
{
public: public:
virtual ~MTGPackEntry() {}; virtual ~MTGPackEntry()
{
}
;
virtual int addCard(WSrcCards * pool, MTGDeck * to) = 0; virtual int addCard(WSrcCards * pool, MTGDeck * to) = 0;
int copies; int copies;
}; };
class MTGPackEntryRandom: public MTGPackEntry{ class MTGPackEntryRandom: public MTGPackEntry
{
public: public:
MTGPackEntryRandom() {filter = ""; copies=1;}; MTGPackEntryRandom()
MTGPackEntryRandom(string f, int c=1) {filter = f; copies = c;}; {
filter = "";
copies = 1;
}
;
MTGPackEntryRandom(string f, int c = 1)
{
filter = f;
copies = c;
}
;
int addCard(WSrcCards * pool, MTGDeck * to); int addCard(WSrcCards * pool, MTGDeck * to);
string filter; string filter;
}; };
class MTGPackEntrySpecific: public MTGPackEntry{ class MTGPackEntrySpecific: public MTGPackEntry
{
public: public:
int addCard(WSrcCards * pool, MTGDeck * to); int addCard(WSrcCards * pool, MTGDeck * to);
MTGCard * card; MTGCard * card;
}; };
class MTGPackEntryNothing: public MTGPackEntry{ class MTGPackEntryNothing: public MTGPackEntry
{
public: public:
int addCard(WSrcCards * pool,MTGDeck * to) {return 0;}; int addCard(WSrcCards * pool, MTGDeck * to)
{
return 0;
}
;
}; };
class MTGPackSlot{ class MTGPackSlot
{
public: public:
~MTGPackSlot(); ~MTGPackSlot();
int add(WSrcCards * ocean, MTGDeck * to, int carryover); int add(WSrcCards * ocean, MTGDeck * to, int carryover);
@@ -38,23 +60,48 @@ public:
vector<MTGPackEntry*> entries; vector<MTGPackEntry*> entries;
}; };
class MTGPack{ class MTGPack
{
public: public:
friend class MTGPacks; friend class MTGPacks;
friend class ShopBooster; friend class ShopBooster;
friend class MTGSetInfo; friend class MTGSetInfo;
bool meetsRequirements(); //Check if pool contains locked cards. bool meetsRequirements(); //Check if pool contains locked cards.
bool isUnlocked(); bool isUnlocked();
bool isValid() {return bValid;}; bool isValid()
{
return bValid;
}
;
void load(string filename); void load(string filename);
int assemblePack(MTGDeck * to); int assemblePack(MTGDeck * to);
MTGPack() {bValid = false; unlockStatus = 0; price=Constants::PRICE_BOOSTER;}; MTGPack()
MTGPack(string s) {bValid = false; load(s); unlockStatus = 0;}; {
bValid = false;
unlockStatus = 0;
price = Constants::PRICE_BOOSTER;
}
;
MTGPack(string s)
{
bValid = false;
load(s);
unlockStatus = 0;
}
;
~MTGPack(); ~MTGPack();
string getName(); string getName();
string getSort() {return sort;}; string getSort()
int getPrice() {return price;}; {
return sort;
}
;
int getPrice()
{
return price;
}
;
static WSrcCards * getPool(string poolstr); static WSrcCards * getPool(string poolstr);
protected: protected:
void countCards(); void countCards();
@@ -72,12 +119,17 @@ protected:
vector<MTGPackSlot*> slotss; vector<MTGPackSlot*> slotss;
}; };
class MTGPacks{ class MTGPacks
{
public: public:
~MTGPacks(); ~MTGPacks();
MTGPack * randomPack(int key = 0); MTGPack * randomPack(int key = 0);
void loadAll(); void loadAll();
int size() {return (int)packs.size();}; int size()
{
return (int) packs.size();
}
;
void refreshUnlocked(); void refreshUnlocked();
static MTGPack * getDefault(); static MTGPack * getDefault();
+6 -4
View File
@@ -4,7 +4,6 @@
#include "utils.h" #include "utils.h"
#include "MTGDefinitions.h" #include "MTGDefinitions.h"
class ManaCostHybrid; class ManaCostHybrid;
class ExtraCosts; class ExtraCosts;
class ExtraCost; class ExtraCost;
@@ -12,7 +11,8 @@ class MTGAbility;
class MTGCardInstance; class MTGCardInstance;
class Player; class Player;
class ManaCost{ class ManaCost
{
protected: protected:
int cost[Constants::MTG_NB_COLORS + 1]; int cost[Constants::MTG_NB_COLORS + 1];
ManaCostHybrid * hybrids[10]; ManaCostHybrid * hybrids[10];
@@ -20,7 +20,8 @@ class ManaCost{
int extraCostsIsCopy; int extraCostsIsCopy;
public: public:
enum{ enum
{
MANA_UNPAID = 0, MANA_UNPAID = 0,
MANA_PAID = 1, MANA_PAID = 1,
MANA_PAID_WITH_KICKER = 2, MANA_PAID_WITH_KICKER = 2,
@@ -82,7 +83,8 @@ class ManaCost{
std::ostream& operator<<(std::ostream& out, const ManaCost& m); std::ostream& operator<<(std::ostream& out, const ManaCost& m);
class ManaPool:public ManaCost{ class ManaPool: public ManaCost
{
protected: protected:
Player * player; Player * player;
public: public:
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef _MANACOST_HYBRID_H_ #ifndef _MANACOST_HYBRID_H_
#define _MANACOST_HYBRID_H_ #define _MANACOST_HYBRID_H_
class ManaCostHybrid{ class ManaCostHybrid
{
public: public:
int color1; int color1;
int color2; int color2;
+7 -2
View File
@@ -29,7 +29,6 @@ class MenuItem: public JGuiObject
JQuad * offQuad; JQuad * offQuad;
hgeParticleSystem* mParticleSys; 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(int id, WFont *font, string text, float x, float y, JQuad * _off, JQuad * _on, const char * particle, JQuad * particleQuad, bool hasFocus = false);
~MenuItem(); ~MenuItem();
@@ -39,7 +38,13 @@ class MenuItem: public JGuiObject
virtual void Entering(); virtual void Entering();
virtual bool Leaving(JButton key); virtual bool Leaving(JButton key);
virtual bool ButtonPressed(); 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; virtual ostream& toString(ostream& out) const;
}; };
-1
View File
@@ -9,7 +9,6 @@
#include <map> #include <map>
#include <vector> #include <vector>
// private class only used by Navigator, see implementation file // private class only used by Navigator, see implementation file
class CardZone; class CardZone;
+83 -21
View File
@@ -20,20 +20,29 @@ using std::string;
#define PATH_MAX 4096 #define PATH_MAX 4096
#endif #endif
class OptionItem: public WGuiItem{ class OptionItem: public WGuiItem
{
public: public:
OptionItem(int _id, string _displayValue); OptionItem(int _id, string _displayValue);
virtual ~OptionItem() {}; virtual ~OptionItem() {};
//Accessors //Accessors
virtual int getId() {return id;}; virtual int getId()
virtual void setId(int _id){id = _id;}; {
return id;
}
virtual void setId(int _id)
{
id = _id;
}
protected: protected:
int id; int id;
}; };
class OptionInteger:public OptionItem{ class OptionInteger: public OptionItem
{
public: public:
int value; //Current value. int value; //Current value.
int defValue; //Default value. int defValue; //Default value.
@@ -42,37 +51,77 @@ class OptionInteger:public OptionItem{
OptionInteger(int _id, string _displayValue, int _maxValue = 1, int _increment = 1, int _defV = 0, string _sDef = "", int _minValue = 0); OptionInteger(int _id, string _displayValue, int _maxValue = 1, int _increment = 1, int _defV = 0, string _sDef = "", int _minValue = 0);
virtual void Reload() {if(id != INVALID_OPTION) value = options[id].number;}; virtual void Reload()
virtual bool Changed() {return value != options[id].number;}; {
if (id != INVALID_OPTION)
value = options[id].number;
}
virtual bool Changed()
{
return value != options[id].number;
}
virtual void Render(); virtual void Render();
virtual void setData(); 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{ class OptionSelect: public OptionItem
{
public: public:
size_t value; size_t value;
vector<string> selections; vector<string> selections;
virtual void addSelection(string s); virtual void addSelection(string s);
OptionSelect(int _id, string _displayValue): OptionItem(_id, _displayValue) {value = 0;}; OptionSelect(int _id, string _displayValue) :
virtual void Reload(){initSelections();}; OptionItem(_id, _displayValue)
{
value = 0;
}
;
virtual void Reload()
{
initSelections();
}
;
virtual void Render(); virtual void Render();
virtual bool Selectable(); virtual bool Selectable();
virtual void Entering(JButton key); virtual void Entering(JButton key);
virtual bool Changed() {return (value != prior_value);}; virtual bool Changed()
{
return (value != prior_value);
}
virtual void setData(); virtual void setData();
virtual void initSelections(); virtual void initSelections();
virtual void updateValue(){value++; if (value > selections.size() - 1) value=0;}; virtual void updateValue()
{
value++;
if (value > selections.size() - 1)
value = 0;
}
;
protected: protected:
size_t prior_value; size_t prior_value;
}; };
class OptionLanguage: public OptionSelect{ class OptionLanguage: public OptionSelect
{
public: public:
OptionLanguage(string _displayValue); OptionLanguage(string _displayValue);
virtual void addSelection(string s) {addSelection(s,s);}; virtual void addSelection(string s)
{
addSelection(s, s);
}
;
virtual void addSelection(string s, string show); virtual void addSelection(string s, string show);
virtual void initSelections(); virtual void initSelections();
virtual void confirmChange(bool confirmed); virtual void confirmChange(bool confirmed);
@@ -84,14 +133,16 @@ protected:
vector<string> actual_data; vector<string> actual_data;
}; };
class OptionThemeStyle: public OptionSelect{ class OptionThemeStyle: public OptionSelect
{
public: public:
virtual bool Visible(); virtual bool Visible();
virtual void Reload(); virtual void Reload();
virtual void confirmChange(bool confirmed); virtual void confirmChange(bool confirmed);
OptionThemeStyle(string _displayValue); OptionThemeStyle(string _displayValue);
}; };
class OptionDirectory:public OptionSelect{ class OptionDirectory: public OptionSelect
{
public: public:
virtual void Reload(); virtual void Reload();
OptionDirectory(string root, int id, string displayValue, const string type); OptionDirectory(string root, int id, string displayValue, const string type);
@@ -100,7 +151,8 @@ class OptionDirectory:public OptionSelect{
const string type; const string type;
}; };
class OptionTheme:public OptionDirectory{ class OptionTheme: public OptionDirectory
{
private: private:
static const string DIRTESTER; static const string DIRTESTER;
public: public:
@@ -118,14 +170,23 @@ protected:
bool bChecked; bool bChecked;
}; };
class OptionProfile:public OptionDirectory{ class OptionProfile: public OptionDirectory
{
private: private:
static const string DIRTESTER; static const string DIRTESTER;
public: public:
OptionProfile(GameApp * _app, JGuiListener * jgl); OptionProfile(GameApp * _app, JGuiListener * jgl);
virtual void addSelection(string s); virtual void addSelection(string s);
virtual bool Selectable() {return canSelect;}; virtual bool Selectable()
virtual bool Changed() {return (initialValue != value);}; {
return canSelect;
}
;
virtual bool Changed()
{
return (initialValue != value);
}
;
virtual void Entering(JButton key); virtual void Entering(JButton key);
virtual void Reload(); virtual void Reload();
virtual void Render(); virtual void Render();
@@ -141,7 +202,8 @@ private:
size_t initialValue; size_t initialValue;
}; };
class OptionKey : public WGuiItem, public KeybGrabber { class OptionKey: public WGuiItem, public KeybGrabber
{
public: public:
OptionKey(GameStateOptions* g, LocalKeySym, JButton); OptionKey(GameStateOptions* g, LocalKeySym, JButton);
LocalKeySym from; LocalKeySym from;
+20 -4
View File
@@ -11,15 +11,31 @@ using namespace std;
class Player; class Player;
typedef enum { BLOCKERS, TRIGGERS, ORDER, FIRST_STRIKE, END_FIRST_STRIKE, DAMAGE, END_DAMAGE } CombatStep; typedef enum
class Phase{ {
BLOCKERS,
TRIGGERS,
ORDER,
FIRST_STRIKE,
END_FIRST_STRIKE,
DAMAGE,
END_DAMAGE
} CombatStep;
class Phase
{
public: public:
int id; int id;
Player * player; 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: private:
static bool extraDamagePhase(int id); static bool extraDamagePhase(int id);
public: public:
+33 -7
View File
@@ -16,7 +16,8 @@
#include "WEvent.h" #include "WEvent.h"
#include "Pos.h" #include "Pos.h"
class PlayGuiObject: public JGuiObject, public JGuiListener, public Pos{ class PlayGuiObject: public JGuiObject, public JGuiListener, public Pos
{
protected: protected:
public: public:
@@ -25,16 +26,41 @@ class PlayGuiObject: public JGuiObject, public JGuiListener, public Pos{
float defaultHeight; float defaultHeight;
bool mHasFocus; bool mHasFocus;
int type; int type;
virtual void Entering(){mHasFocus = true; zoom = 1.4f;}; virtual void Entering()
virtual bool Leaving(JButton key){mHasFocus = false; zoom = 1.0; return true;}; {
virtual bool CheckUserInput(JButton key) {return false;}; mHasFocus = true;
virtual bool ButtonPressed(){return 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 Render();
virtual void Update(float dt); virtual void Update(float dt);
PlayGuiObject(float desiredHeight, float x, float y, bool hasFocus); PlayGuiObject(float desiredHeight, float x, float y, bool hasFocus);
PlayGuiObject(float desiredHeight, const Pos& ref, bool hasFocus); PlayGuiObject(float desiredHeight, const Pos& ref, bool hasFocus);
virtual void ButtonPressed(int controllerId, int controlId){}; virtual void ButtonPressed(int controllerId, int controlId) {}
virtual bool getTopLeft(float& top, float& left) {top = actY; left = actX; return true;}; virtual bool getTopLeft(float& top, float& left)
{
top = actY;
left = actX;
return true;
}
;
virtual ~PlayGuiObject() {}; virtual ~PlayGuiObject() {};
vector<Effect*> effects; vector<Effect*> effects;
}; };
+12 -5
View File
@@ -5,7 +5,8 @@
#include "GuiLayers.h" #include "GuiLayers.h"
class PlayGuiObjectController : public GuiLayer{ class PlayGuiObjectController: public GuiLayer
{
protected: protected:
float last_user_move; float last_user_move;
int getClosestItem(int direction); int getClosestItem(int direction);
@@ -14,10 +15,16 @@ class PlayGuiObjectController : public GuiLayer{
public: public:
virtual void Update(float dt); virtual void Update(float dt);
virtual bool CheckUserInput(JButton key); virtual bool CheckUserInput(JButton key);
PlayGuiObjectController(){last_user_move=0;}; PlayGuiObjectController()
virtual void Render(){GuiLayer::Render();}; {
last_user_move = 0;
}
;
virtual void Render()
{
GuiLayer::Render();
}
;
}; };
#endif #endif
+3 -1
View File
@@ -19,7 +19,9 @@ protected:
public: public:
enum ENUM_PLAY_MODE enum ENUM_PLAY_MODE
{ {
MODE_TEST_SUITE, MODE_HUMAN, MODE_AI, MODE_TEST_SUITE,
MODE_HUMAN,
MODE_AI
}; };
JTexture * mAvatarTex; JTexture * mAvatarTex;
+2 -1
View File
@@ -4,7 +4,8 @@
#include "MTGDeck.h" #include "MTGDeck.h"
#include "Tasks.h" #include "Tasks.h"
class PlayerData{ class PlayerData
{
protected: protected:
void init(); void init();
public: public:
+2 -1
View File
@@ -3,7 +3,8 @@
#include "JGE.h" #include "JGE.h"
struct Pos { struct Pos
{
float actX, actY, actZ, actT, actA; float actX, actY, actZ, actT, actA;
float x, y, zoom, t, alpha; float x, y, zoom, t, alpha;
Pos(float, float, float, float, float); Pos(float, float, float, float, float);
+7 -2
View File
@@ -8,7 +8,8 @@
class MTGAllCards; class MTGAllCards;
class PriceList{ class PriceList
{
private: private:
MTGAllCards * collection; MTGAllCards * collection;
string filename; string filename;
@@ -24,7 +25,11 @@ class PriceList{
int setPrice(int cardId, int price); int setPrice(int cardId, int price);
int getOtherPrice(int amt); int getOtherPrice(int amt);
static float difficultyScalar(float price, int cardid = 0); static float difficultyScalar(float price, int cardid = 0);
static void updateKey() {randomKey = rand();}; static void updateKey()
{
randomKey = rand();
}
;
}; };
#endif #endif
+12 -5
View File
@@ -9,13 +9,19 @@ using namespace std;
class TargetChooser; class TargetChooser;
class MTGAbility; class MTGAbility;
class ReplacementEffect { class ReplacementEffect
{
public: public:
virtual WEvent * replace (WEvent * e) {return e;}; virtual WEvent * replace(WEvent * e)
virtual ~ReplacementEffect(){}; {
return e;
}
;
virtual ~ReplacementEffect() {}
}; };
class REDamagePrevention: public ReplacementEffect { class REDamagePrevention: public ReplacementEffect
{
protected: protected:
MTGAbility * source; MTGAbility * source;
TargetChooser * tcSource; TargetChooser * tcSource;
@@ -29,7 +35,8 @@ public:
~REDamagePrevention(); ~REDamagePrevention();
}; };
class ReplacementEffects { class ReplacementEffects
{
protected: protected:
list<ReplacementEffect *> modifiers; list<ReplacementEffect *> modifiers;
public: public:
+10 -6
View File
@@ -13,7 +13,8 @@ class MTGCardInstance;
#define MAX_RULES_CARDS 4096; #define MAX_RULES_CARDS 4096;
class RulesPlayerZone{ class RulesPlayerZone
{
public: public:
vector<int> cards; vector<int> cards;
void add(int cardid); void add(int cardid);
@@ -21,7 +22,8 @@ class RulesPlayerZone{
void cleanup(); void cleanup();
}; };
class RulesPlayerData{ class RulesPlayerData
{
public: public:
vector<string> extraRules; vector<string> extraRules;
int life; int life;
@@ -37,7 +39,8 @@ class RulesPlayerData{
}; };
class RulesState{ class RulesState
{
public: public:
int phase; int phase;
int player; int player;
@@ -47,8 +50,8 @@ class RulesState{
void cleanup(); void cleanup();
}; };
class Rules
class Rules{ {
protected: protected:
Player * loadPlayerMomir(int isAI); Player * loadPlayerMomir(int isAI);
Player * loadPlayerRandom(int isAI, int mode); Player * loadPlayerRandom(int isAI, int mode);
@@ -56,7 +59,8 @@ protected:
MTGDeck * buildDeck(int playerId); MTGDeck * buildDeck(int playerId);
int strToGameMode(string s); int strToGameMode(string s);
public: public:
enum { enum
{
PARSE_UNDEFINED, PARSE_UNDEFINED,
PARSE_INIT, PARSE_INIT,
PARSE_PLAYER1, PARSE_PLAYER1,
+6 -3
View File
@@ -9,7 +9,8 @@
#include "WFont.h" #include "WFont.h"
#include "hge/hgeparticle.h" #include "hge/hgeparticle.h"
class SimpleMenu:public JGuiController{ class SimpleMenu: public JGuiController
{
private: private:
float mHeight, mWidth, mX, mY; float mHeight, mWidth, mX, mY;
int fontId; int fontId;
@@ -39,9 +40,11 @@ class SimpleMenu:public JGuiController{
void Close(); void Close();
float selectionTargetY; float selectionTargetY;
bool isClosed() { return mClosed; } bool isClosed()
{
return mClosed;
}
static void destroy(); static void destroy();
}; };
#endif #endif
+7 -2
View File
@@ -11,7 +11,6 @@ using std::string;
#define SCALE_SELECTED 1.2f #define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f #define SCALE_NORMAL 1.0f
class SimpleMenuItem: public JGuiObject class SimpleMenuItem: public JGuiObject
{ {
private: private:
@@ -41,7 +40,13 @@ class SimpleMenuItem: public JGuiObject
virtual bool Leaving(JButton key); virtual bool Leaving(JButton key);
virtual bool ButtonPressed(); virtual bool ButtonPressed();
virtual ostream& toString(ostream& out) const; 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 #endif
+9 -6
View File
@@ -19,27 +19,31 @@ enum SIMPLE_KEYS{
KPD_INPUT = 255, KPD_INPUT = 255,
}; };
struct SimpleKey{ struct SimpleKey
{
SimpleKey(string _ds, int _id); SimpleKey(string _ds, int _id);
string displayValue; string displayValue;
unsigned char id; unsigned char id;
unsigned char adjacency[4]; unsigned char adjacency[4];
}; };
class SimplePad{ class SimplePad
{
public: public:
friend class GameSettings; friend class GameSettings;
string buffer; string buffer;
string title; string title;
unsigned int cursorPos(); unsigned int cursorPos();
bool isActive() {return bActive;}; bool isActive()
{
return bActive;
}
;
void Render(); void Render();
void Update(float dt); void Update(float dt);
void pressKey(unsigned char id); void pressKey(unsigned char id);
SimplePad(); SimplePad();
~SimplePad(); ~SimplePad();
@@ -65,5 +69,4 @@ private:
string original; //For cancelling. string original; //For cancelling.
}; };
#endif #endif
+8 -3
View File
@@ -35,12 +35,17 @@ private:
public: public:
bool autoTranslate; bool autoTranslate;
SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title = "", DeckMetaData* deckInfo = NULL, MTGAllCards * collection = NULL); SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title = "", DeckMetaData* deckInfo = NULL, MTGAllCards * collection = NULL);
~SimplePopup(void); ~SimplePopup(void);
void drawBoundingBox(float x, float y, float width, float height); void drawBoundingBox(float x, float y, float width, float height);
bool isClosed() { return mClosed; } bool isClosed()
MTGAllCards* getCollection() { return mCollection; } {
return mClosed;
}
MTGAllCards* getCollection()
{
return mCollection;
}
void Render(); void Render();
void Update(DeckMetaData* deckMetaData); void Update(DeckMetaData* deckMetaData);
+43 -18
View File
@@ -11,20 +11,36 @@ class GameObserver;
class MTGDeck; class MTGDeck;
#define CAMPAIGNS_FOLDER "campaigns/" #define CAMPAIGNS_FOLDER "campaigns/"
class StoryDialogElement: public JGuiObject
class StoryDialogElement:public JGuiObject { {
public: public:
float mX; float mX;
float mY; float mY;
StoryDialogElement(float x, float y, int id = 0); StoryDialogElement(float x, float y, int id = 0);
void Entering(){}; void Entering()
bool Leaving(JButton key) {return false;}; {
bool ButtonPressed() {return false;}; }
bool hasFocus() {return false;}; ;
bool Leaving(JButton key)
{
return false;
}
;
bool ButtonPressed()
{
return false;
}
;
bool hasFocus()
{
return false;
}
;
virtual float getHeight() = 0; virtual float getHeight() = 0;
}; };
class StoryText:public StoryDialogElement { class StoryText: public StoryDialogElement
{
public: public:
string text; string text;
int align; int align;
@@ -36,7 +52,8 @@ StoryText(string text, float mX, float mY, string align = "center", int font = 0
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
float getHeight(); float getHeight();
}; };
class StoryImage:public StoryDialogElement { class StoryImage: public StoryDialogElement
{
public: public:
string img; string img;
StoryImage(string img, float mX, float mY); StoryImage(string img, float mX, float mY);
@@ -46,9 +63,11 @@ StoryImage(string img, float mX, float mY);
float getHeight(); float getHeight();
}; };
class StoryReward:public StoryText { class StoryReward: public StoryText
{
public: public:
enum { enum
{
STORY_REWARD_CREDITS, STORY_REWARD_CREDITS,
STORY_REWARD_SET, STORY_REWARD_SET,
STORY_REWARD_CARD, STORY_REWARD_CARD,
@@ -67,7 +86,8 @@ public:
static MTGDeck * collection; static MTGDeck * collection;
}; };
class StoryChoice:public StoryText { class StoryChoice: public StoryText
{
public: public:
string pageId; string pageId;
@@ -87,7 +107,8 @@ public:
}; };
class StoryFlow; class StoryFlow;
class StoryPage { class StoryPage
{
protected: protected:
string safeAttribute(TiXmlElement* element, string attribute); string safeAttribute(TiXmlElement* element, string attribute);
public: public:
@@ -96,11 +117,15 @@ public:
StoryPage(StoryFlow * mParent); StoryPage(StoryFlow * mParent);
virtual void Update(float dt)=0; virtual void Update(float dt)=0;
virtual void Render()=0; virtual void Render()=0;
virtual ~StoryPage(){}; virtual ~StoryPage()
{
}
;
int loadElement(TiXmlElement* element); int loadElement(TiXmlElement* element);
}; };
class StoryDialog:public StoryPage, public JGuiListener,public JGuiController { class StoryDialog: public StoryPage, public JGuiListener, public JGuiController
{
private: private:
vector<StoryDialogElement *> graphics; vector<StoryDialogElement *> graphics;
void RenderElement(StoryDialogElement * elmt); void RenderElement(StoryDialogElement * elmt);
@@ -115,9 +140,9 @@ public:
static float previousY; static float previousY;
}; };
class Rules; class Rules;
class StoryDuel:public StoryPage { class StoryDuel: public StoryPage
{
public: public:
string pageId; string pageId;
string onWin, onLose; string onWin, onLose;
@@ -131,7 +156,8 @@ public:
void init(); void init();
}; };
class StoryFlow{ class StoryFlow
{
private: private:
map<string, StoryPage *> pages; map<string, StoryPage *> pages;
bool parse(string filename); bool parse(string filename);
@@ -149,5 +175,4 @@ public:
void Render(); void Render();
}; };
#endif #endif
+8 -4
View File
@@ -1,4 +1,5 @@
class WStyle{ class WStyle
{
public: public:
friend class StyleManager; friend class StyleManager;
string stylized(string filename); string stylized(string filename);
@@ -6,13 +7,15 @@ protected:
map<string, string> mapping; map<string, string> mapping;
}; };
class WStyleRule{ class WStyleRule
{
public: public:
string filter; //The condition string filter; //The condition
string style; //The style to use. string style; //The style to use.
}; };
class MTGDeck; class MTGDeck;
class StyleManager{ class StyleManager
{
public: public:
friend class OptionThemeStyle; friend class OptionThemeStyle;
friend class OptionTheme; friend class OptionTheme;
@@ -21,7 +24,8 @@ public:
void determineActive(MTGDeck * p1, MTGDeck * p2); void determineActive(MTGDeck * p1, MTGDeck * p2);
WStyle * get(); WStyle * get();
protected: protected:
int topRule; int topSize; int topRule;
int topSize;
int playerSrc; int playerSrc;
void loadRules(); void loadRules();
+4 -6
View File
@@ -1,17 +1,17 @@
#ifndef _SUBTYPES_H_ #ifndef _SUBTYPES_H_
#define _SUBTYPES_H_ #define _SUBTYPES_H_
#include <string> #include <string>
#include <map> #include <map>
#include <vector> #include <vector>
using namespace std; using namespace std;
class Subtypes
class Subtypes{ {
public: public:
//A list of commonly used types //A list of commonly used types
enum { enum
{
TYPE_CREATURE = 1, TYPE_CREATURE = 1,
TYPE_ENCHANTMENT = 2, TYPE_ENCHANTMENT = 2,
TYPE_SORCERY = 3, TYPE_SORCERY = 3,
@@ -22,7 +22,6 @@ public:
LAST_TYPE = TYPE_LEGENDARY, LAST_TYPE = TYPE_LEGENDARY,
}; };
protected: protected:
map<string, int> values; map<string, int> values;
vector<string> valuesById; vector<string> valuesById;
@@ -34,5 +33,4 @@ public:
string find(unsigned int id); string find(unsigned int id);
}; };
#endif #endif
+68 -31
View File
@@ -20,14 +20,14 @@ class Damageable;
class Targetable; class Targetable;
class CardDescriptor; class CardDescriptor;
class TargetChooser: public TargetsList
{
class TargetChooser: public TargetsList {
protected: protected:
int forceTargetListReady; int forceTargetListReady;
public: public:
enum{ enum
{
UNSET = 0, UNSET = 0,
OPPONENT = -1, OPPONENT = -1,
CONTROLLER = 1, CONTROLLER = 1,
@@ -43,28 +43,53 @@ class TargetChooser: public TargetsList {
int maxtargets; //Set to -1 for "unlimited" int maxtargets; //Set to -1 for "unlimited"
bool validTargetsExist(); bool validTargetsExist();
virtual int setAllZones(){return 0;} virtual int setAllZones()
virtual bool targetsZone(MTGGameZone * z){return false;}; {
return 0;
}
virtual bool targetsZone(MTGGameZone * z)
{
return false;
}
;
int ForceTargetListReady(); int ForceTargetListReady();
int targetsReadyCheck(); int targetsReadyCheck();
virtual int addTarget(Targetable * target); virtual int addTarget(Targetable * target);
virtual bool canTarget(Targetable * _target); virtual bool canTarget(Targetable * _target);
virtual int full(){if (maxtargets != -1 && cursor>=maxtargets) {return 1;} else{return 0;}}; virtual int full()
virtual int ready(){return cursor;}; {
virtual ~TargetChooser(){}; if (maxtargets != -1 && cursor >= maxtargets)
{
return 1;
}
else
{
return 0;
}
}
;
virtual int ready()
{
return cursor;
}
;
virtual ~TargetChooser()
{
}
;
int targetListSet(); int targetListSet();
virtual TargetChooser* clone() const = 0; virtual TargetChooser* clone() const = 0;
}; };
class TargetChooserFactory
class TargetChooserFactory{ {
public: public:
TargetChooser * createTargetChooser(string s, MTGCardInstance * card, MTGAbility * ability = NULL); TargetChooser * createTargetChooser(string s, MTGCardInstance * card, MTGAbility * ability = NULL);
TargetChooser * createTargetChooser(MTGCardInstance * card); TargetChooser * createTargetChooser(MTGCardInstance * card);
}; };
class TargetZoneChooser: public TargetChooser
class TargetZoneChooser:public TargetChooser{ {
public: public:
int zones[15]; int zones[15];
int nbzones; int nbzones;
@@ -77,7 +102,8 @@ class TargetZoneChooser:public TargetChooser{
virtual TargetZoneChooser * clone() const; virtual TargetZoneChooser * clone() const;
}; };
class CardTargetChooser:public TargetZoneChooser { class CardTargetChooser: public TargetZoneChooser
{
protected: protected:
MTGCardInstance * validTarget; MTGCardInstance * validTarget;
public: public:
@@ -86,8 +112,8 @@ public:
virtual CardTargetChooser * clone() const; virtual CardTargetChooser * clone() const;
}; };
class CreatureTargetChooser: public TargetZoneChooser
class CreatureTargetChooser:public TargetZoneChooser{ {
public: public:
CreatureTargetChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false); CreatureTargetChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
CreatureTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false); CreatureTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
@@ -96,17 +122,25 @@ class CreatureTargetChooser:public TargetZoneChooser{
}; };
class DamageableTargetChooser: public CreatureTargetChooser
class DamageableTargetChooser:public CreatureTargetChooser{ {
public: public:
DamageableTargetChooser(int * _zones, int _nbzones,MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false):CreatureTargetChooser( _zones,_nbzones, card, _maxtargets,other){}; DamageableTargetChooser(int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false) :
DamageableTargetChooser(MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false):CreatureTargetChooser(card, _maxtargets,other){}; 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 bool canTarget(Targetable * target);
virtual DamageableTargetChooser * clone() const; virtual DamageableTargetChooser * clone() const;
}; };
class PlayerTargetChooser: public TargetChooser
class PlayerTargetChooser:public TargetChooser{ {
protected: protected:
Player * p; //In Case we can only target a specific player Player * p; //In Case we can only target a specific player
public: public:
@@ -115,7 +149,8 @@ protected:
virtual PlayerTargetChooser * clone() const; virtual PlayerTargetChooser * clone() const;
}; };
class TypeTargetChooser:public TargetZoneChooser{ class TypeTargetChooser: public TargetZoneChooser
{
public: public:
int nbtypes; int nbtypes;
int types[10]; int types[10];
@@ -127,7 +162,8 @@ class TypeTargetChooser:public TargetZoneChooser{
virtual TypeTargetChooser * clone() const; virtual TypeTargetChooser * clone() const;
}; };
class DescriptorTargetChooser:public TargetZoneChooser{ class DescriptorTargetChooser: public TargetZoneChooser
{
public: public:
CardDescriptor * cd; CardDescriptor * cd;
DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false); DescriptorTargetChooser(CardDescriptor * _cd, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false);
@@ -137,8 +173,8 @@ class DescriptorTargetChooser:public TargetZoneChooser{
virtual DescriptorTargetChooser * clone() const; virtual DescriptorTargetChooser * clone() const;
}; };
class SpellTargetChooser: public TargetChooser
class SpellTargetChooser:public TargetChooser{ {
public: public:
int color; 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);
@@ -146,7 +182,8 @@ class SpellTargetChooser:public TargetChooser{
virtual SpellTargetChooser * clone() const; virtual SpellTargetChooser * clone() const;
}; };
class SpellOrPermanentTargetChooser:public TargetZoneChooser{ class SpellOrPermanentTargetChooser: public TargetZoneChooser
{
public: public:
int color; 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);
@@ -154,9 +191,8 @@ class SpellOrPermanentTargetChooser:public TargetZoneChooser{
virtual SpellOrPermanentTargetChooser * clone() const; virtual SpellOrPermanentTargetChooser * clone() const;
}; };
class DamageTargetChooser: public TargetChooser
{
class DamageTargetChooser:public TargetChooser{
public: public:
int color; int color;
int state; int state;
@@ -166,7 +202,8 @@ class DamageTargetChooser:public TargetChooser{
}; };
//Should only be used for triggered abilities. //Should only be used for triggered abilities.
class TriggerTargetChooser:public TargetChooser{ class TriggerTargetChooser: public TargetChooser
{
public: public:
Targetable * target; Targetable * target;
int triggerTarget; int triggerTarget;
+2 -1
View File
@@ -5,7 +5,8 @@
#define TARGET_PLAYER 2 #define TARGET_PLAYER 2
#define TARGET_STACKACTION 3 #define TARGET_STACKACTION 3
class Targetable{ class Targetable
{
public: public:
virtual int typeAsTarget() = 0; virtual int typeAsTarget() = 0;
virtual const string getDisplayName() const = 0; virtual const string getDisplayName() const = 0;
+7 -2
View File
@@ -11,7 +11,8 @@ class Spell;
class Interruptible; class Interruptible;
class Damage; class Damage;
class TargetsList{ class TargetsList
{
public: public:
int cursor; int cursor;
TargetsList(); TargetsList();
@@ -28,7 +29,11 @@ class TargetsList{
Spell * getNextSpellTarget(Spell * previous = 0); Spell * getNextSpellTarget(Spell * previous = 0);
Damage * getNextDamageTarget(Damage * previous = 0); Damage * getNextDamageTarget(Damage * previous = 0);
Targetable * getNextTarget(Targetable * previous = 0, int type = -1); Targetable * getNextTarget(Targetable * previous = 0, int type = -1);
void initTargets(){cursor = 0;}; void initTargets()
{
cursor = 0;
}
;
}; };
#endif #endif
+25 -13
View File
@@ -20,7 +20,8 @@
#define COMMON_ATTRIBS_COUNT 7 #define COMMON_ATTRIBS_COUNT 7
class Task { class Task
{
protected: protected:
int reward; // TODO: Complex rewards. Be consistent with other planned modes with rewards. int reward; // TODO: Complex rewards. Be consistent with other planned modes with rewards.
int opponent; int opponent;
@@ -64,7 +65,8 @@ public:
void passOneDay(); void passOneDay();
}; };
class TaskList { class TaskList
{
protected: protected:
string fileName; string fileName;
float vPos; float vPos;
@@ -74,11 +76,11 @@ protected:
JTexture * mBgTex; JTexture * mBgTex;
float sH, sW; float sH, sW;
public: public:
vector<Task*> tasks; vector<Task*> tasks;
enum{ enum
{
TASKS_IN, TASKS_IN,
TASKS_ACTIVE, TASKS_ACTIVE,
TASKS_OUT, TASKS_OUT,
@@ -88,7 +90,11 @@ public:
TaskList(string _fileName = ""); TaskList(string _fileName = "");
int load(string _fileName = ""); int load(string _fileName = "");
int save(string _fileName = ""); int save(string _fileName = "");
int getState() {return mState;}; int getState()
{
return mState;
}
;
void addTask(string params, bool rand = false); void addTask(string params, bool rand = false);
void addTask(Task *task); void addTask(Task *task);
void addRandomTask(int diff = 100); void addRandomTask(int diff = 100);
@@ -107,7 +113,8 @@ public:
~TaskList(); ~TaskList();
}; };
class TaskWinAgainst : public Task { class TaskWinAgainst: public Task
{
protected: protected:
virtual int computeReward(); virtual int computeReward();
public: public:
@@ -117,7 +124,8 @@ public:
virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app); virtual bool isDone(Player * _p1, Player * _p2, GameApp * _app);
}; };
class TaskSlaughter : public TaskWinAgainst { class TaskSlaughter: public TaskWinAgainst
{
protected: protected:
int targetLife; int targetLife;
virtual int computeReward(); virtual int computeReward();
@@ -131,7 +139,8 @@ public:
virtual void randomize(); virtual void randomize();
}; };
class TaskDelay : public TaskWinAgainst { class TaskDelay: public TaskWinAgainst
{
protected: protected:
int turn; int turn;
bool afterTurn; bool afterTurn;
@@ -146,7 +155,8 @@ public:
virtual void randomize(); virtual void randomize();
}; };
class TaskImmortal : public Task { class TaskImmortal: public Task
{
protected: protected:
int targetLife; int targetLife;
int level; int level;
@@ -162,7 +172,8 @@ public:
virtual void randomize(); virtual void randomize();
}; };
class TaskMassiveBurial : public Task { class TaskMassiveBurial: public Task
{
protected: protected:
int color; int color;
int bodyCount; int bodyCount;
@@ -178,7 +189,8 @@ public:
virtual void randomize(); virtual void randomize();
}; };
class TaskWisdom : public Task { class TaskWisdom: public Task
{
protected: protected:
int color; int color;
int cardCount; int cardCount;
@@ -194,7 +206,8 @@ public:
virtual void randomize(); virtual void randomize();
}; };
class TaskPacifism : public Task { class TaskPacifism: public Task
{
protected: protected:
virtual int computeReward(); virtual int computeReward();
int lifeSlashCardMin; int lifeSlashCardMin;
@@ -209,7 +222,6 @@ public:
virtual void randomize(); virtual void randomize();
}; };
/* ------------ Task template ------------ /* ------------ Task template ------------
class TaskXX : public Task { class TaskXX : public Task {
+14 -12
View File
@@ -8,7 +8,8 @@
#include "AIPlayer.h" #include "AIPlayer.h"
class TestSuiteActions{ class TestSuiteActions
{
public: public:
int nbitems; int nbitems;
string actions[MAX_TESTSUITE_ACTIONS]; string actions[MAX_TESTSUITE_ACTIONS];
@@ -17,7 +18,8 @@ class TestSuiteActions{
void cleanup(); void cleanup();
}; };
class TestSuitePlayerZone{ class TestSuitePlayerZone
{
public: public:
int cards[MAX_TESTUITE_CARDS]; int cards[MAX_TESTUITE_CARDS];
int nbitems; int nbitems;
@@ -26,7 +28,8 @@ class TestSuitePlayerZone{
void cleanup(); void cleanup();
}; };
class TestSuitePlayerData{ class TestSuitePlayerData
{
public: public:
int life; int life;
ManaCost * manapool; ManaCost * manapool;
@@ -37,10 +40,9 @@ class TestSuitePlayerData{
}; };
class TestSuite; class TestSuite;
class TestSuiteState{ class TestSuiteState
{
public: public:
int phase; int phase;
void parsePlayerState(int playerId, string s); void parsePlayerState(int playerId, string s);
@@ -49,13 +51,14 @@ class TestSuiteState{
void cleanup(); void cleanup();
}; };
class TestSuitePregame
class TestSuitePregame{ {
public: public:
virtual void performTest() = 0; virtual void performTest() = 0;
}; };
class TestSuite{ class TestSuite
{
public: public:
MTGAllCards* collection; MTGAllCards* collection;
int summoningSickness; int summoningSickness;
@@ -86,7 +89,8 @@ class TestSuite{
}; };
class TestSuiteAI:public AIPlayerBaka{ class TestSuiteAI:public AIPlayerBaka
{
public: public:
TestSuite * suite; TestSuite * suite;
float timer; float timer;
@@ -97,7 +101,5 @@ class TestSuiteAI:public AIPlayerBaka{
virtual int displayStack(); virtual int displayStack();
}; };
#endif #endif
#endif #endif
+3 -3
View File
@@ -7,7 +7,8 @@ class JLBFont;
#include <vector> #include <vector>
using namespace std; using namespace std;
class TextScroller: public JGuiObject{ class TextScroller: public JGuiObject
{
protected: protected:
string mText; string mText;
string tempText; string tempText;
@@ -34,8 +35,7 @@ public:
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
}; };
class VerticalTextScroller: class VerticalTextScroller: public TextScroller
public TextScroller
{ {
private: private:
size_t mNbItemsShown; size_t mNbItemsShown;
+24 -13
View File
@@ -10,7 +10,8 @@
#include "MTGCardInstance.h" #include "MTGCardInstance.h"
#include "CardDescriptor.h" #include "CardDescriptor.h"
class ThisDescriptor{ class ThisDescriptor
{
public: public:
int comparisonMode; int comparisonMode;
int comparisonCriterion; int comparisonCriterion;
@@ -19,12 +20,14 @@ class ThisDescriptor{
virtual ~ThisDescriptor(); virtual ~ThisDescriptor();
}; };
class ThisDescriptorFactory{ class ThisDescriptorFactory
{
public: public:
ThisDescriptor * createThisDescriptor(string s); ThisDescriptor * createThisDescriptor(string s);
}; };
class ThisCounter:public ThisDescriptor{ class ThisCounter: public ThisDescriptor
{
public: public:
Counter * counter; Counter * counter;
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
@@ -34,64 +37,72 @@ class ThisCounter:public ThisDescriptor{
~ThisCounter(); ~ThisCounter();
}; };
class ThisCounterAny:public ThisDescriptor{ class ThisCounterAny: public ThisDescriptor
{
public: public:
virtual int match(MTGCardInstance *card); virtual int match(MTGCardInstance *card);
ThisCounterAny(int nb); ThisCounterAny(int nb);
}; };
class ThisControllerlife:public ThisDescriptor{ class ThisControllerlife: public ThisDescriptor
{
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisControllerlife(int life); ThisControllerlife(int life);
}; };
class ThisOpponentlife:public ThisDescriptor{ class ThisOpponentlife: public ThisDescriptor
{
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisOpponentlife(int olife); ThisOpponentlife(int olife);
}; };
class ThisEquip:public ThisDescriptor{ class ThisEquip: public ThisDescriptor
{
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisEquip(int equipment); ThisEquip(int equipment);
}; };
class ThisAttacked: public ThisDescriptor
class ThisAttacked:public ThisDescriptor{ {
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisAttacked(int attack); ThisAttacked(int attack);
}; };
class ThisNotBlocked:public ThisDescriptor{ class ThisNotBlocked: public ThisDescriptor
{
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisNotBlocked(int unblocked); ThisNotBlocked(int unblocked);
}; };
class ThisPower:public ThisDescriptor{ class ThisPower: public ThisDescriptor
{
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisPower(int power); ThisPower(int power);
}; };
class ThisToughness:public ThisDescriptor{ class ThisToughness: public ThisDescriptor
{
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisToughness(int toughness); ThisToughness(int toughness);
}; };
class ThisX:public ThisDescriptor{ class ThisX: public ThisDescriptor
{
public: public:
virtual int match(MTGCardInstance * card); virtual int match(MTGCardInstance * card);
ThisX(int x); ThisX(int x);
+2 -2
View File
@@ -1,7 +1,6 @@
#ifndef THREADING_H #ifndef THREADING_H
#define THREADING_H #define THREADING_H
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
#include <boost/date_time.hpp> #include <boost/date_time.hpp>
@@ -18,7 +17,8 @@ namespace boost
public: public:
struct scoped_lock struct scoped_lock
{ {
scoped_lock(mutex& inMutex) : mID(inMutex.mID) scoped_lock(mutex& inMutex) :
mID(inMutex.mID)
{ {
sceKernelWaitSema(mID, 1, 0); sceKernelWaitSema(mID, 1, 0);
} }
+2 -1
View File
@@ -3,7 +3,8 @@
#include "MTGCardInstance.h" #include "MTGCardInstance.h"
class Token: public MTGCardInstance{ class Token: public MTGCardInstance
{
MTGCardInstance * tokenSource; MTGCardInstance * tokenSource;
public: public:
Token(string _name, MTGCardInstance * source, int _power = 0, int _toughness = 0); Token(string _name, MTGCardInstance * source, int _power = 0, int _toughness = 0);
+2 -2
View File
@@ -4,14 +4,14 @@
#include <string> #include <string>
#include <map> #include <map>
#if defined _DEBUG #if defined _DEBUG
#define DEBUG_TRANSLATE #define DEBUG_TRANSLATE
#endif #endif
using namespace std; using namespace std;
class Translator{ class Translator
{
protected: protected:
static Translator * mInstance; static Translator * mInstance;
bool initDone; bool initDone;
+29 -11
View File
@@ -8,7 +8,8 @@
#define INVALID_MTEX -1 #define INVALID_MTEX -1
#endif #endif
class WResource{ class WResource
{
public: public:
friend class WResourceManager; friend class WResourceManager;
friend struct WCacheSort; friend struct WCacheSort;
@@ -33,7 +34,8 @@ protected:
unsigned char locks; //Remember to unlock when we're done using locked stuff, or else this'll be useless. 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: public:
friend class WResourceManager; friend class WResourceManager;
template<class cacheItem, class cacheActual> friend class WCache; template<class cacheItem, class cacheActual> friend class WCache;
@@ -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(). 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: public:
WTrackedQuad(string _resname); WTrackedQuad(string _resname);
~WTrackedQuad(); ~WTrackedQuad();
@@ -56,7 +58,8 @@ public:
JQuad * quad; JQuad * quad;
}; };
class WCachedTexture: public WCachedResource{ class WCachedTexture: public WCachedResource
{
public: public:
friend class WResourceManager; friend class WResourceManager;
template<class cacheItem, class cacheActual> friend class WCache; template<class cacheItem, class cacheActual> friend class WCache;
@@ -68,11 +71,16 @@ public:
bool isGood(); bool isGood();
bool isLocked(); //Is the resource locked? bool isLocked(); //Is the resource locked?
bool Attempt(string filename, int submode, int & error); 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. JTexture * Actual(); //Return this texture as is. Does not make a new one.
JQuad * GetQuad(string resname); 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 * 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 * 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.
@@ -83,7 +91,8 @@ protected:
vector<WTrackedQuad*> trackedQuads; vector<WTrackedQuad*> trackedQuads;
}; };
class WCachedParticles: public WCachedResource{ class WCachedParticles: public WCachedResource
{
public: public:
friend class WResourceManager; friend class WResourceManager;
template<class cacheItem, class cacheActual> friend class WCache; template<class cacheItem, class cacheActual> friend class WCache;
@@ -94,20 +103,29 @@ public:
bool isGood(); bool isGood();
bool Attempt(string filename, int submode, int & error); bool Attempt(string filename, int submode, int & error);
bool compare(hgeParticleSystemInfo * p) {return (p == particles);}; bool compare(hgeParticleSystemInfo * p)
{
return (p == particles);
}
;
hgeParticleSystemInfo * Actual(); hgeParticleSystemInfo * Actual();
protected: protected:
hgeParticleSystemInfo * particles; hgeParticleSystemInfo * particles;
}; };
class WCachedSample: public WCachedResource{ class WCachedSample: public WCachedResource
{
public: public:
friend class WResourceManager; friend class WResourceManager;
template<class cacheItem, class cacheActual> friend class WCache; template<class cacheItem, class cacheActual> friend class WCache;
WCachedSample(); WCachedSample();
~WCachedSample(); ~WCachedSample();
bool compare(JSample * s) {return (s == sample);}; bool compare(JSample * s)
{
return (s == sample);
}
;
unsigned long size(); unsigned long size();
bool isGood(); bool isGood();
void Refresh(); void Refresh();
+250 -58
View File
@@ -10,14 +10,32 @@ class MTGDeck;
class MTGAllCards; class MTGAllCards;
class JQuad; class JQuad;
class WSyncable{ class WSyncable
{
public: public:
WSyncable(int i=0) {hooked = NULL;currentPos = 0;}; WSyncable(int i = 0)
virtual ~WSyncable() {}; {
hooked = NULL;
currentPos = 0;
}
;
virtual ~WSyncable()
{
}
;
//Local //Local
virtual bool Hook(WSyncable* s); virtual bool Hook(WSyncable* s);
virtual int getOffset() {return currentPos;}; virtual int getOffset()
virtual bool setOffset(int i) {currentPos = i; return true;}; {
return currentPos;
}
;
virtual bool setOffset(int i)
{
currentPos = i;
return true;
}
;
//Recursive //Recursive
virtual int getPos(); virtual int getPos();
virtual bool next(); virtual bool next();
@@ -27,25 +45,74 @@ protected:
int currentPos; int currentPos;
}; };
class WDataSource: public WSyncable{ class WDataSource: public WSyncable
{
public: public:
WDataSource() {}; 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 JQuad * getImage(int offset = 0)
virtual WDistort * getDistort(int offset=0) {return NULL;}; {
virtual bool thisCard(int mtgid) {return false;}; return NULL;
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 JQuad * getThumb(int offset = 0)
virtual float getElapsed() {return mLastInput;}; {
virtual void setElapsed(float f) {mLastInput = f;}; 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: protected:
float mLastInput; float mLastInput;
}; };
class WSrcImage: public WDataSource{ class WSrcImage: public WDataSource
{
public: public:
virtual JQuad * getImage(int offset = 0); virtual JQuad * getImage(int offset = 0);
WSrcImage(string s); WSrcImage(string s);
@@ -54,7 +121,8 @@ protected:
string filename; string filename;
}; };
class WSrcCards: public WDataSource{ class WSrcCards: public WDataSource
{
protected: protected:
vector<MTGCard*> cards; vector<MTGCard*> cards;
vector<size_t> validated; vector<size_t> validated;
@@ -99,9 +167,14 @@ public:
//We put it into something else //We put it into something else
virtual int addRandomCards(MTGDeck * i, int howmany = 1); virtual int addRandomCards(MTGDeck * i, int howmany = 1);
virtual int addToDeck(MTGDeck * i, int num = -1); //Returns num that didn't add virtual int addToDeck(MTGDeck * i, int num = -1); //Returns num that didn't add
virtual WCardFilter * getFiltersRoot(){return filtersRoot;}; virtual WCardFilter * getFiltersRoot()
{
return filtersRoot;
}
;
enum { enum
{
MAX_CYCLES = 4, //How many cycles to search, for addToDeck MAX_CYCLES = 4, //How many cycles to search, for addToDeck
SORT_COLLECTOR, SORT_COLLECTOR,
SORT_ALPHA, SORT_ALPHA,
@@ -110,53 +183,169 @@ public:
}; };
class WSrcDeckViewer: public WSrcCards{ class WSrcDeckViewer: public WSrcCards
{
public: public:
WSrcDeckViewer(WSrcCards * _active, WSrcCards * _inactive); WSrcDeckViewer(WSrcCards * _active, WSrcCards * _inactive);
~WSrcDeckViewer(); ~WSrcDeckViewer();
void swapSrc(); void swapSrc();
//Wrapped functions //Wrapped functions
JQuad * getImage(int offset=0) {return active->getImage(offset);}; JQuad * getImage(int offset = 0)
JQuad * getThumb(int offset=0) {return active->getThumb(offset);}; {
MTGCard * getCard(int offset=0, bool ignore=false) {return active->getCard(offset,ignore);}; return active->getImage(offset);
int Size(bool all=false) {return active->Size();}; }
WCardFilter * getfiltersRoot() {return active->getFiltersRoot();}; ;
void Shuffle() {active->Shuffle();}; JQuad * getThumb(int offset = 0)
bool thisCard(int mtgid) {return active->thisCard(mtgid);}; {
bool next() {return active->next();}; return active->getThumb(offset);
bool prev() {return active->prev();}; }
void Sort(int method) {active->Sort(method);}; ;
bool setOffset(int pos) {return active->setOffset(pos);}; MTGCard * getCard(int offset = 0, bool ignore = false)
bool isEmptySet(WCardFilter * f) {return active->isEmptySet(f);}; {
void addFilter(WCardFilter * f) {active->addFilter(f);}; return active->getCard(offset, ignore);
void clearFilters() {active->clearFilters();}; }
WCardFilter* unhookFilters() {return active->unhookFilters();}; ;
bool matchesFilters(MTGCard * c) {return active->matchesFilters(c);}; int Size(bool all = false)
void validate() {active->validate();}; {
void bakeFilters() {active->bakeFilters();}; //Discards all invalidated cards. return active->Size();
float filterFee() {return active->filterFee();}; }
void updateCounts() {active->updateCounts();}; ;
void clearCounts() {active->clearCounts();}; WCardFilter * getfiltersRoot()
void addCount(MTGCard * c, int qty=1) { active->addCount(c,qty); }; {
int loadMatches(MTGAllCards* ac) {return active->loadMatches(ac);}; return active->getFiltersRoot();
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);}; void Shuffle()
int addToDeck(MTGDeck * i, int num=-1) {return active->addToDeck(i,num);}; {
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: protected:
WSrcCards * active; WSrcCards * active;
WSrcCards * inactive; WSrcCards * inactive;
}; };
class WSrcUnlockedCards: public WSrcCards{ //Only unlocked cards. class WSrcUnlockedCards: public WSrcCards
{ //Only unlocked cards.
public: public:
WSrcUnlockedCards(float mDelay = 0.2); WSrcUnlockedCards(float mDelay = 0.2);
}; };
class WSrcDeck: public WSrcCards{ class WSrcDeck: public WSrcCards
{
public: public:
WSrcDeck(float delay=0.2) : WSrcCards(delay) {clearCounts();}; WSrcDeck(float delay = 0.2) :
WSrcCards(delay)
{
clearCounts();
}
;
virtual int loadMatches(MTGDeck * deck); virtual int loadMatches(MTGDeck * deck);
virtual int Add(MTGCard * c, int quantity = 1); virtual int Add(MTGCard * c, int quantity = 1);
virtual int Remove(MTGCard * c, int quantity = 1, bool erase = false); virtual int Remove(MTGCard * c, int quantity = 1, bool erase = false);
@@ -164,7 +353,8 @@ public:
int count(MTGCard * c); int count(MTGCard * c);
int countByName(MTGCard * card, bool editions = false); int countByName(MTGCard * card, bool editions = false);
int totalPrice(); int totalPrice();
enum { enum
{
//0 to MTG_NB_COLORS are colors. See MTG_COLOR_ in Constants::. //0 to MTG_NB_COLORS are colors. See MTG_COLOR_ in Constants::.
UNFILTERED_COPIES = Constants::MTG_NB_COLORS, UNFILTERED_COPIES = Constants::MTG_NB_COLORS,
UNFILTERED_UNIQUE, UNFILTERED_UNIQUE,
@@ -183,18 +373,20 @@ protected:
int counts[MAX_COUNTS]; int counts[MAX_COUNTS];
}; };
struct WCSortCollector{ struct WCSortCollector
{
bool operator()(const MTGCard*l, const MTGCard*r); bool operator()(const MTGCard*l, const MTGCard*r);
}; };
struct WCSortAlpha{ struct WCSortAlpha
{
bool operator()(const MTGCard*l, const MTGCard*r); bool operator()(const MTGCard*l, const MTGCard*r);
}; };
struct WCSortRarity{ struct WCSortRarity
{
int rareToInt(char r); int rareToInt(char r);
bool operator()(const MTGCard*l, const MTGCard*r); bool operator()(const MTGCard*l, const MTGCard*r);
}; };
#endif #endif
+58 -30
View File
@@ -29,11 +29,20 @@ public:
WEvent(int type = NOT_SPECIFIED); WEvent(int type = NOT_SPECIFIED);
virtual ~WEvent() {}; virtual ~WEvent() {};
virtual std::ostream& toString(std::ostream& out) const; virtual std::ostream& toString(std::ostream& out) const;
virtual int getValue() {return 0;}; virtual int getValue()
virtual Targetable * getTarget(int target) {return 0;}; {
return 0;
}
;
virtual Targetable * getTarget(int target)
{
return 0;
}
;
}; };
struct WEventZoneChange : public WEvent { struct WEventZoneChange: public WEvent
{
MTGCardInstance * card; MTGCardInstance * card;
MTGGameZone * from; MTGGameZone * from;
MTGGameZone * to; MTGGameZone * to;
@@ -43,8 +52,8 @@ struct WEventZoneChange : public WEvent {
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
struct WEventDamage: public WEvent
struct WEventDamage : public WEvent { {
Damage * damage; Damage * damage;
WEventDamage(Damage * damage); WEventDamage(Damage * damage);
virtual std::ostream& toString(std::ostream& out) const; virtual std::ostream& toString(std::ostream& out) const;
@@ -52,25 +61,28 @@ struct WEventDamage : public WEvent {
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
struct WEventDamageStackResolved : public WEvent { struct WEventDamageStackResolved: public WEvent
{
WEventDamageStackResolved(); WEventDamageStackResolved();
}; };
struct WEventPhaseChange : public WEvent { struct WEventPhaseChange: public WEvent
{
Phase * from; Phase * from;
Phase * to; Phase * to;
WEventPhaseChange(Phase * from, Phase * to); WEventPhaseChange(Phase * from, Phase * to);
}; };
//Abstract class of event when a card's status changes //Abstract class of event when a card's status changes
struct WEventCardUpdate : public WEvent { struct WEventCardUpdate: public WEvent
{
MTGCardInstance * card; MTGCardInstance * card;
WEventCardUpdate(MTGCardInstance * card); WEventCardUpdate(MTGCardInstance * card);
}; };
//Event when a card gains/looses types //Event when a card gains/looses types
struct WEventCardChangeType : public WEventCardUpdate { struct WEventCardChangeType: public WEventCardUpdate
{
int type; int type;
bool before; bool before;
bool after; bool after;
@@ -78,68 +90,77 @@ struct WEventCardChangeType : public WEventCardUpdate {
}; };
//Event when a card is tapped/untapped //Event when a card is tapped/untapped
struct WEventCardTap : public WEventCardUpdate { struct WEventCardTap: public WEventCardUpdate
{
bool before; bool before;
bool after; bool after;
WEventCardTap(MTGCardInstance * card, bool before, bool after); WEventCardTap(MTGCardInstance * card, bool before, bool after);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
struct WEventCardTappedForMana : public WEventCardUpdate { struct WEventCardTappedForMana: public WEventCardUpdate
{
bool before; bool before;
bool after; bool after;
WEventCardTappedForMana(MTGCardInstance * card, bool before, bool after); WEventCardTappedForMana(MTGCardInstance * card, bool before, bool after);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//Event when a card's "attacker" status changes //Event when a card's "attacker" status changes
//before:Player/Planeswalker that card was attacking previously //before:Player/Planeswalker that card was attacking previously
//after: Player/Planeswalker that card is attacking now //after: Player/Planeswalker that card is attacking now
struct WEventCreatureAttacker : public WEventCardUpdate { struct WEventCreatureAttacker: public WEventCardUpdate
{
Targetable * before; Targetable * before;
Targetable * after; Targetable * after;
WEventCreatureAttacker(MTGCardInstance * card, Targetable * from, Targetable * to); WEventCreatureAttacker(MTGCardInstance * card, Targetable * from, Targetable * to);
}; };
//event when card attacks. //event when card attacks.
struct WEventCardAttacked : public WEventCardUpdate { struct WEventCardAttacked: public WEventCardUpdate
{
WEventCardAttacked(MTGCardInstance * card); WEventCardAttacked(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card attacks alone. //event when card attacks alone.
struct WEventCardAttackedAlone : public WEventCardUpdate { struct WEventCardAttackedAlone: public WEventCardUpdate
{
WEventCardAttackedAlone(MTGCardInstance * card); WEventCardAttackedAlone(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card attacks but is not blocked. //event when card attacks but is not blocked.
struct WEventCardAttackedNotBlocked : public WEventCardUpdate { struct WEventCardAttackedNotBlocked: public WEventCardUpdate
{
WEventCardAttackedNotBlocked(MTGCardInstance * card); WEventCardAttackedNotBlocked(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card attacks but is blocked. //event when card attacks but is blocked.
struct WEventCardAttackedBlocked : public WEventCardUpdate { struct WEventCardAttackedBlocked: public WEventCardUpdate
{
WEventCardAttackedBlocked(MTGCardInstance * card); WEventCardAttackedBlocked(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card blocked. //event when card blocked.
struct WEventCardBlocked : public WEventCardUpdate { struct WEventCardBlocked: public WEventCardUpdate
{
WEventCardBlocked(MTGCardInstance * card); WEventCardBlocked(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card is sacrificed. //event when card is sacrificed.
struct WEventCardSacrifice : public WEventCardUpdate { struct WEventCardSacrifice: public WEventCardUpdate
{
WEventCardSacrifice(MTGCardInstance * card); WEventCardSacrifice(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card is discarded. //event when card is discarded.
struct WEventCardDiscard : public WEventCardUpdate { struct WEventCardDiscard: public WEventCardUpdate
{
WEventCardDiscard(MTGCardInstance * card); WEventCardDiscard(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
@@ -147,7 +168,8 @@ struct WEventCardDiscard : public WEventCardUpdate {
//Event when a card's "defenser" status changes //Event when a card's "defenser" status changes
//before : attacker that card was blocking previously //before : attacker that card was blocking previously
//after: attacker that card is blocking now //after: attacker that card is blocking now
struct WEventCreatureBlocker : public WEventCardUpdate { struct WEventCreatureBlocker: public WEventCardUpdate
{
MTGCardInstance * before; MTGCardInstance * before;
MTGCardInstance * after; MTGCardInstance * after;
WEventCreatureBlocker(MTGCardInstance * card, MTGCardInstance * from, MTGCardInstance * to); WEventCreatureBlocker(MTGCardInstance * card, MTGCardInstance * from, MTGCardInstance * to);
@@ -155,15 +177,18 @@ struct WEventCreatureBlocker : public WEventCardUpdate {
//Event sent when attackers have been chosen and they //Event sent when attackers have been chosen and they
//cannot be changed any more. //cannot be changed any more.
struct WEventAttackersChosen : public WEvent { struct WEventAttackersChosen: public WEvent
{
}; };
//Event sent when blockers have been chosen and they //Event sent when blockers have been chosen and they
//cannot be changed any more. //cannot be changed any more.
struct WEventBlockersChosen : public WEvent { struct WEventBlockersChosen: public WEvent
{
}; };
struct WEventcardDraw : public WEvent { struct WEventcardDraw: public WEvent
{
WEventcardDraw(Player * player, int nb_cards); WEventcardDraw(Player * player, int nb_cards);
Player * player; Player * player;
int nb_cards; int nb_cards;
@@ -173,7 +198,8 @@ struct WEventcardDraw : public WEvent {
//Event when a blocker is reordered //Event when a blocker is reordered
//exchangeWith: exchange card's position with exchangeWith's position //exchangeWith: exchange card's position with exchangeWith's position
//attacker:both card and exchangeWith *should* be in attacker's "blockers" list. //attacker:both card and exchangeWith *should* be in attacker's "blockers" list.
struct WEventCreatureBlockerRank : public WEventCardUpdate { struct WEventCreatureBlockerRank: public WEventCardUpdate
{
MTGCardInstance * exchangeWith; MTGCardInstance * exchangeWith;
MTGCardInstance * attacker; MTGCardInstance * attacker;
WEventCreatureBlockerRank(MTGCardInstance * card, MTGCardInstance * exchangeWith, MTGCardInstance * attacker); WEventCreatureBlockerRank(MTGCardInstance * card, MTGCardInstance * exchangeWith, MTGCardInstance * attacker);
@@ -186,10 +212,10 @@ struct WEventCombatStepChange : public WEvent
WEventCombatStepChange(CombatStep); WEventCombatStepChange(CombatStep);
}; };
//Event when a mana is engaged //Event when a mana is engaged
//color : color //color : color
struct WEventEngageMana : public WEvent { struct WEventEngageMana: public WEvent
{
int color; int color;
MTGCardInstance* card; MTGCardInstance* card;
ManaPool * destination; ManaPool * destination;
@@ -198,7 +224,8 @@ struct WEventEngageMana : public WEvent {
//Event when a mana is consumed //Event when a mana is consumed
//color : color //color : color
struct WEventConsumeMana : public WEvent { struct WEventConsumeMana: public WEvent
{
int color; int color;
ManaPool * source; ManaPool * source;
WEventConsumeMana(int color, ManaPool * source); WEventConsumeMana(int color, ManaPool * source);
@@ -206,7 +233,8 @@ struct WEventConsumeMana : public WEvent {
//Event when a manapool is emptied //Event when a manapool is emptied
//color : color //color : color
struct WEventEmptyManaPool : public WEvent { struct WEventEmptyManaPool: public WEvent
{
ManaPool * source; ManaPool * source;
WEventEmptyManaPool(ManaPool * source); WEventEmptyManaPool(ManaPool * source);
}; };
+206 -54
View File
@@ -3,7 +3,8 @@
class WCardFilter; class WCardFilter;
class WCFilterFactory{ class WCFilterFactory
{
public: public:
WCFilterFactory(){}; WCFilterFactory(){};
static WCFilterFactory * GetInstance(); static WCFilterFactory * GetInstance();
@@ -16,119 +17,236 @@ private:
static WCFilterFactory * me; static WCFilterFactory * me;
}; };
class WCardFilter{ class WCardFilter
{
public: public:
WCardFilter() {}; WCardFilter() {};
virtual ~WCardFilter() {}; virtual ~WCardFilter() {};
virtual bool isMatch(MTGCard * c) {return true;}; virtual bool isMatch(MTGCard * c)
{
return true;
}
;
virtual string getCode() = 0; 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: public:
WCFBranch(WCardFilter * a, WCardFilter * b) {lhs=a;rhs=b;}; WCFBranch(WCardFilter * a, WCardFilter * b)
~WCFBranch() {SAFE_DELETE(lhs); SAFE_DELETE(rhs);}; {
lhs = a;
rhs = b;
}
;
~WCFBranch()
{
SAFE_DELETE(lhs);
SAFE_DELETE(rhs);
}
;
virtual bool isMatch(MTGCard * c) = 0; virtual bool isMatch(MTGCard * c) = 0;
virtual string getCode() = 0; virtual string getCode() = 0;
virtual WCardFilter * Right(){return rhs;}; virtual WCardFilter * Right()
virtual WCardFilter * Left(){return lhs;}; {
return rhs;
}
;
virtual WCardFilter * Left()
{
return lhs;
}
;
protected: protected:
WCardFilter *lhs, *rhs; WCardFilter *lhs, *rhs;
}; };
class WCFilterOR: public WCFBranch{ class WCFilterOR: public WCFBranch
{
public: public:
WCFilterOR(WCardFilter * a, WCardFilter * b): WCFBranch(a,b) {}; WCFilterOR(WCardFilter * a, WCardFilter * b) :
WCFBranch(a, b)
{
}
;
bool isMatch(MTGCard *c); bool isMatch(MTGCard *c);
string getCode(); string getCode();
float filterFee(); float filterFee();
}; };
class WCFilterAND: public WCFBranch{ class WCFilterAND: public WCFBranch
{
public: public:
WCFilterAND(WCardFilter * a, WCardFilter * b): WCFBranch(a,b) {}; WCFilterAND(WCardFilter * a, WCardFilter * b) :
bool isMatch(MTGCard *c) {return (lhs->isMatch(c) && rhs->isMatch(c));}; WCFBranch(a, b)
{
}
;
bool isMatch(MTGCard *c)
{
return (lhs->isMatch(c) && rhs->isMatch(c));
}
;
string getCode(); string getCode();
float filterFee(); float filterFee();
}; };
class WCFilterGROUP: public WCardFilter{ class WCFilterGROUP: public WCardFilter
{
public: public:
WCFilterGROUP(WCardFilter * _k) {kid = _k;}; WCFilterGROUP(WCardFilter * _k)
~WCFilterGROUP() {SAFE_DELETE(kid);}; {
bool isMatch(MTGCard *c) {return kid->isMatch(c);}; kid = _k;
}
;
~WCFilterGROUP()
{
SAFE_DELETE(kid);
}
;
bool isMatch(MTGCard *c)
{
return kid->isMatch(c);
}
;
string getCode(); string getCode();
float filterFee() {return kid->filterFee();}; float filterFee()
{
return kid->filterFee();
}
;
protected: protected:
WCardFilter * kid; WCardFilter * kid;
}; };
class WCFilterNOT: public WCardFilter{ class WCFilterNOT: public WCardFilter
{
public: public:
WCFilterNOT(WCardFilter * _k) {kid = _k;}; WCFilterNOT(WCardFilter * _k)
~WCFilterNOT() {SAFE_DELETE(kid);}; {
bool isMatch(MTGCard *c) {return !kid->isMatch(c);}; kid = _k;
}
;
~WCFilterNOT()
{
SAFE_DELETE(kid);
}
;
bool isMatch(MTGCard *c)
{
return !kid->isMatch(c);
}
;
string getCode(); string getCode();
protected: protected:
WCardFilter * kid; WCardFilter * kid;
}; };
class WCFilterNULL: public WCardFilter{ class WCFilterNULL: public WCardFilter
{
public: public:
WCFilterNULL() {}; WCFilterNULL()
string getCode() {return "NULL";}; {
bool isMatch(MTGCard *c) {return true;}; }
;
string getCode()
{
return "NULL";
}
;
bool isMatch(MTGCard *c)
{
return true;
}
;
}; };
//Filter terminals: //Filter terminals:
class WCFilterSet: public WCardFilter{ class WCFilterSet: public WCardFilter
{
public: public:
WCFilterSet(int _setid=MTGSets::ALL_SETS) {setid=_setid;}; WCFilterSet(int _setid = MTGSets::ALL_SETS)
{
setid = _setid;
}
;
WCFilterSet(string arg); 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(); string getCode();
float filterFee() {return 0.2f;}; float filterFee()
{
return 0.2f;
}
;
protected: protected:
int setid; int setid;
}; };
class WCFilterLetter: public WCardFilter{ class WCFilterLetter: public WCardFilter
{
public: public:
WCFilterLetter(string arg); WCFilterLetter(string arg);
bool isMatch(MTGCard * c); bool isMatch(MTGCard * c);
string getCode(); string getCode();
float filterFee() {return 4.0f;}; //Alpha searches are expensive! float filterFee()
{
return 4.0f;
}
; //Alpha searches are expensive!
protected: protected:
char alpha; char alpha;
}; };
class WCFilterColor: public WCardFilter{ class WCFilterColor: public WCardFilter
{
public: public:
WCFilterColor(int _c) {color = _c;}; WCFilterColor(int _c)
{
color = _c;
}
;
WCFilterColor(string arg); WCFilterColor(string arg);
bool isMatch(MTGCard * c); bool isMatch(MTGCard * c);
string getCode(); string getCode();
float filterFee() {return 0.2f;}; float filterFee()
{
return 0.2f;
}
;
protected: protected:
int color; int color;
}; };
class WCFilterOnlyColor: public WCFilterColor{ class WCFilterOnlyColor: public WCFilterColor
{
public: public:
WCFilterOnlyColor(int _c) : WCFilterColor(_c) {}; WCFilterOnlyColor(int _c) : WCFilterColor(_c) {};
WCFilterOnlyColor(string arg) : WCFilterColor(arg) {}; WCFilterOnlyColor(string arg) : WCFilterColor(arg) {};
bool isMatch(MTGCard * c); bool isMatch(MTGCard * c);
string getCode(); string getCode();
}; };
class WCFilterProducesColor: public WCFilterColor{ class WCFilterProducesColor: public WCFilterColor
{
public: public:
WCFilterProducesColor(int _c) : WCFilterColor(_c) {}; WCFilterProducesColor(int _c) : WCFilterColor(_c) {};
WCFilterProducesColor(string arg) : WCFilterColor(arg) {}; WCFilterProducesColor(string arg) : WCFilterColor(arg) {};
bool isMatch(MTGCard * c); bool isMatch(MTGCard * c);
string getCode(); string getCode();
}; };
class WCFilterNumeric: public WCardFilter{ class WCFilterNumeric: public WCardFilter
{
public: public:
WCFilterNumeric(int _num) {number = _num;}; WCFilterNumeric(int _num)
{
number = _num;
}
;
WCFilterNumeric(string arg); WCFilterNumeric(string arg);
bool isMatch(MTGCard * c) = 0; bool isMatch(MTGCard * c) = 0;
string getCode() = 0; string getCode() = 0;
@@ -136,43 +254,72 @@ public:
protected: protected:
int number; int number;
}; };
class WCFilterCMC: public WCFilterNumeric{ class WCFilterCMC: public WCFilterNumeric
{
public: public:
WCFilterCMC(int amt) : WCFilterNumeric(amt) {}; WCFilterCMC(int amt) : WCFilterNumeric(amt) {};
WCFilterCMC(string arg) : WCFilterNumeric(arg) {}; WCFilterCMC(string arg) : WCFilterNumeric(arg) {};
bool isMatch(MTGCard * c); bool isMatch(MTGCard * c);
string getCode(); string getCode();
float filterFee() {return number/20.0f;}; float filterFee()
{
return number / 20.0f;
}
;
}; };
class WCFilterPower: public WCFilterNumeric{ class WCFilterPower: public WCFilterNumeric
{
public: public:
WCFilterPower(int amt) : WCFilterNumeric(amt) {}; WCFilterPower(int amt) : WCFilterNumeric(amt) {};
WCFilterPower(string arg) : WCFilterNumeric(arg) {}; WCFilterPower(string arg) : WCFilterNumeric(arg) {};
bool isMatch(MTGCard * c); bool isMatch(MTGCard * c);
string getCode(); 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: public:
WCFilterToughness(int amt) : WCFilterNumeric(amt) {}; WCFilterToughness(int amt) : WCFilterNumeric(amt) {};
WCFilterToughness(string arg) : WCFilterNumeric(arg) {}; WCFilterToughness(string arg) : WCFilterNumeric(arg) {};
bool isMatch(MTGCard * c); bool isMatch(MTGCard * c);
string getCode(); 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: public:
WCFilterType(string arg) {type = arg;}; WCFilterType(string arg)
{
type = arg;
}
;
bool isMatch(MTGCard * c); bool isMatch(MTGCard * c);
string getCode(); string getCode();
float filterFee() {return 0.4f;}; float filterFee()
{
return 0.4f;
}
;
protected: protected:
string type; string type;
}; };
class WCFilterRarity: public WCardFilter{ class WCFilterRarity: public WCardFilter
{
public: public:
WCFilterRarity(char _r) {rarity = _r;}; WCFilterRarity(char _r)
{
rarity = _r;
}
;
WCFilterRarity(string arg); WCFilterRarity(string arg);
bool isMatch(MTGCard * c); bool isMatch(MTGCard * c);
string getCode(); string getCode();
@@ -180,9 +327,14 @@ public:
protected: protected:
char rarity; char rarity;
}; };
class WCFilterAbility: public WCardFilter{ class WCFilterAbility: public WCardFilter
{
public: public:
WCFilterAbility(int _a) {ability = _a;}; WCFilterAbility(int _a)
{
ability = _a;
}
;
WCFilterAbility(string arg); WCFilterAbility(string arg);
bool isMatch(MTGCard * c); bool isMatch(MTGCard * c);
string getCode(); string getCode();
+62 -15
View File
@@ -22,7 +22,6 @@ namespace Fonts
const unsigned int kSingleByteFontOffset = 100; const unsigned int kSingleByteFontOffset = 100;
} }
class WFont class WFont
{ {
public: public:
@@ -62,18 +61,62 @@ class WLBFont : public WFont
{ {
public: public:
WLBFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM = false); WLBFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM = false);
~WLBFont() {SAFE_DELETE(it);}; ~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(const char *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) {it->DrawString(s,x,y,align,leftOffset,width);}; {
void SetColor(PIXEL_TYPE color) {it->SetColor(color);}; it->DrawString(s, x, y, align, leftOffset, width);
PIXEL_TYPE GetColor() const {return it->GetColor();}; }
void SetScale(float scale) {it->SetScale(scale);}; ;
float GetScale() const {return it->GetScale();}; void DrawString(std::string s, float x, float y, int align = JGETEXT_LEFT, float leftOffset = 0, float width = 0)
float GetHeight() const {return it->GetHeight();}; {
float GetStringWidth(const char *s) const {return it->GetStringWidth(s);}; it->DrawString(s, x, y, align, leftOffset, width);
void SetTracking(float tracking) {it->SetTracking(tracking);}; }
void SetBase(int base) {it->SetBase(base);}; ;
void SetColor(PIXEL_TYPE color)
{
it->SetColor(color);
}
;
PIXEL_TYPE GetColor() const
{
return it->GetColor();
}
;
void SetScale(float scale)
{
it->SetScale(scale);
}
;
float GetScale() const
{
return it->GetScale();
}
;
float GetHeight() const
{
return it->GetHeight();
}
;
float GetStringWidth(const char *s) const
{
return it->GetStringWidth(s);
}
;
void SetTracking(float tracking)
{
it->SetTracking(tracking);
}
;
void SetBase(int base)
{
it->SetBase(base);
}
;
void FormatText(string &s, vector<string>& output); void FormatText(string &s, vector<string>& output);
private: private:
@@ -89,7 +132,11 @@ public:
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); void SetColor(PIXEL_TYPE color);
PIXEL_TYPE GetColor() const {return mColor0;}; PIXEL_TYPE GetColor() const
{
return mColor0;
}
;
void SetScale(float scale); void SetScale(float scale);
float GetScale() const; float GetScale() const;
float GetHeight() const; float GetHeight() const;
@@ -147,8 +194,8 @@ public:
class WUFont: public WFBFont class WUFont: public WFBFont
{ {
public: public:
WUFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM = false) WUFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM = false) :
: WFBFont(inFontID, fontname, lineheight, useVideoRAM) {}; WFBFont(inFontID, fontname, lineheight, useVideoRAM) {};
int GetCode(const u8 *ch, int *charLength) const; int GetCode(const u8 *ch, int *charLength) const;
int GetMana(const u8 *ch) const; int GetMana(const u8 *ch) const;
+442 -117
View File
@@ -5,11 +5,12 @@
class hgeDistortionMesh; class hgeDistortionMesh;
class GameStateOptions; class GameStateOptions;
class WGuiColor{ class WGuiColor
{
public: public:
enum { enum
SCROLLBAR, {
SCROLLBUTTON, SCROLLBAR, SCROLLBUTTON,
//Foregrounds only after this //Foregrounds only after this
TEXT, TEXT,
TEXT_HEADER, TEXT_HEADER,
@@ -25,7 +26,8 @@ public:
}; };
}; };
struct WDistort { struct WDistort
{
WDistort(); WDistort();
WDistort(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4); WDistort(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
float & operator[](int p); float & operator[](int p);
@@ -34,27 +36,50 @@ protected:
}; };
//Complete item interface //Complete item interface
class WGuiBase: public JGuiListener { class WGuiBase: public JGuiListener
{
public: public:
typedef enum { typedef enum
{
CONFIRM_NEED, // Still needs confirmation CONFIRM_NEED, // Still needs confirmation
CONFIRM_OK, // Is okay (no need to confirm, or has been confirmed) 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; } CONFIRM_TYPE;
WGuiBase() {}; WGuiBase() {};
virtual ~WGuiBase() {}; virtual ~WGuiBase() {};
virtual bool Selectable() {return true;}; virtual bool Selectable()
virtual bool isModal() {return false;}; {
virtual bool Visible() {return true;}; 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 void confirmChange(bool confirmed) {};
virtual CONFIRM_TYPE needsConfirm(); virtual CONFIRM_TYPE needsConfirm();
virtual bool yieldFocus(); virtual bool yieldFocus();
virtual PIXEL_TYPE getColor(int type); 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 void Entering(JButton key)=0;
virtual bool Leaving(JButton key)=0; virtual bool Leaving(JButton key)=0;
@@ -74,10 +99,26 @@ public:
virtual float getY()=0; virtual float getY()=0;
virtual float getWidth()=0; virtual float getWidth()=0;
virtual float getHeight()=0; virtual float getHeight()=0;
virtual int getId() {return INVALID_ID;}; virtual int getId()
virtual string getDisplay() const {return "";}; {
virtual float minWidth(){return getWidth();}; return INVALID_ID;
virtual float minHeight(){return getHeight();}; }
;
virtual string getDisplay() const
{
return "";
}
;
virtual float minWidth()
{
return getWidth();
}
;
virtual float minHeight()
{
return getHeight();
}
;
virtual void setModal(bool val) {}; virtual void setModal(bool val) {};
virtual void setDisplay(string s) {}; virtual void setDisplay(string s) {};
@@ -88,17 +129,21 @@ public:
virtual void setId(int _id) {}; virtual void setId(int _id) {};
virtual void setHidden(bool bHidden){}; virtual void setHidden(bool bHidden){};
virtual void setVisible(bool bVisisble) {}; virtual void setVisible(bool bVisisble) {};
virtual void renderBack(WGuiBase * it); virtual void renderBack(WGuiBase * it);
virtual void subBack(WGuiBase * item) {}; virtual void subBack(WGuiBase * item) {};
virtual bool CheckUserInput(JButton key) {return false;}; virtual bool CheckUserInput(JButton key)
{
return false;
}
;
protected: protected:
vector<WGuiBase*> items; vector<WGuiBase*> items;
}; };
//This is our base class for concrete items. //This is our base class for concrete items.
class WGuiItem: public WGuiBase{ class WGuiItem: public WGuiBase
{
public: public:
virtual void Entering(JButton key); virtual void Entering(JButton key);
virtual bool Leaving(JButton key); virtual bool Leaving(JButton key);
@@ -113,25 +158,78 @@ public:
virtual void setData() {}; virtual void setData() {};
virtual bool hasFocus() {return mFocus;}; virtual bool hasFocus()
virtual void setFocus(bool bFocus) {mFocus = bFocus;}; {
return mFocus;
}
;
virtual void setFocus(bool bFocus)
{
mFocus = bFocus;
}
;
virtual string getDisplay() const {return displayValue;}; virtual string getDisplay() const
virtual void setDisplay(string s){displayValue=s;}; {
return displayValue;
}
;
virtual void setDisplay(string s)
{
displayValue = s;
}
;
virtual int getId() {return INVALID_ID;}; virtual int getId()
virtual float getX() {return x;}; {
virtual float getY() {return y;}; return INVALID_ID;
virtual float getWidth() {return width;}; }
virtual float getHeight() {return height;}; ;
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 minWidth();
virtual float minHeight(); virtual float minHeight();
virtual void setId(int _id) {}; virtual void setId(int _id) {};
virtual void setX(float _x){x = _x;}; virtual void setX(float _x)
virtual void setY(float _y){y = _y;}; {
virtual void setWidth(float _w){width = _w;}; x = _x;
virtual void setHeight(float _h){height = _h;}; }
enum { ;
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), NO_TRANSLATE = (1 << 1),
}; };
@@ -144,20 +242,31 @@ protected:
string displayValue; string displayValue;
}; };
class WGuiImage: public WGuiItem{ class WGuiImage: public WGuiItem
{
public: public:
WGuiImage(WDataSource * wds, float _w = 0, float _h = 0, int _margin = 0); 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 void Render();
virtual float getHeight(); virtual float getHeight();
virtual void imageScale(float _w, float _h); virtual void imageScale(float _w, float _h);
virtual void setSource(WDataSource *s) {source = s;}; virtual void setSource(WDataSource *s)
{
source = s;
}
;
protected: protected:
int margin; int margin;
float imgW, imgH; float imgW, imgH;
WDataSource * source;}; WDataSource * source;
};
class WGuiCardImage: public WGuiImage{ class WGuiCardImage: public WGuiImage
{
public: public:
WGuiCardImage(WDataSource * wds, bool _thumb = false); WGuiCardImage(WDataSource * wds, bool _thumb = false);
virtual void Render(); virtual void Render();
@@ -166,77 +275,244 @@ protected:
bool bThumb; bool bThumb;
}; };
class WGuiCardDistort: public WGuiCardImage{ class WGuiCardDistort: public WGuiCardImage
{
public: public:
WGuiCardDistort(WDataSource * wds, bool _thumb = false, WDataSource * _distort = NULL); WGuiCardDistort(WDataSource * wds, bool _thumb = false, WDataSource * _distort = NULL);
~WGuiCardDistort(); ~WGuiCardDistort();
virtual void Render(); virtual void Render();
WDistort xy; WDistort xy;
/* we assume first xy is the top left of the distorted card */ /* we assume first xy is the top left of the distorted card */
virtual float getX() {return xy[0];}; virtual float getX()
virtual float getY() {return xy[1];}; {
return xy[0];
}
;
virtual float getY()
{
return xy[1];
}
;
protected: protected:
hgeDistortionMesh* mesh; hgeDistortionMesh* mesh;
WDataSource * distortSrc; WDataSource * distortSrc;
}; };
//This is our base class for decorators. It wraps everything about WGuiBase. //This is our base class for decorators. It wraps everything about WGuiBase.
class WGuiDeco: public WGuiBase{ class WGuiDeco: public WGuiBase
{
public: public:
WGuiDeco(WGuiBase* _it) {it = _it;}; WGuiDeco(WGuiBase* _it)
virtual ~WGuiDeco() {SAFE_DELETE(it);}; {
it = _it;
}
;
virtual ~WGuiDeco()
{
SAFE_DELETE(it);
}
;
virtual bool Selectable() {return it->Selectable();}; virtual bool Selectable()
virtual bool Visible() {return it->Visible();}; {
virtual bool Changed() {return it->Changed();}; return it->Selectable();
virtual void confirmChange(bool confirmed) {it->confirmChange(confirmed);}; }
virtual CONFIRM_TYPE needsConfirm() { return it->needsConfirm();}; ;
virtual bool yieldFocus() {return it->yieldFocus();}; 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 void Entering(JButton key)
virtual bool Leaving(JButton key) {return it->Leaving(key);}; {
virtual void Update(float dt) {it->Update(dt);}; it->Entering(key);
virtual void updateValue() {it->updateValue();}; }
virtual void Reload() {it->Reload();}; ;
virtual void Overlay() {it->Overlay();}; virtual bool Leaving(JButton key)
virtual void Underlay() {it->Underlay();}; {
virtual void Render() {it->Render();}; return it->Leaving(key);
virtual void setData() {it->setData();}; }
;
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 bool hasFocus()
virtual string getDisplay() const {return it->getDisplay();}; {
virtual int getId() {return it->getId();}; return it->hasFocus();
virtual float getX() {return it->getX();}; }
virtual float getY() {return it->getY();}; ;
virtual float getWidth() {return it->getWidth();}; virtual string getDisplay() const
virtual float getHeight() {return it->getHeight();}; {
virtual PIXEL_TYPE getColor(int type) {return it->getColor(type);}; return it->getDisplay();
WGuiBase * getDecorated() {return it;}; }
;
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 setFocus(bool bFocus)
virtual void setDisplay(string s) {it->setDisplay(s);}; {
virtual void setId(int _id) {it->setId(_id);}; it->setFocus(bFocus);
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 setDisplay(string s)
virtual void setHeight(float _h) {it->setHeight(_h);}; {
virtual void setHidden(bool bHidden) {it->setHidden(bHidden);}; it->setDisplay(s);
virtual void setVisible(bool bVisisble) {it->setVisible(bVisisble);}; }
virtual bool CheckUserInput(JButton key) {return it->CheckUserInput(key);}; ;
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: protected:
WGuiBase * it; WGuiBase * it;
}; };
class WGuiAward: public WGuiItem{ class WGuiAward: public WGuiItem
{
public: public:
WGuiAward(int _id, string name, string _text, string _details = ""); WGuiAward(int _id, string name, string _text, string _details = "");
virtual ~WGuiAward(); virtual ~WGuiAward();
virtual void Render(); virtual void Render();
virtual bool Selectable() {return Visible();}; virtual bool Selectable()
{
return Visible();
}
;
virtual bool Visible(); virtual bool Visible();
virtual int getId() {return id;}; virtual int getId()
{
return id;
}
;
virtual void Underlay(); virtual void Underlay();
virtual void Overlay(); virtual void Overlay();
@@ -246,7 +522,8 @@ protected:
string text; string text;
}; };
class WGuiSplit: public WGuiItem{ class WGuiSplit: public WGuiItem
{
public: public:
WGuiSplit(WGuiBase* _left, WGuiBase* _right); WGuiSplit(WGuiBase* _left, WGuiBase* _right);
virtual ~WGuiSplit(); virtual ~WGuiSplit();
@@ -278,7 +555,8 @@ public:
WGuiBase* left; WGuiBase* left;
}; };
class WDecoConfirm: public WGuiDeco{ class WDecoConfirm: public WGuiDeco
{
public: public:
WDecoConfirm(JGuiListener * _listener, WGuiBase * it); WDecoConfirm(JGuiListener * _listener, WGuiBase * it);
virtual ~WDecoConfirm(); virtual ~WDecoConfirm();
@@ -296,17 +574,20 @@ public:
string confirm; string confirm;
string cancel; string cancel;
protected: protected:
enum { enum
{
OP_UNCONFIRMED, OP_UNCONFIRMED,
OP_CONFIRMING, OP_CONFIRMING,
OP_CONFIRMED, OP_CONFIRMED,
} mState; } mState;
SimpleMenu * confirmMenu; SimpleMenu * confirmMenu;
JGuiListener * listener; JGuiListener * listener;
bool bModal; bool bModal;
}; };
class WDecoEnum : public WGuiDeco { class WDecoEnum: public WGuiDeco
{
public: public:
WDecoEnum(WGuiBase * _it, EnumDefinition *_edef = NULL); WDecoEnum(WGuiBase * _it, EnumDefinition *_edef = NULL);
virtual void Render(); virtual void Render();
@@ -315,7 +596,8 @@ class WDecoEnum : public WGuiDeco {
EnumDefinition * edef; EnumDefinition * edef;
}; };
class WDecoCheat: public WGuiDeco { class WDecoCheat: public WGuiDeco
{
public: public:
WDecoCheat(WGuiBase * _it); WDecoCheat(WGuiBase * _it);
virtual bool Visible(); virtual bool Visible();
@@ -325,45 +607,67 @@ protected:
bool bVisible; bool bVisible;
}; };
class WGuiButton: public WGuiDeco{ class WGuiButton: public WGuiDeco
{
public: public:
WGuiButton(WGuiBase* _it, int _controller, int _control, JGuiListener * jgl); WGuiButton(WGuiBase* _it, int _controller, int _control, JGuiListener * jgl);
virtual void updateValue(); virtual void updateValue();
virtual bool CheckUserInput(JButton key); virtual bool CheckUserInput(JButton key);
virtual bool Selectable() {return Visible();}; virtual bool Selectable()
{
return Visible();
}
;
virtual PIXEL_TYPE getColor(int type); virtual PIXEL_TYPE getColor(int type);
virtual int getControlID() {return control;}; virtual int getControlID()
virtual int getControllerID() {return controller;}; {
return control;
}
;
virtual int getControllerID()
{
return controller;
}
;
protected: protected:
int control, controller; int control, controller;
JGuiListener * mListener; JGuiListener * mListener;
}; };
class WGuiHeader:public WGuiItem{ class WGuiHeader: public WGuiItem
{
public: public:
WGuiHeader(string _displayValue) : WGuiItem(_displayValue) {}; WGuiHeader(string _displayValue) : WGuiItem(_displayValue) {};
virtual bool Selectable() {return false;}; virtual bool Selectable()
{
return false;
}
;
virtual void Render(); virtual void Render();
}; };
class WDecoStyled: public WGuiDeco{ class WDecoStyled: public WGuiDeco
{
public: public:
WDecoStyled(WGuiItem * _it) : WGuiDeco(_it) {mStyle=DS_DEFAULT;}; WDecoStyled(WGuiItem * _it) :
WGuiDeco(_it)
{
mStyle = DS_DEFAULT;
}
;
PIXEL_TYPE getColor(int type); PIXEL_TYPE getColor(int type);
void subBack(WGuiBase * item); void subBack(WGuiBase * item);
enum { enum
DS_DEFAULT = (1<<0), {
DS_COLOR_BRIGHT = (1<<1), DS_DEFAULT = (1 << 0), DS_COLOR_BRIGHT = (1 << 1), DS_COLOR_DARK = (1 << 2), DS_STYLE_ALERT = (1 << 3),
DS_COLOR_DARK = (1<<2), DS_STYLE_EDGED = (1 << 4), DS_STYLE_BACKLESS = (1 << 5),
DS_STYLE_ALERT = (1<<3),
DS_STYLE_EDGED = (1<<4),
DS_STYLE_BACKLESS = (1<<5),
}; };
u8 mStyle; u8 mStyle;
}; };
class WGuiMenu: public WGuiItem{ class WGuiMenu: public WGuiItem
{
public: public:
friend class WGuiFilters; friend class WGuiFilters;
virtual ~WGuiMenu(); virtual ~WGuiMenu();
@@ -381,9 +685,17 @@ public:
virtual void subBack(WGuiBase * item); virtual void subBack(WGuiBase * item);
virtual bool CheckUserInput(JButton key); virtual bool CheckUserInput(JButton key);
WGuiBase * Current(); WGuiBase * Current();
virtual int getSelected() {return currentItem;}; virtual int getSelected()
virtual void setSelected(vector<WGuiBase*>::iterator& it) { {
int c = it - items.begin();setSelected(c);}; return currentItem;
}
;
virtual void setSelected(vector<WGuiBase*>::iterator& it)
{
int c = it - items.begin();
setSelected(c);
}
;
virtual void setSelected(int newItem); virtual void setSelected(int newItem);
virtual bool nextItem(); virtual bool nextItem();
virtual bool prevItem(); virtual bool prevItem();
@@ -403,7 +715,8 @@ protected:
float duration; float duration;
}; };
class WGuiList: public WGuiMenu{ class WGuiList: public WGuiMenu
{
public: public:
WGuiList(string name, WSyncable * syncme = NULL); WGuiList(string name, WSyncable * syncme = NULL);
@@ -417,7 +730,8 @@ class WGuiList: public WGuiMenu{
protected: protected:
bool mFocus; bool mFocus;
}; };
class WGuiTabMenu: public WGuiMenu { class WGuiTabMenu: public WGuiMenu
{
public: public:
WGuiTabMenu() : WGuiMenu(JGE_BTN_NEXT, JGE_BTN_PREV) {}; WGuiTabMenu() : WGuiMenu(JGE_BTN_NEXT, JGE_BTN_PREV) {};
virtual void Render(); virtual void Render();
@@ -425,13 +739,15 @@ class WGuiTabMenu: public WGuiMenu {
void save(); void save();
virtual bool CheckUserInput(JButton key); virtual bool CheckUserInput(JButton key);
}; };
class WGuiListRow: public WGuiList{ class WGuiListRow: public WGuiList
{
public: public:
WGuiListRow(string n, WSyncable * s = NULL); WGuiListRow(string n, WSyncable * s = NULL);
virtual void Render(); virtual void Render();
}; };
class WGuiFilters: public WGuiItem { class WGuiFilters: public WGuiItem
{
public: public:
friend class WGuiFilterItem; friend class WGuiFilterItem;
WGuiFilters(string header, WSrcCards * src); WGuiFilters(string header, WSrcCards * src);
@@ -446,7 +762,11 @@ public:
bool isAvailable(int type); bool isAvailable(int type);
bool isAvailableCode(string code); bool isAvailableCode(string code);
bool Finish(bool emptyset = false); //Returns true if card set reasonably expected to be changed. 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 ButtonPressed(int controllerId, int controlId);
void buildList(); void buildList();
void setSrc(WSrcCards * wsc); void setSrc(WSrcCards * wsc);
@@ -461,7 +781,8 @@ protected:
WGuiList * list; WGuiList * list;
}; };
class WGuiFilterItem: public WGuiItem { class WGuiFilterItem: public WGuiItem
{
public: public:
friend class WGuiFilters; friend class WGuiFilters;
friend struct WLFiltersSort; friend struct WLFiltersSort;
@@ -470,7 +791,8 @@ public:
void ButtonPressed(int controllerId, int controlId); void ButtonPressed(int controllerId, int controlId);
string getCode(); string getCode();
bool isModal(); bool isModal();
enum { enum
{
STATE_UNSET, STATE_UNSET,
STATE_CHOOSE_TYPE, STATE_CHOOSE_TYPE,
STATE_CHOOSE_VAL, STATE_CHOOSE_VAL,
@@ -500,15 +822,18 @@ protected:
WGuiFilters * mParent; WGuiFilters * mParent;
}; };
struct WListSort{ struct WListSort
{
virtual bool operator()(const WGuiBase*l, const WGuiBase*r); virtual bool operator()(const WGuiBase*l, const WGuiBase*r);
}; };
struct WLFiltersSort{ struct WLFiltersSort
{
bool operator()(const WGuiBase*l, const WGuiBase*r); bool operator()(const WGuiBase*l, const WGuiBase*r);
}; };
class WGuiKeyBinder : public WGuiList { class WGuiKeyBinder: public WGuiList
{
public: public:
WGuiKeyBinder(string name, GameStateOptions* parent); WGuiKeyBinder(string name, GameStateOptions* parent);
virtual bool isModal(); virtual bool isModal();
+16 -11
View File
@@ -20,7 +20,6 @@
#define MAX_CACHE_TIME 2000000000 #define MAX_CACHE_TIME 2000000000
#endif #endif
#define THUMBNAILS_OFFSET 100000000 #define THUMBNAILS_OFFSET 100000000
#define OTHERS_OFFSET 2000000000 #define OTHERS_OFFSET 2000000000
@@ -31,15 +30,17 @@
#define MAX_CACHED_SAMPLES 50 #define MAX_CACHED_SAMPLES 50
#define MAX_CACHE_GARBAGE 10 #define MAX_CACHE_GARBAGE 10
enum ENUM_WRES_INFO
enum ENUM_WRES_INFO{ {
WRES_UNLOCKED = 0, //Resource is unlocked. WRES_UNLOCKED = 0, //Resource is unlocked.
WRES_MAX_LOCK = 250, //Maximum number of locks for a resource. WRES_MAX_LOCK = 250, //Maximum number of locks for a resource.
WRES_PERMANENT = 251, //Resource is permanent (ie, managed) 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_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_NORMAL, //Returns or creates a resource. Does not change lock status.
RETRIEVE_LOCK, //As above, locks cached resource. Not for quads. RETRIEVE_LOCK, //As above, locks cached resource. Not for quads.
@@ -47,10 +48,12 @@ enum ENUM_RETRIEVE_STYLE{
RETRIEVE_RESOURCE, //Only retrieves a managed resource. Does not make a new one. RETRIEVE_RESOURCE, //Only retrieves a managed resource. Does not make a new one.
RETRIEVE_MANAGE, //Makes resource permanent. RETRIEVE_MANAGE, //Makes resource permanent.
RETRIEVE_THUMB, //Retrieve it as a thumbnail. RETRIEVE_THUMB, //Retrieve it as a thumbnail.
CACHE_THUMB = RETRIEVE_THUMB, //Backwords compatibility. CACHE_THUMB = RETRIEVE_THUMB,
//Backwords compatibility.
}; };
enum ENUM_CACHE_SUBTYPE{ enum ENUM_CACHE_SUBTYPE
{
CACHE_NORMAL = (1 << 0), //Use default values. Not really a flag. CACHE_NORMAL = (1 << 0), //Use default values. Not really a flag.
CACHE_EXISTING = (1 << 1), //Retrieve it only if it already exists CACHE_EXISTING = (1 << 1), //Retrieve it only if it already exists
@@ -60,11 +63,13 @@ enum ENUM_CACHE_SUBTYPE{
TEXTURE_SUB_CARD = (1 << 3), //Retrieve using cardFile, not graphicsFile. TEXTURE_SUB_CARD = (1 << 3), //Retrieve using cardFile, not graphicsFile.
TEXTURE_SUB_AVATAR = (1 << 4), //Retrieve using avatarFile, 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_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_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_NONE = 0,
CACHE_ERROR_NOT_CACHED = CACHE_ERROR_NONE, CACHE_ERROR_NOT_CACHED = CACHE_ERROR_NONE,
CACHE_ERROR_404, CACHE_ERROR_404,
@@ -74,7 +79,8 @@ enum ENUM_CACHE_ERROR{
CACHE_ERROR_NOT_MANAGED, CACHE_ERROR_NOT_MANAGED,
}; };
struct WCacheSort{ struct WCacheSort
{
bool operator()(const WResource * l, const WResource * r); //Predicate for use in sorting. See flatten(). bool operator()(const WResource * l, const WResource * r); //Predicate for use in sorting. See flatten().
}; };
@@ -119,7 +125,6 @@ protected:
int mError; int mError;
}; };
struct WManagedQuad struct WManagedQuad
{ {
WCachedTexture * texture; WCachedTexture * texture;
-5
View File
@@ -12,12 +12,8 @@
#define OutputDebugString(val) {} #define OutputDebugString(val) {}
#endif #endif
#include "limits.h" #include "limits.h"
#if defined (_DEBUG) && defined (WIN32) #if defined (_DEBUG) && defined (WIN32)
#include "crtdbg.h" #include "crtdbg.h"
#define NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) #define NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
@@ -38,7 +34,6 @@
#endif #endif
#endif #endif
#ifndef RESPATH #ifndef RESPATH
#define RESPATH "Res" #define RESPATH "Res"
#endif #endif
-3
View File
@@ -20,7 +20,6 @@
#endif #endif
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
@@ -72,7 +71,6 @@ typedef std::ifstream ifstream;
using std::string; using std::string;
//string manipulation methods //string manipulation methods
string& trim(string& str); string& trim(string& str);
string& ltrim(string& str); string& ltrim(string& str);
@@ -93,7 +91,6 @@ int WRand();
void dumpStack(); void dumpStack();
#endif #endif
/* RAM simple check functions header */ /* RAM simple check functions header */
// *** DEFINES *** // *** DEFINES ***