| 1 |
#ifndef HEADER_ROOM_H |
| 2 |
#define HEADER_ROOM_H |
| 3 |
|
| 4 |
class Path; |
| 5 |
class Field; |
| 6 |
class FinderAlg; |
| 7 |
class WavyPicture; |
| 8 |
class Controls; |
| 9 |
class KeyStroke; |
| 10 |
class MouseStroke; |
| 11 |
class Unit; |
| 12 |
class ResSoundPack; |
| 13 |
class PhaseLocker; |
| 14 |
class Planner; |
| 15 |
class View; |
| 16 |
class Decor; |
| 17 |
class InputProvider; |
| 18 |
class StepCounter; |
| 19 |
|
| 20 |
#include "Drawable.h" |
| 21 |
#include "Cube.h" |
| 22 |
|
| 23 |
#include <string> |
| 24 |
|
| 25 |
/** |
| 26 |
* Room with level. |
| 27 |
*/ |
| 28 |
class Room : public Drawable { |
| 29 |
private: |
| 30 |
WavyPicture *m_bg; |
| 31 |
std::string m_bgFilename; |
| 32 |
Field *m_field; |
| 33 |
FinderAlg *m_finder; |
| 34 |
ResSoundPack *m_soundPack; |
| 35 |
Controls *m_controls; |
| 36 |
PhaseLocker *m_locker; |
| 37 |
Planner *m_levelScript; |
| 38 |
View *m_view; |
| 39 |
Cube::t_models m_models; |
| 40 |
Cube::eAction m_lastAction; |
| 41 |
int m_startTime; |
| 42 |
bool m_fastFalling; |
| 43 |
private: |
| 44 |
void prepareRound(); |
| 45 |
bool fallout(bool interactive=true); |
| 46 |
bool falldown(bool interactive=true); |
| 47 |
void playImpact(Cube::eWeight impact); |
| 48 |
void playDead(Cube *model); |
| 49 |
bool isFresh() const { return m_lastAction == Cube::ACTION_NO; } |
| 50 |
public: |
| 51 |
Room(int w, int h, const std::string &picture, |
| 52 |
PhaseLocker *locker, Planner *levelScript); |
| 53 |
~Room(); |
| 54 |
void setWaves(float amplitude, float periode, float speed); |
| 55 |
void addDecor(Decor *new_decor); |
| 56 |
void setFastFalling(bool value) { m_fastFalling = value; } |
| 57 |
|
| 58 |
int addModel(Cube *new_model, Unit *new_unit); |
| 59 |
Cube *getModel(int model_index); |
| 60 |
Cube *askField(const V2 &loc); |
| 61 |
|
| 62 |
bool beginFall(bool interactive=true); |
| 63 |
void nextRound(const InputProvider *input); |
| 64 |
void finishRound(bool interactive=true); |
| 65 |
|
| 66 |
|
| 67 |
void switchFish(); |
| 68 |
void controlEvent(const KeyStroke &stroke); |
| 69 |
void controlMouse(const MouseStroke &button); |
| 70 |
|
| 71 |
void loadMove(char move); |
| 72 |
bool makeMove(char move); |
| 73 |
bool cannotMove() const; |
| 74 |
bool isSolvable() const; |
| 75 |
bool isSolved() const; |
| 76 |
bool isFalling() const { return m_lastAction == Cube::ACTION_FALL; } |
| 77 |
void checkActive(); |
| 78 |
void unBusyUnits(); |
| 79 |
const StepCounter *stepCounter() const; |
| 80 |
void setMoves(const std::string &moves); |
| 81 |
|
| 82 |
int getW() const; |
| 83 |
int getH() const; |
| 84 |
int getCycles() const; |
| 85 |
void addSound(const std::string &name, const Path &file); |
| 86 |
void playSound(const std::string &name, int volume=100); |
| 87 |
|
| 88 |
void setScreenShift(const V2 &shift); |
| 89 |
void changeBg(const std::string &picture); |
| 90 |
std::string getBg() const { return m_bgFilename; } |
| 91 |
virtual void drawOn(SDL_Surface *screen); |
| 92 |
}; |
| 93 |
|
| 94 |
#endif |