From 00291b5cf4a0f16ddca425b74ed30e8ac35d40e2 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 22 Mar 2004 22:02:18 +0000 Subject: [GameEngine] Commit all Kester's changes made to the gameengine to restore 2.25 like physics. [SCons] Build with Solid as default when enabling the gameengine in the build process [SCons] Build solid and qhull from the extern directory and link statically against them That was about it. There are a few things that needs double checking: * Makefiles * Projectfiles * All the other systems than Linux and Windows on which the build (with scons) has been successfully tested. --- source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp | 4 ++-- source/gameengine/GameLogic/SCA_ISensor.cpp | 4 ++++ source/gameengine/GameLogic/SCA_KeyboardManager.cpp | 6 +++--- source/gameengine/GameLogic/SCA_LogicManager.cpp | 13 ++++++------- source/gameengine/GameLogic/SCA_MouseManager.cpp | 6 +++--- source/gameengine/GameLogic/SCA_PropertyActuator.cpp | 10 +++++----- source/gameengine/GameLogic/SCA_PropertySensor.cpp | 8 ++++---- source/gameengine/GameLogic/SCA_PythonController.cpp | 18 ++++++------------ source/gameengine/GameLogic/SCA_RandomActuator.cpp | 16 ++++++++++++---- source/gameengine/GameLogic/SCA_RandomEventManager.cpp | 4 ++-- 10 files changed, 47 insertions(+), 42 deletions(-) (limited to 'source/gameengine/GameLogic') diff --git a/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp b/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp index 41b9e45df53..18423c4171f 100644 --- a/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp +++ b/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp @@ -45,8 +45,8 @@ using namespace std; SCA_AlwaysEventManager::SCA_AlwaysEventManager(class SCA_LogicManager* logicmgr) - : m_logicmgr(logicmgr), - SCA_EventManager(ALWAYS_EVENTMGR) + : SCA_EventManager(ALWAYS_EVENTMGR), + m_logicmgr(logicmgr) { } diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp index b95c42b0bae..613a44b09f3 100644 --- a/source/gameengine/GameLogic/SCA_ISensor.cpp +++ b/source/gameengine/GameLogic/SCA_ISensor.cpp @@ -156,6 +156,10 @@ PyMethodDef SCA_ISensor::Methods[] = { METH_VARARGS, GetUseNegPulseMode_doc}, {"setUseNegPulseMode", (PyCFunction) SCA_ISensor::sPySetUseNegPulseMode, METH_VARARGS, SetUseNegPulseMode_doc}, + {"getInvert", (PyCFunction) SCA_ISensor::sPyGetInvert, + METH_VARARGS, GetInvert_doc}, + {"setInvert", (PyCFunction) SCA_ISensor::sPySetInvert, + METH_VARARGS, SetInvert_doc}, {NULL,NULL} //Sentinel }; diff --git a/source/gameengine/GameLogic/SCA_KeyboardManager.cpp b/source/gameengine/GameLogic/SCA_KeyboardManager.cpp index 79dbdbe0dc6..039f0c14801 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardManager.cpp +++ b/source/gameengine/GameLogic/SCA_KeyboardManager.cpp @@ -46,8 +46,8 @@ SCA_KeyboardManager::SCA_KeyboardManager(SCA_LogicManager* logicmgr, SCA_IInputDevice* inputdev) : SCA_EventManager(KEYBOARD_EVENTMGR), - m_logicmanager(logicmgr), - m_inputDevice(inputdev) + m_inputDevice(inputdev), + m_logicmanager(logicmgr) { } @@ -70,7 +70,7 @@ void SCA_KeyboardManager::NextFrame(double curtime,double deltatime) { //const SCA_InputEvent& event = GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0; // cerr << "SCA_KeyboardManager::NextFrame"<< endl; - for (int i=0;iActivate(m_logicmanager,NULL); diff --git a/source/gameengine/GameLogic/SCA_LogicManager.cpp b/source/gameengine/GameLogic/SCA_LogicManager.cpp index f33b73199ce..62b532ee5a0 100644 --- a/source/gameengine/GameLogic/SCA_LogicManager.cpp +++ b/source/gameengine/GameLogic/SCA_LogicManager.cpp @@ -50,13 +50,6 @@ SCA_LogicManager::SCA_LogicManager() SCA_LogicManager::~SCA_LogicManager() { - for (vector::iterator it = m_eventmanagers.begin();!(it==m_eventmanagers.end());it++) - { - delete (*it); - } - m_eventmanagers.clear(); - m_sensorcontrollermapje.clear(); - int numgameobj = m_mapStringToGameObjects.size(); for (int i = 0; i < numgameobj; i++) { @@ -73,6 +66,12 @@ SCA_LogicManager::~SCA_LogicManager() delete controllerarray; } */ + for (vector::iterator it = m_eventmanagers.begin();!(it==m_eventmanagers.end());it++) + { + delete (*it); + } + m_eventmanagers.clear(); + m_sensorcontrollermapje.clear(); } diff --git a/source/gameengine/GameLogic/SCA_MouseManager.cpp b/source/gameengine/GameLogic/SCA_MouseManager.cpp index 8d968e0e54d..96abe2c9135 100644 --- a/source/gameengine/GameLogic/SCA_MouseManager.cpp +++ b/source/gameengine/GameLogic/SCA_MouseManager.cpp @@ -52,8 +52,8 @@ SCA_MouseManager::SCA_MouseManager(SCA_LogicManager* logicmgr, SCA_IInputDevice* mousedev) : SCA_EventManager(MOUSE_EVENTMGR), - m_logicmanager(logicmgr), - m_mousedevice (mousedev) + m_mousedevice (mousedev), + m_logicmanager(logicmgr) { m_xpos = 0; m_ypos = 0; @@ -78,7 +78,7 @@ void SCA_MouseManager::NextFrame(double curtime,double deltatime) { if (m_mousedevice) { - for (int i = 0; i < m_sensors.size(); i++) + for (unsigned int i = 0; i < m_sensors.size(); i++) { SCA_MouseSensor* mousesensor = (SCA_MouseSensor*) m_sensors[i]; // (0,0) is the Upper Left corner in our local window diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp index dfb6e3f644b..e4820e00f70 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp @@ -46,11 +46,11 @@ /* ------------------------------------------------------------------------- */ SCA_PropertyActuator::SCA_PropertyActuator(SCA_IObject* gameobj,CValue* sourceObj,const STR_String& propname,const STR_String& expr,int acttype,PyTypeObject* T ) -: SCA_IActuator(gameobj,T), -m_propname(propname), -m_exprtxt(expr), -m_type(acttype), -m_sourceObj(sourceObj) + : SCA_IActuator(gameobj,T), + m_type(acttype), + m_propname(propname), + m_exprtxt(expr), + m_sourceObj(sourceObj) { } diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp index 6fceddcb5f8..448de107381 100644 --- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp +++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp @@ -53,12 +53,12 @@ SCA_PropertySensor::SCA_PropertySensor(SCA_EventManager* eventmgr, KX_PROPSENSOR_TYPE checktype, PyTypeObject* T ) : SCA_ISensor(gameobj,eventmgr,T), - m_checkpropname(propname), + m_checktype(checktype), m_checkpropval(propval), m_checkpropmaxval(propmaxval), - m_checktype(checktype), - m_range_expr(NULL), - m_lastresult(false) + m_checkpropname(propname), + m_lastresult(false), + m_range_expr(NULL) { m_recentresult=false; //CParser pars; diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 0d2f74c14cc..a96e17e67d2 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -50,9 +50,9 @@ SCA_PythonController* SCA_PythonController::m_sCurrentController = NULL; SCA_PythonController::SCA_PythonController(SCA_IObject* gameobj, PyTypeObject* T) : SCA_IController(gameobj, T), - m_pythondictionary(NULL), m_bytecode(NULL), - m_bModified(true) + m_bModified(true), + m_pythondictionary(NULL) { } @@ -285,10 +285,8 @@ PyObject* SCA_PythonController::PyGetActuators(PyObject* self, PyObject* args, PyObject* kwds) { - int index; - PyObject* resultlist = PyList_New(m_linkedactuators.size()); - for (index=0;indexAddRef()); } @@ -310,8 +308,7 @@ SCA_PythonController::PyGetSensor(PyObject* self, return NULL; } - int index; - for (index=0;indexGetName(); @@ -341,8 +338,7 @@ SCA_PythonController::PyGetActuator(PyObject* self, return NULL; } - int index; - for (index=0;indexGetName(); @@ -363,10 +359,8 @@ SCA_PythonController::PyGetSensors(PyObject* self, PyObject* args, PyObject* kwds) { - int index; - PyObject* resultlist = PyList_New(m_linkedsensors.size()); - for (index=0;indexAddRef()); } diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp index 350b2f58b06..4347e5cef67 100644 --- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp @@ -56,10 +56,10 @@ SCA_RandomActuator::SCA_RandomActuator(SCA_IObject *gameobj, const STR_String &propName, PyTypeObject* T) : SCA_IActuator(gameobj, T), - m_distribution(mode), m_propname(propName), m_parameter1(para1), - m_parameter2(para2) + m_parameter2(para2), + m_distribution(mode) { m_base = new SCA_RandomNumberGenerator(seed); m_counter = 0; @@ -94,7 +94,7 @@ bool SCA_RandomActuator::Update(double curtime,double deltatime) RemoveAllEvents(); - CValue *tmpval; + CValue *tmpval = NULL; if (bNegativeEvent) return false; // do nothing on negative events @@ -241,7 +241,15 @@ bool SCA_RandomActuator::Update(double curtime,double deltatime) } break; default: - ; /* unknown distribution... */ + { + /* unknown distribution... */ + static bool randomWarning = false; + if (!randomWarning) { + randomWarning = true; + std::cout << "RandomActuator '" << GetName() << "' has an unknown distribution." << std::endl; + } + return false; + } } /* Round up: assign it */ diff --git a/source/gameengine/GameLogic/SCA_RandomEventManager.cpp b/source/gameengine/GameLogic/SCA_RandomEventManager.cpp index ee517e5b915..17cfa351994 100644 --- a/source/gameengine/GameLogic/SCA_RandomEventManager.cpp +++ b/source/gameengine/GameLogic/SCA_RandomEventManager.cpp @@ -45,8 +45,8 @@ using namespace std; #endif SCA_RandomEventManager::SCA_RandomEventManager(class SCA_LogicManager* logicmgr) - : m_logicmgr(logicmgr), - SCA_EventManager(RANDOM_EVENTMGR) + : SCA_EventManager(RANDOM_EVENTMGR), + m_logicmgr(logicmgr) { } -- cgit v1.2.3