Forcing LF as the line ending style through SVN properties. No actual code changes here.

This commit is contained in:
wrenczes@gmail.com
2011-01-28 06:00:51 +00:00
parent 8156619d49
commit 32cabc15c2
20 changed files with 6391 additions and 6391 deletions

View File

@@ -1,21 +1,21 @@
#pragma once
#include "DeckMenu.h"
#include "DeckDataWrapper.h"
#include "DeckStats.h"
class DeckEditorMenu: public DeckMenu
{
protected:
string deckTitle;
private:
void drawDeckStatistics();
DeckDataWrapper *selectedDeck;
StatsWrapper *stw;
public:
DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const char * _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL);
void Render();
~DeckEditorMenu();
};
#pragma once
#include "DeckMenu.h"
#include "DeckDataWrapper.h"
#include "DeckStats.h"
class DeckEditorMenu: public DeckMenu
{
protected:
string deckTitle;
private:
void drawDeckStatistics();
DeckDataWrapper *selectedDeck;
StatsWrapper *stw;
public:
DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const char * _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL);
void Render();
~DeckEditorMenu();
};

View File

@@ -1,43 +1,43 @@
#include <string>
#include <vector>
#include "DeckMetaData.h"
using namespace std;
class DeckManager
{
private:
static bool instanceFlag;
static DeckManager *mInstance;
DeckManager()
{
//private constructor
}
public:
vector<DeckMetaData *> playerDeckOrderList;
vector<DeckMetaData *> aiDeckOrderList;
map<string, StatsWrapper *> playerDeckStatsMap;
map<string, StatsWrapper *> aiDeckStatsMap;
void updateMetaDataList(vector<DeckMetaData *>* refList, bool isAI);
vector<DeckMetaData *> * getPlayerDeckOrderList();
vector<DeckMetaData *> * getAIDeckOrderList();
DeckMetaData * getDeckMetaDataById( int deckId, bool isAI );
StatsWrapper * getExtendedStatsForDeckId( int deckId, MTGAllCards *collection, bool isAI );
StatsWrapper * getExtendedDeckStats( DeckMetaData *selectedDeck, MTGAllCards *collection, bool isAI );
static DeckManager * GetInstance();
static void EndInstance();
//convenience method to get the difficulty rating between two decks. This should be refined a little more
//since the eventual move of all deck meta data should be managed by this class
static int getDifficultyRating(Player *statsPlayer, Player *player);
~DeckManager();
};
#include <string>
#include <vector>
#include "DeckMetaData.h"
using namespace std;
class DeckManager
{
private:
static bool instanceFlag;
static DeckManager *mInstance;
DeckManager()
{
//private constructor
}
public:
vector<DeckMetaData *> playerDeckOrderList;
vector<DeckMetaData *> aiDeckOrderList;
map<string, StatsWrapper *> playerDeckStatsMap;
map<string, StatsWrapper *> aiDeckStatsMap;
void updateMetaDataList(vector<DeckMetaData *>* refList, bool isAI);
vector<DeckMetaData *> * getPlayerDeckOrderList();
vector<DeckMetaData *> * getAIDeckOrderList();
DeckMetaData * getDeckMetaDataById( int deckId, bool isAI );
StatsWrapper * getExtendedStatsForDeckId( int deckId, MTGAllCards *collection, bool isAI );
StatsWrapper * getExtendedDeckStats( DeckMetaData *selectedDeck, MTGAllCards *collection, bool isAI );
static DeckManager * GetInstance();
static void EndInstance();
//convenience method to get the difficulty rating between two decks. This should be refined a little more
//since the eventual move of all deck meta data should be managed by this class
static int getDifficultyRating(Player *statsPlayer, Player *player);
~DeckManager();
};

View File

@@ -1,84 +1,84 @@
/*
A class for menus with a fixed layout
*/
#ifndef _DeckMenu_H_
#define _DeckMenu_H_
#include <string>
#include "WFont.h"
#include "hge/hgeparticle.h"
#include "DeckMetaData.h"
#include "TextScroller.h"
class DeckMenu: public JGuiController
{
protected:
float mHeight, mWidth, mX, mY;
float titleX, titleY, titleWidth;
float descX, descY, descHeight, descWidth;
float statsX, statsY, statsHeight, statsWidth;
float avatarX, avatarY;
float detailedInfoBoxX, detailedInfoBoxY;
float starsOffsetX;
bool menuInitialized;
string backgroundName;
int fontId;
string title;
string displayTitle;
WFont * mFont;
float titleFontScale;
int maxItems, startId;
float selectionT, selectionY;
float timeOpen;
static hgeParticleSystem* stars;
void initMenuItems();
string getDescription();
string getMetaInformation();
DeckMetaData *mSelectedDeck;
int mSelectedDeckId;
bool mShowDetailsScreen;
bool mAlwaysShowDetailsButton;
bool mClosed;
public:
VerticalTextScroller * mScroller;
bool mAutoTranslate;
float mSelectionTargetY;
//used for detailed info button
JQuad * pspIcons[8];
JTexture * pspIconsTexture;
DeckMenu(int id, JGuiListener* listener, int fontId, const string _title = "", const int& startIndex = 0, bool alwaysShowDetailsButton = false);
~DeckMenu();
DeckMetaData * getSelectedDeck();
void enableDisplayDetailsOverride();
bool showDetailsScreen();
bool isClosed()
{
return mClosed;
}
int getSelectedDeckId()
{
return mSelectedDeckId;
}
void Render();
void Update(float dt);
void Add(int id, const char * Text, string desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL);
void Close();
void updateScroller();
void RenderBackground();
static void destroy();
};
#endif
/*
A class for menus with a fixed layout
*/
#ifndef _DeckMenu_H_
#define _DeckMenu_H_
#include <string>
#include "WFont.h"
#include "hge/hgeparticle.h"
#include "DeckMetaData.h"
#include "TextScroller.h"
class DeckMenu: public JGuiController
{
protected:
float mHeight, mWidth, mX, mY;
float titleX, titleY, titleWidth;
float descX, descY, descHeight, descWidth;
float statsX, statsY, statsHeight, statsWidth;
float avatarX, avatarY;
float detailedInfoBoxX, detailedInfoBoxY;
float starsOffsetX;
bool menuInitialized;
string backgroundName;
int fontId;
string title;
string displayTitle;
WFont * mFont;
float titleFontScale;
int maxItems, startId;
float selectionT, selectionY;
float timeOpen;
static hgeParticleSystem* stars;
void initMenuItems();
string getDescription();
string getMetaInformation();
DeckMetaData *mSelectedDeck;
int mSelectedDeckId;
bool mShowDetailsScreen;
bool mAlwaysShowDetailsButton;
bool mClosed;
public:
VerticalTextScroller * mScroller;
bool mAutoTranslate;
float mSelectionTargetY;
//used for detailed info button
JQuad * pspIcons[8];
JTexture * pspIconsTexture;
DeckMenu(int id, JGuiListener* listener, int fontId, const string _title = "", const int& startIndex = 0, bool alwaysShowDetailsButton = false);
~DeckMenu();
DeckMetaData * getSelectedDeck();
void enableDisplayDetailsOverride();
bool showDetailsScreen();
bool isClosed()
{
return mClosed;
}
int getSelectedDeckId()
{
return mSelectedDeckId;
}
void Render();
void Update(float dt);
void Add(int id, const char * Text, string desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL);
void Close();
void updateScroller();
void RenderBackground();
static void destroy();
};
#endif

View File

@@ -1,109 +1,109 @@
#ifndef _DECKSTATS_H_
#define _DECKSTATS_H_
#include <map>
#include <string>
#include <vector>
#include "MTGDefinitions.h"
#include <DeckDataWrapper.h>
using namespace std;
class Player;
class GameObserver;
class DeckStat
{
public:
DeckStat(int _nbgames = 0, int _victories = 0);
int nbgames;
int victories;
int percentVictories();
};
class DeckStats
{
protected:
static DeckStats * mInstance;
public:
//map<string, DeckStat *> stats; // current set of statistics
string currentDeck;
map<string, map<string,DeckStat*> > masterDeckStats;
static DeckStats * GetInstance();
static void EndInstance();
void saveStats(Player * player, Player * opponent, GameObserver * game);
void save(const char * filename);
void save(Player * player);
void load(const char * filename);
void load(Player * player);
void cleanStats();
~DeckStats();
int percentVictories(string opponentsDeckFile);
int percentVictories();
DeckStat * getDeckStat(string opponentsFile);
//returns the total number of games played with this deck
int nbGames();
};
class StatsWrapper
{
private:
void initValues();
public:
StatsWrapper(int deckId);
StatsWrapper(string filename);
~StatsWrapper();
void initStatistics(string deckstats);
// Stats parameters and status
int mDeckId;
int currentPage;
int pageCount;
bool needUpdate;
// Actual stats
int percentVictories;
int gamesPlayed;
int cardCount;
int countLands;
int totalPrice;
int totalManaCost;
float avgManaCost;
int totalCreatureCost;
float avgCreatureCost;
int totalSpellCost;
float avgSpellCost;
int countManaProducers;
int countCreatures, countSpells, countInstants, countEnchantments, countSorceries, countArtifacts;
float noLandsProbInTurn[Constants::STATS_FOR_TURNS];
float noCreaturesProbInTurn[Constants::STATS_FOR_TURNS];
int countCardsPerCost[Constants::STATS_MAX_MANA_COST + 1];
int countCardsPerCostAndColor[Constants::STATS_MAX_MANA_COST + 1][Constants::MTG_NB_COLORS + 1];
int countCreaturesPerCost[Constants::STATS_MAX_MANA_COST + 1];
int countCreaturesPerCostAndColor[Constants::STATS_MAX_MANA_COST + 1][Constants::MTG_NB_COLORS + 1];
int countSpellsPerCost[Constants::STATS_MAX_MANA_COST + 1];
int countSpellsPerCostAndColor[Constants::STATS_MAX_MANA_COST + 1][Constants::MTG_NB_COLORS + 1];
int countLandsPerColor[Constants::MTG_NB_COLORS + 1];
int countBasicLandsPerColor[Constants::MTG_NB_COLORS + 1];
int countNonLandProducersPerColor[Constants::MTG_NB_COLORS + 1];
int totalCostPerColor[Constants::MTG_NB_COLORS + 1];
int totalColoredSymbols;
void updateStats(string filename, MTGAllCards * collection);
void updateStats(DeckDataWrapper *mtgDeck);
int countCardsByType(const char * _type, DeckDataWrapper * myDeck);
float noLuck(int n, int a, int x);
vector<string> aiDeckNames;
vector<DeckStat*> aiDeckStats;
};
#endif
#ifndef _DECKSTATS_H_
#define _DECKSTATS_H_
#include <map>
#include <string>
#include <vector>
#include "MTGDefinitions.h"
#include <DeckDataWrapper.h>
using namespace std;
class Player;
class GameObserver;
class DeckStat
{
public:
DeckStat(int _nbgames = 0, int _victories = 0);
int nbgames;
int victories;
int percentVictories();
};
class DeckStats
{
protected:
static DeckStats * mInstance;
public:
//map<string, DeckStat *> stats; // current set of statistics
string currentDeck;
map<string, map<string,DeckStat*> > masterDeckStats;
static DeckStats * GetInstance();
static void EndInstance();
void saveStats(Player * player, Player * opponent, GameObserver * game);
void save(const char * filename);
void save(Player * player);
void load(const char * filename);
void load(Player * player);
void cleanStats();
~DeckStats();
int percentVictories(string opponentsDeckFile);
int percentVictories();
DeckStat * getDeckStat(string opponentsFile);
//returns the total number of games played with this deck
int nbGames();
};
class StatsWrapper
{
private:
void initValues();
public:
StatsWrapper(int deckId);
StatsWrapper(string filename);
~StatsWrapper();
void initStatistics(string deckstats);
// Stats parameters and status
int mDeckId;
int currentPage;
int pageCount;
bool needUpdate;
// Actual stats
int percentVictories;
int gamesPlayed;
int cardCount;
int countLands;
int totalPrice;
int totalManaCost;
float avgManaCost;
int totalCreatureCost;
float avgCreatureCost;
int totalSpellCost;
float avgSpellCost;
int countManaProducers;
int countCreatures, countSpells, countInstants, countEnchantments, countSorceries, countArtifacts;
float noLandsProbInTurn[Constants::STATS_FOR_TURNS];
float noCreaturesProbInTurn[Constants::STATS_FOR_TURNS];
int countCardsPerCost[Constants::STATS_MAX_MANA_COST + 1];
int countCardsPerCostAndColor[Constants::STATS_MAX_MANA_COST + 1][Constants::MTG_NB_COLORS + 1];
int countCreaturesPerCost[Constants::STATS_MAX_MANA_COST + 1];
int countCreaturesPerCostAndColor[Constants::STATS_MAX_MANA_COST + 1][Constants::MTG_NB_COLORS + 1];
int countSpellsPerCost[Constants::STATS_MAX_MANA_COST + 1];
int countSpellsPerCostAndColor[Constants::STATS_MAX_MANA_COST + 1][Constants::MTG_NB_COLORS + 1];
int countLandsPerColor[Constants::MTG_NB_COLORS + 1];
int countBasicLandsPerColor[Constants::MTG_NB_COLORS + 1];
int countNonLandProducersPerColor[Constants::MTG_NB_COLORS + 1];
int totalCostPerColor[Constants::MTG_NB_COLORS + 1];
int totalColoredSymbols;
void updateStats(string filename, MTGAllCards * collection);
void updateStats(DeckDataWrapper *mtgDeck);
int countCardsByType(const char * _type, DeckDataWrapper * myDeck);
float noLuck(int n, int a, int x);
vector<string> aiDeckNames;
vector<DeckStat*> aiDeckStats;
};
#endif

View File

@@ -1,153 +1,153 @@
#ifndef _EXTRACOST_H_
#define _EXTRACOST_H_
#include <vector>
#include "Counters.h"
using std::vector;
class TargetChooser;
class MTGCardInstance;
class MTGAbility;
class ExtraCost{
public:
TargetChooser * tc;
MTGCardInstance * source;
MTGCardInstance * target;
MTGCardInstance * targets[20];
std::string mCostRenderString;
ExtraCost(const std::string& inCostRenderString, TargetChooser *_tc = NULL);
virtual ~ExtraCost();
virtual int setPayment(MTGCardInstance * card);
virtual int isPaymentSet() { return (target != NULL && targets != NULL); }
virtual int canPay() { return 1; }
virtual int doPay() = 0;
virtual void Render();
virtual int setSource(MTGCardInstance * _source);
virtual ExtraCost* clone() const = 0;
};
class ExtraCosts{
public:
vector<ExtraCost *>costs;
MTGCardInstance * source;
MTGAbility * action;
ExtraCosts();
~ExtraCosts();
void Render();
int tryToSetPayment(MTGCardInstance * card);
int isPaymentSet();
int canPay();
int doPay();
int reset();
int setAction(MTGAbility * _action, MTGCardInstance * _source);
void Dump();
ExtraCosts * clone() const;
};
class SacrificeCost: public ExtraCost{
public:
SacrificeCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual SacrificeCost * clone() const;
};
//life cost
class LifeCost: public ExtraCost{
public:
LifeCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual LifeCost * clone() const;
};
//Discard a random card cost
class DiscardRandomCost: public ExtraCost{
public:
DiscardRandomCost(TargetChooser *_tc = NULL);
virtual int canPay();
virtual int doPay();
virtual DiscardRandomCost * clone() const;
};
//a choosen discard
class DiscardCost: public ExtraCost{
public:
DiscardCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual DiscardCost * clone() const;
};
//tolibrary cost
class ToLibraryCost: public ExtraCost{
public:
ToLibraryCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual ToLibraryCost * clone() const;
};
//Millyourself cost
class MillCost: public ExtraCost{
public:
MillCost(TargetChooser *_tc = NULL);
virtual int canPay();
virtual int doPay();
virtual MillCost * clone() const;
};
//Mill to exile yourself cost
class MillExileCost: public MillCost{
public:
MillExileCost(TargetChooser *_tc = NULL);
virtual int doPay();
};
//tap other cost
class TapTargetCost: public ExtraCost{
public:
TapTargetCost(TargetChooser *_tc = NULL);
virtual int isPaymentSet();
virtual int doPay();
virtual TapTargetCost * clone() const;
};
//exile as cost
class ExileTargetCost: public ExtraCost{
public:
ExileTargetCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual ExileTargetCost * clone() const;
};
//bounce cost
class BounceTargetCost: public ExtraCost{
public:
BounceTargetCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual BounceTargetCost * clone() const;
};
//bounce cost
class Ninja: public ExtraCost{
public:
Ninja(TargetChooser *_tc = NULL);
virtual int isPaymentSet();
virtual int doPay();
virtual Ninja * clone() const;
};
class CounterCost: public ExtraCost{
public:
Counter * counter;
int hasCounters;
CounterCost(Counter * _counter,TargetChooser *_tc = NULL);
~CounterCost();
virtual int setPayment(MTGCardInstance * card);
virtual int isPaymentSet();
virtual int canPay();
virtual int doPay();
virtual CounterCost * clone() const;
};
#endif
#ifndef _EXTRACOST_H_
#define _EXTRACOST_H_
#include <vector>
#include "Counters.h"
using std::vector;
class TargetChooser;
class MTGCardInstance;
class MTGAbility;
class ExtraCost{
public:
TargetChooser * tc;
MTGCardInstance * source;
MTGCardInstance * target;
MTGCardInstance * targets[20];
std::string mCostRenderString;
ExtraCost(const std::string& inCostRenderString, TargetChooser *_tc = NULL);
virtual ~ExtraCost();
virtual int setPayment(MTGCardInstance * card);
virtual int isPaymentSet() { return (target != NULL && targets != NULL); }
virtual int canPay() { return 1; }
virtual int doPay() = 0;
virtual void Render();
virtual int setSource(MTGCardInstance * _source);
virtual ExtraCost* clone() const = 0;
};
class ExtraCosts{
public:
vector<ExtraCost *>costs;
MTGCardInstance * source;
MTGAbility * action;
ExtraCosts();
~ExtraCosts();
void Render();
int tryToSetPayment(MTGCardInstance * card);
int isPaymentSet();
int canPay();
int doPay();
int reset();
int setAction(MTGAbility * _action, MTGCardInstance * _source);
void Dump();
ExtraCosts * clone() const;
};
class SacrificeCost: public ExtraCost{
public:
SacrificeCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual SacrificeCost * clone() const;
};
//life cost
class LifeCost: public ExtraCost{
public:
LifeCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual LifeCost * clone() const;
};
//Discard a random card cost
class DiscardRandomCost: public ExtraCost{
public:
DiscardRandomCost(TargetChooser *_tc = NULL);
virtual int canPay();
virtual int doPay();
virtual DiscardRandomCost * clone() const;
};
//a choosen discard
class DiscardCost: public ExtraCost{
public:
DiscardCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual DiscardCost * clone() const;
};
//tolibrary cost
class ToLibraryCost: public ExtraCost{
public:
ToLibraryCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual ToLibraryCost * clone() const;
};
//Millyourself cost
class MillCost: public ExtraCost{
public:
MillCost(TargetChooser *_tc = NULL);
virtual int canPay();
virtual int doPay();
virtual MillCost * clone() const;
};
//Mill to exile yourself cost
class MillExileCost: public MillCost{
public:
MillExileCost(TargetChooser *_tc = NULL);
virtual int doPay();
};
//tap other cost
class TapTargetCost: public ExtraCost{
public:
TapTargetCost(TargetChooser *_tc = NULL);
virtual int isPaymentSet();
virtual int doPay();
virtual TapTargetCost * clone() const;
};
//exile as cost
class ExileTargetCost: public ExtraCost{
public:
ExileTargetCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual ExileTargetCost * clone() const;
};
//bounce cost
class BounceTargetCost: public ExtraCost{
public:
BounceTargetCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual BounceTargetCost * clone() const;
};
//bounce cost
class Ninja: public ExtraCost{
public:
Ninja(TargetChooser *_tc = NULL);
virtual int isPaymentSet();
virtual int doPay();
virtual Ninja * clone() const;
};
class CounterCost: public ExtraCost{
public:
Counter * counter;
int hasCounters;
CounterCost(Counter * _counter,TargetChooser *_tc = NULL);
~CounterCost();
virtual int setPayment(MTGCardInstance * card);
virtual int isPaymentSet();
virtual int canPay();
virtual int doPay();
virtual CounterCost * clone() const;
};
#endif

View File

@@ -1,152 +1,152 @@
#ifndef _GAME_STATE_DECK_VIEWER_H_
#define _GAME_STATE_DECK_VIEWER_H_
#include <math.h>
#include <iostream>
#include <JGE.h>
#include "GameState.h"
#include "DeckEditorMenu.h"
#include "SimpleMenu.h"
#include "WResourceManager.h"
#include "CardGui.h"
#include "GameOptions.h"
#include "PriceList.h"
#include "PlayerData.h"
#include "DeckDataWrapper.h"
#include "DeckStats.h"
#include "WDataSrc.h"
#include "WGui.h"
#define NO_USER_ACTIVITY_HELP_DELAY 10
#define NO_USER_ACTIVITY_SHOWCARD_DELAY 0.1
enum
{
STAGE_TRANSITION_RIGHT = 0,
STAGE_TRANSITION_LEFT = 1,
STAGE_WAITING = 2,
STAGE_TRANSITION_UP = 3,
STAGE_TRANSITION_DOWN = 4,
STAGE_ONSCREEN_MENU = 5,
STAGE_WELCOME = 6,
STAGE_MENU = 7,
STAGE_FILTERS = 8
};
// TODO: need a better name for MENU_FIRST_MENU, this is reused for the 1st submenu of
// available options in the duel menu
enum
{
MENU_CARD_PURCHASE = 2,
MENU_DECK_SELECTION = 10,
MENU_DECK_BUILDER = 11,
MENU_FIRST_DUEL_SUBMENU = 102,
MENU_LANGUAGE_SELECTION = 103,
};
// enums for menu options
// TODO: make these enums a little more descriptive. (ie should reflect what menu they are attached to )
enum DECK_VIEWER_MENU_ITEMS
{
MENU_ITEM_NEW_DECK = -30,
MENU_ITEM_CHEAT_MODE = -12,
MENU_ITEM_CANCEL = kCancelMenuID,
MENU_ITEM_SAVE_RETURN_MAIN_MENU = 0,
MENU_ITEM_SAVE_RENAME = 1,
MENU_ITEM_SWITCH_DECKS_NO_SAVE = 2,
MENU_ITEM_MAIN_MENU = 3,
MENU_ITEM_EDITOR_CANCEL = kCancelMenuID,
MENU_ITEM_SAVE_AS_AI_DECK = 5,
MENU_ITEM_YES = 20,
MENU_ITEM_NO = 21,
MENU_ITEM_FILTER_BY = 22,
MENUITEM_MORE_INFO = kInfoMenuID
};
#define ALL_COLORS -1
#define ROTATE_LEFT 1;
#define ROTATE_RIGHT 0;
#define HIGH_SPEED 15.0
#define MED_SPEED 5.0f
#define LOW_SPEED 1.5
#define MAX_SAVED_FILTERS 8
#define CARDS_DISPLAYED 7
class GameStateDeckViewer: public GameState, public JGuiListener
{
private:
JQuad * mIcons[CARDS_DISPLAYED];
JQuad * pspIcons[8];
JTexture * pspIconsTexture;
float last_user_activity;
float onScreenTransition;
float mRotation;
float mSlide;
int mAlpha;
int mStage;
int nbDecks;
int deckNum;
int useFilter;
JMusic * bgMusic;
JQuad * backQuad;
int lastPos;
int lastTotal;
WGuiFilters * filterMenu;
WSrcDeckViewer * source;
DeckEditorMenu * welcome_menu;
SimpleMenu * subMenu;
DeckEditorMenu * menu;
PriceList* pricelist;
PlayerData * playerdata;
int price;
DeckDataWrapper * displayed_deck;
DeckDataWrapper * myDeck;
DeckDataWrapper * myCollection;
MTGCard * cardIndex[CARDS_DISPLAYED];
StatsWrapper *stw;
int hudAlpha;
string newDeckname;
bool isAIDeckSave;
bool mSwitching;
void saveDeck(); //Saves the deck and additional necessary information
void saveAsAIDeck(string deckName); // saves deck as an AI Deck
int getCurrentPos();
pair<float, float> cardsCoordinates[CARDS_DISPLAYED];
public:
GameStateDeckViewer(GameApp* parent);
virtual ~GameStateDeckViewer();
void updateDecks();
void rotateCards(int direction);
void loadIndexes();
void updateFilters();
void rebuildFilters();
void switchDisplay();
void Start();
virtual void End();
void addRemove(MTGCard * card);
virtual void Update(float dt);
void renderOnScreenBasicInfo();
void renderSlideBar();
void renderDeckBackground();
void renderOnScreenMenu();
virtual void renderCard(int id, float rotation);
virtual void renderCard(int id);
virtual void Render();
int loadDeck(int deckid);
void LoadDeckStatistics(int deckId);
void buildEditorMenu();
virtual void ButtonPressed(int controllerId, int controlId);
};
#endif
#ifndef _GAME_STATE_DECK_VIEWER_H_
#define _GAME_STATE_DECK_VIEWER_H_
#include <math.h>
#include <iostream>
#include <JGE.h>
#include "GameState.h"
#include "DeckEditorMenu.h"
#include "SimpleMenu.h"
#include "WResourceManager.h"
#include "CardGui.h"
#include "GameOptions.h"
#include "PriceList.h"
#include "PlayerData.h"
#include "DeckDataWrapper.h"
#include "DeckStats.h"
#include "WDataSrc.h"
#include "WGui.h"
#define NO_USER_ACTIVITY_HELP_DELAY 10
#define NO_USER_ACTIVITY_SHOWCARD_DELAY 0.1
enum
{
STAGE_TRANSITION_RIGHT = 0,
STAGE_TRANSITION_LEFT = 1,
STAGE_WAITING = 2,
STAGE_TRANSITION_UP = 3,
STAGE_TRANSITION_DOWN = 4,
STAGE_ONSCREEN_MENU = 5,
STAGE_WELCOME = 6,
STAGE_MENU = 7,
STAGE_FILTERS = 8
};
// TODO: need a better name for MENU_FIRST_MENU, this is reused for the 1st submenu of
// available options in the duel menu
enum
{
MENU_CARD_PURCHASE = 2,
MENU_DECK_SELECTION = 10,
MENU_DECK_BUILDER = 11,
MENU_FIRST_DUEL_SUBMENU = 102,
MENU_LANGUAGE_SELECTION = 103,
};
// enums for menu options
// TODO: make these enums a little more descriptive. (ie should reflect what menu they are attached to )
enum DECK_VIEWER_MENU_ITEMS
{
MENU_ITEM_NEW_DECK = -30,
MENU_ITEM_CHEAT_MODE = -12,
MENU_ITEM_CANCEL = kCancelMenuID,
MENU_ITEM_SAVE_RETURN_MAIN_MENU = 0,
MENU_ITEM_SAVE_RENAME = 1,
MENU_ITEM_SWITCH_DECKS_NO_SAVE = 2,
MENU_ITEM_MAIN_MENU = 3,
MENU_ITEM_EDITOR_CANCEL = kCancelMenuID,
MENU_ITEM_SAVE_AS_AI_DECK = 5,
MENU_ITEM_YES = 20,
MENU_ITEM_NO = 21,
MENU_ITEM_FILTER_BY = 22,
MENUITEM_MORE_INFO = kInfoMenuID
};
#define ALL_COLORS -1
#define ROTATE_LEFT 1;
#define ROTATE_RIGHT 0;
#define HIGH_SPEED 15.0
#define MED_SPEED 5.0f
#define LOW_SPEED 1.5
#define MAX_SAVED_FILTERS 8
#define CARDS_DISPLAYED 7
class GameStateDeckViewer: public GameState, public JGuiListener
{
private:
JQuad * mIcons[CARDS_DISPLAYED];
JQuad * pspIcons[8];
JTexture * pspIconsTexture;
float last_user_activity;
float onScreenTransition;
float mRotation;
float mSlide;
int mAlpha;
int mStage;
int nbDecks;
int deckNum;
int useFilter;
JMusic * bgMusic;
JQuad * backQuad;
int lastPos;
int lastTotal;
WGuiFilters * filterMenu;
WSrcDeckViewer * source;
DeckEditorMenu * welcome_menu;
SimpleMenu * subMenu;
DeckEditorMenu * menu;
PriceList* pricelist;
PlayerData * playerdata;
int price;
DeckDataWrapper * displayed_deck;
DeckDataWrapper * myDeck;
DeckDataWrapper * myCollection;
MTGCard * cardIndex[CARDS_DISPLAYED];
StatsWrapper *stw;
int hudAlpha;
string newDeckname;
bool isAIDeckSave;
bool mSwitching;
void saveDeck(); //Saves the deck and additional necessary information
void saveAsAIDeck(string deckName); // saves deck as an AI Deck
int getCurrentPos();
pair<float, float> cardsCoordinates[CARDS_DISPLAYED];
public:
GameStateDeckViewer(GameApp* parent);
virtual ~GameStateDeckViewer();
void updateDecks();
void rotateCards(int direction);
void loadIndexes();
void updateFilters();
void rebuildFilters();
void switchDisplay();
void Start();
virtual void End();
void addRemove(MTGCard * card);
virtual void Update(float dt);
void renderOnScreenBasicInfo();
void renderSlideBar();
void renderDeckBackground();
void renderOnScreenMenu();
virtual void renderCard(int id, float rotation);
virtual void renderCard(int id);
virtual void Render();
int loadDeck(int deckid);
void LoadDeckStatistics(int deckId);
void buildEditorMenu();
virtual void ButtonPressed(int controllerId, int controlId);
};
#endif

View File

@@ -1,76 +1,76 @@
#ifndef _GAME_STATE_DUEL_H_
#define _GAME_STATE_DUEL_H_
#include "GameState.h"
#include "SimpleMenu.h"
#include "SimplePopup.h"
#include "DeckMenu.h"
#include "MTGDeck.h"
#include "GameObserver.h"
#define CHOOSE_OPPONENT 7
#ifdef TESTSUITE
class TestSuite;
#endif
class Credits;
class Rules;
class GameStateDuel: public GameState, public JGuiListener
{
private:
#ifdef TESTSUITE
TestSuite * testSuite;
#endif
Credits * credits;
int mGamePhase;
Player * mCurrentPlayer;
Player * mPlayers[2];
MTGPlayerCards * deck[2];
GameObserver * game;
DeckMenu * deckmenu;
DeckMenu * opponentMenu;
SimpleMenu * menu;
SimplePopup * popupScreen; // used for informational screens, modal
static int selectedPlayerDeckId;
static int selectedAIDeckId;
bool premadeDeck;
int OpponentsDeckid;
string musictrack;
Rules * rules;
bool MusicExist(string FileName);
void loadPlayer(int playerId, int decknb = 0, int isAI = 0);
void ConstructOpponentMenu(); //loads the opponentMenu if it doesn't exist
void initScroller();
public:
GameStateDuel(GameApp* parent);
virtual ~GameStateDuel();
#ifdef TESTSUITE
void loadTestSuitePlayers();
#endif
virtual void ButtonPressed(int ControllerId, int ControlId);
virtual void Start();
virtual void End();
virtual void Update(float dt);
virtual void Render();
void initRand(unsigned seed = 0);
enum ENUM_DUEL_STATE_MENU_ITEM
{
MENUITEM_CANCEL = kCancelMenuID,
MENUITEM_NEW_DECK = -10,
MENUITEM_RANDOM_PLAYER = -11,
MENUITEM_RANDOM_AI = -12,
MENUITEM_MAIN_MENU = -13,
MENUITEM_EVIL_TWIN = -14,
MENUITEM_MULLIGAN = -15,
MENUITEM_MORE_INFO = kInfoMenuID
};
};
#endif
#ifndef _GAME_STATE_DUEL_H_
#define _GAME_STATE_DUEL_H_
#include "GameState.h"
#include "SimpleMenu.h"
#include "SimplePopup.h"
#include "DeckMenu.h"
#include "MTGDeck.h"
#include "GameObserver.h"
#define CHOOSE_OPPONENT 7
#ifdef TESTSUITE
class TestSuite;
#endif
class Credits;
class Rules;
class GameStateDuel: public GameState, public JGuiListener
{
private:
#ifdef TESTSUITE
TestSuite * testSuite;
#endif
Credits * credits;
int mGamePhase;
Player * mCurrentPlayer;
Player * mPlayers[2];
MTGPlayerCards * deck[2];
GameObserver * game;
DeckMenu * deckmenu;
DeckMenu * opponentMenu;
SimpleMenu * menu;
SimplePopup * popupScreen; // used for informational screens, modal
static int selectedPlayerDeckId;
static int selectedAIDeckId;
bool premadeDeck;
int OpponentsDeckid;
string musictrack;
Rules * rules;
bool MusicExist(string FileName);
void loadPlayer(int playerId, int decknb = 0, int isAI = 0);
void ConstructOpponentMenu(); //loads the opponentMenu if it doesn't exist
void initScroller();
public:
GameStateDuel(GameApp* parent);
virtual ~GameStateDuel();
#ifdef TESTSUITE
void loadTestSuitePlayers();
#endif
virtual void ButtonPressed(int ControllerId, int ControlId);
virtual void Start();
virtual void End();
virtual void Update(float dt);
virtual void Render();
void initRand(unsigned seed = 0);
enum ENUM_DUEL_STATE_MENU_ITEM
{
MENUITEM_CANCEL = kCancelMenuID,
MENUITEM_NEW_DECK = -10,
MENUITEM_RANDOM_PLAYER = -11,
MENUITEM_RANDOM_AI = -12,
MENUITEM_MAIN_MENU = -13,
MENUITEM_EVIL_TWIN = -14,
MENUITEM_MULLIGAN = -15,
MENUITEM_MORE_INFO = kInfoMenuID
};
};
#endif

View File

@@ -1,113 +1,113 @@
#ifndef _PLAYER_H_
#define _PLAYER_H_
#include "JGE.h"
#include "MTGGameZones.h"
#include "Damage.h"
#include "Targetable.h"
class MTGDeck;
class MTGPlayerCards;
class MTGInPlay;
class ManaPool;
class Player: public Damageable
{
protected:
ManaPool * manaPool;
public:
enum ENUM_PLAY_MODE
{
MODE_TEST_SUITE,
MODE_HUMAN,
MODE_AI
};
JTexture * mAvatarTex;
JQuad * mAvatar;
int playMode;
bool canPutLandsIntoPlay;
int landsPlayerCanStillPlay;
bool nomaxhandsize;
int castedspellsthisturn;
bool onlyonecast;
int castcount;
bool nocreatureinstant;
bool nospellinstant;
bool onlyoneinstant;
bool castrestrictedcreature;
bool castrestrictedspell;
bool onlyoneboth;
bool bothrestrictedspell;
bool bothrestrictedcreature;
bool isPoisoned;
MTGPlayerCards * game;
string deckFile;
string deckFileSmall;
string deckName;
Player(MTGDeck * deck, string deckFile, string deckFileSmall);
virtual ~Player();
virtual void End();
virtual int displayStack()
{
return 1;
}
const string getDisplayName() const;
int typeAsTarget()
{
return TARGET_PLAYER;
}
int afterDamage();
int gainLife(int value);
int loseLife(int value);
int gainOrLoseLife(int value);
int poisoned();
int damaged();
int prevented();
void unTapPhase();
MTGInPlay * inPlay();
ManaPool * getManaPool();
void cleanupPhase();
virtual int Act(float dt)
{
return 0;
}
virtual int isAI()
{
return 0;
}
Player * opponent();
int getId();
JQuad * getIcon();
virtual int receiveEvent(WEvent * event)
{
return 0;
}
virtual void Render()
{
}
void loadAvatar(string file);
};
class HumanPlayer: public Player
{
public:
HumanPlayer(MTGDeck * deck, string deckFile, string deckFileSmall);
HumanPlayer(string deckFile);
};
ostream& operator<<(ostream&, const Player&);
#endif
#ifndef _PLAYER_H_
#define _PLAYER_H_
#include "JGE.h"
#include "MTGGameZones.h"
#include "Damage.h"
#include "Targetable.h"
class MTGDeck;
class MTGPlayerCards;
class MTGInPlay;
class ManaPool;
class Player: public Damageable
{
protected:
ManaPool * manaPool;
public:
enum ENUM_PLAY_MODE
{
MODE_TEST_SUITE,
MODE_HUMAN,
MODE_AI
};
JTexture * mAvatarTex;
JQuad * mAvatar;
int playMode;
bool canPutLandsIntoPlay;
int landsPlayerCanStillPlay;
bool nomaxhandsize;
int castedspellsthisturn;
bool onlyonecast;
int castcount;
bool nocreatureinstant;
bool nospellinstant;
bool onlyoneinstant;
bool castrestrictedcreature;
bool castrestrictedspell;
bool onlyoneboth;
bool bothrestrictedspell;
bool bothrestrictedcreature;
bool isPoisoned;
MTGPlayerCards * game;
string deckFile;
string deckFileSmall;
string deckName;
Player(MTGDeck * deck, string deckFile, string deckFileSmall);
virtual ~Player();
virtual void End();
virtual int displayStack()
{
return 1;
}
const string getDisplayName() const;
int typeAsTarget()
{
return TARGET_PLAYER;
}
int afterDamage();
int gainLife(int value);
int loseLife(int value);
int gainOrLoseLife(int value);
int poisoned();
int damaged();
int prevented();
void unTapPhase();
MTGInPlay * inPlay();
ManaPool * getManaPool();
void cleanupPhase();
virtual int Act(float dt)
{
return 0;
}
virtual int isAI()
{
return 0;
}
Player * opponent();
int getId();
JQuad * getIcon();
virtual int receiveEvent(WEvent * event)
{
return 0;
}
virtual void Render()
{
}
void loadAvatar(string file);
};
class HumanPlayer: public Player
{
public:
HumanPlayer(MTGDeck * deck, string deckFile, string deckFileSmall);
HumanPlayer(string deckFile);
};
ostream& operator<<(ostream&, const Player&);
#endif

View File

@@ -1,50 +1,50 @@
#ifndef _REPLACEMENT_EFFECTS_H_
#define _REPLACEMENT_EFFECTS_H_
#include <list>
using namespace std;
#include "Damage.h"
#include "WEvent.h"
class TargetChooser;
class MTGAbility;
class ReplacementEffect
{
public:
virtual WEvent * replace(WEvent * e)
{
return e;
}
;
virtual ~ReplacementEffect() {}
};
class REDamagePrevention: public ReplacementEffect
{
protected:
MTGAbility * source;
TargetChooser * tcSource;
TargetChooser * tcTarget;
int damage;
bool oneShot;
int typeOfDamage;
public:
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL, int _damage = -1, bool _oneShot = true, int typeOfDamage = DAMAGE_ALL_TYPES);
WEvent * replace(WEvent *e);
~REDamagePrevention();
};
class ReplacementEffects
{
protected:
list<ReplacementEffect *> modifiers;
public:
ReplacementEffects();
WEvent * replace(WEvent *e);
int add(ReplacementEffect * re);
int remove(ReplacementEffect * re);
~ReplacementEffects();
};
#endif
#ifndef _REPLACEMENT_EFFECTS_H_
#define _REPLACEMENT_EFFECTS_H_
#include <list>
using namespace std;
#include "Damage.h"
#include "WEvent.h"
class TargetChooser;
class MTGAbility;
class ReplacementEffect
{
public:
virtual WEvent * replace(WEvent * e)
{
return e;
}
;
virtual ~ReplacementEffect() {}
};
class REDamagePrevention: public ReplacementEffect
{
protected:
MTGAbility * source;
TargetChooser * tcSource;
TargetChooser * tcTarget;
int damage;
bool oneShot;
int typeOfDamage;
public:
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL, int _damage = -1, bool _oneShot = true, int typeOfDamage = DAMAGE_ALL_TYPES);
WEvent * replace(WEvent *e);
~REDamagePrevention();
};
class ReplacementEffects
{
protected:
list<ReplacementEffect *> modifiers;
public:
ReplacementEffects();
WEvent * replace(WEvent *e);
int add(ReplacementEffect * re);
int remove(ReplacementEffect * re);
~ReplacementEffects();
};
#endif

View File

@@ -1,58 +1,58 @@
/*
* SimplePopup.h
* Created on: Nov 18, 2010
*
* Simple popup dialog box for displaying information only.
*/
#ifndef SIMPLEPOPUP_H_
#define SIMPLEPOPUP_H_
#pragma once
#include <JGui.h>
#include <JTypes.h>
#include <WFont.h>
#include <DeckMetaData.h>
class SimplePopup: public JGuiController
{
private:
float mWidth, mX, mY;
int mMaxLines;
int mFontId;
DeckMetaData * mDeckInformation;
string mTitle;
WFont *mTextFont;
StatsWrapper *mStatsWrapper;
bool mClosed;
MTGAllCards * mCollection;
void drawHorzPole(string imageName, bool flipX, bool flipY, float x, float y, float width);
void drawCorner(string imageName, bool flipX, bool flipY, float x, float y);
void drawVertPole(string imageName, bool flipX, bool flipY, float x, float y, float height);
public:
bool autoTranslate;
SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title = "", DeckMetaData* deckInfo = NULL, MTGAllCards * collection = NULL);
~SimplePopup(void);
void drawBoundingBox(float x, float y, float width, float height);
bool isClosed()
{
return mClosed;
}
MTGAllCards* getCollection()
{
return mCollection;
}
void Render();
void Update(DeckMetaData* deckMetaData);
string getDetailedInformation(string deckFilename);
void Update(float dt);
void Close();
};
#endif /* SIMPLEPOPUP_H_ */
/*
* SimplePopup.h
* Created on: Nov 18, 2010
*
* Simple popup dialog box for displaying information only.
*/
#ifndef SIMPLEPOPUP_H_
#define SIMPLEPOPUP_H_
#pragma once
#include <JGui.h>
#include <JTypes.h>
#include <WFont.h>
#include <DeckMetaData.h>
class SimplePopup: public JGuiController
{
private:
float mWidth, mX, mY;
int mMaxLines;
int mFontId;
DeckMetaData * mDeckInformation;
string mTitle;
WFont *mTextFont;
StatsWrapper *mStatsWrapper;
bool mClosed;
MTGAllCards * mCollection;
void drawHorzPole(string imageName, bool flipX, bool flipY, float x, float y, float width);
void drawCorner(string imageName, bool flipX, bool flipY, float x, float y);
void drawVertPole(string imageName, bool flipX, bool flipY, float x, float y, float height);
public:
bool autoTranslate;
SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title = "", DeckMetaData* deckInfo = NULL, MTGAllCards * collection = NULL);
~SimplePopup(void);
void drawBoundingBox(float x, float y, float width, float height);
bool isClosed()
{
return mClosed;
}
MTGAllCards* getCollection()
{
return mCollection;
}
void Render();
void Update(DeckMetaData* deckMetaData);
string getDetailedInformation(string deckFilename);
void Update(float dt);
void Close();
};
#endif /* SIMPLEPOPUP_H_ */

View File

@@ -1,55 +1,55 @@
#ifndef _TEXTSCROLLER_H_
#define _TEXTSCROLLER_H_
class JLBFont;
#include <JGui.h>
#include <string>
#include <vector>
using namespace std;
class TextScroller: public JGuiObject
{
protected:
string mText;
string tempText;
int fontId;
float mWidth; // width of the text scroller object
float mScrollSpeed;
float mX;
float mY;
float start;
int timer;
vector<string> strings;
unsigned int currentId;
int mRandom;
int scrollDirection;
public:
TextScroller(int fontId, float x, float y, float width, float speed = 30);
void Add(string text);
void Reset();
void setRandom(int mode = 1);
void Render();
void Update(float dt);
virtual ostream& toString(ostream& out) const;
};
class VerticalTextScroller: public TextScroller
{
private:
size_t mNbItemsShown;
float mHeight; // maximum height availble for display
float mMarginX;
float mMarginY; // margin used to allow text to scroll off screen without
// affecting look and feel. Should be enough
// for at least one line of text ( mY - line height of current font )
float mOriginalY; // mY initially, used to restore scroller to original position after update
public:
VerticalTextScroller(int fontId, float x, float y, float width, float height, float scrollSpeed = 30, size_t _minimumItems = 1);
void Render();
void Update(float dt);
void Add(string text);
};
#endif
#ifndef _TEXTSCROLLER_H_
#define _TEXTSCROLLER_H_
class JLBFont;
#include <JGui.h>
#include <string>
#include <vector>
using namespace std;
class TextScroller: public JGuiObject
{
protected:
string mText;
string tempText;
int fontId;
float mWidth; // width of the text scroller object
float mScrollSpeed;
float mX;
float mY;
float start;
int timer;
vector<string> strings;
unsigned int currentId;
int mRandom;
int scrollDirection;
public:
TextScroller(int fontId, float x, float y, float width, float speed = 30);
void Add(string text);
void Reset();
void setRandom(int mode = 1);
void Render();
void Update(float dt);
virtual ostream& toString(ostream& out) const;
};
class VerticalTextScroller: public TextScroller
{
private:
size_t mNbItemsShown;
float mHeight; // maximum height availble for display
float mMarginX;
float mMarginY; // margin used to allow text to scroll off screen without
// affecting look and feel. Should be enough
// for at least one line of text ( mY - line height of current font )
float mOriginalY; // mY initially, used to restore scroller to original position after update
public:
VerticalTextScroller(int fontId, float x, float y, float width, float height, float scrollSpeed = 30, size_t _minimumItems = 1);
void Render();
void Update(float dt);
void Add(string text);
};
#endif

View File

@@ -1,13 +1,13 @@
#ifndef _TOKEN_H_
#define _TOKEN_H_
#include "MTGCardInstance.h"
class Token: public MTGCardInstance
{
MTGCardInstance * tokenSource;
public:
Token(string _name, MTGCardInstance * source, int _power = 0, int _toughness = 0);
};
#endif
#ifndef _TOKEN_H_
#define _TOKEN_H_
#include "MTGCardInstance.h"
class Token: public MTGCardInstance
{
MTGCardInstance * tokenSource;
public:
Token(string _name, MTGCardInstance * source, int _power = 0, int _toughness = 0);
};
#endif