summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-02-27 05:42:05 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2012-02-27 05:42:05 (GMT)
commit6d349aebe9db752359f485ba07edeec937491c18 (patch)
treea8f02c95e2261b173352f2f33ac47af31ec0e935
parent72e0efb120e2da54e739ec7701bc8a37cb406401 (diff)
downloadgrv-6d349aebe9db752359f485ba07edeec937491c18.zip
grv-6d349aebe9db752359f485ba07edeec937491c18.tar.gz
grv-6d349aebe9db752359f485ba07edeec937491c18.tar.bz2
grv-6d349aebe9db752359f485ba07edeec937491c18.tar.xz
Minor code cleanups; no functional change
-rw-r--r--drawlevel.c64
-rw-r--r--play.c14
2 files changed, 38 insertions, 40 deletions
diff --git a/drawlevel.c b/drawlevel.c
index 069cda1..a1339e8 100644
--- a/drawlevel.c
+++ b/drawlevel.c
@@ -547,46 +547,48 @@ static void level_full(void)
level_frame();
}
+static void add_white(int x, int y)
+{
+ int nw = gp.nwhite++;
+
+ gp.whitecherrylist[nw].x = x;
+ gp.whitecherrylist[nw].y = y;
+ lprint(x, y, "\xeb");
+}
+
/* Level 75: Finale */
static void level_finale(void)
{
int i, j, e;
- int nw;
-
- gp.nextwhite = 0;
- nw = 0;
-#define ADDW(i,j) ( gp.whitecherrylist[nw].x = (i), \
- gp.whitecherrylist[nw].y = (j), \
- lprint((i),(j),"\xeb"), \
- nw++ )
+ gp.nextwhite = gp.nwhite = 0;
color(15, gp.c);
for ( i = 3 ; i <= 22 ; i += 2 ) {
- ADDW(i,2);
- ADDW(i,6);
- ADDW(i,10);
- ADDW(i,14);
- ADDW(i,18);
- ADDW(i,22);
- ADDW(i,26);
- ADDW(i,30);
- ADDW(i,34);
- ADDW(i,38);
-
- ADDW(i+1,4);
- ADDW(i+1,8);
- ADDW(i+1,12);
- ADDW(i+1,16);
- ADDW(i+1,20);
- ADDW(i+1,24);
- ADDW(i+1,28);
- ADDW(i+1,32);
- ADDW(i+1,36);
- }
- gp.Bar = gp.nwhite = nw;
+ add_white(i,2);
+ add_white(i,6);
+ add_white(i,10);
+ add_white(i,14);
+ add_white(i,18);
+ add_white(i,22);
+ add_white(i,26);
+ add_white(i,30);
+ add_white(i,34);
+ add_white(i,38);
+
+ add_white(i+1,4);
+ add_white(i+1,8);
+ add_white(i+1,12);
+ add_white(i+1,16);
+ add_white(i+1,20);
+ add_white(i+1,24);
+ add_white(i+1,28);
+ add_white(i+1,32);
+ add_white(i+1,36);
+ }
+ gp.Bar = gp.nwhite;
/* Shuffle the white cherry list */
- for ( i = nw-1 ; i >= 0 ; i-- ) {
+ for ( i = gp.nwhite-1 ; i >= 0 ; i-- ) {
struct xy tmp;
j = irnd(i+1);
diff --git a/play.c b/play.c
index b402ef8..2daa9ba 100644
--- a/play.c
+++ b/play.c
@@ -410,23 +410,19 @@ static void push_rock(int x, int y)
static void move_player_to(int x, int y)
{
int x1 = gp.x, y1 = gp.y;
- int s, m, f; /* Why these names? */
- int su, mu, fu; /* Same thing for the space above */
+ int s, m; /* Symbol, foreground */
+ int su; /* Symbol above */
int hpp = 0;
char sbuf[2];
s = screen(x,y);
m = fg(x,y);
- f = bg(x,y);
sbuf[0] = s; sbuf[1] = '\0';
- if ( x > 2 ) {
+ if ( x > 2 )
su = screen(x-1,y);
- mu = fg(x-1,y);
- fu = bg(x-1,y);
- } else {
- su = ' '; mu = 0; fu = gp.c;
- }
+ else
+ su = ' ';
if ( strchr(DOORS "\xfe\xb1\xe5\x0f", s) ||
(s == SYM_CHERRY && m == 15) ) {