home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / XenonSource.exe / xenon / includes / gamestate.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-13  |  3.9 KB  |  190 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 CXenon;
  25.  
  26. //-------------------------------------------------------------
  27. // Files
  28.  
  29. #define OPTIONS_FILENAME        "options.ini"
  30. #define ACTORINFO_FILENAME        "actors.ini"
  31. #define HISCORE_FILENAME        "hiscore.ini"
  32. #define DEMO_FILENAME            "xenon2000.dem"
  33.  
  34. //-------------------------------------------------------------
  35. // File directories
  36.  
  37. #define DIRECTORY_ROOT            "..\\..\\"
  38. #define DIRECTORY_MUSIC            "..\\..\\music\\"
  39. #define DIRECTORY_SOUNDS        "..\\..\\sounds\\"
  40. #define DIRECTORY_GRAPHICS8        "..\\..\\graphics\\8bit\\"
  41. #define DIRECTORY_GRAPHICS24    "..\\..\\graphics\\24bit\\"
  42. #define DIRECTORY_LEVELS        "..\\..\\levels\\"
  43.  
  44. const int MAX_FILENAME_SIZE = 100;
  45.  
  46. //-------------------------------------------------------------
  47.  
  48. const int NUMBER_OF_SCORE_ENTRIES = 10;
  49.  
  50. //-------------------------------------------------------------
  51.  
  52. typedef enum
  53. {
  54.     MUSIC_TITLE,
  55.     MUSIC_INTRO,
  56.     MUSIC_GAME,
  57.     MUSIC_HISCORE,
  58.     MUSIC_BOSS,
  59.     MUSIC_OUTRO,
  60. } GameMusicType;
  61.  
  62. //-------------------------------------------------------------
  63.  
  64. typedef enum
  65. {
  66.     SAMPLE_MENU_SELECTION,
  67.     SAMPLE_MENU_OPTION,
  68.     SAMPLE_MENU_CLICK,
  69.     SAMPLE_MENU_BACK,
  70.  
  71.     SAMPLE_PLAYER_CREATED,
  72.     SAMPLE_PLAYER_DESTROYED,
  73.     
  74.     SAMPLE_FIRE_MISSILE,
  75.     SAMPLE_FIRE_HOMING_MISSILE,
  76.     SAMPLE_FIRE_LASER,
  77.  
  78.     SAMPLE_SMALL_EXPLOSION,
  79.     SAMPLE_MEDIUM_EXPLOSION,
  80.     SAMPLE_BIG_EXPLOSION,
  81.  
  82.     SAMPLE_ASTEROID_BREAKUP,
  83.  
  84.     SAMPLE_PICKUP,
  85.     SAMPLE_BONUS,
  86.  
  87.     SAMPLE_DIVE_DOWN,
  88.     SAMPLE_DIVE_UP,
  89.  
  90.     SAMPLE_HIT_BACKGROUND,
  91.  
  92.     SAMPLE_ROAR,
  93.     SAMPLE_SNORT,
  94.  
  95.     SAMPLE_CHECKPOINT,
  96.  
  97. } GameSampleType;
  98.  
  99. //-------------------------------------------------------------
  100.  
  101. typedef enum
  102. {
  103.     DEMO_OFF,
  104.     DEMO_RECORD,
  105.     DEMO_PLAYBACK
  106. } DemoMode;
  107.  
  108. //-------------------------------------------------------------
  109.  
  110. typedef enum
  111. {
  112.     KEYBOARD_LAYOUT_1,
  113.     KEYBOARD_LAYOUT_2,
  114.     JOYSTICK_1,
  115.     JOYSTICK_2,
  116. } ControllerType;
  117.  
  118. //-------------------------------------------------------------
  119.  
  120. class CGameState
  121. {
  122.     private:
  123.  
  124.         static CXenon *m_xenon;
  125.  
  126.     protected:
  127.  
  128.         static gsCScreen m_screen;
  129.         static gsCKeyboard m_keyboard;
  130.         static gsCJoystick m_joystick;
  131.         static gsCSoundSystem m_sound_system;
  132.  
  133.         static gsCFont m_small_font;
  134.         static gsCFont m_medium_font;
  135.         static gsCStarfield m_starfield;
  136.         static gsCScoreTable m_score_table;
  137.         static gsCImage m_backdrop;
  138.  
  139.         static char m_level_filename[MAX_FILENAME_SIZE];
  140.  
  141.         static CLevel m_level;
  142.         static CScene m_scene;
  143.  
  144.         static int m_number_of_players;
  145.  
  146.         static bool loadGraphics();
  147.         static bool loadMusic();
  148.         static bool loadSoundEffects();
  149.         static void loadScoreTable();
  150.         static bool saveScoreTable();
  151.         static bool addNewScore(int score);
  152.         static void updateVolume();
  153.  
  154.         gsCApplication *getApplication();
  155.  
  156.         static CDemoRecorder m_demo_recorder;
  157.         static DemoMode m_demo_mode;
  158.  
  159.     public:
  160.  
  161.         CGameState();
  162.         virtual ~CGameState();
  163.  
  164.         static bool initialize(CXenon *xenon);
  165.         static bool shutdown();
  166.  
  167.         bool changeState(CGameState *new_game_state);
  168.  
  169.         virtual bool create();
  170.         virtual bool update();
  171.         virtual bool destroy();
  172.  
  173.         gsKeyCode getKey();
  174.         void getControl(Controls& controls,int player);
  175.  
  176.         static void playSample(GameSampleType sample);
  177.         static void playSample(GameSampleType sample,float x);
  178.         static void playMusic(GameMusicType music);
  179.  
  180.         static void stopSamples();
  181.         static void stopMusic();
  182.  
  183.         static void setDemoMode(DemoMode mode);
  184. };
  185.  
  186. //-------------------------------------------------------------
  187.  
  188. #endif
  189.  
  190.