Show objectives intro screen when starting a level.

This commit is contained in:
Steve 2018-02-08 07:26:42 +00:00
parent e9c1560bde
commit bf0f64caf8
3 changed files with 22 additions and 8 deletions

View File

@ -95,9 +95,8 @@ void clearControl(int type)
} }
} }
void resetAcceptControls(void) void clearControls(void)
{ {
app.keyboard[SDL_SCANCODE_SPACE] = app.keyboard[SDL_SCANCODE_RETURN] = 0; memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
memset(&app.joypadButton, 0, sizeof(int) * SDL_CONTROLLER_BUTTON_MAX);
clearControl(CONTROL_FIRE);
} }

View File

@ -34,7 +34,7 @@ static void drawNormal(void);
static void addHelperItems(void); static void addHelperItems(void);
static void spawnEnemies(void); static void spawnEnemies(void);
static int canAdd(Unit *u, int mx, int my); static int canAdd(Unit *u, int mx, int my);
void startMission(void); static void startMission(void);
static Texture *background; static Texture *background;
static int observationIndex; static int observationIndex;
@ -82,8 +82,6 @@ void initWorld(void)
app.delegate.logic = logic; app.delegate.logic = logic;
app.delegate.draw = draw; app.delegate.draw = draw;
startMission();
world.bob->x = 166 * MAP_TILE_SIZE; world.bob->x = 166 * MAP_TILE_SIZE;
world.bob->y = 103 * MAP_TILE_SIZE; world.bob->y = 103 * MAP_TILE_SIZE;
} }
@ -139,6 +137,12 @@ static void draw(void)
drawMissionStatus(); drawMissionStatus();
break; break;
case WS_START:
drawNormal();
drawMissionStatus();
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 80, 24, TA_CENTER, colors.white, _("Press Fire to Continue"));
break;
default: default:
if (world.betweenTimer == 0) if (world.betweenTimer == 0)
{ {
@ -164,7 +168,7 @@ static void drawNormal(void)
drawParticles(PLANE_FOREGROUND); drawParticles(PLANE_FOREGROUND);
} }
void startMission(void) static void startMission(void)
{ {
Entity *self; Entity *self;
SDL_Rect *r; SDL_Rect *r;
@ -209,6 +213,13 @@ static void doWorldStart(void)
world.entityChaseTimer = MAX(world.entityChaseTimer - 1, 0); world.entityChaseTimer = MAX(world.entityChaseTimer - 1, 0);
doCommon(); doCommon();
if (isAcceptControl())
{
clearControls();
startMission();
}
} }
static void doWorldInProgress(void) static void doWorldInProgress(void)

View File

@ -64,8 +64,12 @@ extern int isOnScreen(Entity *e);
extern int isControl(int type); extern int isControl(int type);
extern void clearControl(int type); extern void clearControl(int type);
extern void drawMissionStatus(void); extern void drawMissionStatus(void);
extern int isAcceptControl(void);
extern void clearControls(void);
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
extern App app; extern App app;
extern Colors colors;
extern Dev dev; extern Dev dev;
extern Game game; extern Game game;
extern World world; extern World world;