1 /***************************************
2   $Header: /home/amb/CVS/xbomb/xbomb.h,v 1.9 2008-01-05 19:24:16 amb Exp $
3 
4   XBomb - 'Minesweeper' game - Version 2.2.
5 
6   Global header file.
7   ******************/ /******************
8   Written by Andrew M. Bishop
9 
10   This file Copyright 1994-2007 Andrew M. Bishop
11   It may be distributed under the GNU Public License, version 2, or
12   any higher version.  See section COPYING of the GNU Public license
13   for conditions under which this file may be redistributed.
14   ***************************************/
15 
16 
17 #ifndef XBOMB_H
18 #define XBOMB_H
19 
20 /* State of each square */
21 
22 #define EMPTY         0         /*+ No bomb. +*/
23 #define ACTUAL_BOMB  16         /*+ Really is a bomb. +*/
24 #define THINK_BOMB   32         /*+ User thinks there is a bomb. +*/
25 #define UNSEEN       64         /*+ Not seen by user. +*/
26 #define CORRECT     128         /*+ guessed correctly at end of game. +*/
27 
28 /* Status of game */
29 
30 #define GAME_CONTINUES 0        /*+ Normal state during game. +*/
31 #define GAME_WAIT      1        /*+ Waiting for start to be pressed.  +*/
32 #define GAME_LOST      2        /*+ Just finished a game and lost. +*/
33 #define GAME_WON       3        /*+ Just finished a game and won. +*/
34 #define GAME_READY     4        /*+ Ready to start playing. +*/
35 
36 /* Status of game from the X part */
37 
38 #define GAME_START     10       /*+ User has pressed start button. +*/
39 #define GAME_QUIT      11       /*+ User has pressed quit button. +*/
40 
41 /* The level of difficulty */
42 
43 #define GAME_LEVEL     12       /*+ Starting point for the levels. +*/
44 #define GAME_EASY      12       /*+ The Easy level. +*/
45 #define GAME_MEDIUM    13       /*+ The Medium level. +*/
46 #define GAME_DIFFICULT 14       /*+ The Difficult level. +*/
47 
48 /* The type of game */
49 
50 #define GAME_TYPE     20        /*+ Starting point for the game types. +*/
51 #define GAME_HEXAGON  20        /*+ The hexagons game. +*/
52 #define GAME_SQUARE   21        /*+ The squares game. +*/
53 #define GAME_TRIANGLE 22        /*+ The triangles game. +*/
54 
55 /* The levels */
56 
57 #define NLEVELS  3              /*+ The number of levels. +*/
58 #define MAX_SIZE 30             /*+ The maximum size of the grid. +*/
59 
60 /* The game types */
61 
62 #define NTYPES    3             /*+ The number of types of game. +*/
63 
64 /* In hiscore.c */
65 
66 void PrintHighScores(void);
67 void AddHighScore(int ticks);
68 void ShowHighScores(void);
69 
70 /* In xbomb.c */
71 
72 void StartGame(int level,int type);
73 void HideBombs(int xs,int ys);
74 void StopGame(void);
75 void DrawGrid(void);
76 void SelectSquare(int x,int y);
77 void SelectSquareOrAdjacent(int x,int y);
78 void SelectAdjacent(int x,int y);
79 void MarkBomb(int x,int y);
80 void RemoveEmpties(int x, int y);
81 
82 /* In xwindow.c */
83 
84 void InitialiseX(int *argc,char **argv);
85 void FinishUpX(void);
86 int ProcessXEvents(void);
87 void DrawSquare(int x,int y,unsigned char value);
88 void DisplayHighScores(char *scores[11][4],int which_score);
89 void ScaleWindow(void);
90 void StartClock(int reset);
91 int StopClock(void);
92 void SetUXB(int n);
93 
94 #endif
95