summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-03-01 05:12:55 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2012-03-01 05:12:55 (GMT)
commitc105886c048e0700de01c6ba327684b67aa0aed1 (patch)
treeec752aa3ccacb7cc32a23b051aff0f9a9ed98bf4
parent9041bb43b4d5de67cab2a2224afcd1c40d53ec87 (diff)
downloadgrv-c105886c048e0700de01c6ba327684b67aa0aed1.zip
grv-c105886c048e0700de01c6ba327684b67aa0aed1.tar.gz
grv-c105886c048e0700de01c6ba327684b67aa0aed1.tar.bz2
grv-c105886c048e0700de01c6ba327684b67aa0aed1.tar.xz
Clean up crap whitespace
-rw-r--r--action.c10
-rw-r--r--bullets.c5
-rw-r--r--drawlevel.c42
-rw-r--r--graphics.c12
-rw-r--r--grv.c8
-rw-r--r--highscore.c16
-rw-r--r--intro.c2
-rw-r--r--keyboard.c1
-rw-r--r--mystery.c6
-rw-r--r--netopen.c7
-rw-r--r--network.h1
-rw-r--r--play.c30
-rw-r--r--prefs.c6
-rw-r--r--random.c38
-rw-r--r--scoretbl.c2
-rw-r--r--test.c2
16 files changed, 91 insertions, 97 deletions
diff --git a/action.c b/action.c
index b592ea2..19f875c 100644
--- a/action.c
+++ b/action.c
@@ -145,7 +145,7 @@ static void blow_bomb(int x, int y, int smash)
for ( y2 = y-patw ; y2 <= y+patw ; y2++ ) {
path = *pattern++;
-
+
if ( y2 < 1 || y2 > 40 )
continue;
@@ -186,7 +186,7 @@ static void blow_bomb(int x, int y, int smash)
if ( !fl )
addaction(x2, y2, gp.Tid+30.0/(gp.Level+1), act_apple);
break;
-
+
case SYM_BOMB:
case 'H':
case 'Y':
@@ -215,7 +215,7 @@ static void blow_bomb(int x, int y, int smash)
lprint(x2,y2," ");
}
}
-
+
/* See if there is something above this row that should be activated */
if ( x2 >= 2 && x2 <= 23 ) {
ch = screen(x2,y2);
@@ -277,7 +277,7 @@ void handle_action(void)
case act_apple:
fall_apple(action.x, action.y);
break;
-
+
case act_bomb:
blow_bomb(action.x, action.y, 0);
break;
@@ -336,5 +336,3 @@ void handle_action(void)
break;
}
}
-
-
diff --git a/bullets.c b/bullets.c
index 2ee4a36..3eac94c 100644
--- a/bullets.c
+++ b/bullets.c
@@ -65,7 +65,7 @@ void run_bullets(void)
for ( b = bb ; b < eb ; b++ ) {
live = 1;
-
+
x = (b->x += b->dx);
y = (b->y += b->dy);
@@ -82,7 +82,7 @@ void run_bullets(void)
} else {
color(b->color, f);
lprint(x,y,"\xf9");
-
+
switch ( s ) {
case SYM_CHERRY:
take_cherry();
@@ -144,4 +144,3 @@ void run_bullets(void)
}
}
}
-
diff --git a/drawlevel.c b/drawlevel.c
index b9500c0..07968b9 100644
--- a/drawlevel.c
+++ b/drawlevel.c
@@ -64,7 +64,7 @@ static void level_crosswall(void)
static void level_wheel(void)
{
int e;
-
+
lprint(8,2,"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb0\xb0");
lprint(15,14,"\xb0\xb0\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1");
@@ -72,7 +72,7 @@ static void level_wheel(void)
lprint(e,28,(e > 13) ? "\xb0" : "\xb1");
for ( e = 9 ; e <= 22 ; e++ )
lprint(e,13,(e < 11) ? "\xb0" : "\xb1");
-
+
level_frame();
}
@@ -85,7 +85,7 @@ static void level_cross(void)
lprint(e,20,"\xb1");
lprint(13,2,"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1");
-
+
level_frame();
}
@@ -134,7 +134,7 @@ static void level_bunker(void)
lprint(e,7," ");
lprint(e,25," ");
}
-
+
gp.Bar = 4;
lprint(10,8,"\xeb");
lprint(10,33,"\xeb");
@@ -144,7 +144,7 @@ static void level_bunker(void)
color(14,0);
lprint(14,7," ");
lprint(14,25," ");
-
+
for ( e = 18 ; e <= 22 ; e++ )
lprint(e,20," ");
@@ -183,7 +183,7 @@ static void level_fred1(void)
lprint(13,2,"\xb1\xb1\xb1\xb1\xb0\xb1\xb1\xb1\xb1");
lprint(13,31,"\xb1\xb1\xb1\xb1\xb0\xb1\xb1\xb1\xb1");
-
+
color(0,gp.c2);
lprint(13,13,"\xeb \xeb");
lprint(13,23,"\xeb \xeb");
@@ -338,7 +338,7 @@ static void level_breakout(void)
lprint(e, 28, " ");
lprint(e, 34, " ");
}
-
+
color(0,gp.c2);
for ( e = 11 ; e <= 13 ; e++ ) {
lprint(e, 8, " ");
@@ -381,7 +381,7 @@ static void level_arch(void)
lprint(x, 14, " ");
lprint(x, 25, " ");
}
-
+
for ( y = 19 ; y <= 22 ; y++ ) {
lprint(11, y, "\xcd");
addaction(11, y, 20, act_door);
@@ -415,7 +415,7 @@ static void level_macke1(void)
Ghosts = Ghost1;
lprint(13, 2, "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1");
-
+
color(0,0);
for ( e = 8 ; e <= 15 ; e++ ) {
@@ -436,7 +436,7 @@ static void level_macke1(void)
lprint(12, 25, "\xb0");
lprint(13, 16, "\xb0");
lprint(13, 25, "\xb0");
-
+
color(0,gp.c2);
for ( e = 16 ; e <= 22 ; e++ ) {
lprint(e, 18, " ");
@@ -551,7 +551,7 @@ static void add_white(int x, int y)
{
int nw = gp.nwhite++;
int xw = irnd(nw+1);
-
+
gp.whitecherrylist[nw] = gp.whitecherrylist[xw];
gp.whitecherrylist[xw].x = x;
gp.whitecherrylist[xw].y = y;
@@ -591,7 +591,7 @@ static void level_finale(void)
for ( e = 1 ; e <= 5 ; e++ )
white2black();
-
+
if ( gp.ZLevel > 0 )
addaction(0, 0, 10, act_droplevel); /* drop 1 reentry level */
@@ -645,9 +645,9 @@ static void draw_bombs(void)
int i, j, e, z, xbg;
z = gp.Level/10;
-
+
gp.Bombs += z;
-
+
for ( e = 0 ; e < z ; e++ ) {
unbusy(i,j);
@@ -664,7 +664,7 @@ static void draw_shots(void)
int i, j, e, z, xbg;
z = 1 + (gp.Level > 9) + (gp.Level > 14) + (gp.Level > 24);
-
+
for ( e = 0 ; e < z ; e++ ) {
unbusy(i,j);
@@ -680,7 +680,7 @@ static void draw_cluster(void)
int i, j, e, z, xbg;
z = (int)(gp.Level/10.0+rnd());
-
+
for ( e = 0 ; e < z ; e++ ) {
unbusy(i,j);
@@ -696,7 +696,7 @@ static void draw_mystery(void)
int i, j, e, z, xbg;
z = (gp.Level > 11) + (gp.Level > 19) + (gp.Level > 24);
-
+
for ( e = 0 ; e < z ; e++ ) {
unbusy(i,j);
@@ -712,7 +712,7 @@ static void draw_apples(void)
int i, j, e, z, xbg;
z = min(gp.Level+2,20);
-
+
for ( e = 0 ; e < z ; e++ ) {
unbusy2(i,j);
@@ -786,7 +786,7 @@ void levelscreen(void)
gp.c2 = colors[gp.Level % CCYCLMAX].anti;
color(0, gp.c);
initscreen(40);
-}
+}
/* Main level-drawing function */
void drawlevel(void)
@@ -879,7 +879,7 @@ void drawlevel(void)
if ( level >= 29 )
draw_bombs();
-
+
if ( gp.Lvf >= 4 ) {
draw_hyper();
gp.Lvf = 0;
@@ -959,7 +959,7 @@ void message(int col, const char *fmt, ...)
va_start(ap, fmt);
vsprintf(buffer, fmt, ap);
va_end(ap);
-
+
len = strlen(buffer);
msgbuf[40] = '\0';
diff --git a/graphics.c b/graphics.c
index ea47d3b..161007e 100644
--- a/graphics.c
+++ b/graphics.c
@@ -127,13 +127,13 @@ static void put_screen(int tx, int ty)
int attr;
int pxwid = current.dwidth + 1;
int bmask = blink_mask;
-
+
attr = screendata[ty][tx].attr;
fontp = grv_font[screendata[ty][tx].sym];
bgp = colors[(attr >> 4) & 7];
fgp = (bmask & attr) ? bgp : colors[attr & 15];
-
+
/*
* This assumes that either unaligned references are okay, or
* pitch will be a multiple of 4.
@@ -320,7 +320,7 @@ void cls(void)
SDL_Rect rect;
lock_screen();
-
+
empty.sym = ' ';
empty.attr = current.attr;
@@ -349,17 +349,17 @@ struct saved_screen
struct current_screen current;
struct screen_char screendata[TS_HEIGHT][TS_WIDTH];
};
-
+
struct saved_screen *save_screen(void)
{
struct saved_screen *save = malloc(sizeof(struct saved_screen));
-
+
if ( !save )
return NULL;
memcpy(&save->current, &current, sizeof(current));
memcpy(&save->screendata, &screendata, sizeof(screendata));
-
+
return save;
}
diff --git a/grv.c b/grv.c
index 22db93a..9e3bdc9 100644
--- a/grv.c
+++ b/grv.c
@@ -35,7 +35,7 @@ int xread(int fd, void *buf, size_t count)
} else if ( rv == 0 ) {
return n;
}
-
+
count -= rv;
n += rv;
b += rv;
@@ -68,7 +68,7 @@ void init_gameparams(void)
{
/* We might have /dev/urandom */
int fd = open("/dev/urandom", O_RDONLY);
-
+
if ( fd >= 0 ) {
if ( xread(fd, &gp.gameid, sizeof(gp.gameid)) == sizeof(gp.gameid) )
gp.have_id = 1;
@@ -150,7 +150,7 @@ void game(void)
newlevel();
}
highscore_endgame();
-}
+}
struct opts opt;
@@ -185,7 +185,7 @@ int main(int argc, char *argv[])
mkdir(grvd, 0777); /* Make .grv directory if missing */
}
}
-
+
if ( grvd )
chdir(grvd); /* Change to .grv directory */
}
diff --git a/highscore.c b/highscore.c
index e8f41d3..37bceaf 100644
--- a/highscore.c
+++ b/highscore.c
@@ -58,7 +58,7 @@ void highscore_upload(void)
}
}
}
-
+
/*
* Allow the user to enter the name for the high score
*/
@@ -82,7 +82,7 @@ static void enter_name(int rank, char *player)
color(0,gp.c);
lprint(15,11,"ENTER YOUR INITIALS!");
-
+
color(0,gp.c2);
lprint(17,1,symbols[0]);
lprint(18,1,symbols[1]);
@@ -116,7 +116,7 @@ static void enter_name(int rank, char *player)
do {
ke = get_key();
-
+
if ( ke->keysym.sym == kbd_keys[0] ) {
x = max(0,x-1);
if ( x != x1 ) y = vy;
@@ -156,7 +156,7 @@ static void enter_name(int rank, char *player)
lprint(x1+17,y1+1,s);
}
}
-
+
/*
* Display highscore screen; optionally show the user rank
@@ -171,14 +171,14 @@ void highscore_show(int myrank, int upload)
color(0,gp.c);
lprint(1,15,"THE TOP TEN");
-
+
for ( i = 0 ; i < 10 ; i++ ) {
if ( bests.total[i].score )
lprintf(i+4,4,"%2d %-13" PRId64 " %-9.9s (%2d)",
i+1, bests.total[i].score,
bests.total[i].player,
bests.total[i].endlvl+1);
-
+
if ( i+1 == myrank ) {
color(0,gp.c2);
lprint(i+4,23,".........");
@@ -199,9 +199,9 @@ void highscore_show(int myrank, int upload)
color(0,gp.c);
lprint(21,8,"Please press any key . . .");
get_key();
-
+
initscreen(80);
-
+
x = 1; y = 1;
for ( i = 10 ; i < 100 ; i++ ) {
if ( i+1 == myrank )
diff --git a/intro.c b/intro.c
index ca3e3c8..d3ff31a 100644
--- a/intro.c
+++ b/intro.c
@@ -11,7 +11,7 @@ void intro(void)
{
gp.c = 1;
gp.c2 = 6;
-
+
initscreen(40);
color(14,0);
diff --git a/keyboard.c b/keyboard.c
index 69f4732..bcb905b 100644
--- a/keyboard.c
+++ b/keyboard.c
@@ -78,4 +78,3 @@ SDL_KeyboardEvent *get_key(void)
}
return NULL;
}
-
diff --git a/mystery.c b/mystery.c
index 747f690..71b07dd 100644
--- a/mystery.c
+++ b/mystery.c
@@ -63,16 +63,16 @@ void mystery(void)
if ( gp.FS == 0 )
goto again;
-
+
message(0,"Treasure: Ghost freeze");
gp.FS = 0; /* Ghosts frozen */
-
+
color(10,0);
for ( e = 0 ; e < MAXGHOST ; e++ ) {
if ( !ghost[e].dead )
lprint(ghost[e].x, ghost[e].y, "\x02");
}
-
+
/* Just in case we have scared ghosts right now... */
removeaction(0, 0, act_ghost_thaw);
removeaction(0, 0, act_ghost_normal);
diff --git a/netopen.c b/netopen.c
index 4599384..9fc0ece 100644
--- a/netopen.c
+++ b/netopen.c
@@ -80,7 +80,7 @@ static int output_send(netcon_t nc)
nc->bufdata = nc->buffer;
nc->buffill = 0;
-
+
return oc;
}
@@ -107,7 +107,7 @@ char *fgets_network(char *s, int size, netcon_t nc)
int ch;
char *p = s;
int cr = 0;
-
+
if ( size == 0 )
return NULL;
@@ -127,7 +127,7 @@ char *fgets_network(char *s, int size, netcon_t nc)
return cr ? s : NULL;
}
-
+
int fputs_network(const char *s, netcon_t nc)
{
int b = strlen(s);
@@ -336,4 +336,3 @@ netcon_t fopen_network(const char *name, int port, int is_write)
return sock_to_netcon(sock, is_write);
}
-
diff --git a/network.h b/network.h
index 040b708..386221a 100644
--- a/network.h
+++ b/network.h
@@ -29,4 +29,3 @@ int fclose_network(netcon_t);
netcon_t fopen_network(const char *name, int port, int is_write);
#endif /* NETWORK_H */
-
diff --git a/play.c b/play.c
index 2daa9ba..93fc725 100644
--- a/play.c
+++ b/play.c
@@ -167,7 +167,7 @@ static void handle_key(SDL_KeyboardEvent *ke)
break;
}
}
-
+
if ( sym == kbd_keys[0] ) {
/* Up */
gp.XWk = (gp.XWk > 0) ? 0 : -1;
@@ -515,7 +515,7 @@ static void move_player(void)
x1 = gp.x; y1 = gp.y;
x = gp.x + gp.XWk;
y = gp.y + gp.YWk;
-
+
if ( x < 2 ) {
x = 2; gp.XWk = 0;
}
@@ -598,10 +598,10 @@ static void move_ghosts(void)
for ( i = 0 ; i < 4 ; i++ ) {
int s, f;
-
+
x = x1 + rx[rkt[r][i]] * gp.FS;
y = y1 + ry[rkt[r][i]] * gp.FS;
-
+
if ( x < 2 || x > 23 || y < 1 || y > 40 )
continue;
@@ -617,7 +617,7 @@ static void move_ghosts(void)
ghost[e].x = x;
ghost[e].y = y;
-
+
if ( s == 0x01 )
taken_by_ghost();
@@ -625,7 +625,7 @@ static void move_ghosts(void)
}
}
}
-}
+}
/*
* End of game/super bonus code
@@ -642,7 +642,7 @@ static void super_bonus(void)
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;
@@ -652,7 +652,7 @@ static void super_bonus(void)
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);
@@ -661,7 +661,7 @@ static void super_bonus(void)
print("...");
gp.Level = gp.ZLevel;
-
+
mymssleep(5000);
}
@@ -753,7 +753,7 @@ static void end_level(int done)
lprintf(16+i,21, " %d %" PRId64 " ", i+1, s);
}
}
-
+
/* Wait 4 seconds */
if ( gp.EOLWait ) {
mymssleep(4000);
@@ -772,15 +772,15 @@ static void end_level(int done)
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++;
}
@@ -825,7 +825,7 @@ void play(void)
if ( (ke = poll_key()) )
handle_key(ke);
-
+
move_player();
if ( gp.Status != Status_Live )
break;
diff --git a/prefs.c b/prefs.c
index 6215bd1..b53bf99 100644
--- a/prefs.c
+++ b/prefs.c
@@ -88,11 +88,11 @@ void set_keys(void)
color(0,gp.c);
for ( i = 0 ; i < NKEYS ; i++ )
lprintf(i+3, 26, "%-10s", SDL_GetKeyName(kbd_keys[i]));
-
+
for ( i = 0 ; i < NKEYS ; i++ ) {
color(0,gp.c2);
lprintf(i+3, 26, "%-10s", SDL_GetKeyName(kbd_keys[i]));
-
+
kbd_keys[i] = get_key()->keysym.sym;
color(0,gp.c);
lprintf(i+3, 26, "%-10s", SDL_GetKeyName(kbd_keys[i]));
@@ -111,7 +111,7 @@ void set_keys(void)
color(0,gp.c);
lprint(20,5,"Edit again? (Y/N) ");
-
+
while ( !bad ) {
switch ( get_key()->keysym.sym ) {
case SDLK_y:
diff --git a/random.c b/random.c
index e86b14d..1aac839 100644
--- a/random.c
+++ b/random.c
@@ -1,12 +1,12 @@
-/*
+/*
A C-program for MT19937, with initialization improved 2002/1/26.
Coded by Takuji Nishimura and Makoto Matsumoto.
- Before using, initialize the state by using init_genrand(seed)
+ Before using, initialize the state by using init_genrand(seed)
or init_by_array(init_key, key_length).
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
- All rights reserved.
+ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -19,8 +19,8 @@
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- 3. The names of its contributors may not be used to endorse or promote
- products derived from this software without specific prior written
+ 3. The names of its contributors may not be used to endorse or promote
+ products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -43,7 +43,7 @@
#include <stdio.h>
-/* Period parameters */
+/* Period parameters */
#define N 624
#define M 397
#define MATRIX_A 0x9908b0dfUL /* constant vector a */
@@ -58,8 +58,8 @@ void init_genrand(unsigned long s)
{
mt[0]= s & 0xffffffffUL;
for (mti=1; mti<N; mti++) {
- mt[mti] =
- (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
+ mt[mti] =
+ (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
/* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
/* In the previous versions, MSBs of the seed affect */
/* only MSBs of the array mt[]. */
@@ -95,7 +95,7 @@ unsigned long init_key[], key_length;
if (i>=N) { mt[0] = mt[N-1]; i=1; }
}
- mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
+ mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
}
/* generates a random number on [0,0xffffffff]-interval */
@@ -124,7 +124,7 @@ unsigned long genrand_int32(void)
mti = 0;
}
-
+
y = mt[mti++];
/* Tempering */
@@ -145,27 +145,27 @@ long genrand_int31(void)
/* generates a random number on [0,1]-real-interval */
double genrand_real1(void)
{
- return genrand_int32()*(1.0/4294967295.0);
- /* divided by 2^32-1 */
+ return genrand_int32()*(1.0/4294967295.0);
+ /* divided by 2^32-1 */
}
/* generates a random number on [0,1)-real-interval */
double genrand_real2(void)
{
- return genrand_int32()*(1.0/4294967296.0);
+ return genrand_int32()*(1.0/4294967296.0);
/* divided by 2^32 */
}
/* generates a random number on (0,1)-real-interval */
double genrand_real3(void)
{
- return (((double)genrand_int32()) + 0.5)*(1.0/4294967296.0);
+ return (((double)genrand_int32()) + 0.5)*(1.0/4294967296.0);
/* divided by 2^32 */
}
/* generates a random number on [0,1) with 53-bit resolution*/
-double genrand_res53(void)
-{
- unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
- return(a*67108864.0+b)*(1.0/9007199254740992.0);
-}
+double genrand_res53(void)
+{
+ unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
+ return(a*67108864.0+b)*(1.0/9007199254740992.0);
+}
diff --git a/scoretbl.c b/scoretbl.c
index 5c66b58..78d9726 100644
--- a/scoretbl.c
+++ b/scoretbl.c
@@ -130,7 +130,7 @@ static unsigned char *unquote(const char *i)
i += 2;
}
*o++ = '\0';
-
+
return buf;
}
diff --git a/test.c b/test.c
index cc634dc..f46816b 100644
--- a/test.c
+++ b/test.c
@@ -6,7 +6,7 @@
int main(int argc, char *argv[])
{
int i, j;
-
+
screen_init();
color(0, 1);
cls();