| [4838] | 1 | /* |
|---|
| [1853] | 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. |
|---|
| [1855] | 10 | |
|---|
| 11 | ### File Specific: |
|---|
| [3761] | 12 | main-programmer: ... |
|---|
| [1855] | 13 | co-programmer: ... |
|---|
| [1853] | 14 | */ |
|---|
| 15 | |
|---|
| [3761] | 16 | #include "proto_world_entity.h" |
|---|
| [1853] | 17 | |
|---|
| [1856] | 18 | using namespace std; |
|---|
| [1853] | 19 | |
|---|
| [3559] | 20 | |
|---|
| [3564] | 21 | /** |
|---|
| [4838] | 22 | * constructs and loads a ProtoWorldEntity from a XML-element |
|---|
| 23 | * @param root the XML-element to load from |
|---|
| 24 | */ |
|---|
| [4483] | 25 | ProtoWorldEntity::ProtoWorldEntity(const TiXmlElement* root) |
|---|
| 26 | { |
|---|
| 27 | this->init(); |
|---|
| [4838] | 28 | if (root != NULL) |
|---|
| 29 | this->loadParams(root); |
|---|
| [4483] | 30 | } |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | /** |
|---|
| [4838] | 34 | * standard deconstructor |
|---|
| 35 | */ |
|---|
| 36 | ProtoWorldEntity::~ProtoWorldEntity () |
|---|
| [3566] | 37 | { |
|---|
| 38 | |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| [5509] | 41 | |
|---|
| [3762] | 42 | /** |
|---|
| [4838] | 43 | * initializes the ProtoWorldEntity |
|---|
| 44 | * @todo change this to what you wish |
|---|
| 45 | */ |
|---|
| [5509] | 46 | void ProtoWorldEntity::init() |
|---|
| [4483] | 47 | { |
|---|
| [5509] | 48 | this->setClassID(CL_PROTO_WORLD_ENTITY, "ProtoWorldEntity"); |
|---|
| 49 | |
|---|
| 50 | /** |
|---|
| 51 | * @todo: Write CL_PROTO_WORLD_ENTITY INTO THE src/defs/class_id.h (your own definition) |
|---|
| 52 | */ |
|---|
| 53 | |
|---|
| [4483] | 54 | } |
|---|
| 55 | |
|---|
| [5509] | 56 | |
|---|
| [4483] | 57 | /** |
|---|
| [4838] | 58 | * loads a ProtoWorldEntity from a XML-element |
|---|
| 59 | * @param root the XML-element to load from |
|---|
| 60 | * @todo make the class Loadable |
|---|
| 61 | */ |
|---|
| [4483] | 62 | void ProtoWorldEntity::loadParams(const TiXmlElement* root) |
|---|
| 63 | { |
|---|
| [4838] | 64 | // all the clases this Entity is directly derived from must be called in this way, to load all settings. |
|---|
| [4483] | 65 | static_cast<WorldEntity*>(this)->loadParam(root); |
|---|
| 66 | |
|---|
| [5509] | 67 | |
|---|
| 68 | /** |
|---|
| 69 | * @todo: make the class Loadable |
|---|
| 70 | */ |
|---|
| [4483] | 71 | } |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | /** |
|---|
| [4838] | 75 | * advances the ProtoWorldEntity about time seconds |
|---|
| 76 | * @param time the Time to step |
|---|
| 77 | */ |
|---|
| [3762] | 78 | ProtoWorldEntity::tick(float time) |
|---|
| 79 | { |
|---|
| [1853] | 80 | |
|---|
| [3762] | 81 | } |
|---|
| 82 | |
|---|
| [3245] | 83 | /** |
|---|
| [4838] | 84 | * draws this worldEntity |
|---|
| 85 | */ |
|---|
| [5509] | 86 | void ProtoWorldEntity::draw () const |
|---|
| [4838] | 87 | { |
|---|
| [3559] | 88 | glMatrixMode(GL_MODELVIEW); |
|---|
| 89 | glPushMatrix(); |
|---|
| 90 | float matrix[4][4]; |
|---|
| [4838] | 91 | |
|---|
| [3559] | 92 | /* translate */ |
|---|
| [4838] | 93 | glTranslatef (this->getAbsCoor ().x, |
|---|
| 94 | this->getAbsCoor ().y, |
|---|
| 95 | this->getAbsCoor ().z); |
|---|
| [3559] | 96 | /* rotate */ |
|---|
| [3761] | 97 | this->getAbsDir().matrix(matrix); |
|---|
| [3559] | 98 | glMultMatrixf((float*)matrix); |
|---|
| 99 | |
|---|
| [3761] | 100 | if (model) |
|---|
| [3566] | 101 | model->draw(); |
|---|
| [3559] | 102 | glPopMatrix(); |
|---|
| 103 | } |
|---|
| [5509] | 104 | |
|---|
| 105 | |
|---|
| 106 | /** |
|---|
| 107 | * |
|---|
| 108 | * |
|---|
| 109 | */ |
|---|
| 110 | void ProtoWorldEntity::collidesWith (WorldEntity* entity, const Vector& location) |
|---|
| 111 | { |
|---|
| 112 | |
|---|
| 113 | } |
|---|