Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2009-11-16 02:58:56 +0300
committerBenoit Bolsee <benoit.bolsee@online.be>2009-11-16 02:58:56 +0300
commitb45ab480e07931406785c8fc877e7cee849c8998 (patch)
tree88dbf52d49d1a3c26a5f4683517cfd3d7d7adcbf /source/gameengine/GameLogic
parent349fa813eaf413cd2f472e545e7ce2cb6b087b1c (diff)
BGE: dynamic loading patch commited. API and demo files available here: https://projects.blender.org/tracker/?func=detail&aid=19492&group_id=9&atid=127
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r--source/gameengine/GameLogic/SCA_EventManager.h5
-rw-r--r--source/gameengine/GameLogic/SCA_ILogicBrick.h8
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp13
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.h1
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.cpp5
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.h5
6 files changed, 37 insertions, 0 deletions
diff --git a/source/gameengine/GameLogic/SCA_EventManager.h b/source/gameengine/GameLogic/SCA_EventManager.h
index debefcc45b0..8d3610acc5f 100644
--- a/source/gameengine/GameLogic/SCA_EventManager.h
+++ b/source/gameengine/GameLogic/SCA_EventManager.h
@@ -70,6 +70,11 @@ public:
virtual void EndFrame();
virtual void RegisterSensor(class SCA_ISensor* sensor);
int GetType();
+ //SG_DList &GetSensors() { return m_sensors; }
+
+
+ void Replace_LogicManager(SCA_LogicManager* logicmgr) { m_logicmgr= logicmgr; }
+ virtual void Replace_PhysicsScene(class PHY_IPhysicsEnvironment* env) { } /* only for event managers that use one */
protected:
EVENT_MANAGER_TYPE m_mgrtype;
diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.h b/source/gameengine/GameLogic/SCA_ILogicBrick.h
index 11885f988f3..cebfcf6bdc4 100644
--- a/source/gameengine/GameLogic/SCA_ILogicBrick.h
+++ b/source/gameengine/GameLogic/SCA_ILogicBrick.h
@@ -35,6 +35,9 @@
#include "GEN_Map.h"
#include "GEN_HashedPtr.h"
+class NG_NetworkScene;
+class SCA_IScene;
+
class SCA_ILogicBrick : public CValue
{
Py_Header;
@@ -122,9 +125,14 @@ public:
virtual bool LessComparedTo(SCA_ILogicBrick* other);
+ /* runtime variable, set when Triggering the python controller */
static class SCA_LogicManager* m_sCurrentLogicManager;
+ /* for moving logic bricks between scenes */
+ virtual void Replace_IScene(SCA_IScene *val) {};
+ virtual void Replace_NetworkScene(NG_NetworkScene *val) {};
+
#ifndef DISABLE_PYTHON
// python methods
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index 877563e3161..3191c99fb2f 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -160,6 +160,19 @@ void SCA_ISensor::RegisterToManager()
m_eventmgr->RegisterSensor(this);
}
+void SCA_ISensor::Replace_EventManager(class SCA_LogicManager* logicmgr)
+{
+ if(m_links) { /* true if we're used currently */
+
+ m_eventmgr->RemoveSensor(this);
+ m_eventmgr= logicmgr->FindEventManager(m_eventmgr->GetType());
+ m_eventmgr->RegisterSensor(this);
+ }
+ else {
+ m_eventmgr= logicmgr->FindEventManager(m_eventmgr->GetType());
+ }
+}
+
void SCA_ISensor::LinkToController(SCA_IController* controller)
{
m_linkedcontrollers.push_back(controller);
diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h
index fce5f340be1..e01f5775289 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.h
+++ b/source/gameengine/GameLogic/SCA_ISensor.h
@@ -133,6 +133,7 @@ public:
virtual void RegisterToManager();
virtual void UnregisterToManager();
+ void Replace_EventManager(class SCA_LogicManager* logicmgr);
void ReserveController(int num)
{
m_linkedcontrollers.reserve(num);
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.cpp b/source/gameengine/GameLogic/SCA_LogicManager.cpp
index d93f2e70e36..848b7df6658 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.cpp
+++ b/source/gameengine/GameLogic/SCA_LogicManager.cpp
@@ -282,6 +282,11 @@ void SCA_LogicManager::RegisterMeshName(const STR_String& meshname,void* mesh)
m_mapStringToMeshes.insert(mn,mesh);
}
+void SCA_LogicManager::UnregisterMeshName(const STR_String& meshname,void* mesh)
+{
+ STR_HashedString mn = meshname;
+ m_mapStringToMeshes.remove(mn);
+}
void SCA_LogicManager::RegisterActionName(const STR_String& actname,void* action)
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h
index 402090357cb..0c2effc2516 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.h
+++ b/source/gameengine/GameLogic/SCA_LogicManager.h
@@ -66,6 +66,7 @@ typedef std::map<class SCA_ISensor*,controllerlist > sensormap_t;
#include "SCA_ILogicBrick.h"
#include "SCA_IActuator.h"
+#include "SCA_EventManager.h"
class SCA_LogicManager
@@ -110,6 +111,7 @@ public:
void AddTriggeredController(SCA_IController* controller, SCA_ISensor* sensor);
SCA_EventManager* FindEventManager(int eventmgrtype);
+ vector<class SCA_EventManager*> GetEventManagers() { return m_eventmanagers; }
void RemoveGameObject(const STR_String& gameobjname);
@@ -123,6 +125,9 @@ public:
// for the scripting... needs a FactoryManager later (if we would have time... ;)
void RegisterMeshName(const STR_String& meshname,void* mesh);
+ void UnregisterMeshName(const STR_String& meshname,void* mesh);
+ GEN_Map<STR_HashedString,void*>& GetMeshMap() { return m_mapStringToMeshes; };
+
void RegisterActionName(const STR_String& actname,void* action);
void* GetActionByName (const STR_String& actname);