Home | History | Annotate | Line # | Download | only in robots
robots.h revision 1.13.2.1
      1  1.13.2.1  wrstuden /*	$NetBSD: robots.h,v 1.13.2.1 1999/12/27 18:29:04 wrstuden 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.7     lukem # include	<err.h>
     42      1.12       jsm # include	<errno.h>
     43       1.6     lukem # include	<fcntl.h>
     44       1.6     lukem # include	<pwd.h>
     45       1.1       cgd # include	<setjmp.h>
     46       1.6     lukem # include	<signal.h>
     47       1.6     lukem # include	<stdlib.h>
     48       1.5       cgd # include	<string.h>
     49       1.6     lukem # include	<termios.h>
     50       1.6     lukem # include	<unistd.h>
     51       1.1       cgd 
     52       1.1       cgd /*
     53       1.1       cgd  * miscellaneous constants
     54       1.1       cgd  */
     55       1.1       cgd 
     56       1.1       cgd # define	Y_FIELDSIZE	23
     57       1.1       cgd # define	X_FIELDSIZE	60
     58       1.1       cgd # define	Y_SIZE		24
     59       1.1       cgd # define	X_SIZE		80
     60       1.1       cgd # define	MAXLEVELS	4
     61       1.1       cgd # define	MAXROBOTS	(MAXLEVELS * 10)
     62       1.1       cgd # define	ROB_SCORE	10
     63  1.13.2.1  wrstuden # undef		S_BONUS
     64       1.1       cgd # define	S_BONUS		(60 * ROB_SCORE)
     65       1.1       cgd # define	Y_SCORE		21
     66       1.1       cgd # define	X_SCORE		(X_FIELDSIZE + 9)
     67       1.1       cgd # define	Y_PROMPT	(Y_FIELDSIZE - 1)
     68       1.1       cgd # define	X_PROMPT	(X_FIELDSIZE + 2)
     69       1.1       cgd # define	MAXSCORES	(Y_SIZE - 2)
     70       1.1       cgd # define	MAXNAME		16
     71       1.1       cgd # define	MS_NAME		"Ten"
     72       1.1       cgd 
     73       1.1       cgd /*
     74       1.1       cgd  * characters on screen
     75       1.1       cgd  */
     76       1.1       cgd 
     77       1.1       cgd # define	ROBOT	'+'
     78       1.1       cgd # define	HEAP	'*'
     79       1.1       cgd # define	PLAYER	'@'
     80       1.1       cgd 
     81       1.1       cgd /*
     82       1.1       cgd  * type definitions
     83       1.1       cgd  */
     84       1.1       cgd 
     85       1.1       cgd typedef struct {
     86       1.1       cgd 	int	y, x;
     87       1.1       cgd } COORD;
     88       1.1       cgd 
     89       1.6     lukem typedef struct {
     90       1.9  christos 	u_int32_t	s_uid;
     91       1.9  christos 	u_int32_t	s_score;
     92       1.9  christos 	u_int32_t	s_auto;
     93       1.9  christos 	u_int32_t	s_level;
     94       1.9  christos 	char		s_name[MAXNAME];
     95       1.6     lukem } SCORE;
     96       1.6     lukem 
     97       1.6     lukem typedef struct passwd	PASSWD;
     98       1.6     lukem 
     99       1.1       cgd /*
    100       1.1       cgd  * global variables
    101       1.1       cgd  */
    102       1.1       cgd 
    103       1.1       cgd extern bool	Dead, Full_clear, Jump, Newscore, Real_time, Running,
    104       1.9  christos 		Teleport, Waiting, Was_bonus, Auto_bot;
    105       1.1       cgd 
    106       1.1       cgd #ifdef	FANCY
    107       1.1       cgd extern bool	Pattern_roll, Stand_still;
    108       1.1       cgd #endif
    109       1.1       cgd 
    110      1.11       jsm extern char	Cnt_move, Field[Y_FIELDSIZE][X_FIELDSIZE], Run_ch;
    111      1.11       jsm extern const char *Next_move, *Move_list;
    112       1.1       cgd 
    113      1.13       jsm extern int	Count, Level, Num_robots, Num_scrap, Num_scores,
    114       1.9  christos 		Start_level, Wait_bonus, Num_games;
    115      1.13       jsm 
    116      1.13       jsm extern u_int32_t	Score;
    117       1.1       cgd 
    118       1.9  christos extern COORD	Max, Min, My_pos, Robots[], Scrap[];
    119       1.1       cgd 
    120       1.1       cgd extern jmp_buf	End_move;
    121       1.1       cgd 
    122       1.1       cgd /*
    123       1.1       cgd  * functions types
    124       1.1       cgd  */
    125       1.1       cgd 
    126       1.6     lukem void	add_score __P((int));
    127       1.6     lukem bool	another __P((void));
    128       1.6     lukem int	cmp_sc __P((const void *, const void *));
    129       1.6     lukem bool	do_move __P((int, int));
    130      1.11       jsm bool	eaten __P((const COORD *));
    131       1.6     lukem void	flush_in __P((void));
    132       1.6     lukem void	get_move __P((void));
    133       1.6     lukem void	init_field __P((void));
    134       1.6     lukem bool	jumping __P((void));
    135       1.6     lukem void	make_level __P((void));
    136       1.6     lukem void	move_robots __P((int));
    137       1.6     lukem bool	must_telep __P((void));
    138       1.6     lukem void	play_level __P((void));
    139      1.11       jsm int	query __P((const char *));
    140       1.8   hubertf void	quit __P((int)) __attribute__((__noreturn__));
    141       1.6     lukem void	reset_count __P((void));
    142       1.6     lukem int	rnd __P((int));
    143       1.6     lukem COORD  *rnd_pos __P((void));
    144      1.12       jsm void	score __P((int));
    145       1.6     lukem void	set_name __P((SCORE *));
    146       1.6     lukem void	show_score __P((void));
    147       1.6     lukem int	sign __P((int));
    148      1.10  christos char	automove __P((void));
    149