xref: /openbsd/games/robots/extern.c (revision 133306f0)
1 /*	$OpenBSD: extern.c,v 1.3 1999/12/18 11:18:12 pjanzen Exp $	*/
2 /*	$NetBSD: extern.c,v 1.3 1995/04/22 10:08:49 cgd Exp $	*/
3 
4 /*
5  * Copyright (c) 1980, 1993
6  *	The Regents of the University of California.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *	This product includes software developed by the University of
19  *	California, Berkeley and its contributors.
20  * 4. Neither the name of the University nor the names of its contributors
21  *    may be used to endorse or promote products derived from this software
22  *    without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  */
36 
37 #ifndef lint
38 #if 0
39 static char sccsid[] = "@(#)extern.c	8.1 (Berkeley) 5/31/93";
40 #else
41 static char rcsid[] = "$OpenBSD: extern.c,v 1.3 1999/12/18 11:18:12 pjanzen Exp $";
42 #endif
43 #endif /* not lint */
44 
45 #include	"robots.h"
46 
47 bool	Dead;			/* Player is now dead */
48 bool	Full_clear = TRUE;	/* Lots of junk for init_field to clear */
49 bool	Jump = FALSE;		/* Jump while running, counting, or waiting */
50 bool	Newscore;		/* There was a new score added */
51 #ifdef	FANCY
52 bool	Pattern_roll = FALSE;	/* Auto play for YHBJNLUK pattern */
53 #endif
54 bool	Real_time = FALSE;	/* Play in real time? */
55 bool	Running = FALSE;	/* Currently in the middle of a run */
56 #ifdef	FANCY
57 bool	Stand_still = FALSE;	/* Auto play for standing still pattern */
58 #endif
59 bool	Teleport = FALSE;	/* Teleport automatically when player must */
60 bool	Waiting;		/* Player is waiting for end */
61 bool	Was_bonus = FALSE;	/* Was a bonus last level */
62 
63 char	Cnt_move;		/* Command which has preceded the count */
64 char	Field[Y_FIELDSIZE][X_FIELDSIZE];	/* the playing field itself */
65 char	*Next_move;		/* Next move to be used in the pattern */
66 char	*Move_list = "YHBJNLUK";/* List of moves in the pattern */
67 char	Run_ch;			/* Character for the direction we are running */
68 
69 int	Count = 0;		/* Command count */
70 int	Level;			/* Current level */
71 int	Num_robots;		/* Number of robots left */
72 int	Num_scores;		/* Number of scores posted */
73 int	Score;			/* Current score */
74 int	Start_level = 1;	/* Level on which to start */
75 int	Wait_bonus;		/* bonus for waiting */
76 
77 fd_set	rset;			/* Needed if Real_time */
78 struct timeval	tv;		/* how long to wait; could be an option */
79 
80 COORD	Max;			/* Max area robots take up */
81 COORD	Min;			/* Min area robots take up */
82 COORD	My_pos;			/* Player's current position */
83 COORD	Robots[MAXROBOTS];	/* Robots' current positions */
84