* @(#)crc.c 5.2 (Berkeley) 4/4/91
* @(#)crc.c 8.1 (Berkeley) 5/31/93
* $FreeBSD: src/games/adventure/crc.c,v 1.6 1999/12/19 00:21:50 billf Exp $
- * $DragonFly: src/games/adventure/crc.c,v 1.2 2003/06/17 04:25:22 dillon Exp $
+ * $DragonFly: src/games/adventure/crc.c,v 1.3 2007/04/18 18:32:12 swildner Exp $
*/
#include <sys/types.h>
u_int step;
void
-crc_start()
+crc_start(void)
{
crcval = step = 0;
}
-u_long crc(ptr, nr) /* Process nr bytes at a time; ptr points to them */
-const char *ptr;
-int nr;
+/* Process nr bytes at a time; ptr points to them */
+u_long
+crc(const char *ptr, int nr)
{
int i;
const char *p;
*
* @(#)done.c 8.1 (Berkeley) 5/31/93
* $FreeBSD: src/games/adventure/done.c,v 1.7 1999/12/19 00:21:50 billf Exp $
- * $DragonFly: src/games/adventure/done.c,v 1.3 2005/03/25 12:56:48 liamfoy Exp $
+ * $DragonFly: src/games/adventure/done.c,v 1.4 2007/04/18 18:32:12 swildner Exp $
*/
/* Re-coding of advent in C: termination routines */
#include <stdlib.h>
#include "hdr.h"
+/* sort of like 20000 */
int
-score() /* sort of like 20000 */
+score(void)
{ int scor,i;
mxscor=scor=0;
for (i=50; i<=maxtrs; i++)
return(scor);
}
+/* entry=1 means goto 13000 */ /* game is over */
+/* entry=2 means goto 20000 */ /* 3=19000 */
void
-done(entry) /* entry=1 means goto 13000 */ /* game is over */
-int entry; /* entry=2 means goto 20000 */ /* 3=19000 */
+done(int entry)
{ int i,sc;
if (entry==1) mspeak(1);
if (entry==3) rspeak(136);
}
+/* label 90 */
void
-die(entry) /* label 90 */
-int entry;
+die(int entry)
{ int i;
if (entry != 99)
{ rspeak(23);
*
* @(#)init.c 8.1 (Berkeley) 6/2/93
* $FreeBSD: src/games/adventure/init.c,v 1.9.2.1 2001/03/05 11:43:11 kris Exp $
- * $DragonFly: src/games/adventure/init.c,v 1.3 2004/09/12 17:19:58 dillon Exp $
+ * $DragonFly: src/games/adventure/init.c,v 1.4 2007/04/18 18:32:12 swildner Exp $
*/
/* Re-coding of advent in C: data initialization */
static void linkdata (void);
+/* everything for 1st time run */
void
-init() /* everything for 1st time run */
+init(void)
{
rdata(); /* read data from orig. file */
linkdata();
poof();
}
-char *decr(a,b,c,d,e)
-const char *a,*b,*c,*d,*e;
+char *
+decr(const char *a, const char *b, const char *c, const char *d, const char *e)
{
static char buf[6];
return buf;
}
+/* secondary data manipulation */
static void
-linkdata() /* secondary data manipulation */
+linkdata(void)
{ int i,j;
/* array linkages */
closng=panic=closed=scorng=FALSE;
}
-
-
+/* come here if he hits a del */
void
-trapdel(sig) /* come here if he hits a del */
-int sig;
+trapdel(int sig __unused)
{
- sig = 0;
delhit = 1; /* main checks, treats as QUIT */
signal(2,trapdel); /* catch subsequent DELs */
}
-
void
-startup()
+startup(void)
{
demo=Start();
srandomdev();
*
* @(#)io.c 8.1 (Berkeley) 5/31/93
* $FreeBSD: src/games/adventure/io.c,v 1.8.2.1 2001/03/05 11:43:11 kris Exp $
- * $DragonFly: src/games/adventure/io.c,v 1.2 2003/06/17 04:25:22 dillon Exp $
+ * $DragonFly: src/games/adventure/io.c,v 1.3 2007/04/18 18:32:12 swildner Exp $
*/
/* Re-coding of advent in C: file i/o and user i/o */
static void twrite (int);
#endif
+/* get command from user */
+/* no prompt, usually */
void
-getin(wrd1,wrd2) /* get command from user */
-char **wrd1,**wrd2; /* no prompt, usually */
+getin(char **wrd1, char **wrd2)
{ char *s;
static char wd1buf[MAXSTR],wd2buf[MAXSTR];
int first, numch;
}
}
+/* confirm with rspeak */
int
-yes(x,y,z) /* confirm with rspeak */
-int x,y,z;
+yes(int x, int y, int z)
{ int result;
int ch;
return(result);
}
+/* confirm with mspeak */
int
-yesm(x,y,z) /* confirm with mspeak */
-int x,y,z;
+yesm(int x, int y, int z)
{ int result;
int ch;
const char iotape[] = "Ax3F'\003tt$8h\315qer*h\017nGKrX\207:!l";
const char *tape = iotape; /* pointer to encryption tape */
+/* next virtual char, bump adr */
static int
-next() /* next virtual char, bump adr */
+next(void)
{
int ch;
char breakch; /* tell which char ended rnum */
+/* "read" data from virtual file*/
void
-rdata() /* "read" data from virtual file*/
+rdata(void)
{ int sect;
char ch;
char nbf[12];
+/* read initial location num */
static int
-rnum() /* read initial location num */
+rnum(void)
{ char *s;
tape = iotape; /* restart encryption tape */
for (s=nbf,*s=0;; s++)
char *seekhere;
+/* read description-format msgs */
static void
-rdesc(sect) /* read description-format msgs */
-int sect;
+rdesc(int sect)
{
int locc;
char *seekstart, *maystart;
}
+/* read travel table */
static void
-rtrav() /* read travel table */
+rtrav(void)
{ int locc;
struct travlist *t;
char *s;
#ifdef DEBUG
+/* travel options from this loc */
static void
-twrite(loq) /* travel options from this loc */
-int loq;
+twrite(int loq)
{ struct travlist *t;
printf("If");
speak(<ext[loq]);
#endif /* DEBUG */
static void
-rvoc()
+rvoc(void)
{ char *s; /* read the vocabulary */
int rv_index;
char buf[6];
}
+/* initial object locations */
static void
-rlocs() /* initial object locations */
+rlocs(void)
{ for (;;)
{ if ((obj=rnum())<0) break;
plac[obj]=rnum(); /* initial loc for this obj */
}
}
+/* default verb messages */
static void
-rdflt() /* default verb messages */
+rdflt(void)
{ for (;;)
{ if ((verb=rnum())<0) break;
actspk[verb]=rnum();
}
}
+/* liquid assets &c: cond bits */
static void
-rliq() /* liquid assets &c: cond bits */
+rliq(void)
{ int bitnum;
for (;;) /* read new bit list */
{ if ((bitnum=rnum())<0) break;
}
static void
-rhints()
+rhints(void)
{ int hintnum,i;
hntmax=0;
for (;;)
void
-rspeak(msg)
-int msg;
+rspeak(int msg)
{ if (msg!=0) speak(&rtext[msg]);
}
void
-mspeak(msg)
-int msg;
+mspeak(int msg)
{ if (msg!=0) speak(&mtext[msg]);
}
+/* read, decrypt, and print a message (not ptext) */
+/* msg is a pointer to seek address and length of mess */
void
-speak(msg) /* read, decrypt, and print a message (not ptext) */
-const struct text *msg;/* msg is a pointer to seek address and length of mess */
+speak(const struct text *msg)
{
char *s, nonfirst;
}
+/* read, decrypt an print a ptext message */
+/* msg is the number of all the p msgs for this place */
+/* assumes object 1 doesn't have prop 1, obj 2 no prop 2 &c*/
void
-pspeak(m,skip) /* read, decrypt an print a ptext message */
-int m; /* msg is the number of all the p msgs for this place */
-int skip; /* assumes object 1 doesn't have prop 1, obj 2 no prop 2 &c*/
+pspeak(int m, int skip)
{
char *s,nonfirst;
char *numst, ps_save;
*
* @(#)save.c 8.1 (Berkeley) 5/31/93
* $FreeBSD: src/games/adventure/save.c,v 1.8 1999/12/19 00:21:51 billf Exp $
- * $DragonFly: src/games/adventure/save.c,v 1.2 2003/06/17 04:25:22 dillon Exp $
+ * $DragonFly: src/games/adventure/save.c,v 1.3 2007/04/18 18:32:12 swildner Exp $
*/
#include <stdio.h>
{NULL, 0}
};
+/* Two passes on data: first to get checksum, second */
+/* to output the data using checksum to start random #s */
int
-save(outfile) /* Two passes on data: first to get checksum, second */
-const char *outfile; /* to output the data using checksum to start random #s */
+save(const char *outfile)
{
FILE *out;
struct savestruct *p;
}
int
-restore(infile)
-const char *infile;
+restore(const char *infile)
{
FILE *in;
struct savestruct *p;
*
* @(#)subr.c 8.1 (Berkeley) 5/31/93
* $FreeBSD: src/games/adventure/subr.c,v 1.7.2.1 2001/03/05 11:43:11 kris Exp $
- * $DragonFly: src/games/adventure/subr.c,v 1.3 2005/03/25 12:56:48 liamfoy Exp $
+ * $DragonFly: src/games/adventure/subr.c,v 1.4 2007/04/18 18:32:12 swildner Exp $
*/
/* Re-coding of advent in C: subroutines from main */
/* Statement functions */
int
-toting(objj)
-int objj;
+toting(int objj)
{ if (place[objj] == -1) return(TRUE);
else return(FALSE);
}
int
-here(objj)
-int objj;
+here(int objj)
{ if (place[objj]==loc || toting(objj)) return(TRUE);
else return(FALSE);
}
int
-at(objj)
-int objj;
+at(int objj)
{ if (place[objj]==loc || fixed[objj]==loc) return(TRUE);
else return (FALSE);
}
static int
-liq2(pbotl)
-int pbotl;
+liq2(int pbotl)
{ return((1-pbotl)*water+(pbotl/2)*(water+oil));
}
int
-liq()
+liq(void)
{ int i;
i=prop[bottle];
if (i>-1-i) return(liq2(i));
else return(liq2(-1-i));
}
+/* may want to clean this one up a bit */
int
-liqloc(locc) /* may want to clean this one up a bit */
-int locc;
+liqloc(int locc)
{ int i,j,l;
i=cond[locc]/2;
j=((i*2)%8)-5;
}
static int
-bitset(l,n)
-int l,n;
+bitset(int l, int n)
{ if (cond[l] & setbit[n]) return(TRUE);
return(FALSE);
}
int
-forced(locc)
-int locc;
+forced(int locc)
{ if (cond[locc]==2) return(TRUE);
return(FALSE);
}
int
-dark()
+dark(void)
{ if ((cond[loc]%2)==0 && (prop[lamp]==0 || !here(lamp)))
return(TRUE);
return(FALSE);
}
int
-pct(n)
-int n;
+pct(int n)
{ if (ran(100)<n) return(TRUE);
return(FALSE);
}
+/* 71 */
int
-fdwarf() /* 71 */
+fdwarf(void)
{ int i,j;
struct travlist *kk;
}
+/* label 8 */
int
-march() /* label 8 */
+march(void)
{ int ll1,ll2;
if ((tkk=travel[newloc=loc])==0) bug(26);
}
-
+/* 20 */
static int
-mback() /* 20 */
+mback(void)
{ struct travlist *tk2,*j;
int ll;
if (forced(k=oldloc)) k=oldlc2; /* k=location */
}
+/* 30000 */
static int
-specials() /* 30000 */
+specials(void)
{ switch(newloc -= 300)
{ case 1: /* 30100 */
newloc = 99+100-loc;
}
+/* 30300 */
static int
-trbridge() /* 30300 */
+trbridge(void)
{ if (prop[troll]==1)
{ pspeak(troll,1);
prop[troll]=0;
}
+/* 20 */
static void
-badmove() /* 20 */
+badmove(void)
{ spk=12;
if (k>=43 && k<=50) spk=9;
if (k==29||k==30) spk=9;
}
int
-bug(n)
-int n;
+bug(int n)
{ printf("Please tell jim@rand.org that fatal bug %d happened.\n",n);
exit(1);
}
+/* 2600 &c */
void
-checkhints() /* 2600 &c */
+checkhints(void)
{ int hint;
for (hint=4; hint<=hntmax; hint++)
{ if (hinted[hint]) continue;
}
+/* 9030 */
int
-trsay() /* 9030 */
+trsay(void)
{ int i;
if (*wd2!=0) strcpy(wd1,wd2);
i=vocab(wd1,-1,0);
}
+/* 9010 */
int
-trtake() /* 9010 */
+trtake(void)
{
if (toting(obj)) return(2011); /* 9010 */
spk=25;
}
+/* 9021 */
static int
-dropper() /* 9021 */
+dropper(void)
{ k=liq();
if (k==obj) obj=bottle;
if (obj==bottle&&k!=0) place[k]=0;
return(2012);
}
+/* 9020 */
int
-trdrop() /* 9020 */
+trdrop(void)
{
if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
if (!toting(obj)) return(2011);
}
+/* 9040 */
int
-tropen() /* 9040 */
+tropen(void)
{ if (obj==clam||obj==oyster)
{ k=0; /* 9046 */
if (obj==oyster) k=1;
}
+/* 9120 */
int
-trkill() /* 9120 */
+trkill(void)
{ int i;
for (i=1; i<=5; i++)
if (dloc[i]==loc&&dflag>=2) break;
}
+/* 9170: throw */
int
-trtoss() /* 9170: throw */
+trtoss(void)
{ int i;
if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
if (!toting(obj)) return(2011);
}
+/* 9210 */
int
-trfeed() /* 9210 */
+trfeed(void)
{ if (obj==bird)
{ spk=100;
return(2011);
}
+/* 9220 */
int
-trfill() /* 9220 */
+trfill(void)
{ if (obj==vase)
{ spk=29;
if (liqloc(loc)==0) spk=144;
}
+/* 10000 */
void
-closing() /* 10000 */
+closing(void)
{ int i;
prop[grate]=prop[fissur]=0;
}
+/* 11000 */
void
-caveclose() /* 11000 */
+caveclose(void)
{ int i;
prop[bottle]=put(bottle,115,1);
prop[plant]=put(plant,115,0);
*
* @(#)vocab.c 8.1 (Berkeley) 5/31/93
* $FreeBSD: src/games/adventure/vocab.c,v 1.9 1999/12/19 00:21:51 billf Exp $
- * $DragonFly: src/games/adventure/vocab.c,v 1.3 2005/03/25 12:56:48 liamfoy Exp $
+ * $DragonFly: src/games/adventure/vocab.c,v 1.4 2007/04/18 18:32:12 swildner Exp $
*/
/* Re-coding of advent in C: data structure routines */
#include "hdr.h"
void
-dstroy(object)
-int object;
+dstroy(int object)
{ move(object,0);
}
void
-juggle(object)
-int object;
+juggle(int object)
{ int i,j;
i=place[object];
void
-move(object,where)
-int object,where;
+move(int object, int where)
{ int from;
if (object<=100)
int
-put(object,where,pval)
-int object,where,pval;
+put(int object, int where, int pval)
{ move(object,where);
return(-1-pval);
}
void
-carry(object,where)
-int object,where;
+carry(int object, int where)
{ int temp;
if (object<=100)
void
-drop(object,where)
-int object,where;
+drop(int object, int where)
{ if (object>100) fixed[object-100]=where;
else
{ if (place[object]== -1) holdng--;
}
+/* look up or store a word */
+/* type is -2 for store, -1 for user word, >=0 for canned lookup*/
+/* value is used for storing only */
int
-vocab(word,type,value) /* look up or store a word */
-const char *word;
-int type; /* -2 for store, -1 for user word, >=0 for canned lookup*/
-int value; /* used for storing only */
+vocab(const char *word, int type, int value)
{ int adr;
const char *s;
char *t;
*
* @(#)wizard.c 8.1 (Berkeley) 6/2/93
* $FreeBSD: src/games/adventure/wizard.c,v 1.10.2.1 2001/03/05 11:43:11 kris Exp $
- * $DragonFly: src/games/adventure/wizard.c,v 1.2 2003/06/17 04:25:22 dillon Exp $
+ * $DragonFly: src/games/adventure/wizard.c,v 1.3 2007/04/18 18:32:12 swildner Exp $
*/
/* Re-coding of advent in C: privileged operations */
static int wizard (void);
void
-datime(d,t)
-int *d,*t;
+datime(int *d, int *t)
{ struct tm *tptr;
time_t tvec;
char magic[6];
void
-poof()
+poof(void)
{
strcpy(magic, DECR(d,w,a,r,f));
latncy = 45;
}
int
-Start()
+Start(void)
{ int d,t,delay;
datime(&d,&t);
return(FALSE);
}
+/* not as complex as advent/10 (for now) */
static int
-wizard() /* not as complex as advent/10 (for now) */
+wizard(void)
{
char *word,*x;
if (!yesm(16,0,7)) return(FALSE);
}
void
-ciao()
+ciao(void)
{ char *c;
char fname[80];
int
-ran(range)
-int range;
+ran(int range)
{
int i;
* v2.0 featuring strict ANSI/POSIX conformance, November 1993.
*
* $FreeBSD: src/games/bs/bs.c,v 1.9 2000/02/21 03:07:31 billf Exp $
- * $DragonFly: src/games/bs/bs.c,v 1.6 2005/06/15 20:59:13 swildner Exp $
+ * $DragonFly: src/games/bs/bs.c,v 1.7 2007/04/18 18:32:12 swildner Exp $
*/
#include <assert.h>
int playagain (void);
/* end the game, either normally or due to signal */
-static void uninitgame(void) {
+static void
+uninitgame(void)
+{
clear();
refresh();
resetterm();
* 03-23-04 added centering, scroll delay (cap)
*
* $FreeBSD: src/games/grdc/grdc.c,v 1.8.2.1 2001/10/02 11:51:49 ru Exp $
- * $DragonFly: src/games/grdc/grdc.c,v 1.5 2005/03/15 20:53:39 dillon Exp $
+ * $DragonFly: src/games/grdc/grdc.c,v 1.6 2007/04/18 18:32:12 swildner Exp $
*/
#include <err.h>
static void draw_row(int, int);
static void snooze(long int);
-void sighndl(int signo)
+void
+sighndl(int signo)
{
sigtermed = signo;
}
*
* @(#)prword.c 8.1 (Berkeley) 5/31/93
* $FreeBSD: src/games/hangman/prword.c,v 1.3 1999/12/10 03:23:00 billf Exp $
- * $DragonFly: src/games/hangman/prword.c,v 1.3 2005/02/13 18:57:30 cpressey Exp $
+ * $DragonFly: src/games/hangman/prword.c,v 1.4 2007/04/18 18:32:12 swildner Exp $
*/
#include "hangman.h"
* Print out the current state of the word
*/
void
-prword()
+prword(void)
{
move(KNOWNY, KNOWNX + sizeof("Word: "));
addstr(Known);
* @(#) Copyright (c) 1980, 1993 The Regents of the University of California. All rights reserved.
* @(#)worms.c 8.1 (Berkeley) 5/31/93
* $FreeBSD: src/games/worms/worms.c,v 1.8.2.1 2000/12/04 10:36:17 alex Exp $
- * $DragonFly: src/games/worms/worms.c,v 1.4 2005/03/15 20:53:42 dillon Exp $
+ * $DragonFly: src/games/worms/worms.c,v 1.5 2007/04/18 18:32:12 swildner Exp $
*/
/*
}
}
-void onsig(__unused int signo) {
+void
+onsig(__unused int signo)
+{
sig_caught = 1;
}
void
-nomem()
+nomem(void)
{
errx(1, "not enough memory.");
}
* @(#) Copyright (c) 1989, 1993 The Regents of the University of California. All rights reserved.
* @(#)wump.c 8.1 (Berkeley) 5/31/93
* $FreeBSD: src/games/wump/wump.c,v 1.13.2.1 2000/08/17 06:24:54 jhb Exp $
- * $DragonFly: src/games/wump/wump.c,v 1.5 2006/09/09 02:21:49 pavalos Exp $
+ * $DragonFly: src/games/wump/wump.c,v 1.6 2007/04/18 18:32:12 swildner Exp $
*/
/*
}
void
-display_room_stats()
+display_room_stats(void)
{
int i;
}
int
-take_action()
+take_action(void)
{
/*
* Do the action specified by the player, either 'm'ove, 's'hoot
}
int
-move_to(room_number)
- char *room_number;
+move_to(char *room_number)
{
int i, just_moved_by_bats, next_room, tunnel_available;
}
int
-shoot(room_list)
- char *room_list;
+shoot(char *room_list)
{
int chance, next, roomcnt;
int j, arrow_location, wumplink, ok;
}
void
-cave_init()
+cave_init(void)
{
int i, j, k, wumplink;
int delta;
}
void
-clear_things_in_cave()
+clear_things_in_cave(void)
{
int i;
}
void
-initialize_things_in_cave()
+initialize_things_in_cave(void)
{
int i, loc;
}
int
-getans(prompt)
- const char *prompt;
+getans(const char *prompt)
{
char buf[20];
}
int
-bats_nearby()
+bats_nearby(void)
{
int i;
}
int
-pit_nearby()
+pit_nearby(void)
{
int i;
}
int
-wump_nearby()
+wump_nearby(void)
{
int i, j;
}
void
-move_wump()
+move_wump(void)
{
wumpus_loc = cave[wumpus_loc].tunnel[random() % link_num];
}
int
-int_compare(va, vb)
- const void *va, *vb;
+int_compare(const void *va, const void *vb)
{
const int *a, *b;
}
void
-instructions()
+instructions(void)
{
const char *pager;
pid_t pid;
}
void
-usage()
+usage(void)
{
(void)fprintf(stderr,
"usage: wump [-h] [-a arrows] [-b bats] [-p pits] [-r rooms] [-t tunnels]\n");
/* messages */
void
-wump_kill()
+wump_kill(void)
{
(void)printf(
"*ROAR* *chomp* *snurfle* *chomp*!\n\
}
void
-kill_wump()
+kill_wump(void)
{
(void)printf(
"*thwock!* *groan* *crash*\n\n\
}
void
-no_arrows()
+no_arrows(void)
{
(void)printf(
"\nYou turn and look at your quiver, and realize with a sinking feeling\n\
}
void
-shoot_self()
+shoot_self(void)
{
(void)printf(
"\n*Thwack!* A sudden piercing feeling informs you that the ricochet\n\
}
void
-jump(where)
- int where;
+jump(int where)
{
(void)printf(
"\nWith a jaunty step you enter the magic tunnel. As you do, you\n\
}
void
-pit_kill()
+pit_kill(void)
{
(void)printf(
"*AAAUUUUGGGGGHHHHHhhhhhhhhhh...*\n\
}
void
-pit_survive()
+pit_survive(void)
{
(void)printf(
"Without conscious thought you grab for the side of the cave and manage\n\