00001 #ifndef HEADER_ROOM_H 00002 #define HEADER_ROOM_H 00003 00004 class Path; 00005 class Field; 00006 class FinderAlg; 00007 class WavyPicture; 00008 class Controls; 00009 class KeyStroke; 00010 class MouseStroke; 00011 class Unit; 00012 class ResSoundPack; 00013 class PhaseLocker; 00014 class Planner; 00015 class View; 00016 class Decor; 00017 class InputProvider; 00018 class StepCounter; 00019 00020 #include "Drawable.h" 00021 #include "Cube.h" 00022 00023 #include <string> 00024 00025 /** 00026 * Room with level. 00027 */ 00028 class Room : public Drawable { 00029 private: 00030 WavyPicture *m_bg; 00031 Field *m_field; 00032 FinderAlg *m_finder; 00033 ResSoundPack *m_soundPack; 00034 Controls *m_controls; 00035 PhaseLocker *m_locker; 00036 Planner *m_levelScript; 00037 View *m_view; 00038 Cube::t_models m_models; 00039 Cube::eAction m_lastAction; 00040 int m_startTime; 00041 bool m_fastFalling; 00042 private: 00043 void prepareRound(); 00044 bool fallout(bool interactive=true); 00045 bool falldown(bool interactive=true); 00046 void playImpact(Cube::eWeight impact); 00047 void playDead(Cube *model); 00048 bool isFresh() const { return m_lastAction == Cube::ACTION_NO; } 00049 public: 00050 Room(int w, int h, const Path &picture, 00051 PhaseLocker *locker, Planner *levelScript); 00052 ~Room(); 00053 void setWaves(float amplitude, float periode, float speed); 00054 void addDecor(Decor *new_decor); 00055 void setFastFalling(bool value) { m_fastFalling = value; } 00056 00057 int addModel(Cube *new_model, Unit *new_unit); 00058 Cube *getModel(int model_index); 00059 Cube *askField(const V2 &loc); 00060 00061 bool beginFall(bool interactive=true); 00062 void nextRound(const InputProvider *input); 00063 void finishRound(bool interactive=true); 00064 00065 00066 void switchFish(); 00067 void controlEvent(const KeyStroke &stroke); 00068 void controlMouse(const MouseStroke &button); 00069 00070 void loadMove(char move); 00071 bool makeMove(char move); 00072 bool cannotMove() const; 00073 bool isSolvable() const; 00074 bool isSolved() const; 00075 void checkActive(); 00076 void unBusyUnits(); 00077 const StepCounter *stepCounter() const; 00078 00079 int getW() const; 00080 int getH() const; 00081 int getCycles() const; 00082 void addSound(const std::string &name, const Path &file); 00083 void playSound(const std::string &name, int volume=100); 00084 00085 void setScreenShift(const V2 &shift); 00086 void changeBg(const Path &picture); 00087 virtual void drawOn(SDL_Surface *screen); 00088 }; 00089 00090 #endif