Jeck - "Fix" to issue 247 (see issue for notes), added additional award ("Collection valued over 10,000 credits"), minor enhancement to trophy room UI (floating "O - Details" notification).
The new award will need some art before we ship, but it won't take too much work to add that :)
This commit is contained in:
@@ -65,6 +65,7 @@ public:
|
|||||||
MOMIR_MODE_UNLOCKED,
|
MOMIR_MODE_UNLOCKED,
|
||||||
EVILTWIN_MODE_UNLOCKED,
|
EVILTWIN_MODE_UNLOCKED,
|
||||||
RANDOMDECK_MODE_UNLOCKED,
|
RANDOMDECK_MODE_UNLOCKED,
|
||||||
|
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.
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class GameStateAwards: public GameState, public JGuiListener
|
|||||||
public:
|
public:
|
||||||
GameStateAwards(GameApp* parent);
|
GameStateAwards(GameApp* parent);
|
||||||
bool enterSet(int setid);
|
bool enterSet(int setid);
|
||||||
|
bool enterStats(int option);
|
||||||
virtual ~GameStateAwards();
|
virtual ~GameStateAwards();
|
||||||
|
|
||||||
virtual void Start();
|
virtual void Start();
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public:
|
|||||||
virtual JQuad * getImage();
|
virtual JQuad * getImage();
|
||||||
WSrcImage(string s);
|
WSrcImage(string s);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
string filename;
|
string filename;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -242,14 +242,17 @@ protected:
|
|||||||
|
|
||||||
class WGuiAward: public WGuiItem{
|
class WGuiAward: public WGuiItem{
|
||||||
public:
|
public:
|
||||||
WGuiAward(int _id, string name, string _text);
|
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();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
string details;
|
||||||
int id;
|
int id;
|
||||||
string text;
|
string text;
|
||||||
};
|
};
|
||||||
@@ -345,7 +348,7 @@ protected:
|
|||||||
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();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ class PriceList{
|
|||||||
int save();
|
int save();
|
||||||
int getPrice(int cardId);
|
int getPrice(int cardId);
|
||||||
int setPrice(int cardId, int price);
|
int setPrice(int cardId, int price);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ const char * Options::optionNames[] = {
|
|||||||
"prx_rimom",
|
"prx_rimom",
|
||||||
"prx_eviltwin",
|
"prx_eviltwin",
|
||||||
"prx_rnddeck",
|
"prx_rnddeck",
|
||||||
|
"aw_collector",
|
||||||
};
|
};
|
||||||
int Options::getID(string name){
|
int Options::getID(string name){
|
||||||
if(!name.size())
|
if(!name.size())
|
||||||
@@ -825,6 +826,7 @@ bool GameOptionAward::giveAward(){
|
|||||||
achieved = time(NULL);
|
achieved = time(NULL);
|
||||||
viewed = false;
|
viewed = false;
|
||||||
number = 1;
|
number = 1;
|
||||||
|
options.save(); //TODO - Consider efficiency of this placement.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "../include/Translate.h"
|
#include "../include/Translate.h"
|
||||||
#include "../include/OptionItem.h"
|
#include "../include/OptionItem.h"
|
||||||
#include "../include/GameOptions.h"
|
#include "../include/GameOptions.h"
|
||||||
|
#include "../include/DeckDataWrapper.h"
|
||||||
|
|
||||||
enum ENUM_AWARDS_STATE{
|
enum ENUM_AWARDS_STATE{
|
||||||
STATE_LISTVIEW,
|
STATE_LISTVIEW,
|
||||||
@@ -30,6 +31,7 @@ void GameStateAwards::End()
|
|||||||
SAFE_DELETE(listview);
|
SAFE_DELETE(listview);
|
||||||
SAFE_DELETE(setSrc);
|
SAFE_DELETE(setSrc);
|
||||||
|
|
||||||
|
resources.Release(mBgTex);
|
||||||
if(saveMe)
|
if(saveMe)
|
||||||
options.save();
|
options.save();
|
||||||
}
|
}
|
||||||
@@ -38,6 +40,7 @@ void GameStateAwards::Start()
|
|||||||
char buf[256];
|
char buf[256];
|
||||||
mState = STATE_LISTVIEW;
|
mState = STATE_LISTVIEW;
|
||||||
options.checkProfile();
|
options.checkProfile();
|
||||||
|
//resources.ClearUnlocked(); //Last resort.
|
||||||
|
|
||||||
menu = NULL;
|
menu = NULL;
|
||||||
saveMe = options.newAward();
|
saveMe = options.newAward();
|
||||||
@@ -51,8 +54,6 @@ void GameStateAwards::Start()
|
|||||||
|
|
||||||
WGuiHeader * wgh = NEW WGuiHeader("Achievements");
|
WGuiHeader * wgh = NEW WGuiHeader("Achievements");
|
||||||
listview->Add(wgh);
|
listview->Add(wgh);
|
||||||
wgh = NEW WGuiHeader("");
|
|
||||||
listview->Add(wgh);
|
|
||||||
|
|
||||||
aw = NEW WGuiAward(Options::DIFFICULTY_MODE_UNLOCKED,"Difficulty Modes","Achieved a 66% victory ratio.");
|
aw = NEW WGuiAward(Options::DIFFICULTY_MODE_UNLOCKED,"Difficulty Modes","Achieved a 66% victory ratio.");
|
||||||
btn = NEW WGuiButton(aw,-103,Options::DIFFICULTY_MODE_UNLOCKED,this);
|
btn = NEW WGuiButton(aw,-103,Options::DIFFICULTY_MODE_UNLOCKED,this);
|
||||||
@@ -70,7 +71,13 @@ void GameStateAwards::Start()
|
|||||||
btn = NEW WGuiButton(aw,-103,Options::RANDOMDECK_MODE_UNLOCKED,this);
|
btn = NEW WGuiButton(aw,-103,Options::RANDOMDECK_MODE_UNLOCKED,this);
|
||||||
listview->Add(btn);
|
listview->Add(btn);
|
||||||
|
|
||||||
listview->Add(NEW WGuiHeader("Click a set for details."));
|
aw = NEW WGuiAward(Options::AWARD_COLLECTOR,"Valuable Collection","Collection valued over 10,000c.","Collection Info");
|
||||||
|
btn = NEW WGuiButton(aw,-103,Options::AWARD_COLLECTOR,this);
|
||||||
|
listview->Add(btn);
|
||||||
|
|
||||||
|
wgh = NEW WGuiHeader("");
|
||||||
|
listview->Add(wgh);
|
||||||
|
|
||||||
int locked = 0;
|
int locked = 0;
|
||||||
for (int i = 0; i < setlist.size(); i++){
|
for (int i = 0; i < setlist.size(); i++){
|
||||||
MTGSetInfo * si = setlist.getInfo(i);
|
MTGSetInfo * si = setlist.getInfo(i);
|
||||||
@@ -89,7 +96,7 @@ void GameStateAwards::Start()
|
|||||||
sprintf(buf,"%s: %i cards.",si->author.c_str(),si->totalCards());
|
sprintf(buf,"%s: %i cards.",si->author.c_str(),si->totalCards());
|
||||||
|
|
||||||
|
|
||||||
aw = NEW WGuiAward(Options::optionSet(i),si->getName(),buf);
|
aw = NEW WGuiAward(Options::optionSet(i),si->getName(),buf,"Card Spoiler");
|
||||||
btn = NEW WGuiButton(aw,-103,Options::optionSet(i),this);
|
btn = NEW WGuiButton(aw,-103,Options::optionSet(i),this);
|
||||||
listview->Add(btn);
|
listview->Add(btn);
|
||||||
}
|
}
|
||||||
@@ -104,6 +111,8 @@ void GameStateAwards::Start()
|
|||||||
detailview = NULL;
|
detailview = NULL;
|
||||||
setSrc = NULL;
|
setSrc = NULL;
|
||||||
showMenu = false;
|
showMenu = false;
|
||||||
|
mBgTex = resources.RetrieveTexture("awardback.jpg");
|
||||||
|
mBg = resources.RetrieveQuad("awardback.jpg");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameStateAwards::Create()
|
void GameStateAwards::Create()
|
||||||
@@ -117,8 +126,9 @@ void GameStateAwards::Destroy()
|
|||||||
void GameStateAwards::Render()
|
void GameStateAwards::Render()
|
||||||
{
|
{
|
||||||
JRenderer * r = JRenderer::GetInstance();
|
JRenderer * r = JRenderer::GetInstance();
|
||||||
JQuad * bg = resources.RetrieveTempQuad("awardback.jpg");
|
r->ClearScreen(ARGB(0,0,0,0));
|
||||||
r->RenderQuad(bg, 0, 0);
|
if(mBg)
|
||||||
|
r->RenderQuad(mBg, 0, 0);
|
||||||
|
|
||||||
switch(mState){
|
switch(mState){
|
||||||
case STATE_LISTVIEW:
|
case STATE_LISTVIEW:
|
||||||
@@ -202,7 +212,7 @@ bool GameStateAwards::enterSet(int setid){
|
|||||||
spoiler->setWidth(SCREEN_WIDTH - 220);
|
spoiler->setWidth(SCREEN_WIDTH - 220);
|
||||||
MTGAllCards * c = GameApp::collection;
|
MTGAllCards * c = GameApp::collection;
|
||||||
for(it = c->collection.begin();it!=c->collection.end();it++){
|
for(it = c->collection.begin();it!=c->collection.end();it++){
|
||||||
if(it->second && it->second->setId == setid)
|
if(it->second && it->second->setId == setid && it->second->getId() >= 0) //Add only non-tokens from this set.
|
||||||
spoiler->Add(NEW WGuiItem(it->second->name));
|
spoiler->Add(NEW WGuiItem(it->second->name));
|
||||||
}
|
}
|
||||||
spoiler->Entering(0);
|
spoiler->Entering(0);
|
||||||
@@ -214,6 +224,93 @@ bool GameStateAwards::enterSet(int setid){
|
|||||||
detailview->Entering(0);
|
detailview->Entering(0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
bool GameStateAwards::enterStats(int option){
|
||||||
|
if(option != Options::AWARD_COLLECTOR)
|
||||||
|
return false;
|
||||||
|
DeckDataWrapper* ddw = NEW DeckDataWrapper(NEW MTGDeck(options.profileFile(PLAYER_COLLECTION).c_str(), mParent->collection));
|
||||||
|
if(!ddw)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
SAFE_DELETE(detailview);
|
||||||
|
detailview = NEW WGuiList("Details");
|
||||||
|
|
||||||
|
detailview->Add(NEW WGuiHeader("Collection Stats"));
|
||||||
|
detailview->Entering(0);
|
||||||
|
|
||||||
|
//Discover favorite set and unique cards
|
||||||
|
int unique = 0;
|
||||||
|
|
||||||
|
if(setlist.size() > 0){
|
||||||
|
int * counts = (int*)calloc(setlist.size(),sizeof(int));
|
||||||
|
int setid = -1;
|
||||||
|
int dupes = 0;
|
||||||
|
MTGCard * many = NULL;
|
||||||
|
MTGCard * costly = NULL;
|
||||||
|
MTGCard * strong = NULL;
|
||||||
|
MTGCard * tough = NULL;
|
||||||
|
map<MTGCard *,int,Cmp1>::iterator it;
|
||||||
|
|
||||||
|
for (it = ddw->cards.begin(); it!=ddw->cards.end(); it++){
|
||||||
|
MTGCard * c = it->first;
|
||||||
|
if(!c)
|
||||||
|
continue;
|
||||||
|
if(!c->isLand() && (many == NULL || it->second > dupes)){
|
||||||
|
many = c;
|
||||||
|
dupes = it->second;
|
||||||
|
}
|
||||||
|
unique++;
|
||||||
|
counts[c->setId]+=it->second;
|
||||||
|
if(costly == NULL
|
||||||
|
|| c->getManaCost()->getConvertedCost() > costly->getManaCost()->getConvertedCost())
|
||||||
|
costly = c;
|
||||||
|
|
||||||
|
if(c->isCreature() && (strong == NULL || c->getPower() > strong->getPower()))
|
||||||
|
strong = c;
|
||||||
|
|
||||||
|
if(c->isCreature() && (tough == NULL || c->getToughness() > tough->getToughness()))
|
||||||
|
tough = c;
|
||||||
|
|
||||||
|
}
|
||||||
|
for(int i=0;i<setlist.size();i++){
|
||||||
|
if(setid < 0 || counts[i] > counts[setid])
|
||||||
|
setid = i;
|
||||||
|
}
|
||||||
|
free(counts);
|
||||||
|
|
||||||
|
char buf[1024];
|
||||||
|
sprintf(buf,_("Total Value: %ic").c_str(),ddw->totalPrice());
|
||||||
|
detailview->Add(NEW WGuiItem(buf));//ddw->colors
|
||||||
|
|
||||||
|
sprintf(buf,_("Total Cards (including duplicates): %i").c_str(),ddw->getCount());
|
||||||
|
detailview->Add(NEW WGuiItem(buf));//ddw->colors
|
||||||
|
|
||||||
|
sprintf(buf,_("Unique Cards: %i").c_str(),unique);
|
||||||
|
detailview->Add(NEW WGuiItem(buf));
|
||||||
|
|
||||||
|
if(many){
|
||||||
|
sprintf(buf,_("Most Duplicates: %i (%s)").c_str(),dupes,many->getName().c_str());
|
||||||
|
detailview->Add(NEW WGuiItem(buf));
|
||||||
|
}
|
||||||
|
if(setid >= 0){
|
||||||
|
sprintf(buf,_("Favorite Set: %s").c_str(),setlist[setid].c_str());
|
||||||
|
detailview->Add(NEW WGuiItem(buf));
|
||||||
|
}
|
||||||
|
if(costly){
|
||||||
|
sprintf(buf,_("Highest Mana Cost: %i (%s)").c_str(),costly->getManaCost()->getConvertedCost(),costly->getName().c_str());
|
||||||
|
detailview->Add(NEW WGuiItem(buf));
|
||||||
|
}
|
||||||
|
if(strong){
|
||||||
|
sprintf(buf,_("Most Powerful: %i (%s)").c_str(),strong->getPower(),strong->getName().c_str());
|
||||||
|
detailview->Add(NEW WGuiItem(buf));
|
||||||
|
}
|
||||||
|
if(tough){
|
||||||
|
sprintf(buf,_("Toughest: %i (%s)").c_str(),tough->getToughness(),strong->getName().c_str());
|
||||||
|
detailview->Add(NEW WGuiItem(buf));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
void GameStateAwards::ButtonPressed(int controllerId, int controlId)
|
void GameStateAwards::ButtonPressed(int controllerId, int controlId)
|
||||||
{
|
{
|
||||||
if(controllerId == -102)
|
if(controllerId == -102)
|
||||||
@@ -232,12 +329,14 @@ void GameStateAwards::ButtonPressed(int controllerId, int controlId)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(controllerId == -103){
|
else if(controllerId == -103){
|
||||||
//Enter "Details Mode" for that item. TODO: Details for non-sets
|
int setid = controlId-Options::SET_UNLOCKS;
|
||||||
if(controlId >= Options::SET_UNLOCKS){
|
|
||||||
|
if(controlId >= Options::SET_UNLOCKS && enterSet(setid)){
|
||||||
mState = STATE_DETAILS;
|
mState = STATE_DETAILS;
|
||||||
mDetailItem = controlId;
|
mDetailItem = controlId;
|
||||||
int setid = controlId-Options::SET_UNLOCKS;
|
|
||||||
enterSet(setid);
|
}else if(controlId == Options::AWARD_COLLECTOR && enterStats(controlId)){
|
||||||
|
mState = STATE_DETAILS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,6 @@ void WGuiItem::Render(){
|
|||||||
float fH = (height-mFont->GetHeight())/2;
|
float fH = (height-mFont->GetHeight())/2;
|
||||||
mFont->DrawString(_(displayValue).c_str(),x+(width/2),y+fH,JGETEXT_CENTER);
|
mFont->DrawString(_(displayValue).c_str(),x+(width/2),y+fH,JGETEXT_CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
WGuiItem::WGuiItem(string _display){
|
WGuiItem::WGuiItem(string _display){
|
||||||
displayValue = _display;
|
displayValue = _display;
|
||||||
mFocus = false;
|
mFocus = false;
|
||||||
@@ -1220,6 +1219,29 @@ void WGuiTabMenu::save(){
|
|||||||
|
|
||||||
|
|
||||||
//WGuiAward
|
//WGuiAward
|
||||||
|
void WGuiAward::Overlay(){
|
||||||
|
JRenderer * r = JRenderer::GetInstance();
|
||||||
|
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||||
|
mFont->SetScale(.8);
|
||||||
|
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||||
|
|
||||||
|
string s = _(details);
|
||||||
|
if(s.size()){
|
||||||
|
float fW = mFont->GetStringWidth(s.c_str());
|
||||||
|
float fH = mFont->GetHeight();
|
||||||
|
|
||||||
|
if(fH < 16)
|
||||||
|
fH = 18;
|
||||||
|
JQuad * button = resources.RetrieveQuad("iconspsp.png", (float)4*32, 0, 32, 32,"",RETRIEVE_NORMAL);
|
||||||
|
|
||||||
|
r->FillRoundRect(5,10,fW+32,fH+2,2,getColor(WGuiColor::BACK));
|
||||||
|
if(button)
|
||||||
|
r->RenderQuad(button, 10,12,0,.5,.5);
|
||||||
|
mFont->DrawString(s,30,16);
|
||||||
|
}
|
||||||
|
|
||||||
|
mFont->SetScale(1);
|
||||||
|
}
|
||||||
void WGuiAward::Underlay(){
|
void WGuiAward::Underlay(){
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
JRenderer * r = JRenderer::GetInstance();
|
JRenderer * r = JRenderer::GetInstance();
|
||||||
@@ -1278,13 +1300,14 @@ void WGuiAward::Render(){
|
|||||||
}
|
}
|
||||||
setHeight(myY-y);
|
setHeight(myY-y);
|
||||||
mFont->SetScale(1);
|
mFont->SetScale(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WGuiAward::WGuiAward(int _id, string name, string _text): WGuiItem(name){
|
WGuiAward::WGuiAward(int _id, string name, string _text, string _details): WGuiItem(name){
|
||||||
id = _id;
|
id = _id;
|
||||||
text = _text;
|
text = _text;
|
||||||
height = 60;
|
height = 60;
|
||||||
|
details = _details;
|
||||||
}
|
}
|
||||||
WGuiAward::~WGuiAward(){
|
WGuiAward::~WGuiAward(){
|
||||||
GameOptionAward * goa = dynamic_cast<GameOptionAward*>(&options[id]);
|
GameOptionAward * goa = dynamic_cast<GameOptionAward*>(&options[id]);
|
||||||
@@ -1379,7 +1402,6 @@ JQuad * WSrcImage::getImage(){
|
|||||||
WSrcImage::WSrcImage(string s){
|
WSrcImage::WSrcImage(string s){
|
||||||
filename = s;
|
filename = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
//WSrcMTGSet
|
//WSrcMTGSet
|
||||||
WSrcMTGSet::WSrcMTGSet(int setid, float delay){
|
WSrcMTGSet::WSrcMTGSet(int setid, float delay){
|
||||||
MTGAllCards * ac = GameApp::collection;
|
MTGAllCards * ac = GameApp::collection;
|
||||||
|
|||||||
@@ -448,6 +448,12 @@ void ShopItems::ButtonPressed(int controllerId, int controlId){
|
|||||||
}
|
}
|
||||||
delete tempDeck;
|
delete tempDeck;
|
||||||
}
|
}
|
||||||
|
//Check if we just scored an award...
|
||||||
|
if(myCollection && myCollection->totalPrice() > 10000){
|
||||||
|
GameOptionAward * goa = dynamic_cast<GameOptionAward *>(&options[Options::AWARD_COLLECTOR]);
|
||||||
|
if(goa)
|
||||||
|
goa->giveAward();
|
||||||
|
}
|
||||||
showPriceDialog = -1;
|
showPriceDialog = -1;
|
||||||
}else{
|
}else{
|
||||||
//error not enough money
|
//error not enough money
|
||||||
|
|||||||
Reference in New Issue
Block a user