Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7071 in orxonox.OLD


Ignore:
Timestamp:
Feb 7, 2006, 2:58:08 PM (18 years ago)
Author:
patrick
Message:

patches: network load level and md2 death

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/md2Model.cc

    r7068 r7071  
    157157  the animation types can be looked up in the animationType table
    158158*/
    159 void MD2Model::setAnim(int type)
     159void MD2Model::setAnim(int type, int animPlayback)
    160160{
    161161  if( (type < 0) || (type > MAX_ANIMATIONS) )
     
    174174  this->animationState.type = type;
    175175  this->animationState.numPlays = 0;
     176  this->animationState.animPlaybackMode = animPlayback;
    176177
    177178  this->animationState.interpolationState = 0.0f;
     
    315316    }
    316317
    317   if( this->animationState.currentFrame > (this->data->numFrames - 1) )
     318  if( this->animationState.currentFrame > (this->data->numFrames - 1) && this->animationState.animPlaybackMode == MD2_ANIM_LOOP)
    318319    this->animationState.currentFrame = 0;
    319320  if( this->animationState.nextFrame > (this->data->numFrames - 1) )
  • trunk/src/lib/graphics/importer/md2Model.h

    r7059 r7071  
    136136  int              nextFrame;            //!< the next frame in the list
    137137  int              numPlays;             //!< the number of times, this has been played in series
     138
     139  int              animPlaybackMode;     //!< the playback mode
    138140} sAnimState;
    139141
     
    168170
    169171
     172typedef enum animPlayback
     173{
     174  MD2_ANIM_LOOP = 0,
     175  MD2_ANIM_ONCE,
     176
     177  MD2_ANIM_NUM
     178};
     179
     180
    170181
    171182/* forward definitions */
     
    219230
    220231
    221   void setAnim(int type);
     232  void setAnim(int type, int animPlayback = MD2_ANIM_LOOP);
    222233  /**  returns the current animation @returns animation type */
    223234  inline int MD2Model::getAnim() { return this->animationState.type; }
  • trunk/src/lib/network/network_game_manager.cc

    r6994 r7071  
    558558      {
    559559
    560         ss->loadModel("models/ships/reap_#.obj");
     560        ss->loadModel("models/ships/reap_0.obj");
    561561        ss->toList(OM_GROUP_00);
    562562      }
  • trunk/src/story_entities/multi_player_world_data.cc

    r7014 r7071  
    141141    element = element->FirstChildElement();
    142142
    143     while( element != NULL)
    144     {
    145       if( NetworkManager::getInstance()->isGameServer())
     143    if( NetworkManager::getInstance()->isGameServer() )
     144    {
     145      while( element != NULL)
    146146      {
    147147        /* pass the entity to the NetworkGameManager to be created */
     
    159159          CDEngine::getInstance()->setTerrain(terrain);
    160160        }
     161
     162        element = element->NextSiblingElement();
     163
     164
     165        glmis->step();
     166        PRINTF(4)("Done loading NetworkWorldEntities\n");
    161167      }
    162       element = element->NextSiblingElement();
    163 
    164 
    165       glmis->step();
    166       PRINTF(4)("Done loading NetworkWorldEntities\n");
    167     }
     168    }
     169    else
     170    {
     171      while( element != NULL)
     172      {
     173        PRINTF(0)("load: %s\n", element->Value());
     174        if( !strcmp(element->Value(), "Terrain") || !strcmp(element->Value(), "Building")  )
     175        {
     176
     177          /* pass the entity to the NetworkGameManager to be created */
     178          BaseObject* created = Factory::fabricate(element);
     179
     180          if( created != NULL )
     181            PRINTF(1)("Created a %s: %s (0x%8x) from %s\n", created->getClassName(), created->getName(), created->getLeafClassID(), element->Value());
     182          else
     183            PRINTF(1)("NetworkWorld: could not create this entity\n");
     184
     185          if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
     186            this->sky = dynamic_cast<WorldEntity*>(created);
     187          if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
     188          {
     189            this->terrain = dynamic_cast<Terrain*>(created);
     190            CDEngine::getInstance()->setTerrain(terrain);
     191          }
     192
     193          glmis->step();
     194          PRINTF(4)("Done loading NetworkWorldEntities\n");
     195        }
     196        element = element->NextSiblingElement();
     197      }
     198    }
     199
    168200
    169201    if( NetworkManager::getInstance()->isGameServer())
     
    180212        playable = dynamic_cast<Playable*>(playableList->front());
    181213        this->localPlayer->setPlayable(playable);
     214        playable->toList(OM_GROUP_00);
    182215      }
    183216    }
  • trunk/src/world_entities/creatures/md2_creature.cc

    r7069 r7071  
    226226{
    227227  PRINTF(0)("Collided with the md2 model\n");
    228   //entity->die();
    229228}
    230229
  • trunk/src/world_entities/test_entity.cc

    r6512 r7071  
    7676
    7777
    78 void  TestEntity::setAnim(int animationIndex)
     78void  TestEntity::setAnim(int animationIndex, int animPlaybackMode)
    7979{
    8080  if( likely(this->getModel(0) != NULL))
    81     ((MD2Model*)this->getModel(0))->setAnim(animationIndex);
     81    ((MD2Model*)this->getModel(0))->setAnim(animationIndex, animPlaybackMode);
    8282}
    8383
     
    9292
    9393void TestEntity::collidesWith(WorldEntity* entity, const Vector& location)
    94 {}
     94{
     95  if( this->lastCollided != entity)
     96  {
     97    this->dieHard();
     98    this->lastCollided = entity;
     99  }
     100}
    95101
    96102
     103
     104void TestEntity::dieHard()
     105{
     106  this->setAnim(DEATH_FALLBACK, MD2_ANIM_ONCE);
     107}
     108
  • trunk/src/world_entities/test_entity.h

    r7069 r7071  
    1111class Material;
    1212class TiXmlElement;
     13class WorldEntity;
    1314
    1415class TestEntity : public WorldEntity, public PhysicsInterface
     
    2425  virtual void loadParams(const TiXmlElement* root);
    2526
    26   void setAnim(int animationIndex);
     27  void setAnim(int animationIndex, int animPlaybackMode);
    2728
    2829  void dieHard();
     
    3738  Material* material;
    3839
     40  WorldEntity* lastCollided;
     41
    3942};
    4043
Note: See TracChangeset for help on using the changeset viewer.