Show stats during level.

This commit is contained in:
Steve 2018-02-19 19:12:55 +00:00
parent 1eb9530fb5
commit 44e34ab7de
2 changed files with 43 additions and 8 deletions

View File

@ -42,11 +42,12 @@ static void options(void);
static void stats(void);
static void trophies(void);
static void quit(void);
static void returnFromStats(void);
int getMissionStatus(void);
static Texture *background;
static int observationIndex;
static int showingWidgets;
static int showing;
void initWorld(void)
{
@ -181,9 +182,15 @@ static void draw(void)
break;
}
if (showingWidgets)
switch (showing)
{
drawInGameWidgets();
case SHOW_WIDGETS:
drawInGameWidgets();
break;
case SHOW_STATS:
drawStats();
break;
}
}
@ -194,7 +201,7 @@ static void drawInGameWidgets(void)
w = 300;
h = 550;
drawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 64);
drawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 128);
drawRect((SCREEN_WIDTH - w) / 2, (SCREEN_HEIGHT - h) / 2, w, h, 0, 0, 0, 192);
drawOutlineRect((SCREEN_WIDTH - w) / 2, (SCREEN_HEIGHT - h) / 2, w, h, 255, 255, 255, 255);
@ -277,7 +284,7 @@ static void doWorldInProgress(void)
doPlayer();
if (!showingWidgets)
if (showing == SHOW_NONE)
{
doBob();
@ -320,7 +327,7 @@ static void doWorldInProgress(void)
app.keyboard[SDL_SCANCODE_ESCAPE] = 0;
showWidgetGroup("gamePaused");
playSound(SND_MENU_BACK, 0);
showingWidgets = 1;
showing = SHOW_WIDGETS;
}
if (world.observationTimer > 0)
@ -333,10 +340,19 @@ static void doWorldInProgress(void)
}
}
}
else
else if (showing == SHOW_WIDGETS)
{
handleWidgets();
}
else if (showing == SHOW_STATS)
{
doStats();
if (app.keyboard[SDL_SCANCODE_ESCAPE])
{
returnFromStats();
}
}
}
static void handleWidgets(void)
@ -668,7 +684,7 @@ static void resume(void)
{
app.keyboard[SDL_SCANCODE_ESCAPE] = 0;
hideAllWidgets();
showingWidgets = 0;
showing = SHOW_NONE;
}
static void options(void)
@ -677,6 +693,8 @@ static void options(void)
static void stats(void)
{
showing = SHOW_STATS;
showWidgetGroup("stats");
}
static void trophies(void)
@ -687,6 +705,13 @@ static void quit(void)
{
}
static void returnFromStats(void)
{
showWidgetGroup("hub");
showing = SHOW_WIDGETS;
app.keyboard[SDL_SCANCODE_ESCAPE] = 0;
}
void destroyWorld(void)
{
int i;

View File

@ -20,6 +20,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../common.h"
enum
{
SHOW_NONE,
SHOW_WIDGETS,
SHOW_STATS,
SHOW_TROPHIES
};
extern Texture *getTexture(const char *filename);
extern void initObjectives(void);
extern Entity *getRandomObjectiveEntity(void);
@ -89,6 +97,8 @@ extern void initMap(void);
extern void initEntities(void);
extern void initPostMission(void);
extern void addKeysFromStash(void);
extern void drawStats(void);
extern void doStats(void);
extern App app;
extern Colors colors;