[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20218] trunk/blender/source/gameengine: BGE: fix a compatibility problem since logic patch with YoFrankie ( and other games I guess).
Benoit Bolsee
benoit.bolsee at online.be
Fri May 15 22:51:32 CEST 2009
Revision: 20218
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20218
Author: ben2610
Date: 2009-05-15 22:51:32 +0200 (Fri, 15 May 2009)
Log Message:
-----------
BGE: fix a compatibility problem since logic patch with YoFrankie (and other games I guess). State actuators will now execute before any other actuators to make sure that the actuators link count are up to date when they execute.
Modified Paths:
--------------
trunk/blender/source/gameengine/GameLogic/SCA_IActuator.cpp
trunk/blender/source/gameengine/GameLogic/SCA_IActuator.h
trunk/blender/source/gameengine/GameLogic/SCA_LogicManager.cpp
trunk/blender/source/gameengine/GameLogic/SCA_LogicManager.h
trunk/blender/source/gameengine/Ketsji/KX_StateActuator.cpp
trunk/blender/source/gameengine/Ketsji/KX_StateActuator.h
Modified: trunk/blender/source/gameengine/GameLogic/SCA_IActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_IActuator.cpp 2009-05-15 18:21:27 UTC (rev 20217)
+++ trunk/blender/source/gameengine/GameLogic/SCA_IActuator.cpp 2009-05-15 20:51:32 UTC (rev 20218)
@@ -58,6 +58,27 @@
return false;
}
+void SCA_IActuator::Activate(SG_DList& head)
+{
+ if (QEmpty())
+ {
+ InsertActiveQList(m_gameobj->m_activeActuators);
+ head.AddBack(&m_gameobj->m_activeActuators);
+ }
+}
+
+void SCA_IActuator::Deactivate()
+{
+ if (QDelink())
+ {
+ // the actuator was in the active list
+ if (m_gameobj->m_activeActuators.QEmpty())
+ // the owner object has no more active actuators, remove it from the global list
+ m_gameobj->m_activeActuators.Delink();
+ }
+}
+
+
void SCA_IActuator::ProcessReplica()
{
SCA_ILogicBrick::ProcessReplica();
Modified: trunk/blender/source/gameengine/GameLogic/SCA_IActuator.h
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_IActuator.h 2009-05-15 18:21:27 UTC (rev 20217)
+++ trunk/blender/source/gameengine/GameLogic/SCA_IActuator.h 2009-05-15 20:51:32 UTC (rev 20218)
@@ -118,24 +118,9 @@
/**
* remove this actuator from the list of active actuators
*/
- void Deactivate()
- {
- if (QDelink())
- // the actuator was in the active list
- if (m_gameobj->m_activeActuators.QEmpty())
- // the owner object has no more active actuators, remove it from the global list
- m_gameobj->m_activeActuators.Delink();
- }
+ virtual void Deactivate();
+ virtual void Activate(SG_DList& head);
- void Activate(SG_DList& head)
- {
- if (QEmpty())
- {
- InsertActiveQList(m_gameobj->m_activeActuators);
- head.AddBack(&m_gameobj->m_activeActuators);
- }
- }
-
void LinkToController(SCA_IController* controller);
void UnlinkController(class SCA_IController* cont);
void UnlinkAllControllers();
Modified: trunk/blender/source/gameengine/GameLogic/SCA_LogicManager.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_LogicManager.cpp 2009-05-15 18:21:27 UTC (rev 20217)
+++ trunk/blender/source/gameengine/GameLogic/SCA_LogicManager.cpp 2009-05-15 20:51:32 UTC (rev 20218)
@@ -312,16 +312,6 @@
}
}
-
-void SCA_LogicManager::AddActiveActuator(SCA_IActuator* actua,bool event)
-{
- actua->SetActive(true);
- actua->Activate(m_activeActuators);
- actua->AddEvent(event);
-}
-
-
-
SCA_EventManager* SCA_LogicManager::FindEventManager(int eventmgrtype)
{
// find an eventmanager of a certain type
Modified: trunk/blender/source/gameengine/GameLogic/SCA_LogicManager.h
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_LogicManager.h 2009-05-15 18:21:27 UTC (rev 20217)
+++ trunk/blender/source/gameengine/GameLogic/SCA_LogicManager.h 2009-05-15 20:51:32 UTC (rev 20218)
@@ -65,6 +65,7 @@
*/
#include "SCA_ILogicBrick.h"
+#include "SCA_IActuator.h"
class SCA_LogicManager
@@ -103,7 +104,13 @@
void BeginFrame(double curtime, double fixedtime);
void UpdateFrame(double curtime, bool frame);
void EndFrame();
- void AddActiveActuator(SCA_IActuator* sensor,bool event);
+ void AddActiveActuator(SCA_IActuator* actua,bool event)
+ {
+ actua->SetActive(true);
+ actua->Activate(m_activeActuators);
+ actua->AddEvent(event);
+ }
+
void AddTriggeredController(SCA_IController* controller, SCA_ISensor* sensor);
SCA_EventManager* FindEventManager(int eventmgrtype);
Modified: trunk/blender/source/gameengine/Ketsji/KX_StateActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_StateActuator.cpp 2009-05-15 18:21:27 UTC (rev 20217)
+++ trunk/blender/source/gameengine/Ketsji/KX_StateActuator.cpp 2009-05-15 20:51:32 UTC (rev 20218)
@@ -55,6 +55,9 @@
// intentionally empty
}
+// used to put state actuator to be executed before any other actuators
+SG_QList KX_StateActuator::m_stateActuatorHead;
+
CValue*
KX_StateActuator::GetReplica(
void
@@ -99,6 +102,28 @@
return false;
}
+void KX_StateActuator::Deactivate()
+{
+ if (QDelink())
+ {
+ // the actuator was in the active list
+ if (m_stateActuatorHead.QEmpty())
+ // no more state object active
+ m_stateActuatorHead.Delink();
+ }
+}
+
+void KX_StateActuator::Activate(SG_DList& head)
+{
+ // no need to sort the state actuators
+ if (m_stateActuatorHead.QAddBack(this))
+ {
+ // add front to make sure it runs before other actuators
+ head.AddFront(&m_stateActuatorHead);
+ }
+}
+
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
Modified: trunk/blender/source/gameengine/Ketsji/KX_StateActuator.h
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_StateActuator.h 2009-05-15 18:21:27 UTC (rev 20217)
+++ trunk/blender/source/gameengine/Ketsji/KX_StateActuator.h 2009-05-15 20:51:32 UTC (rev 20218)
@@ -46,6 +46,7 @@
OP_NEG,
OP_COUNT
};
+ static SG_QList m_stateActuatorHead;
int m_operation;
int m_mask;
@@ -71,6 +72,9 @@
virtual bool
Update();
+ virtual void Deactivate();
+ virtual void Activate(SG_DList& head);
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
More information about the Bf-blender-cvs
mailing list