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