Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5621 in orxonox.OLD for branches/world_entities/src


Ignore:
Timestamp:
Nov 17, 2005, 12:31:14 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/world_entities: added new Class Weapon, that will once fire BOMBS

Location:
branches/world_entities/src
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/world_entities/src/Makefile.am

    r5593 r5621  
    6363                  world_entities/weapons/turret.cc \
    6464                  world_entities/weapons/aiming_turret.cc \
     65                  world_entities/weapons/cannon.cc \
    6566                  world_entities/weapons/test_bullet.cc \
    6667                  world_entities/weapons/rocket.cc \
     
    9798                 world_entities/weapons/projectile.h \
    9899                 world_entities/weapons/test_gun.h \
     100                 world_entities/weapons/cannon.h \
    99101                 world_entities/weapons/turret.h \
    100102                 world_entities/weapons/aiming_turret.h \
  • branches/world_entities/src/Makefile.in

    r5597 r5621  
    6565        orxonox-weapon.$(OBJEXT) orxonox-projectile.$(OBJEXT) \
    6666        orxonox-test_gun.$(OBJEXT) orxonox-turret.$(OBJEXT) \
    67         orxonox-aiming_turret.$(OBJEXT) orxonox-test_bullet.$(OBJEXT) \
    68         orxonox-rocket.$(OBJEXT) orxonox-laser.$(OBJEXT) \
    69         orxonox-aim.$(OBJEXT) orxonox-bomb.$(OBJEXT) \
    70         orxonox-crosshair.$(OBJEXT) orxonox-power_up.$(OBJEXT) \
    71         orxonox-turret_power_up.$(OBJEXT) \
     67        orxonox-aiming_turret.$(OBJEXT) orxonox-cannon.$(OBJEXT) \
     68        orxonox-test_bullet.$(OBJEXT) orxonox-rocket.$(OBJEXT) \
     69        orxonox-laser.$(OBJEXT) orxonox-aim.$(OBJEXT) \
     70        orxonox-bomb.$(OBJEXT) orxonox-crosshair.$(OBJEXT) \
     71        orxonox-power_up.$(OBJEXT) orxonox-turret_power_up.$(OBJEXT) \
    7272        orxonox-laser_power_up.$(OBJEXT) orxonox-benchmark.$(OBJEXT)
    7373orxonox_OBJECTS = $(am_orxonox_OBJECTS)
     
    259259                  world_entities/weapons/turret.cc \
    260260                  world_entities/weapons/aiming_turret.cc \
     261                  world_entities/weapons/cannon.cc \
    261262                  world_entities/weapons/test_bullet.cc \
    262263                  world_entities/weapons/rocket.cc \
     
    293294                 world_entities/weapons/projectile.h \
    294295                 world_entities/weapons/test_gun.h \
     296                 world_entities/weapons/cannon.h \
    295297                 world_entities/weapons/turret.h \
    296298                 world_entities/weapons/aiming_turret.h \
     
    406408@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-camera.Po@am__quote@
    407409@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-campaign.Po@am__quote@
     410@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-cannon.Po@am__quote@
    408411@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-character_attributes.Po@am__quote@
    409412@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-crosshair.Po@am__quote@
     
    754757@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    755758@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-aiming_turret.obj `if test -f 'world_entities/weapons/aiming_turret.cc'; then $(CYGPATH_W) 'world_entities/weapons/aiming_turret.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/aiming_turret.cc'; fi`
     759
     760orxonox-cannon.o: world_entities/weapons/cannon.cc
     761@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-cannon.o -MD -MP -MF "$(DEPDIR)/orxonox-cannon.Tpo" -c -o orxonox-cannon.o `test -f 'world_entities/weapons/cannon.cc' || echo '$(srcdir)/'`world_entities/weapons/cannon.cc; \
     762@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/orxonox-cannon.Tpo" "$(DEPDIR)/orxonox-cannon.Po"; else rm -f "$(DEPDIR)/orxonox-cannon.Tpo"; exit 1; fi
     763@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/weapons/cannon.cc' object='orxonox-cannon.o' libtool=no @AMDEPBACKSLASH@
     764@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     765@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-cannon.o `test -f 'world_entities/weapons/cannon.cc' || echo '$(srcdir)/'`world_entities/weapons/cannon.cc
     766
     767orxonox-cannon.obj: world_entities/weapons/cannon.cc
     768@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-cannon.obj -MD -MP -MF "$(DEPDIR)/orxonox-cannon.Tpo" -c -o orxonox-cannon.obj `if test -f 'world_entities/weapons/cannon.cc'; then $(CYGPATH_W) 'world_entities/weapons/cannon.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/cannon.cc'; fi`; \
     769@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/orxonox-cannon.Tpo" "$(DEPDIR)/orxonox-cannon.Po"; else rm -f "$(DEPDIR)/orxonox-cannon.Tpo"; exit 1; fi
     770@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/weapons/cannon.cc' object='orxonox-cannon.obj' libtool=no @AMDEPBACKSLASH@
     771@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     772@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-cannon.obj `if test -f 'world_entities/weapons/cannon.cc'; then $(CYGPATH_W) 'world_entities/weapons/cannon.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/cannon.cc'; fi`
    756773
    757774orxonox-test_bullet.o: world_entities/weapons/test_bullet.cc
  • branches/world_entities/src/defs/class_id.h

    r5603 r5621  
    136136  CL_TURRET                     =    0x00000231,
    137137  CL_AIMING_TURRET              =    0x00000232,
    138 
     138  CL_CANNON                     =    0x00000233,
    139139
    140140  CL_TEST_BULLET                =    0x00000240,
  • branches/world_entities/src/world_entities/npc.cc

    r5499 r5621  
    3434  this->setClassID(CL_NPC, "NPC");
    3535
    36   this->loadModel("models/ships/bolido.obj", 2);
     36  if ((float)rand()/RAND_MAX > .5f)
     37    this->loadModel("models/ships/bolido.obj", 2);
     38  else
     39    this->loadModel("models/ships/gobblin.obj", 2);
    3740
    3841  this->randomRotAxis =  VECTOR_RAND(1);
  • branches/world_entities/src/world_entities/npc2.cc

    r5511 r5621  
    3535  this->setClassID(CL_NPC, "NPC");
    3636
    37   this->loadModel("models/ships/bolido.obj", 3);
     37  if ((float)rand()/RAND_MAX > .5f)
     38    this->loadModel("models/ships/bolido.obj", 3);
     39  else
     40    this->loadModel("models/ships/gobblin.obj", 3);
     41
    3842  this->shader = NULL;
    3943  if (likely(Shader::checkShaderAbility()))
  • branches/world_entities/src/world_entities/player.cc

    r5576 r5621  
    2626#include "weapons/test_gun.h"
    2727#include "weapons/turret.h"
     28#include "weapons/cannon.h"
    2829
    2930#include "list.h"
     
    4546{
    4647  this->init();
    47 
    48   //weapons:
    49   Weapon* wpRight = new TestGun(this->weaponMan, 0);
    50   Weapon* wpLeft = new TestGun(this->weaponMan, 1);
    51 
    52   this->weaponMan->addWeapon(wpRight);
    53 //  this->weaponMan->addWeapon(wpLeft, WM_CONFIG1, WM_SLOT1);
    54 //  this->weaponMan->addWeapon(wpRight, WM_CONFIG2);
    55 //  this->weaponMan->addWeapon(wpLeft, WM_CONFIG2);
    5648}
    5749
     
    9183  Weapon* wpLeft = new TestGun(this->weaponMan, 1);
    9284  wpLeft->setName("testGun Left");
     85  Weapon* cannon = new Cannon(this->weaponMan);
     86  cannon->setName("BFG");
    9387
    9488  this->weaponMan->addWeapon(wpLeft, 1, 0);
    9589  this->weaponMan->addWeapon(wpRight,1 ,1);
     90  this->weaponMan->addWeapon(cannon, 0, 6);
     91
    9692  //this->weaponMan->addWeapon(turret, 3, 0);
    9793
     
    133129
    134130  this->weaponMan = new WeaponManager(this);
    135   this->weaponMan->setSlotCount(6);
     131  this->weaponMan->setSlotCount(7);
    136132
    137133  this->weaponMan->setSlotPosition(0, Vector(-2.6, .1, -3.0));
     
    153149  this->weaponMan->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
    154150//
    155 //   this->weaponMan->setSlotPosition(6, Vector(-2.0, 0.1, -2.0));
    156 //   this->weaponMan->setSlotPosition(7, Vector(-2.0, 0.1, 2.0));
    157 //
     151   this->weaponMan->setSlotPosition(6, Vector(-1, 0.0, 0));
     152   this->weaponMan->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     153   //
    158154//   this->weaponMan->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
    159155//   this->weaponMan->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
  • branches/world_entities/src/world_entities/weapons/cannon.cc

    r5619 r5621  
    2121#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
    2222
    23 #include "test_gun.h"
     23#include "cannon.h"
    2424
    2525#include "world_entity.h"
     
    4141using namespace std;
    4242
    43 CREATE_FACTORY(TestGun);
     43CREATE_FACTORY(Cannon);
    4444
    4545/**
     
    4848   creates a new weapon
    4949*/
    50 TestGun::TestGun (WeaponManager* weaponManager, int leftRight)
     50Cannon::Cannon (WeaponManager* weaponManager)
    5151  : Weapon(weaponManager)
    5252{
    5353  this->init();
    5454
    55 
    56   this->leftRight = leftRight;
    57 
    58   this->objectComponent1 = new PNode();
    59   Animation3D* animation1 = this->getAnimation(WS_SHOOTING, this->objectComponent1);
     55//  this->objectComponent1 = new PNode();
     56//  Animation3D* animation1 = this->getAnimation(WS_SHOOTING, this->objectComponent1);
    6057  Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this);
    6158  Animation3D* animation3 = this->getAnimation(WS_DEACTIVATING, this);
    6259  //parent->addChild(this->objectComponent1, PNODE_ALL);
    63   this->addChild(this->objectComponent1);
    64 
    65   animation1->setInfinity(ANIM_INF_CONSTANT);
     60//  this->addChild(this->objectComponent1);
     61
     62//  animation1->setInfinity(ANIM_INF_CONSTANT);
    6663  animation2->setInfinity(ANIM_INF_CONSTANT);
    6764  animation3->setInfinity(ANIM_INF_CONSTANT);
    6865
    69   if( this->leftRight == W_LEFT)
    70   {
    71     this->setEmissionPoint(1.0, -0.6, -0.2);
    72 
    73     animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
    74     animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
    75     animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);
    76 
    77     animation2->addKeyFrame(Vector(0.0, 0.0, -1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     66    this->setEmissionPoint(3.8, 1.2, 0);
     67
     68//     animation1->addKeyFrame(Vector(0, -1.5, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
     69//     animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
     70//     animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);
     71
     72    animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    7873    animation2->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    7974
    8075    animation3->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    81     animation3->addKeyFrame(Vector(0.0, 0.0, -1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    82   }
    83   else if( this->leftRight == W_RIGHT)
    84   {
    85     this->setEmissionPoint(1.0, -0.6, 0.3);
    86 
    87     this->objectComponent1->setRelCoor(Vector(0,0,0.35));
    88     animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
    89     animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
    90     animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);
    91 
    92     animation2->addKeyFrame(Vector(.0, .0, 1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    93     animation2->addKeyFrame(Vector(.0, .0, .0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    94 
    95     animation3->addKeyFrame(Vector(.0, .0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    96     animation3->addKeyFrame(Vector(.0, .0, 1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    97   }
    98 }
    99 
    100 
    101 TestGun::TestGun(const TiXmlElement* root)
     76    animation3->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     77}
     78
     79
     80Cannon::Cannon(const TiXmlElement* root)
    10281{
    10382  this->init();
     
    10887 *  standard deconstructor
    10988*/
    110 TestGun::~TestGun ()
     89Cannon::~Cannon ()
    11190{
    11291  // model will be deleted from WorldEntity-destructor
     
    11493
    11594
    116 void TestGun::init()
    117 {
    118   this->setClassID(CL_TEST_GUN, "TestGun");
     95void Cannon::init()
     96{
     97  this->setClassID(CL_CANNON, "Cannon");
    11998
    12099//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
    121100
    122   this->loadModel("models/guns/test_gun.obj");
     101  this->loadModel("models/guns/cannon.obj");
    123102
    124103  this->setStateDuration(WS_SHOOTING, .1);
     
    140119
    141120
    142 void TestGun::loadParams(const TiXmlElement* root)
     121void Cannon::loadParams(const TiXmlElement* root)
    143122{
    144123
     
    154133   been armed out.
    155134*/
    156 void TestGun::activate()
     135void Cannon::activate()
    157136{
    158137}
     
    166145   been armed out.
    167146*/
    168 void TestGun::deactivate()
     147void Cannon::deactivate()
    169148{
    170149}
     
    177156   @todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent
    178157*/
    179 void TestGun::fire()
     158void Cannon::fire()
    180159{
    181160  Projectile* pj =  this->getProjectile();
     
    198177 * hit, it can also be destoryed.
    199178*/
    200 void TestGun::destroy ()
     179void Cannon::destroy ()
    201180{}
    202181
     
    204183 *  this will draw the weapon
    205184*/
    206 void TestGun::draw () const
     185void Cannon::draw () const
    207186{
    208187  /* draw gun body */
     
    216195  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    217196
    218   if( this->leftRight == W_RIGHT)
    219     glScalef(1.0, 1.0, -1.0);
    220   this->model->draw(1);
     197  this->model->draw();
    221198  glPopMatrix();
    222199
    223200  /* draw objectComponent1: gun coil - animated stuff */
    224   glMatrixMode(GL_MODELVIEW);
     201/*  glMatrixMode(GL_MODELVIEW);
    225202  glPushMatrix();
    226203  glTranslatef (this->objectComponent1->getAbsCoor ().x,
     
    230207  glRotatef (this->objectComponent1->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    231208  this->model->draw(0);
    232   glPopMatrix();
    233 }
    234 
     209
     210  glPopMatrix();*/
     211}
     212
  • branches/world_entities/src/world_entities/weapons/cannon.h

    r5619 r5621  
    11/*!
    2     @file weapon.h
    3   *  a weapon that a player can use
    4 
    5     A Player has a list of weapons, that can be choosen to shoot projectiles
    6     (projectiles.{cc,h}) at enemies. These weapons can be shooted sequentially
    7     or (if able) combined. Therefore you can choose the weapon mode = choose
    8     a weapon.
    9 
    10     A weapon is characterized by:
    11      o firing-rate: the initial firing rate of a weapon (1/s = Herz)
    12      o slowdown-factor: this is a factor d: exp(-d*x), d is element of all positive R. it determines how fast the firing-rate will slow down. if no slowdown: d=0, the bigger d is, the faster the weapon will slow down!
    13      o energy-consumption: this determines the energy that has to be used to produce this projectile = costs per projectile
    14 
    15     Furthermore there are some other attributes, that will help to represent a firing
    16     weapon in this world:
    17      o sound file/ressource: this is a pointer to the sound-file/ressource. however it may be represented
    18      o shooting animation
    19 
     2 * @file cannon.h
     3 * a weapon that is fix on top of the player to fire heavy weaponary.
    204*/
    215
    226
    23 #ifndef _TEST_GUN_H
    24 #define _TEST_GUN_H
     7#ifndef _CANNON_H
     8#define _CANNON_H
    259
    2610#include "weapon.h"
    2711
    28 
    29 //! a weapon can be left or right sided
    30 /**
    31  * @todo this will be reset with mirror X/Y/Z
    32  */
    33 #define    W_LEFT        0
    34 #define    W_RIGHT       1
    35 
    36 
    37 class TestGun : public Weapon
     12class Cannon : public Weapon
    3813  {
    3914  public:
    40     TestGun (WeaponManager* weaponManager, int leftRight);
    41     TestGun (const TiXmlElement* root);
    42     virtual ~TestGun ();
     15    Cannon (WeaponManager* weaponManager);
     16    Cannon (const TiXmlElement* root);
     17    virtual ~Cannon ();
    4318
    4419    void init();
     
    5429
    5530  private:
    56     PNode* objectComponent1;         //<! the gun is made of multiple parts, these PNodes represent their location and orientation
    57 
    58     int leftRight;   // this will become an enum
     31//     PNode* objectComponent1;         //<! the gun is made of multiple parts, these PNodes represent their location and orientation
    5932  };
    60 #endif /* _TEST_GUN_H */
     33#endif /* _CANNON_H */
Note: See TracChangeset for help on using the changeset viewer.