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