Home | History | Annotate | Line # | Download | only in robots
robots.h revision 1.22
      1  1.22  dholland /*	$NetBSD: robots.h,v 1.22 2009/08/12 08:30:55 dholland 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.16       agc  * 3. Neither the name of the University nor the names of its contributors
     16   1.1       cgd  *    may be used to endorse or promote products derived from this software
     17   1.1       cgd  *    without specific prior written permission.
     18   1.1       cgd  *
     19   1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20   1.1       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21   1.1       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22   1.1       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23   1.1       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24   1.1       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25   1.1       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26   1.1       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27   1.1       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28   1.1       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29   1.1       cgd  * SUCH DAMAGE.
     30   1.1       cgd  *
     31   1.4       cgd  *	@(#)robots.h	8.1 (Berkeley) 5/31/93
     32   1.1       cgd  */
     33   1.1       cgd 
     34  1.21  dholland #include <sys/cdefs.h>
     35  1.21  dholland 
     36  1.20  dholland #include <setjmp.h>
     37  1.21  dholland #include <stdbool.h>
     38  1.21  dholland #include <stdint.h>
     39   1.1       cgd 
     40   1.1       cgd /*
     41   1.1       cgd  * miscellaneous constants
     42   1.1       cgd  */
     43   1.1       cgd 
     44  1.20  dholland #define Y_FIELDSIZE	23
     45  1.20  dholland #define X_FIELDSIZE	60
     46  1.20  dholland #define Y_SIZE		24
     47  1.20  dholland #define X_SIZE		80
     48  1.20  dholland #define MAXLEVELS	4
     49  1.20  dholland #define MAXROBOTS	(MAXLEVELS * 10)
     50  1.20  dholland #define ROB_SCORE	10
     51  1.20  dholland #undef  S_BONUS
     52  1.20  dholland #define S_BONUS		(60 * ROB_SCORE)
     53  1.20  dholland #define Y_SCORE		21
     54  1.20  dholland #define X_SCORE		(X_FIELDSIZE + 9)
     55  1.20  dholland #define Y_PROMPT	(Y_FIELDSIZE - 1)
     56  1.20  dholland #define X_PROMPT	(X_FIELDSIZE + 2)
     57  1.20  dholland #define MAXSCORES	(Y_SIZE - 2)
     58  1.20  dholland #define MAXNAME		16
     59  1.20  dholland #define MS_NAME		"Ten"
     60   1.1       cgd 
     61   1.1       cgd /*
     62   1.1       cgd  * characters on screen
     63   1.1       cgd  */
     64   1.1       cgd 
     65  1.20  dholland #define ROBOT	'+'
     66  1.20  dholland #define HEAP	'*'
     67  1.20  dholland #define PLAYER	'@'
     68   1.1       cgd 
     69   1.1       cgd /*
     70   1.1       cgd  * type definitions
     71   1.1       cgd  */
     72   1.1       cgd 
     73   1.1       cgd typedef struct {
     74  1.20  dholland 	int y, x;
     75   1.1       cgd } COORD;
     76   1.1       cgd 
     77   1.6     lukem typedef struct {
     78  1.21  dholland 	uint32_t s_uid;
     79  1.21  dholland 	uint32_t s_score;
     80  1.21  dholland 	uint32_t s_auto;
     81  1.21  dholland 	uint32_t s_level;
     82  1.20  dholland 	char s_name[MAXNAME];
     83   1.6     lukem } SCORE;
     84   1.6     lukem 
     85   1.1       cgd /*
     86   1.1       cgd  * global variables
     87   1.1       cgd  */
     88   1.1       cgd 
     89  1.20  dholland extern bool Dead, Full_clear, Jump, Newscore, Real_time, Running,
     90  1.20  dholland 	Teleport, Waiting, Was_bonus, Auto_bot;
     91   1.1       cgd 
     92  1.20  dholland #ifdef FANCY
     93  1.20  dholland extern bool Pattern_roll, Stand_still;
     94   1.1       cgd #endif
     95   1.1       cgd 
     96  1.20  dholland extern char Cnt_move, Field[Y_FIELDSIZE][X_FIELDSIZE], Run_ch;
     97  1.11       jsm extern const char *Next_move, *Move_list;
     98   1.1       cgd 
     99  1.20  dholland extern int Count, Level, Num_robots, Num_scrap, Num_scores,
    100  1.20  dholland 	Start_level, Wait_bonus, Num_games;
    101  1.13       jsm 
    102  1.21  dholland extern uint32_t Score;
    103   1.1       cgd 
    104  1.20  dholland extern COORD Max, Min, My_pos, Robots[], Scrap[];
    105   1.1       cgd 
    106  1.20  dholland extern jmp_buf End_move;
    107   1.1       cgd 
    108   1.1       cgd /*
    109  1.19  dholland  * functions
    110   1.1       cgd  */
    111   1.1       cgd 
    112  1.20  dholland void add_score(int);
    113  1.20  dholland char automove(void);
    114  1.20  dholland void flush_in(void);
    115  1.20  dholland void get_move(void);
    116  1.20  dholland void init_field(void);
    117  1.20  dholland bool jumping(void);
    118  1.20  dholland void make_level(void);
    119  1.20  dholland void move_robots(int);
    120  1.20  dholland void play_level(void);
    121  1.20  dholland int query(const char *);
    122  1.20  dholland void quit(int) __dead;
    123  1.20  dholland void reset_count(void);
    124  1.20  dholland COORD *rnd_pos(void);
    125  1.20  dholland void score(int);
    126  1.20  dholland void show_score(void);
    127  1.20  dholland int sign(int);
    128  1.20  dholland void telmsg(int);
    129