Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/old.we/src/world_entities/weapons/ground_turret.cc @ 5828

Last change on this file since 5828 was 5794, checked in by bensch, 19 years ago

we: sync

File size: 2.6 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Manuel Leuenberger
13   co-programmer: ...
14*/
15
16#include "ground_turret.h"
17#include "model.h"
18#include "turret.h"
19
20#include "factory.h"
21#include "load_param.h"
22
23CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET);
24
25using namespace std;
26
27
28/**
29 * constructs and loads a GroundTurret from a XML-element
30 * @param root the XML-element to load from
31 */
32GroundTurret::GroundTurret(const TiXmlElement* root)
33{
34  this->init();
35  if (root != NULL)
36    this->loadParams(root);
37}
38
39
40/**
41 * standard deconstructor
42 */
43GroundTurret::~GroundTurret ()
44{
45
46}
47
48
49/**
50 * initializes the GroundTurret
51 * @todo change this to what you wish
52 */
53void GroundTurret::init()
54{
55  this->setClassID(CL_GROUND_TURRET, "GroundTurret");
56  this->loadModel("models/ground_turret.obj", 5);
57  this->left = NULL;
58  this->right = NULL;
59
60  /*  left = new Turret();
61  left->setParent(this);
62  left->setRelCoor(0,10,0);
63  right = new Turret();
64  right->setParent(this);
65  right->setRelCoor(0,10,0);*/
66}
67
68
69/**
70 * loads a GroundTurret from a XML-element
71 * @param root the XML-element to load from
72 * @todo make the class Loadable
73 */
74void GroundTurret::loadParams(const TiXmlElement* root)
75{
76  // all the clases this Entity is directly derived from must be called in this way, to load all settings.
77  static_cast<NPC*>(this)->loadParams(root);
78
79
80  /**
81   * @todo: make the class Loadable
82   */
83  LoadParamXML(root, "Weapons", this, GroundTurret, loadWeapon);
84}
85
86
87/**
88 * advances the GroundTurret about time seconds
89 * @param time the Time to step
90 */
91void GroundTurret::tick(float time)
92{
93
94}
95
96/**
97 * draws this worldEntity
98 */
99void GroundTurret::draw () const
100{
101  glMatrixMode(GL_MODELVIEW);
102  glPushMatrix();
103  float matrix[4][4];
104
105  /* translate */
106  glTranslatef (this->getAbsCoor ().x,
107                this->getAbsCoor ().y,
108                this->getAbsCoor ().z);
109  /* rotate */
110  this->getAbsDir().matrix(matrix);
111  glMultMatrixf((float*)matrix);
112
113  if (this->model)
114    this->model->draw();
115  if (left != NULL)
116    this->left->draw();
117  if (this->right != NULL)
118    this->right->draw();
119
120  glPopMatrix();
121}
122
123
124/**
125 *
126 *
127 */
128void GroundTurret::collidesWith (WorldEntity* entity, const Vector& location)
129{
130
131}
132
133/**
134 *
135 *
136 */
137void GroundTurret::postSpawn ()
138{
139
140}
141
142/**
143 *
144 *
145 */
146void GroundTurret::leftWorld ()
147{
148
149}
Note: See TracBrowser for help on using the repository browser.