From 8573aa30ba313aaae15465370145bc23587f9c42 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Thu, 9 Jan 2014 02:43:37 +0000
Subject: [PATCH] [Add] Implemented loading bar for nebulae.

---
 src/lephisto.c |  6 +++---
 src/nebulae.c  | 10 +++++++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/lephisto.c b/src/lephisto.c
index 8e3d481..d02cf03 100644
--- a/src/lephisto.c
+++ b/src/lephisto.c
@@ -84,7 +84,7 @@ char* namjoystick = NULL;           /**< Name of joystick to use, NULL is none.
 /* Loading. */
 static void print_SDLversion(void);
 static void loadscreen_load(void);
-static void loadscreen_render(double done, const char* msg);
+void loadscreen_render(double done, const char* msg); /* nebulae.c */
 static void loadscreen_unload(void);
 static void load_all(void);
 static void unload_all(void);
@@ -306,13 +306,13 @@ void loadscreen_load(void) {
 }
 
 /**
- * @fn static void loadscreen_render(double done, const char* msg)
+ * @fn void loadscreen_render(double done, const char* msg)
  *
  * @brief Render the load screen with message.
  *    @param done Amount done (1. == completed).
  *    @param msg Loading screen message.
  */
-static void loadscreen_render(double done, const char* msg) {
+void loadscreen_render(double done, const char* msg) {
   double x, y, w, h, rh;
 
   /* Clear background. */
diff --git a/src/nebulae.c b/src/nebulae.c
index 677989c..e8d4f7d 100644
--- a/src/nebulae.c
+++ b/src/nebulae.c
@@ -28,6 +28,7 @@
 /* Extern. */
 extern double gui_xoff, gui_yoff;
 extern Vec2 shake_pos;
+extern void loadscreen_render(double done, const char* msg);
 
 /* The nebulae textures. */
 static GLuint nebu_textures[NEBULAE_Z]; /**< BG Nebulae textures. */
@@ -83,8 +84,9 @@ int nebu_init(void) {
   int ret;
 
   /* Special code to regenerate the nebulae. */
-  if((nebu_w == -9) && (nebu_h == -9))
+  if((nebu_w == -9) && (nebu_h == -9)) {
     nebu_generate();
+  }
 
   /* Set expected sizes. */
   nebu_w = SCREEN_W;
@@ -483,6 +485,9 @@ static int nebu_generate(void) {
   int w, h;
   int ret;
 
+  /* Warn user of what is happening. */
+  loadscreen_render(0.05, "Generating Nebulae...");
+
   w = SCREEN_W;
   h = SCREEN_H;
 
@@ -513,6 +518,9 @@ static void nebu_generatePuffs(void) {
   SDL_Surface* sur;
   float* nebu;
 
+  /* Warn user of what is happening. */
+  loadscreen_render(0.05, "Generating Nebulae Puffs.");
+
   /* Generate the nebulae puffs. */
   for(i = 0; i < NEBULAE_PUFFS; i++) {
     /* Generate the nebulae. */