1 | |
---|
2 | |
---|
3 | /* |
---|
4 | orxonox - the future of 3D-vertical-scrollers |
---|
5 | |
---|
6 | Copyright (C) 2004 orx |
---|
7 | |
---|
8 | This program is free software; you can redistribute it and/or modify |
---|
9 | it under the terms of the GNU General Public License as published by |
---|
10 | the Free Software Foundation; either version 2, or (at your option) |
---|
11 | any later version. |
---|
12 | |
---|
13 | ### File Specific |
---|
14 | main-programmer: Patrick Boenzli |
---|
15 | co-programmer: |
---|
16 | */ |
---|
17 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY |
---|
18 | |
---|
19 | |
---|
20 | #include "executor/executor.h" |
---|
21 | #include "factory.h" |
---|
22 | #include "load_param.h" |
---|
23 | |
---|
24 | #include "test_entity.h" |
---|
25 | #include "stdincl.h" |
---|
26 | #include "model.h" |
---|
27 | #include "md2Model.h" |
---|
28 | #include "obb_tree.h" |
---|
29 | #include "state.h" |
---|
30 | |
---|
31 | using namespace std; |
---|
32 | |
---|
33 | |
---|
34 | CREATE_FACTORY(TestEntity, CL_TEST_ENTITY); |
---|
35 | |
---|
36 | |
---|
37 | TestEntity::TestEntity () |
---|
38 | { |
---|
39 | this->init(); |
---|
40 | this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx"); |
---|
41 | } |
---|
42 | |
---|
43 | |
---|
44 | // this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx"); |
---|
45 | // this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp"); |
---|
46 | // this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices); |
---|
47 | |
---|
48 | |
---|
49 | TestEntity::TestEntity(const TiXmlElement* root) |
---|
50 | { |
---|
51 | this->init(); |
---|
52 | if (root != NULL) |
---|
53 | this->loadParams(root); |
---|
54 | } |
---|
55 | |
---|
56 | |
---|
57 | TestEntity::~TestEntity () |
---|
58 | {} |
---|
59 | |
---|
60 | |
---|
61 | |
---|
62 | void TestEntity::init() |
---|
63 | { |
---|
64 | this->setClassID(CL_TEST_ENTITY, "TestEntity"); |
---|
65 | this->toList(OM_COMMON); |
---|
66 | } |
---|
67 | |
---|
68 | /** |
---|
69 | * loads the Settings of a MD2Creature from an XML-element. |
---|
70 | * @param root the XML-element to load the MD2Creature's properties from |
---|
71 | */ |
---|
72 | void TestEntity::loadParams(const TiXmlElement* root) |
---|
73 | { |
---|
74 | WorldEntity::loadParams(root); |
---|
75 | |
---|
76 | LoadParam(root, "md2animation", this, TestEntity, setAnim) |
---|
77 | .describe("sets the animation of the md2 model") |
---|
78 | .defaultValues(1, 1); |
---|
79 | |
---|
80 | } |
---|
81 | |
---|
82 | |
---|
83 | void TestEntity::setAnim(int animationIndex) |
---|
84 | { |
---|
85 | if( likely(this->getModel(0) != NULL)) |
---|
86 | ((MD2Model*)this->getModel(0))->setAnim(animationIndex); |
---|
87 | } |
---|
88 | |
---|
89 | |
---|
90 | void TestEntity::tick (float time) |
---|
91 | { |
---|
92 | if( likely(this->getModel(0) != NULL)) |
---|
93 | ((MD2Model*)this->getModel(0))->tick(time); |
---|
94 | |
---|
95 | } |
---|
96 | |
---|
97 | |
---|
98 | void TestEntity::collidesWith(WorldEntity* entity, const Vector& location) |
---|
99 | {} |
---|
100 | |
---|
101 | |
---|