Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/playability/src/world_entities/space_ships/space_ship.cc @ 10237

Last change on this file since 10237 was 10237, checked in by muellmic, 17 years ago

changed camera handling for the vertical-scroller playmode. the top-down view in vertical scroller is now a proper camera-viewmode. also added a bool-state in the camera class to override the camera's event-listener and handle the camera-events (view buttons) in other classes. i used this to handle the camera parenting with the space-ship class, so other views as the top-down get useful and nice-looking again…. *taking-a-look-at-the-watch* oops damnit… i hope i won't forget the last tram ;-)

File size: 34.2 KB
RevLine 
[6868]1/*
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:
12   main-programmer: Benjamin Knecht
13   co-programmer: Silvan Nellen
14
15*/
16
17#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
18
19#include "executor/executor.h"
20#include "space_ship.h"
21
[7193]22#include "util/loading/resource_manager.h"
[6868]23
24#include "weapons/test_gun.h"
[9970]25#include "weapons/light_blaster.h"
26#include "weapons/medium_blaster.h"
27#include "weapons/heavy_blaster.h"
[10023]28#include "weapons/swarm_launcher.h"
[10170]29#include "weapons/spike_launcher.h"
[10196]30#include "weapons/spike_thrower.h"
[9970]31#include "weapons/boomerang_gun.h"
[6868]32#include "weapons/turret.h"
33#include "weapons/cannon.h"
34
[10120]35#include "elements/glgui_energywidgetvertical.h"
[10230]36#include "glgui_bar.h"
[10120]37
[9869]38#include "particles/dot_emitter.h"
[10073]39#include "particles/emitter_node.h"
[9869]40#include "particles/sprite_particles.h"
[10081]41#include "effects/trail.h"
[6868]42
[10154]43#include "effects/wobblegrid.h"
44
[7193]45#include "util/loading/factory.h"
[6868]46#include "key_mapper.h"
47
48#include "network_game_manager.h"
[8708]49#include "shared_network_data.h"
[6868]50
51#include "power_ups/weapon_power_up.h"
52#include "power_ups/param_power_up.h"
53
54#include "graphics_engine.h"
55
56#include "plane.h"
57
58#include "state.h"
59#include "player.h"
[10237]60#include "camera.h"
[6868]61
[10113]62
[7193]63#include "util/loading/load_param.h"
[10020]64#include "time.h"
[6868]65
[10096]66#include "track/track.h"
[7056]67
[10096]68
[6868]69// #include "lib/gui/gl_gui/glgui_bar.h"
70// #include "lib/gui/gl_gui/glgui_pushbutton.h"
71
72
[9869]73#include "class_id_DEPRECATED.h"
74ObjectListDefinitionID(SpaceShip, CL_SPACE_SHIP);
75CREATE_FACTORY(SpaceShip);
[9406]76
[9061]77#include "script_class.h"
[9869]78CREATE_SCRIPTABLE_CLASS(SpaceShip,
79                        addMethod("hasPlayer", Executor0ret<Playable, lua_State*,bool>(&Playable::hasPlayer))
80                        ->addMethod("fire", Executor1<Playable, lua_State*, bool>(&Playable::fire))
81                        ->addMethod("loadModel", Executor2<WorldEntity, lua_State*,const std::string& ,float>(&WorldEntity::loadModel2))
82                        ->addMethod("setName", Executor1<BaseObject, lua_State*,const std::string&>(&BaseObject::setName))
83                        ->addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide))
84                        ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide))
85                        //Coordinates
86                        ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
87                        ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
88                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
89                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
[10017]90                        //->addMethod("setCameraSpeed", Executor1<SpaceShip, lua_State*, float>(&SpaceShip::setCameraSpeed))
[9061]91                       );
[6868]92
93/**
94 *  destructs the spaceship, deletes alocated memory
95 */
96SpaceShip::~SpaceShip ()
97{
[6986]98  this->setPlayer(NULL);
[6868]99}
100
101/**
102 * loads a Spaceships information from a specified file.
103 * @param fileName the name of the File to load the spaceship from (absolute path)
104 */
[7221]105SpaceShip::SpaceShip(const std::string& fileName)
[10019]106    : secWeaponMan(this) //,
107    //supportedPlaymodes(Playable::Vertical) ,
108    //playmode(Playable::Vertical)
[6868]109{
110  this->init();
111  TiXmlDocument doc(fileName);
112
113  if(!doc.LoadFile())
114  {
[7221]115    PRINTF(2)("Loading file %s failed for spaceship.\n", fileName.c_str());
[6868]116    return;
117  }
118
119  this->loadParams(doc.RootElement());
120}
121
122/**
123 *  creates a new Spaceship from Xml Data
124 * @param root the xml element containing spaceship data
125
126   @todo add more parameters to load
127*/
128SpaceShip::SpaceShip(const TiXmlElement* root)
[10019]129    : secWeaponMan(this) //,
130    //supportedPlaymodes(Playable::Vertical) ,
131    //playmode(Playable::Vertical)
[6868]132{
133  this->init();
[10081]134  //this->setParentMode(PNODE_REPARENT_DELETE_CHILDREN);
[6868]135  if (root != NULL)
136    this->loadParams(root);
137
138}
139
140
141/**
142 * initializes a Spaceship
143 */
144void SpaceShip::init()
145{
[9998]146
[10022]147  srand(time(0));   //initialize Random Nomber Generator
148
[9869]149  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
150  this->registerObject(this, SpaceShip::_objectList);
[6868]151  PRINTF(4)("SPACESHIP INIT\n");
[10121]152  this->weaponMan.setParentEntity( this);
[6868]153  //weapons:
[10098]154 
[9996]155  Weapon* wpRight1 = new LightBlaster ();
[10073]156  wpRight1->setName( "LightBlaster");
[10117]157  //wpRight1->setParent( this);
[9996]158  Weapon* wpLeft1 = new LightBlaster ();
[10073]159  wpLeft1->setName( "LightBlaster");
[10117]160  //wpLeft1->setParent( this);
[6868]161
[9996]162  Weapon* wpRight2 = new MediumBlaster ();
[10073]163  wpRight2->setName( "MediumBlaster");
[10117]164  //wpRight2->setParent( this);
[9996]165  Weapon* wpLeft2 = new MediumBlaster ();
[10073]166  wpLeft2->setName( "MediumBlaster");
[10117]167  //wpLeft2->setParent( this);
[10098]168 
[10152]169  Weapon* wpRight3 = new HeavyBlaster (1);
[10073]170  wpRight3->setName( "HeavyBlaster");
[10117]171  //wpRight3->setParent( this);
[10152]172  Weapon* wpLeft3 = new HeavyBlaster (0);
[10073]173  wpLeft3->setName( "HeavyBlaster");
[10117]174  //wpLeft3->setParent( this);
[9996]175
[10173]176  Weapon* cannon = new SwarmLauncher();
177  cannon->setName( "SwarmLauncher");
[6868]178
[10235]179//   Weapon* spike = new SpikeThrower();
180//   spike->setName( "SpikeThrower" );
[9961]181
[10224]182  Weapon* spike2 = new SpikeLauncher();
[10235]183  spike2->setName( "SpikeLauncher" );
[10196]184
[10098]185  this->weaponMan.addWeapon( wpLeft1, 0, 0);
186  this->weaponMan.addWeapon( wpRight1, 0, 1);
[9998]187
[10121]188  this->weaponMan.addWeapon( wpLeft2, 1, 2);
189  this->weaponMan.addWeapon( wpRight2, 1, 3);
[9961]190
[10121]191  this->weaponMan.addWeapon( wpLeft3, 2, 4);
192  this->weaponMan.addWeapon( wpRight3, 2, 5);
[10113]193
[10152]194  this->weaponMan.addWeapon( wpLeft1, 3, 0);
195  this->weaponMan.addWeapon( wpRight1, 3, 1);
196
197  this->weaponMan.addWeapon( wpLeft2, 3, 2);
198  this->weaponMan.addWeapon( wpRight2, 3, 3);
199
200  this->weaponMan.addWeapon( wpLeft3, 3, 4);
201  this->weaponMan.addWeapon( wpRight3, 3, 5);
202
[10121]203  this->secWeaponMan.addWeapon( cannon, 0, 0);
[10235]204/*  this->secWeaponMan.addWeapon( spike, 1, 1);*/
[10224]205  this->secWeaponMan.addWeapon( spike2, 2, 2);
[9998]206
[10113]207 
[10152]208  this->weaponMan.changeWeaponConfig(3);
[10235]209  this->secWeaponMan.changeWeaponConfig(2);
[10113]210
[10188]211  curWeaponPrimary    = 3;
[10224]212  curWeaponSecondary  = 2;
[9965]213
214  Playable::weaponConfigChanged();
215
[9970]216  reactorOutput     = 10;
[9965]217
[9970]218  weaponEnergyRegen = 10;       // 10 einheiten pro Sekunde
219  engineSpeedBase   = 5;
220  shieldRegen       = 2;
221
222  shieldEnergyShare = 0.3;
223  weaponEnergyShare = 0.3;
224  engineEnergyShare = 0.4;
225
226  shieldCur         = 20;
227  shieldMax         = 100;
[10020]228  shieldTH          = .2* shieldMax;   // shield power must be 20% before shield kicks in again
[9970]229
[10119]230  this->setHealth( 20);
231  this->setHealthMax( 100);
232
[10024]233  electronicCur = 50;
[10022]234  electronicMax = 50;
[10020]235  electronicRegen   = 3;
236  electronicTH      = .7 * electronicMax; // 30% of eDamage can be handled by the ship
237
[6868]238
[9970]239  this->loadModel("models/ships/mantawing.obj");
[10017]240  //this->setVisibiliy(false);
[6868]241
[10017]242  bForward = bBackward = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = bFire = bSecFire = false;
243 
[6868]244
[9970]245  this->setHealthMax(shieldMax);
246  this->setHealth(shieldCur);
[6868]247
[10017]248  this->travelNode = new PNode();
249
250  // camera - issue
251  this->cameraNode.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
252  this->cameraNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
253
[10120]254  // widget handling
[10139]255  /*
[10120]256  this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical();
257  this->electronicWidget->setDisplayedName(std::string(this->getClassName()) + " Electronics:");
258  this->electronicWidget->setSize2D(30,400);
259  this->electronicWidget->setAbsCoor2D(150,200);
260  this->electronicWidget->shiftDir2D(270);
261  this->updateElectronicWidget();
262  this->shieldWidget = new OrxGui::GLGuiEnergyWidgetVertical();
263  this->shieldWidget->setDisplayedName(std::string(this->getClassName()) + " Shield:");
264  this->shieldWidget->setSize2D(30,400);
265  this->shieldWidget->setAbsCoor2D(200,200);
266  this->shieldWidget->shiftDir2D(270);
267  this->updateShieldWidget();
268  if (this->hasPlayer())
269  {
270    State::getPlayer()->hud().setShiledWidget(this->shieldWidget);
271    State::getPlayer()->hud().setEnergyWidget(this->electronicWidget);
272  }
[10139]273  */
274  this->electronicWidget = NULL;
275  this->shieldWidget = NULL;
[6868]276
277  //add events to the eventlist
[6997]278  registerEvent(KeyMapper::PEV_FORWARD);
279  registerEvent(KeyMapper::PEV_BACKWARD);
[6868]280  registerEvent(KeyMapper::PEV_LEFT);
281  registerEvent(KeyMapper::PEV_RIGHT);
282  //registerEvent(SDLK_q);
283  //registerEvent(SDLK_e);
284  registerEvent(KeyMapper::PEV_FIRE1);
[9958]285  registerEvent(KeyMapper::PEV_FIRE2);                  // Added for secondary weapon support
[6868]286  registerEvent(KeyMapper::PEV_NEXT_WEAPON);
287  registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON);
288  //registerEvent(SDLK_PAGEUP);
289  //registerEvent(SDLK_PAGEDOWN);
290  registerEvent(EV_MOUSE_MOTION);
291
[10073]292  this->weaponMan.setParentEntity( this);
293  this->secWeaponMan.setParentEntity( this);
294
[9965]295  this->weaponMan.setSlotCount(6);
[6868]296
[10152]297  this->weaponMan.setSlotPosition(0, Vector(0.0, 0, -3.0));
[9965]298  this->weaponMan.setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
[6868]299
[10152]300  this->weaponMan.setSlotPosition(1, Vector(0.0, 0, 3.0));
[9965]301  this->weaponMan.setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
[6868]302
[10064]303  this->weaponMan.setSlotPosition(2, Vector(-1.5, 0, -.5));
[9965]304  this->weaponMan.setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
[6868]305
[10064]306  this->weaponMan.setSlotPosition(3, Vector(-1.5, 0, .5));
[9965]307  this->weaponMan.setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
[6868]308
[10133]309  this->weaponMan.setSlotPosition(4, Vector(1.5, 0, .5));
[9965]310  this->weaponMan.setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
[6868]311
[10133]312  this->weaponMan.setSlotPosition(5, Vector(1.5, 0, -.5));
[9965]313  this->weaponMan.setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
[9961]314
315  this->secWeaponMan.setSlotCount(6);
316
[10073]317  this->secWeaponMan.setSlotPosition(0, Vector(1.5, 0, 0));
[9961]318  this->secWeaponMan.setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
319
[10073]320  this->secWeaponMan.setSlotPosition(1, Vector(2.6, 0, 3.0));
[9961]321  this->secWeaponMan.setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
322
[10073]323  this->secWeaponMan.setSlotPosition(2, Vector(1.5, 0, -.5));
[9961]324  this->secWeaponMan.setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
325
[10073]326  this->secWeaponMan.setSlotPosition(3, Vector(1.5, 0, .5));
[9961]327  this->secWeaponMan.setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
328
[10073]329  this->secWeaponMan.setSlotPosition(4, Vector(1.5, 0, .5));
[9961]330  this->secWeaponMan.setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
331
[10073]332  this->secWeaponMan.setSlotPosition(5, Vector(1.5, 0, -.5));
[9961]333  this->secWeaponMan.setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
[9965]334
[6868]335
[9965]336  this->weaponMan.getFixedTarget()->setParent(this);
337  this->weaponMan.getFixedTarget()->setRelCoor(100000,0,0);
[10004]338
[9998]339 
[9961]340  this->secWeaponMan.getFixedTarget()->setParent(this);
341  this->secWeaponMan.getFixedTarget()->setRelCoor(100000,0,0);
[10004]342  this->secWeaponMan.setRotationSpeed(0);
[6868]343
[9965]344  dynamic_cast<Element2D*>(this->weaponMan.getFixedTarget())->setVisibility( false);
[9961]345
[6868]346
[10017]347  registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) );
348  registerVar( new SynchronizeableBool( &bBackward, &bBackward, "bBackward", PERMISSION_OWNER ) );
349  registerVar( new SynchronizeableBool( &bLeft, &bLeft, "bLeft", PERMISSION_OWNER ) );
350  registerVar( new SynchronizeableBool( &bRight, &bRight, "bRight", PERMISSION_OWNER ) );
351  registerVar( new SynchronizeableFloat( &cameraLook, &cameraLook, "cameraLook", PERMISSION_OWNER ) );
352  registerVar( new SynchronizeableFloat( &rotation, &rotation, "rotation", PERMISSION_OWNER ) );
[10023]353  registerVar( new SynchronizeableBool( &bFire, &bFire, "bSecFire", PERMISSION_OWNER));
[10017]354  registerVar( new SynchronizeableVector( &velocity, &velocity, "velocity", PERMISSION_MASTER_SERVER ) );
355
356  //this->airFriction = 0.5f;
[10019]357  this->travelDistancePlus = Vector2D(38.0, 43.0);
358  this->travelDistanceMinus = Vector2D(-38.0, -43.0);
[10017]359  this->cameraSpeed = 40;
[10019]360  this->cameraLook = 0.0f;
361  //this->airFriction = 0.0f;
[10017]362
[10020]363  srand(time(0));  //initaialize RNG
364
[10017]365  this->travelNode->debugDraw();
[10032]366
367  this->setSupportedPlaymodes(Playable::Horizontal | Playable::Vertical);
[10081]368
369 
[10156]370  this->trail = new Trail( 10, 10, .2, this);
[10095]371  //this->trail->setParent( this);
[10081]372  this->trail->setTexture( "maps/engine.png");
373
[10156]374  this->trailL = new Trail( 10, 10, .2, this);
[10095]375  //this->trailL->setParent( this);
[10081]376  this->trailL->setTexture( "maps/engine.png");
377
[10156]378  this->trailR = new Trail( 10, 10, .2, this);
[10095]379  //this->trailR->setParent( this);
[10081]380  this->trailR->setTexture( "maps/engine.png");
[10098]381
[10113]382
[10098]383  this->toList(OM_GROUP_00);
[10154]384
[10155]385  //FIXME Just testaddition to show the wobblegrid
[10156]386  this->test  = new Wobblegrid(5);
[10159]387  test->setTexture("maps/blub.png");
[10154]388 
389  test->setAbsCoor( this->getAbsCoor() + Vector(0, 2, 0));
390  test->setParent( this);
391 
[6868]392}
393
394
395/**
396 * loads the Settings of a SpaceShip from an XML-element.
397 * @param root the XML-element to load the Spaceship's properties from
398 */
399void SpaceShip::loadParams(const TiXmlElement* root)
400{
401  Playable::loadParams(root);
[10032]402
403  LoadParam(root, "playmode", this, SpaceShip, setPlaymodeXML);
[6868]404}
405
[10032]406
[10017]407void SpaceShip::setPlayDirection(const Quaternion& rot, float speed)
[7056]408{
[10032]409  //this->direction = Quaternion (rot.getHeading(), Vector(0,1,0));
[7056]410}
[6868]411
[7085]412void SpaceShip::reset()
413{
[10017]414  bForward = bBackward = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = bFire = bSecFire = false;
[7056]415
[10017]416  //xMouse = yMouse = 0;
[7085]417
418  this->setHealth(80);
419  this->velocity = Vector(0.0, 0.0, 0.0);
420}
421
422
[6868]423void SpaceShip::enter()
424{
[10004]425  this->secWeaponMan.showCrosshair();
[10095]426  this->toList( OM_GROUP_01 );
[10233]427  State::getPlayer()->hud().setOverlayActive(true);
[10194]428  //dynamic_cast <OrxGui::GLGuiEnergyWidgetVertical*> (State::getPlayer()->hud().getArmorWidget())->setDisplayedName("Armor");
[10004]429  //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( true);
[10019]430  //this->attachCamera();
[10032]431 // this->setPlaymode(Playable::Horizontal);
[6868]432}
433
434void SpaceShip::leave()
435{
[10004]436  this->secWeaponMan.hideCrosshair();
[10095]437  this->toList( OM_GROUP_00);
[10233]438  State::getPlayer()->hud().setOverlayActive(false);
[10237]439  State::getCamera()->setEventHandling(true);
[10004]440  //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( false);
[10019]441  //this->detachCamera();
[6868]442}
443
444
445/**
446 *  effect that occurs after the SpaceShip is spawned
447*/
448void SpaceShip::postSpawn ()
449{
450  //setCollision(new CollisionCluster(1.0, Vector(0,0,0)));
451}
452
453/**
454 *  the action occuring if the spaceship left the game
455*/
456void SpaceShip::leftWorld ()
[10073]457{
458
[10064]459}
[6868]460
461WorldEntity* ref = NULL;
462/**
463 *  this function is called, when two entities collide
464 * @param entity: the world entity with whom it collides
465 *
466 * Implement behaviour like damage application or other miscellaneous collision stuff in this function
467 */
468void SpaceShip::collidesWith(WorldEntity* entity, const Vector& location)
469{
470}
471
472/**
473 *  draws the spaceship after transforming it.
474*/
475void SpaceShip::draw () const
476{
477  WorldEntity::draw();
478
[10081]479  glMatrixMode(GL_MODELVIEW);
480  glPushMatrix();
481
482  float matrix[4][4];
483  glTranslatef (this->getAbsCoor ().x-1, this->getAbsCoor ().y-.2, this->getAbsCoor ().z);
484  this->getAbsDir().matrix (matrix);
485  glMultMatrixf((float*)matrix);
486  //glScalef(2.0, 2.0, 2.0);  // no double rescale
487 
488  this->trail->draw();
489 
490  glTranslatef(0,0,-.5);
491  this->trailL->draw();
492
493  glTranslatef(0,0,1);
494  this->trailR->draw();
495  glPopMatrix();
[6868]496  //this->debug(0);
497}
498
499/**
500 *  the function called for each passing timeSnap
501 * @param time The timespan passed since last update
502*/
503void SpaceShip::tick (float time)
504{
[9961]505  // Playable::tick(time);$
[10156]506  this->test->tick(time);
[9961]507  // Own Tick Setup, as a different fire routine is used on the weapon manager
[9965]508  this->weaponMan.tick(time);
[9961]509  this->secWeaponMan.tick(time);
510
[10020]511  if( this->systemFailure() )
512    bFire = bSecFire = false;
513
[10037]514  // fire reqeust/release for primary weapons
[9965]515  if( this->bFire)
516    this->weaponMan.fire();
[10036]517  else
518    this->weaponMan.releaseFire();
519
[10037]520  // fire reqeust/release for secondary weapons
[9961]521  if( this->bSecFire)
522    this->secWeaponMan.fire();
[10036]523  else
524    this->secWeaponMan.releaseFire();
[10096]525   
526  // Tracktick
527  if(this->entityTrack)
528    this->entityTrack->tick(time);
[9961]529
[9970]530
531  // Shield Regeneration and other regular calculations on the ship
532  this->regen(time);
533
534  // Weapon Regeneration and other regular calculations on the ship
[9965]535  this->weaponRegen(time);
536
[9970]537  // current engine speed output
538  this->engineSpeedCur = this->engineSpeedBase + this->reactorOutput * this->engineEnergyShare;
539
[10043]540  // calculation of maxSpeed and acceleration:
541  this->travelSpeed = this->engineSpeedCur * 5;
542  this->acceleration = this->travelSpeed * 2;
[9970]543
[10017]544  this->movement(time);
545
546   // TRYING TO FIX PNode.
547  this->cameraNode.setAbsCoorSoft(this->getAbsCoor() + Vector(0.0f, 5.0f, 0.0f), 30.0f);
548  this->cameraNode.setRelDirSoft(this->getAbsDir(), 30.0f);
549
[10095]550 
551  this->velocity  = (this->getAbsCoor() - this->oldPos) / time;
552  this->oldPos    = this->getAbsCoor();
553
[10081]554  this->trail->tick(time);
555  this->trailL->tick(time);
556  this->trailR->tick(time);
[10095]557
[10113]558  this->weaponMan.setParentEntity( this);
559  this->secWeaponMan.setParentEntity( this);
560
[6868]561  //orient the spaceship in direction of the mouse
[10017]562  /*
[9869]563  rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, 0.5);//fabsf(time)*shipInertia);
564  if (this->getAbsDir().distance(rotQuat) > 0.00000000000001)
[6868]565    this->setAbsDir( rotQuat);
[9869]566  //this->setAbsDirSoft(mouseDir,5);
[10017]567  */
[6868]568
569  // this is the air friction (necessary for a smooth control)
[10017]570  /*
[6868]571  if(travelSpeed >= 120) velocity -= velocity.getNormalized()*travelSpeed*travelSpeed*0.0001;
572  else if (travelSpeed <= 80) velocity -= velocity.getNormalized()*travelSpeed*0.001;
[10017]573  */
[6868]574
575  //other physics (gravity)
576  //if(travelSpeed < 120)
577  //move += Vector(0,-1,0)*60*time + Vector(0,1,0)*travelSpeed/2*time;
578
579  //hoover effect
580  //cycle += time;
581  //this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
582
583  //readjust
584  //if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
585  //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
586
587  //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
588
[10017]589  /*
[6868]590  this->shiftCoor(move);
[10017]591  */
[6868]592
[9869]593  //   PRINTF(0)("id of %s is: %i\n", this->getName(), this->getOMListNumber());
[6868]594
595}
596
597/**
598 * @todo switch statement ??
599 */
600void SpaceShip::process(const Event &event)
601{
[9961]602  //Playable::process(event);
[10113]603 
[6868]604  if( event.type == KeyMapper::PEV_LEFT)
[10017]605    this->bLeft = event.bPressed;
[6868]606  else if( event.type == KeyMapper::PEV_RIGHT)
[10017]607    this->bRight = event.bPressed;
[6997]608  else if( event.type == KeyMapper::PEV_FORWARD)
[10017]609    this->bForward = event.bPressed; //this->shiftCoor(0,.1,0);
[6997]610  else if( event.type == KeyMapper::PEV_BACKWARD)
[10017]611    this->bBackward = event.bPressed; //this->shiftCoor(0,-.1,0);
[9961]612  else if( event.type == KeyMapper::PEV_FIRE2)
613    this->bSecFire = event.bPressed;
[9958]614  else if( event.type == KeyMapper::PEV_FIRE1)
[9965]615    this->bFire = event.bPressed;
[10113]616  else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
617  {
618    this->nextWeaponConfig();
619  }
620  else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
621    this->previousWeaponConfig();
[10017]622
[10237]623  if (!(State::getCamera()->getEventHandling()))
624  {
625    if( event.type == KeyMapper::PEV_VIEW0)
626    {
627      State::getCamera()->setViewMode(Camera::ViewNormal);
628      State::getCameraTargetNode()->setParent(this);
629      State::getCamera()->setParent(this);
630    }
631    else if( event.type == KeyMapper::PEV_VIEW1)
632    {
633      State::getCamera()->setViewMode(Camera::ViewBehind);
634      State::getCameraTargetNode()->setParent(this);
635      State::getCamera()->setParent(this);
636    }
637    else if( event.type == KeyMapper::PEV_VIEW2)
638    {
639      State::getCamera()->setViewMode(Camera::ViewFront);
640      State::getCameraTargetNode()->setParent(this);
641      State::getCamera()->setParent(this);
642    }
643    else if( event.type == KeyMapper::PEV_VIEW3)
644    {
645      State::getCamera()->setViewMode(Camera::ViewLeft);
646      State::getCameraTargetNode()->setParent(this);
647      State::getCamera()->setParent(this);
648    }
649    else if( event.type == KeyMapper::PEV_VIEW4)
650    {
651      State::getCamera()->setViewMode(Camera::ViewRight);
652      State::getCameraTargetNode()->setParent(this);
653      State::getCamera()->setParent(this);
654    }
655    else if( event.type == KeyMapper::PEV_VIEW5)
656    {
657      State::getCamera()->setViewMode(Camera::ViewTop);
658      State::getCameraTargetNode()->setParent(this->travelNode);
659      State::getCamera()->setParent(this->travelNode);
660    }
661  }
[10017]662
[10237]663
[10017]664  /*
[6868]665  else if( event.type == EV_MOUSE_MOTION)
666  {
[9961]667
[6868]668    this->xMouse += event.xRel;
669    this->yMouse += event.yRel;
670  }
[10017]671  */
[6868]672}
673
[9235]674void SpaceShip::destroy( WorldEntity* killer )
[9008]675{
[10107]676  PRINTF(5)("spaceship destroy\n");
[10095]677 
[10073]678  EmitterNode* node  = NULL;
679  DotEmitter* emitter = NULL;
680  SpriteParticles*  explosionParticles  = NULL;
[10064]681
[10107]682  explosionParticles = new SpriteParticles(200);
683  explosionParticles->setName("SpaceShipExplosionParticles");
684  explosionParticles->setLifeSpan(.2, .3);
[10073]685  explosionParticles->setRadius(0.0, 10.0);
686  explosionParticles->setRadius(.5, 6.0);
687  explosionParticles->setRadius(1.0, 3.0);
[10098]688  explosionParticles->setColor(0.0, 1,1,1,.9);
689  explosionParticles->setColor(0.1,  1,1,0,.9);
690  explosionParticles->setColor(0.5, .8,.4,0,.5);
[10107]691  explosionParticles->setColor(1.0, .2,.2,.2,.5);
[10064]692
[10073]693 
[10107]694  emitter = new DotEmitter( 2000, 70, 360);
695  //emitter->setSpread( 0, M_2_PI);
696  emitter->setEmissionRate( 200.0);
[10098]697  //emitter->setEmissionVelocity( 200.0);
[10107]698  //emitter->setSystem( explosionParticles);
699  //emitter->setAbsCoor( this->getAbsCoor());
[10064]700
[10107]701  node  = new EmitterNode( .1f);
[10073]702  node->setupParticle( emitter, explosionParticles);
[10107]703  node->setAbsDir( this->getAbsDir());
704  node->setVelocity( this->getVelocity() * .9f);
[10073]705  node->setAbsCoor( this->getAbsCoor());
[10107]706  if( !node->start())
707    PRINTF(0)("Explosion node not correctly started!");
708
[10095]709/*
[10081]710  PNode* node          = new PNode();
711  node->setAbsCoor(this->getAbsCoor());
712  Explosion* explosion = new Explosion();
713  explosion->explode( node, Vector(5,5,5));
[10095]714*/
[10073]715
[10107]716  if( this->hasPlayer())
717  {
718        this->setAbsCoor(Vector(-10000,10000,10000));
719        this->hide();
720  }
721  else
722  {
[10113]723    this->setAbsCoor( this->getAbsCoor() + Vector(100,0,0) + Vector(1,0,0) * VECTOR_RAND(150).dot(Vector(1,0,0)));
[10107]724  }
725
[9008]726}
[6868]727
[9008]728void SpaceShip::respawn( )
729{
[10107]730  this->unhide();
[10081]731  /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++)
732  {
733    if( dynamic_cast<WorldEntity*>(*it) != NULL)
734      dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00);
735  }*/
[10098]736  /*
[10095]737  if( this->hasPlayer())
738  {
[10081]739    this->toList( OM_GROUP_01);
[10095]740    for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++)
741        {
742          if( likely( dynamic_cast<Weapon*>(*it) != NULL))
743                dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00_PROJ);
744        }
745  }
[10081]746  else
[10095]747  {
748    this->toList( OM_GROUP_00);
749    for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++)
750        {
751          if( likely( dynamic_cast<Weapon*>(*it) != NULL))
752                dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_01_PROJ);
753        }
[10098]754  }*/
[10081]755
[9008]756}
[6868]757
758
[9957]759void SpaceShip::damage(float pDamage, float eDamage){
[10117]760  PRINTF(5)("ship hit for (%f,%f) \n",pDamage,eDamage);
[10081]761
[10064]762  if( this->shieldActive) {
[9950]763    if( this->shieldCur > pDamage) {
764      this->shieldCur = this->shieldCur - pDamage;
765    }
766    else { // shield <= pDamage
[9987]767      this->shieldCur -=pDamage;
768      this->shieldActive = false; //shield collapses
[10081]769      pDamage += this->shieldCur;
[9950]770      if( !this->shieldActive) {
[9957]771        this->armorCur -= pDamage / 2; // remaining damages hits armor at half rate
[9953]772        this->electronicCur -= eDamage;
[9950]773      }
774    }
775  }
776  else {
777    this->armorCur = this->armorCur - pDamage;
778    this->electronicCur = this->electronicCur - eDamage;
779  }
780  if( this->armorCur <= 0) { /* FIXME implement shipcrash*/ }
[10064]781    this->destroy(this);
[10119]782
[10120]783  updateElectronicWidget();
784  updateShieldWidget();
785
[10119]786  this->setHealth( this->armorCur);
[9950]787}
788
[9987]789
[9957]790void SpaceShip::regen(float time){
791  float tmp;
[9963]792  if (this->armorCur != this->armorMax || this->armorRegen != 0){
793    tmp = this->armorCur + this->armorRegen * time;
794    if ( tmp > electronicMax)
795      this->armorCur = this->armorMax;
796    else
797      this->armorCur = tmp;
798  }
799  if (this->shieldCur != this->shieldMax || this->shieldRegen != 0){
[9970]800    tmp =  this->shieldCur + (this->shieldRegen + this->reactorOutput * this->shieldEnergyShare) * time;
[9957]801    if( tmp > shieldMax)
[9953]802      this->shieldCur = this->shieldMax;
803    else
[9957]804      this->shieldCur = tmp;
805    this->shieldActive = ( this->shieldActive || this->shieldCur > shieldTH);
[10120]806
807    updateShieldWidget();
[9953]808  }
[9970]809
810  this->setHealth( this->shieldCur);      // FIXME currently just to test share system
811
[9963]812  if (this->electronicCur != this->electronicMax || this->electronicRegen != 0){
[9957]813    tmp = this->electronicCur + this->electronicRegen * time;
814    if ( tmp > electronicMax)
[9953]815      this->electronicCur = this->electronicMax;
816    else
[9957]817      this->electronicCur = tmp;
[10120]818
819    updateElectronicWidget();
[9953]820  }
[10120]821
[9950]822}
[9965]823
[9987]824
[9965]825/**
826 * Weapon regeneration
827 * does not use any reactor capacity, as it wouldn't work in a consistent way.
828 */
829void SpaceShip::weaponRegen(float time)
830{
831  float energy  = ( this->reactorOutput * this->weaponEnergyShare + this->weaponEnergyRegen) * time;
832  Weapon* weapon;
[9987]833  for( unsigned int i=0; i < this->weaponMan.getSlotCount(); i++)
[9965]834  {
835    weapon = this->weaponMan.getWeapon(i);
836    if( weapon != NULL && weapon->isActive())
837    {
838      weapon->increaseEnergy( energy);
839    }
840
841  }
842  // weaponMan.increaseAmmunition( weapon, energy);
843}
[9975]844
[9987]845
[9975]846void SpaceShip::enterPlaymode(Playable::Playmode playmode)
847{
[10017]848  switch(playmode)
849  {
850    case Playable::Full3D:
851      /*
852      if (State::getCameraNode != NULL)
853      {
854        Vector absCoor = this->getAbsCoor();
855        this->setParent(PNode::getNullParent());
856        this->setAbsCoor(absCoor);
857        State::getCameraNode()->setParentSoft(&this->cameraNode);
858        State::getCameraNode()->setRelCoorSoft(-10, 0,0);
859        State::getCameraTargetNode()->setParentSoft(&this->cameraNode);
860        State::getCameraTargetNode()->setRelCoorSoft(100, 0,0);
861
862      }
863      */
864      //break;
865
[10032]866      break;
867    case Playable::Horizontal:
[10017]868      if (State::getCameraNode != NULL)
869      {
870        this->debugNode(1);
871        this->travelNode->debugNode(1);
872
873        this->travelNode->setAbsCoor(this->getAbsCoor());
874        this->travelNode->updateNode(0.01f);
875
[10098]876        this->setParent(this->travelNode);
[10017]877        this->setRelCoor(0,0,0);
878
[10098]879        State::getCameraNode()->setParentSoft(this->travelNode);
880        //State::getCameraNode()->setParentSoft(this);
[10237]881        //State::getCameraNode()->setRelCoorSoft(-0.01, 40, 0);
[10098]882        State::getCameraTargetNode()->setParentSoft(this->travelNode);
883        //State::getCameraTargetNode()->setParentSoft(this);
[10237]884        //State::getCameraTargetNode()->setRelCoorSoft(0,0,0);
885        this->setCameraMode(Camera::ViewTop);
886        State::getCamera()->setEventHandling(false);
887        registerEvent(KeyMapper::PEV_VIEW0);
888        registerEvent(KeyMapper::PEV_VIEW1);
889        registerEvent(KeyMapper::PEV_VIEW2);
890        registerEvent(KeyMapper::PEV_VIEW3);
891        registerEvent(KeyMapper::PEV_VIEW4);
892        registerEvent(KeyMapper::PEV_VIEW5);
[10017]893
[10237]894        State::getCamera()->setParentMode(PNODE_MOVEMENT);
895
[10017]896        this->debugNode(1);
897        this->travelNode->debugNode(1);
898      }
899      break;
900
901    default:
902      PRINTF(2)("Playmode %s Not Implemented in %s\n", Playable::playmodeToString(this->getPlaymode()).c_str(), this->getClassCName());
903  }
[9975]904}
905
[10017]906/**
907 * @brief calculate the velocity
908 * @param time the timeslice since the last frame
909*/
[9987]910
[9975]911void SpaceShip::movement (float dt)
912{
[10019]913  //by releasing the buttons, the velocity decreases with airCoeff*Acceleration. Should be strong enough so
914  //the ship doesn't slide too much.
915  float airCoeff = 2.5;
916  float pi = 3.14;
[10098]917 
[10017]918
[10032]919  switch(this->getPlaymode())
[10017]920  {
[10032]921    case Playable::Horizontal:
[10017]922    {
[10032]923      // these routines will change the travel movement into zero in a short amout of time, if the player
924      // doesn't press any buttons.
[10098]925      if (this->travelVelocity.x >= 0)
[10017]926      {
[10098]927        if (this->travelVelocity.x > airCoeff*this->acceleration * dt)
928          this->travelVelocity.x -= airCoeff* this->acceleration * dt;
[10032]929        else
[10098]930          this->travelVelocity.x = 0;
[10017]931      }
932      else
933      {
[10098]934        if (this->travelVelocity.x < -airCoeff*this->acceleration * dt)
935          this->travelVelocity.x += airCoeff* this->acceleration * dt;
[10032]936        else
[10098]937          this->travelVelocity.x = 0;
[10017]938      }
[10098]939      if (this->travelVelocity.z >= 0)
[10017]940      {
[10098]941        if (this->travelVelocity.z > airCoeff*this->acceleration * dt)
942          this->travelVelocity.z -= airCoeff* this->acceleration * dt;
[10032]943        else
[10098]944          this->travelVelocity.z = 0;
[10017]945      }
946      else
947      {
[10098]948        if (this->travelVelocity.z < -airCoeff*this->acceleration * dt)
949          this->travelVelocity.z += airCoeff* this->acceleration * dt;
[10032]950        else
[10098]951          this->travelVelocity.z = 0;
[10017]952      }
[10032]953   
954      // this will evite, that the ship moves outside the travelDistance- borders,when the player releases all buttons
955      // and its continuing to slide a bit.
956      Vector oldCoor = this->getRelCoor();
957      if (this->getRelCoor().x > this->travelDistancePlus.x) this->setRelCoor(this->travelDistancePlus.x, oldCoor.y, oldCoor.z);
958      if (this->getRelCoor().x < this->travelDistanceMinus.x) this->setRelCoor(this->travelDistanceMinus.x, oldCoor.y, oldCoor.z);
959      if (this->getRelCoor().z > this->travelDistancePlus.y) this->setRelCoor(oldCoor.x, oldCoor.y, this->travelDistancePlus.y);
960      if (this->getRelCoor().z < this->travelDistanceMinus.y) this->setRelCoor(oldCoor.x, oldCoor.y, this->travelDistanceMinus.y);
961   
962      if( this->systemFailure() )
963        bForward = bBackward = bLeft = bRight = false;
964   
965      if( this->bForward )
[10019]966      {
[10032]967        if(this->getRelCoor().x < this->travelDistancePlus.x)
968        {
[10098]969          if (this->travelVelocity.x < this->travelSpeed)
[10032]970          {
[10098]971            this->travelVelocity.x += (airCoeff + 1.0)*this->acceleration*dt;
[10032]972          }
973          else
974          {
[10098]975            this->travelVelocity.x = this->travelSpeed;
[10032]976          }
977        }
978        else
979        {
[10098]980          this->travelVelocity.x = 0.0f;
[10032]981        }
[10019]982      }
[10032]983   
984      if( this->bBackward )
[10019]985      {
[10032]986        if(this->getRelCoor().x > this->travelDistanceMinus.x)
987        {
[10098]988          if (this->travelVelocity.x > -this->travelSpeed)
[10032]989          {
[10098]990            this->travelVelocity.x -= (airCoeff + 1.0)*this->acceleration*dt;
[10032]991          }
992          else
993          {
[10098]994            this->travelVelocity.x = -this->travelSpeed;
[10032]995          }
996        }
997        else
998        {
[10098]999          this->travelVelocity.x = 0.0f;
[10032]1000        }
[10019]1001      }
[10032]1002   
1003      if( this->bLeft)
[10019]1004      {
[10032]1005        if(this->getRelCoor().z > this->travelDistanceMinus.y)
1006        {
[10098]1007          if (this->travelVelocity.z > -this->travelSpeed)
[10032]1008          {
[10098]1009            this->travelVelocity.z -= (airCoeff + 1.0)*this->acceleration*dt;
[10032]1010          }
1011          else
1012          {
[10098]1013            this->travelVelocity.z = -this->travelSpeed;
[10032]1014          }
1015        }
1016        else
1017        {
[10098]1018          this->travelVelocity.z = 0.0f;
[10032]1019        }
[10043]1020        this->setRelDirSoft(Quaternion(-pi/6, Vector(1,0,0)), 6);
[10019]1021      }
[10032]1022   
1023      if( this->bRight)
[10019]1024      {
[10032]1025        if(this->getRelCoor().z < this->travelDistancePlus.y)
1026        {
[10098]1027          if (this->travelVelocity.z < this->travelSpeed)
[10032]1028          {
[10098]1029            this->travelVelocity.z += (airCoeff + 1.0)*this->acceleration*dt;
[10032]1030          }
1031          else
1032          {
[10098]1033            this->travelVelocity.z = this->travelSpeed;
[10032]1034          }
1035        }
1036        else
1037        {
[10098]1038          this->travelVelocity.z = 0.0f;
[10032]1039        }
[10043]1040        this->setRelDirSoft(Quaternion(pi/6, Vector(1,0,0)), 6);
[10019]1041      }
[10032]1042      if (!this->bRight && !this->bLeft)
1043      {
[10043]1044        this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 6);
[10032]1045      }
1046
[10043]1047    //normalisation of the vectors (vector sum must be <= travelspeed)
[10098]1048    float xzNorm = sqrt(pow(this->travelVelocity.x, 2) + pow(this->travelVelocity.z, 2));
[10043]1049    if (xzNorm > this->travelSpeed)
1050    {
[10098]1051      this->travelVelocity.x = this->travelVelocity.x/xzNorm * this->travelSpeed;
1052      this->travelVelocity.z = this->travelVelocity.z/xzNorm * this->travelSpeed;
[10043]1053    }
[10032]1054
[10099]1055    //this moves camera and ship along the travel path.
[10043]1056    this->travelNode->shiftCoor(Vector(this->cameraSpeed * dt, 0, 0));
[10099]1057
[10043]1058    break;
[10019]1059    }
[10032]1060    case Playable::Vertical:
1061      break;
[10017]1062    default:
[10032]1063      PRINTF(4)("Playmode %s Not Implemented in %s\n", Playable::playmodeToString(this->getPlaymode()).c_str(), this->getClassCName());
[10017]1064  }
[10099]1065   //set new coordinates calculated through key- events.
[10098]1066  this->shiftCoor (this->travelVelocity * dt);
[9975]1067}
[10017]1068
[10032]1069void SpaceShip::setPlaymodeXML(const std::string& playmode)
1070{
1071  this->setPlaymode(Playable::stringToPlaymode(playmode));
1072}
1073
[10113]1074/**
1075 * @brief jumps to the next WeaponConfiguration
1076 */
1077void SpaceShip::nextWeaponConfig()
1078{
[10117]1079  PRINTF(0)("Requested next weapon config!\n");
1080  this->weaponMan.nextWeaponConfig();
[10113]1081  Playable::weaponConfigChanged();
1082}
1083
1084/**
1085 * @brief moves to the last WeaponConfiguration
1086 */
1087void SpaceShip::previousWeaponConfig()
1088{
[10117]1089  this->curWeaponPrimary    = (this->curWeaponPrimary + 1) % 3;
[10113]1090  this->weaponMan.changeWeaponConfig(this->curWeaponPrimary);
1091  Playable::weaponConfigChanged();
[10117]1092}
1093
1094void SpaceShip::hit(float damage, WorldEntity* killer)
1095{
1096  this->damage(killer->getDamage(),0);
1097  killer->collidesWith( this, this->getAbsCoor());
1098  //this->collidesWith(killer, this->getAbsCoor());
1099}
[10120]1100
1101void SpaceShip::updateElectronicWidget()
1102{
[10139]1103  if (this->electronicWidget != NULL)
1104  { //if it exists already: update it
1105     this->electronicWidget->setMaximum(this->electronicMax);
1106     this->electronicWidget->setValue(this->electronicCur);
1107  }
1108  else
1109  { //create the widget
1110    this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical();
[10230]1111    this->electronicWidget->getBarWidget()->setChangedValueColor(Color(1,0,0,1));
[10194]1112    //this->electronicWidget->setDisplayedName("Electronics:");
[10139]1113    //this->electronicWidget->setSize2D(100,20);
1114    //this->electronicWidget->setAbsCoor2D(150,200);
1115    this->updateElectronicWidget();
1116    if (this->hasPlayer())
1117      State::getPlayer()->hud().setEnergyWidget(this->electronicWidget);
1118  }
[10120]1119}
1120
1121void SpaceShip::updateShieldWidget()
1122{
[10139]1123  if (this->shieldWidget != NULL)
1124  { 
1125    this->shieldWidget->setMaximum(this->shieldMax);
1126    this->shieldWidget->setValue(this->shieldCur);;
1127  }
1128  else
1129  {
1130    this->shieldWidget = new OrxGui::GLGuiEnergyWidgetVertical();
[10230]1131    this->shieldWidget->getBarWidget()->setChangedValueColor(Color(1,0,0,1));
[10194]1132    //this->shieldWidget->setDisplayedName("Shield:");
[10139]1133    //his->shieldWidget->setSize2D(100,20);
1134    //this->shieldWidget->setAbsCoor2D(200,200);
1135    this->updateShieldWidget();
1136    if (this->hasPlayer())
1137      State::getPlayer()->hud().setShiledWidget(this->shieldWidget);
1138  }
[10120]1139}
Note: See TracBrowser for help on using the repository browser.