]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - adventure/init.c
PR/3964: Eric Fischer: Remove dependencies to traditional cpp...
[bsdgames-darwin.git] / adventure / init.c
index 77a948af4e2d9c288155aa648003e46ea42a97c5..11c3b0e74929dd0e6fb4de121db09d61ba18c614 100644 (file)
@@ -1,3 +1,5 @@
+/*     $NetBSD: init.c,v 1.5 1997/08/11 14:06:14 christos Exp $        */
+
 /*-
  * Copyright (c) 1993
  *     The Regents of the University of California.  All rights reserved.
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
 #ifndef lint
+#if 0
 static char sccsid[] = "@(#)init.c     8.1 (Berkeley) 6/2/93";
+#else
+__RCSID("$NetBSD: init.c,v 1.5 1997/08/11 14:06:14 christos Exp $");
+#endif
 #endif /* not lint */
 
 /*      Re-coding of advent in C: data initialization                   */
 
 #include <sys/types.h>
+#include <signal.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include "hdr.h"
+#include "extern.h"
 
 int blklin = TRUE;
 
@@ -52,6 +63,7 @@ int setbit[16] = {1,2,4,010,020,040,0100,0200,0400,01000,02000,04000,
                  010000,020000,040000,0100000};
 
 
+void
 init(command)                           /* everything for 1st time run  */
 char *command;                          /* command we were called with  */
 {
@@ -74,6 +86,7 @@ char a,b,c,d,e;
        return buf;
 }
 
+void
 linkdata()                              /*  secondary data manipulation */
 {       register int i,j;
 
@@ -101,67 +114,67 @@ linkdata()                              /*  secondary data manipulation */
        }
 
        /* define mnemonics */
-       keys = vocab(DECR(k,e,y,s,\0), 1);
-       lamp = vocab(DECR(l,a,m,p,\0), 1);
-       grate = vocab(DECR(g,r,a,t,e), 1);
-       cage  = vocab(DECR(c,a,g,e,\0),1);
-       rod   = vocab(DECR(r,o,d,\0,\0),1);
+       keys = vocab(DECR('k','e','y','s','\0'), 1, 0);
+       lamp = vocab(DECR('l','a','m','p','\0'), 1, 0);
+       grate = vocab(DECR('g','r','a','t','e'), 1, 0);
+       cage  = vocab(DECR('c','a','g','e','\0'),1, 0);
+       rod   = vocab(DECR('r','o','d','\0','\0'),1, 0);
        rod2=rod+1;
-       steps=vocab(DECR(s,t,e,p,s),1);
-       bird  = vocab(DECR(b,i,r,d,\0),1);
-       door  = vocab(DECR(d,o,o,r,\0),1);
-       pillow= vocab(DECR(p,i,l,l,o), 1);
-       snake = vocab(DECR(s,n,a,k,e), 1);
-       fissur= vocab(DECR(f,i,s,s,u), 1);
-       tablet= vocab(DECR(t,a,b,l,e), 1);
-       clam  = vocab(DECR(c,l,a,m,\0),1);
-       oyster= vocab(DECR(o,y,s,t,e), 1);
-       magzin= vocab(DECR(m,a,g,a,z), 1);
-       dwarf = vocab(DECR(d,w,a,r,f), 1);
-       knife = vocab(DECR(k,n,i,f,e), 1);
-       food  = vocab(DECR(f,o,o,d,\0),1);
-       bottle= vocab(DECR(b,o,t,t,l), 1);
-       water = vocab(DECR(w,a,t,e,r), 1);
-       oil   = vocab(DECR(o,i,l,\0,\0),1);
-       plant = vocab(DECR(p,l,a,n,t), 1);
+       steps=vocab(DECR('s','t','e','p','s'),1, 0);
+       bird  = vocab(DECR('b','i','r','d','\0'),1, 0);
+       door  = vocab(DECR('d','o','o','r','\0'),1, 0);
+       pillow= vocab(DECR('p','i','l','l','o'), 1, 0);
+       snake = vocab(DECR('s','n','a','k','e'), 1, 0);
+       fissur= vocab(DECR('f','i','s','s','u'), 1, 0);
+       tablet= vocab(DECR('t','a','b','l','e'), 1, 0);
+       clam  = vocab(DECR('c','l','a','m','\0'),1, 0);
+       oyster= vocab(DECR('o','y','s','t','e'), 1, 0);
+       magzin= vocab(DECR('m','a','g','a','z'), 1, 0);
+       dwarf = vocab(DECR('d','w','a','r','f'), 1, 0);
+       knife = vocab(DECR('k','n','i','f','e'), 1, 0);
+       food  = vocab(DECR('f','o','o','d','\0'),1, 0);
+       bottle= vocab(DECR('b','o','t','t','l'), 1, 0);
+       water = vocab(DECR('w','a','t','e','r'), 1, 0);
+       oil   = vocab(DECR('o','i','l','\0','\0'),1, 0);
+       plant = vocab(DECR('p','l','a','n','t'), 1, 0);
        plant2=plant+1;
-       axe   = vocab(DECR(a,x,e,\0,\0),1);
-       mirror= vocab(DECR(m,i,r,r,o), 1);
-       dragon= vocab(DECR(d,r,a,g,o), 1);
-       chasm = vocab(DECR(c,h,a,s,m), 1);
-       troll = vocab(DECR(t,r,o,l,l), 1);
+       axe   = vocab(DECR('a','x','e','\0','\0'),1, 0);
+       mirror= vocab(DECR('m','i','r','r','o'), 1, 0);
+       dragon= vocab(DECR('d','r','a','g','o'), 1, 0);
+       chasm = vocab(DECR('c','h','a','s','m'), 1, 0);
+       troll = vocab(DECR('t','r','o','l','l'), 1, 0);
        troll2=troll+1;
-       bear  = vocab(DECR(b,e,a,r,\0),1);
-       messag= vocab(DECR(m,e,s,s,a), 1);
-       vend  = vocab(DECR(v,e,n,d,i), 1);
-       batter= vocab(DECR(b,a,t,t,e), 1);
-
-       nugget= vocab(DECR(g,o,l,d,\0),1);
-       coins = vocab(DECR(c,o,i,n,s), 1);
-       chest = vocab(DECR(c,h,e,s,t), 1);
-       eggs  = vocab(DECR(e,g,g,s,\0),1);
-       tridnt= vocab(DECR(t,r,i,d,e), 1);
-       vase  = vocab(DECR(v,a,s,e,\0),1);
-       emrald= vocab(DECR(e,m,e,r,a), 1);
-       pyram = vocab(DECR(p,y,r,a,m), 1);
-       pearl = vocab(DECR(p,e,a,r,l), 1);
-       rug   = vocab(DECR(r,u,g,\0,\0),1);
-       chain = vocab(DECR(c,h,a,i,n), 1);
-
-       back  = vocab(DECR(b,a,c,k,\0),0);
-       look  = vocab(DECR(l,o,o,k,\0),0);
-       cave  = vocab(DECR(c,a,v,e,\0),0);
-       null  = vocab(DECR(n,u,l,l,\0),0);
-       entrnc= vocab(DECR(e,n,t,r,a), 0);
-       dprssn= vocab(DECR(d,e,p,r,e), 0);
-       enter = vocab(DECR(e,n,t,e,r), 0);
-
-       pour  = vocab(DECR(p,o,u,r,\0), 2);
-       say   = vocab(DECR(s,a,y,\0,\0),2);
-       lock  = vocab(DECR(l,o,c,k,\0),2);
-       throw = vocab(DECR(t,h,r,o,w), 2);
-       find  = vocab(DECR(f,i,n,d,\0),2);
-       invent= vocab(DECR(i,n,v,e,n), 2);
+       bear  = vocab(DECR('b','e','a','r','\0'),1, 0);
+       messag= vocab(DECR('m','e','s','s','a'), 1, 0);
+       vend  = vocab(DECR('v','e','n','d','i'), 1, 0);
+       batter= vocab(DECR('b','a','t','t','e'), 1, 0);
+
+       nugget= vocab(DECR('g','o','l','d','\0'),1, 0);
+       coins = vocab(DECR('c','o','i','n','s'), 1, 0);
+       chest = vocab(DECR('c','h','e','s','t'), 1, 0);
+       eggs  = vocab(DECR('e','g','g','s','\0'),1, 0);
+       tridnt= vocab(DECR('t','r','i','d','e'), 1, 0);
+       vase  = vocab(DECR('v','a','s','e','\0'),1, 0);
+       emrald= vocab(DECR('e','m','e','r','a'), 1, 0);
+       pyram = vocab(DECR('p','y','r','a','m'), 1, 0);
+       pearl = vocab(DECR('p','e','a','r','l'), 1, 0);
+       rug   = vocab(DECR('r','u','g','\0','\0'),1, 0);
+       chain = vocab(DECR('c','h','a','i','n'), 1, 0);
+
+       back  = vocab(DECR('b','a','c','k','\0'),0, 0);
+       look  = vocab(DECR('l','o','o','k','\0'),0, 0);
+       cave  = vocab(DECR('c','a','v','e','\0'),0, 0);
+       null  = vocab(DECR('n','u','l','l','\0'),0, 0);
+       entrnc= vocab(DECR('e','n','t','r','a'), 0, 0);
+       dprssn= vocab(DECR('d','e','p','r','e'), 0, 0);
+       enter = vocab(DECR('e','n','t','e','r'), 0, 0);
+
+       pour  = vocab(DECR('p','o','u','r','\0'), 2, 0);
+       say   = vocab(DECR('s','a','y','\0','\0'),2, 0);
+       lock  = vocab(DECR('l','o','c','k','\0'),2, 0);
+       throw = vocab(DECR('t','h','r','o','w'), 2, 0);
+       find  = vocab(DECR('f','i','n','d','\0'),2, 0);
+       invent= vocab(DECR('i','n','v','e','n'), 2, 0);
 
        /* initialize dwarves */
        chloc=114;
@@ -195,19 +208,22 @@ linkdata()                              /*  secondary data manipulation */
 
 
 
-trapdel()                               /* come here if he hits a del   */
+void
+trapdel(n)                              /* come here if he hits a del   */
+       int n;
 {      delhit++;                       /* main checks, treats as QUIT  */
-       signal(2,trapdel);              /* catch subsequent DELs        */
+       signal(SIGINT,trapdel);         /* catch subsequent DELs        */
 }
 
 
+void
 startup()
 {
-       time_t time();
-
        demo=Start(0);
        srand((int)(time((time_t *)NULL)));     /* random seed */
-       /* srand(371);                          /* non-random seed */
+#if 0
+       srand(371);                             /* non-random seed */
+#endif
        hinted[3]=yes(65,1,0);
        newloc=1;
        delhit = 0;