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