Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6803 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Jan 28, 2006, 11:14:40 AM (19 years ago)
Author:
bensch
Message:

trunk: WeaponManager fix

Location:
trunk/src/world_entities
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/environments/water.cc

    r6780 r6803  
    185185    if (State::getSkyBox())
    186186    {
    187       glBindTexture(GL_TEXTURE_2D, State::getSkyBox()->getTexture(SKY_TOP));
     187      glBindTexture(GL_TEXTURE_2D, State::getSkyBox()->getTexture(SKY_RIGHT));
    188188      glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    189189
     
    199199    //Shader::deactivateShader();
    200200
    201     SkyBox::disableCubeMap();
     201    //SkyBox::disableCubeMap();
     202    glDisable(GL_TEXTURE_GEN_S);
     203    glDisable(GL_TEXTURE_GEN_T);
     204
    202205    glPopMatrix();
    203206  }
  • trunk/src/world_entities/space_ships/hover.cc

    r6801 r6803  
    3434
    3535CREATE_FACTORY(Hover, CL_HOVER);
    36 
    37 /**
    38  *  creates the controlable Hover
    39  */
    40 Hover::Hover()
    41 {
    42   this->init();
    43 }
    4436
    4537/**
     
    9183  this->addWeapon(wpLeft, 1, 0);
    9284  this->addWeapon(wpRight,1 ,1);
    93   this->addWeapon(cannon, 0, 6);
    94 
    95   //this->addWeapon(turret, 3, 0);
     85  this->addWeapon(cannon, 0, 2);
    9686
    9787  this->getWeaponManager()->changeWeaponConfig(1);
     
    134124
    135125  // rotors
    136   this->wingNodeLeft.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     126  this->wingNodeLeft.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT );
     127  this->wingNodeLeft.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
    137128  this->wingNodeLeft.setParent(this);
    138129  this->wingNodeLeft.setRelCoor(-1.5, -.3, -1.0);
     
    142133
    143134  this->wingNodeRight.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     135  this->wingNodeRight.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
    144136  this->wingNodeRight.setParent(this);
    145137  this->wingNodeRight.setRelCoor(-1.5, -0.3, 1.0);
     
    148140  this->rotorNodeRight.setRelCoor(0, 1.0, 2.3);
    149141
     142  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
     143
    150144  this->loadModel("models/ships/hoverglider_wing.obj", 1.0f, 3);
    151145  this->loadModel("models/ships/hoverglider_rotor.obj", 1.0f, 4);
     
    155149  this->velocity = Vector(0.0,0.0,0.0);
    156150  this->velocityDir = Vector(1.0,0.0,0.0);
    157 //   GLGuiButton* button = new GLGuiPushButton();
    158 //   button->show();
    159 //   button->setLabel("orxonox");
    160 //   button->setBindNode(this);
    161151
    162152  //add events to the eventlist
     
    175165  registerEvent(EV_MOUSE_MOTION);
    176166
    177   this->getWeaponManager()->setSlotCount(7);
    178 
    179   this->getWeaponManager()->setSlotPosition(0, Vector(-2.6, .1, -3.0));
     167
     168  // WEAPON_MANAGER configuration
     169  this->getWeaponManager()->setSlotCount(5);
     170
     171  this->getWeaponManager()->setSlotPosition(0, Vector(-0.28, 1.186, -2.750), &this->wingNodeLeft);
    180172  this->getWeaponManager()->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    181173
    182   this->getWeaponManager()->setSlotPosition(1, Vector(-2.6, .1, 3.0));
     174  this->getWeaponManager()->setSlotPosition(1, Vector(-0.28, 1.186, 2.750), &this->wingNodeRight);
    183175  this->getWeaponManager()->setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    184176
    185   this->getWeaponManager()->setSlotPosition(2, Vector(-1.5, .5, -.5));
    186   this->getWeaponManager()->setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
    187 
    188   this->getWeaponManager()->setSlotPosition(3, Vector(-1.5, .5, .5));
    189   this->getWeaponManager()->setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
    190 
    191   this->getWeaponManager()->setSlotPosition(4, Vector(-1.5, -.5, .5));
    192   this->getWeaponManager()->setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
    193 
    194   this->getWeaponManager()->setSlotPosition(5, Vector(-1.5, -.5, -.5));
    195   this->getWeaponManager()->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
    196 //
    197    this->getWeaponManager()->setSlotPosition(6, Vector(-1, 0.0, 0));
    198    this->getWeaponManager()->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    199    //
    200 //   this->getWeaponManager()->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
    201 //   this->getWeaponManager()->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
    202 //
    203 //   this->getWeaponManager()->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
    204 //   this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
     177  this->getWeaponManager()->setSlotPosition(2, Vector(-1.63, .809, -.003));
     178  this->getWeaponManager()->setSlotCapability(2, WTYPE_HEAVY);
     179
     180  /// TODO: THESE ARE TOO MUCH
     181  this->getWeaponManager()->setSlotPosition(3, Vector(-1.63, .678, -.652));
     182  this->getWeaponManager()->setSlotDirection(3, Quaternion(-24/180 * M_PI, Vector(1,0,0)));
     183
     184  this->getWeaponManager()->setSlotPosition(4, Vector(-1.63, .678, .652));
     185  this->getWeaponManager()->setSlotDirection(4, Quaternion(24/180 * M_PI, Vector(1,0,0)));
    205186
    206187  this->getWeaponManager()->getFixedTarget()->setParent(&(this->cameraNode));
    207   this->getWeaponManager()->getFixedTarget()->setRelCoor(0,0,0);
    208 
    209   dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
    210 
    211188}
    212189
     
    222199void  Hover::attachCamera()
    223200{
    224   State::getCamera()->setParentSoft(this->getWeaponManager()->getFixedTarget());
     201  State::getCamera()->setParentSoft(&this->cameraNode);
    225202  State::getCameraTarget()->setParentSoft(this->getWeaponManager()->getFixedTarget());
    226203
     
    285262  }
    286263
    287   // rotorrotation
    288 //   this->topRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));
    289 //   this->tailRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));
    290 
    291264  // spaceship controlled movement
    292265  this->calculateVelocity(time);
     
    296269  // this is the air friction (necessary for a smooth control)
    297270  if(velocity.len() != 0) velocity -= velocity*0.1;
    298 
    299   //travelSpeed = velocity.len();
    300 
    301   //physics: Gravity
    302   /*this->shiftCoor(Vector(0,-1,0));
    303 
    304   this->shiftCoor(getAbsDirY()*rotorspeed);
    305   */
    306 
    307   /*
    308   //hoover effect
    309   cycle += time;
    310   this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
    311   */
    312 
    313   //readjust
    314  // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
    315   //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
    316 
    317   //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
    318 
    319271  this->shiftCoor (move);
    320   //this->shiftDir(Quaternion(-M_PI/4*tailrotorspeed, Vector(0,1,0)));
    321272
    322273  this->getWeaponManager()->tick(time);
  • trunk/src/world_entities/space_ships/hover.h

    r6800 r6803  
    1414  public:
    1515
    16     Hover();
    1716    Hover(const char* fileName);
    18     Hover(const TiXmlElement* root);
     17    Hover(const TiXmlElement* root = NULL);
    1918    virtual ~Hover();
    2019
    21     void init();
    2220    virtual void loadParams(const TiXmlElement* root);
    2321
     
    3432
    3533    virtual void process(const Event &event);
     34
     35  private:
     36    void init();
    3637
    3738  private:
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6764 r6803  
    132132
    133133  this->getWeaponManager()->changeWeaponConfig(1);
    134 
    135   EventHandler::getInstance()->grabEvents(true);
    136134
    137135  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
     
    143141  controlVelocityX = 25;
    144142  controlVelocityY = 150;
    145   shipInertia = 1.5             ;
     143  shipInertia = 1.5;
    146144//  cycle = 0.0;
    147145
  • trunk/src/world_entities/weapons/cannon.cc

    r6799 r6803  
    7474//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
    7575
    76   this->loadModel("models/guns/plasmadriver_#.obj");
     76  this->loadModel("models/guns/plasmadriver_#.obj", 2.0);
    7777
    7878  this->setStateDuration(WS_SHOOTING, 2.0);
     
    8888  this->setActionSound(WA_ACTIVATE, "sound/voices/cannon.wav");
    8989
    90   this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     90  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_HEAVY);
    9191  this->setProjectileType(CL_BOMB);
    9292  this->prepareProjectiles(5);
  • trunk/src/world_entities/weapons/weapon.h

    r6756 r6803  
    6060  WTYPE_DIRECTIONAL   = 0x00000001,           //!< Weapon is directional/Slot is able to carry directional weapons
    6161  WTYPE_TURRET        = 0x00000002,           //!< Weapon is a turret/slot is able to carry turrets
     62  WTYPE_LIGHT         = 0x00000004,           //!< For light Armament.
     63  WTYPE_HEAVY         = 0x00000008,           //!< The heavy Armament (Cannons).
    6264  WTYPE_ALLKINDS      = 0x0000000f,           //!< Weapon is all types/Slot is able to carry all kinds of weapons
    6365
  • trunk/src/world_entities/weapons/weapon_manager.cc

    r6778 r6803  
    185185 * @param position the position of the given slot
    186186 */
    187 void WeaponManager::setSlotPosition(int slot, const Vector& position)
     187void WeaponManager::setSlotPosition(int slot, const Vector& position, PNode* parent)
    188188{
    189189  if (slot < this->slotCount)
     190  {
    190191    this->currentSlotConfig[slot].position.setRelCoor(position);
     192
     193    if (parent != NULL)
     194      this->currentSlotConfig[slot].position.setParent(parent);
     195  }
    191196}
    192197
  • trunk/src/world_entities/weapons/weapon_manager.h

    r6679 r6803  
    6262    unsigned int getSlotCount() const { return this->slotCount; };
    6363    // setting up the WeaponManager with the following functions
    64     void setSlotPosition(int slot, const Vector& position);
     64    void setSlotPosition(int slot, const Vector& position, PNode* parent = NULL);
    6565    void setSlotDirection(int slot, const Quaternion& rotation);
    6666    /** @param slot the slot to get the relative position from @returns the relative position of the Carrier to the Slot */
Note: See TracChangeset for help on using the changeset viewer.