minor tweaks

This commit is contained in:
dborth 2009-03-25 06:49:43 +00:00
parent 26cfad4405
commit c7aa8f2bd8
3 changed files with 15 additions and 25 deletions

View File

@ -32,6 +32,8 @@
#define SCROLL_LOOP_DELAY 3 #define SCROLL_LOOP_DELAY 3
#define PAGESIZE 8 #define PAGESIZE 8
#define SAVELISTSIZE 6 #define SAVELISTSIZE 6
#define MAX_SAVES 20
#define MAX_OPTIONS 30
typedef void (*UpdateCallback)(void * e); typedef void (*UpdateCallback)(void * e);
@ -351,8 +353,8 @@ class GuiFileBrowser : public GuiElement
typedef struct _optionlist { typedef struct _optionlist {
int length; int length;
char name[150][50]; char name[MAX_OPTIONS][150];
char value[150][50]; char value[MAX_OPTIONS][150];
} OptionList; } OptionList;
class GuiOptionBrowser : public GuiElement class GuiOptionBrowser : public GuiElement
@ -406,11 +408,11 @@ class GuiOptionBrowser : public GuiElement
typedef struct _savelist { typedef struct _savelist {
int length; int length;
char filename[20][255]; char filename[MAX_SAVES][256];
GuiImageData * previewImg[20]; GuiImageData * previewImg[MAX_SAVES];
char date[20][50]; char date[MAX_SAVES][20];
char time[10][50]; char time[MAX_SAVES][10];
int type[20]; int type[MAX_SAVES];
int files[2][100]; int files[2][100];
} SaveList; } SaveList;

View File

@ -168,11 +168,12 @@ void GuiButton::Update(GuiTrigger * t)
} }
} }
} }
else if(state == STATE_SELECTED) else
{ {
if(state == STATE_SELECTED)
state = STATE_DEFAULT; state = STATE_DEFAULT;
if(effectsOver && !effects) if(effectTarget == effectTargetOver && effectAmount == effectAmountOver)
{ {
// initiate effects (in reverse) // initiate effects (in reverse)
effects = effectsOver; effects = effectsOver;

View File

@ -1463,7 +1463,7 @@ static int MenuGameSaves(int action)
if(saves.type[j] != -1) if(saves.type[j] != -1)
{ {
int n = -1; int n = -1;
char tmp[300]; char tmp[256];
strncpy(tmp, browserList[i].filename, 255); strncpy(tmp, browserList[i].filename, 255);
tmp[len2-4] = 0; tmp[len2-4] = 0;
@ -1472,7 +1472,7 @@ static int MenuGameSaves(int action)
else if(len2 - len == 6) else if(len2 - len == 6)
n = atoi(&tmp[len2-6]); n = atoi(&tmp[len2-6]);
if(n > 0 && n < 100) if(n > 0 && n < MAX_SAVES)
saves.files[saves.type[j]][n] = 1; saves.files[saves.type[j]][n] = 1;
strncpy(saves.filename[j], browserList[i].filename, 255); strncpy(saves.filename[j], browserList[i].filename, 255);
@ -1486,20 +1486,7 @@ static int MenuGameSaves(int action)
AllocSaveBuffer(); AllocSaveBuffer();
if(LoadFile(scrfile, GCSettings.SaveMethod, SILENT)) if(LoadFile(scrfile, GCSettings.SaveMethod, SILENT))
{
saves.previewImg[j] = new GuiImageData(savebuffer); saves.previewImg[j] = new GuiImageData(savebuffer);
}
/*char scrfile2[1024];
sprintf(scrfile, "%s/%s.png", GCSettings.SaveFolder, tmp);
sprintf(scrfile2, "%s/resave/%s.png", GCSettings.SaveFolder, tmp);
AllocSaveBuffer();
int scrsize = LoadFile(scrfile, GCSettings.SaveMethod, SILENT);
if(scrsize > 0)
{
//saves.previewImg[j] = new GuiImageData(savebuffer);
SaveFile(scrfile2, scrsize, GCSettings.SaveMethod, SILENT);
}*/
FreeSaveBuffer(); FreeSaveBuffer();
} }
strftime(saves.date[j], 20, "%a %b %d", &browserList[j].mtime); strftime(saves.date[j], 20, "%a %b %d", &browserList[j].mtime);