Jeck - Basic set metadata support. Also a minor improvement to WGuiImage.

* Metadata is currently only used in exactly one place: the set's "Pretty Name" is displayed when the set is first unlocked. 
* WGuiImage now has a function to set scaling.
This commit is contained in:
wagic.jeck
2009-11-18 09:27:24 +00:00
parent 2f327edb6a
commit 37ad16d90e
16 changed files with 334 additions and 113 deletions
-2
View File
@@ -66,8 +66,6 @@ class MTGCard {
char getRarity();
void setRarity(char _rarity);
const char * getSetName();
//void setImageName( char * value);
char * getImageName ();
+53 -12
View File
@@ -16,25 +16,66 @@ using std::string;
class GameApp;
class MTGCard;
#define SET_METADATA "setinfo.txt"
#define MAX_SETS 100
class MTGSetInfo{
public:
MTGSetInfo(string _id);
string id; //Short name: 10E, RAV, etc. Automatic from folder.
string author; //Author of set, for crediting mod makers, etc.
string name; //Long name: Tenth Edition
int block; //For future use by tournament mode, etc.
int year; //The year the set was released.
//TODO Way to group cards by name, rather than mtgid.
void count(MTGCard * c);
int totalCards();
string getName();
string getBlock();
int boosterCost();
int boosterSize();
class MtgSets{
protected:
public:
int nb_items;
string values[MAX_SETS];
public:
static MtgSets * SetsList;
MtgSets();
int Add(const char * subtype);
int find(string value);
enum {
//For memoized counts
LAND = 0,
COMMON = 1,
UNCOMMON = 2,
RARE = 3,
MAX_RARITY = 4, //For boosters, mythic is part of rare... always.
MYTHIC = 4,
TOTAL_CARDS = 5,
MAX_COUNT = 6
};
bool bZipped; //Is this set's images present as a zip file?
bool bThemeZipped; //[...] in the theme?
int counts[MTGSetInfo::MAX_COUNT];
int booster[MAX_RARITY];
};
class MTGSets{
public:
friend class MTGSetInfo;
MTGSets();
int Add(const char * subtype);
int findSet(string value);
int findBlock(string s);
int size();
int operator[](string id); //Returns set id index, -1 for failure.
string operator[](int id); //Returns set id name, "" for failure.
MTGSetInfo* getInfo(int setID);
protected:
vector<string> blocks;
vector<MTGSetInfo*> setinfo;
};
extern MTGSets setlist;
class MTGAllCards {
private:
+13
View File
@@ -111,6 +111,19 @@ class Constants
RARITY_C = 'C',
RARITY_L = 'L',
//Price for singles
PRICE_1M = 3000,
PRICE_1R = 500,
PRICE_1U = 100,
PRICE_1C = 20,
PRICE_1L = 5,
//Price in booster
PRICE_XM = 2500,
PRICE_XR = 355,
PRICE_XU = 88,
PRICE_XC = 8,
PRICE_XL = 1,
MAIN_FONT = 0,
MENU_FONT = 1,
+2 -1
View File
@@ -270,6 +270,7 @@ public:
virtual void Render();
virtual float getHeight();
virtual void imageScale(float w, float h);
protected:
bool exact;
int margin;
@@ -337,7 +338,7 @@ public:
virtual void Reload();
virtual void Update(float dt);
virtual void ButtonPressed(int controllerId, int controlId);
virtual void Add(WGuiBase* item);
virtual void Add(WGuiBase* item); //Remember, does not set X & Y of items automatically.
virtual void confirmChange(bool confirmed);
WGuiBase * Current();