www.pudn.com > coolMEMORY.rar > MemoryLogic.h
//-----------------------------------------------------------------------------
// File: MemoryLogic.h
//-----------------------------------------------------------------------------
#ifndef __MEMORY_LOGIC_H__
#define __MEMORY_LOGIC_H__
// Definitions: ***************************************************************
enum PLAYER_TYPE
{
PLAYER_TYPE_HUMAN, // This is an human player
PLAYER_TYPE_COMPUTER_EASY, // The computer often forgets something
PLAYER_TYPE_COMPUTER_NORMAL, // The computer sometimes forgets something
PLAYER_TYPE_COMPUTER_CLEVER, // The computer never forgets something...
};
enum
{
FIX_POINT, CURRENT_POINT, LAST_POINT, NEW_POINT, POINT_VELOCITY,
};
#define MAX_PLAYERS 4 // The maximal number of players
#define MAX_CARD_PAIRS 50 // The number of max card pairs
#define cCARD_DESCRIPTION_LENGTH 1000 // The length of an description text
///////////////////////////////////////////////////////////////////////////////
// Structures: ****************************************************************
typedef struct sCARD
{
char byName[256]; // The name of the card
AS_TEXTURE Texture; // The textures this card
AS_FMOD_SAMPLE Sound; // The sound for this card
char byDescription[cCARD_DESCRIPTION_LENGTH]; // The card description
} sCARD;
typedef struct sPLAYER_INFO
{
int iCardPairs; // The number of card pairs this player has
float fActiveBlend; // The active blend value
long lNextSelectionTime; // The time were the next selection should happen
BOOL bComputerMemory[MAX_CARD_PAIRS*2]; // The computers 'memory' for remembering
long lComputerSeeTime[MAX_CARD_PAIRS*2]; // The time, were the computer has seen the card
} sPLAYER_INFO;
///////////////////////////////////////////////////////////////////////////////
// Classes: *******************************************************************
typedef class cSTYLE
{
public:
char byFilename[256], // The filename of this syle
byFolderName[256], // The folder of this syle
byStyleName[256]; // The style name
AS_TEXTURE sTexture[4]; // [0] = The backside textures this card style
// [1] = The side textures this card style
// [2] = The environment textures this card style
// [3] = The table background texture
int iCards; // The number of cards available in this sytle
sCARD *sCard; // The cards
cSTYLE(void);
~cSTYLE(void);
BOOL Load(char *);
void Destroy(void);
void GenOpenGLTextures(void);
void DestroyOpenGLTextures(void);
void UpdateTextures(void);
} cSTYLE;
typedef class cGAME_CONFIG
{
public:
int iPlayers; // The number of players
PLAYER_TYPE PlayerType[MAX_PLAYERS]; // The type of each player
BOOL bShowCardsAtBeginning, // Should the cards be shown at the beginning?
bTimeLimit, // Should there be a time limit?
bThinkTimeLimit, // Should there be an think time limit?
bErrorLimit; // Should there be an error limit?
int iBeginningShowTime, // The time the cards could be seen at the beginning
iTimeLimit, // The games time limit (in seconds)
iThinkTime, // The time each player has to do his action (in seconds)
iRounds, // The number of rounds
iErrors, // The number of wrong selections of an card pair
iCardDimension, // The choosen card dimension
iCardPairs; // The number of card pairs derived from the card dimension
cSTYLE cStyle; // The selected style
cGAME_CONFIG(void);
void SetStandart(void);
void LoadAdvancedSettings(char *);
void SaveAdvancedSettings(char *);
} cGAME_CONFIG;
typedef class cGAME_CARD
{
public:
int iID, // The ID of this card
iCard; // The card ID
AS_3D_VECTOR vWorldPos, // The world position of the card (cards center)
vRot; // The cards rotation
float fSelectionRotTime, // The process of card opening/closing
fSelectionRotSmoothTime; // Opening/closing smooth interpolated time
BOOL bActive, // Is this card active?
bGoingDeath, // Should this card be killed?
bUnderMouse, // Is this card currently under the mouse?
bSelected; // Is it selected?
long lSelectionAniTime; // The time were the last selected animation step was changed
int iSelectionAniStep; // The current selected animation step
FLOAT4 fSelectionColor; // The selection color
AS_3D_VECTOR vAniSelectionPoints[5][8]; // [0] = Fix point position
// [1] = Current point position
// [2] = Last point position
// [3] = New point position
// [4] = Point velocity
void Draw(BOOL);
void PerformLighmap(AS_DLIGHT);
void Check(void);
} cGAME_CARD;
typedef class cGAME_INFO
{
public:
int iSelectedCard[2], // The current selected carts
iCurrentPlayer, // The current player
iCardPairsOnTable, // The number of card pairs which are on still on the table
iCurrentRound; // The current round
sPLAYER_INFO sPlayerInfo[MAX_PLAYERS]; // The information about the players
BOOL bShowCardsAtBeginng; // Beginning show?
long lShowCardsAtBeginningTime; // Show cards at beginning timer
int iShowCardsAtBeginningPastSeconds; // The number of past show seconds
long lTimeLimit; // Time limit timer
int iTimeLimitPastSeconds; // The number of past seconds
long lThinkTime; // Think time timer
int iThinkTimePastSeconds; // The number of past think time seconds
int iError[MAX_CARD_PAIRS*2]; // The errors for each card pair, if its too height the cards will deleted
void Reset(void);
void ShowInfo(AS_WINDOW *);
void ShowPlayerInfo(AS_WINDOW *, int);
void Check(void);
} cGAME_INFO;
///////////////////////////////////////////////////////////////////////////////
// Variables: *****************************************************************
extern cSTYLE *pcCardStyle;
extern cGAME_CONFIG cGameConfig;
extern cGAME_CARD *pcGameCard;
extern cGAME_INFO cGameInfo;
extern AS_2D_VECTOR vPlayField[2];
extern BOOL bGameFinished;
extern float fGameFinishedBlend;
extern INT2 iCardDimensionStencil[11];
extern FLOAT2 fCardDimensionCamera[11];
///////////////////////////////////////////////////////////////////////////////
// Functions: *****************************************************************
extern void InitGameCards(void);
extern void DestroyGameCards(void);
extern void DrawGameCards(void);
extern void CheckGameCards(void);
extern void PerformLightMapOnGameCarts(void);
extern void DrawTableBackground(void);
///////////////////////////////////////////////////////////////////////////////
#endif // __MEMORY_LOGIC_H__