| 1 |  | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | orxonox - the future of 3D-vertical-scrollers | 
|---|
| 5 |  | 
|---|
| 6 | Copyright (C) 2004 orx | 
|---|
| 7 |  | 
|---|
| 8 | This program is free software; you can redistribute it and/or modify | 
|---|
| 9 | it under the terms of the GNU General Public License as published by | 
|---|
| 10 | the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 11 | any later version. | 
|---|
| 12 |  | 
|---|
| 13 | ### File Specific | 
|---|
| 14 | main-programmer: Patrick Boenzli | 
|---|
| 15 | co-programmer: | 
|---|
| 16 | */ | 
|---|
| 17 |  | 
|---|
| 18 |  | 
|---|
| 19 | #include "projectile.h" | 
|---|
| 20 |  | 
|---|
| 21 | #include "world_entity.h" | 
|---|
| 22 | #include "objModel.h" | 
|---|
| 23 | #include "primitive.h" | 
|---|
| 24 | #include "vector.h" | 
|---|
| 25 |  | 
|---|
| 26 | using namespace std; | 
|---|
| 27 |  | 
|---|
| 28 |  | 
|---|
| 29 | /** | 
|---|
| 30 | \brief standard constructor | 
|---|
| 31 | */ | 
|---|
| 32 | Projectile::Projectile () : WorldEntity() | 
|---|
| 33 | { | 
|---|
| 34 | //this->model = new OBJModel(""); | 
|---|
| 35 | this->projectileModel = new Primitive(P_SPHERE); | 
|---|
| 36 | } | 
|---|
| 37 |  | 
|---|
| 38 |  | 
|---|
| 39 | /** | 
|---|
| 40 | \brief standard deconstructor | 
|---|
| 41 | */ | 
|---|
| 42 | Projectile::~Projectile () | 
|---|
| 43 | { | 
|---|
| 44 |  | 
|---|
| 45 | } | 
|---|
| 46 |  | 
|---|
| 47 |  | 
|---|
| 48 | /** | 
|---|
| 49 | \brief signal tick, time dependent things will be handled here | 
|---|
| 50 | \param time since last tick | 
|---|
| 51 | */ | 
|---|
| 52 | void Projectile::tick (float time) | 
|---|
| 53 | {} | 
|---|
| 54 |  | 
|---|
| 55 | /** | 
|---|
| 56 | \brief the projectile gets hit by another entity | 
|---|
| 57 | \param the other entity | 
|---|
| 58 | \param place where it is hit | 
|---|
| 59 | */ | 
|---|
| 60 | void Projectile::hit (WorldEntity* entity, Vector* place) | 
|---|
| 61 | {} | 
|---|
| 62 |  | 
|---|
| 63 |  | 
|---|
| 64 | /** | 
|---|
| 65 | \brief the function gets called, when the projectile is destroyed | 
|---|
| 66 | */ | 
|---|
| 67 | void Projectile::destroy () | 
|---|
| 68 | {} | 
|---|
| 69 |  | 
|---|
| 70 |  | 
|---|
| 71 | void Projectile::draw () | 
|---|
| 72 | { | 
|---|
| 73 | glMatrixMode(GL_MODELVIEW); | 
|---|
| 74 | glPushMatrix(); | 
|---|
| 75 |  | 
|---|
| 76 | float matrix[4][4]; | 
|---|
| 77 | glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); | 
|---|
| 78 | this->getAbsDir().matrix (matrix); | 
|---|
| 79 | glMultMatrixf((float*)matrix); | 
|---|
| 80 | this->model->draw(); | 
|---|
| 81 |  | 
|---|
| 82 | glPopMatrix(); | 
|---|
| 83 | } | 
|---|
| 84 |  | 
|---|