Home | History | Annotate | Line # | Download | only in huntd
      1  1.32    rillig /*	$NetBSD: hunt.h,v 1.32 2021/05/02 12:50:45 rillig Exp $	*/
      2   1.3     perry 
      3   1.1       mrg /*
      4   1.8       wiz  * Copyright (c) 1983-2003, Regents of the University of California.
      5   1.8       wiz  * All rights reserved.
      6  1.32    rillig  *
      7  1.32    rillig  * Redistribution and use in source and binary forms, with or without
      8  1.32    rillig  * modification, are permitted provided that the following conditions are
      9   1.8       wiz  * met:
     10  1.32    rillig  *
     11  1.32    rillig  * + Redistributions of source code must retain the above copyright
     12   1.8       wiz  *   notice, this list of conditions and the following disclaimer.
     13  1.32    rillig  * + Redistributions in binary form must reproduce the above copyright
     14  1.32    rillig  *   notice, this list of conditions and the following disclaimer in the
     15   1.8       wiz  *   documentation and/or other materials provided with the distribution.
     16  1.32    rillig  * + Neither the name of the University of California, San Francisco nor
     17  1.32    rillig  *   the names of its contributors may be used to endorse or promote
     18  1.32    rillig  *   products derived from this software without specific prior written
     19   1.8       wiz  *   permission.
     20  1.32    rillig  *
     21  1.32    rillig  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
     22  1.32    rillig  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     23  1.32    rillig  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     24  1.32    rillig  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     25  1.32    rillig  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     26  1.32    rillig  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     27  1.32    rillig  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28  1.32    rillig  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     29  1.32    rillig  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     30  1.32    rillig  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     31   1.8       wiz  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32   1.1       mrg  */
     33   1.1       mrg 
     34  1.20  dholland #include <stdbool.h>
     35  1.15  dholland #include <stdio.h>
     36  1.15  dholland #include <string.h>
     37  1.15  dholland #include <syslog.h>
     38  1.15  dholland 
     39  1.15  dholland #include <sys/ioctl.h>
     40  1.15  dholland #include <sys/types.h>
     41  1.15  dholland #include <sys/uio.h>
     42  1.15  dholland #include <sys/poll.h>
     43  1.15  dholland 
     44  1.23  dholland #include "hunt_common.h"
     45  1.15  dholland 
     46  1.26  dholland extern const int shot_req[];
     47  1.26  dholland extern const int shot_type[];
     48  1.26  dholland #ifdef OOZE
     49  1.26  dholland extern const int slime_req[];
     50  1.26  dholland #endif
     51   1.1       mrg 
     52   1.1       mrg typedef struct bullet_def	BULLET;
     53   1.1       mrg typedef struct expl_def		EXPL;
     54   1.1       mrg typedef struct player_def	PLAYER;
     55   1.1       mrg typedef struct ident_def	IDENT;
     56   1.1       mrg typedef struct regen_def	REGEN;
     57   1.1       mrg 
     58   1.1       mrg struct ident_def {
     59  1.30  dholland 	char i_name[WIRE_NAMELEN];
     60  1.15  dholland 	char i_team;
     61  1.12  dholland 	uint32_t i_machine;
     62  1.12  dholland 	uint32_t i_uid;
     63  1.15  dholland 	float i_kills;
     64  1.15  dholland 	int i_entries;
     65  1.15  dholland 	float i_score;
     66  1.15  dholland 	int i_absorbed;
     67  1.15  dholland 	int i_faced;
     68  1.15  dholland 	int i_shot;
     69  1.15  dholland 	int i_robbed;
     70  1.15  dholland 	int i_slime;
     71  1.15  dholland 	int i_missed;
     72  1.15  dholland 	int i_ducked;
     73  1.15  dholland 	int i_gkills, i_bkills, i_deaths, i_stillb, i_saved;
     74  1.15  dholland 	IDENT *i_next;
     75   1.1       mrg };
     76   1.1       mrg 
     77   1.1       mrg struct player_def {
     78  1.15  dholland 	IDENT *p_ident;
     79  1.15  dholland 	char p_over;
     80  1.15  dholland 	int p_face;
     81  1.15  dholland 	int p_undershot;
     82  1.15  dholland #ifdef FLY
     83  1.15  dholland 	int p_flying;
     84  1.15  dholland 	int p_flyx, p_flyy;
     85  1.15  dholland #endif
     86  1.15  dholland #ifdef BOOTS
     87  1.15  dholland 	int p_nboots;
     88  1.15  dholland #endif
     89  1.15  dholland 	FILE *p_output;
     90  1.15  dholland 	int p_fd;
     91  1.15  dholland 	int p_mask;
     92  1.15  dholland 	int p_damage;
     93  1.15  dholland 	int p_damcap;
     94  1.15  dholland 	int p_ammo;
     95  1.15  dholland 	int p_ncshot;
     96  1.15  dholland 	int p_scan;
     97  1.15  dholland 	int p_cloak;
     98  1.15  dholland 	int p_x, p_y;
     99  1.15  dholland 	int p_ncount;
    100  1.15  dholland 	int p_nexec;
    101  1.15  dholland 	long p_nchar;
    102  1.15  dholland 	char p_death[MSGLEN];
    103  1.15  dholland 	char p_maze[HEIGHT][WIDTH2];
    104  1.15  dholland 	int p_curx, p_cury;
    105  1.15  dholland 	int p_lastx, p_lasty;
    106  1.15  dholland 	char p_cbuf[BUFSIZ];
    107   1.1       mrg };
    108   1.1       mrg 
    109   1.1       mrg struct bullet_def {
    110  1.15  dholland 	int b_x, b_y;
    111  1.15  dholland 	int b_face;
    112  1.15  dholland 	int b_charge;
    113  1.15  dholland 	char b_type;
    114  1.15  dholland 	char b_size;
    115  1.15  dholland 	char b_over;
    116  1.15  dholland 	PLAYER *b_owner;
    117  1.15  dholland 	IDENT *b_score;
    118  1.20  dholland 	bool b_expl;
    119  1.15  dholland 	BULLET *b_next;
    120   1.1       mrg };
    121   1.1       mrg 
    122   1.1       mrg struct expl_def {
    123  1.15  dholland 	int e_x, e_y;
    124  1.15  dholland 	char e_char;
    125  1.15  dholland 	EXPL *e_next;
    126   1.1       mrg };
    127   1.1       mrg 
    128   1.1       mrg struct regen_def {
    129  1.15  dholland 	int r_x, r_y;
    130  1.15  dholland 	REGEN *r_next;
    131   1.1       mrg };
    132   1.1       mrg 
    133   1.1       mrg /*
    134   1.1       mrg  * external variables
    135   1.1       mrg  */
    136   1.1       mrg 
    137  1.15  dholland extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
    138   1.1       mrg 
    139  1.28  dholland extern int Nplayer;
    140  1.28  dholland extern int huntsock;
    141  1.15  dholland extern struct pollfd fdset[];
    142   1.1       mrg 
    143  1.15  dholland extern int See_over[NASCII];
    144   1.1       mrg 
    145  1.15  dholland extern BULLET *Bullets;
    146   1.1       mrg 
    147  1.15  dholland extern IDENT *Scores;
    148   1.1       mrg 
    149  1.15  dholland extern PLAYER Player[MAXPL], *End_player;
    150  1.15  dholland #ifdef BOOTS
    151  1.15  dholland extern PLAYER Boot[NBOOTS];
    152  1.15  dholland #endif
    153   1.1       mrg 
    154  1.15  dholland #ifdef MONITOR
    155  1.15  dholland extern PLAYER Monitor[MAXMON], *End_monitor;
    156  1.15  dholland #endif
    157   1.1       mrg 
    158   1.1       mrg /*
    159   1.1       mrg  * function types
    160   1.1       mrg  */
    161   1.1       mrg 
    162  1.25  dholland /* in answer.c */
    163  1.31  dholland bool answer(void);
    164  1.25  dholland int rand_dir(void);
    165  1.25  dholland 
    166  1.25  dholland /* in draw.c */
    167  1.25  dholland void drawmaze(PLAYER *);
    168  1.25  dholland void look(PLAYER *);
    169  1.15  dholland void check(PLAYER *, int, int);
    170  1.25  dholland void showstat(PLAYER *);
    171  1.25  dholland void drawplayer(PLAYER *, bool);
    172  1.25  dholland void message(PLAYER *, const char *);
    173  1.25  dholland 
    174  1.25  dholland /* in driver.c */
    175  1.15  dholland void checkdam(PLAYER *, PLAYER *, IDENT *, int, char);
    176  1.25  dholland int rand_num(int);
    177  1.25  dholland __dead void cleanup(int);
    178  1.25  dholland 
    179  1.25  dholland /* in execute.c */
    180  1.25  dholland void mon_execute(PLAYER *);	/* ifdef MONITOR only */
    181  1.25  dholland void execute(PLAYER *);
    182  1.25  dholland void add_shot(int, int, int, char, int, PLAYER *, int, char);
    183  1.15  dholland BULLET *create_shot(int, int, int, char, int, int, PLAYER *,
    184  1.10       jsm 		    IDENT *, int, char);
    185  1.25  dholland 
    186  1.25  dholland /* in expl.c */
    187  1.25  dholland void showexpl(int, int, char);
    188  1.25  dholland void rollexpl(void);
    189  1.25  dholland void clearwalls(void);
    190  1.25  dholland 
    191  1.25  dholland /* in makemaze.c */
    192  1.15  dholland void makemaze(void);
    193  1.25  dholland 
    194  1.25  dholland /* in shots.c */
    195  1.15  dholland void moveshots(void);
    196  1.25  dholland PLAYER *play_at(int, int);
    197  1.20  dholland bool opposite(int, char);
    198  1.25  dholland BULLET *is_bullet(int, int);
    199  1.25  dholland void fixshots(int, int, char);
    200  1.25  dholland 
    201  1.27  dholland /* in support.c */
    202  1.27  dholland __printflike(2, 3) void complain(int level, const char *fmt, ...);
    203  1.27  dholland 
    204  1.25  dholland /* in terminal.c */
    205  1.25  dholland void cgoto(PLAYER *, int, int);
    206  1.15  dholland void outch(PLAYER *, int);
    207  1.15  dholland void outstr(PLAYER *, const char *, int);
    208  1.25  dholland void clrscr(PLAYER *);
    209  1.25  dholland void ce(PLAYER *);
    210  1.15  dholland void sendcom(PLAYER *, int, ...);
    211