Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 23, 2007, 7:31:23 PM (18 years ago)
Author:
nicolasc
Message:

initial modularisation in spaceship config

Location:
branches/vs-enhencements/src/world_entities/space_ships
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc

    r10648 r10659  
    218218
    219219
    220 //   this->weaponMan.addWeapon( acid0, 3, 0);
    221 //   this->weaponMan.addWeapon( acid1, 3, 1);
    222 
    223 
    224220  this->secWeaponMan.addWeapon( cannon, 0, 2);
    225 //   this->secWeaponMan.addWeapon( spike, 1, 3);
    226 //   this->secWeaponMan.addWeapon( acid0, 2, 2);
    227 //   this->secWeaponMan.addWeapon( acid1, 2, 3);
    228 
    229221
    230222  this->weaponMan.changeWeaponConfig(3);
     
    232224
    233225
    234 //   curWeaponPrimary    = 3;
    235 //   curWeaponSecondary  = 0;
    236 
    237226  Playable::weaponConfigChanged();
    238227
    239   reactorOutput     = 10;
    240 
    241   weaponEnergyRegen = 10;       // 10 einheiten pro Sekunde
    242   engineSpeedBase   = 15;
    243   shieldRegen       = 2;
    244 
     228//   reactorOutput     = 10;
     229  setReactor(10);
     230//   weaponEnergyRegen = 10;       // 10 einheiten pro Sekunde
     231  setWeapon(10);
     232//   engineSpeedBase   = 15;
     233  setEngine(15);
     234//   shieldRegen       = 2;
     235/*
    245236  shieldEnergyShare = 0.3;
    246237  weaponEnergyShare = 0.3;
    247   engineEnergyShare = 0.4;
    248 
     238  engineEnergyShare = 0.4;*/
     239  setEnergyShare(.3,.3,.4);
     240/*
    249241  shieldCur         = 100;
    250242  shieldMax         = 100;
    251   shieldTH          = .2 * shieldMax;   // shield power must be 20% before shield kicks in again
    252 
     243  shieldTH          = .2 * shieldMax;   // shield power must be 20% before shield kicks in again*/
     244  setShield(100, 100, .2, 2);
     245/*
    253246  this->setHealth( 100);
    254   this->setHealthMax( 100);
    255 
     247  this->setHealthMax( 100);*/
     248  setArmor(100, 100);
     249/*
    256250  electronicCur = 50;
    257251  electronicMax = 50;
    258252  electronicRegen   = 3;
    259   electronicTH      = .7 * electronicMax; // 30% of eDamage can be handled by the ship
    260 
    261 
    262   this->loadModel("models/spaceships/fighter_redesign9.obj");
     253  electronicTH      = .7 * electronicMax; // 30% of eDamage can be handled by the ship*/
     254  setElectronic(50, 50, .7, 3.0);
     255
     256//   this->loadModel("models/spaceships/fighter_redesign9.obj");
    263257  //this->setVisibiliy(false);
    264258
    265259  bForward = bBackward = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = bFire = bSecFire = false;
    266260
    267   this->setHealthMax(shieldMax);
    268   this->setHealth(shieldCur);
     261//   this->setHealthMax(shieldMax);
     262//   this->setHealth(shieldCur);
    269263
    270264  this->travelNode = new PNode();
     
    405399//   this->trailL->setTexture( "textures/engine.png");
    406400//
    407 //   this->trailR = new Trail( 5, 10, .2, this);
     401//   this->trailR = new ( 5, 10, .2, this);
    408402//   this->trailR->setTexture( "textures/engine.png");
    409403
     
    437431
    438432  State::getCamera()->setViewMode(Camera::ViewTop);
     433
     434  LoadParam(root, "reactor", this, SpaceShip, setReactor);
     435  LoadParam(root, "shield", this, SpaceShip, setShield);
     436  LoadParam(root, "armor", this, SpaceShip, setArmor);
     437  LoadParam(root, "electronic", this, SpaceShip, setElectronic);
     438  LoadParam(root, "engine", this, SpaceShip, setEngine);
     439  LoadParam(root, "energyshare", this, SpaceShip, setEnergyShare);
     440  LoadParam(root, "weapon", this, SpaceShip, setWeapon);
     441
    439442}
    440443
  • branches/vs-enhencements/src/world_entities/space_ships/space_ship.h

    r10531 r10659  
    6363    inline WeaponManager& getWeaponManagerSecondary() { return this->secWeaponMan; };
    6464
     65    inline void setReactor(float output) {this->reactorOutput = output; };
     66    inline void setShield(float cur, float max, float th, float regen)
     67        { this->shieldCur = cur; this->shieldMax = max; this->shieldTH = th; this->shieldRegen = regen;};
     68    inline void setArmor(float cur, float max) { this->armorCur = cur; this->armorMax = max; updateHealth(); };
     69    inline void setElectronic(float cur, float max, float th, float regen)
     70        { this->electronicCur = cur; this->electronicMax = max; this->electronicTH = th; this->electronicRegen = regen; };
     71    inline void setEngine( float speedBase) {this->engineSpeedBase = speedBase; };
     72    inline void setEnergyShare(float shield, float weapon, float engine)
     73        { float tmp = shield + weapon + engine; if (unlikely (tmp > 1)) { tmp = 1/tmp; }
     74          // dirty safty hack, prevents total share being bigger than 1!!
     75          this->shieldEnergyShare = shield * tmp;
     76          this->weaponEnergyShare = weapon * tmp;
     77          this->engineEnergyShare = engine * tmp; };
     78    inline void setWeapon(float regen) { this->weaponEnergyRegen = regen; };
     79
     80    //!< Resynchonizes armor with health in WE!!
     81    inline void updateHealth() { this->setHealth(this->armorCur); this->setHealthMax(this->armorMax); };
     82
    6583    //Functions for GUI
    6684    inline float getShieldCur() { return this->shieldCur; };        //!< returns current shield value
     
    86104    virtual void movement (float dt);
    87105
    88     //
     106
    89107
    90108    void nextWeaponConfig();
     
    92110
    93111    virtual void hit(float damage, WorldEntity* killer);
    94    
     112
    95113    void                  setCameraDistance(float dist);
    96114
     
    147165
    148166    float       reactorOutput;      //!< reactor output
    149     float       reactorCapacity;    //!< reactor capacity
     167//    float       reactorCapacity;    //!< reactor capacity
    150168
    151169    int         curWeaponPrimary;   //!< current primary weapon config
     
    208226
    209227    byte                  oldMask;            //!< used for synchronisation
    210 
     228/*
    211229    Trail*                trail;              //!< Burst trail
    212230    Trail*                trailL;              //!< Burst trail
    213231    Trail*                trailR;              //!< Burst trail
    214 
     232*/
    215233
    216234};
Note: See TracChangeset for help on using the changeset viewer.