home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / XenonSource.exe / demo5 / gamestate.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-12  |  2.8 KB  |  144 lines

  1. //-------------------------------------------------------------
  2. //
  3. // Class:    CGameState
  4. //
  5. // Author:    John M Phillips
  6. //
  7. // Started:    06/05/00
  8. //
  9. // Base:    None
  10. //
  11. // Derived:    CMainMenuState
  12. //            COptionsMenuState
  13. //            CPlayGameState
  14. //            CScoreEntryState
  15. //            CScoreTableState
  16. //
  17. //-------------------------------------------------------------
  18.  
  19. #ifndef _INCLUDE_GAMESTATE_H
  20. #define _INCLUDE_GAMESTATE_H
  21.  
  22. //-------------------------------------------------------------
  23.  
  24. class CDemo5;
  25.  
  26. //-------------------------------------------------------------
  27. // File directories
  28.  
  29. #define DIRECTORY_ROOT            "..\\..\\"
  30. #define DIRECTORY_MUSIC            "..\\..\\music\\"
  31. #define DIRECTORY_SOUNDS        "..\\..\\sounds\\"
  32. #define DIRECTORY_GRAPHICS        "..\\..\\graphics\\24bit\\"
  33. #define DIRECTORY_LEVELS        "..\\..\\Demo5\\Levels\\"
  34.  
  35. const int MAX_FILENAME_SIZE = 100;
  36.  
  37. //-------------------------------------------------------------
  38.  
  39. typedef enum
  40. {
  41.     MUSIC_TITLE,
  42.     MUSIC_INTRO,
  43.     MUSIC_GAME,
  44.     MUSIC_HISCORE,
  45.     MUSIC_BOSS,
  46.     MUSIC_OUTRO,
  47. } GameMusicType;
  48.  
  49. //-------------------------------------------------------------
  50.  
  51. typedef enum
  52. {
  53.     SAMPLE_MENU_SELECTION,
  54.     SAMPLE_MENU_OPTION,
  55.     SAMPLE_MENU_CLICK,
  56.     SAMPLE_MENU_BACK,
  57.  
  58.     SAMPLE_PLAYER_CREATED,
  59.     SAMPLE_PLAYER_DESTROYED,
  60.     
  61.     SAMPLE_FIRE_MISSILE,
  62.     SAMPLE_FIRE_HOMING_MISSILE,
  63.     SAMPLE_FIRE_LASER,
  64.  
  65.     SAMPLE_SMALL_EXPLOSION,
  66.     SAMPLE_MEDIUM_EXPLOSION,
  67.     SAMPLE_BIG_EXPLOSION,
  68.  
  69.     SAMPLE_ASTEROID_BREAKUP,
  70.  
  71.     SAMPLE_PICKUP,
  72.     SAMPLE_BONUS,
  73.  
  74.     SAMPLE_DIVE_DOWN,
  75.     SAMPLE_DIVE_UP,
  76.  
  77.     SAMPLE_HIT_BACKGROUND,
  78.  
  79.     SAMPLE_ROAR,
  80.     SAMPLE_SNORT,
  81.  
  82.     SAMPLE_CHECKPOINT,
  83.  
  84. } GameSampleType;
  85.  
  86. //-------------------------------------------------------------
  87.  
  88. class CGameState
  89. {
  90.     private:
  91.  
  92.         static CDemo5 *m_demo5;
  93.  
  94.     protected:
  95.  
  96.         static gsCScreen m_screen;
  97.         static gsCKeyboard m_keyboard;
  98.         static gsCSoundSystem m_sound_system;
  99.  
  100.         static gsCFont m_small_font;
  101.         static gsCFont m_medium_font;
  102.         static gsCStarfield m_starfield;
  103.  
  104.         static CLevel m_level;
  105.         static CScene m_scene;
  106.  
  107.         static bool loadGraphics();
  108.         static bool loadMusic();
  109.         static bool loadSoundEffects();
  110.         static void updateVolume();
  111.  
  112.         gsCApplication *getApplication();
  113.  
  114.     public:
  115.  
  116.         CGameState();
  117.         virtual ~CGameState();
  118.  
  119.         static bool initialize(CDemo5 *demo5);
  120.         static bool shutdown();
  121.  
  122.         bool changeState(CGameState *new_game_state);
  123.  
  124.         virtual bool create();
  125.         virtual bool update();
  126.         virtual bool destroy();
  127.  
  128.         gsKeyCode getKey();
  129.         void getControl(Controls& controls,int player);
  130.  
  131.         static void playSample(GameSampleType sample);
  132.         static void playSample(GameSampleType sample,float x);
  133.         static void playMusic(GameMusicType music);
  134.  
  135.         static void stopSamples();
  136.         static void stopMusic();
  137.  
  138. };
  139.  
  140. //-------------------------------------------------------------
  141.  
  142. #endif
  143.  
  144.