RaceX.h
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:4k
- // RACE X
- //
- // Written by Mauricio Teichmann Ritter
- //
- // Copyright (C) 2002, Brazil. All rights reserved.
- //
- //
- #include "stdafx.h"
- #include "cRaceCar.h" // Added by ClassView
- #include ".applibcApplication.h"
- #include ".applibcKeyboard.h"
- #include ".applibcMouse.h"
- #include ".applibcSurface.h"
- #include ".applibcSprite.h"
- #include ".applibcMultiplayer.h"
- #include ".applibcMessageHandler.h"
- #include ".applibcSoundInterface.h"
- #include ".applibcSound.h"
- #include ".applibcWavFile.h"
- #include "cRaceTrack.h"
- #include "cCompetition.h"
- #include "cTextWriter.h"
- #define GS_MAINSCREEN 1
- #define GS_RACE 2
- #define GS_CREATEGAME 3
- #define GS_JOINGAME 4
- #define GS_CREDITS 5
- #define GS_HELP 6
- #define GS_SELECTTRACK_AND_CAR 11
- #define GS_SELECTCAR 12
- #define GS_RACECOMPLETED 13
- #define GS_COMPETITIONSTATUS 14
- #define GS_NETWORKSTATUS 15
- #define GS_WAIT 16
- #define GS_WAITCOMPETITION 17
- #define MSG_PLAYER_INFO 1
- #define MSG_START_RACE 2
- #define MSG_KEYBOARD_STATUS 3
- #define MSG_RACECARS_STATUS 4
- #define MSG_RACECARS_INFO 5
- #define MSG_COMPETITIONSTATUS 6
- #define MSG_PLAYER_READY 7
- // This is the main application class
- class cRaceXApp : public cApplication, cMessageHandler
- {
- private:
- // This holds the startup flag for each one of the game states
- int iStart;
- // This vector hold the track names
- STRVECTOR pTrackNames;
- // RaceTrack instance
- cRaceTrack pRaceTrack;
- // This is used to process the Mouse and Keyboard input
- cMouse m_Mouse;
- cKeyboard m_Keyboard;
- // Textwritter classes, used to write text on the screen
- cTextWriter m_txDigital;
- cTextWriter m_txDigitalSmall;
- cTextWriter m_txVerdana;
- // Competiion class instance
- cCompetition m_pCompetition;
- // Main DXSound wrapper interface
- cSoundInterface m_pSoundInterface;
- // Multiplayer Management object
- cMultiplayer m_pMultiPlayer;
- public:
- int GetDifficultyLevel();
- int m_iDifficultyLevel;
- cSurface m_surfCarPannel;
- BOOL m_bSendKeyboard;
- cMultiplayer* GetMultiplayer();
- BOOL m_bIsMultiplayer;
- BOOL CheckInput(string*, int iMax);
-
- string m_sPlayerName;
- string m_sGameName;
- cSprite m_sptrCar;
- int m_iIncrY;
- int m_iIncrX;
- // Sound Objects
- cSound m_sndChangeOption;
- cSound m_sndSelect;
- cSound m_sndType;
- int m_iOption;
- int m_iTrack;
-
- // Surface Objects
- cSurface m_surfBigCars[4];
- cSurface m_surfCursor;
- cSurface m_surfCaret;
- cSurface m_surfTitle;
- cSurface m_surfHelmet;
- cSurface m_surfPanel;
- cSurface m_surfTophy;
- cSurface m_surfPositions;
- int m_iState;
- cSurface m_hcHit;
- cRaceCar* pCar;
- // To show the track to select
- int m_iX, m_iY;
- void ExitApp();
- cRaceXApp() : cApplication()
- {
- m_bSendKeyboard = TRUE;
- m_lpszAppName = "RaceX";
- m_lpszwndClassName = "RaceXWnd";
- m_iState = GS_MAINSCREEN;
- m_bIsMultiplayer = FALSE;
- iStart = 0;
- WIN32_FIND_DATA lpFindData;
-
- HANDLE hFileFinder = FindFirstFile("*.rxt", &lpFindData);
- if(hFileFinder)
- {
- char* lpTmpString;
- do
- {
- lpTmpString = (char*) malloc(strlen(lpFindData.cFileName)+1);
- memcpy(lpTmpString, lpFindData.cFileName, strlen(lpFindData.cFileName)+1);
- pTrackNames.push_back(lpTmpString);
- lpTmpString = NULL;
- }while(FindNextFile(hFileFinder, &lpFindData) != 0);
- }
- }
- ~cRaceXApp()
- {
- }
- void AppInitialized();
- void DoIdle();
- void IncomingMessage(DWORD dwType, int idSender, BYTE* pBuffer, DWORD dwBufferSize);
- };
- cRaceXApp* GetRaceXApp();