/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Claudio Botta co-programmer: ... */ #include "bsp_entity.h" #include "util/loading/resource_manager.h" CREATE_FACTORY(BspEntity, CL_BSP_ENTITY); /** * constructs and loads a BspEntity from a XML-element * @param root the XML-element to load from */ BspEntity::BspEntity(const TiXmlElement* root) { this->init(); if (root != NULL) this->loadParams(root); } /** * standard deconstructor */ BspEntity::~BspEntity () { if( this->bspManager) delete this->bspManager; } /** * initializes the BspEntity * @todo change this to what you wish */ void BspEntity::init() { this->setClassID(CL_BSP_ENTITY, "BspEntity"); this->bspManager = new BspManager(this); this->toList(OM_ENVIRON); /** * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition) */ } void BspEntity::setName(const std::string& name) { PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str()); this->bspManager->load(name.c_str(), 0.1f); } /** * loads a BspEntity from a XML-element * @param root the XML-element to load from * @todo make the class Loadable */ void BspEntity::loadParams(const TiXmlElement* root) { // all the clases this Entity is directly derived from must be called in this way, to load all settings. // WorldEntity::loadParam(root); LoadParam(root, "Name", this, BspEntity, setName) .describe("Sets the of the BSP file."); /* LoadParam(root, "Scale", this, BSpEntity, setScale) .describe("Sets the scale factore of the bsp level."); */ /** * @todo: make the class Loadable */ } /** * advances the BspEntity about time seconds * @param time the Time to step */ void BspEntity::tick(float time) { this->bspManager->tick(time); } /** * draws this worldEntity */ void BspEntity::draw () const { this->bspManager->draw(); } /** * * */ void BspEntity::collidesWith (WorldEntity* entity, const Vector& location) { }