Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/bsp_entity.cc @ 8685

Last change on this file since 8685 was 8490, checked in by patrick, 18 years ago

merged the bsp branche back to trunk

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