]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - hunt/huntd/expl.c
Fix darwin-amd64
[bsdgames-darwin.git] / hunt / huntd / expl.c
index ff2c74632cdf53e5043f3f243d9e89a8cdff83fb..4b1f72e1e73cb8bea7e58e960fd5e895c93de54a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: expl.c,v 1.5 2009/07/04 01:01:18 dholland Exp $        */
+/*     $NetBSD: expl.c,v 1.8 2014/03/29 21:33:41 dholland Exp $        */
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
  * All rights reserved.
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: expl.c,v 1.5 2009/07/04 01:01:18 dholland Exp $");
+__RCSID("$NetBSD: expl.c,v 1.8 2014/03/29 21:33:41 dholland Exp $");
 #endif /* not lint */
 
-# include      <stdlib.h>
-# include      "hunt.h"
+#include <stdlib.h>
+#include "hunt.h"
 
-static void    remove_wall(int, int);
+
+static EXPL *Expl[EXPLEN];             /* explosion lists */
+static EXPL *Last_expl;                        /* last explosion on Expl[0] */
+
+static void remove_wall(int, int);
 
 
 /*
@@ -46,12 +50,10 @@ static      void    remove_wall(int, int);
  *     Show the explosions as they currently are
  */
 void
-showexpl(y, x, type)
-       int     y, x;
-       char    type;
+showexpl(int y, int x, char type)
 {
-       PLAYER  *pp;
-       EXPL    *ep;
+       PLAYER *pp;
+       EXPL *ep;
 
        if (y < 0 || y >= HEIGHT)
                return;
@@ -74,7 +76,7 @@ showexpl(y, x, type)
                cgoto(pp, y, x);
                outch(pp, type);
        }
-# ifdef MONITOR
+#ifdef MONITOR
        for (pp = Monitor; pp < End_monitor; pp++) {
                if (pp->p_maze[y][x] == type)
                        continue;
@@ -82,18 +84,18 @@ showexpl(y, x, type)
                cgoto(pp, y, x);
                outch(pp, type);
        }
-# endif
+#endif
        switch (Maze[y][x]) {
          case WALL1:
          case WALL2:
          case WALL3:
-# ifdef RANDOM
+#ifdef RANDOM
          case DOOR:
-# endif
-# ifdef REFLECT
+#endif
+#ifdef REFLECT
          case WALL4:
          case WALL5:
-# endif
+#endif
                if (y >= UBOUND && y < DBOUND && x >= LBOUND && x < RBOUND)
                        remove_wall(y, x);
                break;
@@ -106,13 +108,13 @@ showexpl(y, x, type)
  *     top
  */
 void
-rollexpl()
+rollexpl(void)
 {
-       EXPL    *ep;
-       PLAYER  *pp;
-       int     y, x;
-       char    c;
-       EXPL    *nextep;
+       EXPL *ep;
+       PLAYER *pp;
+       int y, x;
+       char c;
+       EXPL *nextep;
 
        for (ep = Expl[EXPLEN - 1]; ep != NULL; ep = nextep) {
                nextep = ep->e_next;
@@ -128,10 +130,10 @@ rollexpl()
                                cgoto(pp, y, x);
                                outch(pp, c);
                        }
-# ifdef MONITOR
+#ifdef MONITOR
                for (pp = Monitor; pp < End_monitor; pp++)
                        check(pp, y, x);
-# endif
+#endif
                free(ep);
        }
        for (x = EXPLEN - 1; x > 0; x--)
@@ -141,10 +143,10 @@ rollexpl()
 
 /* There's about 700 walls in the initial maze.  So we pick a number
  * that keeps the maze relatively full. */
-# define MAXREMOVE     40
+#define MAXREMOVE      40
 
-static REGEN   removed[MAXREMOVE];
-static REGEN   *rem_index = removed;
+static REGEN removed[MAXREMOVE];
+static REGEN *rem_index = removed;
 
 /*
  * remove_wall - add a location where the wall was blown away.
@@ -152,20 +154,19 @@ static    REGEN   *rem_index = removed;
  *              the location currently pointed at.
  */
 static void
-remove_wall(y, x)
-       int     y, x;
+remove_wall(int y, int x)
 {
-       REGEN   *r;
-# if defined(MONITOR) || defined(FLY)
-       PLAYER  *pp;
-# endif
-# ifdef        FLY
-       char    save_char = 0;
-# endif
+       REGEN *r;
+#if defined(MONITOR) || defined(FLY)
+       PLAYER *pp;
+#endif
+#ifdef FLY
+       char save_char = 0;
+#endif
 
        r = rem_index;
        while (r->r_y != 0) {
-# ifdef FLY
+#ifdef FLY
                switch (Maze[r->r_y][r->r_x]) {
                  case SPACE:
                  case LEFTS:
@@ -176,10 +177,10 @@ remove_wall(y, x)
                        save_char = Maze[r->r_y][r->r_x];
                        goto found;
                }
-# else
+#else
                if (Maze[r->r_y][r->r_x] == SPACE)
                        break;
-# endif
+#endif
                if (++r >= &removed[MAXREMOVE])
                        r = removed;
        }
@@ -187,7 +188,7 @@ remove_wall(y, x)
 found:
        if (r->r_y != 0) {
                /* Slot being used, put back this wall */
-# ifdef FLY
+#ifdef FLY
                if (save_char == SPACE)
                        Maze[r->r_y][r->r_x] = Orig_maze[r->r_y][r->r_x];
                else {
@@ -204,21 +205,21 @@ found:
                        Maze[r->r_y][r->r_x] = FLYER;
                        showexpl(r->r_y, r->r_x, FLYER);
                }
-# else
+#else
                Maze[r->r_y][r->r_x] = Orig_maze[r->r_y][r->r_x];
-# endif
-# ifdef RANDOM
+#endif
+#ifdef RANDOM
                if (rand_num(100) == 0)
                        Maze[r->r_y][r->r_x] = DOOR;
-# endif
-# ifdef REFLECT
+#endif
+#ifdef REFLECT
                if (rand_num(100) == 0)         /* one percent of the time */
                        Maze[r->r_y][r->r_x] = WALL4;
-# endif
-# ifdef MONITOR
+#endif
+#ifdef MONITOR
                for (pp = Monitor; pp < End_monitor; pp++)
                        check(pp, r->r_y, r->r_x);
-# endif
+#endif
        }
 
        r->r_y = y;
@@ -229,10 +230,10 @@ found:
                rem_index = r;
 
        Maze[y][x] = SPACE;
-# ifdef MONITOR
+#ifdef MONITOR
        for (pp = Monitor; pp < End_monitor; pp++)
                check(pp, y, x);
-# endif
+#endif
 }
 
 /*
@@ -240,9 +241,9 @@ found:
  *     Clear out the walls array
  */
 void
-clearwalls()
+clearwalls(void)
 {
-       REGEN   *rp;
+       REGEN *rp;
 
        for (rp = removed; rp < &removed[MAXREMOVE]; rp++)
                rp->r_y = 0;