Updates to title screen.
This commit is contained in:
parent
d43811a32d
commit
e0a7a3511e
|
@ -42,6 +42,13 @@ void initGame(void)
|
|||
loadTrophyData();
|
||||
}
|
||||
|
||||
void newGame(void)
|
||||
{
|
||||
destroyGame();
|
||||
|
||||
initGame();
|
||||
}
|
||||
|
||||
int addItem(Item *item, int num)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -22,17 +22,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "../json/cJSON.h"
|
||||
|
||||
extern Entity *createEntity(char *name);
|
||||
extern int deleteFile(char *path);
|
||||
extern int fileExists(const char *filename);
|
||||
extern char **getFileList(const char *dir, int *count);
|
||||
extern char *getLookupName(const char *prefix, long num);
|
||||
extern int getPercent(float current, float total);
|
||||
extern Trophy *getTrophy(char *id);
|
||||
extern void loadTrophyData(void);
|
||||
extern int lookup(char *name);
|
||||
extern char *readFile(const char *filename);
|
||||
extern int writeFile(const char *filename, const char *data);
|
||||
extern char *timeToString(int seconds, int showHours);
|
||||
extern int getPercent(float current, float total);
|
||||
extern char **getFileList(const char *dir, int *count);
|
||||
extern int deleteFile(char *path);
|
||||
extern void loadTrophyData(void);
|
||||
extern int writeFile(const char *filename, const char *data);
|
||||
|
||||
extern App app;
|
||||
extern Entity *self;
|
||||
|
|
|
@ -34,12 +34,13 @@ static void doSaveSlot(void);
|
|||
static void doLoadCancel(void);
|
||||
static void doOK(void);
|
||||
static void doCancel(void);
|
||||
static void returnFromOptions(void);
|
||||
|
||||
static Texture *atlasTexture;
|
||||
static Atlas *title;
|
||||
static int recentSaveSlot;
|
||||
static int saveAction;
|
||||
static Widget *newGame;
|
||||
static Widget *startNewGame;
|
||||
static Widget *load;
|
||||
static Widget *continueGame;
|
||||
static Widget *options;
|
||||
|
@ -58,8 +59,8 @@ void initTitle(void)
|
|||
|
||||
title = getImageFromAtlas("gfx/main/title.png");
|
||||
|
||||
newGame = getWidget("new", "title");
|
||||
newGame->action = &doNewGame;
|
||||
startNewGame = getWidget("new", "title");
|
||||
startNewGame->action = &doNewGame;
|
||||
|
||||
load = getWidget("load", "title");
|
||||
load->action = &doLoadGame;
|
||||
|
@ -181,17 +182,35 @@ static void populateSaveSlotWidgets(void)
|
|||
|
||||
static void doNewGame(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
saveAction = SA_DELETE;
|
||||
|
||||
showWidgetGroup("saveSlot");
|
||||
|
||||
for (i = 0 ; i < MAX_SAVE_SLOTS ; i++)
|
||||
{
|
||||
save[i]->disabled = 0;
|
||||
}
|
||||
|
||||
loadCancel->visible = 1;
|
||||
|
||||
destroyGame();
|
||||
}
|
||||
|
||||
static void doLoadGame(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
saveAction = SA_LOAD;
|
||||
|
||||
showWidgetGroup("saveSlot");
|
||||
|
||||
for (i = 0 ; i < MAX_SAVE_SLOTS ; i++)
|
||||
{
|
||||
save[i]->disabled = save[i]->value[0] == 0;
|
||||
}
|
||||
|
||||
loadCancel->visible = 1;
|
||||
}
|
||||
|
||||
|
@ -206,12 +225,12 @@ static void doContinueGame(void)
|
|||
|
||||
static void doOptions(void)
|
||||
{
|
||||
|
||||
initOptions(returnFromOptions);
|
||||
}
|
||||
|
||||
static void doCredits(void)
|
||||
{
|
||||
|
||||
initCredits();
|
||||
}
|
||||
|
||||
static void doQuit(void)
|
||||
|
@ -225,8 +244,6 @@ static void doSaveSlot(void)
|
|||
|
||||
w = getSelectedWidget();
|
||||
|
||||
game.saveSlot = w->value[1];
|
||||
|
||||
if (saveAction == SA_LOAD)
|
||||
{
|
||||
loadGame();
|
||||
|
@ -235,8 +252,14 @@ static void doSaveSlot(void)
|
|||
}
|
||||
else if (saveAction == SA_DELETE)
|
||||
{
|
||||
newGame();
|
||||
|
||||
initHub();
|
||||
}
|
||||
|
||||
game.saveSlot = w->value[1];
|
||||
|
||||
saveGame();
|
||||
}
|
||||
|
||||
static void doLoadCancel(void)
|
||||
|
@ -253,3 +276,11 @@ static void doCancel(void)
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
static void returnFromOptions(void)
|
||||
{
|
||||
app.delegate.logic = &logic;
|
||||
app.delegate.draw = &draw;
|
||||
|
||||
showWidgetGroup("title");
|
||||
}
|
||||
|
|
|
@ -27,26 +27,29 @@ enum
|
|||
};
|
||||
|
||||
extern void blitRect(SDL_Texture *texture, int x, int y, SDL_Rect *srcRect, int center);
|
||||
extern void destroyGame(void);
|
||||
extern void doWidgets(void);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
extern void drawWidgets(void);
|
||||
extern void endSectionTransition(void);
|
||||
extern Atlas *getImageFromAtlas(char *filename);
|
||||
extern Texture *getTexture(const char *filename);
|
||||
extern Widget *getWidget(char *name, char *group);
|
||||
extern void playSound(int snd, int ch);
|
||||
extern void saveConfig(void);
|
||||
extern void showWidgetGroup(char *group);
|
||||
extern void startSectionTransition(void);
|
||||
extern long getFileModTime(char *filename);
|
||||
extern int fileExists(const char *filename);
|
||||
extern void setSelectedWidget(char *name, char *group);
|
||||
extern long getFileModTime(char *filename);
|
||||
extern Atlas *getImageFromAtlas(char *filename);
|
||||
extern char *getSaveWidgetLabel(char *filename);
|
||||
extern Widget *getSelectedWidget(void);
|
||||
extern void loadGame(void);
|
||||
extern Texture *getTexture(const char *filename);
|
||||
extern Widget *getWidget(char *name, char *group);
|
||||
extern void initCredits(void);
|
||||
extern void initHub(void);
|
||||
extern void destroyGame(void);
|
||||
extern void initOptions(void (*callback)(void));
|
||||
extern void loadGame(void);
|
||||
extern void newGame(void);
|
||||
extern void saveGame(void);
|
||||
extern void setSelectedWidget(char *name, char *group);
|
||||
extern void showWidgetGroup(char *group);
|
||||
extern void startSectionTransition(void);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
extern Game game;
|
||||
|
||||
|
|
|
@ -630,7 +630,11 @@ static void trophies(void)
|
|||
|
||||
static void quit(void)
|
||||
{
|
||||
stopMusic();
|
||||
|
||||
destroyHub();
|
||||
|
||||
initTitle();
|
||||
}
|
||||
|
||||
static void returnFromTrophyStats(void)
|
||||
|
|
|
@ -58,6 +58,7 @@ extern Widget *getWidget(char *name, char *group);
|
|||
extern void hideAllWidgets(void);
|
||||
extern void initOptions(void (*callback)(void));
|
||||
extern void initStatsDisplay(void);
|
||||
extern void initTitle(void);
|
||||
extern void initWorld(void);
|
||||
extern int isControl(int type);
|
||||
extern void limitTextWidth(int width);
|
||||
|
|
Loading…
Reference in New Issue