📄 console.h
字号:
#ifndef _ASIDER_TANK_ALPHA3_CONSOLE_H_
#define _ASIDER_TANK_ALPHA3_CONSOLE_H_
#include "msglist.h"
#include "object.h"
#include "mapinfo.h"
#include "aigenerator.h"
enum ConsoleStat { CONSTAT_NOTHING, CONSTAT_WAITCONNECT, CONSTAT_WAITMORE,
CONSTAT_WAITBEGIN, CONSTAT_RUNNING, CONSTAT_WAITPLAYER,
CONSTAT_WAITERROR, CONSTAT_ENDGAME };
#define DEFTANKNUM 20
#define DEFAINUM 4
//-----------------------------------------------------------------------------
// Console version
//-----------------------------------------------------------------------------
#define ASIDER_GAME_TANK_VER_ALPHA2 0x20030215
#define ASIDER_GAME_TANK_VER_ALPHA3 0x20030325
//-----------------------------------------------------------------------------
// Error code
//-----------------------------------------------------------------------------
#define ERRCODE_NOERROR 0
#define ERRCODE_UNKNOWN 1
#define ERRCODE_ILLEGALSCREEN 2
#define ERRCODE_UNABLELOADMAP 3
#define ERRCODE_UNABLEDISPLAY 4
#define ERRCODE_UNABLEFOUNDCMD 5
//-----------------------------------------------------------------------------
// Classes defined in this header file
//-----------------------------------------------------------------------------
class Console;
class ConsoleNet;
//-----------------------------------------------------------------------------
// Name: class Console
// Desc: Class to handle all data of the game and control the operations
// in a game cycle
//-----------------------------------------------------------------------------
class Console
{
protected:
unsigned long con_version;
unsigned int err_code;
public:
Console();
~Console();
// Status function
bool IsError() { return err_code != 0; }
// Access functions
unsigned long GetConsoleVer() { return con_version; }
unsigned int GetError() { return err_code; }
// Methods
virtual void ErrorTrigger( unsigned int error );
};
//-----------------------------------------------------------------------------
// Name: class Console
// Desc: Class to handle all data of the game and control the operations
// in a game cycle
//-----------------------------------------------------------------------------
class ConsoleNet : public Console
{
protected:
DWORD m_dwStatus;
unsigned int m_nPlayers;
unsigned int m_nComputers;
unsigned int m_nComPerTeam;
int m_nLocal;
bool m_bHomeTeam;
int m_nNumTanks;
int m_nNumRiver;
CObjTank *m_ppTanks[DEFTANKNUM];
CObjBullet *m_ppBullets[DEFTANKNUM];
CAiGenerator m_ppAiGen[DEFAINUM];
CObjBase *m_ppBases[2];
CObjBlock *m_pRiver;
CObjFood *m_pFood;
int m_pProCounter[2];
int m_nMsgCounter;
bool *m_pMsgFlag;
CMapInfo MapInfo;
public:
ConsoleNet();
~ConsoleNet();
// Status function
// Access functions
bool IsHomeTeam() { return m_bHomeTeam; }
// Creation/destruction methods
bool CreateConsole( HWND hwnd, const char *mapname, bool hometeam );
bool LoadMap( const char *mapname );
bool RenderMap( bool hometeam );
bool InitDisplay( HWND hwnd );
bool InitSound( HWND hwnd );
bool InitObjects();
// Methods
void CreateAICmd();
void MsgProcessor( CMsgList *ml );
void GameMain();
// Screen methods
bool RollBlockObjects( CObjBlock *poblk, int num );
void BlitTanks( CObjTank **pptks, int num );
void BlitBullets( CObjBullet **ppbts, int num );
bool BlitBases( CObjBase **ppbs, int num );
void BlitFood();
// Override methods
void ErrorTrigger( unsigned int error );
protected:
int BulletsProc();
int TanksProc();
void FoodProc();
};
#endif // _ASIDER_TANK_ALPHA3_CONSOLE_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -