Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/space_ships/collision_probe.cc @ 8490

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

merged the bsp branche back to trunk

File size: 2.1 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: Patrick Boenzli
13*/
14
15#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
16
17
18#include "collision_probe.h"
19
20#include "util/loading/factory.h"
21#include "util/loading/load_param.h"
22
23#include "md2/md2Model.h"
24
25
26using namespace std;
27
28CREATE_FACTORY(CollisionProbe, CL_COLLISION_PROBE);
29
30
31/**
32 *  destructs the spaceship, deletes alocated memory
33 */
34CollisionProbe::~CollisionProbe ()
35{}
36
37
38/**
39 *  creates a new Spaceship from Xml Data
40 * @param root the xml element containing spaceship data
41
42   @todo add more parameters to load
43*/
44CollisionProbe::CollisionProbe(const TiXmlElement* root)
45{
46  this->init();
47
48  if (root != NULL)
49    this->loadParams(root);
50}
51
52
53/**
54 * initializes a Spaceship
55 */
56void CollisionProbe::init()
57{
58  this->setClassID(CL_COLLISION_PROBE, "CollisionProbe");
59
60  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
61
62  this->setHealthMax(100);
63  this->setHealth(80);
64
65  this->toList(OM_GROUP_00);
66  this->loadMD2Texture("maps/dr_freak.pcx");
67  this->loadModel("models/dr_freak.md2");
68
69  this->localVelocity = Vector(0,-4,0);
70}
71
72
73/**
74 * loads the Settings of a CollisionProbe from an XML-element.
75 * @param root the XML-element to load the Spaceship's properties from
76 */
77void CollisionProbe::loadParams(const TiXmlElement* root)
78{
79  Playable::loadParams(root);
80}
81
82
83
84/**
85 *  draws the spaceship after transforming it.
86*/
87void CollisionProbe::draw () const
88{
89  WorldEntity::draw();
90}
91
92
93/**
94 *  the function called for each passing timeSnap
95 * @param time The timespan passed since last update
96 */
97void CollisionProbe::tick (float time)
98{
99  if( likely(this->getModel(0) != NULL))
100    ((MD2Model*)this->getModel(0))->tick(time);
101
102  this->shiftCoor(this->localVelocity * time);
103}
104
105
106/**
107 * @todo switch statement ??
108 */
109void CollisionProbe::process(const Event &event)
110{
111
112}
113
114
115
116
Note: See TracBrowser for help on using the repository browser.