Changeset 4877 in orxonox.OLD for orxonox/branches/weaponSystem/src
- Timestamp:
- Jul 16, 2005, 10:38:04 PM (19 years ago)
- Location:
- orxonox/branches/weaponSystem/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/weaponSystem/src/story_entities/world.cc
r4872 r4877 841 841 while( entity != NULL ) 842 842 { 843 if( entity-> bDraw) entity->draw();843 if( entity->isVisible() ) entity->draw(); 844 844 //entity = this->entities->nextElement(); 845 845 entity = iterator->nextElement(); -
orxonox/branches/weaponSystem/src/util/loading/game_loader.cc
r4838 r4877 19 19 #include "campaign.h" 20 20 #include "world.h" 21 #include "player.h"22 21 #include "orxonox.h" 23 22 #include "camera.h" -
orxonox/branches/weaponSystem/src/util/loading/game_loader.h
r4836 r4877 1 1 /*! 2 \file game_loader.h3 2 * @file game_loader.h 3 * loads campaigns, worlds and all other story_entities 4 4 */ 5 5 … … 18 18 class Campaign; 19 19 class World; 20 class Camera;21 class CammandNode;22 20 class Factory; 23 21 class TiXmlElement; -
orxonox/branches/weaponSystem/src/world_entities/player.cc
r4836 r4877 23 23 24 24 #include "weapon_manager.h" 25 #include "weapon.h"26 25 #include "test_gun.h" 27 26 #include "world.h" 28 27 29 28 #include "list.h" 30 #include "stdincl.h"31 29 32 30 #include "event_handler.h" 33 31 34 #include "projectile.h"35 32 #include "event.h" 36 33 … … 41 38 42 39 /** 43 * 40 * creates a new Player 44 41 * @param isFree if the player is free 45 42 */ 46 43 Player::Player() 47 44 { 48 /*49 this is the debug player - actualy we would have to make a new50 class derivated from Player for each player. for now, we just use51 the player.cc for debug also52 */53 45 this->init(); 54 46 … … 75 67 delete this->weaponMan; 76 68 } 77 78 69 79 70 /** … … 119 110 120 111 /** 121 * 112 * loads the Settings of a Player from an XML-element. 122 113 * @param root the XML-element to load the Player's properties from 123 114 */ … … 132 123 133 124 /** 134 * 125 * adds a weapon to the weapon list of player 135 126 * @param weapon to add 136 127 */ … … 219 210 void Player::tick (float time) 220 211 { 221 //printf("%p\n", this);222 //this->getRelCoor().debug();223 224 /* link tick to weapon */225 //this->activeWeapon->tick(time);226 //this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE227 this->weaponMan->tick(time);228 212 // player controlled movement 229 213 this->move(time); 214 215 this->weaponMan->tick(time); 230 216 // weapon system manipulation 231 this->weapon ();217 this->weaponAction(); 232 218 } 233 219 … … 266 252 * weapon manipulation by the player 267 253 */ 268 void Player::weapon ()254 void Player::weaponAction() 269 255 { 270 256 if( this->bFire) … … 277 263 this->bWeaponChange = false; 278 264 } 279 }280 281 282 /**283 * The connection to the command node284 * @param cmd the Command unit from witch to map285 286 here the commands are mapped to the players movement/weaponary287 */288 void Player::command (Command* cmd)289 {290 PRINTF(3)("recieved command [%s]\n", cmd->cmd);291 if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_UP)) this->bUp = !cmd->bUp;292 if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_DOWN)) this->bDown = !cmd->bUp;293 if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_LEFT)) this->bLeft = !cmd->bUp;294 if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_RIGHT)) this->bRight = !cmd->bUp;295 if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_FIRE)) this->bFire = !cmd->bUp;296 if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_NEXT_WEAPON)) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange;297 265 } 298 266 -
orxonox/branches/weaponSystem/src/world_entities/player.h
r4836 r4877 1 1 /*! 2 \file player.h3 *Implements a basic controllable WorldEntity2 * @file player.h 3 * Implements a basic controllable WorldEntity 4 4 */ 5 5 … … 15 15 class WeaponManager; 16 16 class Vector; 17 class World;18 17 class Event; 19 class Crosshair;20 18 21 19 //! Basic controllable WorldEntity 20 /** 21 * this is the debug player - actualy we would have to make a new 22 class derivated from Player for each player. for now, we just use 23 the player.cc for debug also 24 */ 22 25 class Player : public WorldEntity, public PhysicsInterface, public EventListener 23 26 { … … 43 46 virtual void draw(); 44 47 45 virtual void command(Command* cmd);46 47 48 virtual void process(const Event &event); 48 49 … … 50 51 private: 51 52 void move(float time); 52 void weapon ();53 void weaponAction(); 53 54 54 55 55 56 private: 56 bool bUp;//!< up button pressed.57 bool bDown;//!< down button pressed.58 bool bLeft;//!< left button pressed.59 bool bRight;//!< right button pressed.60 bool bAscend;//!< ascend button pressed.61 bool bDescend;//!< descend button presses.62 bool bFire;//!< fire button pressed.63 bool bWeaponChange;//!< weapon change button pressed57 bool bUp; //!< up button pressed. 58 bool bDown; //!< down button pressed. 59 bool bLeft; //!< left button pressed. 60 bool bRight; //!< right button pressed. 61 bool bAscend; //!< ascend button pressed. 62 bool bDescend; //!< descend button presses. 63 bool bFire; //!< fire button pressed. 64 bool bWeaponChange; //!< weapon change button pressed 64 65 65 tList<Weapon>* weapons;//!< a list of weapon 66 Weapon* activeWeapon; //!< the weapon that is currenty activated 67 Weapon* activeWeaponL; //temporary -- FIX THIS 68 WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping 66 WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping 69 67 70 World* myWorld; //!< reference to the world object 71 72 Vector* velocity; //!< the velocity of the player. 73 float travelSpeed; //!< the current speed of the player (to make soft movement) 74 float acceleration; //!< the acceleration of the player. 75 76 Crosshair* crosshair; //!< the crosshair of the player 68 Vector* velocity; //!< the velocity of the player. 69 float travelSpeed; //!< the current speed of the player (to make soft movement) 70 float acceleration; //!< the acceleration of the player. 77 71 }; 78 72 -
orxonox/branches/weaponSystem/src/world_entities/world_entity.cc
r4836 r4877 38 38 this->loadParams(root); 39 39 40 this-> bDraw = true;40 this->setVisibiliy(true); 41 41 } 42 42 … … 111 111 */ 112 112 113 114 /**115 * process draw function116 */117 void WorldEntity::processDraw ()118 {119 120 }121 122 /**123 * sets the drawable state of this entity.124 * @param bDraw TRUE if draweable, FALSE otherwise125 */126 void WorldEntity::setDrawable (bool bDraw)127 {128 this->bDraw = bDraw;129 }130 131 132 113 /** 133 114 * this function is called, when two entities collide … … 183 164 { 184 165 } 185 186 166 187 167 /** … … 228 208 glPopMatrix(); 229 209 } 230 231 /**232 * this handles incoming command messages233 * @param cmd: a pointer to the incoming Command structure234 235 Put all code that handles Command messages here, this will mainly be called by the assigned CommandNode but can also be used236 to send commands from one WorldEntity to another.237 */238 void WorldEntity::command (Command* cmd)239 {240 } -
orxonox/branches/weaponSystem/src/world_entities/world_entity.h
r4836 r4877 26 26 class WorldEntity : public PNode 27 27 { 28 friend class World;29 30 28 public: 31 29 WorldEntity(const TiXmlElement* root = NULL); … … 35 33 void loadModel(const char* fileName); 36 34 37 //void setCollision (CollisionCluster* newhull);38 35 39 36 //void addAbility(Ability* ability); 40 37 //void removeAbility(Ability* ability); 41 void setDrawable (bool bDraw); 38 39 /** @param visibility if the Entity should be visible (been draw) */ 40 void setVisibiliy (bool visibility) { this->bVisible = visibility; }; 41 /** @returns true if the entity is visible, false otherwise */ 42 bool isVisible() const { return this->bVisible; }; 42 43 void setCharacterAttributes(CharacterAttributes* charAttr); 43 44 CharacterAttributes* getCharacterAttributes(); … … 48 49 virtual void hit (WorldEntity* weapon, Vector* loc); 49 50 virtual void collideWith (WorldEntity* entity); 50 virtual void command (Command* cmd);51 51 52 52 /** @returns the Count of Faces on this WorldEntity */ 53 53 virtual unsigned int getFaceCount () const { if (this->model) return this->model->getFaceCount(); else return 0; }; 54 54 55 void processDraw ();56 55 virtual void draw (); 57 56 void drawBVTree(int depth, int drawMode); … … 59 58 60 59 protected: 61 Model* model;//!< The model that should be loaded for this entity.62 CharacterAttributes* charAttr;//!< the character attributes of a world_entity63 BVTree* obbTree;//!< this is the obb tree reference needed for collision detection60 Model* model; //!< The model that should be loaded for this entity. 61 CharacterAttributes* charAttr; //!< the character attributes of a world_entity 62 BVTree* obbTree; //!< this is the obb tree reference needed for collision detection 64 63 65 64 private: 66 bool bCollide; //!< If it should be considered for the collisiontest. 67 bool bDraw; //!< If it should be visible. 68 69 70 71 //CollisionCluster* collisioncluster; //!< The collision-Cluster of this entity. 65 bool bCollide; //!< If it should be considered for the collisiontest. 66 bool bVisible; //!< If it should be visible. 72 67 }; 73 68
Note: See TracChangeset
for help on using the changeset viewer.