Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4963 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Jul 28, 2005, 2:43:15 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: added class turret, a subclass for turrets, this is not finished yet, but will be in some time from now…

Location:
orxonox/trunk/src
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.am

    r4940 r4963  
    6464                  world_entities/weapons/projectile.cc \
    6565                  world_entities/weapons/test_gun.cc \
     66                  world_entities/weapons/turret.cc \
    6667                  world_entities/weapons/test_bullet.cc \
    6768                  world_entities/weapons/crosshair.cc \
     
    120121                 world_entities/weapons/projectile.h \
    121122                 world_entities/weapons/test_gun.h \
     123                 world_entities/weapons/turret.h \
    122124                 world_entities/weapons/test_bullet.h \
    123125                 world_entities/weapons/crosshair.h \
  • orxonox/trunk/src/Makefile.in

    r4940 r4963  
    7272        orxonox-test_entity.$(OBJEXT) orxonox-weapon_manager.$(OBJEXT) \
    7373        orxonox-weapon.$(OBJEXT) orxonox-projectile.$(OBJEXT) \
    74         orxonox-test_gun.$(OBJEXT) orxonox-test_bullet.$(OBJEXT) \
    75         orxonox-crosshair.$(OBJEXT) orxonox-p_node.$(OBJEXT) \
    76         orxonox-null_parent.$(OBJEXT) \
     74        orxonox-test_gun.$(OBJEXT) orxonox-turret.$(OBJEXT) \
     75        orxonox-test_bullet.$(OBJEXT) orxonox-crosshair.$(OBJEXT) \
     76        orxonox-p_node.$(OBJEXT) orxonox-null_parent.$(OBJEXT) \
    7777        orxonox-graphics_engine.$(OBJEXT) orxonox-light.$(OBJEXT) \
    7878        orxonox-text_engine.$(OBJEXT) orxonox-element_2d.$(OBJEXT) \
     
    131131@AMDEP_TRUE@    ./$(DEPDIR)/orxonox-track_manager.Po \
    132132@AMDEP_TRUE@    ./$(DEPDIR)/orxonox-track_node.Po \
     133@AMDEP_TRUE@    ./$(DEPDIR)/orxonox-turret.Po \
    133134@AMDEP_TRUE@    ./$(DEPDIR)/orxonox-vector.Po \
    134135@AMDEP_TRUE@    ./$(DEPDIR)/orxonox-weapon.Po \
     
    317318                  world_entities/weapons/projectile.cc \
    318319                  world_entities/weapons/test_gun.cc \
     320                  world_entities/weapons/turret.cc \
    319321                  world_entities/weapons/test_bullet.cc \
    320322                  world_entities/weapons/crosshair.cc \
     
    373375                 world_entities/weapons/projectile.h \
    374376                 world_entities/weapons/test_gun.h \
     377                 world_entities/weapons/turret.h \
    375378                 world_entities/weapons/test_bullet.h \
    376379                 world_entities/weapons/crosshair.h \
     
    525528@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-track_manager.Po@am__quote@
    526529@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-track_node.Po@am__quote@
     530@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-turret.Po@am__quote@
    527531@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-vector.Po@am__quote@
    528532@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-weapon.Po@am__quote@
     
    10581062@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    10591063@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-test_gun.obj `if test -f 'world_entities/weapons/test_gun.cc'; then $(CYGPATH_W) 'world_entities/weapons/test_gun.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/test_gun.cc'; fi`
     1064
     1065orxonox-turret.o: world_entities/weapons/turret.cc
     1066@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-turret.o -MD -MP -MF "$(DEPDIR)/orxonox-turret.Tpo" -c -o orxonox-turret.o `test -f 'world_entities/weapons/turret.cc' || echo '$(srcdir)/'`world_entities/weapons/turret.cc; \
     1067@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/orxonox-turret.Tpo" "$(DEPDIR)/orxonox-turret.Po"; else rm -f "$(DEPDIR)/orxonox-turret.Tpo"; exit 1; fi
     1068@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/weapons/turret.cc' object='orxonox-turret.o' libtool=no @AMDEPBACKSLASH@
     1069@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/orxonox-turret.Po' tmpdepfile='$(DEPDIR)/orxonox-turret.TPo' @AMDEPBACKSLASH@
     1070@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1071@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-turret.o `test -f 'world_entities/weapons/turret.cc' || echo '$(srcdir)/'`world_entities/weapons/turret.cc
     1072
     1073orxonox-turret.obj: world_entities/weapons/turret.cc
     1074@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-turret.obj -MD -MP -MF "$(DEPDIR)/orxonox-turret.Tpo" -c -o orxonox-turret.obj `if test -f 'world_entities/weapons/turret.cc'; then $(CYGPATH_W) 'world_entities/weapons/turret.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/turret.cc'; fi`; \
     1075@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/orxonox-turret.Tpo" "$(DEPDIR)/orxonox-turret.Po"; else rm -f "$(DEPDIR)/orxonox-turret.Tpo"; exit 1; fi
     1076@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='world_entities/weapons/turret.cc' object='orxonox-turret.obj' libtool=no @AMDEPBACKSLASH@
     1077@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/orxonox-turret.Po' tmpdepfile='$(DEPDIR)/orxonox-turret.TPo' @AMDEPBACKSLASH@
     1078@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1079@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-turret.obj `if test -f 'world_entities/weapons/turret.cc'; then $(CYGPATH_W) 'world_entities/weapons/turret.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/turret.cc'; fi`
    10601080
    10611081orxonox-test_bullet.o: world_entities/weapons/test_bullet.cc
  • orxonox/trunk/src/defs/class_id.h

    r4961 r4963  
    128128  CL_TEST_ENTITY                =    0x00000209,
    129129  CL_TEST_GUN                   =    0x0000020a,
     130  CL_TURRET                     =    0x0000020b,
    130131
    131132
  • orxonox/trunk/src/world_entities/player.cc

    r4955 r4963  
    2424#include "weapon_manager.h"
    2525#include "test_gun.h"
     26#include "turret.h"
    2627#include "world.h"
    2728
     
    8586  wpLeft->setName("testGun Left");
    8687
     88  Weapon* turret = new Turret(this->weaponMan);
    8789  this->weaponMan->addWeapon(wpLeft, 1, 0);
    8890  this->weaponMan->addWeapon(wpRight,1 ,1);
    89   this->weaponMan->addWeapon(wpLeft, 3, 1);
     91  this->weaponMan->addWeapon(turret, 3, 1);
    9092
    9193  this->weaponMan->changeWeaponConfig(0);
  • orxonox/trunk/src/world_entities/weapons/turret.cc

    r4962 r4963  
    1 
    2 
    31/*
    42   orxonox - the future of 3D-vertical-scrollers
     
    1210
    1311   ### File Specific
    14    main-programmer: Patrick Boenzli
     12   main-programmer: Benjamin Grauer
    1513   co-programmer:
    16 
    17 
    18    @todo: direction in which the projectile flights
    19    @todo: a target to set/hit
    2014*/
    2115
    2216
    23 #include "test_gun.h"
     17#include "turret.h"
    2418
    25 #include "world_entity.h"
    26 #include "model.h"
     19#include "weapon_manager.h"
    2720#include "test_bullet.h"
    28 #include "weapon_manager.h"
    2921
    3022#include "state.h"
     
    4537   creates a new weapon
    4638*/
    47 TestGun::TestGun (WeaponManager* weaponManager, int leftRight)
     39Turret::Turret (WeaponManager* weaponManager)
    4840  : Weapon(weaponManager)
    4941{
    50   this->setClassID(CL_TEST_GUN, "TestGun");
     42  this->setClassID(CL_TURRET, "Turret");
    5143
    52   this->model = (Model*)ResourceManager::getInstance()->load("models/test_gun.obj", OBJ, RP_CAMPAIGN);
     44  this->model = (Model*)ResourceManager::getInstance()->load("models/turret1.obj", OBJ, RP_CAMPAIGN);
    5345  this->leftRight = leftRight;
    5446
    55   this->objectComponent1 = new PNode();
     47/*  this->objectComponent1 = new PNode();
    5648  Animation3D* animation1 = this->getAnimation(WS_SHOOTING, this->objectComponent1);
    5749  Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this);
     
    9183      animation3->addKeyFrame(Vector(.0, .0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    9284      animation3->addKeyFrame(Vector(.0, .0, 1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    93     }
    94 /*
    95   this->fireSound = (SoundBuffer*)ResourceManager::getInstance()->load("sound/shot1.wav", WAV);
    96   this->weaponSource = new SoundSource(this->fireSound, this);
    97   this->weaponSource->setRolloffFactor(.1);*/
    98   Projectile* p = new TestBullet();
     85    }*/
    9986
    10087  //  ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, p);
     
    120107 *  standard deconstructor
    121108*/
    122 TestGun::~TestGun ()
     109Turret::~Turret ()
    123110{
    124111  // model will be deleted from WorldEntity-destructor
     
    133120   been armed out.
    134121*/
    135 void TestGun::activate()
     122void Turret::activate()
    136123{
    137124}
     
    145132   been armed out.
    146133*/
    147 void TestGun::deactivate()
     134void Turret::deactivate()
    148135{
    149136}
     
    156143   @todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent
    157144*/
    158 void TestGun::fire()
     145void Turret::fire()
    159146{
    160147  Projectile* pj =  dynamic_cast<Projectile*>(this->getProjectileFactory()->resurrect());
     
    177164
    178165/**
    179  *  is called, when the weapon gets hit (=collide with something)
    180  * @param from which entity it is been hit
    181  * @param where it is been hit
    182 
    183    this may not be used, since it would make the game relay complicated when one
    184    can destroy the weapons of enemies or vice versa.
    185 */
    186 void TestGun::hit (WorldEntity* entity, Vector* position)
    187 {}
    188 
    189 
    190 /**
    191166 *  is called, when the weapon is destroyed
    192167
     
    194169   hit, it can also be destoryed.
    195170*/
    196 void TestGun::destroy ()
     171void Turret::destroy ()
    197172{}
    198173
     
    200175 *  this will draw the weapon
    201176*/
    202 void TestGun::draw ()
     177void Turret::draw ()
    203178{
    204179  this->getWeaponManager()->getFixedTarget()->debugDraw(10);
     
    213188  this->getAbsDir ().matrix (matrix);
    214189  glMultMatrixf((float*)matrix);
    215   if( this->leftRight == W_RIGHT)
    216     glScalef(1.0, 1.0, -1.0);
    217   this->model->draw(1);
    218   glPopMatrix();
    219190
    220   /* draw objectComponent1: gun coil - animated stuff */
    221   glMatrixMode(GL_MODELVIEW);
    222   glPushMatrix();
    223   glTranslatef (this->objectComponent1->getAbsCoor ().x,
    224                 this->objectComponent1->getAbsCoor ().y,
    225                 this->objectComponent1->getAbsCoor ().z);
    226   this->objectComponent1->getAbsDir ().matrix (matrix);
    227   glMultMatrixf((float*)matrix);
    228   this->model->draw(0);
     191  this->model->draw();
    229192  glPopMatrix();
    230193}
  • orxonox/trunk/src/world_entities/weapons/turret.h

    r4962 r4963  
    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 turret.h
    203*/
    214
    225
    23 #ifndef _TEST_GUN_H
    24 #define _TEST_GUN_H
     6#ifndef _TURRET_H
     7#define _TURRET_H
    258
    269#include "weapon.h"
    2710
    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
     11class Turret : public Weapon
    3812  {
    3913  public:
    40     TestGun (WeaponManager* weaponManager, int leftRight);
    41     virtual ~TestGun ();
     14    Turret (WeaponManager* weaponManager);
     15    virtual ~Turret ();
    4216
    4317    virtual void activate();
     
    4519
    4620    virtual void fire();
    47     virtual void hit (WorldEntity* weapon, Vector* loc);
    4821    virtual void destroy();
    4922
     
    5528    int leftRight;   // this will become an enum
    5629  };
    57 #endif /* _TEST_GUN_H */
     30#endif /* _TURRET_H */
Note: See TracChangeset for help on using the changeset viewer.