calculate scores
[gbajam22] / src / gamescr.c
index 62c16a9..5fdfa6b 100644 (file)
@@ -109,8 +109,6 @@ static void setup_palette(void)
        int i;
        unsigned char *cmap = gba_colors ? color_gba_cmap : color_cmap;
 
-       emuprint("setting up %s palette", gba_colors ? "GBA" : "NDS/Emu");
-
        for(i=0; i<256; i++) {
                int r = cmap[i * 3];
                int g = cmap[i * 3 + 1];
@@ -145,7 +143,7 @@ static int gamescr_start(void)
        /* setup color image palette */
        setup_palette();
 
-       spr_setup(16, 16, spr_game_pixels, spr_game_cmap);
+       spr_setup(16, 16, spr_game_pixels, gba_colors ? spr_game_gba_cmap : spr_game_cmap);
        wait_vblank();
        spr_clear();
 
@@ -555,8 +553,20 @@ static void draw(void)
 
 static void victory(void)
 {
+       int sec, time_bonus;
+
        total_time = timer_msec - start_time;
-       score = 42;
+       sec = total_time / 1000;
+
+       if(sec < 60) {
+               time_bonus = 1000 + (60 - sec) * 100;
+       } else if(sec < 120) {
+               time_bonus = 250 + (60 - (sec - 60)) * 10;
+       } else if(sec < 300) {
+               time_bonus = 100;
+       }
+
+       score = energy * 250 + time_bonus;
 
        /* TODO enter name */
        save_score("???", score, total_time, 0);