Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/single_player_map/src/world_entities/bsp_entity.cc @ 9047

Last change on this file since 9047 was 9003, checked in by bensch, 18 years ago

orxonox/trunk: merged the single_player_map branche back
merged with command:
svn merge -r8896:HEAD https://svn.orxonox.net/orxonox/branches/single_player_map .
no conflicts

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