|
Blender
V2.59
|
00001 /* 00002 * Always trigger 00003 * 00004 * $Id: SCA_AlwaysSensor.cpp 35169 2011-02-25 13:32:11Z jesterking $ 00005 * 00006 * ***** BEGIN GPL LICENSE BLOCK ***** 00007 * 00008 * This program is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU General Public License 00010 * as published by the Free Software Foundation; either version 2 00011 * of the License, or (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software Foundation, 00020 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00021 * 00022 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00023 * All rights reserved. 00024 * 00025 * The Original Code is: all of this file. 00026 * 00027 * Contributor(s): none yet. 00028 * 00029 * ***** END GPL LICENSE BLOCK ***** 00030 */ 00031 00037 #if defined(WIN32) && !defined(FREE_WINDOWS) 00038 // This warning tells us about truncation of __long__ stl-generated names. 00039 // It can occasionally cause DevStudio to have internal compiler warnings. 00040 #pragma warning( disable : 4786 ) 00041 #endif 00042 00043 #include "SCA_AlwaysSensor.h" 00044 #include "SCA_LogicManager.h" 00045 #include "SCA_EventManager.h" 00046 00047 /* ------------------------------------------------------------------------- */ 00048 /* Native functions */ 00049 /* ------------------------------------------------------------------------- */ 00050 00051 SCA_AlwaysSensor::SCA_AlwaysSensor(class SCA_EventManager* eventmgr, 00052 SCA_IObject* gameobj) 00053 : SCA_ISensor(gameobj,eventmgr) 00054 { 00055 //SetDrawColor(255,0,0); 00056 Init(); 00057 } 00058 00059 void SCA_AlwaysSensor::Init() 00060 { 00061 m_alwaysresult = true; 00062 } 00063 00064 SCA_AlwaysSensor::~SCA_AlwaysSensor() 00065 { 00066 /* intentionally empty */ 00067 } 00068 00069 00070 00071 CValue* SCA_AlwaysSensor::GetReplica() 00072 { 00073 CValue* replica = new SCA_AlwaysSensor(*this);//m_float,GetName()); 00074 // this will copy properties and so on... 00075 replica->ProcessReplica(); 00076 00077 return replica; 00078 } 00079 00080 00081 00082 bool SCA_AlwaysSensor::IsPositiveTrigger() 00083 { 00084 return (m_invert ? false : true); 00085 } 00086 00087 00088 00089 bool SCA_AlwaysSensor::Evaluate() 00090 { 00091 /* Nice! :) */ 00092 //return true; 00093 /* even nicer ;) */ 00094 //return false; 00095 00096 /* nicest ! */ 00097 bool result = m_alwaysresult; 00098 m_alwaysresult = false; 00099 return result; 00100 } 00101 00102 #ifdef WITH_PYTHON 00103 00104 /* ------------------------------------------------------------------------- */ 00105 /* Python functions */ 00106 /* ------------------------------------------------------------------------- */ 00107 00108 /* Integration hooks ------------------------------------------------------- */ 00109 PyTypeObject SCA_AlwaysSensor::Type = { 00110 PyVarObject_HEAD_INIT(NULL, 0) 00111 "SCA_AlwaysSensor", 00112 sizeof(PyObjectPlus_Proxy), 00113 0, 00114 py_base_dealloc, 00115 0, 00116 0, 00117 0, 00118 0, 00119 py_base_repr, 00120 0,0,0,0,0,0,0,0,0, 00121 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, 00122 0,0,0,0,0,0,0, 00123 Methods, 00124 0, 00125 0, 00126 &SCA_ISensor::Type, 00127 0,0,0,0,0,0, 00128 py_base_new 00129 }; 00130 00131 PyMethodDef SCA_AlwaysSensor::Methods[] = { 00132 {NULL,NULL} //Sentinel 00133 }; 00134 00135 PyAttributeDef SCA_AlwaysSensor::Attributes[] = { 00136 { NULL } //Sentinel 00137 }; 00138 00139 #endif 00140 00141 /* eof */