controls help screen
[gbajam22] / src / gamescr.c
index 64169e7..11390c7 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();
 
@@ -187,7 +185,7 @@ static int gamescr_start(void)
                                enemy->vobj.px = -1;
                                enemy->anm = 0xff;
                                enemy->hp = ENEMY_ENERGY;
-                               enemy->last_shot = timer_msec > E_RATE ? timer_msec - E_RATE : 0;
+                               enemy->last_shot = -1;
                                enemy->shot_frame = -1;
                                if(++total_enemies >= MAX_ENEMIES) {
                                        goto endspawn;
@@ -197,7 +195,6 @@ 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) {
@@ -262,9 +259,10 @@ static void gamescr_frame(void)
        wait_vblank();
        present(backbuf);
 
+       /*
        if(!(nframes & 15)) {
                emuprint("vbl: %d", vblperf_count);
-       }
+       }*/
 #ifdef VBLBAR
        vblperf_begin();
 #else
@@ -403,7 +401,9 @@ static int update(void)
                        }
                } else if(enemy->vobj.px >= 0) {
                        /* check rate of fire and start a shot if necessary */
-                       if(timer_msec - enemy->last_shot >= E_RATE) {
+                       if(enemy->last_shot == -1) {
+                               enemy->last_shot = timer_msec;
+                       } else if(timer_msec - enemy->last_shot >= E_RATE) {
                                enemy->last_shot = timer_msec;
                                enemy->shot_frame = 0;
                        }
@@ -553,8 +553,20 @@ static void draw(void)
 
 static void victory(void)
 {
+       int sec, time_bonus = 0;
+
        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);