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