- quick patches, attempt at fixing a few crashes
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-03-13 08:48:40 +00:00
parent 8a4797a06a
commit fa0d98988d
5 changed files with 15 additions and 11 deletions

View File

@@ -25,7 +25,6 @@ void GameStateOptions::Start()
if (GameApp::HasMusic) if (GameApp::HasMusic)
optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::MUSICVOLUME,"Music volume",100,10,100),OptionVolume::getInstance())); optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::MUSICVOLUME,"Music volume",100,10,100),OptionVolume::getInstance()));
optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::SFXVOLUME,"SFX volume",100,10,100),OptionVolume::getInstance())); optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::SFXVOLUME,"SFX volume",100,10,100),OptionVolume::getInstance()));
optionsList->Add(NEW OptionInteger(Options::OSD, "Display InGame extra information"));
if (options[Options::DIFFICULTY_MODE_UNLOCKED].number){ if (options[Options::DIFFICULTY_MODE_UNLOCKED].number){
optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::DIFFICULTY,"Difficulty",3,1,0),OptionDifficulty::getInstance())); optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::DIFFICULTY,"Difficulty",3,1,0),OptionDifficulty::getInstance()));
optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::ECON_DIFFICULTY,"Economic Difficuly",Constants::ECON_EASY))); optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::ECON_DIFFICULTY,"Economic Difficuly",Constants::ECON_EASY)));
@@ -45,6 +44,7 @@ void GameStateOptions::Start()
optionsList->Add(NEW OptionInteger(Options::REVERSETRIGGERS, "Reverse left and right triggers")); optionsList->Add(NEW OptionInteger(Options::REVERSETRIGGERS, "Reverse left and right triggers"));
optionsList->Add(NEW OptionInteger(Options::DISABLECARDS,"Disable card images")); optionsList->Add(NEW OptionInteger(Options::DISABLECARDS,"Disable card images"));
optionsList->Add(NEW OptionInteger(Options::TRANSITIONS,"Disable screen transitions")); optionsList->Add(NEW OptionInteger(Options::TRANSITIONS,"Disable screen transitions"));
optionsList->Add(NEW OptionInteger(Options::OSD, "Display InGame extra information"));
optionsTabs->Add(optionsList); optionsTabs->Add(optionsList);
optionsList = NEW WGuiList("User"); optionsList = NEW WGuiList("User");

View File

@@ -199,7 +199,7 @@ void GameStateShop::cancelCard(int controlId){
//Update prices //Update prices
MTGCard * c = srcCards->getCard(controlId-BOOSTER_SLOTS); MTGCard * c = srcCards->getCard(controlId-BOOSTER_SLOTS);
if(!c || !c->data || playerdata->credits - mPrices[controlId] < 0) if(!c || !c->data || playerdata->credits - mPrices[controlId] < 0)
return; //We only care about their oppinion if they /can/ buy it. return; //We only care about their opinion if they /can/ buy it.
int price = mPrices[controlId]; int price = mPrices[controlId];
int rnd; int rnd;
@@ -212,7 +212,8 @@ void GameStateShop::cancelCard(int controlId){
rnd = rand() % 25; break; rnd = rand() % 25; break;
} }
price = price - (rnd * price)/100; price = price - (rnd * price)/100;
pricelist->setPrice(c->getMTGId(),price); if (price < pricelist->getPrice(c->getMTGId())) //filters have a tendancy to increase the price instead of lowering it!
pricelist->setPrice(c->getMTGId(),price);
//Prices do not immediately go down when you ignore something. //Prices do not immediately go down when you ignore something.
return; return;
} }

View File

@@ -172,8 +172,8 @@ void OptionProfile::Render(){
sprintf(buf,"player/avatar.jpg"); sprintf(buf,"player/avatar.jpg");
else else
sprintf(buf,"profiles/%s/avatar.jpg",selections[value].c_str()); sprintf(buf,"profiles/%s/avatar.jpg",selections[value].c_str());
string filename = buf;
JQuad * mAvatar = resources.RetrieveQuad(buf,0,0,0,0,"temporary",RETRIEVE_NORMAL,TEXTURE_SUB_EXACT); JQuad * mAvatar = resources.RetrieveTempQuad(filename,TEXTURE_SUB_EXACT);
if(mAvatar){ if(mAvatar){
renderer->RenderQuad(mAvatar,x,pY); renderer->RenderQuad(mAvatar,x,pY);
@@ -358,8 +358,8 @@ JQuad * OptionTheme::getImage(){
sprintf(buf,"graphics/preview.png"); sprintf(buf,"graphics/preview.png");
else else
sprintf(buf,"themes/%s/preview.png",val.c_str()); sprintf(buf,"themes/%s/preview.png",val.c_str());
string filename = buf;
return resources.RetrieveQuad(buf,0,0,0,0,"temporary",RETRIEVE_NORMAL,TEXTURE_SUB_EXACT); return resources.RetrieveTempQuad(filename,TEXTURE_SUB_EXACT);
} }
float OptionTheme::getHeight(){ float OptionTheme::getHeight(){
@@ -372,9 +372,6 @@ void OptionTheme::updateValue(){
void OptionTheme::Render(){ void OptionTheme::Render(){
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
JQuad * q = getImage();
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
mFont->SetColor(getColor(WGuiColor::TEXT_HEADER));
char buf[512]; char buf[512];
if(!bChecked){ if(!bChecked){
author = ""; author = "";
@@ -396,11 +393,14 @@ void OptionTheme::Render(){
} }
sprintf(buf,_("Theme: %s").c_str(),selections[value].c_str()); sprintf(buf,_("Theme: %s").c_str(),selections[value].c_str());
JQuad * q = getImage();
if(q){ if(q){
float scale = 128 / q->mHeight; float scale = 128 / q->mHeight;
renderer->RenderQuad(q,x, y,0,scale,scale); renderer->RenderQuad(q,x, y,0,scale,scale);
} }
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
mFont->SetColor(getColor(WGuiColor::TEXT_HEADER));
mFont->DrawString(buf, x + 2, y + 2); mFont->DrawString(buf, x + 2, y + 2);
if(bChecked && author.size()){ if(bChecked && author.size()){
mFont->SetColor(getColor(WGuiColor::TEXT_BODY)); mFont->SetColor(getColor(WGuiColor::TEXT_BODY));

View File

@@ -152,12 +152,14 @@ WTrackedQuad * WCachedTexture::GetTrackedQuad(float offX, float offY, float widt
if(!quad){ if(!quad){
quad = NEW JQuad(texture,offX,offY,width,height); quad = NEW JQuad(texture,offX,offY,width,height);
/*
There's a risk this erases the texture calling the quad creation.... Erwan 2010/03/13
if(!quad) { if(!quad) {
//Probably out of memory. Try again. //Probably out of memory. Try again.
resources.Cleanup(); resources.Cleanup();
quad = NEW JQuad(texture,offX,offY,width,height); quad = NEW JQuad(texture,offX,offY,width,height);
} }
*/
if(!quad){ if(!quad){
if(allocated && tq) if(allocated && tq)
SAFE_DELETE(tq); SAFE_DELETE(tq);

View File

@@ -742,6 +742,7 @@ WGuiMenu::WGuiMenu(JButton next = JGE_BTN_RIGHT, JButton prev = JGE_BTN_LEFT, bo
currentItem = -1; currentItem = -1;
mDPad = m; mDPad = m;
sync = syncme; sync = syncme;
held = JGE_BTN_NONE;
} }
WGuiMenu::~WGuiMenu(){ WGuiMenu::~WGuiMenu(){
for(vector<WGuiBase*>::iterator it = items.begin();it!=items.end();it++) for(vector<WGuiBase*>::iterator it = items.begin();it!=items.end();it++)