#ifndef WARP_H
#define WARP_H
#include "config.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <term.h>
#include <math.h>
#include <stdio.h>
#include <signal.h>
#include <fcntl.h>
#include <ctype.h>
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define SAVEDIR "/var/games/warp"
#define NEWSFILE "warp.news"
#define HELPFILE "warp.doc"
#define LOCKFILE ".warp.lock"
#define LOGFILE "warp.log"
#define SCOREBOARD "warp.top"
#define LSCOREBOARD "warp.lowtop"
#define FSCOREBOARD "warp.funtop"
#define TMPSCOREBOARD "warp.topnew"
#define WARPMACRO "%X/Kbmap.%{TERM}"
#ifndef WARPLIB
# ifdef PRIVLIB
# define WARPLIB PRIVLIB
# else
# define WARPLIB "/usr/games/warp"
# endif
#endif
EXT char *warplib;
#define PERMMAPS 8
#define MAPS 20
#define XYSIZE 920
#define XYSIZEx4 3680
#define YSIZE 23
#define YSIZE00 2300
#define YSIZE01 2301
#define YSIZE99 2299
#define XSIZE 40
#define XSIZE00 4000
#define XSIZE01 4001
#define XSIZE99 3999
#define XSIZE02 4002
#define XSIZE98 3998
#define XSIZE03 4003
#define XSIZE97 3997
#define XSIZE08 4008
#define XSIZE92 3992
EXT char amb[YSIZE][XSIZE];
#ifdef WHOAMI
# include <whoami.h>
#endif
#ifndef isalnum
# define isalnum(c) (isalpha(c) || isdigit(c))
#endif
#ifdef TERMIO
# include <termio.h>
#elif defined TERMIOS
# include <termios.h>
#else
# include <sgtty.h>
#endif
#include <sys/timeb.h>
# include <pwd.h>
#define BITSPERBYTE 8
#define LBUFLEN 512
#ifdef pdp11
# define CBUFLEN 256
# define PUSHSIZE 128
#else
# define CBUFLEN 512
# define PUSHSIZE 256
#endif
#ifdef pdp11
# define MAXFILENAME 128
#else
# define MAXFILENAME 512
#endif
#define FINISHCMD 0177
#define Ctl(ch) (ch & 037)
#define strNE(s1,s2) (strcmp(s1,s2))
#define strEQ(s1,s2) (!strcmp(s1,s2))
#define strnNE(s1,s2,l) (strncmp(s1,s2,l))
#define strnEQ(s1,s2,l) (!strncmp(s1,s2,l))
#define sgn(x) ((x) < 0 ? -1 : (x) > 0)
#ifdef SIGPROF
# define BSD42
#endif
#ifdef FIONREAD
# define PENDING
#else
# ifdef O_NDELAY
# define PENDING
# else
# ifdef RDCHK
# define PENDING
# endif
# endif
#endif
#define UNLINK(victim) unlink(victim)
#ifndef ROOTID
# define ROOTID 0
#endif
# define sigset signal
# define sigignore(sig) signal(sig,SIG_IGN)
#ifndef LOGDIRFIELD
# define LOGDIRFIELD 6
#endif
#ifndef GCOSFIELD
# define GCOSFIELD 5
#endif
#define DEBUGGING
#define PUSHBACK
#define CONDSUB
#define BACKTICK
#define PROMPTTTY
#define GETLOGIN
#define TILDENAME
#define GETWD
#define SETUIDGID
#define VERBOSE
#define TERSE
#ifndef SETUIDGID
# define eaccess access
#endif
#ifdef VERBOSE
# ifdef TERSE
# define IF(c) if (c)
# define ELSE else
# else
# define IF(c)
# define ELSE
# endif
#else
# ifndef TERSE
# define TERSE
# endif
# define IF(c) "IF" outside of VERBOSE???
# define ELSE "ELSE" outside of VERBOSE???
#endif
#ifdef DEBUGGING
# define assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\r\n", __FILE__, __LINE__);sig_catcher(0);}}
#else
# define assert(ex) ;
#endif
#define TCSIZE 512
#ifndef PREFSHELL
# define PREFSHELL "/bin/csh"
#endif
#ifndef SH
# define SH "/bin/sh"
#endif
#ifndef WARPMACRO
# ifdef PUSHBACK
# define WARPMACRO "%./.warpmac"
# endif
#endif
#ifndef FULLNAMEFILE
# ifndef PASSNAMES
# define FULLNAMEFILE "%./.fullname"
# endif
#endif
#ifndef WARPNEWSNAME
# define WARPNEWSNAME "%X/warp.news"
#endif
EXT struct stat filestat;
EXT char buf[LBUFLEN+1];
EXT char *cwd INIT(NULL);
#ifdef DEBUGGING
EXT int debug INIT(0);
# define DEB_FILEXP 64
#endif
#ifdef VERBOSE
# ifdef TERSE
EXT bool verbose INIT(true);
# endif
#endif
EXT FILE *tmpfp INIT(NULL);
#define NOMARKING 0
#define STANDOUT 1
#define UNDERLINE 2
EXT char nullstr[] INIT("");
EXT char readerr[] INIT("warp read error");
EXT char cantopen[] INIT("Can't open %s\r\n");
#ifdef VERBOSE
#define NOCD "Can't chdir to directory %s\r\n"
#else
#define NOCD "Can't find %s\r\n"
#endif
EXT bool justonemoretime INIT(true);
EXT bool keepgoing INIT(true);
EXT bool friendspec INIT(false);
EXT bool piratespec INIT(false);
EXT bool amoebaspec INIT(false);
EXT bool starspec INIT(false);
EXT bool klingspec INIT(false);
EXT bool apolspec INIT(false);
EXT bool crushspec INIT(false);
EXT bool romspec INIT(false);
EXT bool prespec INIT(false);
EXT bool tholspec INIT(false);
EXT bool gornspec INIT(false);
EXT bool beginner INIT(false);
EXT bool massacre INIT(false);
EXT bool lowspeed INIT(false);
EXT bool debugging INIT(false);
EXT bool didkill INIT(false);
EXT bool experimenting INIT(false);
EXT bool scorespec INIT(false);
EXT bool metakey INIT(false);
EXT bool bombed_out;
EXT int panic INIT(0);
EXT bool madgorns;
EXT int madfriends;
EXT int inumpirates;
EXT int numpirates;
EXT int inumfriends;
EXT int numfriends;
EXT int inumamoebas;
EXT int numamoebas;
EXT int inumstars;
EXT int numstars;
EXT int inumenemies;
EXT int numenemies;
EXT int inumroms;
EXT int inumthols;
EXT int inumapollos;
EXT int numapollos;
EXT int apolloflag;
EXT int inumcrushes;
EXT int numcrushes;
EXT int inumgorns;
EXT int numgorns;
EXT int deados;
EXT int deadmudds;
EXT int smarts;
EXT int ismarts INIT(0);
EXT int numos INIT(0);
EXT int numxes INIT(0);
EXT int ient;
EXT int numents;
EXT int ibase;
EXT int numbases;
EXT int inuminhab;
EXT int numinhab;
EXT int wave;
EXT int cumsmarts;
EXT int prescene INIT(-1);
EXT int scandist;
EXT int antibase;
EXT int sm35;
EXT int sm45;
EXT int sm50;
EXT int sm55;
EXT int sm80;
EXT int sm95;
EXT int entmax;
EXT int basemax;
EXT int enemshields;
EXT int super;
EXT int whenok;
EXT int yamblast;
EXT int xamblast;
EXT int ambsize;
EXT char spbuf[1024];
#endif