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:
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r--source/gameengine/GameLogic/CMakeLists.txt147
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp382
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_Joystick.h213
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h56
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp137
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h52
-rw-r--r--source/gameengine/GameLogic/SCA_2DFilterActuator.cpp153
-rw-r--r--source/gameengine/GameLogic/SCA_2DFilterActuator.h71
-rw-r--r--source/gameengine/GameLogic/SCA_ANDController.cpp131
-rw-r--r--source/gameengine/GameLogic/SCA_ANDController.h51
-rw-r--r--source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp68
-rw-r--r--source/gameengine/GameLogic/SCA_ActuatorEventManager.h56
-rw-r--r--source/gameengine/GameLogic/SCA_ActuatorSensor.cpp171
-rw-r--r--source/gameengine/GameLogic/SCA_ActuatorSensor.h70
-rw-r--r--source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp58
-rw-r--r--source/gameengine/GameLogic/SCA_AlwaysEventManager.h50
-rw-r--r--source/gameengine/GameLogic/SCA_AlwaysSensor.cpp139
-rw-r--r--source/gameengine/GameLogic/SCA_AlwaysSensor.h53
-rw-r--r--source/gameengine/GameLogic/SCA_BasicEventManager.cpp60
-rw-r--r--source/gameengine/GameLogic/SCA_BasicEventManager.h57
-rw-r--r--source/gameengine/GameLogic/SCA_DelaySensor.cpp170
-rw-r--r--source/gameengine/GameLogic/SCA_DelaySensor.h66
-rw-r--r--source/gameengine/GameLogic/SCA_EventManager.cpp83
-rw-r--r--source/gameengine/GameLogic/SCA_EventManager.h90
-rw-r--r--source/gameengine/GameLogic/SCA_ExpressionController.cpp159
-rw-r--r--source/gameengine/GameLogic/SCA_ExpressionController.h66
-rw-r--r--source/gameengine/GameLogic/SCA_IActuator.cpp139
-rw-r--r--source/gameengine/GameLogic/SCA_IActuator.h168
-rw-r--r--source/gameengine/GameLogic/SCA_IController.cpp298
-rw-r--r--source/gameengine/GameLogic/SCA_IController.h112
-rw-r--r--source/gameengine/GameLogic/SCA_IInputDevice.cpp139
-rw-r--r--source/gameengine/GameLogic/SCA_IInputDevice.h333
-rw-r--r--source/gameengine/GameLogic/SCA_ILogicBrick.cpp271
-rw-r--r--source/gameengine/GameLogic/SCA_ILogicBrick.h167
-rw-r--r--source/gameengine/GameLogic/SCA_IObject.cpp349
-rw-r--r--source/gameengine/GameLogic/SCA_IObject.h229
-rw-r--r--source/gameengine/GameLogic/SCA_IScene.cpp144
-rw-r--r--source/gameengine/GameLogic/SCA_IScene.h87
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp471
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.h220
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickManager.cpp92
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickManager.h58
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.cpp428
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.h168
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardManager.cpp79
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardManager.h66
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.cpp668
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.h141
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.cpp342
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.h154
-rw-r--r--source/gameengine/GameLogic/SCA_MouseManager.cpp112
-rw-r--r--source/gameengine/GameLogic/SCA_MouseManager.h75
-rw-r--r--source/gameengine/GameLogic/SCA_MouseSensor.cpp317
-rw-r--r--source/gameengine/GameLogic/SCA_MouseSensor.h120
-rw-r--r--source/gameengine/GameLogic/SCA_NANDController.cpp133
-rw-r--r--source/gameengine/GameLogic/SCA_NANDController.h52
-rw-r--r--source/gameengine/GameLogic/SCA_NORController.cpp133
-rw-r--r--source/gameengine/GameLogic/SCA_NORController.h48
-rw-r--r--source/gameengine/GameLogic/SCA_ORController.cpp129
-rw-r--r--source/gameengine/GameLogic/SCA_ORController.h49
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyActuator.cpp293
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyActuator.h90
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyEventManager.cpp57
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyEventManager.h55
-rw-r--r--source/gameengine/GameLogic/SCA_PropertySensor.cpp332
-rw-r--r--source/gameengine/GameLogic/SCA_PropertySensor.h97
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp539
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.h118
-rw-r--r--source/gameengine/GameLogic/SCA_PythonJoystick.cpp188
-rw-r--r--source/gameengine/GameLogic/SCA_PythonJoystick.h55
-rw-r--r--source/gameengine/GameLogic/SCA_PythonKeyboard.cpp153
-rw-r--r--source/gameengine/GameLogic/SCA_PythonKeyboard.h50
-rw-r--r--source/gameengine/GameLogic/SCA_PythonMouse.cpp206
-rw-r--r--source/gameengine/GameLogic/SCA_PythonMouse.h59
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.cpp543
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.h119
-rw-r--r--source/gameengine/GameLogic/SCA_RandomEventManager.cpp57
-rw-r--r--source/gameengine/GameLogic/SCA_RandomEventManager.h54
-rw-r--r--source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp133
-rw-r--r--source/gameengine/GameLogic/SCA_RandomNumberGenerator.h84
-rw-r--r--source/gameengine/GameLogic/SCA_RandomSensor.cpp187
-rw-r--r--source/gameengine/GameLogic/SCA_RandomSensor.h71
-rw-r--r--source/gameengine/GameLogic/SCA_TimeEventManager.cpp119
-rw-r--r--source/gameengine/GameLogic/SCA_TimeEventManager.h62
-rw-r--r--source/gameengine/GameLogic/SCA_XNORController.cpp137
-rw-r--r--source/gameengine/GameLogic/SCA_XNORController.h53
-rw-r--r--source/gameengine/GameLogic/SCA_XORController.cpp136
-rw-r--r--source/gameengine/GameLogic/SCA_XORController.h48
88 files changed, 0 insertions, 13395 deletions
diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt
deleted file mode 100644
index b9eec74f6f4..00000000000
--- a/source/gameengine/GameLogic/CMakeLists.txt
+++ /dev/null
@@ -1,147 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2006, Blender Foundation
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-set(INC
- .
- ../Expressions
- ../Rasterizer
- ../SceneGraph
- ../../blender/blenlib
- ../../../intern/container
- ../../../intern/string
- ../../../intern/ghost
-)
-
-set(INC_SYS
- ../../../intern/moto/include
-)
-
-set(SRC
- SCA_2DFilterActuator.cpp
- SCA_ANDController.cpp
- SCA_ActuatorEventManager.cpp
- SCA_ActuatorSensor.cpp
- SCA_AlwaysEventManager.cpp
- SCA_AlwaysSensor.cpp
- SCA_BasicEventManager.cpp
- SCA_DelaySensor.cpp
- SCA_EventManager.cpp
- SCA_ExpressionController.cpp
- SCA_IActuator.cpp
- SCA_IController.cpp
- SCA_IInputDevice.cpp
- SCA_ILogicBrick.cpp
- SCA_IObject.cpp
- SCA_IScene.cpp
- SCA_ISensor.cpp
- SCA_JoystickManager.cpp
- SCA_JoystickSensor.cpp
- SCA_KeyboardManager.cpp
- SCA_KeyboardSensor.cpp
- SCA_LogicManager.cpp
- SCA_MouseManager.cpp
- SCA_MouseSensor.cpp
- SCA_NANDController.cpp
- SCA_NORController.cpp
- SCA_ORController.cpp
- SCA_PropertyActuator.cpp
- SCA_PropertyEventManager.cpp
- SCA_PropertySensor.cpp
- SCA_PythonController.cpp
- SCA_PythonJoystick.cpp
- SCA_PythonKeyboard.cpp
- SCA_PythonMouse.cpp
- SCA_RandomActuator.cpp
- SCA_RandomEventManager.cpp
- SCA_RandomNumberGenerator.cpp
- SCA_RandomSensor.cpp
- SCA_TimeEventManager.cpp
- SCA_XNORController.cpp
- SCA_XORController.cpp
- Joystick/SCA_Joystick.cpp
- Joystick/SCA_JoystickEvents.cpp
-
- SCA_2DFilterActuator.h
- SCA_ANDController.h
- SCA_ActuatorEventManager.h
- SCA_ActuatorSensor.h
- SCA_AlwaysEventManager.h
- SCA_AlwaysSensor.h
- SCA_BasicEventManager.h
- SCA_DelaySensor.h
- SCA_EventManager.h
- SCA_ExpressionController.h
- SCA_IActuator.h
- SCA_IController.h
- SCA_IInputDevice.h
- SCA_ILogicBrick.h
- SCA_IObject.h
- SCA_IScene.h
- SCA_ISensor.h
- SCA_JoystickManager.h
- SCA_JoystickSensor.h
- SCA_KeyboardManager.h
- SCA_KeyboardSensor.h
- SCA_LogicManager.h
- SCA_MouseManager.h
- SCA_MouseSensor.h
- SCA_NANDController.h
- SCA_NORController.h
- SCA_ORController.h
- SCA_PropertyActuator.h
- SCA_PropertyEventManager.h
- SCA_PropertySensor.h
- SCA_PythonController.h
- SCA_PythonJoystick.h
- SCA_PythonKeyboard.h
- SCA_PythonMouse.h
- SCA_RandomActuator.h
- SCA_RandomEventManager.h
- SCA_RandomNumberGenerator.h
- SCA_RandomSensor.h
- 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}
- )
-
- add_definitions(-DWITH_SDL)
-
- if(WITH_GHOST_SDL)
- add_definitions(-DWITH_GHOST_SDL)
- endif()
- if(WITH_SDL_DYNLOAD)
- add_definitions(-DWITH_SDL_DYNLOAD)
- endif()
-endif()
-
-blender_add_lib(ge_logic "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
deleted file mode 100644
index 369ec4257cf..00000000000
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): snailrose.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/Joystick/SCA_Joystick.cpp
- * \ingroup gamelogic
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "SCA_Joystick.h"
-#include "SCA_JoystickPrivate.h"
-
-#include "BLI_path_util.h"
-
-#ifdef WITH_SDL
-# ifdef WITH_SDL_DYNLOAD
-# define SDL_CHECK(x) ((x) != (void *)0)
-# else
-# define SDL_CHECK(x) true
-# endif
-#endif
-
-SCA_Joystick::SCA_Joystick(short int index)
- :
- m_joyindex(index),
- m_prec(3200),
- m_axismax(-1),
- m_buttonmax(-1),
- m_hatmax(-1),
- m_isinit(0),
- m_istrig_axis(0),
- m_istrig_button(0),
- m_istrig_hat(0)
-{
- for (int i=0; i < JOYAXIS_MAX; i++)
- m_axis_array[i] = 0;
-
- for (int i=0; i < JOYHAT_MAX; i++)
- m_hat_array[i] = 0;
-
-#ifdef WITH_SDL
- m_private = new PrivateData();
-#endif
-}
-
-
-SCA_Joystick::~SCA_Joystick()
-
-{
-#ifdef WITH_SDL
- delete m_private;
-#endif
-}
-
-SCA_Joystick *SCA_Joystick::m_instance[JOYINDEX_MAX];
-int SCA_Joystick::m_joynum = 0;
-int SCA_Joystick::m_refCount = 0;
-
-SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
-{
-#ifndef WITH_SDL
- return NULL;
-#else /* WITH_SDL */
- if (!SDL_CHECK(SDL_InitSubSystem)) {
- return NULL;
- }
- if (joyindex < 0 || joyindex >= JOYINDEX_MAX) {
- JOYSTICK_ECHO("Error-invalid joystick index: " << joyindex);
- return NULL;
- }
-
- if (m_refCount == 0)
- {
- int i;
-
- /* The video subsystem is required for joystick input to work. However,
- * when GHOST is running under SDL, video is initialized elsewhere. We
- * also need to set the videodriver to dummy, and do it here to avoid
- * interfering with addons that may use SDL too.
- *
- * We also init SDL once only. */
-# ifdef WITH_GHOST_SDL
- int success = (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1 );
-# else
- /* set and restore environment variable */
- char *videodriver = getenv("SDL_VIDEODRIVER");
- BLI_setenv("SDL_VIDEODRIVER", "dummy");
-
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- int success = (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1 );
-#else
- int success = (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) != -1 );
-#endif
-
- BLI_setenv("SDL_VIDEODRIVER", videodriver);
-# endif
-
- if (!success) {
- JOYSTICK_ECHO("Error-Initializing-SDL: " << SDL_GetError());
- return NULL;
- }
-
- m_joynum = SDL_NumJoysticks();
-
- for (i = 0; i < m_joynum; i++) {
- m_instance[i] = new SCA_Joystick(i);
- m_instance[i]->CreateJoystickDevice();
- }
- m_refCount = 1;
- }
- else
- {
- m_refCount++;
- }
- return m_instance[joyindex];
-#endif /* WITH_SDL */
-}
-
-void SCA_Joystick::ReleaseInstance()
-{
- if (--m_refCount == 0)
- {
-#ifdef WITH_SDL
- if (!SDL_CHECK(SDL_QuitSubSystem)) {
- return;
- }
- for (int i = 0; i < m_joynum; i++) {
- if (m_instance[i]) {
- m_instance[i]->DestroyJoystickDevice();
- delete m_instance[i];
- }
- m_instance[i] = NULL;
- }
-
- /* The video subsystem is required for joystick input to work. However,
- * when GHOST is running under SDL, video is freed elsewhere.
- * Do this once only. */
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
-#else
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
-#endif
-#endif /* WITH_SDL */
- }
-}
-
-void SCA_Joystick::cSetPrecision(int val)
-{
- m_prec = val;
-}
-
-
-bool SCA_Joystick::aAxisPairIsPositive(int axis)
-{
- return (pAxisTest(axis) > m_prec) ? true:false;
-}
-
-bool SCA_Joystick::aAxisPairDirectionIsPositive(int axis, int dir)
-{
-
- int res;
-
- if (dir==JOYAXIS_UP || dir==JOYAXIS_DOWN)
- res = pGetAxis(axis, 1);
- else /* JOYAXIS_LEFT || JOYAXIS_RIGHT */
- res = pGetAxis(axis, 0);
-
- if (dir==JOYAXIS_DOWN || dir==JOYAXIS_RIGHT)
- return (res > m_prec) ? true : false;
- else /* JOYAXIS_UP || JOYAXIS_LEFT */
- return (res < -m_prec) ? true : false;
-}
-
-bool SCA_Joystick::aAxisIsPositive(int axis_single)
-{
- return abs(m_axis_array[axis_single]) > m_prec ? true:false;
-}
-
-bool SCA_Joystick::aAnyButtonPressIsPositive(void)
-{
-#ifdef WITH_SDL
- if (!SDL_CHECK(SDL_JoystickGetButton)) {
- return false;
- }
- /* this is needed for the "all events" option
- * so we know if there are no buttons pressed */
- for (int i=0; i<m_buttonmax; i++)
- if (SDL_JoystickGetButton(m_private->m_joystick, i))
- return true;
-#endif
- return false;
-}
-
-bool SCA_Joystick::aButtonPressIsPositive(int button)
-{
-#ifndef WITH_SDL
- return false;
-#else
- bool result;
- result = SDL_CHECK(SDL_JoystickGetButton) && SDL_JoystickGetButton(m_private->m_joystick, button);
- return result;
-#endif
-}
-
-
-bool SCA_Joystick::aButtonReleaseIsPositive(int button)
-{
-#ifndef WITH_SDL
- return false;
-#else
- bool result;
- result = !(SDL_CHECK(SDL_JoystickGetButton) && SDL_JoystickGetButton(m_private->m_joystick, button));
- return result;
-#endif
-}
-
-
-bool SCA_Joystick::aHatIsPositive(int hatnum, int dir)
-{
- return (GetHat(hatnum)==dir) ? true : false;
-}
-
-int SCA_Joystick::GetNumberOfAxes()
-{
- return m_axismax;
-}
-
-
-int SCA_Joystick::GetNumberOfButtons()
-{
- return m_buttonmax;
-}
-
-
-int SCA_Joystick::GetNumberOfHats()
-{
- return m_hatmax;
-}
-
-bool SCA_Joystick::CreateJoystickDevice(void)
-{
-#ifndef WITH_SDL
- m_isinit = true;
- m_axismax = m_buttonmax = m_hatmax = 0;
- return false;
-#else /* WITH_SDL */
- if (m_isinit == false && SDL_CHECK(SDL_JoystickOpen)) {
- if (m_joyindex>=m_joynum) {
- /* don't print a message, because this is done anyway */
- //JOYSTICK_ECHO("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)");
-
- /* Need this so python args can return empty lists */
- m_axismax = m_buttonmax = m_hatmax = 0;
- return false;
- }
-
- m_private->m_joystick = SDL_JoystickOpen(m_joyindex);
- SDL_JoystickEventState(SDL_ENABLE);
- m_isinit = true;
-
- JOYSTICK_ECHO("Joystick " << m_joyindex << " initialized");
-
- /* must run after being initialized */
- m_axismax = SDL_JoystickNumAxes(m_private->m_joystick);
- m_buttonmax = SDL_JoystickNumButtons(m_private->m_joystick);
- m_hatmax = SDL_JoystickNumHats(m_private->m_joystick);
-
- if (m_axismax > JOYAXIS_MAX) m_axismax = JOYAXIS_MAX; /* very unlikely */
- else if (m_axismax < 0) m_axismax = 0;
-
- if (m_hatmax > JOYHAT_MAX) m_hatmax = JOYHAT_MAX; /* very unlikely */
- else if (m_hatmax < 0) m_hatmax = 0;
-
- if (m_buttonmax < 0) m_buttonmax = 0;
-
- }
- return true;
-#endif /* WITH_SDL */
-}
-
-
-void SCA_Joystick::DestroyJoystickDevice(void)
-{
-#ifdef WITH_SDL
- if (m_isinit) {
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- if (SDL_CHECK(SDL_JoystickGetAttached) && SDL_JoystickGetAttached(m_private->m_joystick))
-#else
- if (SDL_CHECK(SDL_JoystickOpened) && SDL_JoystickOpened(m_joyindex))
-#endif
- {
- JOYSTICK_ECHO("Closing-joystick " << m_joyindex);
- SDL_JoystickClose(m_private->m_joystick);
- }
- m_isinit = false;
- }
-#endif /* WITH_SDL */
-}
-
-int SCA_Joystick::Connected(void)
-{
-#ifdef WITH_SDL
- if (m_isinit &&
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- SDL_CHECK(SDL_JoystickGetAttached) && SDL_JoystickGetAttached(m_private->m_joystick)
-#else
- SDL_CHECK(SDL_JoystickOpened) && SDL_JoystickOpened(m_joyindex)
-#endif
- )
- {
- return 1;
- }
-#endif
- return 0;
-}
-
-int SCA_Joystick::pGetAxis(int axisnum, int udlr)
-{
-#ifdef WITH_SDL
- return m_axis_array[(axisnum*2)+udlr];
-#endif
- return 0;
-}
-
-int SCA_Joystick::pAxisTest(int axisnum)
-{
-#ifdef WITH_SDL
- /* Use ints instead of shorts here to avoid problems when we get -32768.
- * When we take the negative of that later, we should get 32768, which is greater
- * than what a short can hold. In other words, abs(MIN_SHORT) > MAX_SHRT. */
- int i1 = m_axis_array[(axisnum * 2)];
- int i2 = m_axis_array[(axisnum * 2) + 1];
-
- /* long winded way to do:
- * return max_ff(absf(i1), absf(i2))
- * ...avoid abs from math.h */
- if (i1 < 0) i1 = -i1;
- if (i2 < 0) i2 = -i2;
- if (i1 <i2) return i2;
- else return i1;
-#else /* WITH_SDL */
- return 0;
-#endif /* WITH_SDL */
-}
-
-const char *SCA_Joystick::GetName()
-{
-#ifdef WITH_SDL
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- return (SDL_CHECK(SDL_JoystickName)) ? SDL_JoystickName(m_private->m_joystick) : "";
-#else
- return (SDL_CHECK(SDL_JoystickName)) ? SDL_JoystickName(m_joyindex) : "";
-#endif
-#else /* WITH_SDL */
- return "";
-#endif /* WITH_SDL */
-}
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h
deleted file mode 100644
index e315f0c01d7..00000000000
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): snailrose.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_Joystick.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_JOYSTICK_H__
-#define __SCA_JOYSTICK_H__
-
-#include "SCA_JoystickDefines.h"
-#ifdef WITH_SDL
-/* SDL force defines __SSE__ and __SSE2__ flags, which generates warnings
- * because we pass those defines via command line as well. For until there's
- * proper ifndef added to SDL headers we ignore the redefinition warning.
- */
-# ifdef _MSC_VER
-# pragma warning(push)
-# pragma warning(disable : 4005)
-# endif
-# include "SDL.h"
-# ifdef _MSC_VER
-# pragma warning(pop)
-# endif
-#endif
-
-/**
- * Basic Joystick class
- * I will make this class a singleton because there should be only one joystick
- * even if there are more than one scene using it and count how many scene are using it.
- * The underlying joystick should only be removed when the last scene is removed
- */
-
-class SCA_Joystick
-
-{
- static SCA_Joystick *m_instance[JOYINDEX_MAX];
- static int m_joynum;
- static int m_refCount;
-
- class PrivateData;
-#ifdef WITH_SDL
- PrivateData *m_private;
-#endif
- int m_joyindex;
-
- /**
- *support for JOYAXIS_MAX axes (in pairs)
- */
- int m_axis_array[JOYAXIS_MAX];
-
- /**
- *support for JOYHAT_MAX hats (each is a direction)
- */
- int m_hat_array[JOYHAT_MAX];
-
- /**
- * Precision or range of the axes
- */
- int m_prec;
-
- /**
- * max # of buttons avail
- */
-
- int m_axismax;
- int m_buttonmax;
- int m_hatmax;
-
- /** is the joystick initialized ?*/
- bool m_isinit;
-
-
- /** is triggered for each event type */
- bool m_istrig_axis;
- bool m_istrig_button;
- bool m_istrig_hat;
-
-#ifdef WITH_SDL
- /**
- * event callbacks
- */
- void OnAxisMotion(SDL_Event *sdl_event);
- void OnHatMotion(SDL_Event *sdl_event);
- void OnButtonUp(SDL_Event *sdl_event);
- void OnButtonDown(SDL_Event *sdl_event);
- void OnNothing(SDL_Event *sdl_event);
-#if 0 /* not used yet */
- void OnBallMotion(SDL_Event *sdl_event) {}
-#endif
-
-#endif /* WITH_SDL */
- /**
- * Open the joystick
- */
- bool CreateJoystickDevice(void);
-
- /**
- * Close the joystick
- */
- void DestroyJoystickDevice(void);
-
- /**
- * fills the axis member values
- */
- void pFillButtons(void);
-
- /**
- * returns m_axis_array
- */
-
- int pAxisTest(int axisnum);
- /**
- * returns m_axis_array
- */
- int pGetAxis(int axisnum, int udlr);
-
- SCA_Joystick(short int index);
-
- ~SCA_Joystick();
-
-public:
-
- static SCA_Joystick *GetInstance(short int joyindex);
- static void HandleEvents(void);
- void ReleaseInstance();
-
-
- /*
- */
- bool aAxisPairIsPositive(int axis);
- bool aAxisPairDirectionIsPositive(int axis, int dir); /* function assumes joysticks are in axis pairs */
- bool aAxisIsPositive(int axis_single); /* check a single axis only */
-
- bool aAnyButtonPressIsPositive(void);
- bool aButtonPressIsPositive(int button);
- bool aButtonReleaseIsPositive(int button);
- bool aHatIsPositive(int hatnum, int dir);
-
- /**
- * precision is default '3200' which is overridden by input
- */
-
- void cSetPrecision(int val);
-
- int GetAxisPosition(int index) {
- return m_axis_array[index];
- }
-
- int GetHat(int index) {
- return m_hat_array[index];
- }
-
- int GetThreshold(void) {
- return m_prec;
- }
-
- bool IsTrigAxis(void) {
- return m_istrig_axis;
- }
-
- bool IsTrigButton(void) {
- return m_istrig_button;
- }
-
- bool IsTrigHat(void) {
- return m_istrig_hat;
- }
-
- /**
- * returns the # of...
- */
-
- int GetNumberOfAxes(void);
- int GetNumberOfButtons(void);
- int GetNumberOfHats(void);
-
- /**
- * Test if the joystick is connected
- */
- int Connected(void);
-
- /**
- * Name of the joytsick
- */
- const char *GetName();
-};
-
-#endif
diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h b/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h
deleted file mode 100644
index 566e5567507..00000000000
--- a/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): snailrose.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_JoystickDefines.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_JOYSTICKDEFINES_H__
-#define __SCA_JOYSTICKDEFINES_H__
-
-#ifdef main
-#undef main
-#endif
-
-#ifndef DEBUG
-# define JOYSTICK_ECHO(x)
-#else
-# include <iostream>
-# define JOYSTICK_ECHO(x) std::cout << x << std::endl;
-#endif
-
-#define JOYINDEX_MAX 8
-#define JOYAXIS_MAX 16
-#define JOYBUT_MAX 18
-#define JOYHAT_MAX 4
-
-#define JOYAXIS_RIGHT 0
-#define JOYAXIS_UP 1
-#define JOYAXIS_DOWN 3
-#define JOYAXIS_LEFT 2
-
-#endif
diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
deleted file mode 100644
index b1ce31662ed..00000000000
--- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): snailrose.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
- * \ingroup gamelogic
- */
-
-#include "SCA_Joystick.h"
-#include "SCA_JoystickPrivate.h"
-
-#ifdef _MSC_VER
-# include <cstdio> /* printf */
-#endif
-
-#ifdef WITH_SDL
-void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event)
-{
- if (sdl_event->jaxis.axis >= JOYAXIS_MAX)
- return;
-
- m_axis_array[sdl_event->jaxis.axis] = sdl_event->jaxis.value;
- m_istrig_axis = 1;
-}
-
-/* See notes below in the event loop */
-void SCA_Joystick::OnHatMotion(SDL_Event* sdl_event)
-{
- if (sdl_event->jhat.hat >= JOYHAT_MAX)
- return;
-
- m_hat_array[sdl_event->jhat.hat] = sdl_event->jhat.value;
- m_istrig_hat = 1;
-}
-
-/* See notes below in the event loop */
-void SCA_Joystick::OnButtonUp(SDL_Event* sdl_event)
-{
- m_istrig_button = 1;
-}
-
-
-void SCA_Joystick::OnButtonDown(SDL_Event* sdl_event)
-{
- //if (sdl_event->jbutton.button > m_buttonmax) /* unsigned int so always above 0 */
- // return;
- // sdl_event->jbutton.button;
-
- m_istrig_button = 1;
-}
-
-
-void SCA_Joystick::OnNothing(SDL_Event* sdl_event)
-{
- m_istrig_axis = m_istrig_button = m_istrig_hat = 0;
-}
-
-void SCA_Joystick::HandleEvents(void)
-{
- SDL_Event sdl_event;
-
-#ifdef WITH_SDL_DYNLOAD
- if (SDL_PollEvent == (void*)0) {
- return;
- }
-#endif
-
- int i;
- for (i=0; i<m_joynum; i++) { /* could use JOYINDEX_MAX but no reason to */
- if (SCA_Joystick::m_instance[i])
- SCA_Joystick::m_instance[i]->OnNothing(&sdl_event);
- }
-
- while (SDL_PollEvent(&sdl_event)) {
- /* Note! m_instance[sdl_event.jaxis.which]
- * will segfault if over JOYINDEX_MAX, not too nice but what are the chances? */
-
- /* Note!, with buttons, this wont care which button is pressed,
- * only to set 'm_istrig_button', actual pressed buttons are detected by SDL_JoystickGetButton */
-
- /* Note!, if you manage to press and release a button within 1 logic tick
- * it wont work as it should */
-
- switch (sdl_event.type) {
- case SDL_JOYAXISMOTION:
- SCA_Joystick::m_instance[sdl_event.jaxis.which]->OnAxisMotion(&sdl_event);
- break;
- case SDL_JOYHATMOTION:
- SCA_Joystick::m_instance[sdl_event.jhat.which]->OnHatMotion(&sdl_event);
- break;
- case SDL_JOYBUTTONUP:
- SCA_Joystick::m_instance[sdl_event.jbutton.which]->OnButtonUp(&sdl_event);
- break;
- case SDL_JOYBUTTONDOWN:
- SCA_Joystick::m_instance[sdl_event.jbutton.which]->OnButtonDown(&sdl_event);
- break;
-#if 0 /* Not used yet */
- case SDL_JOYBALLMOTION:
- SCA_Joystick::m_instance[sdl_event.jball.which]->OnBallMotion(&sdl_event);
- break;
-#endif
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- case SDL_JOYDEVICEADDED:
- case SDL_JOYDEVICEREMOVED:
- /* pass */
- break;
-#endif
- default:
- printf("SCA_Joystick::HandleEvents, Unknown SDL event (%d), this should not happen\n", sdl_event.type);
- break;
- }
- }
-}
-#endif /* WITH_SDL */
diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h b/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h
deleted file mode 100644
index ab42eb57079..00000000000
--- a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): snailrose.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_JoystickPrivate.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_JOYSTICKPRIVATE_H__
-#define __SCA_JOYSTICKPRIVATE_H__
-#include "SCA_Joystick.h"
-
-#ifdef WITH_SDL
-class SCA_Joystick::PrivateData
-{
-public:
- /*
- * The Joystick
- */
- SDL_Joystick* m_joystick;
-
- PrivateData()
- : m_joystick(NULL)
- {
- }
-};
-#endif /* WITH_SDL */
-
-#endif
diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
deleted file mode 100644
index 6a87d3ccb98..00000000000
--- a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * SCA_2DFilterActuator.cpp
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_2DFilterActuator.cpp
- * \ingroup gamelogic
- */
-
-
-#include <stddef.h>
-
-#include "SCA_IActuator.h"
-#include "SCA_2DFilterActuator.h"
-
-#include <iostream>
-
-SCA_2DFilterActuator::~SCA_2DFilterActuator()
-{
-}
-
-SCA_2DFilterActuator::SCA_2DFilterActuator(
- SCA_IObject *gameobj,
- RAS_2DFilterManager::RAS_2DFILTER_MODE type,
- 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_gameobj = NULL;
- if (gameobj) {
- m_propNames = gameobj->GetPropertyNames();
- m_gameobj = gameobj;
- }
-}
-
-
-CValue* SCA_2DFilterActuator::GetReplica()
-{
- SCA_2DFilterActuator* replica = new SCA_2DFilterActuator(*this);
- replica->ProcessReplica();
- return replica;
-}
-
-
-bool SCA_2DFilterActuator::Update()
-{
- bool bNegativeEvent = IsNegativeEvent();
- RemoveAllEvents();
-
-
- if (bNegativeEvent)
- return false; // do nothing on negative events
-
- if ( m_type == RAS_2DFilterManager::RAS_2DFILTER_MOTIONBLUR )
- {
- if (!m_disableMotionBlur)
- m_rasterizer->EnableMotionBlur(m_float_arg);
- else
- m_rasterizer->DisableMotionBlur();
-
- return false;
- }
- 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);
- }
- // once the filter is in place, no need to update it again => disable the actuator
- return false;
-}
-
-
-void SCA_2DFilterActuator::SetScene(SCA_IScene *scene)
-{
- m_scene = scene;
-}
-
-void SCA_2DFilterActuator::SetShaderText(const char *text)
-{
- m_shaderText = text;
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_2DFilterActuator::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_2DFilterActuator",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_IActuator::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_2DFilterActuator::Methods[] = {
- /* add python functions to deal with m_msg... */
- {NULL,NULL}
-};
-
-PyAttributeDef SCA_2DFilterActuator::Attributes[] = {
- KX_PYATTRIBUTE_STRING_RW("shaderText", 0, 64000, false, SCA_2DFilterActuator, m_shaderText),
- KX_PYATTRIBUTE_SHORT_RW("disableMotionBlur", 0, 1, true, SCA_2DFilterActuator, m_disableMotionBlur),
- KX_PYATTRIBUTE_ENUM_RW("mode",RAS_2DFilterManager::RAS_2DFILTER_ENABLED,RAS_2DFilterManager::RAS_2DFILTER_NUMBER_OF_FILTERS,false,SCA_2DFilterActuator,m_type),
- KX_PYATTRIBUTE_INT_RW("passNumber", 0, 100, true, SCA_2DFilterActuator, m_int_arg),
- KX_PYATTRIBUTE_FLOAT_RW("value", 0.0, 100.0, SCA_2DFilterActuator, m_float_arg),
- { NULL } //Sentinel
-};
-
-#endif
diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.h b/source/gameengine/GameLogic/SCA_2DFilterActuator.h
deleted file mode 100644
index 4635a8ad9f8..00000000000
--- a/source/gameengine/GameLogic/SCA_2DFilterActuator.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SCA_2DFilterActuator.h
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_2DFilterActuator.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_2DFILTERACTUATOR_H__
-#define __SCA_2DFILTERACTUATOR_H__
-
-#include "RAS_IRasterizer.h"
-#include "SCA_IActuator.h"
-#include "SCA_IScene.h"
-
-class SCA_2DFilterActuator : public SCA_IActuator
-{
- Py_Header
-
-private:
- vector<STR_String> m_propNames;
- RAS_2DFilterManager::RAS_2DFILTER_MODE m_type;
- short m_disableMotionBlur;
- float m_float_arg;
- int m_int_arg;
- STR_String m_shaderText;
- RAS_IRasterizer* m_rasterizer;
- SCA_IScene* m_scene;
-
-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);
-
- void SetShaderText(const char *text);
- virtual ~SCA_2DFilterActuator();
- virtual bool Update();
-
- void SetScene(SCA_IScene *scene);
-
- virtual CValue* GetReplica();
-};
-#endif
diff --git a/source/gameengine/GameLogic/SCA_ANDController.cpp b/source/gameengine/GameLogic/SCA_ANDController.cpp
deleted file mode 100644
index 26380105e91..00000000000
--- a/source/gameengine/GameLogic/SCA_ANDController.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 'And' together all inputs
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_ANDController.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_ANDController.h"
-#include "SCA_ISensor.h"
-#include "SCA_LogicManager.h"
-#include "EXP_BoolValue.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_ANDController::SCA_ANDController(SCA_IObject* gameobj)
- :
- SCA_IController(gameobj)
-{
-}
-
-
-
-SCA_ANDController::~SCA_ANDController()
-{
-}
-
-
-
-void SCA_ANDController::Trigger(SCA_LogicManager* logicmgr)
-{
-
- bool sensorresult = true;
-
- for (vector<SCA_ISensor*>::const_iterator is=m_linkedsensors.begin();
- !(is==m_linkedsensors.end());is++)
- {
- SCA_ISensor* sensor = *is;
- if (!sensor->GetState())
- {
- sensorresult = false;
- break;
- }
- }
-
- for (vector<SCA_IActuator*>::const_iterator i=m_linkedactuators.begin();
- !(i==m_linkedactuators.end());i++)
- {
- SCA_IActuator* actua = *i;
- logicmgr->AddActiveActuator(actua,sensorresult);
- }
-}
-
-
-
-CValue* SCA_ANDController::GetReplica()
-{
- CValue* replica = new SCA_ANDController(*this);
- // this will copy properties and so on...
- replica->ProcessReplica();
-
- return replica;
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_ANDController::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_ANDController",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_IController::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_ANDController::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_ANDController::Attributes[] = {
- { NULL } //Sentinel
-};
-#endif // WITH_PYTHON
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_ANDController.h b/source/gameengine/GameLogic/SCA_ANDController.h
deleted file mode 100644
index ff152d6d2fb..00000000000
--- a/source/gameengine/GameLogic/SCA_ANDController.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SCA_ANDController.h
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_ANDController.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_ANDCONTROLLER_H__
-#define __SCA_ANDCONTROLLER_H__
-
-#include "SCA_IController.h"
-
-class SCA_ANDController : public SCA_IController
-{
- Py_Header
- //virtual void Trigger(class SCA_LogicManager* logicmgr);
-public:
- SCA_ANDController(SCA_IObject* gameobj);
- virtual ~SCA_ANDController();
- virtual CValue* GetReplica();
- virtual void Trigger(SCA_LogicManager* logicmgr);
-};
-
-#endif /* __SCA_ANDCONTROLLER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp b/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp
deleted file mode 100644
index fcb236f0913..00000000000
--- a/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_ActuatorEventManager.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_ISensor.h"
-#include "SCA_ActuatorEventManager.h"
-#include "SCA_ActuatorSensor.h"
-
-
-SCA_ActuatorEventManager::SCA_ActuatorEventManager(class SCA_LogicManager* logicmgr)
- : SCA_EventManager(logicmgr, ACTUATOR_EVENTMGR)
-{
-}
-
-
-
-SCA_ActuatorEventManager::~SCA_ActuatorEventManager()
-{
-
-}
-
-void SCA_ActuatorEventManager::NextFrame()
-{
- // check for changed actuator
- SG_DList::iterator<SCA_ISensor> it(m_sensors);
- for (it.begin();!it.end();++it)
- {
- (*it)->Activate(m_logicmgr);
- }
-}
-
-void SCA_ActuatorEventManager::UpdateFrame()
-{
- // update the state of actuator before executing them
- SG_DList::iterator<SCA_ActuatorSensor> it(m_sensors);
- for (it.begin();!it.end();++it)
- {
- (*it)->Update();
- }
-}
diff --git a/source/gameengine/GameLogic/SCA_ActuatorEventManager.h b/source/gameengine/GameLogic/SCA_ActuatorEventManager.h
deleted file mode 100644
index 997be1145db..00000000000
--- a/source/gameengine/GameLogic/SCA_ActuatorEventManager.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_ActuatorEventManager.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_ACTUATOREVENTMANAGER_H__
-#define __SCA_ACTUATOREVENTMANAGER_H__
-
-#include "SCA_EventManager.h"
-
-#include <vector>
-
-using namespace std;
-
-class SCA_ActuatorEventManager : public SCA_EventManager
-{
-public:
- SCA_ActuatorEventManager(class SCA_LogicManager* logicmgr);
- virtual ~SCA_ActuatorEventManager();
- virtual void NextFrame();
- virtual void UpdateFrame();
- //SCA_LogicManager* GetLogicManager() { return m_logicmgr;}
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_ActuatorEventManager")
-#endif
-};
-
-#endif /* __SCA_ACTUATOREVENTMANAGER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
deleted file mode 100644
index 03c142e8c14..00000000000
--- a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Actuator sensor
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_ActuatorSensor.cpp
- * \ingroup gamelogic
- */
-
-
-#include <stddef.h>
-
-#include <iostream>
-#include "SCA_ActuatorSensor.h"
-#include "SCA_EventManager.h"
-#include "SCA_LogicManager.h"
-
-SCA_ActuatorSensor::SCA_ActuatorSensor(SCA_EventManager* eventmgr,
- SCA_IObject* gameobj,
- const STR_String& actname)
- : SCA_ISensor(gameobj,eventmgr),
- m_checkactname(actname)
-{
- m_actuator = GetParent()->FindActuator(m_checkactname);
- Init();
-}
-
-void SCA_ActuatorSensor::Init()
-{
- m_lastresult = m_invert?true:false;
- m_midresult = m_lastresult;
- m_reset = true;
-}
-
-CValue* SCA_ActuatorSensor::GetReplica()
-{
- SCA_ActuatorSensor* replica = new SCA_ActuatorSensor(*this);
- // m_range_expr must be recalculated on replica!
- replica->ProcessReplica();
- replica->Init();
-
- return replica;
-}
-
-void SCA_ActuatorSensor::ReParent(SCA_IObject* parent)
-{
- m_actuator = parent->FindActuator(m_checkactname);
- SCA_ISensor::ReParent(parent);
-}
-
-bool SCA_ActuatorSensor::IsPositiveTrigger()
-{
- bool result = m_lastresult;
- if (m_invert)
- result = !result;
-
- return result;
-}
-
-
-
-SCA_ActuatorSensor::~SCA_ActuatorSensor()
-{
-}
-
-
-
-bool SCA_ActuatorSensor::Evaluate()
-{
- if (m_actuator)
- {
- bool result = m_actuator->IsActive();
- bool reset = m_reset && m_level;
-
- m_reset = false;
- if (m_lastresult != result || m_midresult != result)
- {
- m_lastresult = m_midresult = result;
- return true;
- }
- return (reset) ? true : false;
- }
- return false;
-}
-
-void SCA_ActuatorSensor::Update()
-{
- if (m_actuator)
- {
- m_midresult = m_actuator->IsActive() && !m_actuator->IsNegativeEvent();
- }
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_ActuatorSensor::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_ActuatorSensor",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_ISensor::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_ActuatorSensor::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_ActuatorSensor::Attributes[] = {
- KX_PYATTRIBUTE_STRING_RW_CHECK("actuator",0,MAX_PROP_NAME,false,SCA_ActuatorSensor,m_checkactname,CheckActuator),
- { NULL } //Sentinel
-};
-
-int SCA_ActuatorSensor::CheckActuator(void *self, const PyAttributeDef*)
-{
- SCA_ActuatorSensor* sensor = reinterpret_cast<SCA_ActuatorSensor*>(self);
- SCA_IActuator* act = sensor->GetParent()->FindActuator(sensor->m_checkactname);
- if (act) {
- sensor->m_actuator = act;
- return 0;
- }
- PyErr_SetString(PyExc_AttributeError, "string does not correspond to an actuator");
- return 1;
-}
-
-#endif // WITH_PYTHON
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.h b/source/gameengine/GameLogic/SCA_ActuatorSensor.h
deleted file mode 100644
index f728dc5c0ca..00000000000
--- a/source/gameengine/GameLogic/SCA_ActuatorSensor.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef __SCA_ACTUATORSENSOR_H__
-#define __SCA_ACTUATORSENSOR_H__
-
-/** \file SCA_ActuatorSensor.h
- * \ingroup gamelogic
- */
-
-#include "SCA_ISensor.h"
-#include "SCA_IActuator.h"
-
-class SCA_ActuatorSensor : public SCA_ISensor
-{
- Py_Header
- STR_String m_checkactname;
- bool m_lastresult;
- bool m_midresult;
- protected:
- SCA_IActuator* m_actuator;
-public:
- SCA_ActuatorSensor(class SCA_EventManager* eventmgr,
- SCA_IObject* gameobj,
- const STR_String& actname);
-
- virtual ~SCA_ActuatorSensor();
- virtual CValue* GetReplica();
- virtual void Init();
- virtual bool Evaluate();
- virtual bool IsPositiveTrigger();
- virtual void ReParent(SCA_IObject* parent);
- void Update();
-
-#ifdef WITH_PYTHON
-
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-
- static int CheckActuator(void *self, const PyAttributeDef*);
-
-#endif /* WITH_PYTHON */
-};
-
-#endif /* __SCA_ACTUATORSENSOR_H__ */
diff --git a/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp b/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp
deleted file mode 100644
index 284bd3da853..00000000000
--- a/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Manager for 'always' events. Since always sensors can operate in pulse
- * mode, they need to be activated.
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_AlwaysEventManager.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_AlwaysEventManager.h"
-#include "SCA_LogicManager.h"
-#include <vector>
-#include "SCA_ISensor.h"
-
-using namespace std;
-
-SCA_AlwaysEventManager::SCA_AlwaysEventManager(class SCA_LogicManager* logicmgr)
- : SCA_EventManager(logicmgr, ALWAYS_EVENTMGR)
-{
-}
-
-
-
-void SCA_AlwaysEventManager::NextFrame()
-{
- SG_DList::iterator<SCA_ISensor> it(m_sensors);
- for (it.begin();!it.end();++it)
- {
- (*it)->Activate(m_logicmgr);
- }
-}
diff --git a/source/gameengine/GameLogic/SCA_AlwaysEventManager.h b/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
deleted file mode 100644
index 47293c75726..00000000000
--- a/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_AlwaysEventManager.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_ALWAYSEVENTMANAGER_H__
-#define __SCA_ALWAYSEVENTMANAGER_H__
-#include "SCA_EventManager.h"
-#include <vector>
-
-using namespace std;
-class SCA_AlwaysEventManager : public SCA_EventManager
-{
-public:
- SCA_AlwaysEventManager(class SCA_LogicManager* logicmgr);
- virtual void NextFrame();
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_AlwaysEventManager")
-#endif
-};
-
-#endif /* __SCA_ALWAYSEVENTMANAGER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
deleted file mode 100644
index 28f8b2123e1..00000000000
--- a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Always trigger
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_AlwaysSensor.cpp
- * \ingroup gamelogic
- */
-
-#ifdef _MSC_VER
- /* This warning tells us about truncation of __long__ stl-generated names.
- * It can occasionally cause DevStudio to have internal compiler warnings. */
-# pragma warning( disable:4786 )
-#endif
-
-#include "SCA_AlwaysSensor.h"
-#include "SCA_LogicManager.h"
-#include "SCA_EventManager.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_AlwaysSensor::SCA_AlwaysSensor(class SCA_EventManager* eventmgr,
- SCA_IObject* gameobj)
- : SCA_ISensor(gameobj,eventmgr)
-{
- //SetDrawColor(255,0,0);
- Init();
-}
-
-void SCA_AlwaysSensor::Init()
-{
- m_alwaysresult = true;
-}
-
-SCA_AlwaysSensor::~SCA_AlwaysSensor()
-{
- /* intentionally empty */
-}
-
-
-
-CValue* SCA_AlwaysSensor::GetReplica()
-{
- CValue* replica = new SCA_AlwaysSensor(*this);//m_float,GetName());
- // this will copy properties and so on...
- replica->ProcessReplica();
-
- return replica;
-}
-
-
-
-bool SCA_AlwaysSensor::IsPositiveTrigger()
-{
- return (m_invert ? false : true);
-}
-
-
-
-bool SCA_AlwaysSensor::Evaluate()
-{
- /* Nice! :) */
- //return true;
- /* even nicer ;) */
- //return false;
-
- /* nicest ! */
- bool result = m_alwaysresult;
- m_alwaysresult = false;
- return result;
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_AlwaysSensor::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_AlwaysSensor",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_ISensor::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_AlwaysSensor::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_AlwaysSensor::Attributes[] = {
- { NULL } //Sentinel
-};
-
-#endif
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_AlwaysSensor.h b/source/gameengine/GameLogic/SCA_AlwaysSensor.h
deleted file mode 100644
index e0ab4279b1c..00000000000
--- a/source/gameengine/GameLogic/SCA_AlwaysSensor.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SCA_AlwaysSensor.h
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_AlwaysSensor.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_ALWAYSSENSOR_H__
-#define __SCA_ALWAYSSENSOR_H__
-#include "SCA_ISensor.h"
-
-class SCA_AlwaysSensor : public SCA_ISensor
-{
- Py_Header
- bool m_alwaysresult;
-public:
- SCA_AlwaysSensor(class SCA_EventManager* eventmgr,
- SCA_IObject* gameobj);
- virtual ~SCA_AlwaysSensor();
- virtual CValue* GetReplica();
- virtual bool Evaluate();
- virtual bool IsPositiveTrigger();
- virtual void Init();
-};
-
-#endif /* __SCA_ALWAYSSENSOR_H__ */
diff --git a/source/gameengine/GameLogic/SCA_BasicEventManager.cpp b/source/gameengine/GameLogic/SCA_BasicEventManager.cpp
deleted file mode 100644
index 9cf65fdd126..00000000000
--- a/source/gameengine/GameLogic/SCA_BasicEventManager.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Manager for 'always' events. Since always sensors can operate in pulse
- * mode, they need to be activated.
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_BasicEventManager.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_BasicEventManager.h"
-#include "SCA_LogicManager.h"
-#include <vector>
-#include "SCA_ISensor.h"
-
-using namespace std;
-
-SCA_BasicEventManager::SCA_BasicEventManager(class SCA_LogicManager* logicmgr)
- : SCA_EventManager(logicmgr, BASIC_EVENTMGR)
-{
-}
-
-SCA_BasicEventManager::~SCA_BasicEventManager()
-{
-}
-
-void SCA_BasicEventManager::NextFrame()
-{
- SG_DList::iterator<SCA_ISensor> it(m_sensors);
- for (it.begin();!it.end();++it)
- {
- (*it)->Activate(m_logicmgr);
- }
-}
diff --git a/source/gameengine/GameLogic/SCA_BasicEventManager.h b/source/gameengine/GameLogic/SCA_BasicEventManager.h
deleted file mode 100644
index a015233454b..00000000000
--- a/source/gameengine/GameLogic/SCA_BasicEventManager.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Manager for sensor that only need to call Update
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_BasicEventManager.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_BASICEVENTMANAGER_H__
-#define __SCA_BASICEVENTMANAGER_H__
-
-#include "SCA_EventManager.h"
-#include <vector>
-
-using namespace std;
-
-class SCA_BasicEventManager : public SCA_EventManager
-{
-public:
- SCA_BasicEventManager(class SCA_LogicManager* logicmgr);
- ~SCA_BasicEventManager();
-
- virtual void NextFrame();
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_BasicEventManager")
-#endif
-};
-
-#endif /* __SCA_BASICEVENTMANAGER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.cpp b/source/gameengine/GameLogic/SCA_DelaySensor.cpp
deleted file mode 100644
index 5222d1961af..00000000000
--- a/source/gameengine/GameLogic/SCA_DelaySensor.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Delay trigger
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_DelaySensor.cpp
- * \ingroup gamelogic
- */
-
-#ifdef _MSC_VER
- /* This warning tells us about truncation of __long__ stl-generated names.
- * It can occasionally cause DevStudio to have internal compiler warnings. */
-# pragma warning( disable:4786 )
-#endif
-
-#include <stddef.h>
-
-#include "SCA_DelaySensor.h"
-#include "SCA_LogicManager.h"
-#include "SCA_EventManager.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_DelaySensor::SCA_DelaySensor(class SCA_EventManager* eventmgr,
- SCA_IObject* gameobj,
- int delay,
- int duration,
- bool repeat)
- : SCA_ISensor(gameobj,eventmgr),
- m_repeat(repeat),
- m_delay(delay),
- m_duration(duration)
-{
- Init();
-}
-
-void SCA_DelaySensor::Init()
-{
- m_lastResult = false;
- m_frameCount = -1;
- m_reset = true;
-}
-
-SCA_DelaySensor::~SCA_DelaySensor()
-{
- /* intentionally empty */
-}
-
-CValue* SCA_DelaySensor::GetReplica()
-{
- CValue* replica = new SCA_DelaySensor(*this);
- // this will copy properties and so on...
- replica->ProcessReplica();
-
- return replica;
-}
-
-
-
-bool SCA_DelaySensor::IsPositiveTrigger()
-{
- return (m_invert ? !m_lastResult : m_lastResult);
-}
-
-bool SCA_DelaySensor::Evaluate()
-{
- bool trigger = false;
- bool result;
-
- if (m_frameCount==-1) {
- // this is needed to ensure ON trigger in case delay==0
- // and avoid spurious OFF trigger when duration==0
- m_lastResult = false;
- m_frameCount = 0;
- }
-
- if (m_frameCount<m_delay) {
- m_frameCount++;
- result = false;
- } else if (m_duration > 0) {
- if (m_frameCount < m_delay+m_duration) {
- m_frameCount++;
- result = true;
- } else {
- result = false;
- if (m_repeat)
- m_frameCount = -1;
- }
- } else {
- result = true;
- if (m_repeat)
- m_frameCount = -1;
- }
- if ((m_reset && m_level) || result != m_lastResult)
- trigger = true;
- m_reset = false;
- m_lastResult = result;
- return trigger;
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_DelaySensor::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_DelaySensor",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_ISensor::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_DelaySensor::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_DelaySensor::Attributes[] = {
- KX_PYATTRIBUTE_INT_RW("delay",0,100000,true,SCA_DelaySensor,m_delay),
- KX_PYATTRIBUTE_INT_RW("duration",0,100000,true,SCA_DelaySensor,m_duration),
- KX_PYATTRIBUTE_BOOL_RW("repeat",SCA_DelaySensor,m_repeat),
- { NULL } //Sentinel
-};
-
-#endif // WITH_PYTHON
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.h b/source/gameengine/GameLogic/SCA_DelaySensor.h
deleted file mode 100644
index 0544bfef8c4..00000000000
--- a/source/gameengine/GameLogic/SCA_DelaySensor.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * SCA_DelaySensor.h
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_DelaySensor.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_DELAYSENSOR_H__
-#define __SCA_DELAYSENSOR_H__
-#include "SCA_ISensor.h"
-
-class SCA_DelaySensor : public SCA_ISensor
-{
- Py_Header
- bool m_lastResult;
- bool m_repeat;
- int m_delay;
- int m_duration;
- int m_frameCount;
-
-public:
- SCA_DelaySensor(class SCA_EventManager* eventmgr,
- SCA_IObject* gameobj,
- int delay,
- int duration,
- bool repeat);
- virtual ~SCA_DelaySensor();
- virtual CValue* GetReplica();
- virtual bool Evaluate();
- virtual bool IsPositiveTrigger();
- virtual void Init();
-
-
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-};
-
-#endif /* __SCA_DELAYSENSOR_H__ */
diff --git a/source/gameengine/GameLogic/SCA_EventManager.cpp b/source/gameengine/GameLogic/SCA_EventManager.cpp
deleted file mode 100644
index ffe1ea2dc30..00000000000
--- a/source/gameengine/GameLogic/SCA_EventManager.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_EventManager.cpp
- * \ingroup gamelogic
- */
-
-
-#include <assert.h>
-#include "SCA_EventManager.h"
-#include "SCA_ISensor.h"
-
-
-SCA_EventManager::SCA_EventManager(SCA_LogicManager* logicmgr, EVENT_MANAGER_TYPE mgrtype)
- :m_logicmgr(logicmgr),
- m_mgrtype(mgrtype)
-{
-}
-
-
-
-SCA_EventManager::~SCA_EventManager()
-{
- // all sensors should be removed
- assert(m_sensors.Empty());
-}
-
-void SCA_EventManager::RegisterSensor(class SCA_ISensor* sensor)
-{
- m_sensors.AddBack(sensor);
-}
-
-void SCA_EventManager::RemoveSensor(class SCA_ISensor* sensor)
-{
- sensor->Delink();
-}
-
-void SCA_EventManager::NextFrame(double curtime, double fixedtime)
-{
- NextFrame();
-}
-
-void SCA_EventManager::NextFrame()
-{
- assert(false); // && "Event managers should override a NextFrame method");
-}
-
-void SCA_EventManager::EndFrame()
-{
-}
-
-void SCA_EventManager::UpdateFrame()
-{
-}
-
-int SCA_EventManager::GetType()
-{
- return (int) m_mgrtype;
-}
diff --git a/source/gameengine/GameLogic/SCA_EventManager.h b/source/gameengine/GameLogic/SCA_EventManager.h
deleted file mode 100644
index 845a8c4c4ac..00000000000
--- a/source/gameengine/GameLogic/SCA_EventManager.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_EventManager.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_EVENTMANAGER_H__
-#define __SCA_EVENTMANAGER_H__
-
-#include <vector>
-#include <set>
-#include <algorithm>
-
-#include "SG_DList.h"
-
-class SCA_EventManager
-{
-protected:
- class SCA_LogicManager* m_logicmgr; /* all event manager subclasses use this (other then TimeEventManager) */
-
- // use a set to speed-up insertion/removal
- //std::set <class SCA_ISensor*> m_sensors;
- SG_DList m_sensors;
-
-public:
- enum EVENT_MANAGER_TYPE {
- KEYBOARD_EVENTMGR = 0,
- MOUSE_EVENTMGR,
- ALWAYS_EVENTMGR,
- TOUCH_EVENTMGR,
- PROPERTY_EVENTMGR,
- TIME_EVENTMGR,
- RANDOM_EVENTMGR,
- RAY_EVENTMGR,
- NETWORK_EVENTMGR,
- JOY_EVENTMGR,
- ACTUATOR_EVENTMGR,
- BASIC_EVENTMGR
- };
-
- SCA_EventManager(SCA_LogicManager* logicmgr, EVENT_MANAGER_TYPE mgrtype);
- virtual ~SCA_EventManager();
-
- virtual void RemoveSensor(class SCA_ISensor* sensor);
- virtual void NextFrame(double curtime, double fixedtime);
- virtual void NextFrame();
- virtual void UpdateFrame();
- 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; }
-
-protected:
- EVENT_MANAGER_TYPE m_mgrtype;
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_EventManager")
-#endif
-};
-
-#endif
diff --git a/source/gameengine/GameLogic/SCA_ExpressionController.cpp b/source/gameengine/GameLogic/SCA_ExpressionController.cpp
deleted file mode 100644
index ef058e215d6..00000000000
--- a/source/gameengine/GameLogic/SCA_ExpressionController.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * 'Expression Controller enables to calculate an expression that wires inputs to output
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_ExpressionController.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_ExpressionController.h"
-#include "SCA_ISensor.h"
-#include "SCA_LogicManager.h"
-#include "EXP_BoolValue.h"
-#include "EXP_InputParser.h"
-#include "MT_Transform.h" // for fuzzyZero
-
-#include <stdio.h>
-
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_ExpressionController::SCA_ExpressionController(SCA_IObject* gameobj,
- const STR_String& exprtext)
- :SCA_IController(gameobj),
- m_exprText(exprtext),
- m_exprCache(NULL)
-{
-}
-
-
-
-SCA_ExpressionController::~SCA_ExpressionController()
-{
- if (m_exprCache)
- m_exprCache->Release();
-}
-
-
-
-CValue* SCA_ExpressionController::GetReplica()
-{
- SCA_ExpressionController* replica = new SCA_ExpressionController(*this);
- replica->m_exprText = m_exprText;
- replica->m_exprCache = NULL;
- // this will copy properties and so on...
- replica->ProcessReplica();
-
- return replica;
-}
-
-
-// Forced deletion of precalculated expression to break reference loop
-// Use this function when you know that you won't use the sensor anymore
-void SCA_ExpressionController::Delete()
-{
- if (m_exprCache)
- {
- m_exprCache->Release();
- m_exprCache = NULL;
- }
- Release();
-}
-
-
-void SCA_ExpressionController::Trigger(SCA_LogicManager* logicmgr)
-{
-
- bool expressionresult = false;
- if (!m_exprCache)
- {
- CParser parser;
- parser.SetContext(this->AddRef());
- m_exprCache = parser.ProcessText(m_exprText);
- }
- if (m_exprCache)
- {
- CValue* value = m_exprCache->Calculate();
- if (value)
- {
- if (value->IsError())
- {
- printf("%s\n", value->GetText().ReadPtr());
- } else
- {
- float num = (float)value->GetNumber();
- expressionresult = !MT_fuzzyZero(num);
- }
- value->Release();
-
- }
- }
-
- for (vector<SCA_IActuator*>::const_iterator i=m_linkedactuators.begin();
- !(i==m_linkedactuators.end());i++)
- {
- SCA_IActuator* actua = *i;
- logicmgr->AddActiveActuator(actua,expressionresult);
- }
-}
-
-
-
-CValue* SCA_ExpressionController::FindIdentifier(const STR_String& identifiername)
-{
-
- CValue* identifierval = NULL;
-
- for (vector<SCA_ISensor*>::const_iterator is=m_linkedsensors.begin();
- !(is==m_linkedsensors.end());is++)
- {
- SCA_ISensor* sensor = *is;
- if (sensor->GetName() == identifiername)
- {
- identifierval = new CBoolValue(sensor->GetState());
- //identifierval = sensor->AddRef();
- break;
- }
-
- //if (!sensor->IsPositiveTrigger())
- //{
- // sensorresult = false;
- // break;
- //}
- }
-
- if (identifierval)
- return identifierval;
-
- return GetParent()->FindIdentifier(identifiername);
-
-}
diff --git a/source/gameengine/GameLogic/SCA_ExpressionController.h b/source/gameengine/GameLogic/SCA_ExpressionController.h
deleted file mode 100644
index 993b3b67a96..00000000000
--- a/source/gameengine/GameLogic/SCA_ExpressionController.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * KX_EXPRESSIONController.h
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_ExpressionController.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_EXPRESSIONCONTROLLER_H__
-#define __SCA_EXPRESSIONCONTROLLER_H__
-
-#include "SCA_IController.h"
-
-class SCA_ExpressionController : public SCA_IController
-{
-// Py_Header
- STR_String m_exprText;
- CExpression* m_exprCache;
-
-public:
- SCA_ExpressionController(SCA_IObject* gameobj,
- const STR_String& exprtext);
-
- virtual ~SCA_ExpressionController();
- virtual CValue* GetReplica();
- virtual void Trigger(SCA_LogicManager* logicmgr);
- virtual CValue* FindIdentifier(const STR_String& identifiername);
- /**
- * used to release the expression cache
- * so that self references are removed before the controller itself is released
- */
- virtual void Delete();
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_ExpressionController")
-#endif
-};
-
-#endif /* __SCA_EXPRESSIONCONTROLLER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_IActuator.cpp b/source/gameengine/GameLogic/SCA_IActuator.cpp
deleted file mode 100644
index b86a863ba42..00000000000
--- a/source/gameengine/GameLogic/SCA_IActuator.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_IActuator.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_IActuator.h"
-#include <stdio.h>
-
-using namespace std;
-
-SCA_IActuator::SCA_IActuator(SCA_IObject* gameobj, KX_ACTUATOR_TYPE type) :
- SCA_ILogicBrick(gameobj),
- m_type(type),
- m_links(0),
- m_posevent(false),
- m_negevent(false)
-{
- // nothing to do
-}
-
-bool SCA_IActuator::Update(double curtime, bool frame)
-{
- if (frame)
- return Update();
-
- return true;
-}
-
-bool SCA_IActuator::Update()
-{
- assert(false && "Actuators should override an Update method.");
- return false;
-}
-
-void SCA_IActuator::Activate(SG_DList& head)
-{
- if (QEmpty())
- {
- InsertActiveQList(m_gameobj->m_activeActuators);
- head.AddBack(&m_gameobj->m_activeActuators);
- }
-}
-
-// this function is only used to deactivate actuators outside the logic loop
-// e.g. when an object is deleted.
-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();
- RemoveAllEvents();
- m_linkedcontrollers.clear();
-}
-
-
-
-SCA_IActuator::~SCA_IActuator()
-{
- RemoveAllEvents();
-}
-
-void SCA_IActuator::DecLink()
-{
- m_links--;
- if (m_links < 0)
- {
- printf("Warning: actuator %s has negative m_links: %d\n", m_name.Ptr(), m_links);
- m_links = 0;
- }
-}
-
-void SCA_IActuator::LinkToController(SCA_IController* controller)
-{
- m_linkedcontrollers.push_back(controller);
-}
-
-void SCA_IActuator::UnlinkController(SCA_IController* controller)
-{
- std::vector<class SCA_IController*>::iterator contit;
- for (contit = m_linkedcontrollers.begin();!(contit==m_linkedcontrollers.end());++contit)
- {
- if ((*contit) == controller)
- {
- *contit = m_linkedcontrollers.back();
- m_linkedcontrollers.pop_back();
- return;
- }
- }
- printf("Missing link from actuator %s:%s to controller %s:%s\n",
- m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(),
- controller->GetParent()->GetName().ReadPtr(), controller->GetName().ReadPtr());
-}
-
-void SCA_IActuator::UnlinkAllControllers()
-{
- std::vector<class SCA_IController*>::iterator contit;
- for (contit = m_linkedcontrollers.begin();!(contit==m_linkedcontrollers.end());++contit)
- {
- (*contit)->UnlinkActuator(this);
- }
- m_linkedcontrollers.clear();
-}
diff --git a/source/gameengine/GameLogic/SCA_IActuator.h b/source/gameengine/GameLogic/SCA_IActuator.h
deleted file mode 100644
index bca0b1ad764..00000000000
--- a/source/gameengine/GameLogic/SCA_IActuator.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_IActuator.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_IACTUATOR_H__
-#define __SCA_IACTUATOR_H__
-
-#include "SCA_IController.h"
-#include <vector>
-
-/**
- * Use of SG_DList : None
- * Use of SG_QList : element of activated actuator list of their owner
- * Head: SCA_IObject::m_activeActuators
- */
-class SCA_IActuator : public SCA_ILogicBrick
-{
- friend class SCA_LogicManager;
-protected:
- int m_type;
- int m_links; // number of active links to controllers
- // when 0, the actuator is automatically stopped
- //std::vector<CValue*> m_events;
- bool m_posevent;
- bool m_negevent;
-
- std::vector<class SCA_IController*> m_linkedcontrollers;
-
- void RemoveAllEvents()
- {
- m_posevent = false;
- m_negevent = false;
- }
-
-
-public:
- /**
- * This class also inherits the default copy constructors
- */
- enum KX_ACTUATOR_TYPE {
- KX_ACT_OBJECT,
- KX_ACT_IPO,
- KX_ACT_CAMERA,
- KX_ACT_SOUND,
- KX_ACT_PROPERTY,
- KX_ACT_ADD_OBJECT,
- KX_ACT_END_OBJECT,
- KX_ACT_DYNAMIC,
- KX_ACT_REPLACE_MESH,
- KX_ACT_TRACKTO,
- KX_ACT_CONSTRAINT,
- KX_ACT_SCENE,
- KX_ACT_RANDOM,
- KX_ACT_MESSAGE,
- KX_ACT_ACTION,
- KX_ACT_CD,
- KX_ACT_GAME,
- KX_ACT_VISIBILITY,
- KX_ACT_2DFILTER,
- KX_ACT_PARENT,
- KX_ACT_SHAPEACTION,
- KX_ACT_STATE,
- KX_ACT_ARMATURE,
- KX_ACT_STEERING,
- KX_ACT_MOUSE,
- };
-
- SCA_IActuator(SCA_IObject* gameobj, KX_ACTUATOR_TYPE type);
-
- /**
- * UnlinkObject(...)
- * Certain actuator use gameobject pointers (like TractTo actuator)
- * This function can be called when an object is removed to make
- * sure that the actuator will not use it anymore.
- */
-
- virtual bool UnlinkObject(SCA_IObject* clientobj) { return false; }
-
- /**
- * Update(...)
- * Update the actuator based upon the events received since
- * the last call to Update, the current time and deltatime the
- * time elapsed in this frame ?
- * It is the responsibility of concrete Actuators to clear
- * their event's. This is usually done in the Update() method via
- * a call to RemoveAllEvents()
- */
-
-
- virtual bool Update(double curtime, bool frame);
- virtual bool Update();
-
- /**
- * Add an event to an actuator.
- */
- //void AddEvent(CValue* event)
- void AddEvent(bool event)
- {
- if (event)
- m_posevent = true;
- else
- m_negevent = true;
- }
-
- virtual void ProcessReplica();
-
- /**
- * Return true if all the current events
- * are negative. The definition of negative event is
- * not immediately clear. But usually refers to key-up events
- * or events where no action is required.
- */
- bool IsNegativeEvent() const
- {
- return !m_posevent && m_negevent;
- }
-
- virtual ~SCA_IActuator();
-
- /**
- * remove this actuator from the list of active actuators
- */
- virtual void Deactivate();
- virtual void Activate(SG_DList& head);
-
- void LinkToController(SCA_IController* controller);
- void UnlinkController(class SCA_IController* cont);
- void UnlinkAllControllers();
-
- void ClrLink() { m_links=0; }
- void IncLink() { m_links++; }
- virtual void DecLink();
- bool IsNoLink() const { return !m_links; }
- bool IsType(KX_ACTUATOR_TYPE type) { return m_type == type; }
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_IActuator")
-#endif
-};
-
-#endif /* __SCA_IACTUATOR_H__ */
diff --git a/source/gameengine/GameLogic/SCA_IController.cpp b/source/gameengine/GameLogic/SCA_IController.cpp
deleted file mode 100644
index 46ea2910a74..00000000000
--- a/source/gameengine/GameLogic/SCA_IController.cpp
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_IController.cpp
- * \ingroup gamelogic
- */
-
-
-#include <stddef.h>
-
-#include "SCA_IController.h"
-#include "SCA_LogicManager.h"
-#include "SCA_IActuator.h"
-#include "SCA_ISensor.h"
-#include "EXP_PyObjectPlus.h"
-#include "EXP_ListWrapper.h"
-
-#include <stdio.h>
-
-SCA_IController::SCA_IController(SCA_IObject* gameobj)
- :
- SCA_ILogicBrick(gameobj),
- m_statemask(0),
- m_justActivated(false)
-{
-}
-
-
-
-SCA_IController::~SCA_IController()
-{
- //UnlinkAllActuators();
-}
-
-
-
-std::vector<class SCA_ISensor*>& SCA_IController::GetLinkedSensors()
-{
- return m_linkedsensors;
-}
-
-
-
-std::vector<class SCA_IActuator*>& SCA_IController::GetLinkedActuators()
-{
- return m_linkedactuators;
-}
-
-
-
-void SCA_IController::UnlinkAllSensors()
-{
- std::vector<class SCA_ISensor*>::iterator sensit;
- for (sensit = m_linkedsensors.begin();!(sensit==m_linkedsensors.end());++sensit)
- {
- if (IsActive())
- {
- (*sensit)->DecLink();
- }
- (*sensit)->UnlinkController(this);
- }
- m_linkedsensors.clear();
-}
-
-
-
-void SCA_IController::UnlinkAllActuators()
-{
- std::vector<class SCA_IActuator*>::iterator actit;
- for (actit = m_linkedactuators.begin();!(actit==m_linkedactuators.end());++actit)
- {
- if (IsActive())
- {
- (*actit)->DecLink();
- }
- (*actit)->UnlinkController(this);
- }
- m_linkedactuators.clear();
-}
-
-void SCA_IController::LinkToActuator(SCA_IActuator* actua)
-{
- m_linkedactuators.push_back(actua);
- if (IsActive())
- {
- actua->IncLink();
- }
-}
-
-void SCA_IController::UnlinkActuator(class SCA_IActuator* actua)
-{
- std::vector<class SCA_IActuator*>::iterator actit;
- for (actit = m_linkedactuators.begin();!(actit==m_linkedactuators.end());++actit)
- {
- if ((*actit) == actua)
- {
- if (IsActive())
- {
- (*actit)->DecLink();
- }
- *actit = m_linkedactuators.back();
- m_linkedactuators.pop_back();
- return;
- }
- }
- printf("Missing link from controller %s:%s to actuator %s:%s\n",
- m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(),
- actua->GetParent()->GetName().ReadPtr(), actua->GetName().ReadPtr());
-}
-
-void SCA_IController::LinkToSensor(SCA_ISensor* sensor)
-{
- m_linkedsensors.push_back(sensor);
- if (IsActive())
- {
- sensor->IncLink();
- }
-}
-
-void SCA_IController::UnlinkSensor(class SCA_ISensor* sensor)
-{
- std::vector<class SCA_ISensor*>::iterator sensit;
- for (sensit = m_linkedsensors.begin();!(sensit==m_linkedsensors.end());++sensit)
- {
- if ((*sensit) == sensor)
- {
- if (IsActive())
- {
- sensor->DecLink();
- }
- *sensit = m_linkedsensors.back();
- m_linkedsensors.pop_back();
- return;
- }
- }
- printf("Missing link from controller %s:%s to sensor %s:%s\n",
- m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(),
- sensor->GetParent()->GetName().ReadPtr(), sensor->GetName().ReadPtr());
-}
-
-
-void SCA_IController::ApplyState(unsigned int state)
-{
- std::vector<class SCA_IActuator*>::iterator actit;
- std::vector<class SCA_ISensor*>::iterator sensit;
-
- if (m_statemask & state)
- {
- if (!IsActive())
- {
- // reactive the controller, all the links to actuator are valid again
- for (actit = m_linkedactuators.begin();!(actit==m_linkedactuators.end());++actit)
- {
- (*actit)->IncLink();
- }
-
- for (sensit = m_linkedsensors.begin();!(sensit==m_linkedsensors.end());++sensit)
- {
- (*sensit)->IncLink();
- }
- SetActive(true);
- m_justActivated = true;
- }
- } else if (IsActive())
- {
- for (actit = m_linkedactuators.begin();!(actit==m_linkedactuators.end());++actit)
- {
- (*actit)->DecLink();
- }
- for (sensit = m_linkedsensors.begin();!(sensit==m_linkedsensors.end());++sensit)
- {
- (*sensit)->DecLink();
- }
- SetActive(false);
- m_justActivated = false;
- }
-}
-
-#ifdef WITH_PYTHON
-
-/* Python api */
-
-PyTypeObject SCA_IController::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_IController",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_ILogicBrick::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_IController::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_IController::Attributes[] = {
- KX_PYATTRIBUTE_RO_FUNCTION("state", SCA_IController, pyattr_get_state),
- KX_PYATTRIBUTE_RO_FUNCTION("sensors", SCA_IController, pyattr_get_sensors),
- KX_PYATTRIBUTE_RO_FUNCTION("actuators", SCA_IController, pyattr_get_actuators),
- KX_PYATTRIBUTE_BOOL_RW("useHighPriority",SCA_IController,m_bookmark),
- { NULL } //Sentinel
-};
-
-PyObject *SCA_IController::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_IController* self = static_cast<SCA_IController*>(self_v);
- return PyLong_FromLong(self->m_statemask);
-}
-
-static int sca_icontroller_get_sensors_size_cb(void *self_v)
-{
- return ((SCA_IController *)self_v)->GetLinkedSensors().size();
-}
-
-static PyObject *sca_icontroller_get_sensors_item_cb(void *self_v, int index)
-{
- return ((SCA_IController *)self_v)->GetLinkedSensors()[index]->GetProxy();
-}
-
-static const char *sca_icontroller_get_sensors_item_name_cb(void *self_v, int index)
-{
- return ((SCA_IController *)self_v)->GetLinkedSensors()[index]->GetName().ReadPtr();
-}
-
-PyObject *SCA_IController::pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- return (new CListWrapper(self_v,
- ((SCA_IController *)self_v)->GetProxy(),
- NULL,
- sca_icontroller_get_sensors_size_cb,
- sca_icontroller_get_sensors_item_cb,
- sca_icontroller_get_sensors_item_name_cb,
- NULL))->NewProxy(true);
-}
-
-static int sca_icontroller_get_actuators_size_cb(void *self_v)
-{
- return ((SCA_IController *)self_v)->GetLinkedActuators().size();
-}
-
-static PyObject *sca_icontroller_get_actuators_item_cb(void *self_v, int index)
-{
- return ((SCA_IController *)self_v)->GetLinkedActuators()[index]->GetProxy();
-}
-
-static const char *sca_icontroller_get_actuators_item_name_cb(void *self_v, int index)
-{
- return ((SCA_IController *)self_v)->GetLinkedActuators()[index]->GetName().ReadPtr();
-}
-
-PyObject *SCA_IController::pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- return (new CListWrapper(self_v,
- ((SCA_IController *)self_v)->GetProxy(),
- NULL,
- sca_icontroller_get_actuators_size_cb,
- sca_icontroller_get_actuators_item_cb,
- sca_icontroller_get_actuators_item_name_cb,
- NULL))->NewProxy(true);
-}
-#endif // WITH_PYTHON
diff --git a/source/gameengine/GameLogic/SCA_IController.h b/source/gameengine/GameLogic/SCA_IController.h
deleted file mode 100644
index a249a6e85f9..00000000000
--- a/source/gameengine/GameLogic/SCA_IController.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_IController.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_ICONTROLLER_H__
-#define __SCA_ICONTROLLER_H__
-
-#include "SCA_ILogicBrick.h"
-#include "EXP_PyObjectPlus.h"
-
-/**
- * Use of SG_DList element: none
- * Use of SG_QList element: build ordered list of activated controller on the owner object
- * Head: SCA_IObject::m_activeControllers
- */
-class SCA_IController : public SCA_ILogicBrick
-{
- Py_Header
-protected:
- std::vector<class SCA_ISensor*> m_linkedsensors;
- std::vector<class SCA_IActuator*> m_linkedactuators;
- unsigned int m_statemask;
- bool m_justActivated;
- bool m_bookmark;
-public:
- SCA_IController(SCA_IObject* gameobj);
- virtual ~SCA_IController();
- virtual void Trigger(class SCA_LogicManager* logicmgr)=0;
- void LinkToSensor(SCA_ISensor* sensor);
- void LinkToActuator(SCA_IActuator*);
- std::vector<class SCA_ISensor*>& GetLinkedSensors();
- std::vector<class SCA_IActuator*>& GetLinkedActuators();
- void ReserveActuator(int num)
- {
- m_linkedactuators.reserve(num);
- }
- void UnlinkAllSensors();
- void UnlinkAllActuators();
- void UnlinkActuator(class SCA_IActuator* actua);
- void UnlinkSensor(class SCA_ISensor* sensor);
- void SetState(unsigned int state) { m_statemask = state; }
- void ApplyState(unsigned int state);
- void Deactivate()
- {
- // the controller can only be part of a sensor m_newControllers list
- Delink();
- }
- bool IsJustActivated()
- {
- return m_justActivated;
- }
- void ClrJustActivated()
- {
- m_justActivated = false;
- }
- void SetBookmark(bool bookmark)
- {
- m_bookmark = bookmark;
- }
- void Activate(SG_DList& head)
- {
- if (QEmpty())
- {
- if (m_bookmark)
- {
- m_gameobj->m_activeBookmarkedControllers.QAddBack(this);
- head.AddFront(&m_gameobj->m_activeBookmarkedControllers);
- }
- else
- {
- InsertActiveQList(m_gameobj->m_activeControllers);
- head.AddBack(&m_gameobj->m_activeControllers);
- }
- }
- }
-
-
-#ifdef WITH_PYTHON
- static PyObject* pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-#endif /* WITH_PYTHON */
-};
-
-#endif /* __SCA_ICONTROLLER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.cpp b/source/gameengine/GameLogic/SCA_IInputDevice.cpp
deleted file mode 100644
index 0808028fed3..00000000000
--- a/source/gameengine/GameLogic/SCA_IInputDevice.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_IInputDevice.cpp
- * \ingroup gamelogic
- */
-
-
-#include <assert.h>
-#include "SCA_IInputDevice.h"
-
-SCA_IInputDevice::SCA_IInputDevice()
- :
- m_currentTable(0)
-{
- ClearStatusTable(0);
- ClearStatusTable(1);
-}
-
-
-
-SCA_IInputDevice::~SCA_IInputDevice()
-{
-}
-
-void SCA_IInputDevice::HookEscape()
-{
- assert(false && "This device does not support hooking escape.");
-}
-
-void SCA_IInputDevice::ClearStatusTable(int tableid)
-{
- for (int i=0;i<SCA_IInputDevice::KX_MAX_KEYS;i++)
- m_eventStatusTables[tableid][i]=SCA_InputEvent(SCA_InputEvent::KX_NO_INPUTSTATUS,0);
-}
-
-
-
-const SCA_InputEvent& SCA_IInputDevice::GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)
-{
-// cerr << "SCA_IInputDevice::GetEventValue" << endl;
- return m_eventStatusTables[m_currentTable][inputcode];
-}
-
-
-
-int SCA_IInputDevice::GetNumActiveEvents()
-{
- int num = 0;
-
- // cerr << "SCA_IInputDevice::GetNumActiveEvents" << endl;
-
- for (int i=0;i<SCA_IInputDevice::KX_MAX_KEYS;i++)
- {
- const SCA_InputEvent& event = m_eventStatusTables[m_currentTable][i];
- if ((event.m_status == SCA_InputEvent::KX_JUSTACTIVATED)
- || (event.m_status == SCA_InputEvent::KX_ACTIVE))
- num++;
- }
-
- return num;
-}
-
-
-
-int SCA_IInputDevice::GetNumJustEvents()
-{
- int num = 0;
-
- // cerr << "SCA_IInputDevice::GetNumJustEvents" << endl;
-
- for (int i=0;i<SCA_IInputDevice::KX_MAX_KEYS;i++)
- {
- const SCA_InputEvent& event = m_eventStatusTables[m_currentTable][i];
- if ((event.m_status == SCA_InputEvent::KX_JUSTACTIVATED)
- || (event.m_status == SCA_InputEvent::KX_JUSTRELEASED))
- num++;
- }
-
- return num;
-}
-
-
-
-void SCA_IInputDevice::NextFrame()
-{
- m_currentTable = 1 - m_currentTable;
-
- // cerr << "SCA_IInputDevice::NextFrame " << GetNumActiveEvents() << endl;
-
- for (int i=0;i<SCA_IInputDevice::KX_MAX_KEYS;i++)
- {
- switch (m_eventStatusTables[1 - m_currentTable][i].m_status)
- {
- case SCA_InputEvent::KX_NO_INPUTSTATUS:
- m_eventStatusTables[m_currentTable][i]
- = SCA_InputEvent(SCA_InputEvent::KX_NO_INPUTSTATUS, 1);
- break;
- case SCA_InputEvent::KX_JUSTACTIVATED:
- m_eventStatusTables[m_currentTable][i]
- = SCA_InputEvent(SCA_InputEvent::KX_ACTIVE, 1);
- break;
- case SCA_InputEvent::KX_ACTIVE:
- m_eventStatusTables[m_currentTable][i]
- = SCA_InputEvent(SCA_InputEvent::KX_ACTIVE, 1);
- break;
- case SCA_InputEvent::KX_JUSTRELEASED:
- m_eventStatusTables[m_currentTable][i]
- = SCA_InputEvent(SCA_InputEvent::KX_NO_INPUTSTATUS, 1);
- break;
- default:
- ; /* error */
- }
- }
-}
diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.h b/source/gameengine/GameLogic/SCA_IInputDevice.h
deleted file mode 100644
index 6682fd52a56..00000000000
--- a/source/gameengine/GameLogic/SCA_IInputDevice.h
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_IInputDevice.h
- * \ingroup gamelogic
- * \brief Interface for input devices. The defines for keyboard/system/mouse events
- * here are for internal use in the KX module.
- *
- */
-
-#ifndef __SCA_IINPUTDEVICE_H__
-#define __SCA_IINPUTDEVICE_H__
-
-#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
-#endif
-
-class SCA_InputEvent
-{
-
-public:
- enum SCA_EnumInputs {
-
- KX_NO_INPUTSTATUS = 0,
- KX_JUSTACTIVATED,
- KX_ACTIVE,
- KX_JUSTRELEASED,
- };
-
- SCA_InputEvent(SCA_EnumInputs status=KX_NO_INPUTSTATUS,int eventval=0, int unicode=0)
- : m_status(status),
- m_eventval(eventval),
- m_unicode(unicode)
- {
-
- }
-
- SCA_EnumInputs m_status;
- int m_eventval;
- unsigned int m_unicode;
-};
-
-/* Originally from wm_event_types.h, now only used by GameEngine */
-#define MOUSEX MOUSEMOVE
-#define MOUSEY ACTIONMOUSE
-
-class SCA_IInputDevice
-{
-
-
-public:
-
- SCA_IInputDevice();
- virtual ~SCA_IInputDevice();
-
- enum KX_EnumInputs {
-
- KX_NOKEY = 0,
-
- // TIMERS
-
- KX_TIMER0,
- KX_TIMER1,
- KX_TIMER2,
-
- // SYSTEM
-
- /* Moved to avoid clashes with KX_RETKEY */
- KX_KEYBD,
- KX_RAWKEYBD,
- KX_REDRAW,
- KX_INPUTCHANGE,
- KX_QFULL,
- KX_WINFREEZE,
- KX_WINTHAW,
- /* thaw is 11 */
-
- /* move past retkey*/
- KX_WINCLOSE = 14,
- KX_WINQUIT,
- KX_Q_FIRSTTIME,
- /* sequence ends on 16 */
-
- // standard keyboard
-
- /* Because of the above preamble, KX_BEGINKEY is 15 ! This
- * means that KX_RETKEY on 13d (0Dh)) will double up with
- * KX_WINQUIT! Why is it 13? Because ascii 13d is Ctrl-M aka
- * CR! Its little brother, LF has 10d (0Ah). This is
- * dangerous, since the keyboards start scanning at
- * KX_BEGINKEY. I think the keyboard system should push its
- * key events instead of demanding the user to poll the
- * table... But that's for another time... The fix for now is
- * to move the above system events into a 'safe' (ie. unused)
- * range. I am loathe to move it away from this 'magical'
- * coincidence.. it's probably exploited somewhere. I hope the
- * close and quit events don't mess up 'normal' kb code
- * scanning.
- * */
- KX_BEGINKEY = 12,
-
- KX_RETKEY = 13,
- KX_SPACEKEY = 32,
- KX_PADASTERKEY = 42,
- KX_COMMAKEY = 44,
- KX_MINUSKEY = 45,
- KX_PERIODKEY = 46,
- KX_PLUSKEY = 47,
- KX_ZEROKEY = 48,
-
- KX_ONEKEY, // =49
- KX_TWOKEY,
- KX_THREEKEY,
- KX_FOURKEY,
- KX_FIVEKEY,
- KX_SIXKEY,
- KX_SEVENKEY,
- KX_EIGHTKEY,
- KX_NINEKEY, // = 57
-
- KX_AKEY = 97,
- KX_BKEY,
- KX_CKEY,
- KX_DKEY,
- KX_EKEY,
- KX_FKEY,
- KX_GKEY,
- KX_HKEY,
- KX_IKEY,
- KX_JKEY,
- KX_KKEY,
- KX_LKEY,
- KX_MKEY,
- KX_NKEY, // =110
- KX_OKEY,
- KX_PKEY,
- KX_QKEY,
- KX_RKEY,
- KX_SKEY,
- KX_TKEY,
- KX_UKEY,
- KX_VKEY,
- KX_WKEY,
- KX_XKEY, // =120
- KX_YKEY,
- KX_ZKEY, // =122
-
-
-
- KX_CAPSLOCKKEY, // 123
-
- KX_LEFTCTRLKEY, // 124
- KX_LEFTALTKEY,
- KX_RIGHTALTKEY,
- KX_RIGHTCTRLKEY,
- KX_RIGHTSHIFTKEY,
- KX_LEFTSHIFTKEY,// 129
-
- KX_ESCKEY, // 130
- KX_TABKEY, //131
-
-
- KX_LINEFEEDKEY, // 132
- KX_BACKSPACEKEY,
- KX_DELKEY,
- KX_SEMICOLONKEY, // 135
-
-
- KX_QUOTEKEY, //136
- KX_ACCENTGRAVEKEY, //137
-
- KX_SLASHKEY, //138
- KX_BACKSLASHKEY,
- KX_EQUALKEY,
- KX_LEFTBRACKETKEY,
- KX_RIGHTBRACKETKEY, // 142
-
- KX_LEFTARROWKEY, // 145
- KX_DOWNARROWKEY,
- KX_RIGHTARROWKEY,
- KX_UPARROWKEY, // 148
-
- KX_PAD2 ,
- KX_PAD4 ,
- KX_PAD6 ,
- KX_PAD8 ,
-
- KX_PAD1 ,
- KX_PAD3 ,
- KX_PAD5 ,
- KX_PAD7 ,
- KX_PAD9 ,
-
- KX_PADPERIOD,
- KX_PADSLASHKEY,
-
-
-
- KX_PAD0 ,
- KX_PADMINUS,
- KX_PADENTER,
- KX_PADPLUSKEY,
-
-
- KX_F1KEY ,
- KX_F2KEY ,
- KX_F3KEY ,
- KX_F4KEY ,
- KX_F5KEY ,
- KX_F6KEY ,
- KX_F7KEY ,
- KX_F8KEY ,
- KX_F9KEY ,
- KX_F10KEY,
- KX_F11KEY,
- KX_F12KEY,
- KX_F13KEY,
- KX_F14KEY,
- KX_F15KEY,
- KX_F16KEY,
- KX_F17KEY,
- KX_F18KEY,
- KX_F19KEY,
-
- KX_OSKEY,
-
- KX_PAUSEKEY,
- KX_INSERTKEY,
- KX_HOMEKEY ,
- KX_PAGEUPKEY,
- KX_PAGEDOWNKEY,
- KX_ENDKEY,
-
- // MOUSE
- KX_BEGINMOUSE,
-
- KX_BEGINMOUSEBUTTONS,
-
- KX_LEFTMOUSE,
- KX_MIDDLEMOUSE,
- KX_RIGHTMOUSE,
-
- KX_ENDMOUSEBUTTONS,
-
- KX_WHEELUPMOUSE,
- KX_WHEELDOWNMOUSE,
-
- KX_MOUSEX,
- KX_MOUSEY,
-
- KX_ENDMOUSE,
-
-
-
- KX_MAX_KEYS
-
- }; // enum
-
-
-protected:
- /**
- * m_eventStatusTables are two tables that contain current and previous
- * status of all events
- */
-
- SCA_InputEvent m_eventStatusTables[2][SCA_IInputDevice::KX_MAX_KEYS];
- /**
- * m_currentTable is index for m_keyStatusTable that toggle between 0 or 1
- */
- int m_currentTable;
- void ClearStatusTable(int tableid);
-
-public:
- virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
- virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode);
-
- /**
- * Count active events(active and just_activated)
- */
- virtual int GetNumActiveEvents();
-
- /**
- * Get the number of remapping events (just_activated, just_released)
- */
- virtual int GetNumJustEvents();
-
- virtual void HookEscape();
-
- /**
- * Next frame: we calculate the new key states. This goes as follows:
- *
- * KX_NO_INPUTSTATUS -> KX_NO_INPUTSTATUS
- * KX_JUSTACTIVATED -> KX_ACTIVE
- * KX_ACTIVE -> KX_ACTIVE
- * KX_JUSTRELEASED -> KX_NO_INPUTSTATUS
- *
- * Getting new events provides the
- * KX_NO_INPUTSTATUS->KX_JUSTACTIVATED and
- * KX_ACTIVE->KX_JUSTRELEASED transitions.
- */
- virtual void NextFrame();
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_InputEvent")
-#endif
-};
-
-#endif /* __SCA_IINPUTDEVICE_H__ */
diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
deleted file mode 100644
index d388317ce6a..00000000000
--- a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_ILogicBrick.cpp
- * \ingroup gamelogic
- */
-
-
-#include <stddef.h>
-
-#include "SCA_ILogicBrick.h"
-#include "EXP_PyObjectPlus.h"
-
-SCA_ILogicBrick::SCA_ILogicBrick(SCA_IObject* gameobj)
- :
- CValue(),
- m_gameobj(gameobj),
- m_logicManager(NULL),
- m_Execute_Priority(0),
- m_Execute_Ueber_Priority(0),
- m_bActive(false),
- m_eventval(0)
-{
- m_text = "KX_LogicBrick";
-}
-
-
-
-SCA_ILogicBrick::~SCA_ILogicBrick()
-{
- RemoveEvent();
-}
-
-
-
-void SCA_ILogicBrick::SetExecutePriority(int execute_Priority)
-{
- m_Execute_Priority = execute_Priority;
-}
-
-
-
-void SCA_ILogicBrick::SetUeberExecutePriority(int execute_Priority)
-{
- m_Execute_Ueber_Priority = execute_Priority;
-}
-
-
-
-void SCA_ILogicBrick::ReParent(SCA_IObject* parent)
-{
- m_gameobj = parent;
-}
-
-void SCA_ILogicBrick::Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map)
-{
- // nothing to do
-}
-
-CValue* SCA_ILogicBrick::Calc(VALUE_OPERATOR op, CValue *val)
-{
- CValue* temp = new CBoolValue(false,"");
- CValue* result = temp->Calc(op,val);
- temp->Release();
-
- return result;
-}
-
-
-
-CValue* SCA_ILogicBrick::CalcFinal(VALUE_DATA_TYPE dtype,
- VALUE_OPERATOR op,
- CValue *val)
-{
- // same as bool implementation, so...
- CValue* temp = new CBoolValue(false,"");
- CValue* result = temp->CalcFinal(dtype,op,val);
- temp->Release();
-
- return result;
-}
-
-
-
-const STR_String& SCA_ILogicBrick::GetText()
-{
- if (m_name.Length())
- return m_name;
-
- return m_text;
-}
-
-
-
-double SCA_ILogicBrick::GetNumber()
-{
- return -1;
-}
-
-
-
-STR_String& SCA_ILogicBrick::GetName()
-{
- return m_name;
-}
-
-
-
-void SCA_ILogicBrick::SetName(const char *name)
-{
- m_name = name;
-}
-
-bool SCA_ILogicBrick::LessComparedTo(SCA_ILogicBrick* other)
-{
- return (this->m_Execute_Ueber_Priority < other->m_Execute_Ueber_Priority)
- || ((this->m_Execute_Ueber_Priority == other->m_Execute_Ueber_Priority) &&
- (this->m_Execute_Priority < other->m_Execute_Priority));
-}
-
-void SCA_ILogicBrick::SetLogicManager(SCA_LogicManager *logicmgr)
-{
- m_logicManager = logicmgr;
-}
-
-SCA_LogicManager *SCA_ILogicBrick::GetLogicManager()
-{
- return m_logicManager;
-}
-
-void SCA_ILogicBrick::RegisterEvent(CValue* eventval)
-{
- if (m_eventval)
- m_eventval->Release();
-
- m_eventval = eventval->AddRef();
-}
-
-
-void SCA_ILogicBrick::RemoveEvent()
-{
- if (m_eventval)
- {
- m_eventval->Release();
- m_eventval = NULL;
- }
-}
-
-
-
-CValue* SCA_ILogicBrick::GetEvent()
-{
- if (m_eventval)
- {
- return m_eventval->AddRef();
- }
-
- return NULL;
-}
-
-
-
-#ifdef WITH_PYTHON
-
-/* python stuff */
-
-PyTypeObject SCA_ILogicBrick::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_ILogicBrick",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &CValue::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_ILogicBrick::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_ILogicBrick::Attributes[] = {
- KX_PYATTRIBUTE_RO_FUNCTION("owner", SCA_ILogicBrick, pyattr_get_owner),
- KX_PYATTRIBUTE_INT_RW("executePriority",0,100000,false,SCA_ILogicBrick,m_Execute_Priority),
- KX_PYATTRIBUTE_STRING_RO("name", SCA_ILogicBrick, m_name),
- {NULL} //Sentinel
-};
-
-int SCA_ILogicBrick::CheckProperty(void *self, const PyAttributeDef *attrdef)
-{
- if (attrdef->m_type != KX_PYATTRIBUTE_TYPE_STRING || attrdef->m_length != 1) {
- PyErr_SetString(PyExc_AttributeError, "inconsistent check function for attribute type, report to blender.org");
- return 1;
- }
- SCA_ILogicBrick* brick = reinterpret_cast<SCA_ILogicBrick*>(self);
- STR_String* var = reinterpret_cast<STR_String*>((char*)self+attrdef->m_offset);
- CValue* prop = brick->GetParent()->FindIdentifier(*var);
- bool error = prop->IsError();
- prop->Release();
- if (error) {
- PyErr_SetString(PyExc_ValueError, "string does not correspond to a property");
- return 1;
- }
- return 0;
-}
-
-/*Attribute functions */
-PyObject *SCA_ILogicBrick::pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_ILogicBrick* self = static_cast<SCA_ILogicBrick*>(self_v);
- CValue* parent = self->GetParent();
-
- if (parent)
- return parent->GetProxy();
-
- Py_RETURN_NONE;
-}
-
-
-
-/* Conversions for making life better. */
-bool SCA_ILogicBrick::PyArgToBool(int boolArg)
-{
- if (boolArg) {
- return true;
- } else {
- return false;
- }
-}
-
-PyObject *SCA_ILogicBrick::BoolToPyArg(bool boolarg)
-{
- return PyLong_FromLong(boolarg ? KX_TRUE: KX_FALSE);
-}
-
-#endif // WITH_PYTHON
diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.h b/source/gameengine/GameLogic/SCA_ILogicBrick.h
deleted file mode 100644
index 46c62f0258a..00000000000
--- a/source/gameengine/GameLogic/SCA_ILogicBrick.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_ILogicBrick.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_ILOGICBRICK_H__
-#define __SCA_ILOGICBRICK_H__
-
-#include "EXP_Value.h"
-#include "SCA_IObject.h"
-#include "EXP_BoolValue.h"
-#include "CTR_Map.h"
-#include "CTR_HashedPtr.h"
-
-class NG_NetworkScene;
-class SCA_IScene;
-class SCA_LogicManager;
-
-class SCA_ILogicBrick : public CValue
-{
- Py_Header
-protected:
- SCA_IObject* m_gameobj;
- SCA_LogicManager *m_logicManager;
- int m_Execute_Priority;
- int m_Execute_Ueber_Priority;
-
- bool m_bActive;
- CValue* m_eventval;
- STR_String m_text;
- STR_String m_name;
- //unsigned long m_drawcolor;
- void RegisterEvent(CValue* eventval);
- void RemoveEvent();
- CValue* GetEvent();
-
-public:
- SCA_ILogicBrick(SCA_IObject* gameobj);
- virtual ~SCA_ILogicBrick();
-
- void SetExecutePriority(int execute_Priority);
- void SetUeberExecutePriority(int execute_Priority);
-
- SCA_IObject* GetParent() { return m_gameobj; }
-
- virtual void ReParent(SCA_IObject* parent);
- virtual void Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map);
- virtual void Delete() { Release(); }
-
- // act as a BoolValue (with value IsPositiveTrigger)
- virtual CValue* Calc(VALUE_OPERATOR op, CValue *val);
- virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
-
- virtual const STR_String & GetText();
- virtual double GetNumber();
- virtual STR_String& GetName();
- virtual void SetName(const char *);
-
- bool IsActive()
- {
- return m_bActive;
- }
-
- void SetActive(bool active)
- {
- m_bActive=active;
- }
-
- // insert in a QList at position corresponding to m_Execute_Priority
- void InsertActiveQList(SG_QList& head)
- {
- SG_QList::iterator<SCA_ILogicBrick> it(head);
- for (it.begin(); !it.end() && m_Execute_Priority > (*it)->m_Execute_Priority; ++it);
- it.add_back(this);
- }
-
- // insert in a QList at position corresponding to m_Execute_Priority
- // inside a longer list that contains elements of other objects.
- // Sorting is done only between the elements of the same object.
- // head is the head of the combined list
- // current points to the first element of the object in the list, NULL if none yet
- void InsertSelfActiveQList(SG_QList& head, SG_QList** current)
- {
- if (!*current)
- {
- // first element can be put anywhere
- head.QAddBack(this);
- *current = this;
- return;
- }
- // note: we assume current points actually to one o our element, skip the tests
- SG_QList::iterator<SCA_ILogicBrick> it(head,*current);
- if (m_Execute_Priority <= (*it)->m_Execute_Priority)
- {
- // this element comes before the first
- *current = this;
- }
- else {
- for (++it; !it.end() && (*it)->m_gameobj == m_gameobj && m_Execute_Priority > (*it)->m_Execute_Priority; ++it);
- }
- it.add_back(this);
- }
-
- virtual bool LessComparedTo(SCA_ILogicBrick* other);
-
- virtual void SetLogicManager(SCA_LogicManager *logicmgr);
- SCA_LogicManager *GetLogicManager();
-
- /* for moving logic bricks between scenes */
- virtual void Replace_IScene(SCA_IScene *val) {}
- virtual void Replace_NetworkScene(NG_NetworkScene *val) {}
-
-#ifdef WITH_PYTHON
- // python methods
-
- static PyObject* pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-
- // check that attribute is a property
- static int CheckProperty(void *self, const PyAttributeDef *attrdef);
-
- enum KX_BOOL_TYPE {
- KX_BOOL_NODEF = 0,
- KX_TRUE,
- KX_FALSE,
- KX_BOOL_MAX
- };
-
-
-protected:
- /* Some conversions to go with the bool type. */
- /** Convert a KX_TRUE, KX_FALSE in Python to a c++ value. */
- bool PyArgToBool(int boolArg);
-
- /** Convert a a c++ value to KX_TRUE, KX_FALSE in Python. */
- PyObject *BoolToPyArg(bool);
-
-#endif /* WITH_PYTHON */
-
-};
-
-#endif /* __SCA_ILOGICBRICK_H__ */
diff --git a/source/gameengine/GameLogic/SCA_IObject.cpp b/source/gameengine/GameLogic/SCA_IObject.cpp
deleted file mode 100644
index c5eab53d67e..00000000000
--- a/source/gameengine/GameLogic/SCA_IObject.cpp
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_IObject.cpp
- * \ingroup gamelogic
- */
-
-#include <iostream>
-#include <algorithm>
-
-#include "SCA_IObject.h"
-#include "SCA_ISensor.h"
-#include "SCA_IController.h"
-#include "SCA_IActuator.h"
-#include "MT_Point3.h"
-#include "EXP_ListValue.h"
-
-MT_Point3 SCA_IObject::m_sDummy=MT_Point3(0,0,0);
-SG_QList SCA_IObject::m_activeBookmarkedControllers;
-
-SCA_IObject::SCA_IObject():
- CValue(),
- m_initState(0),
- m_state(0),
- m_firstState(NULL)
-{
- m_suspended = false;
-}
-
-SCA_IObject::~SCA_IObject()
-{
- SCA_SensorList::iterator its;
- for (its = m_sensors.begin(); !(its == m_sensors.end()); ++its)
- {
- //Use Delete for sensor to ensure proper cleaning
- (*its)->Delete();
- //((CValue*)(*its))->Release();
- }
- SCA_ControllerList::iterator itc;
- for (itc = m_controllers.begin(); !(itc == m_controllers.end()); ++itc)
- {
- //Use Delete for controller to ensure proper cleaning (expression controller)
- (*itc)->Delete();
- //((CValue*)(*itc))->Release();
- }
- SCA_ActuatorList::iterator ita;
- for (ita = m_registeredActuators.begin(); !(ita==m_registeredActuators.end()); ++ita)
- {
- (*ita)->UnlinkObject(this);
- }
- for (ita = m_actuators.begin(); !(ita==m_actuators.end()); ++ita)
- {
- (*ita)->Delete();
- }
-
- SCA_ObjectList::iterator ito;
- for (ito = m_registeredObjects.begin(); !(ito==m_registeredObjects.end()); ++ito)
- {
- (*ito)->UnlinkObject(this);
- }
-
- //T_InterpolatorList::iterator i;
- //for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) {
- // delete *i;
- //}
-}
-
-void SCA_IObject::AddSensor(SCA_ISensor* act)
-{
- act->AddRef();
- m_sensors.push_back(act);
-}
-
-
-
-void SCA_IObject::AddController(SCA_IController* act)
-{
- act->AddRef();
- m_controllers.push_back(act);
-}
-
-
-
-void SCA_IObject::AddActuator(SCA_IActuator* act)
-{
- act->AddRef();
- m_actuators.push_back(act);
-}
-
-void SCA_IObject::RegisterActuator(SCA_IActuator* act)
-{
- // don't increase ref count, it would create dead lock
- m_registeredActuators.push_back(act);
-}
-
-void SCA_IObject::UnregisterActuator(SCA_IActuator* act)
-{
- SCA_ActuatorList::iterator ita;
- for (ita = m_registeredActuators.begin(); ita != m_registeredActuators.end(); ++ita)
- {
- if ((*ita) == act) {
- (*ita) = m_registeredActuators.back();
- m_registeredActuators.pop_back();
- break;
- }
- }
-}
-
-void SCA_IObject::RegisterObject(SCA_IObject* obj)
-{
- // one object may be registered multiple times via constraint target
- // store multiple reference, this will serve as registration counter
- m_registeredObjects.push_back(obj);
-}
-
-void SCA_IObject::UnregisterObject(SCA_IObject* obj)
-{
- SCA_ObjectList::iterator ito;
- for (ito = m_registeredObjects.begin(); ito != m_registeredObjects.end(); ++ito)
- {
- if ((*ito) == obj) {
- (*ito) = m_registeredObjects.back();
- m_registeredObjects.pop_back();
- break;
- }
- }
-}
-
-void SCA_IObject::ReParentLogic()
-{
- SCA_ActuatorList& oldactuators = GetActuators();
- int act = 0;
- SCA_ActuatorList::iterator ita;
- for (ita = oldactuators.begin(); !(ita==oldactuators.end()); ++ita)
- {
- SCA_IActuator* newactuator = (SCA_IActuator*) (*ita)->GetReplica();
- newactuator->ReParent(this);
- // actuators are initially not connected to any controller
- newactuator->SetActive(false);
- newactuator->ClrLink();
- oldactuators[act++] = newactuator;
- }
-
- SCA_ControllerList& oldcontrollers = GetControllers();
- int con = 0;
- SCA_ControllerList::iterator itc;
- for (itc = oldcontrollers.begin(); !(itc==oldcontrollers.end()); ++itc)
- {
- SCA_IController* newcontroller = (SCA_IController*)(*itc)->GetReplica();
- newcontroller->ReParent(this);
- newcontroller->SetActive(false);
- oldcontrollers[con++]=newcontroller;
-
- }
- // convert sensors last so that actuators are already available for Actuator sensor
- SCA_SensorList& oldsensors = GetSensors();
- int sen = 0;
- SCA_SensorList::iterator its;
- for (its = oldsensors.begin(); !(its==oldsensors.end()); ++its)
- {
- SCA_ISensor* newsensor = (SCA_ISensor*)(*its)->GetReplica();
- newsensor->ReParent(this);
- newsensor->SetActive(false);
- // sensors are initially not connected to any controller
- newsensor->ClrLink();
- oldsensors[sen++] = newsensor;
- }
-
- // a new object cannot be client of any actuator
- m_registeredActuators.clear();
- m_registeredObjects.clear();
-}
-
-
-
-SCA_ISensor* SCA_IObject::FindSensor(const STR_String& sensorname)
-{
- SCA_ISensor* foundsensor = NULL;
-
- for (SCA_SensorList::iterator its = m_sensors.begin();!(its==m_sensors.end());++its)
- {
- if ((*its)->GetName() == sensorname)
- {
- foundsensor = (*its);
- break;
- }
- }
- return foundsensor;
-}
-
-
-
-SCA_IController* SCA_IObject::FindController(const STR_String& controllername)
-{
- SCA_IController* foundcontroller = NULL;
-
- for (SCA_ControllerList::iterator itc = m_controllers.begin();!(itc==m_controllers.end());++itc)
- {
- if ((*itc)->GetName() == controllername)
- {
- foundcontroller = (*itc);
- break;
- }
- }
- return foundcontroller;
-}
-
-
-
-SCA_IActuator* SCA_IObject::FindActuator(const STR_String& actuatorname)
-{
- SCA_IActuator* foundactuator = NULL;
-
- for (SCA_ActuatorList::iterator ita = m_actuators.begin();!(ita==m_actuators.end());++ita)
- {
- if ((*ita)->GetName() == actuatorname)
- {
- foundactuator = (*ita);
- break;
- }
- }
-
- return foundactuator;
-}
-
-
-void SCA_IObject::Suspend()
-{
- if ((!m_ignore_activity_culling)
- && (!m_suspended)) {
- m_suspended = true;
- /* flag suspend for all sensors */
- SCA_SensorList::iterator i = m_sensors.begin();
- while (i != m_sensors.end()) {
- (*i)->Suspend();
- ++i;
- }
- }
-}
-
-
-
-void SCA_IObject::Resume(void)
-{
- if (m_suspended) {
- m_suspended = false;
- /* unflag suspend for all sensors */
- SCA_SensorList::iterator i = m_sensors.begin();
- while (i != m_sensors.end()) {
- (*i)->Resume();
- ++i;
- }
- }
-}
-
-void SCA_IObject::SetState(unsigned int state)
-{
- unsigned int tmpstate;
- SCA_ControllerList::iterator contit;
-
- // we will update the state in two steps:
- // 1) set the new state bits that are 1
- // 2) clr the new state bits that are 0
- // This to ensure continuity if a sensor is attached to two states
- // that are switching state: no need to deactive and reactive the sensor
-
- tmpstate = m_state | state;
- if (tmpstate != m_state)
- {
- // update the status of the controllers
- for (contit = m_controllers.begin(); contit != m_controllers.end(); ++contit)
- {
- (*contit)->ApplyState(tmpstate);
- }
- }
- m_state = state;
- if (m_state != tmpstate)
- {
- for (contit = m_controllers.begin(); contit != m_controllers.end(); ++contit)
- {
- (*contit)->ApplyState(m_state);
- }
- }
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_IObject::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_IObject",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &CValue::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_IObject::Methods[] = {
- //{"setOrientation", (PyCFunction) SCA_IObject::sPySetOrientation, METH_VARARGS},
- //{"getOrientation", (PyCFunction) SCA_IObject::sPyGetOrientation, METH_VARARGS},
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_IObject::Attributes[] = {
- { NULL } //Sentinel
-};
-
-#endif // WITH_PYTHON
diff --git a/source/gameengine/GameLogic/SCA_IObject.h b/source/gameengine/GameLogic/SCA_IObject.h
deleted file mode 100644
index 5c2dd351fb3..00000000000
--- a/source/gameengine/GameLogic/SCA_IObject.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-/** \file SCA_IObject.h
- * \ingroup gamelogic
- * \brief An abstract object that has some logic, python scripting and
- * reference counting Note: transformation stuff has been moved to
- * SceneGraph
- */
-
-#ifndef __SCA_IOBJECT_H__
-#define __SCA_IOBJECT_H__
-
-#include "EXP_Value.h"
-#include <vector>
-
-class SCA_IObject;
-class SCA_ISensor;
-class SCA_IController;
-class SCA_IActuator;
-
-#ifdef WITH_PYTHON
-template<class T> T PyVecTo(PyObject *);
-#endif
-
-typedef std::vector<SCA_ISensor *> SCA_SensorList;
-typedef std::vector<SCA_IController *> SCA_ControllerList;
-typedef std::vector<SCA_IActuator *> SCA_ActuatorList;
-typedef std::vector<SCA_IObject *> SCA_ObjectList;
-
-class SCA_IObject : public CValue
-{
-
- Py_Header
-
-protected:
- friend class KX_StateActuator;
- friend class SCA_IActuator;
- friend class SCA_IController;
- SCA_SensorList m_sensors;
- SCA_ControllerList m_controllers;
- SCA_ActuatorList m_actuators;
- SCA_ActuatorList m_registeredActuators; // actuators that use a pointer to this object
- SCA_ObjectList m_registeredObjects; // objects that hold reference to this object
-
- // SG_Dlist: element of objects with active actuators
- // Head: SCA_LogicManager::m_activeActuators
- // SG_QList: Head of active actuators list on this object
- // Elements: SCA_IActuator
- SG_QList m_activeActuators;
- // SG_Dlist: element of list os lists with active controllers
- // Head: SCA_LogicManager::m_activeControllers
- // SG_QList: Head of active controller list on this object
- // Elements: SCA_IController
- SG_QList m_activeControllers;
- // SG_Dlist: element of list of lists of active controllers
- // Head: SCA_LogicManager::m_activeControllers
- // SG_QList: Head of active bookmarked controller list globally
- // Elements: SCA_IController with bookmark option
- static SG_QList m_activeBookmarkedControllers;
-
- static class MT_Point3 m_sDummy;
-
- /**
- * Ignore activity culling requests?
- */
- bool m_ignore_activity_culling;
-
- /**
- * Ignore updates?
- */
- bool m_suspended;
-
- /**
- * init state of object (used when object is created)
- */
- unsigned int m_initState;
-
- /**
- * current state = bit mask of state that are active
- */
- unsigned int m_state;
-
- /**
- * pointer inside state actuator list for sorting
- */
- SG_QList* m_firstState;
-
-public:
-
- SCA_IObject();
- virtual ~SCA_IObject();
-
- SCA_ControllerList& GetControllers()
- {
- return m_controllers;
- }
- SCA_SensorList& GetSensors()
- {
- return m_sensors;
- }
- SCA_ActuatorList& GetActuators()
- {
- return m_actuators;
- }
- SG_QList& GetActiveActuators()
- {
- return m_activeActuators;
- }
-
- void AddSensor(SCA_ISensor* act);
- void ReserveSensor(int num)
- {
- m_sensors.reserve(num);
- }
- void AddController(SCA_IController* act);
- void ReserveController(int num)
- {
- m_controllers.reserve(num);
- }
- void AddActuator(SCA_IActuator* act);
- void ReserveActuator(int num)
- {
- m_actuators.reserve(num);
- }
- void RegisterActuator(SCA_IActuator* act);
- void UnregisterActuator(SCA_IActuator* act);
-
- void RegisterObject(SCA_IObject* objs);
- void UnregisterObject(SCA_IObject* objs);
- /**
- * UnlinkObject(...)
- * this object is informed that one of the object to which it holds a reference is deleted
- * returns true if there was indeed a reference.
- */
- virtual bool UnlinkObject(SCA_IObject* clientobj) { return false; }
-
- SCA_ISensor* FindSensor(const STR_String& sensorname);
- SCA_IActuator* FindActuator(const STR_String& actuatorname);
- SCA_IController* FindController(const STR_String& controllername);
-
- void SetCurrentTime(float currentTime) {}
-
- virtual void ReParentLogic();
-
- /**
- * Set whether or not to ignore activity culling requests
- */
- void SetIgnoreActivityCulling(bool b)
- {
- m_ignore_activity_culling = b;
- }
-
- /**
- * Set whether or not this object wants to ignore activity culling
- * requests
- */
- bool GetIgnoreActivityCulling()
- {
- return m_ignore_activity_culling;
- }
-
- /**
- * Suspend all progress.
- */
- void Suspend(void);
-
- /**
- * Resume progress
- */
- void Resume(void);
-
- /**
- * Set init state
- */
- void SetInitState(unsigned int initState) { m_initState = initState; }
-
- /**
- * initialize the state when object is created
- */
- void ResetState(void) { SetState(m_initState); }
-
- /**
- * Set the object state
- */
- void SetState(unsigned int state);
-
- /**
- * Get the object state
- */
- unsigned int GetState(void) { return m_state; }
-
-// const class MT_Point3& ConvertPythonPylist(PyObject *pylist);
-
- virtual int GetGameObjectType() {return -1;}
-
- typedef enum ObjectTypes {
- OBJ_ARMATURE=0,
- OBJ_CAMERA=1,
- OBJ_LIGHT=2,
- OBJ_TEXT=3
- } ObjectTypes;
-
-};
-
-#endif /* __SCA_IOBJECT_H__ */
diff --git a/source/gameengine/GameLogic/SCA_IScene.cpp b/source/gameengine/GameLogic/SCA_IScene.cpp
deleted file mode 100644
index a1ead43a874..00000000000
--- a/source/gameengine/GameLogic/SCA_IScene.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_IScene.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_IScene.h"
-#include "EXP_Value.h"
-
-SCA_DebugProp::SCA_DebugProp(): m_obj(NULL)
-{
-}
-
-SCA_DebugProp::~SCA_DebugProp()
-{
- if (m_obj)
- m_obj->Release();
-}
-
-SCA_IScene::SCA_IScene()
-{
-}
-
-void SCA_IScene::RemoveAllDebugProperties()
-{
- for (std::vector<SCA_DebugProp*>::iterator it = m_debugList.begin();
- !(it==m_debugList.end());++it)
- {
- delete (*it);
- }
- m_debugList.clear();
-}
-
-
-SCA_IScene::~SCA_IScene()
-{
- RemoveAllDebugProperties();
-}
-
-
-std::vector<SCA_DebugProp*>& SCA_IScene::GetDebugProperties()
-{
- return m_debugList;
-}
-
-
-bool SCA_IScene::PropertyInDebugList( class CValue *gameobj, const STR_String &name )
-{
- for (std::vector<SCA_DebugProp*>::iterator it = m_debugList.begin();
- !(it==m_debugList.end());++it) {
- STR_String debugname = (*it)->m_name;
- CValue *debugobj = (*it)->m_obj;
-
- if (debugobj == gameobj && debugname == name)
- return true;
- }
- return false;
-}
-
-
-bool SCA_IScene::ObjectInDebugList( class CValue *gameobj )
-{
- for (std::vector<SCA_DebugProp*>::iterator it = m_debugList.begin();
- !(it==m_debugList.end());++it) {
- CValue* debugobj = (*it)->m_obj;
-
- if (debugobj == gameobj)
- return true;
- }
- return false;
-}
-
-
-void SCA_IScene::AddDebugProperty(class CValue* debugprop,
- const STR_String &name)
-{
- if (m_debugList.size() < DEBUG_MAX_DISPLAY) {
- SCA_DebugProp* dprop = new SCA_DebugProp();
- dprop->m_obj = debugprop;
- debugprop->AddRef();
- dprop->m_name = name;
- m_debugList.push_back(dprop);
- }
-}
-
-
-void SCA_IScene::RemoveDebugProperty(class CValue *gameobj,
- const STR_String &name)
-{
- vector<SCA_DebugProp*>::iterator it = m_debugList.begin();
- while (it != m_debugList.end()) {
- STR_String debugname = (*it)->m_name;
- CValue *debugobj = (*it)->m_obj;
-
- if (debugobj == gameobj && debugname == name) {
- delete (*it);
- m_debugList.erase(it);
- break;
- }
- ++it;
- }
-}
-
-
-void SCA_IScene::RemoveObjectDebugProperties(class CValue* gameobj)
-{
- vector<SCA_DebugProp*>::iterator it = m_debugList.begin();
- while (it != m_debugList.end()) {
- CValue* debugobj = (*it)->m_obj;
-
- if (debugobj == gameobj) {
- delete (*it);
- m_debugList.erase(it);
- continue;
- }
- ++it;
- }
-}
diff --git a/source/gameengine/GameLogic/SCA_IScene.h b/source/gameengine/GameLogic/SCA_IScene.h
deleted file mode 100644
index e08c68f63e4..00000000000
--- a/source/gameengine/GameLogic/SCA_IScene.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_IScene.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_ISCENE_H__
-#define __SCA_ISCENE_H__
-
-#include <vector>
-
-#include "STR_String.h"
-#include "RAS_2DFilterManager.h"
-
-#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
-#endif
-
-#define DEBUG_MAX_DISPLAY 100
-
-struct SCA_DebugProp
-{
- class CValue* m_obj;
- STR_String m_name;
- SCA_DebugProp();
- ~SCA_DebugProp();
-};
-
-class SCA_IScene
-{
- std::vector<SCA_DebugProp*> m_debugList;
-public:
- SCA_IScene();
- virtual ~SCA_IScene();
- virtual class SCA_IObject* AddReplicaObject(class CValue* gameobj,
- class CValue* locationobj,
- int lifespan=0)=0;
- virtual void RemoveObject(class CValue* gameobj)=0;
- virtual void DelayedRemoveObject(class CValue* gameobj)=0;
- //virtual void DelayedReleaseObject(class CValue* gameobj)=0;
-
- virtual void ReplaceMesh(class CValue* gameobj,
- void* meshobj, bool use_gfx, bool use_phys)=0;
- std::vector<SCA_DebugProp*>& GetDebugProperties();
- bool PropertyInDebugList(class CValue *gameobj, const STR_String &name);
- bool ObjectInDebugList(class CValue *gameobj);
- void RemoveAllDebugProperties();
- void AddDebugProperty(class CValue* debugprop, const STR_String &name);
- void RemoveDebugProperty(class CValue *gameobj, const STR_String &name);
- void RemoveObjectDebugProperties(class CValue* gameobj);
-
- virtual void Update2DFilter(std::vector<STR_String>& propNames, void* gameObj,
- RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode,
- int pass, STR_String& text) {}
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_IScene")
-#endif
-};
-
-#endif /* __SCA_ISCENE_H__ */
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
deleted file mode 100644
index 44fbe1d4692..00000000000
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- * Abstract class for sensor logic bricks
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_ISensor.cpp
- * \ingroup gamelogic
- */
-
-
-#include <stddef.h>
-
-#include "SCA_ISensor.h"
-#include "SCA_EventManager.h"
-#include "SCA_LogicManager.h"
-// needed for IsTriggered()
-#include "SCA_PythonController.h"
-
-#include <stdio.h>
-
-/* Native functions */
-void SCA_ISensor::ReParent(SCA_IObject* parent)
-{
- SCA_ILogicBrick::ReParent(parent);
- // will be done when the sensor is activated
- //m_eventmgr->RegisterSensor(this);
- //this->SetActive(false);
-}
-
-
-SCA_ISensor::SCA_ISensor(SCA_IObject* gameobj,
- class SCA_EventManager* eventmgr) :
- SCA_ILogicBrick(gameobj)
-{
- m_links = 0;
- m_suspended = false;
- m_invert = false;
- m_level = false;
- m_tap = false;
- m_reset = false;
- m_pos_ticks = 0;
- m_neg_ticks = 0;
- m_pos_pulsemode = false;
- m_neg_pulsemode = false;
- m_skipped_ticks = 0;
- m_state = false;
- m_prev_state = false;
-
- m_eventmgr = eventmgr;
-}
-
-
-SCA_ISensor::~SCA_ISensor()
-{
- // intentionally empty
-}
-
-void SCA_ISensor::ProcessReplica()
-{
- SCA_ILogicBrick::ProcessReplica();
- m_linkedcontrollers.clear();
-}
-
-bool SCA_ISensor::IsPositiveTrigger()
-{
- bool result = false;
-
- if (m_eventval) {
- result = (m_eventval->GetNumber() != 0.0);
- }
- if (m_invert) {
- result = !result;
- }
-
- return result;
-}
-
-void SCA_ISensor::SetPulseMode(bool posmode,
- bool negmode,
- int skippedticks)
-{
- m_pos_pulsemode = posmode;
- m_neg_pulsemode = negmode;
- m_skipped_ticks = skippedticks;
-}
-
-void SCA_ISensor::SetInvert(bool inv)
-{
- m_invert = inv;
-}
-
-void SCA_ISensor::SetLevel(bool lvl)
-{
- m_level = lvl;
-}
-
-void SCA_ISensor::SetTap(bool tap)
-{
- m_tap = tap;
-}
-
-
-double SCA_ISensor::GetNumber()
-{
- return GetState();
-}
-
-void SCA_ISensor::Suspend()
-{
- m_suspended = true;
-}
-
-bool SCA_ISensor::IsSuspended()
-{
- return m_suspended;
-}
-
-void SCA_ISensor::Resume()
-{
- m_suspended = false;
-}
-
-void SCA_ISensor::Init()
-{
- printf("Sensor %s has no init function, please report this bug to Blender.org\n", m_name.Ptr());
-}
-
-void SCA_ISensor::DecLink()
-{
- m_links--;
- if (m_links < 0)
- {
- printf("Warning: sensor %s has negative m_links: %d\n", m_name.Ptr(), m_links);
- m_links = 0;
- }
- if (!m_links)
- {
- // sensor is detached from all controllers, remove it from manager
- UnregisterToManager();
- }
-}
-
-void SCA_ISensor::RegisterToManager()
-{
- // sensor is just activated, initialize it
- Init();
- m_state = false;
- 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);
-}
-
-void SCA_ISensor::UnlinkController(SCA_IController* controller)
-{
- std::vector<class SCA_IController*>::iterator contit;
- for (contit = m_linkedcontrollers.begin();!(contit==m_linkedcontrollers.end());++contit)
- {
- if ((*contit) == controller)
- {
- *contit = m_linkedcontrollers.back();
- m_linkedcontrollers.pop_back();
- return;
- }
- }
- printf("Missing link from sensor %s:%s to controller %s:%s\n",
- m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(),
- controller->GetParent()->GetName().ReadPtr(), controller->GetName().ReadPtr());
-}
-
-void SCA_ISensor::UnlinkAllControllers()
-{
- std::vector<class SCA_IController*>::iterator contit;
- for (contit = m_linkedcontrollers.begin();!(contit==m_linkedcontrollers.end());++contit)
- {
- (*contit)->UnlinkSensor(this);
- }
- m_linkedcontrollers.clear();
-}
-
-void SCA_ISensor::UnregisterToManager()
-{
- m_eventmgr->RemoveSensor(this);
- m_links = 0;
-}
-
-void SCA_ISensor::ActivateControllers(class SCA_LogicManager* logicmgr)
-{
- for (vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin();
- c!=m_linkedcontrollers.end();++c)
- {
- SCA_IController* contr = *c;
- if (contr->IsActive())
- logicmgr->AddTriggeredController(contr, this);
- }
-}
-
-void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr)
-{
-
- // calculate if a __triggering__ is wanted
- // don't evaluate a sensor that is not connected to any controller
- if (m_links && !m_suspended) {
- bool result = this->Evaluate();
- // store the state for the rest of the logic system
- m_prev_state = m_state;
- m_state = this->IsPositiveTrigger();
- if (result) {
- // the sensor triggered this frame
- if (m_state || !m_tap) {
- ActivateControllers(logicmgr);
- // reset these counters so that pulse are synchronized with transition
- m_pos_ticks = 0;
- m_neg_ticks = 0;
- } else
- {
- result = false;
- }
- } else
- {
- /* First, the pulsing behavior, if pulse mode is
- * active. It seems something goes wrong if pulse mode is
- * not set :( */
- if (m_pos_pulsemode) {
- m_pos_ticks++;
- if (m_pos_ticks > m_skipped_ticks) {
- if ( m_state )
- {
- ActivateControllers(logicmgr);
- result = true;
- }
- m_pos_ticks = 0;
- }
- }
- // negative pulse doesn't make sense in tap mode, skip
- if (m_neg_pulsemode && !m_tap)
- {
- m_neg_ticks++;
- if (m_neg_ticks > m_skipped_ticks) {
- if (!m_state )
- {
- ActivateControllers(logicmgr);
- result = true;
- }
- m_neg_ticks = 0;
- }
- }
- }
- if (m_tap)
- {
- // in tap mode: we send always a negative pulse immediately after a positive pulse
- if (!result)
- {
- // the sensor did not trigger on this frame
- if (m_prev_state)
- {
- // but it triggered on previous frame => send a negative pulse
- ActivateControllers(logicmgr);
- result = true;
- }
- // in any case, absence of trigger means sensor off
- m_state = false;
- }
- }
- if (!result && m_level)
- {
- // This level sensor is connected to at least one controller that was just made
- // active but it did not generate an event yet, do it now to those controllers only
- for (vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin();
- c!=m_linkedcontrollers.end();++c)
- {
- SCA_IController* contr = *c;
- if (contr->IsJustActivated())
- logicmgr->AddTriggeredController(contr, this);
- }
- }
- }
-}
-
-#ifdef WITH_PYTHON
-
-/* ----------------------------------------------- */
-/* Python Functions */
-/* ----------------------------------------------- */
-
-KX_PYMETHODDEF_DOC_NOARGS(SCA_ISensor, reset,
-"reset()\n"
-"\tReset sensor internal state, effect depends on the type of sensor and settings.\n"
-"\tThe sensor is put in its initial state as if it was just activated.\n")
-{
- Init();
- m_prev_state = false;
- Py_RETURN_NONE;
-}
-
-/* ----------------------------------------------- */
-/* Python Integration Hooks */
-/* ----------------------------------------------- */
-
-PyTypeObject SCA_ISensor::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_ISensor",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_ILogicBrick::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_ISensor::Methods[] = {
- KX_PYMETHODTABLE_NOARGS(SCA_ISensor, reset),
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_ISensor::Attributes[] = {
- KX_PYATTRIBUTE_BOOL_RW("usePosPulseMode",SCA_ISensor,m_pos_pulsemode),
- KX_PYATTRIBUTE_BOOL_RW("useNegPulseMode",SCA_ISensor,m_neg_pulsemode),
- KX_PYATTRIBUTE_INT_RW("skippedTicks",0,100000,true,SCA_ISensor,m_skipped_ticks),
- KX_PYATTRIBUTE_BOOL_RW("invert",SCA_ISensor,m_invert),
- KX_PYATTRIBUTE_BOOL_RW_CHECK("level",SCA_ISensor,m_level,pyattr_check_level),
- KX_PYATTRIBUTE_BOOL_RW_CHECK("tap",SCA_ISensor,m_tap,pyattr_check_tap),
- KX_PYATTRIBUTE_RO_FUNCTION("triggered", SCA_ISensor, pyattr_get_triggered),
- KX_PYATTRIBUTE_RO_FUNCTION("positive", SCA_ISensor, pyattr_get_positive),
- KX_PYATTRIBUTE_RO_FUNCTION("status", SCA_ISensor, pyattr_get_status),
- KX_PYATTRIBUTE_RO_FUNCTION("pos_ticks", SCA_ISensor, pyattr_get_posTicks),
- KX_PYATTRIBUTE_RO_FUNCTION("neg_ticks", SCA_ISensor, pyattr_get_negTicks),
- KX_PYATTRIBUTE_RW_FUNCTION("frequency", SCA_ISensor, pyattr_get_frequency, pyattr_set_frequency),
- { NULL } //Sentinel
-};
-
-
-PyObject *SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
- bool retval = false;
- if (SCA_PythonController::m_sCurrentController)
- retval = SCA_PythonController::m_sCurrentController->IsTriggered(self);
- return PyBool_FromLong(retval);
-}
-
-PyObject *SCA_ISensor::pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
- return PyBool_FromLong(self->GetState());
-}
-
-PyObject *SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
- int status = 0;
- if (self->GetState())
- {
- if (self->GetState() == self->GetPrevState())
- {
- status = 2;
- }
- else
- {
- status = 1;
- }
- }
- else if (self->GetState() != self->GetPrevState())
- {
- status = 3;
- }
- return PyLong_FromLong(status);
-}
-
-PyObject *SCA_ISensor::pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
- return PyLong_FromLong(self->GetPosTicks());
-}
-
-PyObject *SCA_ISensor::pyattr_get_negTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
- return PyLong_FromLong(self->GetNegTicks());
-}
-
-int SCA_ISensor::pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
- if (self->m_level)
- self->m_tap = false;
- return 0;
-}
-
-int SCA_ISensor::pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
- if (self->m_tap)
- self->m_level = false;
- return 0;
-}
-
-PyObject *SCA_ISensor::pyattr_get_frequency(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_ISensor *self = static_cast<SCA_ISensor*>(self_v);
- ShowDeprecationWarning("SCA_ISensor.frequency", "SCA_ISensor.skippedTicks");
- return PyLong_FromLong(self->m_skipped_ticks);
-}
-
-int SCA_ISensor::pyattr_set_frequency(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
-{
- SCA_ISensor *self = static_cast<SCA_ISensor*>(self_v);
- ShowDeprecationWarning("SCA_ISensor.frequency", "SCA_ISensor.skippedTicks");
- if (PyLong_Check(value)) {
- self->m_skipped_ticks = PyLong_AsLong(value);
- return PY_SET_ATTR_SUCCESS;
- }
- else {
- PyErr_SetString(PyExc_TypeError, "sensor.frequency = int: Sensor, expected an integer");
- return PY_SET_ATTR_FAIL;
- }
-}
-#endif // WITH_PYTHON
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h
deleted file mode 100644
index f8276b1c79f..00000000000
--- a/source/gameengine/GameLogic/SCA_ISensor.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_ISensor.h
- * \ingroup gamelogic
- * \brief Interface Class for all logic Sensors. Implements
- * pulsemode and pulsefrequency, and event suppression.
- */
-
-#ifndef __SCA_ISENSOR_H__
-#define __SCA_ISENSOR_H__
-
-#include "SCA_IController.h"
-
-#include <vector>
-
-/**
- * Interface Class for all logic Sensors. Implements
- * pulsemode,pulsefrequency
- * Use of SG_DList element: link sensors to their respective event manager
- * Head: SCA_EventManager::m_sensors
- * Use of SG_QList element: not used
- */
-class SCA_ISensor : public SCA_ILogicBrick
-{
- Py_Header
-protected:
- class SCA_EventManager* m_eventmgr;
-
- /** Pulse positive pulses? */
- bool m_pos_pulsemode;
-
- /** Pulse negative pulses? */
- bool m_neg_pulsemode;
-
- /** Number of skipped ticks between two active pulses. */
- int m_skipped_ticks;
-
- /** Number of ticks since the last positive pulse. */
- int m_pos_ticks;
-
- /** Number of ticks since the last negative pulse. */
- int m_neg_ticks;
-
- /** invert the output signal*/
- bool m_invert;
-
- /** detect level instead of edge*/
- bool m_level;
-
- /** tap mode */
- bool m_tap;
-
- /** sensor has been reset */
- bool m_reset;
-
- /** Sensor must ignore updates? */
- bool m_suspended;
-
- /** number of connections to controller */
- int m_links;
-
- /** current sensor state */
- bool m_state;
-
- /** previous state (for tap option) */
- bool m_prev_state;
-
- std::vector<class SCA_IController*> m_linkedcontrollers;
-
-public:
-
- enum sensortype {
- ST_NONE = 0,
- ST_TOUCH,
- ST_NEAR,
- ST_RADAR,
- // to be updated as needed
- };
-
- SCA_ISensor(SCA_IObject* gameobj,
- class SCA_EventManager* eventmgr);
- ~SCA_ISensor();
- virtual void ReParent(SCA_IObject* parent);
-
- /** Because we want sensors to share some behavior, the Activate has */
- /* an implementation on this level. It requires an evaluate on the lower */
- /* level of individual sensors. Mapping the old activate()s is easy. */
- /* The IsPosTrig() also has to change, to keep things consistent. */
- void Activate(class SCA_LogicManager* logicmgr);
- virtual bool Evaluate() = 0;
- virtual bool IsPositiveTrigger();
- virtual void Init();
-
- virtual CValue* GetReplica()=0;
-
- /** Set parameters for the pulsing behavior.
- * \param posmode Trigger positive pulses?
- * \param negmode Trigger negative pulses?
- * \param freq Frequency to use when doing pulsing.
- */
- void SetPulseMode(bool posmode,
- bool negmode,
- int skippedticks);
-
- /** Set inversion of pulses on or off. */
- void SetInvert(bool inv);
- /** set the level detection on or off */
- void SetLevel(bool lvl);
- void SetTap(bool tap);
-
- virtual void RegisterToManager();
- virtual void UnregisterToManager();
- void Replace_EventManager(class SCA_LogicManager* logicmgr);
- void ReserveController(int num)
- {
- m_linkedcontrollers.reserve(num);
- }
- void LinkToController(SCA_IController* controller);
- void UnlinkController(SCA_IController* controller);
- void UnlinkAllControllers();
- void ActivateControllers(class SCA_LogicManager* logicmgr);
-
- virtual void ProcessReplica();
-
- virtual double GetNumber();
-
- virtual sensortype GetSensorType() { return ST_NONE; }
-
- /** Stop sensing for a while. */
- void Suspend();
-
- /** Is this sensor switched off? */
- bool IsSuspended();
-
- /** get the state of the sensor: positive or negative */
- bool GetState()
- {
- return m_state;
- }
-
- /** get the previous state of the sensor: positive or negative */
- bool GetPrevState()
- {
- return m_prev_state;
- }
-
- /** get the number of ticks since the last positive pulse */
- int GetPosTicks()
- {
- return m_pos_ticks;
- }
-
- /** get the number of ticks since the last negative pulse */
- int GetNegTicks()
- {
- return m_neg_ticks;
- }
-
- /** Resume sensing. */
- void Resume();
-
- void ClrLink()
- { m_links = 0; }
- void IncLink()
- { if (!m_links++) RegisterToManager(); }
- void DecLink();
- bool IsNoLink() const
- { return !m_links; }
-
-#ifdef WITH_PYTHON
- /* Python functions: */
- KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,reset);
-
- static PyObject* pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_negTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_frequency(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static int pyattr_set_frequency(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-
- static int pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static int pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-
- enum SensorStatus {
- KX_SENSOR_INACTIVE = 0,
- KX_SENSOR_JUST_ACTIVATED,
- KX_SENSOR_ACTIVE,
- KX_SENSOR_JUST_DEACTIVATED
-
- };
-#endif /* WITH_PYTHON */
-};
-
-#endif /* __SCA_ISENSOR_H__ */
diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.cpp b/source/gameengine/GameLogic/SCA_JoystickManager.cpp
deleted file mode 100644
index 780e4e9ce88..00000000000
--- a/source/gameengine/GameLogic/SCA_JoystickManager.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_JoystickManager.cpp
- * \ingroup gamelogic
- */
-
-#include "SCA_JoystickSensor.h"
-#include "SCA_JoystickManager.h"
-#include "SCA_LogicManager.h"
-//#include <vector>
-#include "SCA_ISensor.h"
-
-//using namespace std;
-
-
-SCA_JoystickManager::SCA_JoystickManager(class SCA_LogicManager* logicmgr)
- : SCA_EventManager(logicmgr, JOY_EVENTMGR)
-{
- int i;
- for (i=0; i<JOYINDEX_MAX; i++) {
- m_joystick[i] = SCA_Joystick::GetInstance( i );
- }
-}
-
-
-SCA_JoystickManager::~SCA_JoystickManager()
-{
- int i;
- for (i=0; i<JOYINDEX_MAX; i++) {
- if (m_joystick[i])
- m_joystick[i]->ReleaseInstance();
- }
-}
-
-
-void SCA_JoystickManager::NextFrame(double curtime,double deltatime)
-{
- // We should always handle events in case we want to grab them with Python
-#ifdef WITH_SDL
- SCA_Joystick::HandleEvents(); /* Handle all SDL Joystick events */
-#endif
-
- if (m_sensors.Empty()) {
- return;
- }
- else {
- ;
- SG_DList::iterator<SCA_JoystickSensor> it(m_sensors);
- for (it.begin();!it.end();++it)
- {
- SCA_JoystickSensor* joysensor = *it;
- if (!joysensor->IsSuspended())
- {
- joysensor->Activate(m_logicmgr);
- }
- }
- }
-}
-
-
-SCA_Joystick *SCA_JoystickManager::GetJoystickDevice( short int joyindex)
-{
- /*
- *Return the instance of SCA_Joystick for use
- */
- return m_joystick[joyindex];
-}
diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.h b/source/gameengine/GameLogic/SCA_JoystickManager.h
deleted file mode 100644
index bac764a08ed..00000000000
--- a/source/gameengine/GameLogic/SCA_JoystickManager.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_JoystickManager.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_JOYSTICKMANAGER_H__
-#define __SCA_JOYSTICKMANAGER_H__
-
-#include "SCA_EventManager.h"
-#include "Joystick/SCA_Joystick.h"
-#include <vector>
-
-using namespace std;
-class SCA_JoystickManager : public SCA_EventManager
-{
- /**
- * SDL Joystick Class Instance
- */
- SCA_Joystick *m_joystick[JOYINDEX_MAX];
-public:
- SCA_JoystickManager(class SCA_LogicManager* logicmgr);
- virtual ~SCA_JoystickManager();
- virtual void NextFrame(double curtime,double deltatime);
- SCA_Joystick* GetJoystickDevice(short int joyindex);
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_JoystickManager")
-#endif
-};
-
-#endif
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
deleted file mode 100644
index c98efd6db08..00000000000
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_JoystickSensor.cpp
- * \ingroup gamelogic
- */
-
-#include "SCA_JoystickManager.h"
-#include "SCA_JoystickSensor.h"
-
-#include "SCA_EventManager.h"
-#include "SCA_LogicManager.h"
-
-#include "EXP_PyObjectPlus.h"
-
-#include <stdio.h>
-#include <stddef.h>
-#include <iostream>
-
-
-
-SCA_JoystickSensor::SCA_JoystickSensor(class SCA_JoystickManager* eventmgr,
- SCA_IObject* gameobj,
- short int joyindex,
- short int joymode,
- int axis, int axisf,int prec,
- int button,
- int hat, int hatf, bool allevents)
- :SCA_ISensor(gameobj,eventmgr),
- m_axis(axis),
- m_axisf(axisf),
- m_button(button),
- m_hat(hat),
- m_hatf(hatf),
- m_precision(prec),
- m_joymode(joymode),
- m_joyindex(joyindex),
- m_bAllEvents(allevents)
-{
-/*
-std::cout << " axis " << m_axis << std::endl;
-std::cout << " axis flag " << m_axisf << std::endl;
-std::cout << " precision " << m_precision << std::endl;
-std::cout << " button " << m_button << std::endl;
-std::cout << " hat " << m_hat << std::endl;
-std::cout << " hat flag " << m_hatf << std::endl;
-*/
- Init();
-}
-
-void SCA_JoystickSensor::Init()
-{
- m_istrig=(m_invert)?1:0;
- m_istrig_prev=0;
- m_reset = true;
-}
-
-SCA_JoystickSensor::~SCA_JoystickSensor()
-{
-}
-
-
-CValue* SCA_JoystickSensor::GetReplica()
-{
- SCA_JoystickSensor* replica = new SCA_JoystickSensor(*this);
- // this will copy properties and so on...
- replica->ProcessReplica();
- replica->Init();
- return replica;
-}
-
-
-bool SCA_JoystickSensor::IsPositiveTrigger()
-{
- bool result = m_istrig;
- if (m_invert)
- result = !result;
- return result;
-}
-
-
-bool SCA_JoystickSensor::Evaluate()
-{
- SCA_Joystick *js = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex);
- bool result = false;
- bool reset = m_reset && m_level;
-
- if (js==NULL) /* no joystick - don't do anything */
- return false;
-
- m_reset = false;
-
- switch (m_joymode) {
- case KX_JOYSENSORMODE_AXIS:
- {
- /* what is what!
- * m_axisf == JOYAXIS_RIGHT, JOYAXIS_UP, JOYAXIS_DOWN, JOYAXIS_LEFT
- * m_axisf == 1 == up
- * m_axisf == 2 == left
- * m_axisf == 3 == down
- *
- * numberof== m_axis (1-4), range is half of JOYAXIS_MAX since
- * it assumes the axis joysticks are axis parirs (0,1), (2,3), etc
- * also note that this starts at 1 where functions its used
- * with expect a zero index.
- */
-
- if (!js->IsTrigAxis() && !reset) /* No events from SDL? - don't bother */
- return false;
-
- js->cSetPrecision(m_precision);
- if (m_bAllEvents) {
- if (js->aAxisPairIsPositive(m_axis-1)) { /* use zero based axis index internally */
- m_istrig = 1;
- result = true;
- }
- else {
- if (m_istrig) {
- m_istrig = 0;
- result = true;
- }
- }
- }
- else {
- if (js->aAxisPairDirectionIsPositive(m_axis-1, m_axisf)) { /* use zero based axis index internally */
- m_istrig = 1;
- result = true;
- }
- else {
- if (m_istrig) {
- m_istrig = 0;
- result = true;
- }
- }
- }
- break;
- }
- case KX_JOYSENSORMODE_AXIS_SINGLE:
- {
- /* Like KX_JOYSENSORMODE_AXIS but don't pair up axis */
- if (!js->IsTrigAxis() && !reset) /* No events from SDL? - don't bother */
- return false;
-
- /* No need for 'm_bAllEvents' check here since were only checking 1 axis */
- js->cSetPrecision(m_precision);
- if (js->aAxisIsPositive(m_axis-1)) { /* use zero based axis index internally */
- m_istrig = 1;
- result = true;
- }
- else {
- if (m_istrig) {
- m_istrig = 0;
- result = true;
- }
- }
- break;
- }
-
- case KX_JOYSENSORMODE_BUTTON:
- {
- /* what is what!
- * m_button = the actual button in question
- */
- if (!js->IsTrigButton() && !reset) /* No events from SDL? - don't bother */
- return false;
-
- if (( m_bAllEvents && js->aAnyButtonPressIsPositive()) || (!m_bAllEvents && js->aButtonPressIsPositive(m_button))) {
- m_istrig = 1;
- result = true;
- }
- else {
- if (m_istrig) {
- m_istrig = 0;
- result = true;
- }
- }
- break;
- }
- case KX_JOYSENSORMODE_HAT:
- {
- /* what is what!
- * numberof = m_hat -- max 4
- * direction= m_hatf -- max 12
- */
-
- if (!js->IsTrigHat() && !reset) /* No events from SDL? - don't bother */
- return false;
-
- if ((m_bAllEvents && js->GetHat(m_hat-1)) || js->aHatIsPositive(m_hat-1, m_hatf)) {
- m_istrig = 1;
- result = true;
- }
- else {
- if (m_istrig) {
- m_istrig = 0;
- result = true;
- }
- }
- break;
- }
- /* test for ball anyone ?*/
- default:
- printf("Error invalid switch statement\n");
- break;
- }
-
- /* if not all events are enabled, only send a positive pulse when
- * the button state changes */
- if (!m_bAllEvents) {
- if (m_istrig_prev == m_istrig) {
- result = false;
- }
- else {
- m_istrig_prev = m_istrig;
- }
- }
-
- if (reset)
- result = true;
-
- return result;
-}
-
-
-bool SCA_JoystickSensor::isValid(SCA_JoystickSensor::KX_JOYSENSORMODE m)
-{
- bool res = false;
- res = ((m > KX_JOYSENSORMODE_NODEF) && (m < KX_JOYSENSORMODE_MAX));
- return res;
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_JoystickSensor::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_JoystickSensor",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_ISensor::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_JoystickSensor::Methods[] = {
- {"getButtonActiveList",(PyCFunction) SCA_JoystickSensor::sPyGetButtonActiveList, METH_NOARGS,(const char *)GetButtonActiveList_doc},
- {"getButtonStatus",(PyCFunction) SCA_JoystickSensor::sPyGetButtonStatus, METH_VARARGS,(const char *)GetButtonStatus_doc},
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_JoystickSensor::Attributes[] = {
- KX_PYATTRIBUTE_SHORT_RW("index",0,JOYINDEX_MAX-1,true,SCA_JoystickSensor,m_joyindex),
- KX_PYATTRIBUTE_INT_RW("threshold",0,32768,true,SCA_JoystickSensor,m_precision),
- KX_PYATTRIBUTE_INT_RW("button",0,100,false,SCA_JoystickSensor,m_button),
- KX_PYATTRIBUTE_INT_LIST_RW_CHECK("axis",0,3,true,SCA_JoystickSensor,m_axis,2,CheckAxis),
- KX_PYATTRIBUTE_INT_LIST_RW_CHECK("hat",0,12,true,SCA_JoystickSensor,m_hat,2,CheckHat),
- KX_PYATTRIBUTE_RO_FUNCTION("axisValues", SCA_JoystickSensor, pyattr_get_axis_values),
- KX_PYATTRIBUTE_RO_FUNCTION("axisSingle", SCA_JoystickSensor, pyattr_get_axis_single),
- KX_PYATTRIBUTE_RO_FUNCTION("hatValues", SCA_JoystickSensor, pyattr_get_hat_values),
- KX_PYATTRIBUTE_RO_FUNCTION("hatSingle", SCA_JoystickSensor, pyattr_get_hat_single),
- KX_PYATTRIBUTE_RO_FUNCTION("numAxis", SCA_JoystickSensor, pyattr_get_num_axis),
- KX_PYATTRIBUTE_RO_FUNCTION("numButtons", SCA_JoystickSensor, pyattr_get_num_buttons),
- KX_PYATTRIBUTE_RO_FUNCTION("numHats", SCA_JoystickSensor, pyattr_get_num_hats),
- KX_PYATTRIBUTE_RO_FUNCTION("connected", SCA_JoystickSensor, pyattr_get_connected),
- { NULL } //Sentinel
-};
-
-/* get button active list -------------------------------------------------- */
-const char SCA_JoystickSensor::GetButtonActiveList_doc[] =
-"getButtonActiveList\n"
-"\tReturns a list containing the indices of the button currently pressed.\n";
-PyObject *SCA_JoystickSensor::PyGetButtonActiveList( )
-{
- SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex);
- PyObject *ls = PyList_New(0);
- PyObject *value;
- int i;
-
- if (joy) {
- for (i=0; i < joy->GetNumberOfButtons(); i++) {
- if (joy->aButtonPressIsPositive(i)) {
- value = PyLong_FromLong(i);
- PyList_Append(ls, value);
- Py_DECREF(value);
- }
- }
- }
- return ls;
-}
-
-/* get button status -------------------------------------------------- */
-const char SCA_JoystickSensor::GetButtonStatus_doc[] =
-"getButtonStatus(buttonIndex)\n"
-"\tReturns a bool of the current pressed state of the specified button.\n";
-PyObject *SCA_JoystickSensor::PyGetButtonStatus( PyObject *args )
-{
- SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex);
- int index;
-
- if (!PyArg_ParseTuple(args, "i:getButtonStatus", &index)) {
- return NULL;
- }
- if (joy && index >= 0 && index < joy->GetNumberOfButtons()) {
- return PyBool_FromLong(joy->aButtonPressIsPositive(index) ? 1 : 0);
- }
- return PyBool_FromLong(0);
-}
-
-PyObject *SCA_JoystickSensor::pyattr_get_axis_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
- SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
-
- int axis_index = (joy ? joy->GetNumberOfAxes() : 0);
- PyObject *list = PyList_New(axis_index);
-
- while (axis_index--) {
- PyList_SET_ITEM(list, axis_index, PyLong_FromLong(joy->GetAxisPosition(axis_index)));
- }
-
- return list;
-}
-
-PyObject *SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
- SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
-
- if (self->m_joymode != KX_JOYSENSORMODE_AXIS_SINGLE) {
- PyErr_SetString(PyExc_AttributeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type");
- return NULL;
- }
-
- return PyLong_FromLong(joy ? joy->GetAxisPosition(self->m_axis - 1) : 0);
-}
-
-PyObject *SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
- SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
-
- int hat_index = (joy ? joy->GetNumberOfHats() : 0);
- PyObject *list = PyList_New(hat_index);
-
- while (hat_index--) {
- PyList_SET_ITEM(list, hat_index, PyLong_FromLong(joy->GetHat(hat_index)));
- }
-
- return list;
-}
-
-PyObject *SCA_JoystickSensor::pyattr_get_hat_single(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
- SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
-
- return PyLong_FromLong(joy ? joy->GetHat(self->m_hat - 1) : 0);
-}
-
-PyObject *SCA_JoystickSensor::pyattr_get_num_axis(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
- SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
- return PyLong_FromLong( joy ? joy->GetNumberOfAxes() : 0 );
-}
-
-PyObject *SCA_JoystickSensor::pyattr_get_num_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
- SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
- return PyLong_FromLong( joy ? joy->GetNumberOfButtons() : 0 );
-}
-
-PyObject *SCA_JoystickSensor::pyattr_get_num_hats(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
- SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
- return PyLong_FromLong( joy ? joy->GetNumberOfHats() : 0 );
-}
-
-PyObject *SCA_JoystickSensor::pyattr_get_connected(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
- SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
- return PyBool_FromLong( joy ? joy->Connected() : 0 );
-}
-
-#endif
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.h b/source/gameengine/GameLogic/SCA_JoystickSensor.h
deleted file mode 100644
index 30c2d1a30c3..00000000000
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_JoystickSensor.h
- * \ingroup gamelogic
- */
-
-
-#ifndef __JOYSENSOR_H__
-#define __JOYSENSOR_H__
-
-#include "SCA_ISensor.h"
-#include "Joystick/SCA_JoystickDefines.h"
-
-class SCA_JoystickSensor :public SCA_ISensor
-{
- Py_Header
-
- /**
- * Axis 1-JOYAXIS_MAX, MUST be followed by m_axisf
- */
- int m_axis;
- /**
- * Axis flag to find direction, MUST be an int
- */
- int m_axisf;
- /**
- * The actual button
- */
- int m_button;
- /**
- * Flag for a pressed or released button
- */
- int m_buttonf;
- /**
- * The actual hat 1-JOYHAT_MAX. MUST be followed by m_hatf
- */
- int m_hat;
- /**
- * Flag to find direction 1-12, MUST be an int
- */
- int m_hatf;
- /**
- * The threshold value the axis acts upon
- */
- int m_precision;
- /**
- * Is an event triggered ?
- */
- bool m_istrig;
- /**
- * Last trigger state for this sensors joystick,
- * Otherwise it will trigger all the time
- * this is used to see if the trigger state changes.
- */
- bool m_istrig_prev;
- /**
- * The mode to determine axis,button or hat
- */
- short int m_joymode;
- /**
- * Select which joystick to use
- */
- short int m_joyindex;
-
- /**
- * Detect all events for the currently selected type
- */
- bool m_bAllEvents;
-
- enum KX_JOYSENSORMODE {
- KX_JOYSENSORMODE_NODEF = 0,
- KX_JOYSENSORMODE_AXIS,
- KX_JOYSENSORMODE_BUTTON,
- KX_JOYSENSORMODE_HAT,
- KX_JOYSENSORMODE_AXIS_SINGLE,
- KX_JOYSENSORMODE_MAX
- };
- bool isValid(KX_JOYSENSORMODE);
-
-public:
- SCA_JoystickSensor(class SCA_JoystickManager* eventmgr,
- SCA_IObject* gameobj,
- short int joyindex,
- short int joymode,
- int axis, int axisf,int prec,
- int button,
- int hat, int hatf, bool allevents);
- virtual ~SCA_JoystickSensor();
- virtual CValue* GetReplica();
-
- virtual bool Evaluate();
- virtual bool IsPositiveTrigger();
- virtual void Init();
-
- short int GetJoyIndex(void) {
- return m_joyindex;
- }
-
-#ifdef WITH_PYTHON
-
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-
- /* Joystick Index */
- KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetButtonActiveList)
- KX_PYMETHOD_DOC_VARARGS(SCA_JoystickSensor,GetButtonStatus)
-
- static PyObject* pyattr_get_axis_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_axis_single(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_hat_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_hat_single(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_num_axis(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_num_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_num_hats(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_connected(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-
-
- /* attribute check */
- static int CheckAxis(void *self, const PyAttributeDef*)
- {
- SCA_JoystickSensor* sensor = reinterpret_cast<SCA_JoystickSensor*>(self);
- if (sensor->m_axis < 1)
- sensor->m_axis = 1;
- else if (sensor->m_axis > JOYAXIS_MAX)
- sensor->m_axis = JOYAXIS_MAX;
- return 0;
- }
- static int CheckHat(void *self, const PyAttributeDef*)
- {
- SCA_JoystickSensor* sensor = reinterpret_cast<SCA_JoystickSensor*>(self);
- if (sensor->m_hat < 1)
- sensor->m_hat = 1;
- else if (sensor->m_hat > JOYHAT_MAX)
- sensor->m_hat = JOYHAT_MAX;
- return 0;
- }
-
-#endif /* WITH_PYTHON */
-
-};
-
-#endif /* __JOYSENSOR_H__ */
diff --git a/source/gameengine/GameLogic/SCA_KeyboardManager.cpp b/source/gameengine/GameLogic/SCA_KeyboardManager.cpp
deleted file mode 100644
index 1d3f81cd213..00000000000
--- a/source/gameengine/GameLogic/SCA_KeyboardManager.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Manager for keyboard events
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_KeyboardManager.cpp
- * \ingroup gamelogic
- */
-
-
-#include "EXP_BoolValue.h"
-#include "SCA_KeyboardManager.h"
-#include "SCA_KeyboardSensor.h"
-#include "EXP_IntValue.h"
-#include <vector>
-
-SCA_KeyboardManager::SCA_KeyboardManager(SCA_LogicManager* logicmgr,
- SCA_IInputDevice* inputdev)
- : SCA_EventManager(logicmgr, KEYBOARD_EVENTMGR),
- m_inputDevice(inputdev)
-{
-}
-
-
-
-SCA_KeyboardManager::~SCA_KeyboardManager()
-{
-}
-
-
-
-SCA_IInputDevice* SCA_KeyboardManager::GetInputDevice()
-{
- return m_inputDevice;
-}
-
-
-
-void SCA_KeyboardManager::NextFrame()
-{
- //const SCA_InputEvent& event = GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
-// cerr << "SCA_KeyboardManager::NextFrame"<< endl;
- SG_DList::iterator<SCA_ISensor> it(m_sensors);
- for (it.begin();!it.end();++it)
- {
- (*it)->Activate(m_logicmgr);
- }
-}
-
-bool SCA_KeyboardManager::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)
-{
- return false;
- //return m_kxsystem->IsPressed(inputcode);
-}
diff --git a/source/gameengine/GameLogic/SCA_KeyboardManager.h b/source/gameengine/GameLogic/SCA_KeyboardManager.h
deleted file mode 100644
index 5a5c8e77b21..00000000000
--- a/source/gameengine/GameLogic/SCA_KeyboardManager.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_KeyboardManager.h
- * \ingroup gamelogic
- * \brief Manager for keyboard events
- *
- */
-
-#ifndef __SCA_KEYBOARDMANAGER_H__
-#define __SCA_KEYBOARDMANAGER_H__
-
-
-#include "SCA_EventManager.h"
-
-#include <vector>
-
-using namespace std;
-
-#include "SCA_IInputDevice.h"
-
-
-class SCA_KeyboardManager : public SCA_EventManager
-{
- class SCA_IInputDevice* m_inputDevice;
-
-public:
- SCA_KeyboardManager(class SCA_LogicManager* logicmgr,class SCA_IInputDevice* inputdev);
- virtual ~SCA_KeyboardManager();
-
- bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode);
-
- virtual void NextFrame();
- SCA_IInputDevice* GetInputDevice();
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_KeyboardManager")
-#endif
-};
-
-#endif /* __SCA_KEYBOARDMANAGER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
deleted file mode 100644
index 66a5c5a2a5a..00000000000
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ /dev/null
@@ -1,668 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * Sensor for keyboard input
- */
-
-/** \file gameengine/GameLogic/SCA_KeyboardSensor.cpp
- * \ingroup gamelogic
- */
-
-
-#include <stddef.h>
-
-#include "SCA_KeyboardSensor.h"
-#include "SCA_KeyboardManager.h"
-#include "SCA_LogicManager.h"
-#include "EXP_StringValue.h"
-#include "SCA_IInputDevice.h"
-
-extern "C" {
- #include "BLI_string_utf8.h"
- #include "BLI_string_cursor_utf8.h"
-}
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_KeyboardSensor::SCA_KeyboardSensor(SCA_KeyboardManager* keybdmgr,
- short int hotkey,
- short int qual,
- short int qual2,
- bool bAllKeys,
- const STR_String& targetProp,
- const STR_String& toggleProp,
- SCA_IObject* gameobj,
- short int exitKey)
- :SCA_ISensor(gameobj,keybdmgr),
- m_hotkey(hotkey),
- m_qual(qual),
- m_qual2(qual2),
- m_bAllKeys(bAllKeys),
- m_targetprop(targetProp),
- m_toggleprop(toggleProp)
-{
- if (hotkey == exitKey)
- keybdmgr->GetInputDevice()->HookEscape();
-// SetDrawColor(0xff0000ff);
- Init();
-}
-
-
-
-SCA_KeyboardSensor::~SCA_KeyboardSensor()
-{
-}
-
-void SCA_KeyboardSensor::Init()
-{
- // this function is used when the sensor is disconnected from all controllers
- // by the state engine. It reinitializes the sensor as if it was just created.
- // However, if the target key is pressed when the sensor is reactivated, it
- // will not generated an event (see remark in Evaluate()).
- m_val = (m_invert)?1:0;
- m_reset = true;
-}
-
-CValue* SCA_KeyboardSensor::GetReplica()
-{
- SCA_KeyboardSensor* replica = new SCA_KeyboardSensor(*this);
- // this will copy properties and so on...
- replica->ProcessReplica();
- replica->Init();
- return replica;
-}
-
-
-
-short int SCA_KeyboardSensor::GetHotkey()
-{
- return m_hotkey;
-}
-
-
-
-bool SCA_KeyboardSensor::IsPositiveTrigger()
-{
- bool result = (m_val != 0);
-
- if (m_invert)
- result = !result;
-
- return result;
-}
-
-
-
-bool SCA_KeyboardSensor::TriggerOnAllKeys()
-{
- return m_bAllKeys;
-}
-
-
-
-bool SCA_KeyboardSensor::Evaluate()
-{
- bool result = false;
- bool reset = m_reset && m_level;
- bool qual = true;
- bool qual_change = false;
- short int m_val_orig = m_val;
-
- SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice();
- // 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 */
- CValue* myparent = GetParent();
- CValue* togPropState = myparent->GetProperty(m_toggleprop);
- if (togPropState &&
- (((int)togPropState->GetNumber()) != 0) )
- {
- LogKeystrokes();
- }
-
- m_reset = false;
-
- /* Now see whether events must be bounced. */
- if (m_bAllKeys)
- {
- bool justactivated = false;
- bool justreleased = false;
- bool active = false;
-
- for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++)
- {
- const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i);
- switch (inevent.m_status)
- {
- case SCA_InputEvent::KX_JUSTACTIVATED:
- justactivated = true;
- break;
- case SCA_InputEvent::KX_JUSTRELEASED:
- justreleased = true;
- break;
- case SCA_InputEvent::KX_ACTIVE:
- active = true;
- break;
- case SCA_InputEvent::KX_NO_INPUTSTATUS:
- /* do nothing */
- break;
- }
- }
-
- if (justactivated)
- {
- m_val=1;
- result = true;
- } else
- {
- if (justreleased)
- {
- m_val=(active)?1:0;
- result = true;
- } else
- {
- if (active)
- {
- if (m_val == 0)
- {
- m_val = 1;
- if (m_level) {
- result = true;
- }
- }
- } else
- {
- if (m_val == 1)
- {
- m_val = 0;
- result = true;
- }
- }
- }
- if (m_tap)
- // special case for tap mode: only generate event for new activation
- result = false;
- }
-
-
- } else
- {
-
- // cerr << "======= SCA_KeyboardSensor::Evaluate:: peeking at key status" << endl;
- const SCA_InputEvent & inevent = inputdev->GetEventValue(
- (SCA_IInputDevice::KX_EnumInputs) m_hotkey);
-
- // cerr << "======= SCA_KeyboardSensor::Evaluate:: status: " << inevent.m_status << endl;
-
-
- /* Check qualifier keys
- * - see if the qualifiers we request are pressed - 'qual' true/false
- * - see if the qualifiers we request changed their state - 'qual_change' true/false
- */
- if (m_qual > 0) {
- const SCA_InputEvent & qualevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) m_qual);
- switch (qualevent.m_status) {
- case SCA_InputEvent::KX_NO_INPUTSTATUS:
- qual = false;
- break;
- case SCA_InputEvent::KX_JUSTRELEASED:
- qual_change = true;
- qual = false;
- break;
- case SCA_InputEvent::KX_JUSTACTIVATED:
- qual_change = true;
- case SCA_InputEvent::KX_ACTIVE:
- /* do nothing */
- break;
- }
- }
- if (m_qual2 > 0 && qual==true) {
- const SCA_InputEvent & qualevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) m_qual2);
- /* copy of above */
- switch (qualevent.m_status) {
- case SCA_InputEvent::KX_NO_INPUTSTATUS:
- qual = false;
- break;
- case SCA_InputEvent::KX_JUSTRELEASED:
- qual_change = true;
- qual = false;
- break;
- case SCA_InputEvent::KX_JUSTACTIVATED:
- qual_change = true;
- case SCA_InputEvent::KX_ACTIVE:
- /* do nothing */
- break;
- }
- }
- /* done reading qualifiers */
-
- if (inevent.m_status == SCA_InputEvent::KX_NO_INPUTSTATUS)
- {
- if (m_val == 1)
- {
- // this situation may occur after a scene suspend: the keyboard release
- // event was not captured, produce now the event off
- m_val = 0;
- result = true;
- }
- } else
- {
- if (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED)
- {
- m_val=1;
- result = true;
- } else
- {
- if (inevent.m_status == SCA_InputEvent::KX_JUSTRELEASED)
- {
- m_val = 0;
- result = true;
- } else
- {
- if (inevent.m_status == SCA_InputEvent::KX_ACTIVE)
- {
- if (m_val == 0)
- {
- m_val = 1;
- if (m_level)
- {
- result = true;
- }
- }
- }
- }
- }
- }
-
- /* Modify the key state based on qual(s)
- * Tested carefully. don't touch unless your really sure.
- * note, this will only change the results if key modifiers are set.
- *
- * When all modifiers and keys are positive
- * - pulse true
- *
- * When ANY of the modifiers or main key become inactive,
- * - pulse false
- */
- if (qual==false) { /* one of the qualifiers are not pressed */
- if (m_val_orig && qual_change) { /* we were originally enabled, but a qualifier changed */
- result = true;
- } else {
- result = false;
- }
- m_val = 0; /* since one of the qualifiers is not on, set the state to false */
- } else { /* we done have any qualifiers or they are all pressed */
- if (m_val && qual_change) { /* the main key state is true and our qualifier just changed */
- result = true;
- }
- }
- /* done with key quals */
-
- }
-
- if (reset)
- // force an event
- result = true;
- return result;
-
-}
-
-void SCA_KeyboardSensor::AddToTargetProp(int keyIndex, int unicode)
-{
- if (IsPrintable(keyIndex)) {
- CValue* tprop = GetParent()->GetProperty(m_targetprop);
-
- if (IsDelete(keyIndex)) {
- /* Make a new property. Deletes can be ignored. */
- if (tprop) {
- /* overwrite the old property */
- /* strip one char, if possible */
- STR_String newprop = tprop->GetText();
- int oldlength = newprop.Length();
- if (oldlength >= 1 ) {
- int newlength=oldlength;
-
- BLI_str_cursor_step_prev_utf8(newprop, newprop.Length(), &newlength);
- newprop.SetLength(newlength);
-
- CStringValue * newstringprop = new CStringValue(newprop, m_targetprop);
- GetParent()->SetProperty(m_targetprop, newstringprop);
- newstringprop->Release();
- }
- }
- }
- else {
- char utf8_buf[7];
- size_t utf8_len;
-
- utf8_len = BLI_str_utf8_from_unicode(unicode, utf8_buf);
- utf8_buf[utf8_len] = '\0';
-
- STR_String newprop = tprop ? (tprop->GetText() + utf8_buf) : utf8_buf;
-
- CStringValue * newstringprop = new CStringValue(newprop, m_targetprop);
- GetParent()->SetProperty(m_targetprop, newstringprop);
- newstringprop->Release();
- }
- }
-}
-
-/**
- * Tests whether shift is pressed
- */
-bool SCA_KeyboardSensor::IsShifted(void)
-{
- SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice();
-
- if ( (inputdev->GetEventValue(SCA_IInputDevice::KX_RIGHTSHIFTKEY).m_status
- == SCA_InputEvent::KX_ACTIVE)
- || (inputdev->GetEventValue(SCA_IInputDevice::KX_RIGHTSHIFTKEY).m_status
- == SCA_InputEvent::KX_JUSTACTIVATED)
- || (inputdev->GetEventValue(SCA_IInputDevice::KX_LEFTSHIFTKEY).m_status
- == SCA_InputEvent::KX_ACTIVE)
- || (inputdev->GetEventValue(SCA_IInputDevice::KX_LEFTSHIFTKEY).m_status
- == SCA_InputEvent::KX_JUSTACTIVATED)
- ) {
- return true;
- }
- else {
- return false;
- }
-}
-
-void SCA_KeyboardSensor::LogKeystrokes(void)
-{
- SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice();
- int num = inputdev->GetNumActiveEvents();
-
- /* weird loop, this one... */
- if (num > 0)
- {
-
- int index = 0;
- /* Check on all keys whether they were pushed. This does not
- * 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);
- if (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED) //NO_INPUTSTATUS)
- {
- if (index < num)
- {
- AddToTargetProp(i, inevent.m_unicode);
- index++;
- }
- }
- }
- }
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python Functions */
-/* ------------------------------------------------------------------------- */
-
-KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus,
-"getKeyStatus(keycode)\n"
-"\tGet the given key's status (KX_NO_INPUTSTATUS, KX_JUSTACTIVATED, KX_ACTIVE or KX_JUSTRELEASED).\n")
-{
- if (!PyLong_Check(value)) {
- PyErr_SetString(PyExc_ValueError, "sensor.getKeyStatus(int): Keyboard Sensor, expected an int");
- return NULL;
- }
-
- SCA_IInputDevice::KX_EnumInputs keycode = (SCA_IInputDevice::KX_EnumInputs)PyLong_AsLong(value);
-
- if ((keycode < SCA_IInputDevice::KX_BEGINKEY) ||
- (keycode > SCA_IInputDevice::KX_ENDKEY))
- {
- PyErr_SetString(PyExc_AttributeError, "sensor.getKeyStatus(int): Keyboard Sensor, invalid keycode specified!");
- return NULL;
- }
-
- SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice();
- const SCA_InputEvent & inevent = inputdev->GetEventValue(keycode);
- return PyLong_FromLong(inevent.m_status);
-}
-
-/* ------------------------------------------------------------------------- */
-/* Python Integration Hooks */
-/* ------------------------------------------------------------------------- */
-
-PyTypeObject SCA_KeyboardSensor::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_KeyboardSensor",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_ISensor::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_KeyboardSensor::Methods[] = {
- KX_PYMETHODTABLE_O(SCA_KeyboardSensor, getKeyStatus),
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_KeyboardSensor::Attributes[] = {
- KX_PYATTRIBUTE_RO_FUNCTION("events", SCA_KeyboardSensor, pyattr_get_events),
- KX_PYATTRIBUTE_BOOL_RW("useAllKeys",SCA_KeyboardSensor,m_bAllKeys),
- KX_PYATTRIBUTE_INT_RW("key",0,SCA_IInputDevice::KX_ENDKEY,true,SCA_KeyboardSensor,m_hotkey),
- KX_PYATTRIBUTE_SHORT_RW("hold1",0,SCA_IInputDevice::KX_ENDKEY,true,SCA_KeyboardSensor,m_qual),
- KX_PYATTRIBUTE_SHORT_RW("hold2",0,SCA_IInputDevice::KX_ENDKEY,true,SCA_KeyboardSensor,m_qual2),
- KX_PYATTRIBUTE_STRING_RW("toggleProperty",0,MAX_PROP_NAME,false,SCA_KeyboardSensor,m_toggleprop),
- KX_PYATTRIBUTE_STRING_RW("targetProperty",0,MAX_PROP_NAME,false,SCA_KeyboardSensor,m_targetprop),
- { NULL } //Sentinel
-};
-
-
-PyObject *SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_KeyboardSensor* self = static_cast<SCA_KeyboardSensor*>(self_v);
-
- SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)self->m_eventmgr)->GetInputDevice();
-
- PyObject *resultlist = PyList_New(0);
-
- for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++)
- {
- const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i);
- if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
- {
- PyObject *keypair = PyList_New(2);
- PyList_SET_ITEM(keypair,0,PyLong_FromLong(i));
- PyList_SET_ITEM(keypair,1,PyLong_FromLong(inevent.m_status));
- PyList_Append(resultlist,keypair);
- Py_DECREF(keypair);
- }
- }
- return resultlist;
-}
-
-#endif // WITH_PYTHON
-
-/* Accessed from python */
-
-// this code looks ugly, please use an ordinary hashtable
-
-char ToCharacter(int keyIndex, bool shifted)
-{
- /* numerals */
- if ( (keyIndex >= SCA_IInputDevice::KX_ZEROKEY)
- && (keyIndex <= SCA_IInputDevice::KX_NINEKEY) ) {
- if (shifted) {
- char numshift[] = ")!@#$%^&*(";
- return numshift[keyIndex - '0'];
- } else {
- return keyIndex - SCA_IInputDevice::KX_ZEROKEY + '0';
- }
- }
-
- /* letters... always lowercase... is that desirable? */
- if ( (keyIndex >= SCA_IInputDevice::KX_AKEY)
- && (keyIndex <= SCA_IInputDevice::KX_ZKEY) ) {
- if (shifted) {
- return keyIndex - SCA_IInputDevice::KX_AKEY + 'A';
- } else {
- return keyIndex - SCA_IInputDevice::KX_AKEY + 'a';
- }
- }
-
- if (keyIndex == SCA_IInputDevice::KX_SPACEKEY) {
- return ' ';
- }
- if (keyIndex == SCA_IInputDevice::KX_RETKEY || keyIndex == SCA_IInputDevice::KX_PADENTER) {
- return '\n';
- }
-
-
- if (keyIndex == SCA_IInputDevice::KX_PADASTERKEY) {
- return '*';
- }
-
- if (keyIndex == SCA_IInputDevice::KX_TABKEY) {
- return '\t';
- }
-
- /* comma to period */
- char commatoperiod[] = ",-.";
- char commatoperiodshifted[] = "<_>";
- if (keyIndex == SCA_IInputDevice::KX_COMMAKEY) {
- if (shifted) {
- return commatoperiodshifted[0];
- } else {
- return commatoperiod[0];
- }
- }
- if (keyIndex == SCA_IInputDevice::KX_MINUSKEY) {
- if (shifted) {
- return commatoperiodshifted[1];
- } else {
- return commatoperiod[1];
- }
- }
- if (keyIndex == SCA_IInputDevice::KX_PERIODKEY) {
- if (shifted) {
- return commatoperiodshifted[2];
- } else {
- return commatoperiod[2];
- }
- }
-
- /* semicolon to rightbracket */
- char semicolontorightbracket[] = ";\'`/\\=[]";
- char semicolontorightbracketshifted[] = ":\"~\?|+{}";
- if ((keyIndex >= SCA_IInputDevice::KX_SEMICOLONKEY)
- && (keyIndex <= SCA_IInputDevice::KX_RIGHTBRACKETKEY)) {
- if (shifted) {
- return semicolontorightbracketshifted[keyIndex - SCA_IInputDevice::KX_SEMICOLONKEY];
- } else {
- return semicolontorightbracket[keyIndex - SCA_IInputDevice::KX_SEMICOLONKEY];
- }
- }
-
- /* keypad2 to padplus */
- char pad2topadplus[] = "246813579. 0- +";
- if ((keyIndex >= SCA_IInputDevice::KX_PAD2)
- && (keyIndex <= SCA_IInputDevice::KX_PADPLUSKEY)) {
- return pad2topadplus[keyIndex - SCA_IInputDevice::KX_PAD2];
- }
-
- return '!';
-}
-
-
-
-/**
- * Determine whether this character can be printed. We cannot use
- * the library functions here, because we need to test our own
- * keycodes. */
-bool IsPrintable(int keyIndex)
-{
- /* only print
- * - numerals: KX_ZEROKEY to KX_NINEKEY
- * - alphas: KX_AKEY to KX_ZKEY.
- * - specials: KX_RETKEY, KX_PADASTERKEY, KX_PADCOMMAKEY to KX_PERIODKEY,
- * KX_TABKEY, KX_SEMICOLONKEY to KX_RIGHTBRACKETKEY,
- * KX_PAD2 to KX_PADPLUSKEY
- * - delete and backspace: also printable in the sense that they modify
- * the string
- * - retkey: should this be printable?
- * - virgule: prints a space... don't know which key that's supposed
- * to be...
- */
- if ( ((keyIndex >= SCA_IInputDevice::KX_ZEROKEY)
- && (keyIndex <= SCA_IInputDevice::KX_NINEKEY))
- || ((keyIndex >= SCA_IInputDevice::KX_AKEY)
- && (keyIndex <= SCA_IInputDevice::KX_ZKEY))
- || (keyIndex == SCA_IInputDevice::KX_SPACEKEY)
- || (keyIndex == SCA_IInputDevice::KX_RETKEY)
- || (keyIndex == SCA_IInputDevice::KX_PADENTER)
- || (keyIndex == SCA_IInputDevice::KX_PADASTERKEY)
- || (keyIndex == SCA_IInputDevice::KX_TABKEY)
- || ((keyIndex >= SCA_IInputDevice::KX_COMMAKEY)
- && (keyIndex <= SCA_IInputDevice::KX_PERIODKEY))
- || ((keyIndex >= SCA_IInputDevice::KX_SEMICOLONKEY)
- && (keyIndex <= SCA_IInputDevice::KX_RIGHTBRACKETKEY))
- || ((keyIndex >= SCA_IInputDevice::KX_PAD2)
- && (keyIndex <= SCA_IInputDevice::KX_PADPLUSKEY))
- || (keyIndex == SCA_IInputDevice::KX_DELKEY)
- || (keyIndex == SCA_IInputDevice::KX_BACKSPACEKEY)
- )
- {
- return true;
- } else {
- return false;
- }
-}
-
-/**
- * Tests whether this is a delete key.
- */
-bool IsDelete(int keyIndex)
-{
- if ( (keyIndex == SCA_IInputDevice::KX_DELKEY)
- || (keyIndex == SCA_IInputDevice::KX_BACKSPACEKEY) ) {
- return true;
- } else {
- return false;
- }
-}
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.h b/source/gameengine/GameLogic/SCA_KeyboardSensor.h
deleted file mode 100644
index 0429ccf9bd1..00000000000
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_KeyboardSensor.h
- * \ingroup gamelogic
- * \brief Sensor for keyboard input
- */
-
-#ifndef __SCA_KEYBOARDSENSOR_H__
-#define __SCA_KEYBOARDSENSOR_H__
-
-#include "SCA_ISensor.h"
-#include "EXP_BoolValue.h"
-#include <list>
-
-/**
- * The keyboard sensor listens to the keyboard, and passes on events
- * on selected keystrokes. It has an alternate mode in which it logs
- * keypresses to a property. Note that these modes are not mutually
- * exclusive. */
-class SCA_KeyboardSensor : public SCA_ISensor
-{
- Py_Header
-
- /**
- * the key this sensor is sensing for
- */
- int m_hotkey;
- short int m_qual,m_qual2;
- short int m_val;
- /**
- * If this toggle is true, all incoming key events generate a
- * response.
- */
- bool m_bAllKeys;
-
- /**
- * The name of the property to which logged text is appended. If
- * this property is not defined, no logging takes place.
- */
- STR_String m_targetprop;
- /**
- * The property that indicates whether or not to log text when in
- * logging mode. If the property equals 0, no logging is done. For
- * all other values, logging is active. Logging can only become
- * active if there is a property to log to. Logging is independent
- * from hotkey settings. */
- STR_String m_toggleprop;
-
- /**
- * Log the keystrokes from the current input buffer.
- */
- void LogKeystrokes(void);
-
- /**
- * Adds this key-code to the target prop.
- */
- void AddToTargetProp(int keyIndex, int unicode);
-
- /**
- * Tests whether shift is pressed.
- */
- bool IsShifted(void);
-
-public:
- SCA_KeyboardSensor(class SCA_KeyboardManager* keybdmgr,
- short int hotkey,
- short int qual,
- short int qual2,
- bool bAllKeys,
- const STR_String& targetProp,
- const STR_String& toggleProp,
- SCA_IObject* gameobj,
- short int exitKey);
- virtual ~SCA_KeyboardSensor();
- virtual CValue* GetReplica();
- virtual void Init();
-
-
- short int GetHotkey();
- virtual bool Evaluate();
- virtual bool IsPositiveTrigger();
- bool TriggerOnAllKeys();
-
-#ifdef WITH_PYTHON
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-
- // KeyEvents:
- KX_PYMETHOD_DOC_NOARGS(SCA_KeyboardSensor,getEventList);
- // KeyStatus:
- KX_PYMETHOD_DOC_O(SCA_KeyboardSensor,getKeyStatus);
-
- static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-#endif
-};
-
-
-/**
- * Transform keycodes to something printable.
- */
-char ToCharacter(int keyIndex, bool shifted);
-
-/**
- * Determine whether this character can be printed. We cannot use
- * the library functions here, because we need to test our own
- * keycodes. */
-bool IsPrintable(int keyIndex);
-
-/**
- * Tests whether this is a delete key.
- */
-bool IsDelete(int keyIndex);
-
-
-#endif /* __SCA_KEYBOARDSENSOR_H__ */
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.cpp b/source/gameengine/GameLogic/SCA_LogicManager.cpp
deleted file mode 100644
index 0913f576d00..00000000000
--- a/source/gameengine/GameLogic/SCA_LogicManager.cpp
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * Regulates the top-level logic behavior for one scene.
- */
-
-/** \file gameengine/GameLogic/SCA_LogicManager.cpp
- * \ingroup gamelogic
- */
-
-#include "EXP_Value.h"
-#include "SCA_LogicManager.h"
-#include "SCA_ISensor.h"
-#include "SCA_IController.h"
-#include "SCA_IActuator.h"
-#include "SCA_EventManager.h"
-#include "SCA_PythonController.h"
-#include <set>
-
-
-SCA_LogicManager::SCA_LogicManager()
-{
-}
-
-
-
-SCA_LogicManager::~SCA_LogicManager()
-{
- for (vector<SCA_EventManager*>::iterator it = m_eventmanagers.begin();!(it==m_eventmanagers.end());++it)
- {
- delete (*it);
- }
- m_eventmanagers.clear();
- assert(m_activeActuators.Empty());
-}
-
-#if 0
-// this kind of fixes bug 398 but breakes games, so better leave it out for now.
-// a removed object's gameobject (and logicbricks and stuff) didn't get released
-// because it was still in the m_mapStringToGameObjects map.
-void SCA_LogicManager::RemoveGameObject(const STR_String& gameobjname)
-{
- int numgameobj = m_mapStringToGameObjects.size();
- for (int i = 0; i < numgameobj; i++)
- {
- CValue** gameobjptr = m_mapStringToGameObjects.at(i);
- assert(gameobjptr);
-
- if (gameobjptr)
- {
- if ((*gameobjptr)->GetName() == gameobjname)
- (*gameobjptr)->Release();
- }
- }
-
- m_mapStringToGameObjects.remove(gameobjname);
-}
-#endif
-
-
-void SCA_LogicManager::RegisterEventManager(SCA_EventManager* eventmgr)
-{
- m_eventmanagers.push_back(eventmgr);
-}
-
-
-
-void SCA_LogicManager::RegisterGameObjectName(const STR_String& gameobjname,
- CValue* gameobj)
-{
- STR_HashedString mn = gameobjname;
- m_mapStringToGameObjects.insert(mn,gameobj);
-}
-
-
-
-void SCA_LogicManager::RegisterGameMeshName(const STR_String& gamemeshname, void* blendobj)
-{
- STR_HashedString mn = gamemeshname;
- m_map_gamemeshname_to_blendobj.insert(mn, blendobj);
-}
-
-
-
-void SCA_LogicManager::RegisterGameObj(void* blendobj, CValue* gameobj)
-{
- m_map_blendobj_to_gameobj.insert(CHashedPtr(blendobj), gameobj);
-}
-
-void SCA_LogicManager::UnregisterGameObj(void* blendobj, CValue* gameobj)
-{
- void **obp = m_map_blendobj_to_gameobj[CHashedPtr(blendobj)];
- if (obp && (CValue*)(*obp) == gameobj)
- m_map_blendobj_to_gameobj.remove(CHashedPtr(blendobj));
-}
-
-CValue* SCA_LogicManager::GetGameObjectByName(const STR_String& gameobjname)
-{
- STR_HashedString mn = gameobjname;
- CValue** gameptr = m_mapStringToGameObjects[mn];
-
- if (gameptr)
- return *gameptr;
-
- return NULL;
-}
-
-
-CValue* SCA_LogicManager::FindGameObjByBlendObj(void* blendobj)
-{
- void **obp= m_map_blendobj_to_gameobj[CHashedPtr(blendobj)];
- return obp?(CValue*)(*obp):NULL;
-}
-
-
-
-void* SCA_LogicManager::FindBlendObjByGameMeshName(const STR_String& gamemeshname)
-{
- STR_HashedString mn = gamemeshname;
- void **obp= m_map_gamemeshname_to_blendobj[mn];
- return obp?*obp:NULL;
-}
-
-
-
-void SCA_LogicManager::RemoveSensor(SCA_ISensor* sensor)
-{
- sensor->UnlinkAllControllers();
- sensor->UnregisterToManager();
-}
-
-void SCA_LogicManager::RemoveController(SCA_IController* controller)
-{
- controller->UnlinkAllSensors();
- controller->UnlinkAllActuators();
- controller->Deactivate();
-}
-
-
-void SCA_LogicManager::RemoveActuator(SCA_IActuator* actuator)
-{
- actuator->UnlinkAllControllers();
- actuator->Deactivate();
- actuator->SetActive(false);
-}
-
-
-
-void SCA_LogicManager::RegisterToSensor(SCA_IController* controller,SCA_ISensor* sensor)
-{
- sensor->LinkToController(controller);
- controller->LinkToSensor(sensor);
-}
-
-
-
-void SCA_LogicManager::RegisterToActuator(SCA_IController* controller,SCA_IActuator* actua)
-{
- actua->LinkToController(controller);
- controller->LinkToActuator(actua);
-}
-
-
-
-void SCA_LogicManager::BeginFrame(double curtime, double fixedtime)
-{
- for (vector<SCA_EventManager*>::const_iterator ie=m_eventmanagers.begin(); !(ie==m_eventmanagers.end()); ie++)
- (*ie)->NextFrame(curtime, fixedtime);
-
- for (SG_QList* obj = (SG_QList*)m_triggeredControllerSet.Remove();
- obj != NULL;
- obj = (SG_QList*)m_triggeredControllerSet.Remove())
- {
- for (SCA_IController* contr = (SCA_IController*)obj->QRemove();
- contr != NULL;
- contr = (SCA_IController*)obj->QRemove())
- {
- contr->Trigger(this);
- contr->ClrJustActivated();
- }
- }
-}
-
-
-
-void SCA_LogicManager::UpdateFrame(double curtime, bool frame)
-{
- for (vector<SCA_EventManager*>::const_iterator ie=m_eventmanagers.begin(); !(ie==m_eventmanagers.end()); ie++)
- (*ie)->UpdateFrame();
-
- SG_DList::iterator<SG_QList> io(m_activeActuators);
- for (io.begin(); !io.end(); )
- {
- SG_QList* ahead = *io;
- // increment now so that we can remove the current element
- ++io;
- SG_QList::iterator<SCA_IActuator> ia(*ahead);
- for (ia.begin(); !ia.end(); )
- {
- SCA_IActuator* actua = *ia;
- // increment first to allow removal of inactive actuators.
- ++ia;
- if (!actua->Update(curtime, frame))
- {
- // this actuator is not active anymore, remove
- actua->QDelink();
- actua->SetActive(false);
- } else if (actua->IsNoLink())
- {
- // This actuator has no more links but it still active
- // make sure it will get a negative event on next frame to stop it
- // Do this check after Update() rather than before to make sure
- // that all the actuators that are activated at same time than a state
- // actuator have a chance to execute.
- bool event = false;
- actua->RemoveAllEvents();
- actua->AddEvent(event);
- }
- }
- if (ahead->QEmpty())
- {
- // no more active controller, remove from main list
- ahead->Delink();
- }
- }
-}
-
-
-
-void *SCA_LogicManager::GetActionByName(const STR_String& actname)
-{
- STR_HashedString an = actname;
- void** actptr = m_mapStringToActions[an];
-
- if (actptr)
- return *actptr;
-
- return NULL;
-}
-
-
-
-void* SCA_LogicManager::GetMeshByName(const STR_String& meshname)
-{
- STR_HashedString mn = meshname;
- void** meshptr = m_mapStringToMeshes[mn];
-
- if (meshptr)
- return *meshptr;
-
- return NULL;
-}
-
-
-
-void SCA_LogicManager::RegisterMeshName(const STR_String& meshname,void* mesh)
-{
- STR_HashedString mn = meshname;
- 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)
-{
- STR_HashedString an = actname;
- m_mapStringToActions.insert(an, action);
-}
-
-
-
-void SCA_LogicManager::EndFrame()
-{
- for (vector<SCA_EventManager*>::const_iterator ie=m_eventmanagers.begin();
- !(ie==m_eventmanagers.end());ie++)
- {
- (*ie)->EndFrame();
- }
-}
-
-
-void SCA_LogicManager::AddTriggeredController(SCA_IController* controller, SCA_ISensor* sensor)
-{
- controller->Activate(m_triggeredControllerSet);
-
-#ifdef WITH_PYTHON
-
- // so that the controller knows which sensor has activited it
- // only needed for python controller
- // Note that this is safe even if the controller is subclassed.
- if (controller->GetType() == &SCA_PythonController::Type)
- {
- SCA_PythonController* pythonController = (SCA_PythonController*)controller;
- pythonController->AddTriggeredSensor(sensor);
- }
-#endif
-}
-
-SCA_EventManager* SCA_LogicManager::FindEventManager(int eventmgrtype)
-{
- // find an eventmanager of a certain type
- SCA_EventManager* eventmgr = NULL;
-
- for (vector<SCA_EventManager*>::const_iterator i=
- m_eventmanagers.begin();!(i==m_eventmanagers.end());i++)
- {
- SCA_EventManager* emgr = *i;
- if (emgr->GetType() == eventmgrtype)
- {
- eventmgr = emgr;
- break;
- }
- }
- return eventmgr;
-}
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h
deleted file mode 100644
index 231af077c8e..00000000000
--- a/source/gameengine/GameLogic/SCA_LogicManager.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-/** \file SCA_LogicManager.h
- * \ingroup gamelogic
- * \brief Regulates the top-level logic behavior for one scene.
- */
-#ifndef __SCA_LOGICMANAGER_H__
-#define __SCA_LOGICMANAGER_H__
-
-#ifdef _MSC_VER
-# pragma warning (disable:4786)
-#endif
-
-#include <vector>
-//#include "CTR_Map.h"
-#include <set>
-#include <map>
-#include <list>
-
-#include "CTR_Map.h"
-#include "STR_HashedString.h"
-#include "EXP_Value.h"
-#include "SG_QList.h"
-
-#include "EXP_HashedPtr.h"
-
-using namespace std;
-typedef std::list<class SCA_IController*> controllerlist;
-typedef std::map<class SCA_ISensor*,controllerlist > sensormap_t;
-
-/**
- * This manager handles sensor, controllers and actuators.
- * logic executes each frame the following way:
- * find triggering sensors
- * build list of controllers that are triggered by these triggering sensors
- * process all triggered controllers
- * during this phase actuators can be added to the active actuator list
- * process all active actuators
- * clear triggering sensors
- * clear triggered controllers
- * (actuators may be active during a longer timeframe)
- */
-
-#include "SCA_ILogicBrick.h"
-#include "SCA_IActuator.h"
-#include "SCA_EventManager.h"
-
-
-class SCA_LogicManager
-{
- vector<class SCA_EventManager*> m_eventmanagers;
-
- // SG_DList: Head of objects having activated actuators
- // element: SCA_IObject::m_activeActuators
- SG_DList m_activeActuators;
- // SG_DList: Head of objects having activated controllers
- // element: SCA_IObject::m_activeControllers
- SG_DList m_triggeredControllerSet;
-
- // need to find better way for this
- // also known as FactoryManager...
- CTR_Map<STR_HashedString,CValue*> m_mapStringToGameObjects;
- CTR_Map<STR_HashedString,void*> m_mapStringToMeshes;
- CTR_Map<STR_HashedString,void*> m_mapStringToActions;
-
- CTR_Map<STR_HashedString,void*> m_map_gamemeshname_to_blendobj;
- CTR_Map<CHashedPtr,void*> m_map_blendobj_to_gameobj;
-public:
- SCA_LogicManager();
- virtual ~SCA_LogicManager();
-
- //void SetKeyboardManager(SCA_KeyboardManager* keyboardmgr) { m_keyboardmgr=keyboardmgr;}
- void RegisterEventManager(SCA_EventManager* eventmgr);
- void RegisterToSensor(SCA_IController* controller,
- class SCA_ISensor* sensor);
- void RegisterToActuator(SCA_IController* controller,
- class SCA_IActuator* actuator);
-
- void BeginFrame(double curtime, double fixedtime);
- void UpdateFrame(double curtime, bool frame);
- void EndFrame();
- 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);
- vector<class SCA_EventManager*> GetEventManagers() { return m_eventmanagers; }
-
- void RemoveGameObject(const STR_String& gameobjname);
-
- /**
- * remove Logic Bricks from the running logicmanager
- */
- void RemoveSensor(SCA_ISensor* sensor);
- void RemoveController(SCA_IController* controller);
- void RemoveActuator(SCA_IActuator* actuator);
-
-
- // 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);
- CTR_Map<STR_HashedString,void*>& GetMeshMap() { return m_mapStringToMeshes; }
- CTR_Map<STR_HashedString,void*>& GetActionMap() { return m_mapStringToActions; }
-
- void RegisterActionName(const STR_String& actname,void* action);
-
- void* GetActionByName (const STR_String& actname);
- void* GetMeshByName(const STR_String& meshname);
-
- void RegisterGameObjectName(const STR_String& gameobjname,CValue* gameobj);
- class CValue* GetGameObjectByName(const STR_String& gameobjname);
-
- void RegisterGameMeshName(const STR_String& gamemeshname, void* blendobj);
- void* FindBlendObjByGameMeshName(const STR_String& gamemeshname);
-
- void RegisterGameObj(void* blendobj, CValue* gameobj);
- void UnregisterGameObj(void* blendobj, CValue* gameobj);
- CValue* FindGameObjByBlendObj(void* blendobj);
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_LogicManager")
-#endif
-};
-
-#endif /* __SCA_LOGICMANAGER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_MouseManager.cpp b/source/gameengine/GameLogic/SCA_MouseManager.cpp
deleted file mode 100644
index 1842b7a9ded..00000000000
--- a/source/gameengine/GameLogic/SCA_MouseManager.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Manager for mouse events
- *
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_MouseManager.cpp
- * \ingroup gamelogic
- */
-
-
-#ifdef _MSC_VER
- /* This warning tells us about truncation of __long__ stl-generated names.
- * It can occasionally cause DevStudio to have internal compiler warnings. */
-# pragma warning( disable:4786 )
-#endif
-
-#include "EXP_BoolValue.h"
-#include "SCA_MouseManager.h"
-#include "SCA_MouseSensor.h"
-#include "EXP_IntValue.h"
-#include "RAS_ICanvas.h"
-
-
-SCA_MouseManager::SCA_MouseManager(SCA_LogicManager* logicmgr,
- SCA_IInputDevice* mousedev,
- RAS_ICanvas* canvas)
- : SCA_EventManager(logicmgr, MOUSE_EVENTMGR),
- m_mousedevice (mousedev),
- m_canvas(canvas)
-{
- m_xpos = 0;
- m_ypos = 0;
-}
-
-
-
-SCA_MouseManager::~SCA_MouseManager()
-{
-}
-
-
-
-SCA_IInputDevice* SCA_MouseManager::GetInputDevice()
-{
- return m_mousedevice;
-}
-
-
-
-void SCA_MouseManager::NextFrame()
-{
- if (m_mousedevice)
- {
- SG_DList::iterator<SCA_ISensor> it(m_sensors);
- for (it.begin();!it.end();++it)
- {
- SCA_MouseSensor* mousesensor = (SCA_MouseSensor*)(*it);
- // (0,0) is the Upper Left corner in our local window
- // coordinates
- if (!mousesensor->IsSuspended())
- {
- const SCA_InputEvent& event1 =
- m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEX);
- const SCA_InputEvent& event2 =
- m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEY);
-
- int mx = this->m_canvas->GetMouseX(event1.m_eventval);
- int my = this->m_canvas->GetMouseY(event2.m_eventval);
-
- mousesensor->setX(mx);
- mousesensor->setY(my);
-
- mousesensor->Activate(m_logicmgr);
- }
- }
- }
-}
-
-bool SCA_MouseManager::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)
-{
- /* We should guard for non-mouse events maybe? A rather silly side */
- /* effect here is that position-change events are considered presses as */
- /* well. */
-
- return m_mousedevice->IsPressed(inputcode);
-}
diff --git a/source/gameengine/GameLogic/SCA_MouseManager.h b/source/gameengine/GameLogic/SCA_MouseManager.h
deleted file mode 100644
index de932584ede..00000000000
--- a/source/gameengine/GameLogic/SCA_MouseManager.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_MouseManager.h
- * \ingroup gamelogic
- * \brief Manager for mouse events.
- *
- */
-
-
-#ifndef __SCA_MOUSEMANAGER_H__
-#define __SCA_MOUSEMANAGER_H__
-
-
-#include "SCA_EventManager.h"
-
-#include <vector>
-
-using namespace std;
-
-#include "SCA_IInputDevice.h"
-
-
-class SCA_MouseManager : public SCA_EventManager
-{
-
- class SCA_IInputDevice* m_mousedevice;
- class RAS_ICanvas* m_canvas;
-
- unsigned short m_xpos; // Cached location of the mouse pointer
- unsigned short m_ypos;
-
-public:
- SCA_MouseManager(class SCA_LogicManager* logicmgr,class SCA_IInputDevice* mousedev, class RAS_ICanvas* canvas);
- virtual ~SCA_MouseManager();
-
- /**
- * Checks whether a mouse button is depressed. Ignores requests on non-
- * mouse related events. Can also flag mouse movement.
- */
- bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode);
- virtual void NextFrame();
- SCA_IInputDevice* GetInputDevice();
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_MouseManager")
-#endif
-};
-
-#endif /* __SCA_MOUSEMANAGER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
deleted file mode 100644
index f3a5269f3d7..00000000000
--- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Sensor for mouse input
- *
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): José I. Romero (cleanup and fixes)
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_MouseSensor.cpp
- * \ingroup gamelogic
- */
-
-
-#include <stddef.h>
-
-#include "SCA_MouseSensor.h"
-#include "SCA_EventManager.h"
-#include "SCA_MouseManager.h"
-#include "SCA_LogicManager.h"
-#include "SCA_IInputDevice.h"
-#include "EXP_ConstExpr.h"
-#include <iostream>
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_MouseSensor::SCA_MouseSensor(SCA_MouseManager* eventmgr,
- int startx,int starty,
- short int mousemode,
- SCA_IObject* gameobj)
- : SCA_ISensor(gameobj,eventmgr),
- m_x(startx),
- m_y(starty)
-{
- m_mousemode = mousemode;
- m_triggermode = true;
-
- UpdateHotkey(this);
- Init();
-}
-
-void SCA_MouseSensor::Init()
-{
- m_val = (m_invert)?1:0; /* stores the latest attribute */
- m_reset = true;
-}
-
-SCA_MouseSensor::~SCA_MouseSensor()
-{
- /* Nothing to be done here. */
-}
-
-void SCA_MouseSensor::UpdateHotkey(void *self)
-{
- // gosh, this function is so damn stupid
- // its here because of a design mistake in the mouse sensor, it should only
- // have 3 trigger modes (button, wheel, move), and let the user set the
- // hotkey separately, like the other sensors. but instead it has a mode for
- // each friggin key and i have to update the hotkey based on it... genius!
- SCA_MouseSensor* sensor = reinterpret_cast<SCA_MouseSensor*>(self);
-
- switch (sensor->m_mousemode) {
- case KX_MOUSESENSORMODE_LEFTBUTTON:
- sensor->m_hotkey = SCA_IInputDevice::KX_LEFTMOUSE;
- break;
- case KX_MOUSESENSORMODE_MIDDLEBUTTON:
- sensor->m_hotkey = SCA_IInputDevice::KX_MIDDLEMOUSE;
- break;
- case KX_MOUSESENSORMODE_RIGHTBUTTON:
- sensor->m_hotkey = SCA_IInputDevice::KX_RIGHTMOUSE;
- break;
- case KX_MOUSESENSORMODE_WHEELUP:
- sensor->m_hotkey = SCA_IInputDevice::KX_WHEELUPMOUSE;
- break;
- case KX_MOUSESENSORMODE_WHEELDOWN:
- sensor->m_hotkey = SCA_IInputDevice::KX_WHEELDOWNMOUSE;
- break;
- default:
- ; /* ignore, no hotkey */
- }
-}
-
-CValue* SCA_MouseSensor::GetReplica()
-{
- SCA_MouseSensor* replica = new SCA_MouseSensor(*this);
- // this will copy properties and so on...
- replica->ProcessReplica();
- replica->Init();
-
- return replica;
-}
-
-
-
-bool SCA_MouseSensor::IsPositiveTrigger()
-{
- bool result = (m_val != 0);
- if (m_invert)
- result = !result;
-
- return result;
-}
-
-
-
-short int SCA_MouseSensor::GetModeKey()
-{
- return m_mousemode;
-}
-
-
-
-SCA_IInputDevice::KX_EnumInputs SCA_MouseSensor::GetHotKey()
-{
- return m_hotkey;
-}
-
-
-
-bool SCA_MouseSensor::Evaluate()
-{
- bool result = false;
- bool reset = m_reset && m_level;
- SCA_IInputDevice* mousedev = ((SCA_MouseManager *)m_eventmgr)->GetInputDevice();
-
- m_reset = false;
- switch (m_mousemode) {
- case KX_MOUSESENSORMODE_LEFTBUTTON:
- case KX_MOUSESENSORMODE_MIDDLEBUTTON:
- case KX_MOUSESENSORMODE_RIGHTBUTTON:
- case KX_MOUSESENSORMODE_WHEELUP:
- case KX_MOUSESENSORMODE_WHEELDOWN:
- {
- const SCA_InputEvent& mevent = mousedev->GetEventValue(m_hotkey);
- switch (mevent.m_status) {
- case SCA_InputEvent::KX_JUSTACTIVATED:
- m_val = 1;
- result = true;
- break;
- case SCA_InputEvent::KX_JUSTRELEASED:
- m_val = 0;
- result = true;
- break;
- case SCA_InputEvent::KX_ACTIVE:
- if (m_val == 0)
- {
- m_val = 1;
- if (m_level)
- result = true;
- }
- break;
- default:
- if (m_val == 1)
- {
- m_val = 0;
- result = true;
- }
- break;
- }
- break;
- }
- case KX_MOUSESENSORMODE_MOVEMENT:
- {
- const SCA_InputEvent& eventX = mousedev->GetEventValue(SCA_IInputDevice::KX_MOUSEX);
- const SCA_InputEvent& eventY = mousedev->GetEventValue(SCA_IInputDevice::KX_MOUSEY);
-
- if (eventX.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
- eventY.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
- eventX.m_status == SCA_InputEvent::KX_ACTIVE ||
- eventY.m_status == SCA_InputEvent::KX_ACTIVE)
- {
- m_val = 1;
- result = true;
- }
- else if (eventX.m_status == SCA_InputEvent::KX_JUSTRELEASED ||
- eventY.m_status == SCA_InputEvent::KX_JUSTRELEASED )
- {
- m_val = 0;
- result = true;
- }
- else// KX_NO_INPUTSTATUS
- {
- if (m_val == 1)
- {
- m_val = 0;
- result = true;
- }
- }
-
- break;
- }
- default:
- ; /* error */
- }
-
- if (reset)
- // force an event
- result = true;
- return result;
-}
-
-void SCA_MouseSensor::setX(short x)
-{
- m_x = x;
-}
-
-void SCA_MouseSensor::setY(short y)
-{
- m_y = y;
-}
-
-bool SCA_MouseSensor::isValid(SCA_MouseSensor::KX_MOUSESENSORMODE m)
-{
- return ((m > KX_MOUSESENSORMODE_NODEF) && (m < KX_MOUSESENSORMODE_MAX));
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
-"getButtonStatus(button)\n"
-"\tGet the given button's status (KX_INPUT_NONE, KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED).\n")
-{
- if (PyLong_Check(value))
- {
- SCA_IInputDevice::KX_EnumInputs button = (SCA_IInputDevice::KX_EnumInputs)PyLong_AsLong(value);
-
- if ((button < SCA_IInputDevice::KX_LEFTMOUSE) ||
- (button > SCA_IInputDevice::KX_RIGHTMOUSE))
- {
- PyErr_SetString(PyExc_ValueError, "sensor.getButtonStatus(int): Mouse Sensor, invalid button specified!");
- return NULL;
- }
-
- SCA_IInputDevice* mousedev = ((SCA_MouseManager *)m_eventmgr)->GetInputDevice();
- const SCA_InputEvent& event = mousedev->GetEventValue(button);
- return PyLong_FromLong(event.m_status);
- }
-
- Py_RETURN_NONE;
-}
-
-/* ------------------------------------------------------------------------- */
-/* Python Integration Hooks */
-/* ------------------------------------------------------------------------- */
-
-PyTypeObject SCA_MouseSensor::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_MouseSensor",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_ISensor::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_MouseSensor::Methods[] = {
- KX_PYMETHODTABLE_O(SCA_MouseSensor, getButtonStatus),
- {NULL,NULL} //Sentinel
-};
-
-int SCA_MouseSensor::UpdateHotkeyPy(void *self, const PyAttributeDef*)
-{
- UpdateHotkey(self);
- // return value is used in py_setattro(),
- // 0=attribute checked ok (see Attributes array definition)
- return 0;
-}
-
-PyAttributeDef SCA_MouseSensor::Attributes[] = {
- KX_PYATTRIBUTE_SHORT_RW_CHECK("mode",KX_MOUSESENSORMODE_NODEF,KX_MOUSESENSORMODE_MAX-1,true,SCA_MouseSensor,m_mousemode,UpdateHotkeyPy),
- KX_PYATTRIBUTE_SHORT_LIST_RO("position",SCA_MouseSensor,m_x,2),
- { NULL } //Sentinel
-};
-
-#endif // WITH_PYTHON
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.h b/source/gameengine/GameLogic/SCA_MouseSensor.h
deleted file mode 100644
index 53785fa40da..00000000000
--- a/source/gameengine/GameLogic/SCA_MouseSensor.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): José I. Romero (cleanup and fixes)
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_MouseSensor.h
- * \ingroup gamelogic
- * \brief Senses mouse events
- */
-
-#ifndef __SCA_MOUSESENSOR_H__
-#define __SCA_MOUSESENSOR_H__
-
-#include "SCA_ISensor.h"
-#include "EXP_BoolValue.h"
-#include "SCA_IInputDevice.h"
-
-class SCA_MouseSensor : public SCA_ISensor
-{
- Py_Header
-
- /**
- * Use SCA_IInputDevice values to encode the mouse mode for now.
- */
- short int m_mousemode;
- /**
- * Triggermode true means all mouse events trigger. Useful mainly
- * for button presses.
- */
- bool m_triggermode;
- /**
- * Remember the last state update
- */
- int m_val;
-
- SCA_IInputDevice::KX_EnumInputs m_hotkey;
-
- /**
- * valid x coordinate, MUST be followed by y coordinate
- */
- short m_x;
-
- /**
- * valid y coordinate
- */
- short m_y;
-
- public:
- /**
- * Allowable modes for the trigger status of the mouse sensor.
- */
- enum KX_MOUSESENSORMODE {
- KX_MOUSESENSORMODE_NODEF = 0,
- KX_MOUSESENSORMODE_LEFTBUTTON,
- KX_MOUSESENSORMODE_MIDDLEBUTTON,
- KX_MOUSESENSORMODE_RIGHTBUTTON,
- KX_MOUSESENSORMODE_WHEELUP,
- KX_MOUSESENSORMODE_WHEELDOWN,
- KX_MOUSESENSORMODE_POSITION,
- KX_MOUSESENSORMODE_POSITIONX,
- KX_MOUSESENSORMODE_POSITIONY,
- KX_MOUSESENSORMODE_MOVEMENT,
- KX_MOUSESENSORMODE_MAX
- };
-
- bool isValid(KX_MOUSESENSORMODE);
-
- SCA_MouseSensor(class SCA_MouseManager* keybdmgr,
- int startx,int starty,
- short int mousemode,
- SCA_IObject* gameobj);
-
- virtual ~SCA_MouseSensor();
- virtual CValue* GetReplica();
- virtual bool Evaluate();
- virtual void Init();
- virtual bool IsPositiveTrigger();
- short int GetModeKey();
- SCA_IInputDevice::KX_EnumInputs GetHotKey();
- void setX(short x);
- void setY(short y);
-
- static void UpdateHotkey(void *self);
-
-
-#ifdef WITH_PYTHON
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-
- static int UpdateHotkeyPy(void *self, const PyAttributeDef *);
-
- // get button status
- KX_PYMETHOD_DOC_O(SCA_MouseSensor,getButtonStatus);
-#endif
-};
-
-#endif /* __SCA_MOUSESENSOR_H__ */
diff --git a/source/gameengine/GameLogic/SCA_NANDController.cpp b/source/gameengine/GameLogic/SCA_NANDController.cpp
deleted file mode 100644
index ce98c8a5d7c..00000000000
--- a/source/gameengine/GameLogic/SCA_NANDController.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 'Nand' together all inputs
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_NANDController.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_NANDController.h"
-#include "SCA_ISensor.h"
-#include "SCA_LogicManager.h"
-#include "EXP_BoolValue.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_NANDController::SCA_NANDController(SCA_IObject* gameobj)
- :
- SCA_IController(gameobj)
-{
-}
-
-
-
-SCA_NANDController::~SCA_NANDController()
-{
-}
-
-
-
-void SCA_NANDController::Trigger(SCA_LogicManager* logicmgr)
-{
-
- bool sensorresult = false;
-
- for (vector<SCA_ISensor*>::const_iterator is=m_linkedsensors.begin();
- !(is==m_linkedsensors.end());is++)
- {
- SCA_ISensor* sensor = *is;
- if (!sensor->GetState())
- {
- sensorresult = true;
- break;
- }
- }
-
- for (vector<SCA_IActuator*>::const_iterator i=m_linkedactuators.begin();
- !(i==m_linkedactuators.end());i++)
- {
- SCA_IActuator* actua = *i;
- logicmgr->AddActiveActuator(actua,sensorresult);
- }
-}
-
-
-
-CValue* SCA_NANDController::GetReplica()
-{
- CValue* replica = new SCA_NANDController(*this);
- // this will copy properties and so on...
- replica->ProcessReplica();
-
- return replica;
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_NANDController::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_NANDController",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_IController::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_NANDController::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_NANDController::Attributes[] = {
- { NULL } //Sentinel
-};
-
-#endif
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_NANDController.h b/source/gameengine/GameLogic/SCA_NANDController.h
deleted file mode 100644
index a3f02908dd2..00000000000
--- a/source/gameengine/GameLogic/SCA_NANDController.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_NANDController.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_NANDCONTROLLER_H__
-#define __SCA_NANDCONTROLLER_H__
-
-#include "SCA_IController.h"
-
-class SCA_NANDController : public SCA_IController
-{
- Py_Header
- //virtual void Trigger(class SCA_LogicManager* logicmgr);
-public:
- SCA_NANDController(SCA_IObject* gameobj);
- virtual ~SCA_NANDController();
- virtual CValue* GetReplica();
- virtual void Trigger(SCA_LogicManager* logicmgr);
-
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-};
-
-#endif /* __SCA_NANDCONTROLLER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_NORController.cpp b/source/gameengine/GameLogic/SCA_NORController.cpp
deleted file mode 100644
index 16a82a6d23e..00000000000
--- a/source/gameengine/GameLogic/SCA_NORController.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 'Nor' together all inputs
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_NORController.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_NORController.h"
-#include "SCA_ISensor.h"
-#include "SCA_LogicManager.h"
-#include "EXP_BoolValue.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_NORController::SCA_NORController(SCA_IObject* gameobj)
- :
- SCA_IController(gameobj)
-{
-}
-
-
-
-SCA_NORController::~SCA_NORController()
-{
-}
-
-
-
-void SCA_NORController::Trigger(SCA_LogicManager* logicmgr)
-{
-
- bool sensorresult = true;
-
- for (vector<SCA_ISensor*>::const_iterator is=m_linkedsensors.begin();
- !(is==m_linkedsensors.end());is++)
- {
- SCA_ISensor* sensor = *is;
- if (sensor->GetState())
- {
- sensorresult = false;
- break;
- }
- }
-
- for (vector<SCA_IActuator*>::const_iterator i=m_linkedactuators.begin();
- !(i==m_linkedactuators.end());i++)
- {
- SCA_IActuator* actua = *i;
- logicmgr->AddActiveActuator(actua,sensorresult);
- }
-}
-
-
-
-CValue* SCA_NORController::GetReplica()
-{
- CValue* replica = new SCA_NORController(*this);
- // this will copy properties and so on...
- replica->ProcessReplica();
-
- return replica;
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_NORController::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_NORController",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_IController::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_NORController::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_NORController::Attributes[] = {
- { NULL } //Sentinel
-};
-
-#endif // WITH_PYTHON
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_NORController.h b/source/gameengine/GameLogic/SCA_NORController.h
deleted file mode 100644
index ec8159de8d1..00000000000
--- a/source/gameengine/GameLogic/SCA_NORController.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_NORController.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_NORCONTROLLER_H__
-#define __SCA_NORCONTROLLER_H__
-
-#include "SCA_IController.h"
-
-class SCA_NORController : public SCA_IController
-{
- Py_Header
- //virtual void Trigger(class SCA_LogicManager* logicmgr);
-public:
- SCA_NORController(SCA_IObject* gameobj);
- virtual ~SCA_NORController();
- virtual CValue* GetReplica();
- virtual void Trigger(SCA_LogicManager* logicmgr);
-};
-
-#endif /* __SCA_NORCONTROLLER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_ORController.cpp b/source/gameengine/GameLogic/SCA_ORController.cpp
deleted file mode 100644
index f758c096cc0..00000000000
--- a/source/gameengine/GameLogic/SCA_ORController.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 'Or' together all inputs
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_ORController.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_ORController.h"
-#include "SCA_ISensor.h"
-#include "SCA_LogicManager.h"
-#include "EXP_BoolValue.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_ORController::SCA_ORController(SCA_IObject* gameobj)
- :SCA_IController(gameobj)
-{
-}
-
-
-
-SCA_ORController::~SCA_ORController()
-{
-}
-
-
-
-CValue* SCA_ORController::GetReplica()
-{
- CValue* replica = new SCA_ORController(*this);
- // this will copy properties and so on...
- replica->ProcessReplica();
-
- return replica;
-}
-
-
-void SCA_ORController::Trigger(SCA_LogicManager* logicmgr)
-{
-
- bool sensorresult = false;
- SCA_ISensor* sensor;
-
- vector<SCA_ISensor*>::const_iterator is=m_linkedsensors.begin();
- while ( (!sensorresult) && (!(is==m_linkedsensors.end())) )
- {
- sensor = *is;
- if (sensor->GetState()) sensorresult = true;
- is++;
- }
-
- for (vector<SCA_IActuator*>::const_iterator i=m_linkedactuators.begin();
- !(i==m_linkedactuators.end());i++)
- {
- SCA_IActuator* actua = *i;
- logicmgr->AddActiveActuator(actua,sensorresult);
- }
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_ORController::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_ORController",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_IController::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_ORController::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_ORController::Attributes[] = {
- { NULL } //Sentinel
-};
-
-#endif // WITH_PYTHON
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_ORController.h b/source/gameengine/GameLogic/SCA_ORController.h
deleted file mode 100644
index 9499c893c72..00000000000
--- a/source/gameengine/GameLogic/SCA_ORController.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_ORController.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_ORCONTROLLER_H__
-#define __SCA_ORCONTROLLER_H__
-
-#include "SCA_IController.h"
-
-class SCA_ORController : public SCA_IController
-{
- Py_Header
- //virtual void Trigger(class SCA_LogicManager* logicmgr);
-public:
- SCA_ORController(SCA_IObject* gameobj);
-
- virtual ~SCA_ORController();
- virtual CValue* GetReplica();
- virtual void Trigger(SCA_LogicManager* logicmgr);
-};
-
-#endif /* __SCA_ORCONTROLLER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
deleted file mode 100644
index 87b0503ede8..00000000000
--- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Assign, change, copy properties
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_PropertyActuator.cpp
- * \ingroup gamelogic
- */
-
-
-#include <stddef.h>
-
-#include "SCA_PropertyActuator.h"
-#include "EXP_InputParser.h"
-#include "EXP_Operator2Expr.h"
-#include "EXP_ConstExpr.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_PropertyActuator::SCA_PropertyActuator(SCA_IObject* gameobj,SCA_IObject* sourceObj,const STR_String& propname,const STR_String& expr,int acttype)
- : SCA_IActuator(gameobj, KX_ACT_PROPERTY),
- m_type(acttype),
- m_propname(propname),
- m_exprtxt(expr),
- m_sourceObj(sourceObj)
-{
- // protect ourselves against someone else deleting the source object
- // don't protect against ourselves: it would create a dead lock
- if (m_sourceObj)
- m_sourceObj->RegisterActuator(this);
-}
-
-SCA_PropertyActuator::~SCA_PropertyActuator()
-{
- if (m_sourceObj)
- m_sourceObj->UnregisterActuator(this);
-}
-
-bool SCA_PropertyActuator::Update()
-{
- bool result = false;
-
- bool bNegativeEvent = IsNegativeEvent();
- RemoveAllEvents();
- CValue* propowner = GetParent();
-
- if (bNegativeEvent)
- {
- if (m_type==KX_ACT_PROP_LEVEL)
- {
- CValue* newval = new CBoolValue(false);
- CValue* oldprop = propowner->GetProperty(m_propname);
- if (oldprop)
- {
- oldprop->SetValue(newval);
- }
- newval->Release();
- }
- return false;
- }
-
-
- CParser parser;
- parser.SetContext( propowner->AddRef());
-
- CExpression* userexpr= NULL;
-
- if (m_type==KX_ACT_PROP_TOGGLE)
- {
- /* don't use */
- CValue* newval;
- CValue* oldprop = propowner->GetProperty(m_propname);
- if (oldprop)
- {
- newval = new CBoolValue((oldprop->GetNumber()==0.0) ? true:false);
- oldprop->SetValue(newval);
- } else
- { /* as not been assigned, evaluate as false, so assign true */
- newval = new CBoolValue(true);
- propowner->SetProperty(m_propname,newval);
- }
- newval->Release();
- }
- else if (m_type==KX_ACT_PROP_LEVEL)
- {
- CValue* newval = new CBoolValue(true);
- CValue* oldprop = propowner->GetProperty(m_propname);
- if (oldprop)
- {
- oldprop->SetValue(newval);
- } else
- {
- propowner->SetProperty(m_propname,newval);
- }
- newval->Release();
- }
- else if ((userexpr = parser.ProcessText(m_exprtxt))) {
- switch (m_type)
- {
-
- case KX_ACT_PROP_ASSIGN:
- {
-
- CValue* newval = userexpr->Calculate();
- CValue* oldprop = propowner->GetProperty(m_propname);
- if (oldprop)
- {
- oldprop->SetValue(newval);
- } else
- {
- propowner->SetProperty(m_propname,newval);
- }
- newval->Release();
- break;
- }
- case KX_ACT_PROP_ADD:
- {
- CValue* oldprop = propowner->GetProperty(m_propname);
- if (oldprop)
- {
- // int waarde = (int)oldprop->GetNumber(); /*unused*/
- CExpression* expr = new COperator2Expr(VALUE_ADD_OPERATOR,new CConstExpr(oldprop->AddRef()),
- userexpr->AddRef());
-
- CValue* newprop = expr->Calculate();
- oldprop->SetValue(newprop);
- newprop->Release();
- expr->Release();
-
- }
-
- break;
- }
- case KX_ACT_PROP_COPY:
- {
- if (m_sourceObj)
- {
- CValue* copyprop = m_sourceObj->GetProperty(m_exprtxt);
- if (copyprop)
- {
- CValue *val = copyprop->GetReplica();
- GetParent()->SetProperty(
- m_propname,
- val);
- val->Release();
-
- }
- }
- break;
- }
- /* case KX_ACT_PROP_TOGGLE: */ /* accounted for above, no need for userexpr */
- default:
- {
-
- }
- }
-
- userexpr->Release();
- }
-
- return result;
-}
-
- bool
-
-SCA_PropertyActuator::
-
-isValid(
-
- SCA_PropertyActuator::KX_ACT_PROP_MODE mode
-
-) {
- bool res = false;
- res = ((mode > KX_ACT_PROP_NODEF) && (mode < KX_ACT_PROP_MAX));
- return res;
-}
-
-
- CValue*
-
-SCA_PropertyActuator::
-
-GetReplica()
-{
-
- SCA_PropertyActuator* replica = new SCA_PropertyActuator(*this);
-
- replica->ProcessReplica();
- return replica;
-
-};
-
-void SCA_PropertyActuator::ProcessReplica()
-{
- // no need to check for self reference like in the constructor:
- // the replica will always have a different parent
- if (m_sourceObj)
- m_sourceObj->RegisterActuator(this);
- SCA_IActuator::ProcessReplica();
-}
-
-bool SCA_PropertyActuator::UnlinkObject(SCA_IObject* clientobj)
-{
- if (clientobj == m_sourceObj)
- {
- // this object is being deleted, we cannot continue to track it.
- m_sourceObj = NULL;
- return true;
- }
- return false;
-}
-
-void SCA_PropertyActuator::Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map)
-{
- void **h_obj = (*obj_map)[m_sourceObj];
- if (h_obj) {
- if (m_sourceObj)
- m_sourceObj->UnregisterActuator(this);
- m_sourceObj = (SCA_IObject*)(*h_obj);
- m_sourceObj->RegisterActuator(this);
- }
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_PropertyActuator::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_PropertyActuator",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_IActuator::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_PropertyActuator::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_PropertyActuator::Attributes[] = {
- KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,MAX_PROP_NAME,false,SCA_PropertyActuator,m_propname,CheckProperty),
- KX_PYATTRIBUTE_STRING_RW("value",0,100,false,SCA_PropertyActuator,m_exprtxt),
- KX_PYATTRIBUTE_INT_RW("mode", KX_ACT_PROP_NODEF+1, KX_ACT_PROP_MAX-1, false, SCA_PropertyActuator, m_type), /* ATTR_TODO add constents to game logic dict */
- { NULL } //Sentinel
-};
-
-#endif
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.h b/source/gameengine/GameLogic/SCA_PropertyActuator.h
deleted file mode 100644
index 57483bd0e05..00000000000
--- a/source/gameengine/GameLogic/SCA_PropertyActuator.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_PropertyActuator.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_PROPERTYACTUATOR_H__
-#define __SCA_PROPERTYACTUATOR_H__
-
-#include "SCA_IActuator.h"
-
-class SCA_PropertyActuator : public SCA_IActuator
-{
- Py_Header
-
- enum KX_ACT_PROP_MODE {
- KX_ACT_PROP_NODEF = 0,
- KX_ACT_PROP_ASSIGN,
- KX_ACT_PROP_ADD,
- KX_ACT_PROP_COPY,
- KX_ACT_PROP_TOGGLE,
- KX_ACT_PROP_LEVEL,
- KX_ACT_PROP_MAX
- };
-
- /**check whether this value is valid */
- bool isValid(KX_ACT_PROP_MODE mode);
-
- int m_type;
- STR_String m_propname;
- STR_String m_exprtxt;
- SCA_IObject* m_sourceObj; // for copy property actuator
-
-public:
-
-
-
- SCA_PropertyActuator(
- SCA_IObject* gameobj,
- SCA_IObject* sourceObj,
- const STR_String& propname,
- const STR_String& expr,
- int acttype);
-
-
- ~SCA_PropertyActuator();
-
- CValue*
- GetReplica(
- );
-
- virtual void ProcessReplica();
- virtual bool UnlinkObject(SCA_IObject* clientobj);
- virtual void Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map);
-
- virtual bool
- Update();
-
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-
-};
-
-#endif /* __KX_PROPERTYACTUATOR_DOC */
diff --git a/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp b/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp
deleted file mode 100644
index 854069690da..00000000000
--- a/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_PropertyEventManager.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_ISensor.h"
-#include "SCA_PropertyEventManager.h"
-
-
-SCA_PropertyEventManager::SCA_PropertyEventManager(class SCA_LogicManager* logicmgr)
- : SCA_EventManager(logicmgr, PROPERTY_EVENTMGR)
-{
-}
-
-
-
-SCA_PropertyEventManager::~SCA_PropertyEventManager()
-{
-
-}
-
-void SCA_PropertyEventManager::NextFrame()
-{
- // check for changed properties
- SG_DList::iterator<SCA_ISensor> it(m_sensors);
- for (it.begin();!it.end();++it)
- {
- (*it)->Activate(m_logicmgr);
- }
-}
diff --git a/source/gameengine/GameLogic/SCA_PropertyEventManager.h b/source/gameengine/GameLogic/SCA_PropertyEventManager.h
deleted file mode 100644
index 554fe686df2..00000000000
--- a/source/gameengine/GameLogic/SCA_PropertyEventManager.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_PropertyEventManager.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_PROPERTYEVENTMANAGER_H__
-#define __SCA_PROPERTYEVENTMANAGER_H__
-
-#include "SCA_EventManager.h"
-
-#include <vector>
-
-using namespace std;
-
-class SCA_PropertyEventManager : public SCA_EventManager
-{
-public:
- SCA_PropertyEventManager(class SCA_LogicManager* logicmgr);
- virtual ~SCA_PropertyEventManager();
- virtual void NextFrame();
- //SCA_LogicManager* GetLogicManager() { return m_logicmgr;}
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_PropertyEventManager")
-#endif
-};
-
-#endif /* __SCA_PROPERTYEVENTMANAGER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
deleted file mode 100644
index f823320a417..00000000000
--- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Property sensor
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_PropertySensor.cpp
- * \ingroup gamelogic
- */
-
-
-#include <stddef.h>
-
-#include <iostream>
-#include "SCA_PropertySensor.h"
-#include "EXP_Operator2Expr.h"
-#include "EXP_ConstExpr.h"
-#include "EXP_InputParser.h"
-#include "EXP_StringValue.h"
-#include "SCA_EventManager.h"
-#include "SCA_LogicManager.h"
-#include "EXP_BoolValue.h"
-#include "EXP_FloatValue.h"
-#include <stdio.h>
-
-SCA_PropertySensor::SCA_PropertySensor(SCA_EventManager* eventmgr,
- SCA_IObject* gameobj,
- const STR_String& propname,
- const STR_String& propval,
- const STR_String& propmaxval,
- KX_PROPSENSOR_TYPE checktype)
- : SCA_ISensor(gameobj,eventmgr),
- m_checktype(checktype),
- m_checkpropval(propval),
- m_checkpropmaxval(propmaxval),
- m_checkpropname(propname)
-{
- //CParser pars;
- //pars.SetContext(this->AddRef());
- //CValue* resultval = m_rightexpr->Calculate();
-
- CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname);
- if (!orgprop->IsError())
- {
- m_previoustext = orgprop->GetText();
- }
- orgprop->Release();
-
- Init();
-}
-
-void SCA_PropertySensor::Init()
-{
- m_recentresult = false;
- m_lastresult = m_invert?true:false;
- m_reset = true;
-}
-
-CValue* SCA_PropertySensor::GetReplica()
-{
- SCA_PropertySensor* replica = new SCA_PropertySensor(*this);
- // m_range_expr must be recalculated on replica!
- replica->ProcessReplica();
- replica->Init();
-
- return replica;
-}
-
-
-
-bool SCA_PropertySensor::IsPositiveTrigger()
-{
- bool result = m_recentresult;//CheckPropertyCondition();
- if (m_invert)
- result = !result;
-
- return result;
-}
-
-
-
-SCA_PropertySensor::~SCA_PropertySensor()
-{
-}
-
-
-
-bool SCA_PropertySensor::Evaluate()
-{
- bool result = CheckPropertyCondition();
- bool reset = m_reset && m_level;
-
- m_reset = false;
- if (m_lastresult!=result)
- {
- m_lastresult = result;
- return true;
- }
- return (reset) ? true : false;
-}
-
-
-bool SCA_PropertySensor::CheckPropertyCondition()
-{
- m_recentresult=false;
- bool result=false;
- bool reverse = false;
- switch (m_checktype)
- {
- case KX_PROPSENSOR_NOTEQUAL:
- reverse = true;
- ATTR_FALLTHROUGH;
- case KX_PROPSENSOR_EQUAL:
- {
- CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname);
- if (!orgprop->IsError())
- {
- const STR_String& testprop = orgprop->GetText();
- // Force strings to upper case, to avoid confusion in
- // bool tests. It's stupid the prop's identity is lost
- // on the way here...
- if ((&testprop == &CBoolValue::sTrueString) || (&testprop == &CBoolValue::sFalseString)) {
- m_checkpropval.Upper();
- }
- result = (testprop == m_checkpropval);
-
- /* Patch: floating point values cant use strings usefully since you can have "0.0" == "0.0000"
- * this could be made into a generic Value class function for comparing values with a string.
- */
- if (result==false && (orgprop->GetValueType() == VALUE_FLOAT_TYPE)) {
- float f;
- if (sscanf(m_checkpropval.ReadPtr(), "%f", &f) == 1) {
- result = (f == ((CFloatValue *)orgprop)->GetFloat());
- }
- else {
- /* error */
- }
- }
- /* end patch */
- }
- orgprop->Release();
-
- if (reverse)
- result = !result;
- break;
-
- }
-
- case KX_PROPSENSOR_EXPRESSION:
- {
-#if 0
- if (m_rightexpr)
- {
- CValue* resultval = m_rightexpr->Calculate();
- if (resultval->IsError())
- {
- int i=0;
- STR_String errortest = resultval->GetText();
- printf(errortest);
-
- } else
- {
- result = resultval->GetNumber() != 0;
- }
- }
-#endif
- break;
- }
- case KX_PROPSENSOR_INTERVAL:
- {
- CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname);
- if (!orgprop->IsError())
- {
- const float min = m_checkpropval.ToFloat();
- const float max = m_checkpropmaxval.ToFloat();
- float val;
-
- if (orgprop->GetValueType() == VALUE_STRING_TYPE) {
- val = orgprop->GetText().ToFloat();
- }
- else {
- val = orgprop->GetNumber();
- }
-
- result = (min <= val) && (val <= max);
- }
- orgprop->Release();
-
- break;
- }
- case KX_PROPSENSOR_CHANGED:
- {
- CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname);
-
- if (!orgprop->IsError())
- {
- if (m_previoustext != orgprop->GetText())
- {
- m_previoustext = orgprop->GetText();
- result = true;
- }
- }
- orgprop->Release();
-
- //cout << " \nSens:Prop:changed!"; /* need implementation here!!! */
- break;
- }
- case KX_PROPSENSOR_LESSTHAN:
- reverse = true;
- ATTR_FALLTHROUGH;
- case KX_PROPSENSOR_GREATERTHAN:
- {
- CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname);
- if (!orgprop->IsError())
- {
- const float ref = m_checkpropval.ToFloat();
- float val;
-
- if (orgprop->GetValueType() == VALUE_STRING_TYPE) {
- val = orgprop->GetText().ToFloat();
- }
- else {
- val = orgprop->GetNumber();
- }
-
- if (reverse) {
- result = val < ref;
- }
- else {
- result = val > ref;
- }
-
- }
- orgprop->Release();
-
- break;
- }
- default:
- ; /* error */
- }
-
- //the concept of Edge and Level triggering has unwanted effect for KX_PROPSENSOR_CHANGED
- //see Game Engine bugtracker [ #3809 ]
- m_recentresult = result;
-
- return result;
-}
-
-CValue* SCA_PropertySensor::FindIdentifier(const STR_String& identifiername)
-{
- return GetParent()->FindIdentifier(identifiername);
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-int SCA_PropertySensor::validValueForProperty(void *self, const PyAttributeDef*)
-{
- /* If someone actually do type checking please make sure the 'max' and 'min'
- * are checked as well (currently they are calling the PrecalculateRangeExpression
- * function directly */
-
- /* There is no type checking at this moment, unfortunately... */
- return 0;
-}
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_PropertySensor::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_PropertySensor",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_ISensor::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_PropertySensor::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_PropertySensor::Attributes[] = {
- KX_PYATTRIBUTE_INT_RW("mode",KX_PROPSENSOR_NODEF,KX_PROPSENSOR_MAX-1,false,SCA_PropertySensor,m_checktype),
- KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,MAX_PROP_NAME,false,SCA_PropertySensor,m_checkpropname,CheckProperty),
- KX_PYATTRIBUTE_STRING_RW_CHECK("value",0,100,false,SCA_PropertySensor,m_checkpropval,validValueForProperty),
- KX_PYATTRIBUTE_STRING_RW_CHECK("min",0,100,false,SCA_PropertySensor,m_checkpropval,validValueForProperty),
- KX_PYATTRIBUTE_STRING_RW_CHECK("max",0,100,false,SCA_PropertySensor,m_checkpropmaxval,validValueForProperty),
- { NULL } //Sentinel
-};
-
-#endif // WITH_PYTHON
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.h b/source/gameengine/GameLogic/SCA_PropertySensor.h
deleted file mode 100644
index 4183abeaf95..00000000000
--- a/source/gameengine/GameLogic/SCA_PropertySensor.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_PropertySensor.h
- * \ingroup gamelogic
- * \brief Property sensor
- */
-
-#ifndef __SCA_PROPERTYSENSOR_H__
-#define __SCA_PROPERTYSENSOR_H__
-
-#include "SCA_ISensor.h"
-
-class SCA_PropertySensor : public SCA_ISensor
-{
- Py_Header
- //class CExpression* m_rightexpr;
- int m_checktype;
- STR_String m_checkpropval;
- STR_String m_checkpropmaxval;
- STR_String m_checkpropname;
- STR_String m_previoustext;
- bool m_lastresult;
- bool m_recentresult;
-
- protected:
-
-public:
- enum KX_PROPSENSOR_TYPE {
- KX_PROPSENSOR_NODEF = 0,
- KX_PROPSENSOR_EQUAL,
- KX_PROPSENSOR_NOTEQUAL,
- KX_PROPSENSOR_INTERVAL,
- KX_PROPSENSOR_CHANGED,
- KX_PROPSENSOR_EXPRESSION,
- KX_PROPSENSOR_LESSTHAN,
- KX_PROPSENSOR_GREATERTHAN,
- KX_PROPSENSOR_MAX
- };
-
- const STR_String S_KX_PROPSENSOR_EQ_STRING;
-
- SCA_PropertySensor(class SCA_EventManager* eventmgr,
- SCA_IObject* gameobj,
- const STR_String& propname,
- const STR_String& propval,
- const STR_String& propmaxval,
- KX_PROPSENSOR_TYPE checktype);
-
- virtual ~SCA_PropertySensor();
- virtual CValue* GetReplica();
- virtual void Init();
- bool CheckPropertyCondition();
-
- virtual bool Evaluate();
- virtual bool IsPositiveTrigger();
- virtual CValue* FindIdentifier(const STR_String& identifiername);
-
-#ifdef WITH_PYTHON
-
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-
- /**
- * Test whether this is a sensible value (type check)
- */
- static int validValueForProperty(void* self, const PyAttributeDef*);
-
-#endif
-};
-
-#endif
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
deleted file mode 100644
index 8da660686ef..00000000000
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ /dev/null
@@ -1,539 +0,0 @@
-/*
- * Execute Python scripts
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_PythonController.cpp
- * \ingroup gamelogic
- */
-
-
-#include <stddef.h>
-
-#include "SCA_PythonController.h"
-#include "SCA_LogicManager.h"
-#include "SCA_ISensor.h"
-#include "SCA_IActuator.h"
-#include "EXP_PyObjectPlus.h"
-
-#ifdef WITH_PYTHON
-#include "compile.h"
-#include "eval.h"
-#endif // WITH_PYTHON
-
-#include <algorithm>
-
-
-// initialize static member variables
-SCA_PythonController* SCA_PythonController::m_sCurrentController = NULL;
-
-
-SCA_PythonController::SCA_PythonController(SCA_IObject* gameobj, int mode)
- : SCA_IController(gameobj),
-#ifdef WITH_PYTHON
- m_bytecode(NULL),
- m_function(NULL),
-#endif
- m_function_argc(0),
- m_bModified(true),
- m_debug(false),
- m_mode(mode)
-#ifdef WITH_PYTHON
- , m_pythondictionary(NULL)
-#endif
-
-{
-
-}
-
-#if 0
-//debugging
-CValue *SCA_PythonController::AddRef()
-{
- //printf("AddRef refcount = %i\n",GetRefCount());
- return CValue::AddRef();
-}
-int SCA_PythonController::Release()
-{
- //printf("Release refcount = %i\n",GetRefCount());
- return CValue::Release();
-}
-#endif
-
-SCA_PythonController::~SCA_PythonController()
-{
-
-#ifdef WITH_PYTHON
- //printf("released python byte script\n");
-
- Py_XDECREF(m_bytecode);
- Py_XDECREF(m_function);
-
- if (m_pythondictionary) {
- // break any circular references in the dictionary
- PyDict_Clear(m_pythondictionary);
- Py_DECREF(m_pythondictionary);
- }
-#endif
-}
-
-
-
-CValue* SCA_PythonController::GetReplica()
-{
- SCA_PythonController* replica = new SCA_PythonController(*this);
-
-#ifdef WITH_PYTHON
- /* why is this needed at all??? - m_bytecode is NULL'd below so this doesnt make sense
- * but removing it crashes blender (with YoFrankie). so leave in for now - Campbell */
- Py_XINCREF(replica->m_bytecode);
-
- Py_XINCREF(replica->m_function); // this is ok since its not set to NULL
- replica->m_bModified = replica->m_bytecode == NULL;
-
- // The replica->m_pythondictionary is stolen - replace with a copy.
- if (m_pythondictionary)
- replica->m_pythondictionary = PyDict_Copy(m_pythondictionary);
-
-#if 0
- // The other option is to incref the replica->m_pythondictionary -
- // the replica objects can then share data.
- if (m_pythondictionary)
- Py_INCREF(replica->m_pythondictionary);
-#endif
-
-#endif /* WITH_PYTHON */
-
- // this will copy properties and so on...
- replica->ProcessReplica();
-
- return replica;
-}
-
-
-
-void SCA_PythonController::SetScriptText(const STR_String& text)
-{
- m_scriptText = text;
- m_bModified = true;
-}
-
-
-
-void SCA_PythonController::SetScriptName(const STR_String& name)
-{
- m_scriptName = name;
-}
-
-
-#ifdef WITH_PYTHON
-void SCA_PythonController::SetNamespace(PyObject* pythondictionary)
-{
- if (m_pythondictionary)
- {
- PyDict_Clear(m_pythondictionary);
- Py_DECREF(m_pythondictionary);
- }
- m_pythondictionary = PyDict_Copy(pythondictionary); /* new reference */
-
- /* Without __file__ set the sys.argv[0] is used for the filename
- * which ends up with lines from the blender binary being printed in the console */
- PyObject *value = PyUnicode_From_STR_String(m_scriptName);
- PyDict_SetItemString(m_pythondictionary, "__file__", value);
- Py_DECREF(value);
-
-}
-#endif
-
-bool SCA_PythonController::IsTriggered(class SCA_ISensor* sensor)
-{
- if (std::find(m_triggeredSensors.begin(), m_triggeredSensors.end(), sensor) !=
- m_triggeredSensors.end())
- {
- return true;
- }
- else {
- return false;
- }
-}
-
-#ifdef WITH_PYTHON
-
-/* warning, self is not the SCA_PythonController, its a PyObjectPlus_Proxy */
-PyObject *SCA_PythonController::sPyGetCurrentController(PyObject *self)
-{
- if (m_sCurrentController==NULL)
- {
- PyErr_SetString(PyExc_SystemError, "bge.logic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt.");
- return NULL;
- }
- return m_sCurrentController->GetProxy();
-}
-
-SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
-{
- // for safety, todo: only allow for registered actuators (pointertable)
- // we don't want to crash gameengine/blender by python scripts
- std::vector<SCA_IActuator*> lacts = m_sCurrentController->GetLinkedActuators();
- std::vector<SCA_IActuator*>::iterator it;
-
- if (PyUnicode_Check(value)) {
- /* get the actuator from the name */
- const char *name= _PyUnicode_AsString(value);
- for (it = lacts.begin(); it!= lacts.end(); ++it) {
- if ( name == (*it)->GetName() ) {
- return *it;
- }
- }
- }
- else if (PyObject_TypeCheck(value, &SCA_IActuator::Type)) {
- PyObjectPlus *value_plus= BGE_PROXY_REF(value);
- for (it = lacts.begin(); it!= lacts.end(); ++it) {
- if (static_cast<SCA_IActuator*>(value_plus) == (*it)) {
- return *it;
- }
- }
- }
-
- /* set the exception */
- PyErr_Format(PyExc_ValueError,
- "%R not in this python controllers actuator list", value);
-
- return NULL;
-}
-
-const char* SCA_PythonController::sPyGetCurrentController__doc__ = "getCurrentController()";
-
-PyTypeObject SCA_PythonController::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_PythonController",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_IController::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_PythonController::Methods[] = {
- {"activate", (PyCFunction) SCA_PythonController::sPyActivate, METH_O},
- {"deactivate", (PyCFunction) SCA_PythonController::sPyDeActivate, METH_O},
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_PythonController::Attributes[] = {
- KX_PYATTRIBUTE_RW_FUNCTION("script", SCA_PythonController, pyattr_get_script, pyattr_set_script),
- KX_PYATTRIBUTE_INT_RO("mode", SCA_PythonController, m_mode),
- { NULL } //Sentinel
-};
-
-void SCA_PythonController::ErrorPrint(const char *error_msg)
-{
- // If GetParent() is NULL, then most likely the object this controller
- // was attached to is gone (e.g., removed by LibFree()). Also, GetName()
- // can be a bad pointer if GetParent() is NULL, so better be safe and
- // flag it as unavailable as well
- const char *obj_name, *ctr_name;
- if (GetParent()) {
- obj_name = GetParent()->GetName().ReadPtr();
- ctr_name = GetName().ReadPtr();
- } else {
- obj_name = ctr_name = "Unavailable";
- }
- printf("%s - object '%s', controller '%s':\n", error_msg, obj_name, ctr_name);
- PyErr_Print();
-
- /* Added in 2.48a, the last_traceback can reference Objects for example, increasing
- * their user count. Not to mention holding references to wrapped data.
- * This is especially bad when the PyObject for the wrapped data is freed, after blender
- * has already dealocated the pointer */
- PySys_SetObject("last_traceback", NULL);
- PyErr_Clear(); /* just to be sure */
-}
-
-bool SCA_PythonController::Compile()
-{
- //printf("py script modified '%s'\n", m_scriptName.Ptr());
- m_bModified= false;
-
- // if a script already exists, decref it before replace the pointer to a new script
- if (m_bytecode) {
- Py_DECREF(m_bytecode);
- m_bytecode=NULL;
- }
-
- // recompile the scripttext into bytecode
- m_bytecode = Py_CompileString(m_scriptText.Ptr(), m_scriptName.Ptr(), Py_file_input);
-
- if (m_bytecode) {
- return true;
- } else {
- ErrorPrint("Python error compiling script");
- return false;
- }
-}
-
-bool SCA_PythonController::Import()
-{
- //printf("py module modified '%s'\n", m_scriptName.Ptr());
- m_bModified= false;
-
- /* in case we re-import */
- Py_XDECREF(m_function);
- m_function= NULL;
-
- STR_String mod_path_str= m_scriptText; /* just for storage, use C style string access */
- char *mod_path= mod_path_str.Ptr();
- char *function_string;
-
- function_string= strrchr(mod_path, '.');
-
- if (function_string == NULL) {
- printf("Python module name formatting error in object '%s', controller '%s':\n\texpected 'SomeModule.Func', got '%s'\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr());
- return false;
- }
-
- *function_string= '\0';
- function_string++;
-
- // Import the module and print an error if it's not found
- PyObject *mod = PyImport_ImportModule(mod_path);
-
- if (mod == NULL) {
- ErrorPrint("Python module can't be imported");
- return false;
- }
-
- if (m_debug)
- mod = PyImport_ReloadModule(mod);
-
- if (mod == NULL) {
- ErrorPrint("Python module can't be reloaded");
- return false;
- }
-
- // Get the function object
- m_function = PyObject_GetAttrString(mod, function_string);
-
- // DECREF the module as we don't need it anymore
- Py_DECREF(mod);
-
- if (m_function==NULL) {
- if (PyErr_Occurred())
- ErrorPrint("Python controller found the module but could not access the function");
- else
- printf("Python module error in object '%s', controller '%s':\n '%s' module found but function missing\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr());
- return false;
- }
-
- if (!PyCallable_Check(m_function)) {
- Py_DECREF(m_function);
- m_function = NULL;
- printf("Python module function error in object '%s', controller '%s':\n '%s' not callable\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr());
- return false;
- }
-
- m_function_argc = 0; /* rare cases this could be a function that isn't defined in python, assume zero args */
- if (PyFunction_Check(m_function)) {
- m_function_argc= ((PyCodeObject *)PyFunction_GET_CODE(m_function))->co_argcount;
- }
-
- if (m_function_argc > 1) {
- Py_DECREF(m_function);
- m_function = NULL;
- printf("Python module function in object '%s', controller '%s':\n '%s' takes %d args, should be zero or 1 controller arg\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr(), m_function_argc);
- return false;
- }
-
- return true;
-}
-
-
-void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
-{
- m_sCurrentController = this;
-
- PyObject *excdict= NULL;
- PyObject *resultobj= NULL;
-
- switch (m_mode) {
- case SCA_PYEXEC_SCRIPT:
- {
- if (m_bModified)
- if (Compile()==false) // sets m_bModified to false
- return;
- if (!m_bytecode)
- return;
-
- /*
- * This part here with excdict is a temporary patch
- * to avoid python/gameengine crashes when python
- * inadvertently holds references to game objects
- * in global variables.
- *
- * The idea is always make a fresh dictionary, and
- * destroy it right after it is used to make sure
- * python won't hold any gameobject references.
- *
- * Note that the PyDict_Clear _is_ necessary before
- * the Py_DECREF() because it is possible for the
- * variables inside the dictionary to hold references
- * to the dictionary (ie. generate a cycle), so we
- * break it by hand, then DECREF (which in this case
- * should always ensure excdict is cleared).
- */
-
- excdict= PyDict_Copy(m_pythondictionary);
-
- resultobj = PyEval_EvalCode((PyObject *)m_bytecode, excdict, excdict);
-
- /* PyRun_SimpleString(m_scriptText.Ptr()); */
- break;
- }
- case SCA_PYEXEC_MODULE:
- {
- if (m_bModified || m_debug)
- if (Import()==false) // sets m_bModified to false
- return;
- if (!m_function)
- return;
-
- PyObject *args= NULL;
-
- if (m_function_argc==1) {
- args = PyTuple_New(1);
- PyTuple_SET_ITEM(args, 0, GetProxy());
- }
-
- resultobj = PyObject_CallObject(m_function, args);
- Py_XDECREF(args);
- break;
- }
-
- } /* end switch */
-
-
- /* Free the return value and print the error */
- if (resultobj)
- Py_DECREF(resultobj);
- else
- ErrorPrint("Python script error");
-
- if (excdict) /* Only for SCA_PYEXEC_SCRIPT types */
- {
- /* clear after PyErrPrint - seems it can be using
- * something in this dictionary and crash? */
- // This doesn't appear to be needed anymore
- //PyDict_Clear(excdict);
- Py_DECREF(excdict);
- }
-
- m_triggeredSensors.clear();
- m_sCurrentController = NULL;
-}
-
-PyObject *SCA_PythonController::PyActivate(PyObject *value)
-{
- if (m_sCurrentController != this) {
- PyErr_SetString(PyExc_SystemError, "Cannot activate an actuator from a non-active controller");
- return NULL;
- }
-
- SCA_IActuator* actu = LinkedActuatorFromPy(value);
- if (actu==NULL)
- return NULL;
-
- m_logicManager->AddActiveActuator((SCA_IActuator*)actu, true);
- Py_RETURN_NONE;
-}
-
-PyObject *SCA_PythonController::PyDeActivate(PyObject *value)
-{
- if (m_sCurrentController != this) {
- PyErr_SetString(PyExc_SystemError, "Cannot deactivate an actuator from a non-active controller");
- return NULL;
- }
-
- SCA_IActuator* actu = LinkedActuatorFromPy(value);
- if (actu==NULL)
- return NULL;
-
- m_logicManager->AddActiveActuator((SCA_IActuator*)actu, false);
- Py_RETURN_NONE;
-}
-
-PyObject *SCA_PythonController::pyattr_get_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- //SCA_PythonController* self = static_cast<SCA_PythonController*>(static_cast<SCA_IController*>(static_cast<SCA_ILogicBrick*>(static_cast<CValue*>(static_cast<PyObjectPlus*>(self_v)))));
- // static_cast<void *>(dynamic_cast<Derived *>(obj)) - static_cast<void *>(obj)
-
- SCA_PythonController* self = static_cast<SCA_PythonController*>(self_v);
- return PyUnicode_From_STR_String(self->m_scriptText);
-}
-
-
-
-int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
-{
- SCA_PythonController* self = static_cast<SCA_PythonController*>(self_v);
-
- const char *scriptArg = _PyUnicode_AsString(value);
-
- if (scriptArg==NULL) {
- PyErr_SetString(PyExc_TypeError, "controller.script = string: Python Controller, expected a string script text");
- return PY_SET_ATTR_FAIL;
- }
-
- /* set scripttext sets m_bModified to true,
- * so next time the script is needed, a reparse into byte code is done */
- self->SetScriptText(scriptArg);
-
- return PY_SET_ATTR_SUCCESS;
-}
-
-#else // WITH_PYTHON
-
-void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
-{
- /* intentionally blank */
-}
-
-#endif // WITH_PYTHON
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_PythonController.h b/source/gameengine/GameLogic/SCA_PythonController.h
deleted file mode 100644
index ffb23c152ea..00000000000
--- a/source/gameengine/GameLogic/SCA_PythonController.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_PythonController.h
- * \ingroup gamelogic
- * \brief Execute Python scripts
- */
-
-#ifndef __SCA_PYTHONCONTROLLER_H__
-#define __SCA_PYTHONCONTROLLER_H__
-
-#include "SCA_IController.h"
-#include "SCA_LogicManager.h"
-#include "EXP_BoolValue.h"
-
-#include <vector>
-
-class SCA_IObject;
-class SCA_PythonController : public SCA_IController
-{
- Py_Header
-#ifdef WITH_PYTHON
- struct _object * m_bytecode; /* SCA_PYEXEC_SCRIPT only */
- PyObject* m_function; /* SCA_PYEXEC_MODULE only */
-#endif
- int m_function_argc;
- bool m_bModified;
- bool m_debug; /* use with SCA_PYEXEC_MODULE for reloading every logic run */
- int m_mode;
-
-
- protected:
- STR_String m_scriptText;
- STR_String m_scriptName;
-#ifdef WITH_PYTHON
- PyObject* m_pythondictionary; /* for SCA_PYEXEC_SCRIPT only */
- PyObject* m_pythonfunction; /* for SCA_PYEXEC_MODULE only */
-#endif
- std::vector<class SCA_ISensor*> m_triggeredSensors;
-
- public:
- enum SCA_PyExecMode
- {
- SCA_PYEXEC_SCRIPT = 0,
- SCA_PYEXEC_MODULE,
- SCA_PYEXEC_MAX
- };
-
- static SCA_PythonController* m_sCurrentController; // protected !!!
-
- //for debugging
- //virtual CValue* AddRef();
- //virtual int Release(); // Release a reference to this value (when reference count reaches 0, the value is removed from the heap)
-
- SCA_PythonController(SCA_IObject* gameobj, int mode);
- virtual ~SCA_PythonController();
-
- virtual CValue* GetReplica();
- virtual void Trigger(class SCA_LogicManager* logicmgr);
-
- void SetScriptText(const STR_String& text);
- void SetScriptName(const STR_String& name);
-#ifdef WITH_PYTHON
- void SetNamespace(PyObject* pythondictionary);
-#endif
- void SetDebug(bool debug) { m_debug = debug; }
- void AddTriggeredSensor(class SCA_ISensor* sensor)
- { m_triggeredSensors.push_back(sensor); }
- bool IsTriggered(class SCA_ISensor* sensor);
- bool Compile();
- bool Import();
- void ErrorPrint(const char *error_msg);
-
-#ifdef WITH_PYTHON
- static const char *sPyGetCurrentController__doc__;
- static PyObject *sPyGetCurrentController(PyObject *self);
- static const char *sPyAddActiveActuator__doc__;
- static PyObject *sPyAddActiveActuator(PyObject *self,
- PyObject *args);
- static SCA_IActuator* LinkedActuatorFromPy(PyObject *value);
-
-
- KX_PYMETHOD_O(SCA_PythonController,Activate);
- KX_PYMETHOD_O(SCA_PythonController,DeActivate);
- KX_PYMETHOD_O(SCA_PythonController,SetScript);
- KX_PYMETHOD_NOARGS(SCA_PythonController,GetScript);
-
-
- static PyObject* pyattr_get_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static int pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-#endif
-};
-
-#endif /* __SCA_PYTHONCONTROLLER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_PythonJoystick.cpp b/source/gameengine/GameLogic/SCA_PythonJoystick.cpp
deleted file mode 100644
index 06f42e84147..00000000000
--- a/source/gameengine/GameLogic/SCA_PythonJoystick.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Mitchell Stokes.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_PythonJoystick.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_PythonJoystick.h"
-#include "./Joystick/SCA_Joystick.h"
-#include "SCA_IInputDevice.h"
-
-//#include "GHOST_C-api.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_PythonJoystick::SCA_PythonJoystick(SCA_Joystick* joystick)
-: PyObjectPlus(),
-m_joystick(joystick)
-{
-#ifdef WITH_PYTHON
- m_event_dict = PyDict_New();
-#endif
-}
-
-SCA_PythonJoystick::~SCA_PythonJoystick()
-{
- // The joystick reference we got in the constructor was a new instance,
- // so we release it here
- m_joystick->ReleaseInstance();
-
-#ifdef WITH_PYTHON
- PyDict_Clear(m_event_dict);
- Py_DECREF(m_event_dict);
-#endif
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-PyObject* SCA_PythonJoystick::py_repr(void)
-{
- return PyUnicode_FromString(m_joystick->GetName());
-}
-
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_PythonJoystick::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_PythonJoystick",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &PyObjectPlus::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_PythonJoystick::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_PythonJoystick::Attributes[] = {
- KX_PYATTRIBUTE_RO_FUNCTION("numButtons", SCA_PythonJoystick, pyattr_get_num_x),
- KX_PYATTRIBUTE_RO_FUNCTION("numHats", SCA_PythonJoystick, pyattr_get_num_x),
- KX_PYATTRIBUTE_RO_FUNCTION("numAxis", SCA_PythonJoystick, pyattr_get_num_x),
- KX_PYATTRIBUTE_RO_FUNCTION("activeButtons", SCA_PythonJoystick, pyattr_get_active_buttons),
- KX_PYATTRIBUTE_RO_FUNCTION("hatValues", SCA_PythonJoystick, pyattr_get_hat_values),
- KX_PYATTRIBUTE_RO_FUNCTION("axisValues", SCA_PythonJoystick, pyattr_get_axis_values),
- KX_PYATTRIBUTE_RO_FUNCTION("name", SCA_PythonJoystick, pyattr_get_name),
- { NULL } //Sentinel
-};
-
-// Use one function for numAxis, numButtons, and numHats
-PyObject* SCA_PythonJoystick::pyattr_get_num_x(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_PythonJoystick* self = static_cast<SCA_PythonJoystick*>(self_v);
-
- if (strcmp(attrdef->m_name, "numButtons") == 0)
- return PyLong_FromLong(self->m_joystick->GetNumberOfButtons());
- else if (strcmp(attrdef->m_name, "numAxis") == 0)
- return PyLong_FromLong(self->m_joystick->GetNumberOfAxes());
- else if (strcmp(attrdef->m_name, "numHats") == 0)
- return PyLong_FromLong(self->m_joystick->GetNumberOfHats());
-
- // If we got here, we have a problem...
- PyErr_SetString(PyExc_AttributeError, "invalid attribute");
- return NULL;
-}
-
-PyObject* SCA_PythonJoystick::pyattr_get_active_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_PythonJoystick* self = static_cast<SCA_PythonJoystick*>(self_v);
-
- const int button_number = self->m_joystick->GetNumberOfButtons();
-
- PyObject *list = PyList_New(0);
- PyObject *value;
-
- for (int i=0; i < button_number; i++) {
- if (self->m_joystick->aButtonPressIsPositive(i)) {
- value = PyLong_FromLong(i);
- PyList_Append(list, value);
- Py_DECREF(value);
- }
- }
-
- return list;
-}
-
-PyObject* SCA_PythonJoystick::pyattr_get_hat_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_PythonJoystick* self = static_cast<SCA_PythonJoystick*>(self_v);
-
- int hat_index = self->m_joystick->GetNumberOfHats();
- PyObject *list = PyList_New(hat_index);
-
- while (hat_index--) {
- PyList_SET_ITEM(list, hat_index, PyLong_FromLong(self->m_joystick->GetHat(hat_index)));
- }
-
- return list;
-}
-
-PyObject* SCA_PythonJoystick::pyattr_get_axis_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_PythonJoystick* self = static_cast<SCA_PythonJoystick*>(self_v);
-
- int axis_index = self->m_joystick->GetNumberOfAxes();
- PyObject *list = PyList_New(axis_index);
- int position;
-
- while (axis_index--) {
- position = self->m_joystick->GetAxisPosition(axis_index);
-
- // We get back a range from -32768 to 32767, so we use an if here to
- // get a perfect -1.0 to 1.0 mapping. Some oddball system might have an
- // actual min of -32767 for shorts, so we use SHRT_MIN/MAX to be safe.
- if (position < 0)
- PyList_SET_ITEM(list, axis_index, PyFloat_FromDouble(position/((double)-SHRT_MIN)));
- else
- PyList_SET_ITEM(list, axis_index, PyFloat_FromDouble(position/(double)SHRT_MAX));
- }
-
- return list;
-}
-
-PyObject* SCA_PythonJoystick::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_PythonJoystick* self = static_cast<SCA_PythonJoystick*>(self_v);
-
- return PyUnicode_FromString(self->m_joystick->GetName());
-}
-#endif
diff --git a/source/gameengine/GameLogic/SCA_PythonJoystick.h b/source/gameengine/GameLogic/SCA_PythonJoystick.h
deleted file mode 100644
index fdecba604c6..00000000000
--- a/source/gameengine/GameLogic/SCA_PythonJoystick.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Mitchell Stokes.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_PythonJoystick.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_PYTHONJOYSTICK_H__
-#define __SCA_PYTHONJOYSTICK_H__
-
-#include "EXP_PyObjectPlus.h"
-
-class SCA_PythonJoystick : public PyObjectPlus
-{
- Py_Header
-private:
- class SCA_Joystick *m_joystick;
-#ifdef WITH_PYTHON
- PyObject* m_event_dict;
-#endif
-public:
- SCA_PythonJoystick(class SCA_Joystick* joystick);
- virtual ~SCA_PythonJoystick();
-
-#ifdef WITH_PYTHON
- virtual PyObject* py_repr(void);
-
- static PyObject* pyattr_get_num_x(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_active_buttons(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_hat_values(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_axis_values(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-#endif
-};
-
-#endif //__SCA_PYTHONJOYSTICK_H__
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
deleted file mode 100644
index 388ee5b9d4f..00000000000
--- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_PythonKeyboard.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_PythonKeyboard.h"
-#include "SCA_IInputDevice.h"
-
-#include "GHOST_C-api.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_PythonKeyboard::SCA_PythonKeyboard(SCA_IInputDevice* keyboard)
-: PyObjectPlus(),
-m_keyboard(keyboard)
-{
-#ifdef WITH_PYTHON
- m_event_dict = PyDict_New();
-#endif
-}
-
-SCA_PythonKeyboard::~SCA_PythonKeyboard()
-{
-#ifdef WITH_PYTHON
- PyDict_Clear(m_event_dict);
- Py_DECREF(m_event_dict);
-#endif
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* clipboard */
-static PyObject *gPyGetClipboard(PyObject *args, PyObject *kwds)
-{
- char *buf = (char *)GHOST_getClipboard(0);
- return PyUnicode_FromString(buf?buf:"");
-}
-
-static PyObject *gPySetClipboard(PyObject *args, PyObject *value)
-{
- char* buf;
- if (!PyArg_ParseTuple(value,"s:setClipboard",&buf))
- Py_RETURN_NONE;
-
- GHOST_putClipboard((GHOST_TInt8 *)buf, 0);
- Py_RETURN_NONE;
-}
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_PythonKeyboard::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_PythonKeyboard",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &PyObjectPlus::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_PythonKeyboard::Methods[] = {
- {"getClipboard", (PyCFunction) gPyGetClipboard, METH_VARARGS, "getCliboard doc"},
- {"setClipboard", (PyCFunction) gPySetClipboard, METH_VARARGS, "setCliboard doc"},
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_PythonKeyboard::Attributes[] = {
- KX_PYATTRIBUTE_RO_FUNCTION("events", SCA_PythonKeyboard, pyattr_get_events),
- KX_PYATTRIBUTE_RO_FUNCTION("active_events", SCA_PythonKeyboard, pyattr_get_active_events),
- { NULL } //Sentinel
-};
-
-PyObject *SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_PythonKeyboard* self = static_cast<SCA_PythonKeyboard*>(self_v);
-
- for (int i = SCA_IInputDevice::KX_BEGINKEY; i <= SCA_IInputDevice::KX_ENDKEY; i++) {
- const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
- PyObject *key = PyLong_FromLong(i);
- PyObject *value = PyLong_FromLong(inevent.m_status);
-
- PyDict_SetItem(self->m_event_dict, key, value);
-
- Py_DECREF(key);
- Py_DECREF(value);
- }
- Py_INCREF(self->m_event_dict);
- return self->m_event_dict;
-}
-
-PyObject *SCA_PythonKeyboard::pyattr_get_active_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_PythonKeyboard* self = static_cast<SCA_PythonKeyboard*>(self_v);
-
- PyDict_Clear(self->m_event_dict);
-
- for (int i = SCA_IInputDevice::KX_BEGINKEY; i <= SCA_IInputDevice::KX_ENDKEY; i++) {
- const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
-
- if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) {
- PyObject *key = PyLong_FromLong(i);
- PyObject *value = PyLong_FromLong(inevent.m_status);
-
- PyDict_SetItem(self->m_event_dict, key, value);
-
- Py_DECREF(key);
- Py_DECREF(value);
- }
- }
- Py_INCREF(self->m_event_dict);
- return self->m_event_dict;
-}
-
-#endif
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.h b/source/gameengine/GameLogic/SCA_PythonKeyboard.h
deleted file mode 100644
index 3cbe250378c..00000000000
--- a/source/gameengine/GameLogic/SCA_PythonKeyboard.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_PythonKeyboard.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_PYTHONKEYBOARD_H__
-#define __SCA_PYTHONKEYBOARD_H__
-
-#include "EXP_PyObjectPlus.h"
-
-class SCA_PythonKeyboard : public PyObjectPlus
-{
- Py_Header
-private:
- class SCA_IInputDevice *m_keyboard;
-#ifdef WITH_PYTHON
- PyObject *m_event_dict;
-#endif
-public:
- SCA_PythonKeyboard(class SCA_IInputDevice* keyboard);
- virtual ~SCA_PythonKeyboard();
-
-#ifdef WITH_PYTHON
- static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_active_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-#endif
-};
-
-#endif /* __SCA_PYTHONKEYBOARD_H__ */
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
deleted file mode 100644
index 111d8abe8c5..00000000000
--- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_PythonMouse.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_PythonMouse.h"
-#include "SCA_IInputDevice.h"
-#include "RAS_ICanvas.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_PythonMouse::SCA_PythonMouse(SCA_IInputDevice* mouse, RAS_ICanvas* canvas)
-: PyObjectPlus(),
-m_mouse(mouse),
-m_canvas(canvas)
-{
-#ifdef WITH_PYTHON
- m_event_dict = PyDict_New();
-#endif
-}
-
-SCA_PythonMouse::~SCA_PythonMouse()
-{
-#ifdef WITH_PYTHON
- PyDict_Clear(m_event_dict);
- Py_DECREF(m_event_dict);
-#endif
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_PythonMouse::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_PythonMouse",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &PyObjectPlus::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_PythonMouse::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_PythonMouse::Attributes[] = {
- KX_PYATTRIBUTE_RO_FUNCTION("events", SCA_PythonMouse, pyattr_get_events),
- KX_PYATTRIBUTE_RO_FUNCTION("active_events", SCA_PythonMouse, pyattr_get_active_events),
- KX_PYATTRIBUTE_RW_FUNCTION("position", SCA_PythonMouse, pyattr_get_position, pyattr_set_position),
- KX_PYATTRIBUTE_RW_FUNCTION("visible", SCA_PythonMouse, pyattr_get_visible, pyattr_set_visible),
- { NULL } //Sentinel
-};
-
-PyObject *SCA_PythonMouse::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v);
-
- for (int i = SCA_IInputDevice::KX_BEGINMOUSE; i <= SCA_IInputDevice::KX_ENDMOUSE; i++) {
- const SCA_InputEvent &inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
- PyObject *key = PyLong_FromLong(i);
- PyObject *value = PyLong_FromLong(inevent.m_status);
-
- PyDict_SetItem(self->m_event_dict, key, value);
-
- Py_DECREF(key);
- Py_DECREF(value);
- }
- Py_INCREF(self->m_event_dict);
- return self->m_event_dict;
-}
-
-PyObject *SCA_PythonMouse::pyattr_get_active_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v);
-
- PyDict_Clear(self->m_event_dict);
-
- for (int i = SCA_IInputDevice::KX_BEGINMOUSE; i <= SCA_IInputDevice::KX_ENDMOUSE; i++) {
- const SCA_InputEvent &inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
-
- if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) {
-
- PyObject *key = PyLong_FromLong(i);
- PyObject *value = PyLong_FromLong(inevent.m_status);
-
- PyDict_SetItem(self->m_event_dict, key, value);
-
- Py_DECREF(key);
- Py_DECREF(value);
- }
- }
- Py_INCREF(self->m_event_dict);
- return self->m_event_dict;
-}
-
-PyObject *SCA_PythonMouse::pyattr_get_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v);
- const SCA_InputEvent & xevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEX);
- const SCA_InputEvent & yevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEY);
-
- float x_coord, y_coord;
-
- x_coord = self->m_canvas->GetMouseNormalizedX(xevent.m_eventval);
- y_coord = self->m_canvas->GetMouseNormalizedY(yevent.m_eventval);
-
- PyObject *ret = PyTuple_New(2);
-
- PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(x_coord));
- PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(y_coord));
-
- return ret;
-}
-
-int SCA_PythonMouse::pyattr_set_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
-{
- SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v);
- int x, y;
- float pyx, pyy;
- if (!PyArg_ParseTuple(value, "ff:position", &pyx, &pyy))
- return PY_SET_ATTR_FAIL;
-
- x = (int)(pyx*self->m_canvas->GetWidth());
- y = (int)(pyy*self->m_canvas->GetHeight());
-
- self->m_canvas->SetMousePosition(x, y);
-
- return PY_SET_ATTR_SUCCESS;
-}
-
-PyObject *SCA_PythonMouse::pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v);
-
- int visible;
-
- if (self->m_canvas->GetMouseState() == RAS_ICanvas::MOUSE_INVISIBLE)
- visible = 0;
- else
- visible = 1;
-
- return PyBool_FromLong(visible);
-}
-
-int SCA_PythonMouse::pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
-{
- SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v);
-
- int visible = PyObject_IsTrue(value);
-
- if (visible == -1)
- {
- PyErr_SetString(PyExc_AttributeError, "SCA_PythonMouse.visible = bool: SCA_PythonMouse, expected True or False");
- return PY_SET_ATTR_FAIL;
- }
-
- if (visible)
- self->m_canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);
- else
- self->m_canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE);
-
- return PY_SET_ATTR_SUCCESS;
-}
-
-#endif
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.h b/source/gameengine/GameLogic/SCA_PythonMouse.h
deleted file mode 100644
index 6dde90b3482..00000000000
--- a/source/gameengine/GameLogic/SCA_PythonMouse.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_PythonMouse.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_PYTHONMOUSE_H__
-#define __SCA_PYTHONMOUSE_H__
-
-#include "EXP_PyObjectPlus.h"
-
-class SCA_PythonMouse : public PyObjectPlus
-{
- Py_Header
-private:
- class SCA_IInputDevice *m_mouse;
- class RAS_ICanvas *m_canvas;
-#ifdef WITH_PYTHON
- PyObject *m_event_dict;
-#endif
-public:
- SCA_PythonMouse(class SCA_IInputDevice* mouse, class RAS_ICanvas* canvas);
- virtual ~SCA_PythonMouse();
-
- void Show(bool visible);
-
-#ifdef WITH_PYTHON
- KX_PYMETHOD_DOC(SCA_PythonMouse, show);
-
- static PyObject *pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject *pyattr_get_active_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject *pyattr_get_position(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static int pyattr_set_position(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
- static PyObject *pyattr_get_visible(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static int pyattr_set_visible(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-#endif
-};
-
-#endif /* __SCA_PYTHONMOUSE_H__ */
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
deleted file mode 100644
index 121be5f003e..00000000000
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * Set random/camera stuff
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_RandomActuator.cpp
- * \ingroup gamelogic
- */
-
-
-#include <stddef.h>
-#include <math.h>
-
-#include "EXP_BoolValue.h"
-#include "EXP_IntValue.h"
-#include "EXP_FloatValue.h"
-#include "SCA_IActuator.h"
-#include "SCA_RandomActuator.h"
-#include "MT_Transform.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_RandomActuator::SCA_RandomActuator(SCA_IObject *gameobj,
- long seed,
- SCA_RandomActuator::KX_RANDOMACT_MODE mode,
- float para1,
- float para2,
- const STR_String &propName)
- : SCA_IActuator(gameobj, KX_ACT_RANDOM),
- m_propname(propName),
- m_parameter1(para1),
- m_parameter2(para2),
- m_distribution(mode)
-{
- m_base = new SCA_RandomNumberGenerator(seed);
- m_counter = 0;
- enforceConstraints();
-}
-
-
-
-SCA_RandomActuator::~SCA_RandomActuator()
-{
- m_base->Release();
-}
-
-
-
-CValue* SCA_RandomActuator::GetReplica()
-{
- SCA_RandomActuator* replica = new SCA_RandomActuator(*this);
- // replication just copy the m_base pointer => common random generator
- replica->ProcessReplica();
- return replica;
-}
-
-void SCA_RandomActuator::ProcessReplica()
-{
- SCA_IActuator::ProcessReplica();
- // increment reference count so that we can release the generator at the end
- m_base->AddRef();
-}
-
-
-
-bool SCA_RandomActuator::Update()
-{
- //bool result = false; /*unused*/
- bool bNegativeEvent = IsNegativeEvent();
-
- RemoveAllEvents();
-
-
- CValue *tmpval = NULL;
-
- if (bNegativeEvent)
- return false; // do nothing on negative events
-
- switch (m_distribution) {
- case KX_RANDOMACT_BOOL_CONST: {
- /* un petit peu filthy */
- bool res = !(m_parameter1 < 0.5);
- tmpval = new CBoolValue(res);
- }
- break;
- case KX_RANDOMACT_BOOL_UNIFORM: {
- /* flip a coin */
- bool res;
- if (m_counter > 31) {
- m_previous = m_base->Draw();
- res = ((m_previous & 0x1) == 0);
- m_counter = 1;
- } else {
- res = (((m_previous >> m_counter) & 0x1) == 0);
- m_counter++;
- }
- tmpval = new CBoolValue(res);
- }
- break;
- case KX_RANDOMACT_BOOL_BERNOUILLI: {
- /* 'percentage' */
- bool res;
- res = (m_base->DrawFloat() < m_parameter1);
- tmpval = new CBoolValue(res);
- }
- break;
- case KX_RANDOMACT_INT_CONST: {
- /* constant */
- tmpval = new CIntValue((int) floor(m_parameter1));
- }
- break;
- case KX_RANDOMACT_INT_UNIFORM: {
- /* uniform (toss a die) */
- int res;
- /* The [0, 1] interval is projected onto the [min, max+1] domain, */
- /* and then rounded. */
- res = (int)floor( ((m_parameter2 - m_parameter1 + 1) * m_base->DrawFloat()) + m_parameter1);
- tmpval = new CIntValue(res);
- }
- break;
- case KX_RANDOMACT_INT_POISSON: {
- /* poisson (queues) */
- /* 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, b;
- int res = 0;
- /* The - sign is important here! The number to test for, a, must be */
- /* between 0 and 1. */
- a = exp(-m_parameter1);
- /* a quickly reaches 0.... so we guard explicitly for that. */
- if (a < FLT_MIN) a = FLT_MIN;
- b = m_base->DrawFloat();
- while (b >= a) {
- b = b * m_base->DrawFloat();
- res++;
- };
- tmpval = new CIntValue(res);
- }
- break;
- case KX_RANDOMACT_FLOAT_CONST: {
- /* constant */
- tmpval = new CFloatValue(m_parameter1);
- }
- break;
- case KX_RANDOMACT_FLOAT_UNIFORM: {
- float res = ((m_parameter2 - m_parameter1) * m_base->DrawFloat()) + m_parameter1;
- tmpval = new CFloatValue(res);
- }
- break;
- case KX_RANDOMACT_FLOAT_NORMAL: {
- /* normal (big numbers): para1 = mean, para2 = std dev */
-
- /* 070301 - nzc: Changed the termination condition. I think I
- * made a small mistake here, but it only affects distro's where
- * the seed equals 0. In that case, the algorithm locks. Let's
- * just guard that case separately.
- */
-
- float x = 0.0, y = 0.0, s = 0.0, t = 0.0;
- if (m_base->GetSeed() == 0) {
- /* 070301 - nzc: Just taking the mean here seems reasonable. */
- tmpval = new CFloatValue(m_parameter1);
- }
- else {
- /* 070301 - nzc
- * Now, with seed != 0, we will most assuredly get some
- * 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
- * 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
- * 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
- * cause by #2 is of the same magnitude as the one
- * prevented by #1. The error introduced into the SD will be
- * improved, though. By how much? Hard to say... If you like
- * the maths, feel free to analyse. Be aware that this is
- * one of the really old standard algorithms. I think the
- * original came in Fortran, was translated to Pascal, and
- * then someone came up with the C code. My guess it that
- * this will be quite sufficient here.
- */
- do {
- x = 2.0f * m_base->DrawFloat() - 1.0f;
- y = 2.0f * m_base->DrawFloat() - 1.0f;
- s = x * x + y * y;
- } while ((s >= 1.0f) || (s == 0.0f));
- t = x * sqrtf((-2.0 * log(s)) / s);
- tmpval = new CFloatValue(m_parameter1 + m_parameter2 * t);
- }
- }
- break;
- case KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL: {
- /* 1st order fall-off. I am very partial to using the half-life as */
- /* controlling parameter. Using the 'normal' exponent is not very */
- /* intuitive... */
- /* tmpval = new CFloatValue( (1.0 / m_parameter1) */
- tmpval = new CFloatValue((m_parameter1) * (-log(1.0 - m_base->DrawFloat())));
-
- }
- break;
- default:
- {
- /* 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 */
- CValue *prop = GetParent()->GetProperty(m_propname);
- if (prop) {
- prop->SetValue(tmpval);
- }
- tmpval->Release();
-
- return false;
-}
-
-void SCA_RandomActuator::enforceConstraints()
-{
- /* The constraints that are checked here are the ones fundamental to */
- /* the various distributions. Limitations of the algorithms are checked */
- /* elsewhere (or they should be... ). */
- switch (m_distribution) {
- case KX_RANDOMACT_BOOL_CONST:
- case KX_RANDOMACT_BOOL_UNIFORM:
- case KX_RANDOMACT_INT_CONST:
- case KX_RANDOMACT_INT_UNIFORM:
- case KX_RANDOMACT_FLOAT_UNIFORM:
- case KX_RANDOMACT_FLOAT_CONST:
- ; /* Nothing to be done here. We allow uniform distro's to have */
- /* 'funny' domains, i.e. max < min. This does not give problems. */
- break;
- case KX_RANDOMACT_BOOL_BERNOUILLI:
- /* clamp to [0, 1] */
- if (m_parameter1 < 0.0) {
- m_parameter1 = 0.0;
- } else if (m_parameter1 > 1.0) {
- m_parameter1 = 1.0;
- }
- break;
- case KX_RANDOMACT_INT_POISSON:
- /* non-negative */
- if (m_parameter1 < 0.0) {
- m_parameter1 = 0.0;
- }
- break;
- case KX_RANDOMACT_FLOAT_NORMAL:
- /* standard dev. is non-negative */
- if (m_parameter2 < 0.0) {
- m_parameter2 = 0.0;
- }
- break;
- case KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL:
- /* halflife must be non-negative */
- if (m_parameter1 < 0.0) {
- m_parameter1 = 0.0;
- }
- break;
- default:
- ; /* unknown distribution... */
- }
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_RandomActuator::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_RandomActuator",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_IActuator::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_RandomActuator::Methods[] = {
- KX_PYMETHODTABLE(SCA_RandomActuator, setBoolConst),
- KX_PYMETHODTABLE_NOARGS(SCA_RandomActuator, setBoolUniform),
- KX_PYMETHODTABLE(SCA_RandomActuator, setBoolBernouilli),
-
- KX_PYMETHODTABLE(SCA_RandomActuator, setIntConst),
- KX_PYMETHODTABLE(SCA_RandomActuator, setIntUniform),
- KX_PYMETHODTABLE(SCA_RandomActuator, setIntPoisson),
-
- KX_PYMETHODTABLE(SCA_RandomActuator, setFloatConst),
- KX_PYMETHODTABLE(SCA_RandomActuator, setFloatUniform),
- KX_PYMETHODTABLE(SCA_RandomActuator, setFloatNormal),
- KX_PYMETHODTABLE(SCA_RandomActuator, setFloatNegativeExponential),
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_RandomActuator::Attributes[] = {
- KX_PYATTRIBUTE_FLOAT_RO("para1",SCA_RandomActuator,m_parameter1),
- KX_PYATTRIBUTE_FLOAT_RO("para2",SCA_RandomActuator,m_parameter2),
- KX_PYATTRIBUTE_ENUM_RO("distribution",SCA_RandomActuator,m_distribution),
- KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,MAX_PROP_NAME,false,SCA_RandomActuator,m_propname,CheckProperty),
- KX_PYATTRIBUTE_RW_FUNCTION("seed",SCA_RandomActuator,pyattr_get_seed,pyattr_set_seed),
- { NULL } //Sentinel
-};
-
-PyObject *SCA_RandomActuator::pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
- return PyLong_FromLong(act->m_base->GetSeed());
-}
-
-int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
-{
- SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
- if (PyLong_Check(value)) {
- act->m_base->SetSeed(PyLong_AsLong(value));
- return PY_SET_ATTR_SUCCESS;
- }
- else {
- PyErr_SetString(PyExc_TypeError, "actuator.seed = int: Random Actuator, expected an integer");
- return PY_SET_ATTR_FAIL;
- }
-}
-
-/* 11. setBoolConst */
-KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolConst,
-"setBoolConst(value)\n"
-"\t- value: 0 or 1\n"
-"\tSet this generator to produce a constant boolean value.\n")
-{
- int paraArg;
- if (!PyArg_ParseTuple(args, "i:setBoolConst", &paraArg)) {
- return NULL;
- }
-
- m_distribution = KX_RANDOMACT_BOOL_CONST;
- m_parameter1 = (paraArg) ? 1.0 : 0.0;
-
- Py_RETURN_NONE;
-}
-/* 12. setBoolUniform, */
-KX_PYMETHODDEF_DOC_NOARGS(SCA_RandomActuator, setBoolUniform,
-"setBoolUniform()\n"
-"\tSet this generator to produce true and false, each with 50%% chance of occurring\n")
-{
- /* no args */
- m_distribution = KX_RANDOMACT_BOOL_UNIFORM;
- enforceConstraints();
- Py_RETURN_NONE;
-}
-/* 13. setBoolBernouilli, */
-KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolBernouilli,
-"setBoolBernouilli(value)\n"
-"\t- value: a float between 0 and 1\n"
-"\tReturn false value * 100%% of the time.\n")
-{
- float paraArg;
- if (!PyArg_ParseTuple(args, "f:setBoolBernouilli", &paraArg)) {
- return NULL;
- }
-
- m_distribution = KX_RANDOMACT_BOOL_BERNOUILLI;
- m_parameter1 = paraArg;
- enforceConstraints();
- Py_RETURN_NONE;
-}
-/* 14. setIntConst,*/
-KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntConst,
-"setIntConst(value)\n"
-"\t- value: integer\n"
-"\tAlways return value\n")
-{
- int paraArg;
- if (!PyArg_ParseTuple(args, "i:setIntConst", &paraArg)) {
- return NULL;
- }
-
- m_distribution = KX_RANDOMACT_INT_CONST;
- m_parameter1 = paraArg;
- enforceConstraints();
- Py_RETURN_NONE;
-}
-/* 15. setIntUniform,*/
-KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntUniform,
-"setIntUniform(lower_bound, upper_bound)\n"
-"\t- lower_bound: integer\n"
-"\t- upper_bound: integer\n"
-"\tReturn a random integer between lower_bound and\n"
-"\tupper_bound. The boundaries are included.\n")
-{
- int paraArg1, paraArg2;
- if (!PyArg_ParseTuple(args, "ii:setIntUniform", &paraArg1, &paraArg2)) {
- return NULL;
- }
-
- m_distribution = KX_RANDOMACT_INT_UNIFORM;
- m_parameter1 = paraArg1;
- m_parameter2 = paraArg2;
- enforceConstraints();
- Py_RETURN_NONE;
-}
-/* 16. setIntPoisson, */
-KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntPoisson,
-"setIntPoisson(value)\n"
-"\t- value: float\n"
-"\tReturn a Poisson-distributed number. This performs a series\n"
-"\tof Bernouilli tests with parameter value. It returns the\n"
-"\tnumber of tries needed to achieve succes.\n")
-{
- float paraArg;
- if (!PyArg_ParseTuple(args, "f:setIntPoisson", &paraArg)) {
- return NULL;
- }
-
- m_distribution = KX_RANDOMACT_INT_POISSON;
- m_parameter1 = paraArg;
- enforceConstraints();
- Py_RETURN_NONE;
-}
-/* 17. setFloatConst */
-KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatConst,
-"setFloatConst(value)\n"
-"\t- value: float\n"
-"\tAlways return value\n")
-{
- float paraArg;
- if (!PyArg_ParseTuple(args, "f:setFloatConst", &paraArg)) {
- return NULL;
- }
-
- m_distribution = KX_RANDOMACT_FLOAT_CONST;
- m_parameter1 = paraArg;
- enforceConstraints();
- Py_RETURN_NONE;
-}
-/* 18. setFloatUniform, */
-KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatUniform,
-"setFloatUniform(lower_bound, upper_bound)\n"
-"\t- lower_bound: float\n"
-"\t- upper_bound: float\n"
-"\tReturn a random integer between lower_bound and\n"
-"\tupper_bound.\n")
-{
- float paraArg1, paraArg2;
- if (!PyArg_ParseTuple(args, "ff:setFloatUniform", &paraArg1, &paraArg2)) {
- return NULL;
- }
-
- m_distribution = KX_RANDOMACT_FLOAT_UNIFORM;
- m_parameter1 = paraArg1;
- m_parameter2 = paraArg2;
- enforceConstraints();
- Py_RETURN_NONE;
-}
-/* 19. setFloatNormal, */
-KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNormal,
-"setFloatNormal(mean, standard_deviation)\n"
-"\t- mean: float\n"
-"\t- standard_deviation: float\n"
-"\tReturn normal-distributed numbers. The average is mean, and the\n"
-"\tdeviation from the mean is characterized by standard_deviation.\n")
-{
- float paraArg1, paraArg2;
- if (!PyArg_ParseTuple(args, "ff:setFloatNormal", &paraArg1, &paraArg2)) {
- return NULL;
- }
-
- m_distribution = KX_RANDOMACT_FLOAT_NORMAL;
- m_parameter1 = paraArg1;
- m_parameter2 = paraArg2;
- enforceConstraints();
- Py_RETURN_NONE;
-}
-/* 20. setFloatNegativeExponential, */
-KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential,
-"setFloatNegativeExponential(half_life)\n"
-"\t- half_life: float\n"
-"\tReturn negative-exponentially distributed numbers. The half-life 'time'\n"
-"\tis characterized by half_life.\n")
-{
- float paraArg;
- if (!PyArg_ParseTuple(args, "f:setFloatNegativeExponential", &paraArg)) {
- return NULL;
- }
-
- m_distribution = KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL;
- m_parameter1 = paraArg;
- enforceConstraints();
- Py_RETURN_NONE;
-}
-
-#endif
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.h b/source/gameengine/GameLogic/SCA_RandomActuator.h
deleted file mode 100644
index 07ceff1e9c5..00000000000
--- a/source/gameengine/GameLogic/SCA_RandomActuator.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_RandomActuator.h
- * \ingroup gamelogic
- * \brief Draw a random number, and put it in a property
- */
-
-#ifndef __SCA_RANDOMACTUATOR_H__
-#define __SCA_RANDOMACTUATOR_H__
-
-#include "SCA_IActuator.h"
-#include "SCA_RandomNumberGenerator.h"
-
-class SCA_RandomActuator : public SCA_IActuator
-{
- Py_Header
- /** Property to assign to */
- STR_String m_propname;
-
- /** First parameter. The meaning of the parameters depends on the
- * distribution */
- float m_parameter1;
- /** Second parameter. The meaning of the parameters depends on the
- * distribution */
- float m_parameter2;
-
- /** The base generator */
- SCA_RandomNumberGenerator *m_base;
-
- /** just a generic, persistent counter */
- int m_counter;
-
- /** cache for the previous draw */
- long m_previous;
-
- /** apply constraints for the chosen distribution to the parameters */
- void enforceConstraints(void);
-
- public:
-
- enum KX_RANDOMACT_MODE {
- KX_RANDOMACT_NODEF,
- KX_RANDOMACT_BOOL_CONST,
- KX_RANDOMACT_BOOL_UNIFORM,
- KX_RANDOMACT_BOOL_BERNOUILLI,
- KX_RANDOMACT_INT_CONST,
- KX_RANDOMACT_INT_UNIFORM,
- KX_RANDOMACT_INT_POISSON,
- KX_RANDOMACT_FLOAT_CONST,
- KX_RANDOMACT_FLOAT_UNIFORM,
- KX_RANDOMACT_FLOAT_NORMAL,
- KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL,
- KX_RANDOMACT_MAX
- };
- /** distribution type */
- KX_RANDOMACT_MODE m_distribution;
-
- SCA_RandomActuator(class SCA_IObject* gameobj,
- long seed,
- KX_RANDOMACT_MODE mode,
- float para1,
- float para2,
- const STR_String &propName);
- virtual ~SCA_RandomActuator();
- virtual bool Update();
-
- virtual CValue* GetReplica();
- virtual void ProcessReplica();
-
-#ifdef WITH_PYTHON
-
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-
- static PyObject *pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
- static int pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-
- KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setBoolConst);
- KX_PYMETHOD_DOC_NOARGS(SCA_RandomActuator, setBoolUniform);
- KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setBoolBernouilli);
- KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setIntConst);
- KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setIntUniform);
- KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setIntPoisson);
- KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatConst);
- KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatUniform);
- KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatNormal);
- KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential);
-
-#endif /* WITH_PYTHON */
-
-}; /* end of class KX_EditObjectActuator : public SCA_PropertyActuator */
-
-#endif
diff --git a/source/gameengine/GameLogic/SCA_RandomEventManager.cpp b/source/gameengine/GameLogic/SCA_RandomEventManager.cpp
deleted file mode 100644
index dd268a0cd44..00000000000
--- a/source/gameengine/GameLogic/SCA_RandomEventManager.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Manager for random events
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_RandomEventManager.cpp
- * \ingroup gamelogic
- */
-
-#include "SCA_RandomEventManager.h"
-#include "SCA_LogicManager.h"
-#include "SCA_ISensor.h"
-#include <vector>
-using namespace std;
-
-#include <iostream>
-#include <stdio.h>
-
-SCA_RandomEventManager::SCA_RandomEventManager(class SCA_LogicManager* logicmgr)
- : SCA_EventManager(logicmgr, RANDOM_EVENTMGR)
-{
-}
-
-
-void SCA_RandomEventManager::NextFrame()
-{
- SG_DList::iterator<SCA_ISensor> it(m_sensors);
- for (it.begin();!it.end();++it)
- {
- (*it)->Activate(m_logicmgr);
- }
-}
diff --git a/source/gameengine/GameLogic/SCA_RandomEventManager.h b/source/gameengine/GameLogic/SCA_RandomEventManager.h
deleted file mode 100644
index 2d83c5fcdca..00000000000
--- a/source/gameengine/GameLogic/SCA_RandomEventManager.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_RandomEventManager.h
- * \ingroup gamelogic
- * \brief Manager for random events
- */
-
-#ifndef __SCA_RANDOMEVENTMANAGER_H__
-#define __SCA_RANDOMEVENTMANAGER_H__
-
-#include "SCA_EventManager.h"
-#include <vector>
-
-using namespace std;
-
-class SCA_RandomEventManager : public SCA_EventManager
-{
-public:
- SCA_RandomEventManager(class SCA_LogicManager* logicmgr);
-
- virtual void NextFrame();
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_RandomEventManager")
-#endif
-};
-
-#endif /* __SCA_RANDOMEVENTMANAGER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
deleted file mode 100644
index e6c1b51ea23..00000000000
--- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/** \file gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
- * \ingroup gamelogic
- */
-/**
- * Generate random numbers that can be used by other components. We
- * convert to different types/distributions elsewhere. This just
- * delivers a clean, random bitvector.
- *
- */
-
-/* A C-program for MT19937: Real number version */
-/* genrand() generates one pseudorandom real number (double) */
-/* which is uniformly distributed on [0,1]-interval, for each */
-/* call. sgenrand(seed) set initial values to the working area */
-/* of 624 words. Before genrand(), sgenrand(seed) must be */
-/* called once. (seed is any 32-bit integer except for 0). */
-/* Integer generator is obtained by modifying two lines. */
-/* Coded by Takuji Nishimura, considering the suggestions by */
-/* Topher Cooper and Marc Rieffel in July-Aug. 1997. */
-
-/* This library is free software; you can redistribute it and/or */
-/* modify it under the terms of the GNU Library General Public */
-/* License as published by the Free Software Foundation; either */
-/* version 2 of the License, or (at your option) any later */
-/* version. */
-/* This library is distributed in the hope that it will be useful, */
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */
-/* See the GNU Library General Public License for more details. */
-/* You should have received a copy of the GNU Library General */
-/* Public License along with this library; if not, write to the */
-/* Free Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA */
-/* 02110-1301, USA */
-
-/* Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. */
-/* When you use this, send an email to: matumoto@math.keio.ac.jp */
-/* with an appropriate reference to your work. */
-
-#include <limits.h>
-#include "SCA_RandomNumberGenerator.h"
-
-/* Period parameters */
-#define N 624
-#define M 397
-#define MATRIX_A 0x9908b0df /* constant vector a */
-#define UPPER_MASK 0x80000000 /* most significant w-r bits */
-#define LOWER_MASK 0x7fffffff /* least significant r bits */
-
-/* Tempering parameters */
-#define TEMPERING_MASK_B 0x9d2c5680
-#define TEMPERING_MASK_C 0xefc60000
-#define TEMPERING_SHIFT_U(y) (y >> 11)
-#define TEMPERING_SHIFT_S(y) (y << 7)
-#define TEMPERING_SHIFT_T(y) (y << 15)
-#define TEMPERING_SHIFT_L(y) (y >> 18)
-
-SCA_RandomNumberGenerator::SCA_RandomNumberGenerator(long seed)
-{
- // int mti = N + 1; /*unused*/
- m_seed = seed;
- m_refcount = 1;
- SetStartVector();
-}
-
-SCA_RandomNumberGenerator::~SCA_RandomNumberGenerator()
-{
- /* intentionally empty */
-}
-
-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;
-}
-
-long SCA_RandomNumberGenerator::GetSeed() { return m_seed; }
-void SCA_RandomNumberGenerator::SetSeed(long newseed)
-{
- m_seed = newseed;
- SetStartVector();
-}
-
-/**
- * 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;
-}
-
-float SCA_RandomNumberGenerator::DrawFloat()
-{
- return ( (float) Draw()/ (unsigned long) 0xffffffff );
-}
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h
deleted file mode 100644
index 2c6a4583317..00000000000
--- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_RandomNumberGenerator.h
- * \ingroup gamelogic
- * \brief Generate random numbers that can be used by other components. Each
- * generator needs its own generator, so that the seed can be set
- * on a per-generator basis.
- */
-
-#ifndef __SCA_RANDOMNUMBERGENERATOR_H__
-#define __SCA_RANDOMNUMBERGENERATOR_H__
-
-#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
-#endif
-
-class SCA_RandomNumberGenerator {
-
- /* reference counted for memleak */
- int m_refcount;
-
- /** base seed */
- long m_seed;
-
- /* A bit silly.. The N parameter is a define in the .cpp file */
- /** the array for the state vector */
- /* unsigned long mt[N]; */
- unsigned long mt[624];
-
- /** mti==N+1 means mt[KX_MT_VectorLength] is not initialized */
- int mti; /* initialized in the cpp file */
-
- /** Calculate a start vector */
- void SetStartVector(void);
- public:
- SCA_RandomNumberGenerator(long seed);
- ~SCA_RandomNumberGenerator();
- unsigned long Draw();
- float DrawFloat();
- long GetSeed();
- void SetSeed(long newseed);
- SCA_RandomNumberGenerator* AddRef()
- {
- ++m_refcount;
- return this;
- }
- void Release()
- {
- if (--m_refcount == 0)
- delete this;
- }
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_RandomNumberGenerator")
-#endif
-};
-
-#endif /* __SCA_RANDOMNUMBERGENERATOR_H__ */
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
deleted file mode 100644
index 0757655e7db..00000000000
--- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Generate random pulses
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_RandomSensor.cpp
- * \ingroup gamelogic
- */
-
-
-#include <stddef.h>
-
-#include "SCA_RandomSensor.h"
-#include "SCA_EventManager.h"
-#include "SCA_RandomEventManager.h"
-#include "SCA_LogicManager.h"
-#include "EXP_ConstExpr.h"
-#include <iostream>
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_RandomSensor::SCA_RandomSensor(SCA_EventManager* eventmgr,
- SCA_IObject* gameobj,
- int startseed)
- : SCA_ISensor(gameobj,eventmgr)
-{
- m_basegenerator = new SCA_RandomNumberGenerator(startseed);
- Init();
-}
-
-
-
-SCA_RandomSensor::~SCA_RandomSensor()
-{
- m_basegenerator->Release();
-}
-
-void SCA_RandomSensor::Init()
-{
- m_iteration = 0;
- m_interval = 0;
- m_lastdraw = false;
- m_currentDraw = m_basegenerator->Draw();
-}
-
-
-CValue* SCA_RandomSensor::GetReplica()
-{
- CValue* replica = new SCA_RandomSensor(*this);
- // this will copy properties and so on...
- replica->ProcessReplica();
-
- return replica;
-}
-
-void SCA_RandomSensor::ProcessReplica()
-{
- SCA_ISensor::ProcessReplica();
- // increment reference count so that we can release the generator at this end
- m_basegenerator->AddRef();
-}
-
-
-bool SCA_RandomSensor::IsPositiveTrigger()
-{
- return (m_invert !=m_lastdraw);
-}
-
-
-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. */
-
- bool evaluateResult = false;
-
- if (++m_interval > m_skipped_ticks) {
- bool drawResult = false;
- m_interval = 0;
- if (m_iteration > 31) {
- m_currentDraw = m_basegenerator->Draw();
- drawResult = (m_currentDraw & 0x1) == 0;
- m_iteration = 1;
- } else {
- drawResult = ((m_currentDraw >> m_iteration) & 0x1) == 0;
- m_iteration++;
- }
- evaluateResult = drawResult != m_lastdraw;
- m_lastdraw = drawResult;
- }
-
- /* now pass this result to some controller */
- return evaluateResult;
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_RandomSensor::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_RandomSensor",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_ISensor::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_RandomSensor::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_RandomSensor::Attributes[] = {
- KX_PYATTRIBUTE_BOOL_RO("lastDraw",SCA_RandomSensor,m_lastdraw),
- KX_PYATTRIBUTE_RW_FUNCTION("seed", SCA_RandomSensor, pyattr_get_seed, pyattr_set_seed),
- {NULL} //Sentinel
-};
-
-PyObject *SCA_RandomSensor::pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- SCA_RandomSensor* self = static_cast<SCA_RandomSensor*>(self_v);
- return PyLong_FromLong(self->m_basegenerator->GetSeed());
-}
-
-int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
-{
- SCA_RandomSensor* self = static_cast<SCA_RandomSensor*>(self_v);
- if (!PyLong_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "sensor.seed = int: Random Sensor, expected an integer");
- return PY_SET_ATTR_FAIL;
- }
- self->m_basegenerator->SetSeed(PyLong_AsLong(value));
- return PY_SET_ATTR_SUCCESS;
-}
-
-#endif // WITH_PYTHON
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.h b/source/gameengine/GameLogic/SCA_RandomSensor.h
deleted file mode 100644
index 40d7d7d66cd..00000000000
--- a/source/gameengine/GameLogic/SCA_RandomSensor.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_RandomSensor.h
- * \ingroup gamelogic
- * \brief Generate random pulses
- */
-
-#ifndef __SCA_RANDOMSENSOR_H__
-#define __SCA_RANDOMSENSOR_H__
-
-#include "SCA_ISensor.h"
-#include "EXP_BoolValue.h"
-#include "SCA_RandomNumberGenerator.h"
-
-class SCA_RandomSensor : public SCA_ISensor
-{
- Py_Header
-
- unsigned int m_currentDraw;
- int m_iteration;
- int m_interval;
- SCA_RandomNumberGenerator *m_basegenerator;
- bool m_lastdraw;
-public:
- SCA_RandomSensor(class SCA_EventManager* rndmgr,
- SCA_IObject* gameobj,
- int startseed);
- virtual ~SCA_RandomSensor();
- virtual CValue* GetReplica();
- virtual void ProcessReplica();
- virtual bool Evaluate();
- virtual bool IsPositiveTrigger();
- virtual void Init();
-
-#ifdef WITH_PYTHON
-
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-
- static PyObject* pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static int pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-#endif
-};
-
-#endif /* __SCA_RANDOMSENSOR_H__ */
diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
deleted file mode 100644
index 5c8468e5485..00000000000
--- a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_TimeEventManager.cpp
- * \ingroup gamelogic
- */
-
-#ifdef _MSC_VER
- /* This warning tells us about truncation of __long__ stl-generated names.
- * It can occasionally cause DevStudio to have internal compiler warnings. */
-# pragma warning(disable:4786)
-#endif
-
-#include "SCA_TimeEventManager.h"
-
-#include "SCA_LogicManager.h"
-#include "EXP_FloatValue.h"
-
-SCA_TimeEventManager::SCA_TimeEventManager(SCA_LogicManager* logicmgr)
-: SCA_EventManager(NULL, TIME_EVENTMGR)
-{
-}
-
-
-
-SCA_TimeEventManager::~SCA_TimeEventManager()
-{
- for (vector<CValue*>::iterator it = m_timevalues.begin();
- !(it == m_timevalues.end()); ++it)
- {
- (*it)->Release();
- }
-}
-
-
-
-void SCA_TimeEventManager::RegisterSensor(SCA_ISensor* sensor)
-{
- // not yet
-}
-
-void SCA_TimeEventManager::RemoveSensor(SCA_ISensor* sensor)
-{
- // empty
-}
-
-
-
-void SCA_TimeEventManager::NextFrame(double curtime, double fixedtime)
-{
- if (m_timevalues.size() > 0 && fixedtime > 0.0)
- {
- CFloatValue* floatval = new CFloatValue(curtime);
-
- // update sensors, but ... need deltatime !
- for (vector<CValue*>::iterator it = m_timevalues.begin();
- !(it == m_timevalues.end()); ++it)
- {
- float newtime = (*it)->GetNumber() + fixedtime;
- floatval->SetFloat(newtime);
- (*it)->SetValue(floatval);
- }
-
- floatval->Release();
- }
-}
-
-
-
-void SCA_TimeEventManager::AddTimeProperty(CValue* timeval)
-{
- timeval->AddRef();
- m_timevalues.push_back(timeval);
-}
-
-
-
-void SCA_TimeEventManager::RemoveTimeProperty(CValue* timeval)
-{
- for (vector<CValue*>::iterator it = m_timevalues.begin();
- !(it == m_timevalues.end()); ++it)
- {
- if ((*it) == timeval)
- {
- this->m_timevalues.erase(it);
- timeval->Release();
- break;
- }
- }
-}
-
-vector<CValue*> SCA_TimeEventManager::GetTimeValues()
-{
- return m_timevalues;
-}
diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.h b/source/gameengine/GameLogic/SCA_TimeEventManager.h
deleted file mode 100644
index 723a6ee10a7..00000000000
--- a/source/gameengine/GameLogic/SCA_TimeEventManager.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_TimeEventManager.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_TIMEEVENTMANAGER_H__
-#define __SCA_TIMEEVENTMANAGER_H__
-
-#include "SCA_EventManager.h"
-#include "EXP_Value.h"
-#include <vector>
-
-using namespace std;
-
-class SCA_TimeEventManager : public SCA_EventManager
-{
- vector<CValue*> m_timevalues; // values that need their time updated regularly
-
-public:
- SCA_TimeEventManager(class SCA_LogicManager* logicmgr);
- virtual ~SCA_TimeEventManager();
-
- virtual void NextFrame(double curtime, double fixedtime);
- virtual void RegisterSensor(class SCA_ISensor* sensor);
- virtual void RemoveSensor(class SCA_ISensor* sensor);
- void AddTimeProperty(CValue* timeval);
- void RemoveTimeProperty(CValue* timeval);
-
- vector<CValue*> GetTimeValues();
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_TimeEventManager")
-#endif
-};
-
-#endif /* __SCA_TIMEEVENTMANAGER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_XNORController.cpp b/source/gameengine/GameLogic/SCA_XNORController.cpp
deleted file mode 100644
index f97d11cabf3..00000000000
--- a/source/gameengine/GameLogic/SCA_XNORController.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 'Xnor' together all inputs
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_XNORController.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_XNORController.h"
-#include "SCA_ISensor.h"
-#include "SCA_LogicManager.h"
-#include "EXP_BoolValue.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_XNORController::SCA_XNORController(SCA_IObject* gameobj)
- :
- SCA_IController(gameobj)
-{
-}
-
-
-
-SCA_XNORController::~SCA_XNORController()
-{
-}
-
-
-
-void SCA_XNORController::Trigger(SCA_LogicManager* logicmgr)
-{
-
- bool sensorresult = true;
-
- for (vector<SCA_ISensor*>::const_iterator is=m_linkedsensors.begin();
- !(is==m_linkedsensors.end());is++)
- {
- SCA_ISensor* sensor = *is;
- if (sensor->GetState())
- {
- if (sensorresult == false)
- {
- sensorresult = true;
- break;
- }
- sensorresult = false;
- }
- }
-
- for (vector<SCA_IActuator*>::const_iterator i=m_linkedactuators.begin();
- !(i==m_linkedactuators.end());i++)
- {
- SCA_IActuator* actua = *i;
- logicmgr->AddActiveActuator(actua,sensorresult);
- }
-}
-
-
-
-CValue* SCA_XNORController::GetReplica()
-{
- CValue* replica = new SCA_XNORController(*this);
- // this will copy properties and so on...
- replica->ProcessReplica();
-
- return replica;
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_XNORController::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_XNORController",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_IController::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_XNORController::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_XNORController::Attributes[] = {
- { NULL } //Sentinel
-};
-
-#endif // WITH_PYTHON
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_XNORController.h b/source/gameengine/GameLogic/SCA_XNORController.h
deleted file mode 100644
index c257b71273e..00000000000
--- a/source/gameengine/GameLogic/SCA_XNORController.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_XNORController.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_XNORCONTROLLER_H__
-#define __SCA_XNORCONTROLLER_H__
-
-#include "SCA_IController.h"
-
-class SCA_XNORController : public SCA_IController
-{
- Py_Header
- //virtual void Trigger(class SCA_LogicManager* logicmgr);
-public:
- SCA_XNORController(SCA_IObject* gameobj);
- virtual ~SCA_XNORController();
- virtual CValue* GetReplica();
- virtual void Trigger(SCA_LogicManager* logicmgr);
-
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-
-};
-
-#endif /* __SCA_XNORCONTROLLER_H__ */
diff --git a/source/gameengine/GameLogic/SCA_XORController.cpp b/source/gameengine/GameLogic/SCA_XORController.cpp
deleted file mode 100644
index 70e99a7f819..00000000000
--- a/source/gameengine/GameLogic/SCA_XORController.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 'Xor' together all inputs
- *
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GameLogic/SCA_XORController.cpp
- * \ingroup gamelogic
- */
-
-
-#include "SCA_XORController.h"
-#include "SCA_ISensor.h"
-#include "SCA_LogicManager.h"
-#include "EXP_BoolValue.h"
-
-/* ------------------------------------------------------------------------- */
-/* Native functions */
-/* ------------------------------------------------------------------------- */
-
-SCA_XORController::SCA_XORController(SCA_IObject* gameobj)
- :
- SCA_IController(gameobj)
-{
-}
-
-
-
-SCA_XORController::~SCA_XORController()
-{
-}
-
-
-
-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++)
- {
- SCA_ISensor* sensor = *is;
- if (sensor->GetState())
- {
- if (sensorresult == true)
- {
- sensorresult = false;
- break;
- }
- sensorresult = true;
- }
- }
-
- for (vector<SCA_IActuator*>::const_iterator i=m_linkedactuators.begin();
- !(i==m_linkedactuators.end());i++)
- {
- SCA_IActuator* actua = *i;
- logicmgr->AddActiveActuator(actua,sensorresult);
- }
-}
-
-
-
-CValue* SCA_XORController::GetReplica()
-{
- CValue* replica = new SCA_XORController(*this);
- // this will copy properties and so on...
- replica->ProcessReplica();
-
- return replica;
-}
-
-#ifdef WITH_PYTHON
-
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
-/* Integration hooks ------------------------------------------------------- */
-PyTypeObject SCA_XORController::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "SCA_XORController",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &SCA_IController::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-PyMethodDef SCA_XORController::Methods[] = {
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef SCA_XORController::Attributes[] = {
- { NULL } //Sentinel
-};
-#endif // WITH_PYTHON
-
-/* eof */
diff --git a/source/gameengine/GameLogic/SCA_XORController.h b/source/gameengine/GameLogic/SCA_XORController.h
deleted file mode 100644
index c64a3380ede..00000000000
--- a/source/gameengine/GameLogic/SCA_XORController.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file SCA_XORController.h
- * \ingroup gamelogic
- */
-
-#ifndef __SCA_XORCONTROLLER_H__
-#define __SCA_XORCONTROLLER_H__
-
-#include "SCA_IController.h"
-
-class SCA_XORController : public SCA_IController
-{
- Py_Header
- //virtual void Trigger(class SCA_LogicManager* logicmgr);
-public:
- SCA_XORController(SCA_IObject* gameobj);
- virtual ~SCA_XORController();
- virtual CValue* GetReplica();
- virtual void Trigger(SCA_LogicManager* logicmgr);
-};
-
-#endif /* __SCA_XORCONTROLLER_H__ */