Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4881 in orxonox.OLD


Ignore:
Timestamp:
Jul 17, 2005, 4:46:19 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: shooting works, with interval-handling :)
now after 2 hours of war of the worlds, 5 hours coding…. for some 3-4 hours sleep, until i can't stop thinking about a better way to implement the rest of the WeaponSystem

Location:
orxonox/branches/weaponSystem/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/weaponSystem/src/defs/debug.h

    r4852 r4881  
    6969#define DEBUG_MODULE_LIGHT              0
    7070#define DEBUG_MODULE_PLAYER             1
    71 #define DEBUG_MODULE_WEAPON             0
     71#define DEBUG_MODULE_WEAPON             4
    7272#define DEBUG_MODULE_MATH               0
    7373#define DEBUG_MODULE_FONT               1
  • orxonox/branches/weaponSystem/src/world_entities/weapons/test_gun.cc

    r4880 r4881  
    9898//  ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, p);
    9999  //ObjectManager::getInstance()->debug();
     100
     101  this->setStateDuration(WS_SHOOTING, 2);
    100102}
    101103
     
    144146void TestGun::fire()
    145147{
    146   if( !this->stateTimeElapsed())
    147     {
    148       this->weaponIdle();
    149       return;
    150     }
    151 
    152     Projectile* pj =  new TestBullet(this);//dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET & CL_MASK_LOWLEVEL_CLASS));
    153   weaponSource->play();
     148  Projectile* pj =  new TestBullet(this);//dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET & CL_MASK_LOWLEVEL_CLASS));
     149//  weaponSource->play();
    154150
    155151  pj->setAbsCoor(this->getAbsCoor() + this->projectileOffset);
  • orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.cc

    r4880 r4881  
    1616   2005-07-15: Benjamin Grauer: restructurating the entire Class
    1717*/
     18
     19#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
    1820
    1921#include "weapon.h"
     
    7476  this->maxCharge = 0.0;
    7577
    76   this->active = false;
     78  this->active = true;
    7779  this->projectile = NULL;
    7880}
     
    104106void Weapon::requestAction(WeaponAction action)
    105107{
     108  printf("next action will be %d\n", action);
    106109  this->requestedAction = action;
    107110}
    108111
    109 bool Weapon::execute(WeaponAction action)
    110 {
    111   this->stateDuration = this->times[action] + this->stateDuration;
    112 
    113   switch (action)
     112bool Weapon::execute()
     113{
     114  this->stateDuration = this->times[this->requestedAction] + this->stateDuration;
     115
     116  PRINT(3)("executing action %d\n", this->requestedAction);
     117
     118  switch (this->requestedAction)
    114119  {
    115120    case WA_SHOOT:
     
    129134      break;
    130135  }
     136  this->requestedAction = WA_NONE;
    131137}
    132138
     
    146152void Weapon::fire()
    147153{
    148 
    149154}
    150155
     
    174179void Weapon::tick(float dt)
    175180{
     181  // setting up the timing properties
     182  this->stateDuration -= dt;
     183
    176184  if (this->isActive())
    177185  {
    178     this->stateDuration -= dt;
    179 
    180     if (this->stateDuration < 0.0)
    181       this->execute(this->requestedAction);
     186    if (this->stateDuration <= 0.0 && this->requestedAction != WA_NONE)
     187      this->execute();
    182188  }
    183189  else
  • orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.h

    r4880 r4881  
    113113
    114114
    115     bool execute(WeaponAction action);
     115    bool execute();
    116116    virtual void activate();
    117117    virtual void deactivate();
Note: See TracChangeset for help on using the changeset viewer.