aboutsummaryrefslogtreecommitdiffstats
path: root/play.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2003-03-27 05:48:07 +0000
committerH. Peter Anvin <hpa@zytor.com>2003-03-27 05:48:07 +0000
commitc3aadb29c59e52d4a7cca3a1dc269a3c388695ff (patch)
tree70717210b8c0eca3805aac26f8c3d814b4f46247 /play.c
parenta809fe7de5acf2bfd4bfe223b33d49b6daf67afb (diff)
downloadgrv-c3aadb29c59e52d4a7cca3a1dc269a3c388695ff.tar.gz
grv-c3aadb29c59e52d4a7cca3a1dc269a3c388695ff.tar.xz
grv-c3aadb29c59e52d4a7cca3a1dc269a3c388695ff.zip
Fix lots of little bugs
Diffstat (limited to 'play.c')
-rw-r--r--play.c110
1 files changed, 88 insertions, 22 deletions
diff --git a/play.c b/play.c
index f676ea4..ce73489 100644
--- a/play.c
+++ b/play.c
@@ -105,18 +105,26 @@ static void handle_key(SDL_KeyboardEvent *ke)
switch ( sym ) {
case SDLK_F5:
gp.Life = 0;
+ /* Fall through */
case SDLK_F4:
gp.EOLWait = 0;
+ /* Fall through */
case SDLK_d:
gp.Status = Status_Dead;
break;
- case SDLK_k:
- gp.EOLWait = 0;
case SDLK_l:
+ gp.EOLWait = 0;
+ /* Fall through */
+ case SDLK_e:
gp.Cheat = 1;
gp.Status = Status_Done; /* End of level */
break;
case SDLK_p:
+ gp.Cheat = 1;
+ gp.GkCh += 1000;
+ update_power();
+ break;
+ case SDLK_x:
if ( gp.Life < 6 ) {
gp.Cheat = 1;
gp.Life++;
@@ -124,6 +132,17 @@ static void handle_key(SDL_KeyboardEvent *ke)
lprintf(1,16+2*gp.Life, "\x01");
}
break;
+ case SDLK_w:
+ gp.Cheat = 1;
+ while ( gp.nwhite )
+ white2black();
+ break;
+ case SDLK_s:
+ gp.Cheat = 1;
+ if ( gp.KulSpr < 90 )
+ gp.KulSpr++;
+ update_shots();
+ break;
case SDLK_t:
gp.Cheat = 1;
mystery();
@@ -584,6 +603,44 @@ static void move_ghosts(void)
}
/*
+ * End of game/super bonus code
+ */
+static void super_bonus(void)
+{
+ char buf[40];
+ int64_t SB;
+
+ color(15,4); /* Ick */
+ cls();
+
+ lprint(2,5,"C O N G R A T U L A T I O N S !");
+ lprint(3,5,"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
+
+ lprint(6,2,"You have reached the end of the game!");
+
+ SB = 3*(gp.Sc - gp.SBs)/2;
+ gp.Sc += SB;
+ gp.SBs += SB;
+
+ lprintf(8,15,"SUPER BONUS");
+ sprintf(buf, "%lld POINTS", SB);
+ color(14,4);
+ lprint(10,21-(strlen(buf)+1)/2,buf);
+ color(15,4);
+
+ lprint(15,2,"You now get to keep trying, starting");
+ lprintf(16,2,"on level ");
+ color(14,4);
+ gprintf("%d",gp.ZLevel+1);
+ color(15,4);
+ print("...");
+
+ gp.Level = gp.ZLevel;
+
+ mymssleep(5000);
+}
+
+/*
* End of level code
*/
static void end_level(int done)
@@ -644,9 +701,11 @@ static void end_level(int done)
}
for ( i = 0 ; i < 3 ; i++ ) {
+ int32_t t;
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));
+ t = bests.level[gp.Level].time_ms[i].time_ms;
+ if ( t != NO_TIME )
+ lprintf(16+i,8, " %d %s ", i+1, format_time(t/1000.0));
}
}
@@ -663,9 +722,10 @@ static void end_level(int done)
}
for ( i = 0 ; i < 3 ; i++ ) {
+ int64_t s = bests.level[gp.Level].score[i].score;
color(0,(rank == i+1) ? gp.c : gp.c2);
- lprintf(16+i,21, " %d %lld ", i+1,
- bests.level[gp.Level].score[i].score);
+ if ( s )
+ lprintf(16+i,21, " %d %lld ", i+1, s);
}
}
@@ -676,23 +736,29 @@ static void end_level(int done)
gp.Level++;
- /* Level Hyperspace */
- while ( gp.Hyp > 0 ) {
- if ( gp.Level >= ELev-1 ) {
- gp.Hyp = 0;
- break;
+ if ( gp.Level >= ELev ) {
+ super_bonus();
+ gp.Hyp = 0;
+ gp.Lvf = 0;
+ } else {
+ /* Level Hyperspace */
+ while ( gp.Hyp > 0 ) {
+ if ( gp.Level >= ELev-1 ) {
+ gp.Hyp = 0;
+ break;
+ }
+
+ levelscreen();
+
+ lprintf(5, 17, "LEVEL %d", gp.Level+1);
+ lprint(12, 13, "LEVEL HYPERSPACE");
+
+ /* Wait 1 second */
+ mymssleep(1000);
+
+ gp.Hyp--;
+ gp.Level++;
}
-
- levelscreen();
-
- lprintf(5, 17, "LEVEL %d", gp.Level+1);
- lprint(12, 13, "LEVEL HYPERSPACE");
-
- /* Wait 1 second */
- mymssleep(1000);
-
- gp.Hyp--;
- gp.Level++;
}
}