Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 5, 2006, 12:49:40 AM (18 years ago)
Author:
bensch
Message:

less errors/segfaults

File:
1 copied

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/world_entities/npcs/space_turret.cc

    r9178 r9180  
    1414*/
    1515
    16 #include "ground_turret.h"
     16#include "space_turret.h"
    1717#include "model.h"
    1818#include "world_entities/weapons/turret.h"
     
    2929#include "effects/explosion.h"
    3030
    31 CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET);
    32 
    33 using namespace std;
    34 
     31CREATE_FACTORY(SpaceTurret, CL_SPACE_TURRET);
    3532
    3633/**
    37  * constructs and loads a GroundTurret from a XML-element
     34 * constructs and loads a SpaceTurret from a XML-element
    3835 * @param root the XML-element to load from
    3936 */
    40 GroundTurret::GroundTurret(const TiXmlElement* root)
     37SpaceTurret::SpaceTurret(const TiXmlElement* root)
    4138  : NPC(root)
    4239{
     
    5047 * standard deconstructor
    5148 */
    52 GroundTurret::~GroundTurret ()
     49SpaceTurret::~SpaceTurret ()
    5350{
    5451
     
    5754
    5855/**
    59  * initializes the GroundTurret
     56 * initializes the SpaceTurret
    6057 * @todo change this to what you wish
    6158 */
    62 void GroundTurret::init()
     59void SpaceTurret::init()
    6360{
    64   this->setClassID(CL_GROUND_TURRET, "GroundTurret");
     61  this->setClassID(CL_SPACE_TURRET, "SpaceTurret");
    6562  this->loadModel("models/ground_turret_#.obj", 5);
     63  this->loadModel("models/comet.obj", .5, 3);
    6664  this->left = NULL;
    6765  this->right = NULL;
     
    8078
    8179/**
    82  * loads a GroundTurret from a XML-element
     80 * loads a SpaceTurret from a XML-element
    8381 * @param root the XML-element to load from
    8482 * @todo make the class Loadable
    8583 */
    86 void GroundTurret::loadParams(const TiXmlElement* root)
     84void SpaceTurret::loadParams(const TiXmlElement* root)
    8785{
    8886  // all the clases this Entity is directly derived from must be called in this way, to load all settings.
     
    121119
    122120/**
    123  * advances the GroundTurret about time seconds
     121 * advances the SpaceTurret about time seconds
    124122 * @param time the Time to step
    125123 */
    126 void GroundTurret::tick(float dt)
     124void SpaceTurret::tick(float dt)
    127125{
    128126  if(this->getHealth() > 0.0f && State::getPlayer() &&
     
    146144 * draws this worldEntity
    147145 */
    148 void GroundTurret::draw () const
     146void SpaceTurret::draw () const
    149147{
    150   WorldEntity::draw();
     148  glPushMatrix();
     149  glTranslatef (this->getAbsCoor ().x,
     150                this->getAbsCoor ().y,
     151                this->getAbsCoor ().z);
     152
     153  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     154  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     155
     156  this->getModel()->draw();
     157  if (this->getModel() != NULL)
     158    this->getModel(3)->draw();
     159  glPopMatrix();
    151160
    152161  if (this->left != NULL)
     
    162171 *
    163172 */
    164 void GroundTurret::postSpawn ()
     173void SpaceTurret::postSpawn ()
    165174{
    166175
     
    171180 *
    172181 */
    173 void GroundTurret::leftWorld ()
     182void SpaceTurret::leftWorld ()
    174183{
    175184
    176185}
    177186
    178 void GroundTurret::destroy(WorldEntity* killer)
     187void SpaceTurret::destroy(WorldEntity* killer)
    179188{
    180189  this->setAbsDirSoft(Quaternion(-90, Vector(0,0,1)), 90);
Note: See TracChangeset for help on using the changeset viewer.