00001 #ifndef HEADER_LEVEL_H 00002 #define HEADER_LEVEL_H 00003 00004 class Cube; 00005 class Unit; 00006 class DescFinder; 00007 class PhaseLocker; 00008 class Picture; 00009 class DemoMode; 00010 class KeyStroke; 00011 class MouseStroke; 00012 class LevelScript; 00013 class LevelLoading; 00014 class LevelStatus; 00015 class LevelCountDown; 00016 class CommandQueue; 00017 class Command; 00018 class MultiDrawer; 00019 class StatusDisplay; 00020 00021 #include "Path.h" 00022 #include "GameState.h" 00023 #include "CountAdvisor.h" 00024 00025 #include <string> 00026 00027 /** 00028 * Game level with room. 00029 */ 00030 class Level : public GameState, public CountAdvisor { 00031 private: 00032 static const int SPEED_REPLAY = 1; 00033 00034 int m_depth; 00035 const DescFinder *m_desc; 00036 std::string m_codename; 00037 Path m_datafile; 00038 PhaseLocker *m_locker; 00039 bool m_newRound; 00040 LevelScript *m_levelScript; 00041 LevelLoading *m_loading; 00042 LevelCountDown *m_countdown; 00043 CommandQueue *m_show; 00044 int m_restartCounter; 00045 MultiDrawer *m_background; 00046 StatusDisplay *m_statusDisplay; 00047 private: 00048 void initScreen(); 00049 void nextAction(); 00050 void updateLevel(); 00051 void finishLevel(); 00052 void nextLoadAction(); 00053 void nextShowAction(); 00054 void nextPlayerAction(); 00055 void saveSolution(); 00056 void displaySaveStatus(); 00057 protected: 00058 virtual void own_initState(); 00059 virtual void own_updateState(); 00060 virtual void own_pauseState(); 00061 virtual void own_resumeState(); 00062 virtual void own_cleanState(); 00063 virtual void own_noteBg(); 00064 virtual void own_noteFg(); 00065 public: 00066 Level(const std::string &codename, const Path &datafile, int depth); 00067 virtual ~Level(); 00068 virtual const char *getName() const { return "state_level"; }; 00069 void fillDesc(const DescFinder *desc) { m_desc = desc; } 00070 void fillStatus(LevelStatus *status); 00071 00072 void saveGame(const std::string &models); 00073 void loadGame(const std::string &moves); 00074 void loadReplay(const std::string &moves); 00075 00076 bool action_restart(); 00077 bool action_move(char symbol); 00078 bool action_save(); 00079 bool action_load(); 00080 00081 void switchFish(); 00082 void controlEvent(const KeyStroke &stroke); 00083 void controlMouse(const MouseStroke &button); 00084 00085 std::string getLevelName() const; 00086 int getRestartCounter() const { return m_restartCounter; } 00087 int getDepth() const { return m_depth; } 00088 bool isNewRound() const { return m_newRound; } 00089 00090 void createRoom(int w, int h, const Path &picture); 00091 void newDemo(const Path &demofile); 00092 00093 bool isLoading() const; 00094 void togglePause(); 00095 bool isShowing() const; 00096 void interruptShow(); 00097 void planShow(Command *new_command); 00098 00099 virtual int getCountForSolved() const; 00100 virtual int getCountForWrong() const; 00101 }; 00102 00103 #endif