janky victory screen
[gbajam22] / src / gamescr.c
index 5b4786d..896af07 100644 (file)
@@ -12,6 +12,7 @@
 #include "debug.h"
 #include "voxscape.h"
 #include "data.h"
+#include "scoredb.h"
 
 #define FOV            30
 #define NEAR   2
@@ -181,6 +182,7 @@ static int gamescr_start(void)
                }
        }
 endspawn:
+       total_enemies = 1;      /* XXX DBG */
        /* check continuity */
        for(i=0; i<total_enemies; i++) {
                if(enemies[i].anm <= 0) {
@@ -435,12 +437,24 @@ static void draw(void)
        vox_render();
        //vox_sky_grad(COLOR_HORIZON, COLOR_ZENITH);
        //vox_sky_solid(COLOR_ZENITH);
+
+       if(score >= 0) {
+               glyphcolor = 200;
+               glyphfb = framebuf;
+               dbg_drawstr(80, 10, "Victory!");
+               dbg_drawstr(60, 20, "Score: %d", score);
+               dbg_drawstr(59, 30, "Completed in: %lus", total_time);
+       }
 }
 
 static void victory(void)
 {
        total_time = timer_msec - start_time;
        score = 42;
+
+       /* TODO enter name */
+       save_score("???", score, total_time, 0);
+       save_scores();
 }
 
 static inline void xform_pixel(int *xp, int *yp)