Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
May 2, 2005, 3:14:57 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the levelloader from lltrunktemp to the trunk. Big thanks to fuzzy to make this so easy for us, and for implementing it in the first place.

File:
1 edited

Legend:

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

    r4000 r4010  
    1 
    2 
    31/*
    42   orxonox - the future of 3D-vertical-scrollers
     
    3129
    3230using namespace std;
     31
     32CREATE_FACTORY(Player);
    3333
    3434/**
     
    7474}
    7575
     76/**
     77   \brief creates a new Player from Xml Data
     78   \param root the xml element containing player data
     79   
     80   \todo add more parameters to load
     81*/
     82Player::Player(TiXmlElement* root) : WorldEntity(root)
     83{
     84  /*
     85    char* temp;
     86    const char* string;
     87    string = grabParameter( root, "name");
     88    if( string == NULL)
     89    {
     90    PRINTF0("Player is missing a proper 'name'\n");
     91    string = "Unknown";
     92    temp = new char[strlen(string + 2)];
     93    strcpy( temp, string);
     94    this->setName( temp);
     95    }
     96    else
     97    {
     98    temp = new char[strlen(string + 2)];
     99    strcpy( temp, string);
     100    this->setName( temp);
     101    }
     102   
     103    this->model = NULL;
     104    string = grabParameter( root, "model");
     105    if( string != NULL)
     106    this->model = (Model*)ResourceManager::getInstance()->load(string, OBJ, RP_CAMPAIGN);
     107    else
     108    {
     109    PRINTF0("Player is missing a proper 'model'\n");
     110    this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
     111    }
     112    if( this->model == NULL)
     113    {
     114    PRINTF0("Player model '%s' could not be loaded\n", string);
     115    }
     116  */
     117  this->weapons = new tList<Weapon>();
     118  this->activeWeapon = NULL;
     119  /*
     120    this is the debug player - actualy we would have to make a new
     121     class derivated from Player for each player. for now, we just use
     122     the player.cc for debug also
     123  */
     124  travelSpeed = 15.0;
     125  velocity = new Vector();
     126  bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
     127  bFire = false;
     128  this->bWeaponChange = false;
     129  acceleration = 10.0;
     130  //weapons:
     131  this->weaponMan = new WeaponManager();
     132  Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0);
     133  Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1);
     134 
     135  this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0);
     136  this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1);
     137  this->weaponMan->addWeapon(wpRight, W_CONFIG2);
     138  this->weaponMan->addWeapon(wpLeft, W_CONFIG2);
     139}
    76140
    77141/**
Note: See TracChangeset for help on using the changeset viewer.