From 46d6ce1cd67cbfcf42ed8216e66f5eeb38e9f898 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 18 Feb 2018 09:29:37 +0000 Subject: [PATCH] Start mission from hub. --- src/hub/hub.c | 4 ++++ src/hub/hub.h | 1 + src/world/player.c | 8 ++++---- src/world/player.h | 3 +-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/hub/hub.c b/src/hub/hub.c index a4d48b8..e0724c3 100644 --- a/src/hub/hub.c +++ b/src/hub/hub.c @@ -71,6 +71,8 @@ void initHub(void) memset(&keySprites, 0, sizeof(Sprite*) * MAX_KEY_TYPES); + selectedMission = NULL; + loadMusic("music/61321__mansardian__news-background.ogg"); atlasTexture = getTexture("gfx/atlas/atlas.png"); @@ -517,6 +519,8 @@ static void startMission(void) saveGame(); stopMusic(); + + initWorld(); } static void cancel(void) diff --git a/src/hub/hub.h b/src/hub/hub.h index bde4edc..eafab87 100644 --- a/src/hub/hub.h +++ b/src/hub/hub.h @@ -49,6 +49,7 @@ extern void playMusic(int loop); extern void stopMusic(void); extern void startSectionTransition(void); extern void endSectionTransition(void); +extern void initWorld(void); extern App app; extern Colors colors; diff --git a/src/world/player.c b/src/world/player.c index f29074b..224a129 100644 --- a/src/world/player.c +++ b/src/world/player.c @@ -57,10 +57,10 @@ static void doDebugControls(void) world.bob->weaponType = WPN_GRENADES; } - if (app.keyboard[SDL_SCANCODE_0]) + if (app.keyboard[SDL_SCANCODE_0] && world.state != WS_COMPLETE) { - saveGame(); - saveWorld(); - app.keyboard[SDL_SCANCODE_0] = 0; + stopMusic(); + world.state = WS_COMPLETE; + world.missionCompleteTimer = FPS * 3; } } diff --git a/src/world/player.h b/src/world/player.h index 3d3c4a6..8e0fab2 100644 --- a/src/world/player.h +++ b/src/world/player.h @@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../common.h" -extern void saveGame(void); -extern void saveWorld(void); +extern void stopMusic(void); extern App app; extern Dev dev;