previous functionality of the view restored with a few new benefits ("non-linear" menus)
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <queue>
|
||||
#include <stack>
|
||||
#include <bitset>
|
||||
#include <limits>
|
||||
|
||||
#include "Module.h"
|
||||
#include "EngineEnums.h"
|
||||
|
||||
+19
-1
@@ -163,6 +163,9 @@ void ModelBase::UnregisterEntity (const unsigned int id) {
|
||||
}
|
||||
|
||||
EntityBase* ModelBase::GetEntity (const unsigned int id) {
|
||||
if (id == NullEntityId)
|
||||
return NULL;
|
||||
|
||||
std::map<unsigned int, EntityBase*>::iterator iter = mEntities.find (id);
|
||||
|
||||
if (iter != mEntities.end ()) {
|
||||
@@ -173,6 +176,9 @@ EntityBase* ModelBase::GetEntity (const unsigned int id) {
|
||||
}
|
||||
|
||||
unsigned int ModelBase::CreateEntityId () {
|
||||
if (mEntityIdCounter == NullEntityId - 1)
|
||||
LogError ("Could not create valid entity id, reached maximum value of %u", mEntityIdCounter);
|
||||
|
||||
return ++mEntityIdCounter;
|
||||
}
|
||||
|
||||
@@ -201,6 +207,10 @@ unsigned int ModelBase::GetPlayerEntityId () {
|
||||
return mPlayerEntityId;
|
||||
}
|
||||
|
||||
void ModelBase::SetPlayerEntityId(unsigned int entity_id) {
|
||||
mPlayerEntityId = entity_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* \param collision_time The time when the collision occured relative to the start of the simulation frame
|
||||
*/
|
||||
@@ -249,12 +259,20 @@ void ModelBase::SendEntityCollisionEvent (const unsigned int reference_entity_id
|
||||
*/
|
||||
unsigned int GetPlayerEntityId () {
|
||||
if (!ModelInstance) {
|
||||
LogError ("Couldn't create Entity: Model not initialized!");
|
||||
LogError ("Couldn't get Player id: Model not initialized!");
|
||||
}
|
||||
|
||||
return ModelInstance->GetPlayerEntityId ();
|
||||
}
|
||||
|
||||
void SetPlayerEntityId(unsigned int entity_id) {
|
||||
if (!ModelInstance) {
|
||||
LogError ("Couldn't set Player id: Model not initialized!");
|
||||
}
|
||||
|
||||
ModelInstance->SetPlayerEntityId (entity_id);
|
||||
}
|
||||
|
||||
float GetFrameDuration () {
|
||||
if (!ModelInstance) {
|
||||
LogError ("Couldn't create Entity: Model not initialized!");
|
||||
|
||||
@@ -13,6 +13,8 @@ class Events;
|
||||
class EntityFactoryBase;
|
||||
class OverlayManager;
|
||||
|
||||
const unsigned int NullEntityId = std::numeric_limits<unsigned int>::max() - 1;
|
||||
|
||||
struct EntityBase;
|
||||
|
||||
/** \brief Represents the current state of the Engine
|
||||
@@ -69,6 +71,11 @@ class ModelBase : public Module {
|
||||
|
||||
/** Returns the id of the entity the player is currently controlling */
|
||||
unsigned int GetPlayerEntityId ();
|
||||
/** \brief Assigns the player to an Entity. All controls will be redirected to that player
|
||||
*
|
||||
* This can be used to disable the controls of of the player by assinging
|
||||
* the special entity id of NullEntityId */
|
||||
void SetPlayerEntityId(unsigned int entity_id);
|
||||
|
||||
/** Notifies the gamelogic of a collision event */
|
||||
void SendEntityCollisionEvent (const unsigned int reference_entity_id,
|
||||
|
||||
@@ -5,6 +5,11 @@ namespace Engine {
|
||||
|
||||
/** \brief Adds the function callback as command for the given name*/
|
||||
unsigned int GetPlayerEntityId ();
|
||||
/** \brief Assigns the player to an Entity. All controls will be redirected to that player
|
||||
*
|
||||
* This can be used to disable the controls of of the player by assinging
|
||||
* the special entity id of NullEntityId */
|
||||
void SetPlayerEntityId(unsigned int entity_id);
|
||||
|
||||
/** \brief Returns the duration of the frame in seconds */
|
||||
float GetFrameDuration ();
|
||||
|
||||
@@ -72,6 +72,8 @@
|
||||
* todos within the code have a look at the \ref todo.
|
||||
*
|
||||
* \todo [high] Create a simple racing or asteroids game
|
||||
* \todo [high] Enable saving of music and effects volume
|
||||
* \todo [med] Use shared_ptr instead of raw pointers for the Entities
|
||||
* \todo [med] Clear all references of EntityVisualState and EntityGameState
|
||||
* \todo [med] Clarify functionalities of CreateEntity, KillEntity, RegisterEntity, UnregisterEntity (which frees memory, which does only change the state of the Model?)
|
||||
* \todo [med] Add basic networking
|
||||
@@ -86,7 +88,8 @@
|
||||
* Engine::Module::Init()
|
||||
*
|
||||
* Done:
|
||||
* \todo [high] (11-09-2010) Since introduction of the IMGUI pressing 'space' in the menu crashes the game
|
||||
* \todo [high] (28-11-2010) Allow transitions when player dies
|
||||
* \todo [high] (11-09-2010) Since introduction of the IMGUI pressing 'space' in the menu crashes the game
|
||||
* - [high] In Physics remove dependancy on the Model to pass on collision
|
||||
* events
|
||||
* - [high] Fix Physics bug when two actors collide actively (i.e. velocity
|
||||
|
||||
Reference in New Issue
Block a user