Fle.h
-
#include
"resource.h" // main symbols
-
#include
<d3d9.h>
#include <d3dx9.h>
#include
"D3DGUI.h"
#include "diutil.h"
#include
"AdventureGame.h"
#include
"d3dfont.h"
-
//
enum LOADINGSTATES{
LOADSTATE_BEGINSTARTLOGO,
LOADSTATE_STARTLOGO,
LOADSTATE_ENDSTARTLOGO,
LOADSTATE_BEGINMENU,
LOADSTATE_MENU,
LOADSTATE_ENDMENU,
LOADSTATE_BEGINADVENTUREINTRO,
LOADSTATE_ADVENTUREINTRO,
LOADSTATE_ENDADVENTUREINTRO,
LOADSTATE_BEGINLOADADVENTUREGAME_LOCTEX,
LOADSTATE_ADVENTUREGAME_LOCTEX,
LOADSTATE_ENDADVENTUREGAME_LOCTEX,
LOADSTATE_BEGINLOADADVENTUREGAME_CREATURE,
LOADSTATE_ADVENTUREGAME_CREATURE,
LOADSTATE_ENDADVENTUREGAME_CREATURE,
LOADSTATE_BEGINLOADADVENTUREGAME_SUBJECTS,
LOADSTATE_ADVENTUREGAME_SUBJECTS,
LOADSTATE_ENDADVENTUREGAME_SUBJECTS,
LOADSTATE_BEGINLOADADVENTUREGAME_SUBJECTS_PLATES,
LOADSTATE_ADVENTUREGAME_SUBJECTS_PLATES,
LOADSTATE_ENDADVENTUREGAME_SUBJECTS_PLATES,
LOADSTATE_BEGINLOADADVENTUREGAME_SUBJECTS_PLATES_LETTERS,
LOADSTATE_ADVENTUREGAME_SUBJECTS_PLATES_LETTERS,
LOADSTATE_ENDADVENTUREGAME_SUBJECTS_PLATES_LETTERS,
LOADSTATE_BEGINLOADADVENTUREGAME,
LOADSTATE_ADVENTUREGAME,
LOADSTATE_ENDADVENTUREGAME
};
-
class
CGameAppLoader
{
public:
CGameAppLoader();
~CGameAppLoader();
//
CPtrArray* m_pLoaderTexturesArray;
void Start(CPtrArray* TxArray, LPCTSTR TexFilesPath, LPCTSTR TexFilesListTxt);
void LoadingProcess(CPtrArray* TxArray, LPCTSTR TexFilesPath,
LPD3DXSPRITE pSprite = NULL);
void LoadingResProcess(CPtrArray* TxArray, LPCTSTR TexFilesPath,
LPD3DXSPRITE pSprite);
void LoadingLtProcess(CPtrArray* TxArray, LPCTSTR TexFilesPath,
LPD3DXSPRITE pSprite = NULL);
void End();
void NextLoadStage();
//
float m_fRotorAngle;
void LoadLoaderTextures();
void DrawLoaderScreen();
void RestoreLoaderScreen();
void InvalidateLoaderScreen();
void FreeLoaderTextures();
void AnimateRotor();
void RenderLoaderText();
LPD3D9FONT m_pLoaderFont_2d;
void CreateFont_2d();
void FreeFont_2d();
void RestoreFont_2d();
void InvalidateFont_2d();
void RenderLoaderText_2d();
void Load1GameTexture(CPtrArray* TxArray, LPCTSTR TexFilesPath,
int* CurrentFileIndex, LPD3DXSPRITE pSprite);
void Load1GameTextureRes(CPtrArray* TxArray, LPCTSTR TexFilesPath,
int* CurrentFileIndex, LPD3DXSPRITE pSprite);
void Load1LetterPlate(CPtrArray* TxArray, LPCTSTR TexFilesPath,
int* CurrentFileIndex, LPD3DXSPRITE pSprite);
void OpenGameTexturesListFile(/*CPtrArray* TxArray, */LPCTSTR TexFilesPath,
LPCTSTR TexFilesListTxt);
void CloseGameTexturesListFile();
CStdioFile* m_pTextFile;
//
int m_iCurrentIndex;
float m_fLoadingProgressStep;
float m_fLoadingProgress;
int m_iFilesNum;
TCHAR m_sTexFileName[MaxPath2];
char m_chTexFileName[MAX_PATH];
//
DWORD m_dwLoaderState;
void Loading();
int CountNumberOfFiles();
float m_fRotateProcessTimeCounter;
};
-
//
#define GameAppName L" "
-
#define
ParamDelimeter ';'
#define
GAMEERR_NOINPUT 0x00000006
#define GAMEERR_OUTOFMEMORY 0x00000007
//
#define TexturesPath L"\\Media\\textures\\"
#define LoaderTexFilesPath L"\\Media\\textures\\initial\\"
#define LoaderTexFilesTxt L"\\Media\\textures\\initial\\loader_texlist.txt"
#define
LoaderFontFileName L"\\Media\\fonts\\BALTICA.TTF"
#define LoaderFontHeight 18
#define LoaderFontWidth 10
#define LoaderFontRescaleCorrect 1.0f
#define
LoaderFont2DFileName L"\\Media\\fonts\\MSSansSerif.tga"
#define LoaderFont2DFileName_CoordData L"\\Media\\fonts\\MSSansSerif.dat"
#define
LoaderBackTexIndex 0
#define LoaderRotorTexIndex 1
#define LoaderStatorTexIndex 2
#define
RotateProcessTimeLimit 0.01f
#define RotationStep D3DX_PI * 0.1f
#define RotationSpeed 3.0f
//
(, , )
#define StartupLogoFilesPath L"\\Media\\textures\\startlogo\\"
#define StartupLogoTexFilesTxt L"\\Media\\textures\\startlogo\\start_texlist.txt"
CD3DGameApp
-
class
CD3DGameApp
{
public:
HWND m_hWndMain;
DWORD m_dwScreenWidth; //
DWORD m_dwScreenHeight;
float m_fResolutionRescale;
bool m_bIsActive; //
bool m_bDisplayReady; //
FLOAT fAspectRatio;
BOOL m_bMouseVisible; //
DWORD m_dwAppState; //
DWORD m_dwAppStateAfterLoad; //
//
// Direct3D
LPD3DXSPRITE m_pSprite;
bool m_bShowFPSOn;
bool m_bPaused;
float m_fElapsedTime;
CD3DGameApp();
HRESULT FrameMove();
HRESULT Render();
CGameAppLoader* m_pLoader; //
public:
void GetStrParam(CString* aCurrentStr,
int *aCurrentCharNum, CString* ParamStr);
void ReadFileParam(const CString* ParamStr,
CString* Name, D3DXVECTOR3* Pos, D3DXVECTOR2* Scale, bool* bAnimParam
= NULL,
int* Width = NULL, int* Height = NULL, int* TexOffsetX = NULL,
int* TexOffsetY = NULL, int* FramesPerLine = NULL, float* fMaxFrame =
NULL,
float* Delay = NULL);
void LoadGameTextures(CPtrArray* TxArray, LPCTSTR TexFilesPath,
LPCTSTR TexFilesListTxt);
void FreeGameTextures(CPtrArray* TxArray);
void CleanupAndDisplayError(DWORD dwError);
void Cleanup3DEnvironment();
HRESULT InvalidateDisplayObjects();
HRESULT DestroyDisplayObjects();
HRESULT RestoreDisplayObjects();
void CalcResolutionRescale();
// (, ,
)
CStartLogo* m_pStartLogo;
void LoadStartRes();
//
CGameMainMenu* m_pGameMenu;
void LoadMenuRes();
//
CIntroComics* m_pIntroComics;
void LoadIntroComics();
CAdventure* m_pAdventure;
void LoadAdventure();
void ContinueAdventure();
//
HRESULT CreateInputObjects();
void DestroyInputObjects();
void UpdateInput( UserInput* pUserInput );
// DirectInput
CInputDeviceManager* m_pInputDeviceManager; //
// // DInput
DIACTIONFORMAT m_diafGame; //
UserInput m_UserInput; //
HRESULT InputAddDeviceCB( CInputDeviceManager::DeviceInfo* pDeviceInfo,
const DIDEVICEINSTANCE* pdidi );
static HRESULT CALLBACK StaticInputAddDeviceCB( CInputDeviceManager::DeviceInfo*
pDeviceInfo, const DIDEVICEINSTANCE* pdidi, LPVOID pParam );
BOOL ConfigureInputDevicesCB( IUnknown* pUnknown );
static BOOL CALLBACK StaticConfigureInputDevicesCB( IUnknown* pUnknown,
VOID* pUserData );
void PlayGameSound(int Index, CPtrArray* SoundsArray);
HRESULT LoadSoundList(CPtrArray* SoundsArray,
LPCTSTR SoundsResourcePath, LPCTSTR SoundFilesList);
void FreeSoundList(CPtrArray* SoundsArray);
HRESULT CreateSoundObjects();
void DestroySoundObjects();
void TestGlobalAppState();
};
__declspec(selectany)
CD3DGameApp g_d3dApp; |