Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10664 in orxonox.OLD


Ignore:
Timestamp:
May 31, 2007, 3:45:05 PM (17 years ago)
Author:
retolu
Message:

compiles

Location:
branches/adm/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/adm/src/world_entities/WorldEntities.am

    r10638 r10664  
    1313                world_entities/npcs/attractor_mine.cc \
    1414                world_entities/npcs/mover.cc \
     15                world_entities/npcs/adm_turret.cc \
    1516                \
    1617                \
     
    147148                npcs/attractor_mine.h \
    148149                npcs/mover.h \
     150                npcs/adm_turret.h \
    149151                \
    150152                environments/environment.h \
  • branches/adm/src/world_entities/npcs/adm_turret.cc

    r10663 r10664  
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
    1717#include "adm_turret.h"
    18 #include "weapon_manager.h"
     18#include "weapons/weapon_manager.h"
     19#include "weapons/weapon.h"
    1920#include "lib/util/loading/factory.h"
    2021#include "world_entities/projectiles/projectile.h"
    21 
     22#include "loading/load_param.h"
     23#include "debug.h"
    2224
    2325ObjectListDefinition(AdmTurret);
    2426CREATE_FACTORY(AdmTurret);
    2527
    26 public:
    27        
     28
    2829/**
    2930*  Standard constructor
     
    3132AdmTurret::AdmTurret ()
    3233{
    33           this->init();
     34        this->init();
    3435}
    3536
    36        
    3737/**
    3838*  destructs the turret, deletes allocated memory
     
    4343}
    4444
    45 AdmTurret::AdmTurret (const  TiXmlElemet* root)
     45AdmTurret::AdmTurret (const  TiXmlElement* root)
    4646{
    47              this->init();
    48              if (root != NULL)
    49                  this->loadParams(root);
     47        this->init();
     48        if (root != NULL)
     49        {
     50                this->loadParams(root);
     51        }
    5052}
    51        
     53
    5254void AdmTurret::init()
    5355{
    54      this->registerObject(this, GroundTurret::_objectList);
    55      
    56      // load the 3 parts of the turret
    57      // this-> loadModel ("...", , )
    58      // this-> loadModel ("...", , )
    59      // this-> loadModel ("...", , )
    60      
    61      
    62      //Cannon Node: 2 Cannons fixed left and right of the main turret
    63      this->cannonNode.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT)
    64      this->cannonNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE)
    65      this->cannonNode.setParent(this)
    66      // this->cannonNode.setRelCoor( , , )
    67      
    68      
    69      
    70      //Sensor Node: Sensor rotating independently from main turret (like Radar)
    71      this->sensorNode.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT)
    72      this->sensorNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE)
    73      this->sensorNode.setParent(this)
    74      // this->sensorNode.setRelCoor( , , )
    75      
     56        this->registerObject(this, AdmTurret::_objectList);
    7657
    77      this->setStateDuration(WS_SHOOTING, .1);
    78      this->setStateDuration(WS_RELOADING, .1);
    79          this->setStateDuration(WS_ACTIVATING, .4);
    80          this->setStateDuration(WS_DEACTIVATING, .4);
     58        // load the 3 parts of the turret
     59        // this-> loadModel ("...", , )
     60        // this-> loadModel ("...", , )
     61        // this-> loadModel ("...", , )
    8162
    82          this->setEnergyMax(10000);
    83          this->increaseEnergy(10000);
    84          //this->minCharge = ;
    85        
    86      //this->setActionSound(WA_SHOOT, "sounds/guns/xyz.wav");
    87          //this->setActionSound(WA_ACTIVATE, "sounds/voices/xxyz.wav");
     63        //Cannon Node: 2 Cannons fixed left and right of the main turret
     64        this->cannonNode.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     65        this->cannonNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
     66        this->cannonNode.setParent(this);
     67        // this->cannonNode.setRelCoor( , , )
    8868
    89          this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    90          this->setProjectileTypeC("Projectile");
    91          // this->prepareProjectiles(10000);
    92          
    93      
    94      // PROBLEM!! 2 emission Points!
    95      // this->setEmissionPoint(Vector( , , ) );
    96      
    97      // initialise here
     69        //Sensor Node: Sensor rotating independently from main turret (like Radar)
     70        this->sensorNode.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     71        this->sensorNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
     72        this->sensorNode.setParent(this);
     73        // this->sensorNode.setRelCoor( , , )
     74
     75        // initialise Weapons here
    9876}
    9977
    10078void AdmTurret::loadParams(const TiXmlElement* root)
    10179{
    102         Weapon::loadParams(root);
    103        
    104         LoadParam(root, "target", this, GroundTurret, setTarget)
     80        WorldEntity::loadParams(root);
     81
     82        LoadParam(root, "target", this, AdmTurret, setTarget)
     83                .describe("the filename of the World Entity, that is to be shot at")
     84                .defaultValues("");
    10585}
    10686
    107 virtual void AdmTurret::tick(float dt);
    108 
    109 virtual void GroundTurret::draw() const;
    110 
    111 virtual void AdmTurret::collidesWith(WorldEntity* entity, const Vector& location);
    112 
    113 virtual void AdmTurret::activate()
     87void AdmTurret::tick(float dt)
    11488{
    11589}
    116        
    117 virtual void AdmTurret::deactivate()
    118 {       
     90
     91void AdmTurret::draw() const
     92{
    11993}
    12094
    121 virtual void AdmTurret::setTarget(const std::string& target)
     95void AdmTurret::collidesWith(WorldEntity* entity, const Vector& location)
    12296{
    123         WorldEntity* targetEntity = WorldEntity::objectList().getObject(target);
    124         if (targetEntity != NULL)
    125         {
    126             this->myTarget = targetEntity;
    127         }
    128         else
    129         {
    130             PRINTF(2)("ERROR ADMTURRET : Target %s does not exist\n", target.c_str());
    131         }
    132 }
    133            
    134 private:
    135        
    136 bool AdmTurret::isVisible(const WorldEntity myTarget)
    137 {     
    13897}
    13998
    140 float AdmTurret::aim(const WorldEntity Target);
     99void AdmTurret::activate()
     100{
     101}
     102
     103void AdmTurret::deactivate()
     104{
     105}
     106
     107void AdmTurret::setTarget(const std::string& target)
     108{
     109        WorldEntity* targetEntity = WorldEntity::objectList().getObject(target);
     110        if (targetEntity != NULL)
     111        {
     112                this->myTarget = targetEntity;
     113        }
     114        else
     115        {
     116                PRINTF(2)("ERROR ADMTURRET : Target %s does not exist\n", target.c_str());
     117        }
     118}
     119
     120bool AdmTurret::isVisible(const WorldEntity myTarget)
     121{
     122return true;
     123}
     124
     125float AdmTurret::aim(const WorldEntity Target)
     126{
     127return 0;
     128}
    141129
    142130void AdmTurret::fire()
    143131{
    144      Projectile* pj =  this->getProjectile();
    145      if (pj == NULL) return;
    146      
    147      //pj->setOwner(this->getOwner());
    148          
    149      //pj->setParent(PNode::getNullParent());
     132        // Projectile* pj =  this->getProjectile();
     133        // if (pj == NULL) return;
    150134
    151          //pj->setVelocity(this->getAbsDir().apply(Vector( , , )) );
    152          
    153          //pj->setAbsCoor(this->getEmissionPoint());
    154          //pj->setAbsDir(this->getAbsDir());
    155          //pj->activate();
    156 }       
     135        //pj->setOwner(this->getOwner());
     136        //pj->setParent(PNode::getNullParent());
     137        //pj->setVelocity(this->getAbsDir().apply(Vector( , , )) );
     138        //pj->setAbsCoor(this->getEmissionPoint());
     139        //pj->setAbsDir(this->getAbsDir());
     140        //pj->activate();
     141}
  • branches/adm/src/world_entities/npcs/adm_turret.h

    r10663 r10664  
    1010//#include "sound_source.h"
    1111
    12 #include "weapon.h"
     12#include "world_entity.h"
    1313
    14 class GroundTurret : public WorldEntity
     14class AdmTurret : public WorldEntity
    1515      {
    1616                   ObjectListDeclaration(AdmTurret);
     
    4040                   void fire();
    4141                                           
    42       }
     42      };
     43
     44#endif
Note: See TracChangeset for help on using the changeset viewer.