Home | History | Annotate | Line # | Download | only in robots
robots.h revision 1.6
      1  1.6  lukem /*	$NetBSD: robots.h,v 1.6 1997/10/12 14:10:04 lukem Exp $	*/
      2  1.4    cgd 
      3  1.1    cgd /*
      4  1.4    cgd  * Copyright (c) 1980, 1993
      5  1.4    cgd  *	The Regents of the University of California.  All rights reserved.
      6  1.1    cgd  *
      7  1.1    cgd  * Redistribution and use in source and binary forms, with or without
      8  1.1    cgd  * modification, are permitted provided that the following conditions
      9  1.1    cgd  * are met:
     10  1.1    cgd  * 1. Redistributions of source code must retain the above copyright
     11  1.1    cgd  *    notice, this list of conditions and the following disclaimer.
     12  1.1    cgd  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1    cgd  *    notice, this list of conditions and the following disclaimer in the
     14  1.1    cgd  *    documentation and/or other materials provided with the distribution.
     15  1.1    cgd  * 3. All advertising materials mentioning features or use of this software
     16  1.1    cgd  *    must display the following acknowledgement:
     17  1.1    cgd  *	This product includes software developed by the University of
     18  1.1    cgd  *	California, Berkeley and its contributors.
     19  1.1    cgd  * 4. Neither the name of the University nor the names of its contributors
     20  1.1    cgd  *    may be used to endorse or promote products derived from this software
     21  1.1    cgd  *    without specific prior written permission.
     22  1.1    cgd  *
     23  1.1    cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24  1.1    cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  1.1    cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  1.1    cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27  1.1    cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  1.1    cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  1.1    cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  1.1    cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  1.1    cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  1.1    cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  1.1    cgd  * SUCH DAMAGE.
     34  1.1    cgd  *
     35  1.4    cgd  *	@(#)robots.h	8.1 (Berkeley) 5/31/93
     36  1.1    cgd  */
     37  1.1    cgd 
     38  1.6  lukem # include	<sys/ttydefaults.h>
     39  1.6  lukem # include	<ctype.h>
     40  1.1    cgd # include	<curses.h>
     41  1.6  lukem # include	<fcntl.h>
     42  1.6  lukem # include	<pwd.h>
     43  1.1    cgd # include	<setjmp.h>
     44  1.6  lukem # include	<signal.h>
     45  1.6  lukem # include	<stdlib.h>
     46  1.5    cgd # include	<string.h>
     47  1.6  lukem # include	<termios.h>
     48  1.6  lukem # include	<unistd.h>
     49  1.1    cgd 
     50  1.1    cgd /*
     51  1.1    cgd  * miscellaneous constants
     52  1.1    cgd  */
     53  1.1    cgd 
     54  1.1    cgd # define	Y_FIELDSIZE	23
     55  1.1    cgd # define	X_FIELDSIZE	60
     56  1.1    cgd # define	Y_SIZE		24
     57  1.1    cgd # define	X_SIZE		80
     58  1.1    cgd # define	MAXLEVELS	4
     59  1.1    cgd # define	MAXROBOTS	(MAXLEVELS * 10)
     60  1.1    cgd # define	ROB_SCORE	10
     61  1.1    cgd # define	S_BONUS		(60 * ROB_SCORE)
     62  1.1    cgd # define	Y_SCORE		21
     63  1.1    cgd # define	X_SCORE		(X_FIELDSIZE + 9)
     64  1.1    cgd # define	Y_PROMPT	(Y_FIELDSIZE - 1)
     65  1.1    cgd # define	X_PROMPT	(X_FIELDSIZE + 2)
     66  1.1    cgd # define	MAXSCORES	(Y_SIZE - 2)
     67  1.1    cgd # define	MAXNAME		16
     68  1.1    cgd # define	MS_NAME		"Ten"
     69  1.1    cgd 
     70  1.1    cgd /*
     71  1.1    cgd  * characters on screen
     72  1.1    cgd  */
     73  1.1    cgd 
     74  1.1    cgd # define	ROBOT	'+'
     75  1.1    cgd # define	HEAP	'*'
     76  1.1    cgd # define	PLAYER	'@'
     77  1.1    cgd 
     78  1.1    cgd /*
     79  1.1    cgd  * type definitions
     80  1.1    cgd  */
     81  1.1    cgd 
     82  1.1    cgd typedef struct {
     83  1.1    cgd 	int	y, x;
     84  1.1    cgd } COORD;
     85  1.1    cgd 
     86  1.6  lukem typedef struct {
     87  1.6  lukem 	int	s_uid;
     88  1.6  lukem 	int	s_score;
     89  1.6  lukem 	char	s_name[MAXNAME];
     90  1.6  lukem } SCORE;
     91  1.6  lukem 
     92  1.6  lukem typedef struct passwd	PASSWD;
     93  1.6  lukem 
     94  1.1    cgd /*
     95  1.1    cgd  * global variables
     96  1.1    cgd  */
     97  1.1    cgd 
     98  1.1    cgd extern bool	Dead, Full_clear, Jump, Newscore, Real_time, Running,
     99  1.1    cgd 		Teleport, Waiting, Was_bonus;
    100  1.1    cgd 
    101  1.1    cgd #ifdef	FANCY
    102  1.1    cgd extern bool	Pattern_roll, Stand_still;
    103  1.1    cgd #endif
    104  1.1    cgd 
    105  1.1    cgd extern char	Cnt_move, Field[Y_FIELDSIZE][X_FIELDSIZE], *Next_move,
    106  1.1    cgd 		*Move_list, Run_ch;
    107  1.1    cgd 
    108  1.1    cgd extern int	Count, Level, Num_robots, Num_scores, Score,
    109  1.1    cgd 		Start_level, Wait_bonus;
    110  1.1    cgd 
    111  1.1    cgd extern COORD	Max, Min, My_pos, Robots[];
    112  1.1    cgd 
    113  1.1    cgd extern jmp_buf	End_move;
    114  1.1    cgd 
    115  1.1    cgd /*
    116  1.1    cgd  * functions types
    117  1.1    cgd  */
    118  1.1    cgd 
    119  1.6  lukem void	add_score __P((int));
    120  1.6  lukem bool	another __P((void));
    121  1.6  lukem int	cmp_sc __P((const void *, const void *));
    122  1.6  lukem bool	do_move __P((int, int));
    123  1.6  lukem bool	eaten __P((COORD *));
    124  1.6  lukem void	flush_in __P((void));
    125  1.6  lukem void	get_move __P((void));
    126  1.6  lukem void	init_field __P((void));
    127  1.6  lukem bool	jumping __P((void));
    128  1.6  lukem void	make_level __P((void));
    129  1.6  lukem void	move_robots __P((int));
    130  1.6  lukem bool	must_telep __P((void));
    131  1.6  lukem void	play_level __P((void));
    132  1.6  lukem int	query __P((char *));
    133  1.6  lukem void	quit __P((int));
    134  1.6  lukem void	reset_count __P((void));
    135  1.6  lukem int	rnd __P((int));
    136  1.6  lukem COORD  *rnd_pos __P((void));
    137  1.6  lukem void	score __P((void));
    138  1.6  lukem void	set_name __P((SCORE *));
    139  1.6  lukem void	show_score __P((void));
    140  1.6  lukem int	sign __P((int));
    141