Changeset 9746 in orxonox.OLD for branches/new_class_id/src/world_entities
- Timestamp:
- Sep 16, 2006, 3:34:04 PM (18 years ago)
- Location:
- branches/new_class_id/src/world_entities
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
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.