/* 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: Patrick Boenzli patrick@orxonox.net co-programmer: */ #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY #include "executor/executor.h" #include "util/loading/factory.h" #include "util/loading/load_param.h" #include "mount_point.h" #include "debug.h" #include "state.h" ObjectListDefinition(MountPoint); CREATE_FACTORY(MountPoint); /** * construct */ MountPoint::MountPoint (const Vector& up, const Vector& forward, const Vector& center, const std::string& name) { PRINTF(0)("Created mount point %s\n", name.c_str()); this->_name = name; this->setAbsCoor( center); this->setAbsDir( Quaternion(forward, up)); this->init(); } /** * deconstructor */ MountPoint::~MountPoint () {} /** * initializing function */ void MountPoint::init() { this->registerObject(this, MountPoint::_objectList); this->toList(OM_GROUP_00); this->_mount = NULL; } /** * loads the Settings of a MD2Creature from an XML-element. * @param root the XML-element to load the MD2Creature's properties from */ void MountPoint::initMountPoint(const TiXmlElement* root) { const TiXmlElement* element = root->FirstChildElement("MountPoints"); if( element == NULL) { PRINTF(1)("Object Information file is missing a proper 'MountPoints' section\n"); } else { element = element->FirstChildElement(); // parse the information for this mount point PRINTF(4)("Loading WorldEntities\n"); while( element != NULL) { BaseObject* created = Factory::fabricate(element); if( created != NULL ) PRINTF(4)("Created a %s: %s\n", created->getClassCName(), created->getCName()); //todo do this more elegant if( element->Value() == "SkyBox" && created->isA(SkyBox::staticClassID())) { this->sky = dynamic_cast(created); State::setSkyBox(dynamic_cast(this->sky)); } if( element->Value() == "Terrain" && created->isA(Terrain::staticClassID())) { this->terrain = dynamic_cast(created); CDEngine::getInstance()->setTerrain(terrain); } element = element->NextSiblingElement(); this->glmis->step(); //! @todo temporary } PRINTF(4)("Done loading WorldEntities\n"); } } /** * tick * @param time time passed since the last tick */ void MountPoint::tick (float time) { } /** * draw this entity */ void MountPoint::draw() const { } /** * function called to draw the mount point itself for debug purposes only */ void MountPoint::debugDraw() const { // invoke the underlying pnode debug draw this->debugDraw(); } /** * adds an entity to this mount point * @param entity entity to be added */ void MountPoint::mount(WorldEntity* entity) { this->_mount = entity; } /** * removes an entity from this mount point */ void MountPoint::unmount() { this->_mount = NULL; }