[3618] | 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: |
---|
[3631] | 16 | |
---|
| 17 | |
---|
| 18 | \todo: direction in which the projectile flights |
---|
| 19 | \todo: a target to set/hit |
---|
[3618] | 20 | */ |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | #include "test_gun.h" |
---|
| 24 | |
---|
| 25 | #include "stdincl.h" |
---|
| 26 | #include "world_entity.h" |
---|
| 27 | #include "objModel.h" |
---|
| 28 | #include "projectile.h" |
---|
| 29 | |
---|
| 30 | #include "vector.h" |
---|
[3629] | 31 | #include "list.h" |
---|
[3618] | 32 | |
---|
| 33 | using namespace std; |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | /** |
---|
| 37 | \brief standard constructor |
---|
| 38 | |
---|
| 39 | creates a new weapon |
---|
| 40 | */ |
---|
[3631] | 41 | TestGun::TestGun (PNode* parent, Vector* coordinate, Quaternion* direction) |
---|
| 42 | : Weapon (parent, coordinate, direction) |
---|
[3618] | 43 | {} |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | /** |
---|
| 47 | \brief standard deconstructor |
---|
| 48 | */ |
---|
| 49 | TestGun::~TestGun () |
---|
| 50 | { |
---|
| 51 | // model will be deleted from WorldEntity-destructor |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | /** |
---|
| 56 | \brief this activates the weapon |
---|
| 57 | |
---|
| 58 | This is needed, since there can be more than one weapon on a ship. the |
---|
| 59 | activation can be connected with an animation. for example the weapon is |
---|
| 60 | been armed out. |
---|
| 61 | */ |
---|
| 62 | void TestGun::activate() |
---|
| 63 | {} |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | /** |
---|
| 67 | \brief this deactivates the weapon |
---|
| 68 | |
---|
| 69 | This is needed, since there can be more than one weapon on a ship. the |
---|
| 70 | activation can be connected with an animation. for example the weapon is |
---|
| 71 | been armed out. |
---|
| 72 | */ |
---|
| 73 | void TestGun::deactivate() |
---|
| 74 | {} |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | /** |
---|
| 78 | \brief fires the weapon |
---|
| 79 | |
---|
| 80 | this is called from the player.cc, when fire-button is been pushed |
---|
| 81 | */ |
---|
| 82 | void TestGun::fire() |
---|
[3620] | 83 | { |
---|
| 84 | printf("TestGun::fire() - firing weapon now ---------------------------\n"); |
---|
[3632] | 85 | Projectile* pj = new Projectile(); |
---|
| 86 | Vector* v = new Vector(); |
---|
| 87 | *v = this->getAbsCoor(); |
---|
| 88 | pj->setAbsCoor(v); |
---|
| 89 | Quaternion* q = new Quaternion(); |
---|
| 90 | *q = this->getAbsDir(); |
---|
| 91 | pj->setAbsDir(q); |
---|
| 92 | |
---|
| 93 | pj->setFlightDirection(q); |
---|
| 94 | |
---|
[3646] | 95 | printf("TestGun::current speed is: %f", this->getSpeed()); |
---|
| 96 | |
---|
[3631] | 97 | this->worldEntities->add(pj); |
---|
[3620] | 98 | } |
---|
[3618] | 99 | |
---|
| 100 | |
---|
| 101 | /** |
---|
| 102 | \brief is called, when the weapon gets hit (=collide with something) |
---|
| 103 | \param from which entity it is been hit |
---|
| 104 | \param where it is been hit |
---|
| 105 | |
---|
| 106 | this may not be used, since it would make the game relay complicated when one |
---|
| 107 | can destroy the weapons of enemies or vice versa. |
---|
| 108 | */ |
---|
| 109 | void TestGun::hit (WorldEntity* entity, Vector* position) |
---|
| 110 | {} |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | /** |
---|
| 114 | \brief is called, when the weapon is destroyed |
---|
| 115 | |
---|
| 116 | this is in conjunction with the hit function, so when a weapon is able to get |
---|
| 117 | hit, it can also be destoryed. |
---|
| 118 | */ |
---|
| 119 | void TestGun::destroy () |
---|
| 120 | {} |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | /** |
---|
| 124 | \brief tick signal for time dependent/driven stuff |
---|
| 125 | */ |
---|
| 126 | void TestGun::tick (float time) |
---|
| 127 | {} |
---|
| 128 | |
---|
| 129 | |
---|
| 130 | /** |
---|
| 131 | \brief is called, when there is no fire button pressed |
---|
| 132 | */ |
---|
| 133 | void TestGun::weaponIdle() |
---|
| 134 | {} |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | /** |
---|
| 138 | \brief this will draw the weapon |
---|
| 139 | */ |
---|
| 140 | void TestGun::draw () |
---|
| 141 | {} |
---|
| 142 | |
---|