/*   ACK-3D ( Animation Construction Kit 3D )	      */
/* Global Data      */
/* Author: Lary Myers */
#include <time.h>
#include <stdio.h>
#include "ack3d.h"

MOUSE mouse;
KEYBOARD keyBoard;
char numLockKeyStatus;

long	LastX1;
long	LastY1;

long	iLastX;
long	iLastY;
int	MaxDistance;
int	ErrorCode;
int	xMapPosn;
int	yMapPosn;
int	SkyColor;
int	FloorColor;
int	FlashColor;
int	TopColor;
int	BottomColor;
int	StartX;
int	StartY;
int	StartAngle;
int	DoorSpeed;
int	NonSecretCode;
int	HaveMouse;  /* 1 if mouse present, else 0   */
int	NoWalls;

int	PageNum;    /* 0,1 - video page to write to */
FILE	*dfp;	    /* Debug file if DEBUG is 1	    */

unsigned      char *bMaps[255]; /* Array of wall bitmaps    */
unsigned      char *oMaps[255]; /* Array of object bitmaps    */

#if 0
void  (*bdfp[MAX_DISTANCE+1])();
#endif
void  (*bdfp[1])();

unsigned char Grid[GRID_MAX+1];

unsigned char xGrid[(GRID_WIDTH+2) * (GRID_HEIGHT+2)];
unsigned char yGrid[(GRID_WIDTH+2) * (GRID_HEIGHT+2)];

unsigned char xObjGrid[(GRID_WIDTH+2) * (GRID_HEIGHT+2)];
unsigned char yObjGrid[(GRID_WIDTH+2) * (GRID_HEIGHT+2)];

SPECIALCODE SpecialCodes[MAX_UPDOWN+1];

int    TotalSpecial;
int    PageBegin[4] = {0,19200,38400,57600}; /* Video offsets  */

int    DistanceTable[MAX_DISTANCE+1];  /* Distance vs height   */
long    AdjustTable[MAX_DISTANCE+1];    /* Used to scale bitmap */

WALLARRAY   Walls[VIEW_WIDTH];

DOORS    Door[MAX_DOORS];

int    xSecretmPos;
int    xSecretmPos1;
int    xSecretColumn;

int    ySecretmPos;
int    ySecretmPos1;
int    ySecretColumn;

int    TotalSecret;
int    CurrentLevel;
int    ViewColumn;
int    CenterRow;
long  *SinTable;
long  *CosTable;

long  *LongTanTable;
long  *LongInvTanTable;
long  *InvCosTable;
long  *InvSinTable;
long  *LongCosTable;
long  *ViewCosTable;

long  *xNextTable;
long  *yNextTable;

time_t txRay,tyRay,tDOW,tFlip;

OBJECTS ObjList[MAX_OBJECTS+1];
unsigned char ObjFlags[MAX_OBJECTS+1];

int MaxObjects;
int TotalObjects;

unsigned char ObjNumber[320];
int ObjMapPosn[320];
long ObjRelDist[320];

int DirDx[] = {0,1,1,1,0,-1,-1,-1};
int DirDy[] = {-1,-1,0,1,1,1,0,-1};
int DirAngle[] = {INT_ANGLE_270,INT_ANGLE_315,0,
	      INT_ANGLE_45,INT_ANGLE_90,
	      INT_ANGLE_135,INT_ANGLE_180,
	      INT_ANGLE_225};


char PalFile[128];
char GridFile[128];
char GoalFile[128];
char GoalPalFile[128];

unsigned int mask[4] = { 0x102, 0x202, 0x402, 0x802 };
unsigned char lowmask[4] = { 0x1, 0x2, 0x4, 0x8 };

