Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6810 in orxonox.OLD for trunk/src/world_entities/weapons


Ignore:
Timestamp:
Jan 28, 2006, 3:30:54 PM (19 years ago)
Author:
bensch
Message:

trunk: added hyperblaster

Location:
trunk/src/world_entities/weapons
Files:
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/weapons/hyperblaster.cc

    r6807 r6810  
    1212
    1313   ### File Specific
    14    main-programmer: Patrick Boenzli
     14   main-programmer: Benjamin Grauer
    1515   co-programmer:
    1616
     
    2121#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
    2222
    23 #include "cannon.h"
     23#include "hyperblaster.h"
    2424
    2525#include "world_entity.h"
     
    3838using namespace std;
    3939
    40 CREATE_FACTORY(Cannon, CL_CANNON);
     40CREATE_FACTORY(Hyperblaster, CL_HYPERBLASTER);
    4141
    42 /**
    43  *  standard constructor
    44 
    45    creates a new weapon
    46 */
    47 Cannon::Cannon ()
    48   : Weapon()
    49 {
    50   this->init();
    51 }
    52 
    53 
    54 Cannon::Cannon(const TiXmlElement* root)
     42Hyperblaster::Hyperblaster(const TiXmlElement* root)
    5543{
    5644  this->init();
     
    6250 *  standard deconstructor
    6351*/
    64 Cannon::~Cannon ()
     52Hyperblaster::~Hyperblaster ()
    6553{
    6654  // model will be deleted from WorldEntity-destructor
     
    6856
    6957
    70 void Cannon::init()
     58void Hyperblaster::init()
    7159{
    72   this->setClassID(CL_CANNON, "Cannon");
     60  this->setClassID(CL_HYPERBLASTER, "Hyperblaster");
    7361
    7462//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
     
    7765
    7866  this->setStateDuration(WS_SHOOTING, 2.0);
    79   this->setStateDuration(WS_RELOADING, .1);
     67  this->setStateDuration(WS_RELOADING, 5.0);
    8068  this->setStateDuration(WS_ACTIVATING, .1);
    8169  this->setStateDuration(WS_DEACTIVATING, .4);
    8270
    83   this->setEnergyMax(100);
    84   this->increaseEnergy(100);
     71  this->setEnergyMax(10);
     72  this->increaseEnergy(10);
    8573  //this->minCharge = 2;
    8674
    8775  this->setActionSound(WA_SHOOT, "sound/explo.wav");
    88   this->setActionSound(WA_ACTIVATE, "sound/voices/cannon.wav");
     76  this->setActionSound(WA_ACTIVATE, "sound/voices/hyperblaster.wav");
    8977
    9078  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_HEAVY);
    91   this->setProjectileType(CL_BOMB);
    92   this->prepareProjectiles(5);
     79  this->setProjectileType(CL_HYPERBLAST);
     80  this->prepareProjectiles(2);
    9381
    9482//  this->objectComponent1 = new PNode();
     
    10997//     animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);
    11098
    111   animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     99  animation2->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     100  animation2->addKeyFrame(Vector(1.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    112101  animation2->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    113102
    114103  animation3->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    115   animation3->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     104  animation3->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     105  animation2->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    116106}
    117107
    118108
    119 void Cannon::loadParams(const TiXmlElement* root)
     109void Hyperblaster::loadParams(const TiXmlElement* root)
    120110{
    121111  Weapon::loadParams(root);
     
    130120   been armed out.
    131121*/
    132 void Cannon::activate()
     122void Hyperblaster::activate()
    133123{
    134124}
     
    142132   been armed out.
    143133*/
    144 void Cannon::deactivate()
     134void Hyperblaster::deactivate()
    145135{
    146136}
     
    153143   @todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent
    154144*/
    155 void Cannon::fire()
     145void Hyperblaster::fire()
    156146{
    157147  Projectile* pj =  this->getProjectile();
     
    174164 * hit, it can also be destoryed.
    175165*/
    176 void Cannon::destroy ()
     166void Hyperblaster::destroy ()
    177167{}
    178 
    179 /**
    180  *  this will draw the weapon
    181 */
    182 void Cannon::draw () const
    183 {
    184   /* draw gun body */
    185   glMatrixMode(GL_MODELVIEW);
    186   glPushMatrix();
    187   glTranslatef (this->getAbsCoor ().x,
    188                 this->getAbsCoor ().y,
    189                 this->getAbsCoor ().z);
    190 
    191   Vector tmpRot = this->getAbsDir().getSpacialAxis();
    192   glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    193 
    194   this->getModel()->draw();
    195   glPopMatrix();
    196 
    197   /* draw objectComponent1: gun coil - animated stuff */
    198 /*  glMatrixMode(GL_MODELVIEW);
    199   glPushMatrix();
    200   glTranslatef (this->objectComponent1->getAbsCoor ().x,
    201                 this->objectComponent1->getAbsCoor ().y,
    202                 this->objectComponent1->getAbsCoor ().z);
    203   tmpRot = this->objectComponent1->getAbsDir().getSpacialAxis();
    204   glRotatef (this->objectComponent1->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    205   this->model->draw(0);
    206 
    207   glPopMatrix();*/
    208 }
    209 
  • trunk/src/world_entities/weapons/hyperblaster.h

    r6807 r6810  
    11/*!
    2  * @file cannon.h
    3  * a weapon that is fix on top of the player to fire heavy weaponary.
     2 * @file hyperblaster.h
     3 * a weapon that to fire heavy weaponary Hyperblasts.
    44*/
    55
    66
    7 #ifndef _CANNON_H
    8 #define _CANNON_H
     7#ifndef _HYPERBLASTER_H
     8#define _HYPERBLASTER_H
    99
    1010#include "weapon.h"
    1111
    12 class Cannon : public Weapon
     12class Hyperblaster : public Weapon
    1313  {
    1414  public:
    15     Cannon ();
    16     Cannon (const TiXmlElement* root);
    17     virtual ~Cannon ();
     15    Hyperblaster (const TiXmlElement* root = NULL);
     16    virtual ~Hyperblaster ();
    1817
    1918    void init();
     
    2625    virtual void destroy();
    2726
    28     virtual void draw() const;
    29 
    3027  private:
    3128//     PNode* objectComponent1;         //<! the gun is made of multiple parts, these PNodes represent their location and orientation
    3229  };
    33 #endif /* _CANNON_H */
     30#endif /* _HYPERBLASTER_H */
Note: See TracChangeset for help on using the changeset viewer.