Home | History | Annotate | Line # | Download | only in huntd
hunt.h revision 1.19.6.1
      1  1.19.6.1      yamt /*	$NetBSD: hunt.h,v 1.19.6.1 2014/05/22 11:36:23 yamt 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.8       wiz  *
      7       1.8       wiz  * Redistribution and use in source and binary forms, with or without
      8       1.8       wiz  * modification, are permitted provided that the following conditions are
      9       1.8       wiz  * met:
     10       1.8       wiz  *
     11       1.8       wiz  * + Redistributions of source code must retain the above copyright
     12       1.8       wiz  *   notice, this list of conditions and the following disclaimer.
     13       1.8       wiz  * + Redistributions in binary form must reproduce the above copyright
     14       1.8       wiz  *   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.8       wiz  * + Neither the name of the University of California, San Francisco nor
     17       1.8       wiz  *   the names of its contributors may be used to endorse or promote
     18       1.8       wiz  *   products derived from this software without specific prior written
     19       1.8       wiz  *   permission.
     20       1.8       wiz  *
     21       1.8       wiz  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
     22       1.8       wiz  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     23       1.8       wiz  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     24       1.8       wiz  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     25       1.8       wiz  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     26       1.8       wiz  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     27       1.8       wiz  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28       1.8       wiz  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     29       1.8       wiz  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     30       1.8       wiz  * (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.19.6.1      yamt #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.19.6.1      yamt #include "hunt_common.h"
     45      1.15  dholland 
     46  1.19.6.1      yamt extern const int shot_req[];
     47  1.19.6.1      yamt extern const int shot_type[];
     48      1.15  dholland #ifdef OOZE
     49  1.19.6.1      yamt extern const int slime_req[];
     50      1.15  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.19.6.1      yamt 	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.19.6.1      yamt 	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.19.6.1      yamt extern int Nplayer;
    140  1.19.6.1      yamt 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.19.6.1      yamt /* in answer.c */
    163  1.19.6.1      yamt bool answer(void);
    164  1.19.6.1      yamt int rand_dir(void);
    165  1.19.6.1      yamt 
    166  1.19.6.1      yamt /* in draw.c */
    167  1.19.6.1      yamt void drawmaze(PLAYER *);
    168  1.19.6.1      yamt void look(PLAYER *);
    169      1.15  dholland void check(PLAYER *, int, int);
    170  1.19.6.1      yamt void showstat(PLAYER *);
    171  1.19.6.1      yamt void drawplayer(PLAYER *, bool);
    172  1.19.6.1      yamt void message(PLAYER *, const char *);
    173  1.19.6.1      yamt 
    174  1.19.6.1      yamt /* in driver.c */
    175      1.15  dholland void checkdam(PLAYER *, PLAYER *, IDENT *, int, char);
    176  1.19.6.1      yamt int rand_num(int);
    177  1.19.6.1      yamt __dead void cleanup(int);
    178  1.19.6.1      yamt 
    179  1.19.6.1      yamt /* in execute.c */
    180  1.19.6.1      yamt void mon_execute(PLAYER *);	/* ifdef MONITOR only */
    181  1.19.6.1      yamt void execute(PLAYER *);
    182  1.19.6.1      yamt 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.19.6.1      yamt 
    186  1.19.6.1      yamt /* in expl.c */
    187  1.19.6.1      yamt void showexpl(int, int, char);
    188  1.19.6.1      yamt void rollexpl(void);
    189  1.19.6.1      yamt void clearwalls(void);
    190  1.19.6.1      yamt 
    191  1.19.6.1      yamt /* in makemaze.c */
    192      1.15  dholland void makemaze(void);
    193  1.19.6.1      yamt 
    194  1.19.6.1      yamt /* in shots.c */
    195      1.15  dholland void moveshots(void);
    196  1.19.6.1      yamt PLAYER *play_at(int, int);
    197  1.19.6.1      yamt bool opposite(int, char);
    198  1.19.6.1      yamt BULLET *is_bullet(int, int);
    199  1.19.6.1      yamt void fixshots(int, int, char);
    200  1.19.6.1      yamt 
    201  1.19.6.1      yamt /* in support.c */
    202  1.19.6.1      yamt __printflike(2, 3) void complain(int level, const char *fmt, ...);
    203  1.19.6.1      yamt 
    204  1.19.6.1      yamt /* in terminal.c */
    205  1.19.6.1      yamt 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.19.6.1      yamt void clrscr(PLAYER *);
    209  1.19.6.1      yamt void ce(PLAYER *);
    210      1.15  dholland void sendcom(PLAYER *, int, ...);
    211