#ifndef MAIN_H
#define MAIN_H

/************************************************************************/

#ifndef	GRAPHICS_GFXMACROS_H
#include <graphics/gfxmacros.h>
#endif

#ifndef LIBRARIES_GADTOOLS_H
#include <libraries/gadtools.h>
#endif

/************************************************************************/

#define MYLIB_GRAPHICS
#define MYLIB_INTUITION
#define CATCOMP_NUMBERS

#include "MyLib.h"

#undef BltBitMap
#undef BltBitMapRastPort

/************************************************************************/

#ifndef LIBRARIES_GAMESUPPORT_H
#include <libraries/GameSupport.h>
#endif

#ifndef PROTO_GAMESUPPORT_H
#include <proto/gamesupport.h>
#endif

/************************************************************************/

#ifndef XEMU_H
#include "Xemu.h"
#endif

/************************************************************************/

extern struct DosLibrary *DOSBase;
extern struct GfxBase *GfxBase;
extern struct IntuitionBase *IntuitionBase;
extern struct Library *UtilityBase;
extern struct Library *LocaleBase;
extern struct Library *LayersBase;
extern struct Library *CxBase;

extern struct GameSupportBase *GameSupportBase;

extern struct Locale *Locale;
extern struct Catalog *Catalog;

extern struct TimeFormats
{
  const char *ElapsedTime;
  const char *DateTime;
} Formats;

extern struct MsgPort WindowPort;
extern struct MsgPort MiscPort;

/************************************************************************/

extern struct TextAttr TextAttr;
extern char *ScreenDescription;

/************************************************************************/

#if defined(__SASC)
extern UWORD __chip DitherPattern[2];
#else
extern UWORD *DitherPattern;
#endif

/************************************************************************/

#define FUNCPROTO	~0
#define False		0
#define FONT_NAME
#define SCORE_DIR

/************************************************************************/

struct ScoreDef
{
  struct GS_ScoreDef ScoreDef;
  struct GS_ScoreChunkDef Chunks[3];
};

extern const struct ScoreDef ScoreDef;

/************************************************************************/

struct MiscState
{
  unsigned int GameMode:1;	/* game or demo? */
  unsigned int GamePause:1;	/* game is currently paused */
  unsigned int Joystick:1;	/* we have allocated the joystick */
  unsigned int HappyBlanker:1;	/* HappyBlanker is active */
  unsigned int JumpDemo:3;	/* jump to another demo screen */
  unsigned int Sleep:1;		/* windows are sleeping */
};

extern struct MiscState MiscState;

/************************************************************************/

const char *GetString(LONG);

struct Region *InstallBounds(Pixmap *, struct Rectangle);
void RemoveBounds(Pixmap *);

void *FindMenu(UWORD);

void StartGame(void);
void StopGame(void);

void RedrawGame(void);

int ChangeKey(int, char *);

void UpdateWindowTitle(void);

int CreateBOOPSIClasses(void);
void FreeBOOPSIClasses(void);

struct Menu *CreateMenustrip(struct NewMenu *);

/************************************************************************/

#endif /* MAIN_H */
