Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/test_entity.cc @ 5115

Last change on this file since 5115 was 5115, checked in by bensch, 19 years ago

orxonox/trunk: reimplemented the list functions, as i did before in revision 5110.
This time, i looked out for the bugs, and i think i found one

@patrick: i know, that you do not want to code at the moment… :/ → see mail

File size: 2.1 KB
Line 
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
18
19#include "test_entity.h"
20#include "stdincl.h"
21#include "model.h"
22#include "md2Model.h"
23#include "obb_tree.h"
24#include "state.h"
25#include "list.h"
26
27using namespace std;
28
29
30
31TestEntity::TestEntity ()
32{
33  this->setClassID(CL_TEST_ENTITY, "TestEntity");
34
35  this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx");
36//   this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx");
37// this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp");
38  this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
39
40  this->md2Model->setAnim(RUN);
41  this->md2Model->debug();
42}
43
44
45TestEntity::~TestEntity ()
46{
47  delete this->md2Model;
48  this->obbTree = NULL;
49}
50
51
52void  TestEntity::setAnim(int animationIndex)
53{
54  this->md2Model->setAnim(animationIndex);
55}
56
57
58void TestEntity::tick (float time)
59{
60  this->md2Model->tick(time);
61}
62
63
64void TestEntity::collidesWith(WorldEntity* entity, const Vector& location)
65{
66  if (entity->isA(CL_PROJECTILE))
67  {
68    PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);
69  this->setVisibiliy(false);
70  State::getWorldEntityList()->remove(this);
71  }
72}
73
74void TestEntity::hit (WorldEntity* weapon, Vector* loc) {}
75
76
77void TestEntity::destroy () {}
78
79
80void TestEntity::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
81
82
83void TestEntity::draw ()
84{
85  glMatrixMode(GL_MODELVIEW);
86  glPushMatrix();
87  float matrix[4][4];
88
89
90  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
91  this->getAbsDir().matrix (matrix);
92  glMultMatrixf((float*)matrix);
93  this->md2Model->draw();
94
95
96  glPopMatrix();
97}
98
Note: See TracBrowser for help on using the repository browser.