Jeck - Linked both sets into one filter menu. Requires more testing, but appears to work on PSP/PC as it should.
This commit is contained in:
@@ -108,8 +108,10 @@ private:
|
|||||||
int useFilter;
|
int useFilter;
|
||||||
JMusic * bgMusic;
|
JMusic * bgMusic;
|
||||||
JQuad * backQuad;
|
JQuad * backQuad;
|
||||||
WGuiFilters * filterDeck;
|
|
||||||
WGuiFilters * filterCollection;
|
WGuiFilters * filterMenu;
|
||||||
|
WSrcDeckViewer * source;
|
||||||
|
|
||||||
SimpleMenu * welcome_menu;
|
SimpleMenu * welcome_menu;
|
||||||
SimpleMenu * subMenu;
|
SimpleMenu * subMenu;
|
||||||
SimpleMenu * menu;
|
SimpleMenu * menu;
|
||||||
|
|||||||
@@ -107,6 +107,44 @@ protected:
|
|||||||
float mDelay;
|
float mDelay;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class WSrcDeckViewer: public WSrcCards{
|
||||||
|
public:
|
||||||
|
WSrcDeckViewer(WSrcCards * _active, WSrcCards * _inactive);
|
||||||
|
~WSrcDeckViewer();
|
||||||
|
void swapSrc();
|
||||||
|
|
||||||
|
//Wrapped functions
|
||||||
|
JQuad * getImage(int offset=0) {return active->getImage(offset);};
|
||||||
|
JQuad * getThumb(int offset=0) {return active->getThumb(offset);};
|
||||||
|
MTGCard * getCard(int offset=0, bool ignore=false) {return active->getCard(offset,ignore);};
|
||||||
|
int Size(bool all=false) {return active->Size();};
|
||||||
|
void Shuffle() {active->Shuffle();};
|
||||||
|
bool thisCard(int mtgid) {return active->thisCard(mtgid);};
|
||||||
|
bool next() {return active->next();};
|
||||||
|
bool prev() {return active->prev();};
|
||||||
|
void Sort(int method) {active->Sort(method);};
|
||||||
|
bool setOffset(int pos) {return active->setOffset(pos);};
|
||||||
|
bool isEmptySet(WCardFilter * f) {return active->isEmptySet(f);};
|
||||||
|
void addFilter(WCardFilter * f) {active->addFilter(f);};
|
||||||
|
void clearFilters() {active->clearFilters();};
|
||||||
|
WCardFilter* unhookFilters() {return active->unhookFilters();};
|
||||||
|
bool matchesFilters(MTGCard * c) {return active->matchesFilters(c);};
|
||||||
|
void validate() {active->validate();};
|
||||||
|
void bakeFilters() {active->bakeFilters();}; //Discards all invalidated cards.
|
||||||
|
float filterFee() {return active->filterFee();};
|
||||||
|
void updateCounts() {active->updateCounts();};
|
||||||
|
void clearCounts() {active->clearCounts();};
|
||||||
|
void addCount(MTGCard * c, int qty=1) { active->addCount(c,qty); };
|
||||||
|
int loadMatches(MTGAllCards* ac) {return active->loadMatches(ac);};
|
||||||
|
int loadMatches(MTGDeck * deck) {return active->loadMatches(deck);};
|
||||||
|
int loadMatches(WSrcCards* src, bool all=false) {return loadMatches(src,all);};
|
||||||
|
int addRandomCards(MTGDeck * i, int howmany=1) {return active->addRandomCards(i,howmany);};
|
||||||
|
int addToDeck(MTGDeck * i, int num=-1) {return active->addToDeck(i,num);};
|
||||||
|
protected:
|
||||||
|
WSrcCards * active;
|
||||||
|
WSrcCards * inactive;
|
||||||
|
};
|
||||||
|
|
||||||
class WSrcUnlockedCards: public WSrcCards{ //Only unlocked cards.
|
class WSrcUnlockedCards: public WSrcCards{ //Only unlocked cards.
|
||||||
public:
|
public:
|
||||||
WSrcUnlockedCards(float mDelay=0.2);
|
WSrcUnlockedCards(float mDelay=0.2);
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ GameStateDeckViewer::GameStateDeckViewer(GameApp* parent): GameState(parent) {
|
|||||||
welcome_menu = NULL;
|
welcome_menu = NULL;
|
||||||
myCollection = NULL;
|
myCollection = NULL;
|
||||||
myDeck = NULL;
|
myDeck = NULL;
|
||||||
filterDeck = NULL;
|
filterMenu = NULL;
|
||||||
filterCollection = NULL;
|
source = NULL;
|
||||||
hudAlpha = 0;
|
hudAlpha = 0;
|
||||||
subMenu = NULL;
|
subMenu = NULL;
|
||||||
mRotation = 0;
|
mRotation = 0;
|
||||||
@@ -54,8 +54,7 @@ GameStateDeckViewer::~GameStateDeckViewer() {
|
|||||||
SAFE_DELETE(myCollection->parent);
|
SAFE_DELETE(myCollection->parent);
|
||||||
SAFE_DELETE(myCollection);
|
SAFE_DELETE(myCollection);
|
||||||
}
|
}
|
||||||
SAFE_DELETE(filterDeck);
|
SAFE_DELETE(filterMenu);
|
||||||
SAFE_DELETE(filterCollection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -68,25 +67,17 @@ void GameStateDeckViewer::rotateCards(int direction){
|
|||||||
loadIndexes();
|
loadIndexes();
|
||||||
}
|
}
|
||||||
void GameStateDeckViewer::rebuildFilters(){
|
void GameStateDeckViewer::rebuildFilters(){
|
||||||
SAFE_DELETE(filterDeck);
|
SAFE_DELETE(filterMenu);
|
||||||
SAFE_DELETE(filterCollection);
|
SAFE_DELETE(source);
|
||||||
filterCollection = NEW WGuiFilters("Filter by...",myCollection);
|
source = NEW WSrcDeckViewer(myDeck,myCollection);
|
||||||
filterDeck = NEW WGuiFilters("Filter by...",myDeck);
|
if(displayed_deck != myDeck) source->swapSrc();
|
||||||
filterDeck->Finish(true);
|
filterMenu = NEW WGuiFilters("Filter by...",source);
|
||||||
filterCollection->Finish(true);
|
filterMenu->Finish(true);
|
||||||
}
|
}
|
||||||
void GameStateDeckViewer::updateFilters(){
|
void GameStateDeckViewer::updateFilters(){
|
||||||
if(!displayed_deck) return;
|
if(!displayed_deck) return;
|
||||||
// displayed_deck->clearFilters();
|
filterMenu->recolorFilter(useFilter-1);
|
||||||
int i = (displayed_deck == myDeck);
|
filterMenu->Finish(true);
|
||||||
if(i && filterDeck){
|
|
||||||
filterDeck->recolorFilter(useFilter-1);
|
|
||||||
filterDeck->Finish(true);
|
|
||||||
}
|
|
||||||
else if(filterCollection){
|
|
||||||
filterCollection->recolorFilter(useFilter-1);
|
|
||||||
filterCollection->Finish(true);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void GameStateDeckViewer::loadIndexes(){
|
void GameStateDeckViewer::loadIndexes(){
|
||||||
@@ -102,6 +93,7 @@ void GameStateDeckViewer::switchDisplay(){
|
|||||||
}else{
|
}else{
|
||||||
displayed_deck = myCollection;
|
displayed_deck = myCollection;
|
||||||
}
|
}
|
||||||
|
source->swapSrc();
|
||||||
updateFilters();
|
updateFilters();
|
||||||
loadIndexes();
|
loadIndexes();
|
||||||
}
|
}
|
||||||
@@ -212,8 +204,8 @@ void GameStateDeckViewer::End()
|
|||||||
}
|
}
|
||||||
SAFE_DELETE(pricelist);
|
SAFE_DELETE(pricelist);
|
||||||
SAFE_DELETE(playerdata);
|
SAFE_DELETE(playerdata);
|
||||||
SAFE_DELETE(filterDeck);
|
SAFE_DELETE(filterMenu);
|
||||||
SAFE_DELETE(filterCollection);
|
SAFE_DELETE(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -331,13 +323,8 @@ void GameStateDeckViewer::Update(float dt)
|
|||||||
break;
|
break;
|
||||||
case JGE_BTN_CTRL :
|
case JGE_BTN_CTRL :
|
||||||
mStage = STAGE_FILTERS;
|
mStage = STAGE_FILTERS;
|
||||||
if (displayed_deck == myDeck) {
|
rebuildFilters();
|
||||||
if (!filterDeck) rebuildFilters();
|
filterMenu->Entering(JGE_BTN_NONE);
|
||||||
filterDeck->Entering(JGE_BTN_NONE);
|
|
||||||
} else if(displayed_deck == myCollection) {
|
|
||||||
if (!filterCollection) rebuildFilters();
|
|
||||||
filterCollection->Entering(JGE_BTN_NONE);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case JGE_BTN_PREV :
|
case JGE_BTN_PREV :
|
||||||
if (last_user_activity < NO_USER_ACTIVITY_HELP_DELAY)
|
if (last_user_activity < NO_USER_ACTIVITY_HELP_DELAY)
|
||||||
@@ -418,43 +405,22 @@ void GameStateDeckViewer::Update(float dt)
|
|||||||
menu->Update(dt);
|
menu->Update(dt);
|
||||||
else if(mStage == STAGE_FILTERS){
|
else if(mStage == STAGE_FILTERS){
|
||||||
JButton key = mEngine->ReadButton();
|
JButton key = mEngine->ReadButton();
|
||||||
|
if (filterMenu) {
|
||||||
if (displayed_deck == myDeck) {
|
if (key == JGE_BTN_CTRL) {
|
||||||
if (filterDeck) {
|
useFilter = 0;
|
||||||
if (key == JGE_BTN_CTRL) {
|
filterMenu->Finish(true);
|
||||||
useFilter = 0;
|
filterMenu->Update(dt);
|
||||||
filterDeck->Finish(true);
|
loadIndexes();
|
||||||
filterDeck->Update(dt);
|
return;
|
||||||
loadIndexes();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!filterDeck->isFinished()) {
|
|
||||||
filterDeck->CheckUserInput(key);
|
|
||||||
filterDeck->Update(dt);
|
|
||||||
} else {
|
|
||||||
mStage = STAGE_WAITING;
|
|
||||||
updateFilters();
|
|
||||||
loadIndexes();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
if (!filterMenu->isFinished()) {
|
||||||
if (filterCollection) {
|
filterMenu->CheckUserInput(key);
|
||||||
if (key == JGE_BTN_CTRL) {
|
filterMenu->Update(dt);
|
||||||
useFilter = 0;
|
}
|
||||||
filterCollection->Finish(true);
|
else {
|
||||||
filterCollection->Update(dt);
|
mStage = STAGE_WAITING;
|
||||||
updateFilters();
|
updateFilters();
|
||||||
loadIndexes();
|
loadIndexes();
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!filterCollection->isFinished()) {
|
|
||||||
filterCollection->CheckUserInput(key);
|
|
||||||
filterCollection->Update(dt);
|
|
||||||
} else {
|
|
||||||
mStage = STAGE_WAITING;
|
|
||||||
updateFilters();
|
|
||||||
loadIndexes();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1365,13 +1331,8 @@ void GameStateDeckViewer::Render() {
|
|||||||
}
|
}
|
||||||
if (subMenu) subMenu->Render();
|
if (subMenu) subMenu->Render();
|
||||||
|
|
||||||
if(displayed_deck == myDeck){
|
if(filterMenu && !filterMenu->isFinished())
|
||||||
if(filterDeck && !filterDeck->isFinished())
|
filterMenu->Render();
|
||||||
filterDeck->Render();
|
|
||||||
}else{
|
|
||||||
if(filterCollection && !filterCollection->isFinished())
|
|
||||||
filterCollection->Render();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(options.keypadActive())
|
if(options.keypadActive())
|
||||||
options.keypadRender();
|
options.keypadRender();
|
||||||
@@ -1496,11 +1457,11 @@ void GameStateDeckViewer::ButtonPressed(int controllerId, int controlId)
|
|||||||
goa->giveAward();
|
goa->giveAward();
|
||||||
}
|
}
|
||||||
options.save();
|
options.save();
|
||||||
SAFE_DELETE(filterCollection);
|
|
||||||
SAFE_DELETE(myCollection);
|
SAFE_DELETE(myCollection);
|
||||||
myCollection = NEW DeckDataWrapper(playerdata->collection);
|
myCollection = NEW DeckDataWrapper(playerdata->collection);
|
||||||
myCollection->Sort(WSrcCards::SORT_ALPHA);
|
myCollection->Sort(WSrcCards::SORT_ALPHA);
|
||||||
displayed_deck = myCollection;
|
displayed_deck = myCollection;
|
||||||
|
rebuildFilters();
|
||||||
loadIndexes();
|
loadIndexes();
|
||||||
mStage = STAGE_WELCOME;
|
mStage = STAGE_WELCOME;
|
||||||
break;
|
break;
|
||||||
@@ -1537,14 +1498,9 @@ void GameStateDeckViewer::ButtonPressed(int controllerId, int controlId)
|
|||||||
mStage = STAGE_WAITING;
|
mStage = STAGE_WAITING;
|
||||||
break;
|
break;
|
||||||
case 22:
|
case 22:
|
||||||
mStage = STAGE_FILTERS;
|
mStage = STAGE_FILTERS;
|
||||||
if(displayed_deck == myDeck){
|
if(!filterMenu) rebuildFilters();
|
||||||
if(!filterDeck) rebuildFilters();
|
filterMenu->Entering(JGE_BTN_NONE);
|
||||||
filterDeck->Entering(JGE_BTN_NONE);
|
|
||||||
}else if(displayed_deck == myCollection){
|
|
||||||
if(!filterCollection) rebuildFilters();
|
|
||||||
filterCollection->Entering(JGE_BTN_NONE);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -501,7 +501,20 @@ int WSrcDeck::totalPrice(){
|
|||||||
SAFE_DELETE(pricelist);
|
SAFE_DELETE(pricelist);
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
//WSrcDeckViewer
|
||||||
|
WSrcDeckViewer::WSrcDeckViewer(WSrcCards * _active, WSrcCards * _inactive): WSrcCards(0.2) {
|
||||||
|
active = _active;
|
||||||
|
inactive = _inactive;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WSrcDeckViewer::swapSrc(){
|
||||||
|
WSrcCards * temp = active;
|
||||||
|
active = inactive;
|
||||||
|
inactive = temp;
|
||||||
|
}
|
||||||
|
WSrcDeckViewer::~WSrcDeckViewer(){
|
||||||
|
//Do nothing.
|
||||||
|
}
|
||||||
//Sorting methods:
|
//Sorting methods:
|
||||||
int WCSortRarity::rareToInt(char r){
|
int WCSortRarity::rareToInt(char r){
|
||||||
switch(r){
|
switch(r){
|
||||||
|
|||||||
Reference in New Issue
Block a user