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