aboutsummaryrefslogtreecommitdiffstats
path: root/play.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2003-03-26 21:53:14 +0000
committerH. Peter Anvin <hpa@zytor.com>2003-03-26 21:53:14 +0000
commit579613bb829a38ab6ceb6652e7f7e315ec35d30d (patch)
treed6a5ded392ef8bafd7749677f664c40b2308278f /play.c
parent8a66df1ff9594b51ecb7e9ff26d5404b18817a6b (diff)
downloadgrv-579613bb829a38ab6ceb6652e7f7e315ec35d30d.tar.gz
grv-579613bb829a38ab6ceb6652e7f7e315ec35d30d.tar.xz
grv-579613bb829a38ab6ceb6652e7f7e315ec35d30d.zip
Sleep only once per level ending; add per-level high scores
Diffstat (limited to 'play.c')
-rw-r--r--play.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/play.c b/play.c
index fe2d4cd..f676ea4 100644
--- a/play.c
+++ b/play.c
@@ -11,6 +11,7 @@
#include <math.h>
#include "graphics.h"
#include "grv.h"
+#include "highscore.h"
/* ------------------------------------------------------------------------- */
@@ -624,8 +625,54 @@ static void end_level(int done)
lprint(20, 8, "YOUR TOTAL SCORE AT THIS");
lprintf(21, 8, "LEVEL WAS %lld", gp.Sc-gp.StScore);
+ /* Show level high scores */
+
+ /* Best time */
+ lprint(14,8,"TIME");
+
+ if ( !done ) {
+ lprint(16,8, "Sorry, not");
+ lprint(17,8, "eligible");
+ } else {
+ int i, rank;
+
+ if ( gp.Cheat ) {
+ rank = 0;
+ } else {
+ rank = highscore_add_level_time(gp.gameid, gp.Level,
+ (int32_t)(gp.Tid * 1000.0));
+ }
+
+ for ( i = 0 ; i < 3 ; i++ ) {
+ color(0,(rank == i+1) ? gp.c : gp.c2);
+ lprintf(16+i,8, " %d %s ", i+1,
+ format_time(bests.level[gp.Level].time_ms[i].time_ms/1000.0));
+ }
+ }
+
+ /* Best score */
+ color(0,gp.c2);
+ lprint(14,21,"SCORE");
+ {
+ int i, rank;
+
+ if ( gp.Cheat ) {
+ rank = 0;
+ } else {
+ rank = highscore_add_level_score(gp.gameid, gp.Level, gp.Sc-gp.StScore);
+ }
+
+ for ( i = 0 ; i < 3 ; i++ ) {
+ color(0,(rank == i+1) ? gp.c : gp.c2);
+ lprintf(16+i,21, " %d %lld ", i+1,
+ bests.level[gp.Level].score[i].score);
+ }
+ }
+
/* Wait 4 seconds */
- mymssleep(4000);
+ if ( gp.EOLWait ) {
+ mymssleep(4000);
+ }
gp.Level++;
@@ -706,6 +753,10 @@ void play(void)
gp.Life--;
gp.GkCh = max(gp.GkCh, gp.ChBd);
gp.Lvf = 0;
+
+ /* Sleep 4 seconds */
+ if ( gp.EOLWait )
+ mymssleep(4000);
} else {
/* End of level stuff */
gp.Lvf++;