Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9746 in orxonox.OLD for branches/new_class_id/src


Ignore:
Timestamp:
Sep 16, 2006, 3:34:04 PM (18 years ago)
Author:
bensch
Message:

orxonox/new_class_id: does not run anymore with scripts, but i think, it is on track

lua_State is now handled over the Global Executor

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  
    5050
    5151CREATE_SCRIPTABLE_CLASS(CloudEffect, CloudEffect::classID(),
    52                         addMethod("skyColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellSkyColor))
    53                         ->addMethod("cloudColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor))
    54                         ->addMethod("activate", ExecutorLua0<CloudEffect>(&CloudEffect::activate))
    55                         ->addMethod("deactivate", ExecutorLua0<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))
    5656                       );
    5757
  • branches/new_class_id/src/lib/graphics/effects/fog_effect.cc

    r9716 r9746  
    2121#include "script_class.h"
    2222#include "cloud_effect.h"
     23#include "debug.h"
    2324
    2425ObjectListDefinition(FogEffect);
     
    3233
    3334CREATE_SCRIPTABLE_CLASS(FogEffect, FogEffect::classID(),
    34                         addMethod("fadeIn", ExecutorLua0<FogEffect>(&FogEffect::fadeInFog))
    35                             ->addMethod("fadeOut", ExecutorLua0<FogEffect>(&FogEffect::fadeOutFog))
    36                             ->addMethod("activate", ExecutorLua0<FogEffect>(&FogEffect::activate))
    37                             ->addMethod("deactivate", ExecutorLua0<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))
    3839                       );
    3940
  • branches/new_class_id/src/lib/graphics/effects/lightning_effect.cc

    r9716 r9746  
    2727#include "cloud_effect.h"
    2828#include "script_class.h"
     29#include "debug.h"
    2930#include "class_id_DEPRECATED.h"
    3031
     
    3536
    3637CREATE_SCRIPTABLE_CLASS(LightningEffect, LightningEffect::classID(),
    37                         addMethod("activate", ExecutorLua0<LightningEffect>(&LightningEffect::activate))
    38                             ->addMethod("deactivate", ExecutorLua0<LightningEffect>(&LightningEffect::deactivate))
     38                        addMethod("activate", Executor0<LightningEffect, lua_State*>(&LightningEffect::activate))
     39                            ->addMethod("deactivate", Executor0<LightningEffect, lua_State*>(&LightningEffect::deactivate))
    3940                       );
    4041
  • branches/new_class_id/src/lib/graphics/effects/rain_effect.cc

    r9716 r9746  
    3030#include "cloud_effect.h"
    3131#include "script_class.h"
     32#include "debug.h"
    3233
    3334#include "class_id_DEPRECATED.h"
     
    4445
    4546CREATE_SCRIPTABLE_CLASS(RainEffect, RainEffect::classID(),
    46                         addMethod("startRaining", ExecutorLua0<RainEffect>(&RainEffect::startRaining))
    47                             ->addMethod("stopRaining", ExecutorLua0<RainEffect>(&RainEffect::stopRaining))
    48                             ->addMethod("activate", ExecutorLua0<RainEffect>(&RainEffect::activate))
    49                             ->addMethod("deactivate", ExecutorLua0<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))
    5051                       );
    5152
  • branches/new_class_id/src/lib/graphics/effects/snow_effect.cc

    r9716 r9746  
    3838
    3939CREATE_SCRIPTABLE_CLASS(SnowEffect, SnowEffect::classID(),
    40                             addMethod("activate", ExecutorLua0<SnowEffect>(&SnowEffect::activate))
    41                             ->addMethod("deactivate", ExecutorLua0<SnowEffect>(&SnowEffect::deactivate))
     40                            addMethod("activate", Executor0<SnowEffect, lua_State*>(&SnowEffect::activate))
     41                            ->addMethod("deactivate", Executor0<SnowEffect, lua_State*>(&SnowEffect::deactivate))
    4242                       );
    4343
  • branches/new_class_id/src/lib/script_engine/script.cc

    r9720 r9746  
    2626
    2727CREATE_SCRIPTABLE_CLASS(Script, Script::classID(),
    28                     addMethod("addObject", ExecutorLua2<Script,const std::string&, const std::string& >(&Script::addObject))
    29                     ->addMethod("registerClass", ExecutorLua1<Script,const std::string&>(&Script::registerClass))
    30                     ->addMethod("selectFunction", ExecutorLua2ret<Script, bool, const std::string&, int >(&Script::selectFunction))
    31                     ->addMethod("executeFunction", ExecutorLua0ret<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))
    3232                     );
    3333
  • branches/new_class_id/src/lib/script_engine/script_method.h

    r9727 r9746  
    99#include <vector>
    1010
    11 #include "executor/executor_lua.h"
    12 
     11#include "executor/executor_lua_state.h"
     12#include "executor/executor_member.h"
    1313
    1414class ScriptMethod
  • branches/new_class_id/src/lib/util/Makefile.am

    r9743 r9746  
    88libORXexecutor_a_SOURCES = \
    99                executor/executor.cc \
    10                 executor/executor_lua.cc \
    1110                executor/executor_lua_state.cc \
    1211                executor/executor_substring.cc
     
    4948                executor/executor.h \
    5049                executor/executor_xml.h \
    51                 executor/executor_lua.h \
    5250                executor/executor_lua_state.h \
    5351                executor/executor_substring.h \
  • branches/new_class_id/src/lib/util/executor/executor_generic.h

    r9745 r9746  
    7474   */
    7575  __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  {};
    8078
    8179  /**
     
    118116   */
    119117  __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  {};
    124120
    125121  /**
     
    163159   */
    164160  __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  {};
    169163
    170164  /**
     
    209203   */
    210204  __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  {};
    215207
    216208  /**
     
    256248   */
    257249  __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  {};
    262252
    263253  /**
     
    304294   */
    305295  __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  {};
    310298
    311299  /**
     
    334322};
    335323
     324
     325////////////////////
     326//// 0 & RETURN ////
     327////////////////////
     328//! @brief ExecutorClass, that can execute Functions with one parameter.
     329template<class T, typename CallType, typename ret, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject>
     330class __EXECUTOR_FUNCTIONAL_NAME(0,ret) : public Executor<CallType, BaseClass>
     331{
     332private:
     333  /** @brief the FunctioPointer. */
     334  ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST;
     335
     336public:
     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.
     369template<class T, typename CallType, typename ret, typename type0, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject>
     370class __EXECUTOR_FUNCTIONAL_NAME(1,ret) : public Executor<CallType, BaseClass>
     371{
     372private:
     373  /** @brief the FunctioPointer. */
     374  ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST;
     375
     376public:
     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.
     411template<class T, typename CallType, typename ret, typename type0, typename type1, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject>
     412class __EXECUTOR_FUNCTIONAL_NAME(2,ret) : public Executor<CallType, BaseClass>
     413{
     414private:
     415  /** @brief the FunctioPointer. */
     416  ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST;
     417
     418public:
     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
    336449#endif /* __EXECUTOR_FUNCTIONAL_NAME */
  • branches/new_class_id/src/lib/util/executor/executor_lua_state.h

    r9745 r9746  
    6666    return (fromLua<ToType>(CallValue, index));
    6767  }
     68  template <typename ToType>
     69  void storeRet(lua_State*& state, ToType value)
     70  {
     71    toLua<ToType>(state, value);
     72  }
    6873  static lua_State*& defaultValue() { static lua_State* nullState; return nullState; };
    6974};
  • branches/new_class_id/src/story_entities/game_world.cc

    r9727 r9746  
    6464ObjectListDefinition(GameWorld);
    6565CREATE_SCRIPTABLE_CLASS(GameWorld, GameWorld::classID(),
    66                         addMethod("setPlaymode", ExecutorLua1<GameWorld,const std::string&>(&GameWorld::setPlaymode))
    67                         ->addMethod("setSoundtrack", ExecutorLua1<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))
    6868                       );
    6969
  • branches/new_class_id/src/world_entities/creatures/fps_player.cc

    r9716 r9746  
    4747#include "script_class.h"
    4848CREATE_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))
    5353                       );
    5454
  • branches/new_class_id/src/world_entities/environments/mapped_water.cc

    r9716 r9746  
    3333
    3434CREATE_SCRIPTABLE_CLASS(MappedWater, MappedWater::classID(),
    35                         addMethod("waterUV", ExecutorLua2<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)));
    4343
    4444
  • branches/new_class_id/src/world_entities/npcs/attractor_mine.cc

    r9716 r9746  
    3838#include "script_class.h"
    3939CREATE_SCRIPTABLE_CLASS(AttractorMine, AttractorMine::classID(),
    40                         addMethod("setName", ExecutorLua1<BaseObject,const std::string&>(&BaseObject::setName))
    41                        //Coordinates
    42                         ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    43                         ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    44                         ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    45                         ->addMethod("getAbsCoorZ", ExecutorLua0ret<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))
    4646                       );
    4747
  • branches/new_class_id/src/world_entities/npcs/gate.cc

    r9716 r9746  
    3838#include "script_class.h"
    3939CREATE_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))
    4747                       );
    4848
  • branches/new_class_id/src/world_entities/npcs/generic_npc.cc

    r9716 r9746  
    3939CREATE_SCRIPTABLE_CLASS(GenericNPC, GenericNPC::classID(),
    4040                        // Move
    41                         addMethod("walkTo", ExecutorLua3<GenericNPC,float,float,float>(&GenericNPC::walkTo))
    42                         ->addMethod("runTo", ExecutorLua3<GenericNPC,float,float,float>(&GenericNPC::runTo))
    43                         ->addMethod("turnTo", ExecutorLua1<GenericNPC,float>(&GenericNPC::turnTo))
    44                         ->addMethod("finalGoalReached", ExecutorLua0ret<GenericNPC,bool>(&GenericNPC::finalGoalReached))
    45                         ->addMethod("stop", ExecutorLua0<GenericNPC>(&GenericNPC::stop))
    46                         ->addMethod("resume", ExecutorLua0<GenericNPC>(&GenericNPC::resume))
    47                         ->addMethod("playAnimation", ExecutorLua2<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))
    4848                        // Display
    49                         ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
    50                         ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
     49                        ->addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide))
     50                        ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide))
    5151                        // Coordinates
    52                         ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    53                         ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    54                         ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
    55                         ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    56                         ->addMethod("setAbsDir", ExecutorLua4<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))
    5757                       );
    5858
     
    234234        this->setAnimationSpeed(0.5f);
    235235      }
    236         break;
     236      break;
    237237      case Run:
    238238      {
     
    247247        this->setAnimationSpeed(1.0f);
    248248      }
    249         break;
     249      break;
    250250      case Crouch:
    251251      {
     
    260260        this->setAnimationSpeed(1.0f);
    261261      }
    262         break;
     262      break;
    263263      case LookAt:
    264         if( this->getAnimation() != STAND)
    265           this->setAnimation(STAND, MD2_ANIM_LOOP);
    266         break;
     264      if( this->getAnimation() != STAND)
     265        this->setAnimation(STAND, MD2_ANIM_LOOP);
     266      break;
    267267      case Shoot:
    268         if( this->getAnimation() != STAND)
    269           this->setAnimation(STAND, MD2_ANIM_LOOP);
    270         break;
     268      if( this->getAnimation() != STAND)
     269        this->setAnimation(STAND, MD2_ANIM_LOOP);
     270      break;
    271271
    272272      default:
    273         if( this->getAnimation() != STAND)
    274           this->setAnimation(STAND, MD2_ANIM_LOOP);
    275         break;
     273      if( this->getAnimation() != STAND)
     274        this->setAnimation(STAND, MD2_ANIM_LOOP);
     275      break;
    276276
    277277    }
     
    307307        this->setAnimationSpeed(0.5f);
    308308      }
    309         break;
     309      break;
    310310      case Run:
    311311      {
     
    320320        this->setAnimationSpeed(1.0f);
    321321      }
    322         break;
     322      break;
    323323      case Crouch:
    324324      {
     
    333333        this->setAnimationSpeed(1.0f);
    334334      }
    335         break;
     335      break;
    336336      case LookAt:
    337337      {
     
    339339          this->setAnimation(STAND, MD2_ANIM_LOOP);
    340340      }
    341         break;
     341      break;
    342342      case Shoot:
    343         if( this->getAnimation() != STAND)
     343      if( this->getAnimation() != STAND)
    344344        this->setAnimation(STAND, MD2_ANIM_LOOP);
    345         break;
     345      break;
    346346
    347347      default:
    348         if( this->getAnimation() != STAND)
     348      if( this->getAnimation() != STAND)
    349349        this->setAnimation(STAND, MD2_ANIM_LOOP);
    350         break;
     350      break;
    351351
    352352    }
     
    510510    {
    511511      case Walk:
     512      {
     513        Vector dest = currentAnimation.v - this->getAbsCoor();
     514        dest.y = 0.0f;
     515        if (dest.len() < .5)
    512516        {
    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();
    524518        }
    525         break;
     519        else
     520        {
     521          Vector move = dest.getNormalized() * currentAnimation.speed * dt;
     522          this->shiftCoor(move);
     523        }
     524      }
     525      break;
    526526
    527527      case Run:
     
    552552
    553553      case TurnTo:
    554         //Quaternion direction = this->
    555         break;
     554      //Quaternion direction = this->
     555      break;
    556556
    557557      case LookAt:
    558         break;
     558      break;
    559559
    560560      case Shoot:
    561         break;
     561      break;
    562562
    563563      default:
    564         break;
     564      break;
    565565
    566566    }
     
    572572    this->fallVelocity += 300.0f * dt;
    573573    //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());
    575575    this->shiftCoor(Vector(0, -this->fallVelocity * dt,0));
    576576
  • branches/new_class_id/src/world_entities/script_trigger.cc

    r9715 r9746  
    1919
    2020#include "state.h"
    21 
     21#include "debug.h"
    2222ObjectListDefinition(ScriptTrigger);
    2323
    2424CREATE_SCRIPTABLE_CLASS(ScriptTrigger, ScriptTrigger::classID(),
    2525            // 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))
    3030            //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))
    4242             );
    4343
  • branches/new_class_id/src/world_entities/space_ships/helicopter.cc

    r9716 r9746  
    3939#include "script_class.h"
    4040CREATE_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))
    4747
    4848                       );
  • branches/new_class_id/src/world_entities/space_ships/hover.cc

    r9716 r9746  
    4040#include "script_class.h"
    4141CREATE_SCRIPTABLE_CLASS(Hover, Hover::classID(),
    42                         addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
     42                        addMethod("hasPlayer", Executor0ret<Playable, lua_State*,bool>(&Playable::hasPlayer))
    4343                        //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))
    4848                       );
    4949
  • branches/new_class_id/src/world_entities/space_ships/space_ship.cc

    r9716 r9746  
    5959#include "script_class.h"
    6060CREATE_SCRIPTABLE_CLASS(SpaceShip, SpaceShip::classID(),
    61                         addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
    62                         ->addMethod("fire", ExecutorLua1<Playable, bool>(&Playable::fire))
    63                         ->addMethod("loadModel", ExecutorLua2<WorldEntity,const std::string& ,float>(&WorldEntity::loadModel2))
    64                         ->addMethod("setName", ExecutorLua1<BaseObject,const std::string&>(&BaseObject::setName))
    65                         ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
    66                         ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
    67                        //Coordinates
    68                         ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    69                         ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    70                         ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    71                         ->addMethod("getAbsCoorZ", ExecutorLua0ret<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))
    7272                       );
    7373
     
    118118void SpaceShip::init()
    119119{
    120 //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
     120  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    121121  this->registerObject(this, SpaceShip::_objectList);
    122122
     
    147147  controlVelocityY = 150;
    148148  shipInertia = 1.5;
    149 //  cycle = 0.0;
     149  //  cycle = 0.0;
    150150
    151151  this->setHealthMax(100);
     
    158158  this->pitchDir = this->getAbsDir();
    159159
    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);
    170170
    171171  //add events to the eventlist
     
    202202  this->getWeaponManager().setSlotPosition(5, Vector(-1.5, -.5, -.5));
    203203  this->getWeaponManager().setSlotDirection(5, Quaternion(+M_PI_4*.5-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)));:
     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)));:
    213213
    214214  this->getWeaponManager().getFixedTarget()->setParent(this);
     
    312312void SpaceShip::collidesWith(WorldEntity* entity, const Vector& location)
    313313{
    314 
    315314}
    316315
     
    334333
    335334  if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == SharedNetworkData::getInstance()->getHostID() )
    336    {
     335  {
    337336    if (xMouse > controlVelocityX) xMouse = controlVelocityX;
    338337    else if (xMouse < -controlVelocityX) xMouse = -controlVelocityX;
     
    344343    mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity*yInvert, Vector(0,0,1))*pitchDir);
    345344    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;
    351350
    352351  // spaceship controlled movement fire(bool bF){ this->bFire = bF;}
    353352  //if (this->getOwner() == this->getHostID())
    354     this->calculateVelocity(time);
     353  this->calculateVelocity(time);
    355354
    356355
     
    365364
    366365  //orient the spaceship in direction of the mouse
    367    rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, 0.5);//fabsf(time)*shipInertia);
    368    if (this->getAbsDir().distance(rotQuat) > 0.00000000000001)
     366  rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, 0.5);//fabsf(time)*shipInertia);
     367  if (this->getAbsDir().distance(rotQuat) > 0.00000000000001)
    369368    this->setAbsDir( rotQuat);
    370    //this->setAbsDirSoft(mouseDir,5);
     369  //this->setAbsDirSoft(mouseDir,5);
    371370
    372371  // this is the air friction (necessary for a smooth control)
     
    390389  this->shiftCoor(move);
    391390
    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());
    393392
    394393}
     
    411410
    412411  if( this->bUp )
    413    {
    414      //this->shiftCoor(this->getAbsDirX());
    415       //accel += (this->getAbsDirX())*2;
    416       accel += (this->getAbsDirX())*acceleration;
    417 
    418    }
     412  {
     413    //this->shiftCoor(this->getAbsDirX());
     414    //accel += (this->getAbsDirX())*2;
     415    accel += (this->getAbsDirX())*acceleration;
     416
     417  }
    419418
    420419  if( this->bDown )
    421    {
    422      //this->shiftCoor((this->getAbsDirX())*-1);
    423      //accel -= (this->getAbsDirX())*2;
     420  {
     421    //this->shiftCoor((this->getAbsDirX())*-1);
     422    //accel -= (this->getAbsDirX())*2;
    424423    //if(velocity.len() > 50)
    425      accel -= (this->getAbsDirX())*0.5*acceleration;
    426 
    427 
    428 
    429    }
     424    accel -= (this->getAbsDirX())*0.5*acceleration;
     425
     426
     427
     428  }
    430429
    431430  if( this->bLeft/* > -this->getRelCoor().z*2*/)
    432431  {
    433432    this->shiftDir(Quaternion(time, Vector(0,1,0)));
    434 //    accel -= rightDirection;
     433    //    accel -= rightDirection;
    435434    //velocityDir.normalize();
    436435    //rot +=Vector(1,0,0);
     
    451450  {
    452451    mouseDir *= Quaternion(-time*2, Vector(1,0,0));
    453 //    accel -= rightDirection;
     452    //    accel -= rightDirection;
    454453    //velocityDir.normalize();
    455454    //rot +=Vector(1,0,0);
     
    469468    this->shiftDir(Quaternion(time, Vector(0,0,1)));
    470469
    471 //    accel += upDirection;
     470    //    accel += upDirection;
    472471    //velocityDir.normalize();
    473472    //rot += Vector(0,0,1);
     
    497496
    498497  if( event.type == KeyMapper::PEV_LEFT)
    499       this->bRollL = event.bPressed;
     498    this->bRollL = event.bPressed;
    500499  else if( event.type == KeyMapper::PEV_RIGHT)
    501       this->bRollR = event.bPressed;
     500    this->bRollR = event.bPressed;
    502501  else if( event.type == KeyMapper::PEV_FORWARD)
    503502    this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);
  • branches/new_class_id/src/world_entities/space_ships/spacecraft_2d.cc

    r9716 r9746  
    4343
    4444CREATE_SCRIPTABLE_CLASS(Spacecraft2D, Spacecraft2D::classID(),
    45                         addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
     45                        addMethod("hasPlayer", Executor0ret<Playable, lua_State*,bool>(&Playable::hasPlayer))
    4646                        //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))
    5252                       );
    5353
  • branches/new_class_id/src/world_entities/test_entity.cc

    r9716 r9746  
    2626
    2727#include "test_entity.h"
    28 
     28#include "debug.h"
    2929
    3030#include "interactive_model.h"
     
    4141#include "script_class.h"
    4242CREATE_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))
    4847                       );
    4948
     
    9291
    9392  LoadParam(root, "md2animation", this, TestEntity, setAnim)
    94       .describe("sets the animation of the md2 model")
    95       .defaultValues(1);
     93  .describe("sets the animation of the md2 model")
     94  .defaultValues(1);
    9695
    9796}
Note: See TracChangeset for help on using the changeset viewer.