home *** CD-ROM | disk | FTP | other *** search
- /*
- * Concentation.h - Concentration header file
- */
-
- # ifndef __BLOBMGR_H__
- # include "BlobMgr.h"
- # endif
-
-
- /*
- * Horizontal and vertical ratios for positioning dialogs on the screen
- * according the Apple's (current) Human Interface Guidelines.
- */
-
- # define horizRatio FixRatio (1, 2)
- # define vertRatio FixRatio (1, 5)
-
-
- /*
- * Resource numbers
- */
-
- typedef enum
- {
- aboutAlrtNum = 1000, /* "About Concentration..." alert */
- playerDlogNum = 1002, /* "Players..." dialog */
- boardDlogNum, /* "Board Size..." dialog */
- msgeAlrtNum, /* generic message alert */
-
- fileMenuNum = 1000,
- editMenuNum,
- gameMenuNum,
-
- helpTextNum = 1000 /* 'TEXT' resource for Help window */
- };
-
-
- typedef enum /* game piece sizes */
- {
- largePiece,
- smallPiece
- };
-
-
- typedef enum /* game piece types */
- {
- iconType, /* 'ICON' */
- cicnType, /* 'cicn' */
- sicnType /* 'SICN' */
- };
-
-
- # define iconSize 32 /* icon's are 32x32 pixels */
- # define sitmSize 16 /* sicn items are 16x16 pixels */
- # define iconGap 9 /* gap between large pieces */
- # define sitmGap 11 /* gap between small pieces */
-
- /*
- * SICN item. this is an array, but it's defined as an array inside
- * a structure so x = y assignments can be done.
- */
-
- typedef struct Sitm Sitm, **SitmHandle;
-
- struct Sitm
- {
- short sitmData[sitmSize];
- };
- typedef Sitm Sicn[1]; /* SICN is (variable-length) array of sitms */
- typedef Sicn **SicnHandle;
-
-
- /*
- * Game piece structure. The type member indicates the type of the data
- * member. Operations that manipulate the data use the type to know now
- * to cast the data handle properly.
- */
-
- typedef struct Piece Piece;
-
- struct Piece
- {
- short pieceType;
- Handle pieceData;
- };
-
- # define maxPieces 200
-
- /*
- * For each type of piece (large or small), there must be enough of them
- * available to make the requisite number of pairs for a given board size,
- * i.e., (rows * cols) / 2.
- *
- * Maximum and default board dimensions MUST multiply to an even number of squares.
- */
-
- # define maxLargeRows 6 /* maximum and default number of */
- # define maxLargeCols 8 /* large-piece rows and columns */
- # define defLargeRows 6
- # define defLargeCols 8
-
- # define maxSmallRows 9 /* maximum and default number of */
- # define maxSmallCols 12 /* small-piece rows and columns */
- # define defSmallRows 6
- # define defSmallCols 8
-
-
- /*
- * Gameboard location, size
- */
-
- # define gbHOffset 160 /* horizontal and vertical offsets */
- # define gbVOffset 9 /* of game board upper left blob */
-
-
- /*
- * Gameboard structure. There is one of these for each size of piece that
- * may be used.
- */
-
- typedef struct GameBoard GameBoard;
-
- struct GameBoard
- {
- short sizeType; /* size type of game pieces (large, small) */
- short maxRows; /* maximum dimensions of board */
- short maxCols;
- short defRows; /* default (starting) dimensions of board */
- short defCols;
- short nRows; /* current dimensions of board */
- short nCols;
- short pieceSize; /* size of board pieces */
- short pieceGap; /* gap between board pieces */
- short nPieces; /* number of pieces actually available */
- Piece piece[maxPieces]; /* array of board pieces */
- };
-
-
- /*
- * Scoreboard location, size
- */
-
- # define maxPlayers 4
-
- # define sbHOffset 14
- # define sbVOffset 15
- # define sbNameWidth 100
- # define sbScoreWidth 30
- # define sbWidth (sbNameWidth + sbScoreWidth)
- # define sbSlotHeight 26 /* height of single slot */
- # define sbHeight (sbSlotHeight * (maxPlayers + 1)) /* +1 allows for title */
-
-
- /*
- * Scoreboard information structure. Contains name and score for maximum
- * number of players, the actual current number of players, the player whose
- * turn it currently is, and who the first player was. First player rotates
- * to next player on each new round of the game.
- */
-
- typedef struct ScoreBoard ScoreBoard;
-
- struct ScoreBoard
- {
- Str255 name[maxPlayers];
- short score[maxPlayers];
- short nPlayers;
- short player;
- short firstPlayer;
- };
-
-
- extern WindowPtr gameWind;
- extern GameBoard *gb;
- extern ScoreBoard *sb;
-
-
- /* Main.c */
-
- void Bail (StringPtr msg);
-
- /* Concentration.c */
-
- void ReadPieces (void);
- void InitBoard (short pieceSize);
- void NewGameRound (void);
- void ShowAnswer (void);
- void WindInit (void);
-
- /* ScoreBoard.c */
-
- void ResetScoreBoard (Boolean advanceFirstPlayer);
- void DrawScoreBoard (void);
- void DrawPlayerInfo (short n);
- void FlashPlayerFrame (short n);
- void HiliteWinner (void);
-
- /* Menu.c */
-
- void SetupMenus (void);
-
- /* Dialog.c */
-
- void PlayerDialog (void);
- void BoardDialog (void);
-
- /* Lib.c */
-
- void MakeBlob (BlobSetHandle bSet, short h, short v, short type);
-
- /* Help.c */
-
- void HelpWindow (void);
-