imported patch gamestate_to_model

main
Martin Felis (lola) 2010-06-02 13:39:39 +02:00
parent 710d3e2509
commit 54e14b41af
3 changed files with 15 additions and 12 deletions

View File

@ -14,12 +14,6 @@ class Model : public Engine::ModelBase {
int DoSaveLevel (const char* filename);
bool OnLevelComplete();
void SetGameState (const GameState &state) {
mLastGameState = mGameState;
mGameState = state;
};
GameState GetGameState () { return mGameState; };
int GetPlayerLives () { return mPlayerLives; };
unsigned int GetPoints () { return mPoints; };
@ -46,9 +40,6 @@ class Model : public Engine::ModelBase {
/** \brief Keeps a list of all asteroids */
std::vector<unsigned int> mAsteroids;
GameState mGameState;
GameState mLastGameState;
int mPlayerLives;
unsigned int mPoints;
std::vector<std::string> mLevelList;

View File

@ -23,10 +23,13 @@
#define DECL_ENUM_ELEMENT( element ) element
#define BEGIN_ENUM( ENUM_NAME ) typedef enum tag##ENUM_NAME
#define END_ENUM( ENUM_NAME ) ENUM_NAME; \
const char* GetString##ENUM_NAME(enum tag##ENUM_NAME index);
const char* GetString##ENUM_NAME(enum tag##ENUM_NAME index); \
const char* GetString##ENUM_NAME(unsigned int index);
#else
#define DECL_ENUM_ELEMENT( element ) #element
#define BEGIN_ENUM( ENUM_NAME ) const char* gs_##ENUM_NAME [] =
#define END_ENUM( ENUM_NAME ) ; const char* GetString##ENUM_NAME(enum \
tag##ENUM_NAME index){ return gs_##ENUM_NAME [index]; }
#define END_ENUM( ENUM_NAME ) ; \
const char* GetString##ENUM_NAME(enum \
tag##ENUM_NAME index){ return gs_##ENUM_NAME [index]; } \
const char* GetString##ENUM_NAME(unsigned int index){ return gs_##ENUM_NAME [index]; }
#endif

View File

@ -72,6 +72,12 @@ class ModelBase : public Module {
void SendEntityCollisionEvent (const unsigned int reference_entity_id,
const unsigned int incidence_entity_id, float collision_time, vector3d normal);
void SetGameState (const unsigned int &state) {
mLastGameState = mGameState;
mGameState = state;
};
unsigned int GetGameState () { return mGameState; };
protected:
/** \brief Initializes the system */
virtual int OnInit (int argc, char* argv[]);
@ -98,6 +104,9 @@ class ModelBase : public Module {
unsigned int mEntityIdCounter;
unsigned int mPlayerEntityId;
unsigned int mGameState;
unsigned int mLastGameState;
float mDeltaSec;
friend class ViewBase;