Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3862 in orxonox.OLD for orxonox/trunk/src/world_entities/weapon.h


Ignore:
Timestamp:
Apr 18, 2005, 9:15:08 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: introducing weapon configuration and slots. some mechanisms to load (pre)defined weapon constellations and to use multiple guns at the same time. depending on the number of weapon slots a ship defines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/weapon.h

    r3685 r3862  
    1818     o shooting animation
    1919     
     20
     21     a player defines one or more weapon configurations. a player has got one to eight
     22     weapon slots: places where weapons can be attached to. a weapon configuration
     23     is a matching between weapons and slots.
     24     Since its clear how many weapons a player will have, there is no list of weapons:
     25     its hard coded and limited to 8 slots and 4 configs. More would be a waste of
     26     memory and time you need to customize and change to a weapon config...
    2027*/
    2128
     
    2633#include "world_entity.h"
    2734
     35#define W_MAX_SLOTS 8
     36#define W_MAX_CONFS 4
     37
    2838class Projectile;
     39class Weapon;
    2940
    3041typedef enum {
     
    3748} weaponSoundType;
    3849
     50//! this is an identifier for the slot. there are up to 8 weapon slots -> this means there can't be more than 8 weapons at the same time
     51typedef enum slotID {W_SLOT0=0, W_SLOT1, W_SLOT2, W_SLOT3,
     52                     W_SLOT4, W_SLOT5, W_SLOT6, W_SLOT7};
     53
     54//! this is an identifier for the weapon config
     55typedef enum configID {W_CONFIG0=0, W_CONFIG1,
     56                       W_CONFIG2, W_CONFIG3};
     57
     58//! this is a weapon Configuration: it has up to 8 slots
     59typedef struct weaponConfig {
     60  Weapon* slot1;                    //<! standard right side weapon
     61  Weapon* slot2;                    //<! standard left side weapon
     62  Weapon* slot3;                    //<! custom
     63  Weapon* slot4;                    //<! custom
     64  Weapon* slot5;                    //<! custom
     65  Weapon* slot6;                    //<! custom
     66  Weapon* slot7;                    //<! custom
     67  Weapon* slot8;                    //<! custom
     68};
     69
     70
     71class WeaponManager {
     72 public:
     73  WeaponManager(int nrOfSlots = 2);
     74  ~WeaponManager();
     75 
     76  void addWeapon(Weapon* weapon, slotID slot, configID config = W_CONFIG0);
     77  void addWeaponConfig(weaponConfig* config);
     78
     79  void nextWeaponConf();
     80  void prevWeaponConf();
     81  void selectConfig(configID config);
     82
     83 private:
     84  int nrOfConfigs;                      //<! number of configurations defined
     85  int nrOfSlots;                        //<! number of weapon slots a ship has
     86  weaponConfig* currentConfig;          //<! the currently selected config
     87  weaponConfig* configs[4];             //<! a list of four configurations
     88};
    3989
    4090class Weapon : public WorldEntity
Note: See TracChangeset for help on using the changeset viewer.