Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5750 in orxonox.OLD for trunk/src/world_entities/player.cc


Ignore:
Timestamp:
Nov 24, 2005, 12:13:22 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the WorldEntities into the Trunk.
Merged with command:
svn merge branches/world_entities/ trunk/ -r5516:HEAD

conflics from world_entities changed in favor of branches/world_entity
all other conflict in favor of the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/player.cc

    r5636 r5750  
    2828#include "weapons/test_gun.h"
    2929#include "weapons/turret.h"
     30#include "weapons/cannon.h"
    3031
    3132#include "list.h"
     
    3738using namespace std;
    3839
    39 CREATE_FACTORY(Player);
     40CREATE_FACTORY(Player, CL_PLAYER);
    4041
    4142/**
     
    4647{
    4748  this->init();
    48 
    49   //weapons:
    50   Weapon* wpRight = new TestGun(this->weaponMan, 0);
    51   Weapon* wpLeft = new TestGun(this->weaponMan, 1);
    52 
    53   this->weaponMan->addWeapon(wpRight);
    54 //  this->weaponMan->addWeapon(wpLeft, WM_CONFIG1, WM_SLOT1);
    55 //  this->weaponMan->addWeapon(wpRight, WM_CONFIG2);
    56 //  this->weaponMan->addWeapon(wpLeft, WM_CONFIG2);
    5749}
    5850
     
    8880
    8981  //weapons:
    90   Weapon* wpRight = new TestGun(this->weaponMan, 0);
     82  Weapon* wpRight = new TestGun(0);
    9183  wpRight->setName("testGun Right");
    92   Weapon* wpLeft = new TestGun(this->weaponMan, 1);
     84  Weapon* wpLeft = new TestGun(1);
    9385  wpLeft->setName("testGun Left");
     86  Weapon* cannon = dynamic_cast<Weapon*>(Factory::getFirst()->fabricate(CL_CANNON));
     87
     88  cannon->setName("BFG");
    9489
    9590  this->weaponMan->addWeapon(wpLeft, 1, 0);
    9691  this->weaponMan->addWeapon(wpRight,1 ,1);
     92  this->weaponMan->addWeapon(cannon, 0, 6);
     93
    9794  //this->weaponMan->addWeapon(turret, 3, 0);
    9895
     
    134131
    135132  this->weaponMan = new WeaponManager(this);
    136   this->weaponMan->setSlotCount(10);
     133  this->weaponMan->setSlotCount(7);
    137134
    138135  this->weaponMan->setSlotPosition(0, Vector(-2.6, .1, -3.0));
     
    153150  this->weaponMan->setSlotPosition(5, Vector(-1.5, -.5, -.5));
    154151  this->weaponMan->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
    155 
    156   this->weaponMan->setSlotPosition(6, Vector(-2.0, 0.1, -2.0));
    157   this->weaponMan->setSlotPosition(7, Vector(-2.0, 0.1, 2.0));
    158 
    159   this->weaponMan->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
    160   this->weaponMan->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
    161 
    162   this->weaponMan->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
    163   this->weaponMan->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));
     152//
     153   this->weaponMan->setSlotPosition(6, Vector(-1, 0.0, 0));
     154   this->weaponMan->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     155   //
     156//   this->weaponMan->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
     157//   this->weaponMan->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
     158//
     159//   this->weaponMan->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
     160//   this->weaponMan->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
     161
    164162}
    165163
     
    337335}
    338336
     337#include "weapons/aiming_turret.h"
    339338// FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG
    340339void Player::ADDWEAPON()
    341340{
    342   Weapon* turret1 = new Turret(this->weaponMan);
    343   turret1->setName("Turret");
    344   turret1->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1);
    345 
    346   this->weaponMan->addWeapon(turret1, 2);
    347 
    348   this->weaponMan->changeWeaponConfig(2);
    349 }
     341  Weapon* turret = NULL;
     342
     343  if ((float)rand()/RAND_MAX < .1)
     344  {
     345    //if (this->weaponMan->hasFreeSlot(2, WTYPE_TURRET))
     346    {
     347      turret = new Turret();
     348      this->weaponMan->addWeapon(turret, 2);
     349      this->weaponMan->changeWeaponConfig(2);
     350    }
     351  }
     352  else
     353  {
     354    //if (this->weaponMan->hasFreeSlot(3))
     355    {
     356      turret = new AimingTurret();
     357      this->weaponMan->addWeapon(turret, 3);
     358
     359      this->weaponMan->changeWeaponConfig(3);
     360    }
     361  }
     362
     363  if(turret != NULL)
     364  {
     365    turret->setName("Turret");
     366    turret->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1);
     367  }
     368}
Note: See TracChangeset for help on using the changeset viewer.