diff options
author | christos <christos@NetBSD.org> | 2020-11-10 22:42:19 +0000 |
---|---|---|
committer | christos <christos@NetBSD.org> | 2020-11-10 22:42:19 +0000 |
commit | a6ad8fb14c6bed68eb8b37750e1b2fea36a8c908 (patch) | |
tree | 96a006165d8615e5e0cb4e78ef064e66b8e16437 /warp/init.c | |
parent | 1bb28c57a5d2c06152fff5de57a902bec60cc30d (diff) | |
download | bsdgames-darwin-a6ad8fb14c6bed68eb8b37750e1b2fea36a8c908.tar.gz bsdgames-darwin-a6ad8fb14c6bed68eb8b37750e1b2fea36a8c908.tar.zst bsdgames-darwin-a6ad8fb14c6bed68eb8b37750e1b2fea36a8c908.zip |
Time warp forward 34 years so that it compiles (but not work)
Diffstat (limited to 'warp/init.c')
-rw-r--r-- | warp/init.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/warp/init.c b/warp/init.c index 401b5acc..fc9bea13 100644 --- a/warp/init.c +++ b/warp/init.c @@ -34,33 +34,33 @@ #include "init.h" void -initialize() +initialize(void) { - Reg1 int i; - Reg2 int x; - Reg3 int y; - Reg4 int dist; - Reg5 int ydist; - Reg6 int xdist; + int i; + int x; + int y; + int dist; + int ydist = 0; + int xdist = 0; long e; - int yoff, xoff, ypred, xpred; - Reg7 OBJECT *obj; + int yoff = 0, xoff = 0, ypred, xpred; + OBJECT *obj = NULL; char ch; FILE *mapfp = NULL; bool tmptholspec; int inhabjackpot; long inhenergy; int walksplit = 200; - static char *distname[] = + static const char *distname[] = {" #"," -"," \\"," /", " |"," *"," `"," '"}; - cloaking = madgorns = FALSE; + cloaking = madgorns = false; deados = madfriends = 0; curscore = possiblescore = 0L; yamblast = xamblast = ambsize = 0; if (smarts > 90) - massacre = TRUE; + massacre = true; scandist = (massacre?20:15); antibase = (smarts>60?1:(smarts>40?2:(smarts>25?4:100))); sm35 = (smarts>35?35:smarts); @@ -100,14 +100,15 @@ initialize() yblasted[y] = 0; for (x=0; x<XSIZE; x++) xblasted[x] = 0; - blasted = FALSE; - if (!starspec) + blasted = false; + if (!starspec) { if (smarts < 15) inumstars = 50 + rand_mod(50); else if (smarts < 50 || smarts > 85) inumstars = exdis(800) + rand_mod(100) + 1; else /* too few stars makes 50..85 too hard */ inumstars = exdis(700) + rand_mod(150-super*2) + 50+super*2; + } tmptholspec = (smarts > 15 && inumstars < 450 && ! rand_mod(90-sm80)); if (!klingspec) { inumenemies = rand_mod((smarts+1)/2) + 1; @@ -203,7 +204,7 @@ stars_again: if (debugging) printf(" P\r\n"); dist = 0; - Sprintf(spbuf,"smap.%d", + snprintf(spbuf, sizeof(spbuf), "smap.%d", (prescene>=0?prescene:rand_mod(MAPS)) ); if ((mapfp = fopen(spbuf,"r")) != NULL && fgets(spbuf,10,mapfp) != NULL ) { @@ -216,7 +217,7 @@ stars_again: xoff = rand_mod(XSIZE); /* how much to shift x */ } else { - prespec = FALSE; + prespec = false; prescene = -1; if (rand_mod(2)) goto scenario_again; @@ -356,7 +357,7 @@ stars_again: } } if (mapfp != NULL) - Fclose(mapfp); + fclose(mapfp); if (numcrushes) { do { x = rand_mod(XSIZE); @@ -515,7 +516,7 @@ stars_again: mvaddch(base->posy+1, base->posx*2, base->image); sleep(2); { - Reg7 OBJECT *curobj; + OBJECT *curobj; for (curobj = root.next; curobj != &root; curobj = curobj->next) { mvaddch(curobj->posy+1, curobj->posx*2, curobj->image); @@ -528,7 +529,7 @@ stars_again: whenok = 0; timer = 0; finish = 0; - bombed_out = FALSE; + bombed_out = false; if (ent) entmode = status = 0; else @@ -537,7 +538,7 @@ stars_again: else status = 3; - Sprintf(spbuf, + snprintf(spbuf, sizeof(spbuf), "%-4s E: %4d %2d B: %5d %3d Enemies: %-3d Stars: %-3d Stardate%5d.%1d %9ld", " ", 0, 0, 0, 0, 0, 0, smarts * 100, 0, 0L); mvaddstr(0,0,spbuf); |