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>2011-09-07 19:34:04 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2011-09-07 19:34:04 +0400
commitdbd6658d737b1592a633ddf6397be14e50e434d9 (patch)
tree57081721d70622a3c3141909b258f9bce8a5b1e3 /source/gameengine/GameLogic
parentb5bd86e5907c3fa98546dabeda9703dfb15862f4 (diff)
parent884fc84793be1c5fdd6643ad267331381f8e1c6b (diff)
svn merge -r 37306:39975 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r--source/gameengine/GameLogic/CMakeLists.txt24
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_2DFilterActuator.cpp38
-rw-r--r--source/gameengine/GameLogic/SCA_2DFilterActuator.h23
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.h2
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_MouseSensor.cpp12
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.h2
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp78
-rw-r--r--source/gameengine/GameLogic/SCA_RandomSensor.cpp30
-rw-r--r--source/gameengine/GameLogic/SCA_XORController.cpp8
13 files changed, 118 insertions, 117 deletions
diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt
index b6721650bad..bd417165337 100644
--- a/source/gameengine/GameLogic/CMakeLists.txt
+++ b/source/gameengine/GameLogic/CMakeLists.txt
@@ -25,13 +25,13 @@
# ***** END GPL LICENSE BLOCK *****
set(INC
- .
- ../../../intern/string
+ .
+ ../Expressions
+ ../Rasterizer
+ ../SceneGraph
../../../intern/container
- ../../../source/gameengine/Expressions
- ../../../source/gameengine/SceneGraph
../../../intern/moto/include
- ../../../source/gameengine/Rasterizer
+ ../../../intern/string
)
set(INC_SYS
@@ -39,8 +39,6 @@ set(INC_SYS
)
set(SRC
- Joystick/SCA_Joystick.cpp
- Joystick/SCA_JoystickEvents.cpp
SCA_2DFilterActuator.cpp
SCA_ANDController.cpp
SCA_ActuatorEventManager.cpp
@@ -81,10 +79,9 @@ set(SRC
SCA_TimeEventManager.cpp
SCA_XNORController.cpp
SCA_XORController.cpp
+ Joystick/SCA_Joystick.cpp
+ Joystick/SCA_JoystickEvents.cpp
- Joystick/SCA_Joystick.h
- Joystick/SCA_JoystickDefines.h
- Joystick/SCA_JoystickPrivate.h
SCA_2DFilterActuator.h
SCA_ANDController.h
SCA_ActuatorEventManager.h
@@ -125,10 +122,15 @@ set(SRC
SCA_TimeEventManager.h
SCA_XNORController.h
SCA_XORController.h
+ Joystick/SCA_Joystick.h
+ Joystick/SCA_JoystickDefines.h
+ Joystick/SCA_JoystickPrivate.h
)
if(WITH_SDL)
- list(APPEND INC_SYS ${SDL_INCLUDE_DIR})
+ list(APPEND INC_SYS
+ ${SDL_INCLUDE_DIR}
+ )
else()
add_definitions(-DDISABLE_SDL)
endif()
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
index a73a6d4631b..48ba09e67d2 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
@@ -89,7 +89,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
{
int i;
// do this once only
- if(SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO ) == -1 ){
+ if(SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) == -1 ){
echo("Error-Initializing-SDL: " << SDL_GetError());
return NULL;
}
@@ -124,7 +124,7 @@ void SCA_Joystick::ReleaseInstance()
m_instance[i]= NULL;
}
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO );
+ SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
#endif
}
}
diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
index 0a65fc1584a..7c1824cd4eb 100644
--- a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
@@ -40,34 +40,34 @@ SCA_2DFilterActuator::~SCA_2DFilterActuator()
}
SCA_2DFilterActuator::SCA_2DFilterActuator(
- SCA_IObject *gameobj,
+ SCA_IObject *gameobj,
RAS_2DFilterManager::RAS_2DFILTER_MODE type,
- short flag,
- float float_arg,
- int int_arg,
- RAS_IRasterizer* rasterizer,
- SCA_IScene* scene)
+ short flag,
+ float float_arg,
+ int int_arg,
+ RAS_IRasterizer* rasterizer,
+ SCA_IScene* scene)
: SCA_IActuator(gameobj, KX_ACT_2DFILTER),
- m_type(type),
- m_disableMotionBlur(flag),
- m_float_arg(float_arg),
- m_int_arg(int_arg),
- m_rasterizer(rasterizer),
- m_scene(scene)
+ m_type(type),
+ m_disableMotionBlur(flag),
+ m_float_arg(float_arg),
+ m_int_arg(int_arg),
+ m_rasterizer(rasterizer),
+ m_scene(scene)
{
- m_gameObj = NULL;
+ m_gameobj = NULL;
if(gameobj){
m_propNames = gameobj->GetPropertyNames();
- m_gameObj = gameobj;
+ m_gameobj = gameobj;
}
}
CValue* SCA_2DFilterActuator::GetReplica()
{
- SCA_2DFilterActuator* replica = new SCA_2DFilterActuator(*this);
- replica->ProcessReplica();
- return replica;
+ SCA_2DFilterActuator* replica = new SCA_2DFilterActuator(*this);
+ replica->ProcessReplica();
+ return replica;
}
@@ -91,10 +91,10 @@ bool SCA_2DFilterActuator::Update()
}
else if(m_type < RAS_2DFilterManager::RAS_2DFILTER_NUMBER_OF_FILTERS)
{
- m_scene->Update2DFilter(m_propNames, m_gameObj, m_type, m_int_arg, m_shaderText);
+ m_scene->Update2DFilter(m_propNames, m_gameobj, m_type, m_int_arg, m_shaderText);
}
// once the filter is in place, no need to update it again => disable the actuator
- return false;
+ return false;
}
diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.h b/source/gameengine/GameLogic/SCA_2DFilterActuator.h
index 87d2e8ddbcf..82c82ac3be5 100644
--- a/source/gameengine/GameLogic/SCA_2DFilterActuator.h
+++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.h
@@ -42,7 +42,6 @@ class SCA_2DFilterActuator : public SCA_IActuator
private:
vector<STR_String> m_propNames;
- void * m_gameObj;
RAS_2DFilterManager::RAS_2DFILTER_MODE m_type;
short m_disableMotionBlur;
float m_float_arg;
@@ -53,19 +52,19 @@ private:
public:
- SCA_2DFilterActuator(
- class SCA_IObject* gameobj,
- RAS_2DFilterManager::RAS_2DFILTER_MODE type,
- short flag,
- float float_arg,
- int int_arg,
- RAS_IRasterizer* rasterizer,
- SCA_IScene* scene);
+ SCA_2DFilterActuator(
+ class SCA_IObject* gameobj,
+ RAS_2DFilterManager::RAS_2DFILTER_MODE type,
+ short flag,
+ float float_arg,
+ int int_arg,
+ RAS_IRasterizer* rasterizer,
+ SCA_IScene* scene);
void SetShaderText(const char *text);
- virtual ~SCA_2DFilterActuator();
- virtual bool Update();
+ virtual ~SCA_2DFilterActuator();
+ virtual bool Update();
- virtual CValue* GetReplica();
+ virtual CValue* GetReplica();
};
#endif
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index 0d09e33a81b..85982bd3c0f 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -216,8 +216,8 @@ void SCA_ISensor::UnregisterToManager()
void SCA_ISensor::ActivateControllers(class SCA_LogicManager* logicmgr)
{
- for(vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin();
- c!=m_linkedcontrollers.end();++c)
+ for(vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin();
+ c!=m_linkedcontrollers.end();++c)
{
SCA_IController* contr = *c;
if (contr->IsActive())
diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h
index 741448b1096..f90f1e19a67 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.h
+++ b/source/gameengine/GameLogic/SCA_ISensor.h
@@ -105,7 +105,7 @@ public:
};
SCA_ISensor(SCA_IObject* gameobj,
- class SCA_EventManager* eventmgr);;
+ class SCA_EventManager* eventmgr);
~SCA_ISensor();
virtual void ReParent(SCA_IObject* parent);
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
index 513be43ec28..a2374ccb9da 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
@@ -132,7 +132,7 @@ bool SCA_KeyboardSensor::Evaluate()
// cerr << "SCA_KeyboardSensor::Eval event, sensing for "<< m_hotkey << " at device " << inputdev << "\n";
/* See if we need to do logging: togPropState exists and is
- * different from 0 */
+ * different from 0 */
CValue* myparent = GetParent();
CValue* togPropState = myparent->GetProperty(m_toggleprop);
if (togPropState &&
@@ -400,7 +400,7 @@ void SCA_KeyboardSensor::LogKeystrokes(void)
int index = 0;
/* Check on all keys whether they were pushed. This does not
- * untangle the ordering, so don't type too fast :) */
+ * untangle the ordering, so don't type too fast :) */
for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++)
{
const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i);
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
index a1836163e9c..93d2ae2c1c5 100644
--- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
@@ -50,12 +50,12 @@
/* ------------------------------------------------------------------------- */
SCA_MouseSensor::SCA_MouseSensor(SCA_MouseManager* eventmgr,
- int startx,int starty,
- short int mousemode,
- SCA_IObject* gameobj)
+ int startx,int starty,
+ short int mousemode,
+ SCA_IObject* gameobj)
: SCA_ISensor(gameobj,eventmgr),
- m_x(startx),
- m_y(starty)
+ m_x(startx),
+ m_y(starty)
{
m_mousemode = mousemode;
m_triggermode = true;
@@ -72,7 +72,7 @@ void SCA_MouseSensor::Init()
SCA_MouseSensor::~SCA_MouseSensor()
{
- /* Nothing to be done here. */
+ /* Nothing to be done here. */
}
void SCA_MouseSensor::UpdateHotkey(void *self)
diff --git a/source/gameengine/GameLogic/SCA_PythonController.h b/source/gameengine/GameLogic/SCA_PythonController.h
index 3ccbfea7ed5..739e566237b 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.h
+++ b/source/gameengine/GameLogic/SCA_PythonController.h
@@ -34,7 +34,7 @@
#ifndef KX_PYTHONCONTROLLER_H
#define KX_PYTHONCONTROLLER_H
-
+
#include "SCA_IController.h"
#include "SCA_LogicManager.h"
#include "BoolValue.h"
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
index 3a6b00198e1..c9d11a27c76 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
@@ -152,7 +152,7 @@ bool SCA_RandomActuator::Update()
/* If x_1, x_2, ... is a sequence of random numbers with uniform */
/* distribution between zero and one, k is the first integer for */
/* which the product x_1*x_2*...*x_k < exp(-\lamba). */
- float a = 0.0, b = 0.0;
+ float a, b;
int res = 0;
/* The - sign is important here! The number to test for, a, must be */
/* between 0 and 1. */
@@ -207,10 +207,10 @@ bool SCA_RandomActuator::Update()
sensible values. The termination condition states two
things:
1. s >= 0 is not allowed: to prevent the distro from
- getting a bias towards high values. This is a small
+ getting a bias towards high values. This is a small
correction, really, and might also be left out.
2. s == 0 is not allowed: to prevent a division by zero
- when renormalising the drawn value to the desired
+ when renormalising the drawn value to the desired
distribution shape. As a side effect, the distro will
never yield the exact mean.
I am not sure whether this is consistent, since the error
diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
index 06c24c8211b..67af6237a8d 100644
--- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
@@ -68,12 +68,12 @@ SCA_RandomNumberGenerator::~SCA_RandomNumberGenerator() {
void SCA_RandomNumberGenerator::SetStartVector(void) {
/* setting initial seeds to mt[N] using */
- /* the generator Line 25 of Table 1 in */
- /* [KNUTH 1981, The Art of Computer Programming */
- /* Vol. 2 (2nd Ed.), pp102] */
- mt[0] = m_seed & 0xffffffff;
- for (mti = 1; mti < N; mti++)
- mt[mti] = (69069 * mt[mti-1]) & 0xffffffff;
+ /* the generator Line 25 of Table 1 in */
+ /* [KNUTH 1981, The Art of Computer Programming */
+ /* Vol. 2 (2nd Ed.), pp102] */
+ mt[0] = m_seed & 0xffffffff;
+ for (mti = 1; mti < N; mti++)
+ mt[mti] = (69069 * mt[mti-1]) & 0xffffffff;
}
long SCA_RandomNumberGenerator::GetSeed() { return m_seed; }
@@ -87,39 +87,39 @@ void SCA_RandomNumberGenerator::SetSeed(long newseed)
* This is the important part: copied verbatim :)
*/
unsigned long SCA_RandomNumberGenerator::Draw() {
- static unsigned long mag01[2] = { 0x0, MATRIX_A };
- /* mag01[x] = x * MATRIX_A for x=0,1 */
-
- unsigned long y;
-
- if (mti >= N) { /* generate N words at one time */
- int kk;
-
- /* I set this in the constructor, so it is always satisfied ! */
-// if (mti == N+1) /* if sgenrand() has not been called, */
-// GEN_srand(4357); /* a default initial seed is used */
-
- for (kk = 0; kk < N - M; kk++) {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++) {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= TEMPERING_SHIFT_U(y);
- y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B;
- y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C;
- y ^= TEMPERING_SHIFT_L(y);
-
- return y;
+ static unsigned long mag01[2] = { 0x0, MATRIX_A };
+ /* mag01[x] = x * MATRIX_A for x=0,1 */
+
+ unsigned long y;
+
+ if (mti >= N) { /* generate N words at one time */
+ int kk;
+
+ /* I set this in the constructor, so it is always satisfied ! */
+ // if (mti == N+1) /* if sgenrand() has not been called, */
+ // GEN_srand(4357); /* a default initial seed is used */
+
+ for (kk = 0; kk < N - M; kk++) {
+ y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
+ mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1];
+ }
+ for (; kk < N-1; kk++) {
+ y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
+ mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1];
+ }
+ y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
+ mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1];
+
+ mti = 0;
+ }
+
+ y = mt[mti++];
+ y ^= TEMPERING_SHIFT_U(y);
+ y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B;
+ y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C;
+ y ^= TEMPERING_SHIFT_L(y);
+
+ return y;
}
float SCA_RandomNumberGenerator::DrawFloat() {
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
index 99e25042582..c23722d2d3c 100644
--- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
@@ -48,8 +48,8 @@
/* ------------------------------------------------------------------------- */
SCA_RandomSensor::SCA_RandomSensor(SCA_EventManager* eventmgr,
- SCA_IObject* gameobj,
- int startseed)
+ SCA_IObject* gameobj,
+ int startseed)
: SCA_ISensor(gameobj,eventmgr)
{
m_basegenerator = new SCA_RandomNumberGenerator(startseed);
@@ -65,10 +65,10 @@ SCA_RandomSensor::~SCA_RandomSensor()
void SCA_RandomSensor::Init()
{
- m_iteration = 0;
+ m_iteration = 0;
m_interval = 0;
m_lastdraw = false;
- m_currentDraw = m_basegenerator->Draw();
+ m_currentDraw = m_basegenerator->Draw();
}
@@ -97,19 +97,19 @@ bool SCA_RandomSensor::IsPositiveTrigger()
bool SCA_RandomSensor::Evaluate()
{
- /* Random generator is the generator from Line 25 of Table 1 in */
- /* [KNUTH 1981, The Art of Computer Programming Vol. 2 */
- /* (2nd Ed.), pp102] */
- /* It's a very simple max. length sequence generator. We can */
- /* draw 32 bool values before having to generate the next */
- /* sequence value. There are some theorems that will tell you */
- /* this is a reasonable way of generating bools. Check Knuth. */
- /* Furthermore, we only draw each <delay>-eth frame. */
+ /* Random generator is the generator from Line 25 of Table 1 in */
+ /* [KNUTH 1981, The Art of Computer Programming Vol. 2 */
+ /* (2nd Ed.), pp102] */
+ /* It's a very simple max. length sequence generator. We can */
+ /* draw 32 bool values before having to generate the next */
+ /* sequence value. There are some theorems that will tell you */
+ /* this is a reasonable way of generating bools. Check Knuth. */
+ /* Furthermore, we only draw each <delay>-eth frame. */
bool evaluateResult = false;
if (++m_interval > m_pulse_frequency) {
- bool drawResult = false;
+ bool drawResult = false;
m_interval = 0;
if (m_iteration > 31) {
m_currentDraw = m_basegenerator->Draw();
@@ -122,8 +122,8 @@ bool SCA_RandomSensor::Evaluate()
evaluateResult = drawResult != m_lastdraw;
m_lastdraw = drawResult;
}
-
- /* now pass this result to some controller */
+
+ /* now pass this result to some controller */
return evaluateResult;
}
diff --git a/source/gameengine/GameLogic/SCA_XORController.cpp b/source/gameengine/GameLogic/SCA_XORController.cpp
index f5eefd5cc08..4a03062b6ad 100644
--- a/source/gameengine/GameLogic/SCA_XORController.cpp
+++ b/source/gameengine/GameLogic/SCA_XORController.cpp
@@ -63,22 +63,22 @@ void SCA_XORController::Trigger(SCA_LogicManager* logicmgr)
bool sensorresult = false;
for (vector<SCA_ISensor*>::const_iterator is=m_linkedsensors.begin();
- !(is==m_linkedsensors.end());is++)
+ !(is==m_linkedsensors.end());is++)
{
SCA_ISensor* sensor = *is;
if (sensor->GetState())
{
if (sensorresult == true)
{
- sensorresult = false;
+ sensorresult = false;
break;
}
- sensorresult = true;
+ sensorresult = true;
}
}
for (vector<SCA_IActuator*>::const_iterator i=m_linkedactuators.begin();
- !(i==m_linkedactuators.end());i++)
+ !(i==m_linkedactuators.end());i++)
{
SCA_IActuator* actua = *i;
logicmgr->AddActiveActuator(actua,sensorresult);