Cheattitle scrolls now and some other small stuff

This commit is contained in:
thedarkness1981 2009-07-03 14:59:32 +00:00
parent 8c076a8eb9
commit 4c684e5969

View File

@ -59,35 +59,35 @@ int CheatMenu(const char * gameID)
GCTCheats c; GCTCheats c;
char txtfilename[30]; char txtfilename[40];
snprintf(txtfilename,sizeof(txtfilename),"%s%s.txt",Settings.TxtCheatcodespath,gameID); snprintf(txtfilename,sizeof(txtfilename),"%s%s.txt",Settings.TxtCheatcodespath,gameID);
int check = c.openTxtfile(txtfilename); int check = c.openTxtfile(txtfilename);
switch(check) switch(check)
{ {
case -1: WindowPrompt(tr("Error"),tr("Cheatfile is blank"),tr("OK"),NULL,NULL,NULL,-1); case -1: WindowPrompt(tr("Error"),tr("Cheatfile is blank"),tr("OK"),NULL,NULL,NULL,-1);
break; break;
case 0: WindowPrompt(tr("Error"),tr("No Cheatfile found"),tr("OK"),NULL,NULL,NULL,-1); case 0: WindowPrompt(tr("Error"),tr("No Cheatfile found"),tr("OK"),NULL,NULL,NULL,-1);
break; break;
case 1: //WindowPrompt("Opened File","File found for Game","Okay",NULL,NULL,NULL); case 1:
int cntcheats = c.getCnt()+1; //WindowPrompt("Opened File","File found for Game","Okay",NULL,NULL,NULL);
customOptionList options2(cntcheats); int cntcheats = c.getCnt();
GuiCustomOptionBrowser optionBrowser2(400, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 150); customOptionList cheatslst(cntcheats);
optionBrowser2.SetPosition(0, 90); GuiCustomOptionBrowser chtBrowser(400, 280, &cheatslst, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 1, 90);
optionBrowser2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); chtBrowser.SetPosition(0, 90);
optionBrowser2.SetClickable(true); chtBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
optionBrowser2.SetScrollbar(1); chtBrowser.SetClickable(true);
GuiText titleTxt(c.getGameName().c_str(), 28, (GXColor){0, 0, 0, 255}); GuiText titleTxt(c.getGameName().c_str(), 28, (GXColor){0, 0, 0, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetMaxWidth(350, GuiText::SCROLL); titleTxt.SetMaxWidth(350, GuiText::SCROLL);
titleTxt.SetPosition(12,40); titleTxt.SetPosition(12,40);
//options2.SetName(0, "%s",c.getCheatComment(0).c_str());
for(int i = 0; i <= cntcheats; i++) for(int i = 0; i <= cntcheats; i++)
{ {
options2.SetName(i+1, "%s",c.getCheatName(i).c_str()); cheatslst.SetValue(i, "%s",c.getCheatName(i).c_str());
options2.SetValue(i+1, "OFF"); cheatslst.SetName(i, "OFF");
} }
HaltGui(); HaltGui();
@ -96,7 +96,7 @@ int CheatMenu(const char * gameID)
w.Append(&titleTxt); w.Append(&titleTxt);
w.Append(&backBtn); w.Append(&backBtn);
w.Append(&createBtn); w.Append(&createBtn);
w.Append(&optionBrowser2); w.Append(&chtBrowser);
mainWindow->Append(&w); mainWindow->Append(&w);
ResumeGui(); ResumeGui();
@ -104,17 +104,17 @@ int CheatMenu(const char * gameID)
{ {
VIDEO_WaitVSync (); VIDEO_WaitVSync ();
ret = optionBrowser2.GetClickedOption(); ret = chtBrowser.GetClickedOption();
if (ret) if (ret != -1)
{ {
const char *tt = options2.GetValue(ret); const char *strCheck = cheatslst.GetName(ret);
if (strncmp(tt,"ON",2) == 0) if (strncmp(strCheck,"ON",2) == 0)
{ {
options2.SetValue(ret,"%s","OFF"); cheatslst.SetName(ret,"%s","OFF");
} }
else if (strncmp(tt,"OFF",2) == 0) else if (strncmp(strCheck,"OFF",3) == 0)
{ {
options2.SetValue(ret,"%s","ON"); cheatslst.SetName(ret,"%s","ON");
} }
} }
@ -127,12 +127,11 @@ int CheatMenu(const char * gameID)
int x = 0; int x = 0;
for(int i = 0; i <= cntcheats; i++) for(int i = 0; i <= cntcheats; i++)
{ {
const char *tt = options2.GetValue(i+1); const char *strCheck = cheatslst.GetName(i);
if (strncmp(tt,"ON",2) == 0) if (strncmp(strCheck,"ON",2) == 0)
{ {
selectednrs[x] = i; selectednrs[x] = i;
x++; x++;
//WindowPrompt("Selected Cheat",c.getCheatName(i).c_str(),"Okay",NULL,NULL,NULL);
} }
} }