[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: |
---|
[8490] | 12 | main-programmer: Claudio Botta |
---|
[1855] | 13 | co-programmer: ... |
---|
[1853] | 14 | */ |
---|
| 15 | |
---|
[8081] | 16 | #include "bsp_entity.h" |
---|
| 17 | #include "util/loading/resource_manager.h" |
---|
[1853] | 18 | |
---|
[8490] | 19 | CREATE_FACTORY(BspEntity, CL_BSP_ENTITY); |
---|
[8087] | 20 | |
---|
| 21 | |
---|
[3564] | 22 | /** |
---|
[8490] | 23 | * constructs and loads a BspEntity from a XML-element |
---|
[4838] | 24 | * @param root the XML-element to load from |
---|
| 25 | */ |
---|
[8490] | 26 | BspEntity::BspEntity(const TiXmlElement* root) |
---|
[4483] | 27 | { |
---|
| 28 | this->init(); |
---|
[8490] | 29 | |
---|
[4838] | 30 | if (root != NULL) |
---|
| 31 | this->loadParams(root); |
---|
[4483] | 32 | } |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | /** |
---|
[4838] | 36 | * standard deconstructor |
---|
| 37 | */ |
---|
[8490] | 38 | BspEntity::~BspEntity () |
---|
[3566] | 39 | { |
---|
[8490] | 40 | if( this->bspManager) |
---|
| 41 | delete this->bspManager; |
---|
[3566] | 42 | } |
---|
| 43 | |
---|
[8087] | 44 | |
---|
[3762] | 45 | /** |
---|
[8490] | 46 | * initializes the BspEntity |
---|
[4838] | 47 | * @todo change this to what you wish |
---|
| 48 | */ |
---|
[8490] | 49 | void BspEntity::init() |
---|
[4483] | 50 | { |
---|
[8490] | 51 | this->setClassID(CL_BSP_ENTITY, "BspEntity"); |
---|
[5509] | 52 | |
---|
[8490] | 53 | this->bspManager = new BspManager(this); |
---|
[8081] | 54 | this->toList(OM_ENVIRON); |
---|
[8087] | 55 | |
---|
[5509] | 56 | /** |
---|
[8081] | 57 | * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition) |
---|
[5509] | 58 | */ |
---|
[8490] | 59 | } |
---|
[5509] | 60 | |
---|
[8490] | 61 | |
---|
| 62 | void BspEntity::setName(const std::string& name) |
---|
| 63 | { |
---|
| 64 | PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str()); |
---|
| 65 | |
---|
| 66 | this->bspManager->load(name.c_str(), 0.1f); |
---|
[4483] | 67 | } |
---|
| 68 | |
---|
[5509] | 69 | |
---|
[4483] | 70 | /** |
---|
[8490] | 71 | * loads a BspEntity from a XML-element |
---|
[4838] | 72 | * @param root the XML-element to load from |
---|
| 73 | * @todo make the class Loadable |
---|
| 74 | */ |
---|
[8490] | 75 | void BspEntity::loadParams(const TiXmlElement* root) |
---|
[4483] | 76 | { |
---|
[4838] | 77 | // all the clases this Entity is directly derived from must be called in this way, to load all settings. |
---|
[8081] | 78 | // WorldEntity::loadParam(root); |
---|
[8087] | 79 | |
---|
[8490] | 80 | LoadParam(root, "Name", this, BspEntity, setName) |
---|
[8081] | 81 | .describe("Sets the of the BSP file."); |
---|
[4483] | 82 | |
---|
[8081] | 83 | /* LoadParam(root, "Scale", this, BSpEntity, setScale) |
---|
| 84 | .describe("Sets the scale factore of the bsp level."); |
---|
| 85 | */ |
---|
[5509] | 86 | |
---|
| 87 | /** |
---|
| 88 | * @todo: make the class Loadable |
---|
| 89 | */ |
---|
[4483] | 90 | } |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | /** |
---|
[8490] | 94 | * advances the BspEntity about time seconds |
---|
[4838] | 95 | * @param time the Time to step |
---|
| 96 | */ |
---|
[8490] | 97 | void BspEntity::tick(float time) |
---|
[3762] | 98 | { |
---|
[8490] | 99 | this->bspManager->tick(time); |
---|
[3762] | 100 | } |
---|
| 101 | |
---|
[8081] | 102 | |
---|
[3245] | 103 | /** |
---|
[4838] | 104 | * draws this worldEntity |
---|
| 105 | */ |
---|
[8490] | 106 | void BspEntity::draw () const |
---|
[4838] | 107 | { |
---|
[8081] | 108 | this->bspManager->draw(); |
---|
[3559] | 109 | } |
---|
[5509] | 110 | |
---|
| 111 | |
---|
| 112 | /** |
---|
| 113 | * |
---|
| 114 | * |
---|
| 115 | */ |
---|
[8490] | 116 | void BspEntity::collidesWith (WorldEntity* entity, const Vector& location) |
---|
[5509] | 117 | { |
---|
| 118 | |
---|
| 119 | } |
---|