summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-12-11 05:34:37 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2010-12-11 05:34:37 (GMT)
commit77aa703a56db7fb52241e1e697b581cff38125cf (patch)
treec04e0316b8856ad6610fff002482a9d7c49f8299
parent6c3797c53ce9b02fcc185d4c28303163283209d9 (diff)
downloadgrv-77aa703a56db7fb52241e1e697b581cff38125cf.zip
grv-77aa703a56db7fb52241e1e697b581cff38125cf.tar.gz
grv-77aa703a56db7fb52241e1e697b581cff38125cf.tar.bz2
grv-77aa703a56db7fb52241e1e697b581cff38125cf.tar.xz
Add an infinite life cheat
Add an infinite life cheat (Alt-z); more efficient than pressing Alt-x repeatedly during testing.
-rw-r--r--drawlevel.c3
-rw-r--r--grv.h1
-rw-r--r--play.c14
3 files changed, 18 insertions, 0 deletions
diff --git a/drawlevel.c b/drawlevel.c
index 1c1d1ff..069cda1 100644
--- a/drawlevel.c
+++ b/drawlevel.c
@@ -805,6 +805,9 @@ void drawlevel(void)
levelscreen();
lprintf(1,1,"SCORE:% " PRId64, gp.Sc);
+ if ( gp.InfLife )
+ gp.Life = 6;
+
locate(1,18);
color(14,gp.c);
for ( e = 1 ; e <= gp.Life ; e++ ) {
diff --git a/grv.h b/grv.h
index 74dd6d6..1b64ee2 100644
--- a/grv.h
+++ b/grv.h
@@ -57,6 +57,7 @@ struct gameparams {
int c; /* Main level color */
int c2; /* Alternate level color */
int Cheat; /* Cheat codes used */
+ int InfLife; /* Infinite life cheat */
int EOLWait; /* Standard death/end of level pause? */
int TZero; /* Time at start of level (ms) */
int Speed; /* Desired game speed ms/game round */
diff --git a/play.c b/play.c
index 1eba9f9..b402ef8 100644
--- a/play.c
+++ b/play.c
@@ -132,6 +132,20 @@ static void handle_key(SDL_KeyboardEvent *ke)
lprintf(1,16+2*gp.Life, "\x01");
}
break;
+ case SDLK_z: /* Infinite life */
+ {
+ int e;
+
+ gp.Cheat = 1;
+ gp.Life = 6;
+ gp.InfLife = 1;
+ locate(1,18);
+ color(14,gp.c);
+ for ( e = 1 ; e <= gp.Life ; e++ ) {
+ print("\x01 ");
+ }
+ }
+ break;
case SDLK_b: /* All white -> black */
gp.Cheat = 1;
while ( gp.nwhite )