[4592] | 1 | /* |
---|
[3471] | 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: |
---|
[5841] | 12 | main-programmer: Silvan Nellen |
---|
| 13 | co-programmer: Benjamin Knecht |
---|
[3471] | 14 | */ |
---|
| 15 | |
---|
[5635] | 16 | #include "executor/executor.h" |
---|
[3471] | 17 | #include "player.h" |
---|
[3596] | 18 | |
---|
[3620] | 19 | #include "track_manager.h" |
---|
[3484] | 20 | #include "objModel.h" |
---|
[3655] | 21 | #include "resource_manager.h" |
---|
[5355] | 22 | #include "factory.h" |
---|
[4826] | 23 | |
---|
[5556] | 24 | #include "weapons/weapon_manager.h" |
---|
| 25 | #include "weapons/test_gun.h" |
---|
| 26 | #include "weapons/turret.h" |
---|
[5750] | 27 | #include "weapons/cannon.h" |
---|
[3471] | 28 | |
---|
[3620] | 29 | #include "list.h" |
---|
| 30 | |
---|
[4404] | 31 | #include "event_handler.h" |
---|
[4389] | 32 | |
---|
[4404] | 33 | #include "event.h" |
---|
[4287] | 34 | |
---|
[3471] | 35 | using namespace std; |
---|
| 36 | |
---|
[5750] | 37 | CREATE_FACTORY(Player, CL_PLAYER); |
---|
[4010] | 38 | |
---|
[3471] | 39 | /** |
---|
[4885] | 40 | * creates a new Player |
---|
[4836] | 41 | * @param isFree if the player is free |
---|
[3471] | 42 | */ |
---|
[4762] | 43 | Player::Player() |
---|
[3471] | 44 | { |
---|
[4780] | 45 | this->init(); |
---|
[3471] | 46 | } |
---|
| 47 | |
---|
[4975] | 48 | |
---|
[4010] | 49 | /** |
---|
[4975] | 50 | * destructs the player, deletes alocated memory |
---|
| 51 | */ |
---|
| 52 | Player::~Player () |
---|
| 53 | { |
---|
| 54 | } |
---|
| 55 | |
---|
[5453] | 56 | //#include "glgui_pushbutton.h" |
---|
[5395] | 57 | |
---|
[4975] | 58 | /** |
---|
[4780] | 59 | * initializes a Player |
---|
| 60 | */ |
---|
| 61 | void Player::init() |
---|
| 62 | { |
---|
[5037] | 63 | // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); |
---|
[4780] | 64 | this->setClassID(CL_PLAYER, "Player"); |
---|
[5144] | 65 | |
---|
[5300] | 66 | PRINTF(4)("PLAYER INIT\n"); |
---|
[4834] | 67 | |
---|
[4780] | 68 | } |
---|
| 69 | |
---|
[5847] | 70 | /** |
---|
| 71 | * subscribe to all events because the player dosen't know to witch keys the controllable can react |
---|
| 72 | */ |
---|
[5840] | 73 | void Player::subscribeEvents() |
---|
| 74 | { |
---|
| 75 | //TODO: subscribe for all events!! |
---|
| 76 | } |
---|
[4780] | 77 | |
---|
[4404] | 78 | void Player::process(const Event &event) |
---|
| 79 | { |
---|
[5839] | 80 | this->controllable->process(event); |
---|
[4404] | 81 | } |
---|
[5435] | 82 | |
---|
[5847] | 83 | |
---|
[5840] | 84 | void Player::setControllable(Playable controllalble) |
---|
| 85 | { |
---|
| 86 | this->controllable = controllable; |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | |
---|
[5847] | 90 | |
---|
[5841] | 91 | Playable* Player::getControllable() |
---|
[5840] | 92 | { |
---|
| 93 | return controllable; |
---|
| 94 | } |
---|
| 95 | |
---|