Changeset 9746 in orxonox.OLD for branches/new_class_id
- Timestamp:
- Sep 16, 2006, 3:34:04 PM (18 years ago)
- Location:
- branches/new_class_id/src
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/effects/cloud_effect.cc
r9716 r9746 50 50 51 51 CREATE_SCRIPTABLE_CLASS(CloudEffect, CloudEffect::classID(), 52 addMethod("skyColor", Executor Lua4<CloudEffect,float,float,float,float>(&CloudEffect::shellSkyColor))53 ->addMethod("cloudColor", Executor Lua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor))54 ->addMethod("activate", Executor Lua0<CloudEffect>(&CloudEffect::activate))55 ->addMethod("deactivate", Executor Lua0<CloudEffect>(&CloudEffect::deactivate))52 addMethod("skyColor", Executor4<CloudEffect, lua_State*,float,float,float,float>(&CloudEffect::shellSkyColor)) 53 ->addMethod("cloudColor", Executor4<CloudEffect, lua_State*,float,float,float,float>(&CloudEffect::shellCloudColor)) 54 ->addMethod("activate", Executor0<CloudEffect, lua_State*>(&CloudEffect::activate)) 55 ->addMethod("deactivate", Executor0<CloudEffect, lua_State*>(&CloudEffect::deactivate)) 56 56 ); 57 57 -
branches/new_class_id/src/lib/graphics/effects/fog_effect.cc
r9716 r9746 21 21 #include "script_class.h" 22 22 #include "cloud_effect.h" 23 #include "debug.h" 23 24 24 25 ObjectListDefinition(FogEffect); … … 32 33 33 34 CREATE_SCRIPTABLE_CLASS(FogEffect, FogEffect::classID(), 34 addMethod("fadeIn", Executor Lua0<FogEffect>(&FogEffect::fadeInFog))35 ->addMethod("fadeOut", Executor Lua0<FogEffect>(&FogEffect::fadeOutFog))36 ->addMethod("activate", Executor Lua0<FogEffect>(&FogEffect::activate))37 ->addMethod("deactivate", Executor Lua0<FogEffect>(&FogEffect::deactivate))35 addMethod("fadeIn", Executor0<FogEffect, lua_State*>(&FogEffect::fadeInFog)) 36 ->addMethod("fadeOut", Executor0<FogEffect, lua_State*>(&FogEffect::fadeOutFog)) 37 ->addMethod("activate", Executor0<FogEffect, lua_State*>(&FogEffect::activate)) 38 ->addMethod("deactivate", Executor0<FogEffect, lua_State*>(&FogEffect::deactivate)) 38 39 ); 39 40 -
branches/new_class_id/src/lib/graphics/effects/lightning_effect.cc
r9716 r9746 27 27 #include "cloud_effect.h" 28 28 #include "script_class.h" 29 #include "debug.h" 29 30 #include "class_id_DEPRECATED.h" 30 31 … … 35 36 36 37 CREATE_SCRIPTABLE_CLASS(LightningEffect, LightningEffect::classID(), 37 addMethod("activate", Executor Lua0<LightningEffect>(&LightningEffect::activate))38 ->addMethod("deactivate", Executor Lua0<LightningEffect>(&LightningEffect::deactivate))38 addMethod("activate", Executor0<LightningEffect, lua_State*>(&LightningEffect::activate)) 39 ->addMethod("deactivate", Executor0<LightningEffect, lua_State*>(&LightningEffect::deactivate)) 39 40 ); 40 41 -
branches/new_class_id/src/lib/graphics/effects/rain_effect.cc
r9716 r9746 30 30 #include "cloud_effect.h" 31 31 #include "script_class.h" 32 #include "debug.h" 32 33 33 34 #include "class_id_DEPRECATED.h" … … 44 45 45 46 CREATE_SCRIPTABLE_CLASS(RainEffect, RainEffect::classID(), 46 addMethod("startRaining", Executor Lua0<RainEffect>(&RainEffect::startRaining))47 ->addMethod("stopRaining", Executor Lua0<RainEffect>(&RainEffect::stopRaining))48 ->addMethod("activate", Executor Lua0<RainEffect>(&RainEffect::activate))49 ->addMethod("deactivate", Executor Lua0<RainEffect>(&RainEffect::deactivate))47 addMethod("startRaining", Executor0<RainEffect, lua_State*>(&RainEffect::startRaining)) 48 ->addMethod("stopRaining", Executor0<RainEffect, lua_State*>(&RainEffect::stopRaining)) 49 ->addMethod("activate", Executor0<RainEffect, lua_State*>(&RainEffect::activate)) 50 ->addMethod("deactivate", Executor0<RainEffect, lua_State*>(&RainEffect::deactivate)) 50 51 ); 51 52 -
branches/new_class_id/src/lib/graphics/effects/snow_effect.cc
r9716 r9746 38 38 39 39 CREATE_SCRIPTABLE_CLASS(SnowEffect, SnowEffect::classID(), 40 addMethod("activate", Executor Lua0<SnowEffect>(&SnowEffect::activate))41 ->addMethod("deactivate", Executor Lua0<SnowEffect>(&SnowEffect::deactivate))40 addMethod("activate", Executor0<SnowEffect, lua_State*>(&SnowEffect::activate)) 41 ->addMethod("deactivate", Executor0<SnowEffect, lua_State*>(&SnowEffect::deactivate)) 42 42 ); 43 43 -
branches/new_class_id/src/lib/script_engine/script.cc
r9720 r9746 26 26 27 27 CREATE_SCRIPTABLE_CLASS(Script, Script::classID(), 28 addMethod("addObject", Executor Lua2<Script,const std::string&, const std::string& >(&Script::addObject))29 ->addMethod("registerClass", Executor Lua1<Script,const std::string&>(&Script::registerClass))30 ->addMethod("selectFunction", Executor Lua2ret<Script, bool, const std::string&, int >(&Script::selectFunction))31 ->addMethod("executeFunction", Executor Lua0ret<Script,bool >(&Script::executeFunction))28 addMethod("addObject", Executor2<Script, lua_State*,const std::string&, const std::string& >(&Script::addObject)) 29 ->addMethod("registerClass", Executor1<Script, lua_State*,const std::string&>(&Script::registerClass)) 30 ->addMethod("selectFunction", Executor2ret<Script, lua_State*, bool, const std::string&, int >(&Script::selectFunction)) 31 ->addMethod("executeFunction", Executor0ret<Script, lua_State*,bool >(&Script::executeFunction)) 32 32 ); 33 33 -
branches/new_class_id/src/lib/script_engine/script_method.h
r9727 r9746 9 9 #include <vector> 10 10 11 #include "executor/executor_lua .h"12 11 #include "executor/executor_lua_state.h" 12 #include "executor/executor_member.h" 13 13 14 14 class ScriptMethod -
branches/new_class_id/src/lib/util/Makefile.am
r9743 r9746 8 8 libORXexecutor_a_SOURCES = \ 9 9 executor/executor.cc \ 10 executor/executor_lua.cc \11 10 executor/executor_lua_state.cc \ 12 11 executor/executor_substring.cc … … 49 48 executor/executor.h \ 50 49 executor/executor_xml.h \ 51 executor/executor_lua.h \52 50 executor/executor_lua_state.h \ 53 51 executor/executor_substring.h \ -
branches/new_class_id/src/lib/util/executor/executor_generic.h
r9745 r9746 74 74 */ 75 75 __EXECUTOR_FUNCTIONAL_NAME(0,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST ) 76 : Executor<CallType, BaseClass>(false, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 77 { 78 this->functionPointer = functionPointer; 79 }; 76 : Executor<CallType, BaseClass>(false, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 77 {}; 80 78 81 79 /** … … 118 116 */ 119 117 __EXECUTOR_FUNCTIONAL_NAME(1,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) 120 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 121 { 122 this->functionPointer = functionPointer; 123 }; 118 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 119 {}; 124 120 125 121 /** … … 163 159 */ 164 160 __EXECUTOR_FUNCTIONAL_NAME(2,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) 165 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 166 { 167 this->functionPointer = functionPointer; 168 }; 161 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 162 {}; 169 163 170 164 /** … … 209 203 */ 210 204 __EXECUTOR_FUNCTIONAL_NAME(3,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST) 211 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 212 { 213 this->functionPointer = functionPointer; 214 }; 205 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 206 {}; 215 207 216 208 /** … … 256 248 */ 257 249 __EXECUTOR_FUNCTIONAL_NAME(4,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST) 258 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 259 { 260 this->functionPointer = functionPointer; 261 }; 250 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 251 {}; 262 252 263 253 /** … … 304 294 */ 305 295 __EXECUTOR_FUNCTIONAL_NAME(5,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST) 306 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 307 { 308 this->functionPointer = functionPointer; 309 }; 296 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 297 {}; 310 298 311 299 /** … … 334 322 }; 335 323 324 325 //////////////////// 326 //// 0 & RETURN //// 327 //////////////////// 328 //! @brief ExecutorClass, that can execute Functions with one parameter. 329 template<class T, typename CallType, typename ret, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 330 class __EXECUTOR_FUNCTIONAL_NAME(0,ret) : public Executor<CallType, BaseClass> 331 { 332 private: 333 /** @brief the FunctioPointer. */ 334 ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST; 335 336 public: 337 /** 338 * @brief constructs the Executor. 339 * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. 340 */ 341 __EXECUTOR_FUNCTIONAL_NAME(0,ret) (ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) 342 : Executor<CallType, BaseClass>(true, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 343 {}; 344 345 /** 346 * @brief executes the Functional 347 * @param object the Object the action should be executed on. 348 * @param eval the CallType to get the Parameters from. 349 */ 350 virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const 351 { 352 Evaluater<CallType>().template storeRet<ret>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)()); 353 }; 354 355 /** 356 * @brief copies the Executor 357 * @returns a new Executor that's a copy of this one. 358 */ 359 virtual Executor<CallType, BaseClass>* clone() const 360 { 361 return new __EXECUTOR_FUNCTIONAL_NAME(0,ret)<T, CallType, ret>(this->functionPointer); 362 }; 363 }; 364 365 //////////////////// 366 //// 1 & RETURN //// 367 //////////////////// 368 //! @brief ExecutorClass, that can execute Functions with one parameter. 369 template<class T, typename CallType, typename ret, typename type0, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 370 class __EXECUTOR_FUNCTIONAL_NAME(1,ret) : public Executor<CallType, BaseClass> 371 { 372 private: 373 /** @brief the FunctioPointer. */ 374 ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST; 375 376 public: 377 /** 378 * @brief constructs the Executor. 379 * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. 380 */ 381 __EXECUTOR_FUNCTIONAL_NAME(1,ret) (ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) 382 : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 383 {}; 384 385 /** 386 * @brief executes the Functional 387 * @param object the Object the action should be executed on. 388 * @param eval the CallType to get the Parameters from. 389 */ 390 virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const 391 { 392 Evaluater<CallType>().template storeRet<ret>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 393 Evaluater<CallType>().template operator()<type0, 0>(eval, this->defaultValue))); 394 }; 395 396 /** 397 * @brief copies the Executor 398 * @returns a new Executor that's a copy of this one. 399 */ 400 virtual Executor<CallType, BaseClass>* clone() const 401 { 402 return new __EXECUTOR_FUNCTIONAL_NAME(1,ret)<T, CallType, ret, type0>(this->functionPointer); 403 }; 404 }; 405 406 407 //////////////////// 408 //// 1 & RETURN //// 409 //////////////////// 410 //! @brief ExecutorClass, that can execute Functions with one parameter. 411 template<class T, typename CallType, typename ret, typename type0, typename type1, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 412 class __EXECUTOR_FUNCTIONAL_NAME(2,ret) : public Executor<CallType, BaseClass> 413 { 414 private: 415 /** @brief the FunctioPointer. */ 416 ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST; 417 418 public: 419 /** 420 * @brief constructs the Executor. 421 * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. 422 */ 423 __EXECUTOR_FUNCTIONAL_NAME(2,ret) (ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) 424 : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 425 {}; 426 427 /** 428 * @brief executes the Functional 429 * @param object the Object the action should be executed on. 430 * @param eval the CallType to get the Parameters from. 431 */ 432 virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const 433 { 434 Evaluater<CallType>().template storeRet<ret>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 435 Evaluater<CallType>().template operator()<type0, 0>(eval, this->defaultValue), 436 Evaluater<CallType>().template operator()<type1, 1>(eval, this->defaultValue))); 437 }; 438 439 /** 440 * @brief copies the Executor 441 * @returns a new Executor that's a copy of this one. 442 */ 443 virtual Executor<CallType, BaseClass>* clone() const 444 { 445 return new __EXECUTOR_FUNCTIONAL_NAME(2,ret)<T, CallType, ret, type0, type1>(this->functionPointer); 446 }; 447 }; 448 336 449 #endif /* __EXECUTOR_FUNCTIONAL_NAME */ -
branches/new_class_id/src/lib/util/executor/executor_lua_state.h
r9745 r9746 66 66 return (fromLua<ToType>(CallValue, index)); 67 67 } 68 template <typename ToType> 69 void storeRet(lua_State*& state, ToType value) 70 { 71 toLua<ToType>(state, value); 72 } 68 73 static lua_State*& defaultValue() { static lua_State* nullState; return nullState; }; 69 74 }; -
branches/new_class_id/src/story_entities/game_world.cc
r9727 r9746 64 64 ObjectListDefinition(GameWorld); 65 65 CREATE_SCRIPTABLE_CLASS(GameWorld, GameWorld::classID(), 66 addMethod("setPlaymode", ExecutorLua1<GameWorld,const std::string&>(&GameWorld::setPlaymode))67 ->addMethod("setSoundtrack", Executor Lua1<GameWorld, const std::string&>(&GameWorld::setSoundtrack))66 addMethod("setPlaymode", Executor1<GameWorld, lua_State*,const std::string&>(&GameWorld::setPlaymode)) 67 ->addMethod("setSoundtrack", Executor1<GameWorld, lua_State*, const std::string&>(&GameWorld::setSoundtrack)) 68 68 ); 69 69 -
branches/new_class_id/src/world_entities/creatures/fps_player.cc
r9716 r9746 47 47 #include "script_class.h" 48 48 CREATE_SCRIPTABLE_CLASS(FPSPlayer, FPSPlayer::classID(), 49 addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))50 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))51 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))52 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))49 addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 50 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 51 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 52 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 53 53 ); 54 54 -
branches/new_class_id/src/world_entities/environments/mapped_water.cc
r9716 r9746 33 33 34 34 CREATE_SCRIPTABLE_CLASS(MappedWater, MappedWater::classID(), 35 addMethod("waterUV", Executor Lua2<MappedWater, float, float>(&MappedWater::fadeWaterUV))36 ->addMethod("waterFlow", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterFlow))37 ->addMethod("shineSize", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeShineSize))38 ->addMethod("shineStrength", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeShineStrength))39 ->addMethod("reflStrength", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeReflStrength))40 ->addMethod("refraction", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeRefraction))41 ->addMethod("waterHeight", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterHeight))42 ->addMethod("waterColor", ExecutorLua4<MappedWater, float, float, float, float>(&MappedWater::fadeWaterColor)));35 addMethod("waterUV", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterUV)) 36 ->addMethod("waterFlow", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterFlow)) 37 ->addMethod("shineSize", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeShineSize)) 38 ->addMethod("shineStrength", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeShineStrength)) 39 ->addMethod("reflStrength", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeReflStrength)) 40 ->addMethod("refraction", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeRefraction)) 41 ->addMethod("waterHeight", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterHeight)) 42 ->addMethod("waterColor", Executor4<MappedWater, lua_State*, float, float, float, float>(&MappedWater::fadeWaterColor))); 43 43 44 44 -
branches/new_class_id/src/world_entities/npcs/attractor_mine.cc
r9716 r9746 38 38 #include "script_class.h" 39 39 CREATE_SCRIPTABLE_CLASS(AttractorMine, AttractorMine::classID(), 40 addMethod("setName", Executor Lua1<BaseObject,const std::string&>(&BaseObject::setName))41 //Coordinates42 ->addMethod("setAbsCoor", Executor Lua3<PNode,float,float,float>(&PNode::setAbsCoor))43 ->addMethod("getAbsCoorX", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorX))44 ->addMethod("getAbsCoorY", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorY))45 ->addMethod("getAbsCoorZ", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorZ))40 addMethod("setName", Executor1<BaseObject, lua_State*,const std::string&>(&BaseObject::setName)) 41 //Coordinates 42 ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 43 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 44 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 45 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 46 46 ); 47 47 -
branches/new_class_id/src/world_entities/npcs/gate.cc
r9716 r9746 38 38 #include "script_class.h" 39 39 CREATE_SCRIPTABLE_CLASS(Gate, Gate::classID(), 40 addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))41 ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))42 ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy))43 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))44 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))45 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))46 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))40 addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide)) 41 ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide)) 42 ->addMethod("destroy", Executor0<Gate, lua_State*>(&Gate::destroy)) 43 ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 44 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 45 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 46 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 47 47 ); 48 48 -
branches/new_class_id/src/world_entities/npcs/generic_npc.cc
r9716 r9746 39 39 CREATE_SCRIPTABLE_CLASS(GenericNPC, GenericNPC::classID(), 40 40 // Move 41 addMethod("walkTo", Executor Lua3<GenericNPC,float,float,float>(&GenericNPC::walkTo))42 ->addMethod("runTo", Executor Lua3<GenericNPC,float,float,float>(&GenericNPC::runTo))43 ->addMethod("turnTo", Executor Lua1<GenericNPC,float>(&GenericNPC::turnTo))44 ->addMethod("finalGoalReached", Executor Lua0ret<GenericNPC,bool>(&GenericNPC::finalGoalReached))45 ->addMethod("stop", Executor Lua0<GenericNPC>(&GenericNPC::stop))46 ->addMethod("resume", Executor Lua0<GenericNPC>(&GenericNPC::resume))47 ->addMethod("playAnimation", Executor Lua2<GenericNPC,int,int>(&GenericNPC::playAnimation))41 addMethod("walkTo", Executor3<GenericNPC, lua_State*,float,float,float>(&GenericNPC::walkTo)) 42 ->addMethod("runTo", Executor3<GenericNPC, lua_State*,float,float,float>(&GenericNPC::runTo)) 43 ->addMethod("turnTo", Executor1<GenericNPC, lua_State*,float>(&GenericNPC::turnTo)) 44 ->addMethod("finalGoalReached", Executor0ret<GenericNPC, lua_State*,bool>(&GenericNPC::finalGoalReached)) 45 ->addMethod("stop", Executor0<GenericNPC, lua_State*>(&GenericNPC::stop)) 46 ->addMethod("resume", Executor0<GenericNPC, lua_State*>(&GenericNPC::resume)) 47 ->addMethod("playAnimation", Executor2<GenericNPC, lua_State*,int,int>(&GenericNPC::playAnimation)) 48 48 // Display 49 ->addMethod("hide", Executor Lua0<WorldEntity>(&WorldEntity::hide))50 ->addMethod("unhide", Executor Lua0<WorldEntity>(&WorldEntity::unhide))49 ->addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide)) 50 ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide)) 51 51 // Coordinates 52 ->addMethod("getAbsCoorX", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorX))53 ->addMethod("getAbsCoorY", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorY))54 ->addMethod("getAbsCoorZ", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorZ))55 ->addMethod("setAbsCoor", Executor Lua3<PNode,float,float,float>(&PNode::setAbsCoor))56 ->addMethod("setAbsDir", Executor Lua4<PNode,float,float,float,float>(&PNode::setAbsDir))52 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 53 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 54 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 55 ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 56 ->addMethod("setAbsDir", Executor4<PNode, lua_State*,float,float,float,float>(&PNode::setAbsDir)) 57 57 ); 58 58 … … 234 234 this->setAnimationSpeed(0.5f); 235 235 } 236 236 break; 237 237 case Run: 238 238 { … … 247 247 this->setAnimationSpeed(1.0f); 248 248 } 249 249 break; 250 250 case Crouch: 251 251 { … … 260 260 this->setAnimationSpeed(1.0f); 261 261 } 262 262 break; 263 263 case LookAt: 264 265 266 264 if( this->getAnimation() != STAND) 265 this->setAnimation(STAND, MD2_ANIM_LOOP); 266 break; 267 267 case Shoot: 268 269 270 268 if( this->getAnimation() != STAND) 269 this->setAnimation(STAND, MD2_ANIM_LOOP); 270 break; 271 271 272 272 default: 273 274 275 273 if( this->getAnimation() != STAND) 274 this->setAnimation(STAND, MD2_ANIM_LOOP); 275 break; 276 276 277 277 } … … 307 307 this->setAnimationSpeed(0.5f); 308 308 } 309 309 break; 310 310 case Run: 311 311 { … … 320 320 this->setAnimationSpeed(1.0f); 321 321 } 322 322 break; 323 323 case Crouch: 324 324 { … … 333 333 this->setAnimationSpeed(1.0f); 334 334 } 335 335 break; 336 336 case LookAt: 337 337 { … … 339 339 this->setAnimation(STAND, MD2_ANIM_LOOP); 340 340 } 341 341 break; 342 342 case Shoot: 343 343 if( this->getAnimation() != STAND) 344 344 this->setAnimation(STAND, MD2_ANIM_LOOP); 345 345 break; 346 346 347 347 default: 348 348 if( this->getAnimation() != STAND) 349 349 this->setAnimation(STAND, MD2_ANIM_LOOP); 350 350 break; 351 351 352 352 } … … 510 510 { 511 511 case Walk: 512 { 513 Vector dest = currentAnimation.v - this->getAbsCoor(); 514 dest.y = 0.0f; 515 if (dest.len() < .5) 512 516 { 513 Vector dest = currentAnimation.v - this->getAbsCoor(); 514 dest.y = 0.0f; 515 if (dest.len() < .5) 516 { 517 this->nextStep(); 518 } 519 else 520 { 521 Vector move = dest.getNormalized() * currentAnimation.speed * dt; 522 this->shiftCoor(move); 523 } 517 this->nextStep(); 524 518 } 525 break; 519 else 520 { 521 Vector move = dest.getNormalized() * currentAnimation.speed * dt; 522 this->shiftCoor(move); 523 } 524 } 525 break; 526 526 527 527 case Run: … … 552 552 553 553 case TurnTo: 554 555 554 //Quaternion direction = this-> 555 break; 556 556 557 557 case LookAt: 558 558 break; 559 559 560 560 case Shoot: 561 561 break; 562 562 563 563 default: 564 564 break; 565 565 566 566 } … … 572 572 this->fallVelocity += 300.0f * dt; 573 573 //velocity -= Vector(0.0, 1.0, 0.0) * this->fallVelocity; 574 // PRINTF(0)("%s is not on ground\n", this->getName());574 // PRINTF(0)("%s is not on ground\n", this->getName()); 575 575 this->shiftCoor(Vector(0, -this->fallVelocity * dt,0)); 576 576 -
branches/new_class_id/src/world_entities/script_trigger.cc
r9715 r9746 19 19 20 20 #include "state.h" 21 21 #include "debug.h" 22 22 ObjectListDefinition(ScriptTrigger); 23 23 24 24 CREATE_SCRIPTABLE_CLASS(ScriptTrigger, ScriptTrigger::classID(), 25 25 // Coordinates 26 addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))27 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))28 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))29 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))26 addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 27 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 28 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 29 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 30 30 //Properties 31 ->addMethod("setName", ExecutorLua1<BaseObject, const std::string&>(&BaseObject::setName))32 ->addMethod("setTarget", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTarget))33 ->addMethod("setTriggerParent", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTriggerParent))34 ->addMethod("setTriggerRemains", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setTriggerRemains))35 ->addMethod("setActiveOnCreation", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setActiveOnCreation))36 ->addMethod("setInvert", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setInvert))37 ->addMethod("setRadius", ExecutorLua1<ScriptTrigger, float>(&ScriptTrigger::setRadius))38 ->addMethod("setScript", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setScript))39 ->addMethod("setFunction", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setFunction))40 ->addMethod("setDebugDraw", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setDebugDraw))41 ->addMethod("setAddToScript", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setAddToScript))31 ->addMethod("setName", Executor1<BaseObject, lua_State*, const std::string&>(&BaseObject::setName)) 32 ->addMethod("setTarget", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setTarget)) 33 ->addMethod("setTriggerParent", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setTriggerParent)) 34 ->addMethod("setTriggerRemains", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setTriggerRemains)) 35 ->addMethod("setActiveOnCreation", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setActiveOnCreation)) 36 ->addMethod("setInvert", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setInvert)) 37 ->addMethod("setRadius", Executor1<ScriptTrigger, lua_State*, float>(&ScriptTrigger::setRadius)) 38 ->addMethod("setScript", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setScript)) 39 ->addMethod("setFunction", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setFunction)) 40 ->addMethod("setDebugDraw", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setDebugDraw)) 41 ->addMethod("setAddToScript", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setAddToScript)) 42 42 ); 43 43 -
branches/new_class_id/src/world_entities/space_ships/helicopter.cc
r9716 r9746 39 39 #include "script_class.h" 40 40 CREATE_SCRIPTABLE_CLASS(Helicopter, Helicopter::classID(), 41 addMethod("moveUp", ExecutorLua1<Helicopter,bool>(&Helicopter::moveUp))42 ->addMethod("moveDown", ExecutorLua1<Helicopter,bool>(&Helicopter::moveDown))43 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))44 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))45 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))46 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))41 addMethod("moveUp", Executor1<Helicopter, lua_State*,bool>(&Helicopter::moveUp)) 42 ->addMethod("moveDown", Executor1<Helicopter, lua_State*,bool>(&Helicopter::moveDown)) 43 ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 44 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 45 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 46 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 47 47 48 48 ); -
branches/new_class_id/src/world_entities/space_ships/hover.cc
r9716 r9746 40 40 #include "script_class.h" 41 41 CREATE_SCRIPTABLE_CLASS(Hover, Hover::classID(), 42 addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))42 addMethod("hasPlayer", Executor0ret<Playable, lua_State*,bool>(&Playable::hasPlayer)) 43 43 //Coordinates 44 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))45 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))46 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))47 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))44 ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 45 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 46 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 47 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 48 48 ); 49 49 -
branches/new_class_id/src/world_entities/space_ships/space_ship.cc
r9716 r9746 59 59 #include "script_class.h" 60 60 CREATE_SCRIPTABLE_CLASS(SpaceShip, SpaceShip::classID(), 61 addMethod("hasPlayer", Executor Lua0ret<Playable,bool>(&Playable::hasPlayer))62 ->addMethod("fire", Executor Lua1<Playable, bool>(&Playable::fire))63 ->addMethod("loadModel", Executor Lua2<WorldEntity,const std::string& ,float>(&WorldEntity::loadModel2))64 ->addMethod("setName", Executor Lua1<BaseObject,const std::string&>(&BaseObject::setName))65 ->addMethod("hide", Executor Lua0<WorldEntity>(&WorldEntity::hide))66 ->addMethod("unhide", Executor Lua0<WorldEntity>(&WorldEntity::unhide))67 //Coordinates68 ->addMethod("setAbsCoor", Executor Lua3<PNode,float,float,float>(&PNode::setAbsCoor))69 ->addMethod("getAbsCoorX", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorX))70 ->addMethod("getAbsCoorY", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorY))71 ->addMethod("getAbsCoorZ", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorZ))61 addMethod("hasPlayer", Executor0ret<Playable, lua_State*,bool>(&Playable::hasPlayer)) 62 ->addMethod("fire", Executor1<Playable, lua_State*, bool>(&Playable::fire)) 63 ->addMethod("loadModel", Executor2<WorldEntity, lua_State*,const std::string& ,float>(&WorldEntity::loadModel2)) 64 ->addMethod("setName", Executor1<BaseObject, lua_State*,const std::string&>(&BaseObject::setName)) 65 ->addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide)) 66 ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide)) 67 //Coordinates 68 ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 69 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 70 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 71 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 72 72 ); 73 73 … … 118 118 void SpaceShip::init() 119 119 { 120 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));120 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 121 121 this->registerObject(this, SpaceShip::_objectList); 122 122 … … 147 147 controlVelocityY = 150; 148 148 shipInertia = 1.5; 149 // cycle = 0.0;149 // cycle = 0.0; 150 150 151 151 this->setHealthMax(100); … … 158 158 this->pitchDir = this->getAbsDir(); 159 159 160 // GLGuiButton* button = new GLGuiPushButton();161 // button->show();162 // button->setLabel("orxonox");163 // button->setBindNode(this);164 // GLGuiBar* bar = new GLGuiBar();165 // bar->show();166 // bar->setValue(7.0);167 // bar->setMaximum(10);168 // bar->setSize2D( 20, 100);169 // bar->setAbsCoor2D( 10, 200);160 // GLGuiButton* button = new GLGuiPushButton(); 161 // button->show(); 162 // button->setLabel("orxonox"); 163 // button->setBindNode(this); 164 // GLGuiBar* bar = new GLGuiBar(); 165 // bar->show(); 166 // bar->setValue(7.0); 167 // bar->setMaximum(10); 168 // bar->setSize2D( 20, 100); 169 // bar->setAbsCoor2D( 10, 200); 170 170 171 171 //add events to the eventlist … … 202 202 this->getWeaponManager().setSlotPosition(5, Vector(-1.5, -.5, -.5)); 203 203 this->getWeaponManager().setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0))); 204 //205 206 207 208 // this->getWeaponManager().setSlotPosition(8, Vector(-2.5, -0.3, -2.0));209 // this->getWeaponManager().setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));210 //211 // this->getWeaponManager().setSlotPosition(9, Vector(-2.5, -0.3, 2.0));212 // this->getWeaponManager().setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:204 // 205 this->getWeaponManager().setSlotPosition(6, Vector(-1, 0.0, 0)); 206 this->getWeaponManager().setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 207 // 208 // this->getWeaponManager().setSlotPosition(8, Vector(-2.5, -0.3, -2.0)); 209 // this->getWeaponManager().setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0))); 210 // 211 // this->getWeaponManager().setSlotPosition(9, Vector(-2.5, -0.3, 2.0)); 212 // this->getWeaponManager().setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));: 213 213 214 214 this->getWeaponManager().getFixedTarget()->setParent(this); … … 312 312 void SpaceShip::collidesWith(WorldEntity* entity, const Vector& location) 313 313 { 314 315 314 } 316 315 … … 334 333 335 334 if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == SharedNetworkData::getInstance()->getHostID() ) 336 335 { 337 336 if (xMouse > controlVelocityX) xMouse = controlVelocityX; 338 337 else if (xMouse < -controlVelocityX) xMouse = -controlVelocityX; … … 344 343 mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity*yInvert, Vector(0,0,1))*pitchDir); 345 344 xMouse = yMouse = 0; 346 347 348 349 // if( this != State::getPlayer()->getControllable())350 // return;345 } 346 347 348 // if( this != State::getPlayer()->getControllable()) 349 // return; 351 350 352 351 // spaceship controlled movement fire(bool bF){ this->bFire = bF;} 353 352 //if (this->getOwner() == this->getHostID()) 354 353 this->calculateVelocity(time); 355 354 356 355 … … 365 364 366 365 //orient the spaceship in direction of the mouse 367 368 366 rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, 0.5);//fabsf(time)*shipInertia); 367 if (this->getAbsDir().distance(rotQuat) > 0.00000000000001) 369 368 this->setAbsDir( rotQuat); 370 369 //this->setAbsDirSoft(mouseDir,5); 371 370 372 371 // this is the air friction (necessary for a smooth control) … … 390 389 this->shiftCoor(move); 391 390 392 // PRINTF(0)("id of %s is: %i\n", this->getName(), this->getOMListNumber());391 // PRINTF(0)("id of %s is: %i\n", this->getName(), this->getOMListNumber()); 393 392 394 393 } … … 411 410 412 411 if( this->bUp ) 413 414 415 416 417 418 412 { 413 //this->shiftCoor(this->getAbsDirX()); 414 //accel += (this->getAbsDirX())*2; 415 accel += (this->getAbsDirX())*acceleration; 416 417 } 419 418 420 419 if( this->bDown ) 421 422 423 420 { 421 //this->shiftCoor((this->getAbsDirX())*-1); 422 //accel -= (this->getAbsDirX())*2; 424 423 //if(velocity.len() > 50) 425 426 427 428 429 424 accel -= (this->getAbsDirX())*0.5*acceleration; 425 426 427 428 } 430 429 431 430 if( this->bLeft/* > -this->getRelCoor().z*2*/) 432 431 { 433 432 this->shiftDir(Quaternion(time, Vector(0,1,0))); 434 // accel -= rightDirection;433 // accel -= rightDirection; 435 434 //velocityDir.normalize(); 436 435 //rot +=Vector(1,0,0); … … 451 450 { 452 451 mouseDir *= Quaternion(-time*2, Vector(1,0,0)); 453 // accel -= rightDirection;452 // accel -= rightDirection; 454 453 //velocityDir.normalize(); 455 454 //rot +=Vector(1,0,0); … … 469 468 this->shiftDir(Quaternion(time, Vector(0,0,1))); 470 469 471 // accel += upDirection;470 // accel += upDirection; 472 471 //velocityDir.normalize(); 473 472 //rot += Vector(0,0,1); … … 497 496 498 497 if( event.type == KeyMapper::PEV_LEFT) 499 498 this->bRollL = event.bPressed; 500 499 else if( event.type == KeyMapper::PEV_RIGHT) 501 500 this->bRollR = event.bPressed; 502 501 else if( event.type == KeyMapper::PEV_FORWARD) 503 502 this->bUp = event.bPressed; //this->shiftCoor(0,.1,0); -
branches/new_class_id/src/world_entities/space_ships/spacecraft_2d.cc
r9716 r9746 43 43 44 44 CREATE_SCRIPTABLE_CLASS(Spacecraft2D, Spacecraft2D::classID(), 45 addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))45 addMethod("hasPlayer", Executor0ret<Playable, lua_State*,bool>(&Playable::hasPlayer)) 46 46 //Coordinates 47 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))48 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))49 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))50 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))51 ->addMethod("setAirFriction", ExecutorLua1<Spacecraft2D, float>(&Spacecraft2D::setAirFriction))47 ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 48 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 49 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 50 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 51 ->addMethod("setAirFriction", Executor1<Spacecraft2D, lua_State*, float>(&Spacecraft2D::setAirFriction)) 52 52 ); 53 53 -
branches/new_class_id/src/world_entities/test_entity.cc
r9716 r9746 26 26 27 27 #include "test_entity.h" 28 28 #include "debug.h" 29 29 30 30 #include "interactive_model.h" … … 41 41 #include "script_class.h" 42 42 CREATE_SCRIPTABLE_CLASS(TestEntity, TestEntity::classID(), 43 addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 44 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) 45 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY)) 46 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 47 43 addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 44 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 45 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 46 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 48 47 ); 49 48 … … 92 91 93 92 LoadParam(root, "md2animation", this, TestEntity, setAnim) 94 95 93 .describe("sets the animation of the md2 model") 94 .defaultValues(1); 96 95 97 96 }
Note: See TracChangeset
for help on using the changeset viewer.