Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9235 in orxonox.OLD for trunk/src/world_entities/space_ships


Ignore:
Timestamp:
Jul 5, 2006, 4:39:02 PM (18 years ago)
Author:
bensch
Message:

merged the presentation back

Location:
trunk/src/world_entities/space_ships
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/space_ships/cruizer.cc

    r9061 r9235  
    7878  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
    7979
    80   this->loadModel("models/ships/human_cruizer.obj", 0.05);
     80 // this->loadModel("models/ships/human_cruizer.obj", 0.05);
    8181
    8282}
  • trunk/src/world_entities/space_ships/helicopter.cc

    r8783 r9235  
    4343                            ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    4444                            ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
    45                            
     45
    4646                       );
    4747
     
    124124void Helicopter::init()
    125125{
     126  this->chopperBuffer = NULL;
     127
    126128  this->setClassID(CL_HELICOPTER, "Helicopter");
    127 
    128129  PRINTF(4)("HELICOPTER INIT\n");
    129130
  • trunk/src/world_entities/space_ships/helicopter.h

    r8783 r9235  
    3939
    4040    virtual void process(const Event &event);
    41    
     41
    4242    virtual void moveUp(bool move){bAscend = move;};
    4343    virtual void moveDown(bool move){bDescend = move;};
     
    7878    float                 airViscosity;
    7979
    80     OrxSound::SoundSource soundSource;
    81     OrxSound::SoundBuffer*chopperBuffer;
     80    OrxSound::SoundSource  soundSource;
     81    OrxSound::SoundBuffer* chopperBuffer;
    8282
    8383};
  • trunk/src/world_entities/space_ships/hover.cc

    r8719 r9235  
    2525
    2626#include "util/loading/factory.h"
     27//#include "util/loading/resource_manager.h"
     28
    2729#include "key_mapper.h"
    2830#include "state.h"
     
    3436CREATE_FACTORY(Hover, CL_HOVER);
    3537
     38#include "script_class.h"
     39CREATE_SCRIPTABLE_CLASS(Hover, CL_HOVER,
     40                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
     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))
     46                       );
     47
    3648/**
    3749 *  destructs the hover, deletes alocated memory
     
    4052{
    4153  this->setPlayer(NULL);
     54
     55  //if (this->hoverBuffer != NULL)
     56  //  ResourceManager::getInstance()->unload(this->hoverBuffer);
    4257}
    4358
     
    5873
    5974  this->loadParams(doc.RootElement());
     75
     76  //load sound
     77  //if (this->hoverBuffer != NULL)
     78  //  ResourceManager::getInstance()->unload(this->hoverBuffer);
     79  //this->hoverBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/engine/hover.wav", WAV);
     80
    6081}
    6182
     
    97118void Hover::init()
    98119{
     120
     121  //this->hitEntity = NULL;
     122  //this->hoverBuffer = NULL;
     123
    99124  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    100125  this->setClassID(CL_HOVER, "Hover");
     
    112137  this->cameraLook = 0.0f;
    113138  this->rotation = 0.0f;
    114   this->acceleration = 25.0f;
     139  this->acceleration = 15.0f;
    115140  this->airFriction = 3.0f;
    116141
     
    206231  State::getCameraNode()->setRelCoorSoft(-10, 0,0);
    207232  State::getCameraTargetNode()->setParentSoft(&this->cameraNode);
     233
     234  //this->soundSource.play(this->hoverBuffer, 0.3f, true);
     235
    208236}
    209237
  • trunk/src/world_entities/space_ships/hover.h

    r7346 r9235  
    77#ifndef _HOVER_H
    88#define _HOVER_H
     9
     10//#include "sound_buffer.h"
     11//#include "sound_source.h"
    912
    1013#include "playable.h"
     
    6871    float                 airViscosity;
    6972
    70     WorldEntity* hitEntity;
     73    WorldEntity*          hitEntity;
     74
     75    //OrxSound::SoundSource  soundSource;
     76    //OrxSound::SoundBuffer* hoverBuffer;
    7177};
    7278
  • trunk/src/world_entities/space_ships/space_ship.cc

    r9110 r9235  
    5858CREATE_SCRIPTABLE_CLASS(SpaceShip, CL_SPACE_SHIP,
    5959                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
     60                        ->addMethod("fire", ExecutorLua1<Playable, bool>(&Playable::fire))
     61                        ->addMethod("loadModel", ExecutorLua2<WorldEntity,const std::string& ,float>(&WorldEntity::loadModel2))
     62                        ->addMethod("setName", ExecutorLua1<BaseObject,const std::string&>(&BaseObject::setName))
     63                        ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
     64                        ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
    6065                       //Coordinates
    6166                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
     
    352357//     return;
    353358
    354   // spaceship controlled movement
     359  // spaceship controlled movement fire(bool bF){ this->bFire = bF;}
    355360  //if (this->getOwner() == this->getHostID())
    356361    this->calculateVelocity(time);
     
    404409  Vector accel(0.0, 0.0, 0.0);
    405410  /*
    406   Vector rot(0.0, 0.0, 0.0); // wird benötigt für Helicopter
     411  Vector rot(0.0, 0.0, 0.0); // wird ben�igt fr Helicopter
    407412  */
    408413  //float rotVal = 0.0;
     
    513518}
    514519
    515 void SpaceShip::destroy( )
     520void SpaceShip::destroy( WorldEntity* killer )
    516521{
    517522  PRINTF(0)("spaceship destroy\n");
  • trunk/src/world_entities/space_ships/space_ship.h

    r9008 r9235  
    3737    virtual void leftWorld();
    3838   
    39     virtual void destroy();
     39    virtual void destroy(WorldEntity* killer);
    4040    virtual void respawn();
    4141
  • trunk/src/world_entities/space_ships/spacecraft_2d.cc

    r9110 r9235  
    3535#include "debug.h"
    3636
     37#include "script_class.h"
     38
     39
    3740CREATE_FACTORY(Spacecraft2D, CL_SPACECRAFT_2D);
    3841
    39 /**
    40  *  destructs the spacecraft_2d, deletes alocated memory
    41  */
    42 Spacecraft2D::~Spacecraft2D ()
    43 {
    44   this->setPlayer(NULL);
    45   delete this->toTravelHeight;
    46 }
     42
     43CREATE_SCRIPTABLE_CLASS(Spacecraft2D, CL_SPACECRAFT_2D,
     44                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
     45                        //Coordinates
     46                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
     47                        ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
     48                        ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
     49                        ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     50                        ->addMethod("setAirFriction", ExecutorLua1<Spacecraft2D, float>(&Spacecraft2D::setAirFriction))
     51                       );
     52
    4753
    4854/**
     
    7682    this->loadParams(root);
    7783
     84
     85
    7886  //weapons:
    79   Weapon* wpRight = new TestGun(0);
    80   wpRight->setName("testGun Right");
    81   Weapon* wpLeft = new TestGun(1);
    82   wpLeft->setName("testGun Left");
    83   //Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_HYPERBLASTER));
     87  Weapon* wpRight = dynamic_cast<Weapon*>(Factory::fabricate(CL_LASER_CANNON));
     88  wpRight->setName("Cannon_Right");
     89  Weapon* wpLeft = dynamic_cast<Weapon*>(Factory::fabricate(CL_LASER_CANNON));
     90  wpLeft->setName("Cannon_Left");
     91
     92  Weapon* turretLeft = dynamic_cast<Weapon*>(Factory::fabricate(CL_BOOMERANG_GUN));
     93  wpRight->setName("Turret_Left");
     94  Weapon* turretRight = dynamic_cast<Weapon*>(Factory::fabricate(CL_BOOMERANG_GUN));
     95  wpLeft->setName("Turret_Right");
    8496
    8597  //  cannon->setName("BFG");
     
    8799  this->addWeapon(wpLeft, 1, 0);
    88100  this->addWeapon(wpRight,1 ,1);
     101  this->addWeapon(turretLeft, 1, 2);
     102  this->addWeapon(turretRight, 1, 3);
     103
    89104  //this->addWeapon(cannon, 0, 2);
    90105
    91106  this->getWeaponManager().changeWeaponConfig(1);
    92107  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
     108}
     109
     110
     111/**
     112 * @brief destructs the spacecraft_2d, deletes alocated memory
     113 */
     114Spacecraft2D::~Spacecraft2D ()
     115{
     116  this->setPlayer(NULL);
     117  delete this->toTravelHeight;
    93118}
    94119
     
    109134  this->cameraLook = 0.0f;
    110135  this->rotation = 0.0f;
    111   this->acceleration = 10.0f;
    112   this->airFriction = 2.0f;
    113 
    114 
    115   this->setHealthMax(100);
    116   this->setHealth(100);
     136  this->acceleration = 20.0f;
     137  this->airFriction = 0.0f;
     138
     139
     140  this->setHealthMax(1000);
     141  this->setHealth(1000);
     142  this->setDamage(100.0f);
     143
    117144
    118145
     
    122149  this->travelNode = new PNode();
    123150
     151  this->loadModel("models/ships/mantawing.obj", 5.0f);
    124152
    125153  // camera - issue
     
    166194  this->getWeaponManager().setSlotCount(5);
    167195
    168   this->getWeaponManager().setSlotPosition(0, Vector(-0.28, 1.186, -2.750));
     196  this->getWeaponManager().setSlotPosition(0, Vector(1.843, -0.335, 2.029) * 5.0);
    169197  this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    170198
    171   this->getWeaponManager().setSlotPosition(1, Vector(-0.28, 1.186, 2.750));
     199  this->getWeaponManager().setSlotPosition(1, Vector(1.843, -0.335, -2.029) * 5.0);
    172200  this->getWeaponManager().setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    173201
    174   this->getWeaponManager().setSlotPosition(2, Vector(-1.63, .809, -.003));
    175   this->getWeaponManager().setSlotCapability(2, WTYPE_HEAVY);
    176 
    177202  /// TODO: THESE ARE TOO MUCH
    178   this->getWeaponManager().setSlotPosition(3, Vector(-1.63, .678, -.652));
    179   this->getWeaponManager().setSlotDirection(3, Quaternion(-24/180 * M_PI, Vector(1,0,0)));
    180 
    181   this->getWeaponManager().setSlotPosition(4, Vector(-1.63, .678, .652));
    182   this->getWeaponManager().setSlotDirection(4, Quaternion(24/180 * M_PI, Vector(1,0,0)));
     203  this->getWeaponManager().setSlotPosition(2, Vector(-0.351, -.238, 1.406) * 5.0);
     204  this->getWeaponManager().setSlotDirection(2, Quaternion(-1.7, Vector(0,1,0)));
     205
     206  this->getWeaponManager().setSlotPosition(3, Vector(-0.351, -.238, -1.406) * 5.0);
     207  this->getWeaponManager().setSlotDirection(3, Quaternion(1.7, Vector(0,1,0)));
    183208
    184209  this->cameraNode.setRelCoor(1,5,0);
     
    193218  registerVar( new SynchronizeableFloat( &cameraLook, &cameraLook, "cameraLook", PERMISSION_OWNER ) );
    194219  registerVar( new SynchronizeableFloat( &rotation, &rotation, "rotation", PERMISSION_OWNER ) );
     220
     221
     222
    195223}
    196224
     
    285313
    286314        State::getCameraNode()->setParentSoft(this->travelNode);
    287         State::getCameraNode()->setRelCoorSoft(-3, 50,0);
     315        State::getCameraNode()->setRelCoorSoft(-3, 100,0);
    288316        State::getCameraTargetNode()->setParentSoft(this->travelNode);
    289         State::getCameraTargetNode()->setRelCoorSoft(0,0,0);
     317        State::getCameraTargetNode()->setRelCoorSoft(5,0,1);
    290318
    291319
     
    406434        if (this->toTravelHeight != NULL)
    407435        {
    408           this->travelNode->shiftCoor(Vector(0, (*toTravelHeight - this->travelNode->getAbsCoor().y) * dt, 0));
     436          this->travelNode->shiftCoor(Vector(0, (*toTravelHeight - this->travelNode->getAbsCoor().y) * dt * 10.0, 0));
    409437          if (fabsf(this->travelNode->getAbsCoor().y - *this->toTravelHeight) < .1)
    410438          {
     
    416444
    417445        accel.y = 0.0;
     446
    418447        Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration);
    419448        accelerationDir.y = 0.0;
     
    424453
    425454        this->velocity += (accelerationDir - damping)* dt;
     455
     456        if (this->getRelCoor().z > this->travelDistance.y && velocity.z > 0.0)
     457          this->velocity.z = 0.0f;
     458        if (this->getRelCoor().z < -this->travelDistance.y && velocity.z < 0.0)
     459          this->velocity.z = 0.0f;
     460
     461        if (this->getRelCoor().x > this->travelDistance.x && velocity.x > 0.0)
     462          this->velocity.x = 0.0f;
     463        if (this->getRelCoor().x < -this->travelDistance.x && velocity.x < 0.0)
     464          this->velocity.x = 0.0f;
     465
     466
    426467        this->shiftCoor (this->velocity * dt);
    427         this->setRelDirSoft(Quaternion(0, Vector(0,0,0)), 1.0f);
     468        if (accel.z == 0)
     469          this->setRelDirSoft(Quaternion(0, Vector(0,0,0)), 5.0f);
     470        else
     471          this->setRelDirSoft(Quaternion(this->velocity.z * .004, Vector(1,0,0)), 4.5f);
    428472      }
    429473      break;
     
    475519      else if (cameraLook < -M_PI_4)
    476520        cameraLook = -M_PI_4;
    477       //this->cameraNode.setRelDirSoft(this->direction,10);
    478521    }
    479522  }
  • trunk/src/world_entities/space_ships/spacecraft_2d.h

    r9110 r9235  
    2727    void setTravelDistance(const Vector2D& distance);
    2828    void setTravelDistance(float x, float y);
     29
     30    void setAirFriction(float friction) { this->airFriction = friction; };
    2931
    3032
Note: See TracChangeset for help on using the changeset viewer.