Jeck - Additional fixes for deck editor. Unfortunately, it still has separate filters for deck and collection, but I'm working on that.
This commit is contained in:
@@ -159,7 +159,6 @@ public:
|
||||
WGuiCardDistort(WDataSource * wds, bool _thumb=false, WDataSource * _distort=NULL);
|
||||
~WGuiCardDistort();
|
||||
virtual void Render();
|
||||
|
||||
WDistort xy;
|
||||
protected:
|
||||
hgeDistortionMesh* mesh;
|
||||
@@ -424,7 +423,7 @@ public:
|
||||
void recolorFilter(int color);
|
||||
bool isAvailable(int type);
|
||||
bool isAvailableCode(string code);
|
||||
bool Finish(); //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;};
|
||||
void ButtonPressed(int controllerId, int controlId);
|
||||
void buildList();
|
||||
@@ -433,7 +432,6 @@ protected:
|
||||
void addArg(string display, string code);
|
||||
vector< pair<string,string> > tempArgs; //TODO FIXME this is inefficient
|
||||
bool bFinished;
|
||||
string priorFilter;
|
||||
int recolorTo;
|
||||
WSrcCards* source;
|
||||
SimpleMenu* subMenu;
|
||||
|
||||
@@ -71,15 +71,15 @@ void GameStateDeckViewer::rotateCards(int direction){
|
||||
}
|
||||
void GameStateDeckViewer::updateFilters(){
|
||||
if(!displayed_deck) return;
|
||||
displayed_deck->clearFilters();
|
||||
// displayed_deck->clearFilters();
|
||||
int i = (displayed_deck == myDeck);
|
||||
if(i && filterDeck){
|
||||
filterDeck->recolorFilter(useFilter-1);
|
||||
filterDeck->Finish();
|
||||
filterDeck->Finish(true);
|
||||
}
|
||||
else if(filterCollection){
|
||||
filterCollection->recolorFilter(useFilter-1);
|
||||
filterCollection->Finish();
|
||||
filterCollection->Finish(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ void GameStateDeckViewer::loadIndexes(){
|
||||
|
||||
void GameStateDeckViewer::switchDisplay(){
|
||||
if (displayed_deck == myCollection){
|
||||
displayed_deck = myDeck;
|
||||
displayed_deck = myDeck;
|
||||
}else{
|
||||
displayed_deck = myCollection;
|
||||
}
|
||||
@@ -112,7 +112,6 @@ void GameStateDeckViewer::updateDecks(){
|
||||
if(options[Options::CHEATMODE].number && (!myCollection || myCollection->getCount(WSrcDeck::UNFILTERED_MIN_COPIES) < 4))
|
||||
welcome_menu->Add(-12,"--UNLOCK CARDS--");
|
||||
welcome_menu->Add(-1, _("Cancel").c_str());
|
||||
|
||||
}
|
||||
|
||||
void GameStateDeckViewer::Start()
|
||||
@@ -134,7 +133,7 @@ void GameStateDeckViewer::Start()
|
||||
myCollection->Sort(WSrcCards::SORT_ALPHA);
|
||||
displayed_deck = myCollection;
|
||||
filterCollection = NEW WGuiFilters("Filter by...",myCollection);
|
||||
filterCollection->Finish();
|
||||
filterCollection->Finish(true);
|
||||
//Build menu.
|
||||
menu = NEW SimpleMenu(11,this,Constants::MENU_FONT,SCREEN_WIDTH/2-150,20);
|
||||
menu->Add(22,"Filter by...");
|
||||
@@ -423,7 +422,7 @@ void GameStateDeckViewer::Update(float dt)
|
||||
if (filterDeck) {
|
||||
if (key == JGE_BTN_CTRL) {
|
||||
useFilter = 0;
|
||||
filterDeck->Finish();
|
||||
filterDeck->Finish(true);
|
||||
filterDeck->Update(dt);
|
||||
loadIndexes();
|
||||
return;
|
||||
@@ -440,7 +439,7 @@ void GameStateDeckViewer::Update(float dt)
|
||||
if (filterCollection) {
|
||||
if (key == JGE_BTN_CTRL) {
|
||||
useFilter = 0;
|
||||
filterCollection->Finish();
|
||||
filterCollection->Finish(true);
|
||||
filterCollection->Update(dt);
|
||||
loadIndexes();
|
||||
return;
|
||||
@@ -1403,7 +1402,7 @@ int GameStateDeckViewer::loadDeck(int deckid){
|
||||
myDeck = NEW DeckDataWrapper(NEW MTGDeck(options.profileFile(deckname,"",false,false).c_str(), mParent->collection));
|
||||
if(filterDeck) SAFE_DELETE(filterDeck);
|
||||
filterDeck = NEW WGuiFilters("Filter by...",myDeck);
|
||||
filterDeck->Finish();
|
||||
filterDeck->Finish(true);
|
||||
|
||||
// Check whether the cards in the deck are actually available in the player's collection:
|
||||
int cheatmode = options[Options::CHEATMODE].number;
|
||||
|
||||
@@ -1106,7 +1106,7 @@ void WGuiCardImage::Render(){
|
||||
MTGCard * c = NULL;
|
||||
Pos p(x+margin, y+margin, 1,0,255);
|
||||
|
||||
if(!source || (c = source->getCard(mOffset.getPos())) == NULL){
|
||||
if(!source || (c = source->getCard(mOffset.getPos())) == NULL){ //No card, use card back.
|
||||
JQuad * q;
|
||||
if(bThumb){
|
||||
q = resources.GetQuad("back_thumb");
|
||||
@@ -1119,10 +1119,8 @@ void WGuiCardImage::Render(){
|
||||
q = resources.GetQuad("back");
|
||||
float scale = p.actZ * 257.f / q->mHeight;
|
||||
renderer->RenderQuad(q,p.x,p.y,0,scale,scale);
|
||||
}else{
|
||||
if(!c)
|
||||
return;
|
||||
if(bThumb){
|
||||
}else{ //Have card.
|
||||
if(bThumb){ //Thumbnail.
|
||||
JQuad * q = NULL;
|
||||
if(!options[Options::DISABLECARDS].number){
|
||||
q = source->getThumb(mOffset.getPos());
|
||||
@@ -1135,12 +1133,12 @@ void WGuiCardImage::Render(){
|
||||
return; //TODO Some kind of error image.
|
||||
renderer->RenderQuad(q,p.x,p.y);
|
||||
}
|
||||
else{
|
||||
JQuad * q = source->getImage(mOffset.getPos());
|
||||
if(!q || options[Options::DISABLECARDS].number)
|
||||
CardGui::alternateRender(c,p);
|
||||
else
|
||||
CardGui::RenderBig(c,p);
|
||||
else{ //Normal card.
|
||||
JQuad * q = source->getImage(mOffset.getPos());
|
||||
if(!q || options[Options::DISABLECARDS].number)
|
||||
CardGui::alternateRender(c,p);
|
||||
else
|
||||
CardGui::RenderBig(c,p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1321,13 +1319,11 @@ WGuiListRow::WGuiListRow(string n, WSyncable * s) : WGuiList(n,s) {
|
||||
height = 20;
|
||||
}
|
||||
//WGuiFilterUI
|
||||
bool WGuiFilters::Finish(){
|
||||
bool WGuiFilters::Finish(bool emptyset){
|
||||
bFinished = true;
|
||||
string src;
|
||||
if(source){
|
||||
src = getCode();
|
||||
if(priorFilter == src && recolorTo < 0)
|
||||
return false;
|
||||
source->clearFilters();
|
||||
if(src.size()){
|
||||
WCFilterFactory * wc = WCFilterFactory::GetInstance();
|
||||
@@ -1342,11 +1338,10 @@ bool WGuiFilters::Finish(){
|
||||
source->addFilter(f);
|
||||
}
|
||||
}
|
||||
if(!source->Size()){
|
||||
if(!source->Size() && !emptyset){
|
||||
source->clearFilters(); //TODO: Pop a "No results found" warning
|
||||
}
|
||||
}
|
||||
priorFilter = src;
|
||||
return true;
|
||||
}
|
||||
void WGuiFilters::ButtonPressed(int controllerId, int controlId){
|
||||
@@ -1359,7 +1354,8 @@ void WGuiFilters::ButtonPressed(int controllerId, int controlId){
|
||||
Finish();
|
||||
}
|
||||
else{
|
||||
source->clearFilters();
|
||||
if(source)
|
||||
source->clearFilters();
|
||||
SAFE_DELETE(list);
|
||||
buildList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user