Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6424 in orxonox.OLD for trunk/src/world_entities/world_entity.cc


Ignore:
Timestamp:
Jan 7, 2006, 11:07:22 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the branche network back to the trunk
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/network . -r 6351:HEAD
no conflicts

File:
1 edited

Legend:

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

    r6341 r6424  
    3535    ->defaultValues(2, "models/ships/fighter.obj", 1.0);
    3636
     37SHELL_COMMAND(debugEntity, WorldEntity, debugWE);
    3738
    3839/**
     
    4849
    4950  this->obbTree = NULL;
     51
     52  this->md2TextureFileName = NULL;
    5053
    5154  if (root != NULL)
     
    105108void WorldEntity::loadModel(const char* fileName, float scaling, unsigned int modelNumber)
    106109{
     110  this->scaling = scaling;
    107111  if ( fileName != NULL && strcmp(fileName, "") )
    108112  {
     
    123127      return;
    124128    }
    125 
     129    if (scaling == 0.0)
     130    {
     131      scaling = 1.0;
     132      PRINTF(1)("YOU GAVE ME A CRAPY SCALE resetting to 1\n");
     133    }
    126134    if(strstr(fileName, ".obj"))
    127135    {
     
    343351}
    344352
     353
     354/**
     355 * Debug the WorldEntity
     356 */
     357void WorldEntity::debugEntity() const
     358{
     359  PRINT(0)("WorldEntity %s::%s  (DEBUG)\n", this->getClassName(), this->getName());
     360  this->debugNode();
     361  PRINT(0)("List: %s ; ModelCount %d - ", ObjectManager::OMListToString(this->objectListNumber) , this->models.size());
     362  for (unsigned int i = 0; i < this->models.size(); i++)
     363  {
     364    if (models[i] != NULL)
     365      PRINT(0)(" : %d:%s", i, this->models[i]->getName());
     366  }
     367  PRINT(0)("\n");
     368
     369}
     370
     371
    345372/**
    346373 * Writes data from network containing information about the state
     
    359386  SYNCHELP_READ_FLOAT( scaling );
    360387  //check if modelFileName is relative to datadir or absolute
    361   if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) )
    362   {
    363     loadModel( modelFileName+strlen(ResourceManager::getInstance()->getDataDir()), scaling );
    364   }
    365   else
    366   {
    367     loadModel( modelFileName, scaling );
     388
     389  if ( strcmp(modelFileName, "") )
     390  {
     391
     392    if ( strstr(modelFileName, ResourceManager::getInstance()->getDataDir()) )
     393    {
     394      loadModel( modelFileName+strlen(ResourceManager::getInstance()->getDataDir()), scaling );
     395    }
     396    else
     397    {
     398      loadModel( modelFileName, scaling );
     399    }
    368400  }
    369401  delete[] modelFileName;
     402
     403  SYNCHELP_READ_STRINGM( modelFileName );
     404  if ( strcmp(modelFileName, "") )
     405    this->md2TextureFileName = modelFileName;
    370406
    371407  return SYNCHELP_READ_N;
     
    386422  SYNCHELP_WRITE_STRING( getModel( 0 )->getName() );
    387423  SYNCHELP_WRITE_FLOAT( scaling );
     424  if ( this->md2TextureFileName!=NULL && strcmp(this->md2TextureFileName, "") )
     425  {
     426    SYNCHELP_WRITE_STRING(this->md2TextureFileName);
     427  }
     428  else
     429  {
     430    SYNCHELP_WRITE_STRING("");
     431  }
     432
    388433  return SYNCHELP_WRITE_N;
    389434}
Note: See TracChangeset for help on using the changeset viewer.