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