summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2003-03-29 05:16:53 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2003-03-29 05:16:53 (GMT)
commit22dba96a12a6ac7b1075742f93af9a30cd3e0419 (patch)
treef8b5a1fb0103f906456bddcb32c9c10645549951
parent70cd196461b375f0d6bdaea04db1560e12cd27bf (diff)
downloadgrv-22dba96a12a6ac7b1075742f93af9a30cd3e0419.zip
grv-22dba96a12a6ac7b1075742f93af9a30cd3e0419.tar.gz
grv-22dba96a12a6ac7b1075742f93af9a30cd3e0419.tar.bz2
grv-22dba96a12a6ac7b1075742f93af9a30cd3e0419.tar.xz
Fix rocks falling on each other; apples activated by falling rocks
(can't actually happen, though)
-rw-r--r--play.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/play.c b/play.c
index b35aaf4..ba843e6 100644
--- a/play.c
+++ b/play.c
@@ -319,9 +319,22 @@ void fall_apple(int x, int y)
}
}
+static void activate_apple(int x, int y)
+{
+ int attr = screen1(x,y);
+
+ /* if not flashing... */
+ if ( !(attr & 0x80) ) {
+ color(16+(attr & 15), (attr >> 4) & 7);
+ lprint(x,y,"\xfe");
+ addaction(x,y,gp.Tid+30.0/(gp.Level+1), act_apple);
+ }
+}
+
void fall_rock(int x, int y)
{
int s, f;
+ int x0 = x, y0 = y;
if ( screen(x,y) != SYM_ROCK )
return;
@@ -350,6 +363,15 @@ void fall_rock(int x, int y)
mymssleep(10);
}
+
+ /* See if there is something above we need to release */
+ if ( x0 > 2 ) {
+ s = screen(x0-1,y0);
+ if ( s == SYM_ROCK )
+ fall_rock(x0-1,y0);
+ else if ( s == SYM_APPLE )
+ activate_apple(x0-1,y0);
+ }
}
static void push_rock(int x, int y)
@@ -468,14 +490,8 @@ static void move_player_to(int x, int y)
break;
}
- /* Released apple */
- if ( su == 0xfe && f != 0 ) {
- /* Set flashing */
- color(fu == 4 ? 16 : 20, fu);
- lprint(x-1,y,"\xfe");
-
- addaction(x-1,y,gp.Tid+30.0/(gp.Level+1), act_apple);
- }
+ if ( su == SYM_APPLE )
+ activate_apple(x-1,y);
if ( x1 > 2 && screen(x1-1,y1) == 0x04 ) {
fall_rock(x1-1,y1);