Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8801 in orxonox.OLD


Ignore:
Timestamp:
Jun 26, 2006, 4:30:31 PM (18 years ago)
Author:
rennerc
Message:

finished spawningpoint for spawning playables

Location:
branches/network/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/util/game_rules.h

    r8623 r8801  
    3535    /** adding a kill event to the kill list @param kill the kill object containing all infos */
    3636    void registerKill(const Kill& kill);
     37    virtual void registerSpawn( WorldEntity * we ){}
    3738
    3839    virtual void onPlayerSpawn() {}
    3940    virtual void onPlayerDeath() {}
    40 
    4141
    4242    virtual void tick(float dt) = 0;
  • branches/network/src/util/multiplayer_team_deathmatch.cc

    r8798 r8801  
    139139
    140140/**
    141  * called when the player enters the game
    142  * @param player the spawned player
    143  */
    144 void MultiplayerTeamDeathmatch::onPlayerSpawn()
    145 {
    146   this->bLocalPlayerDead = false;
    147 }
    148 
    149 
    150 /**
    151  * when the player is killed
    152  * @param player the killed player
    153  */
    154 void MultiplayerTeamDeathmatch::onPlayerDeath()
    155 {
    156   this->bLocalPlayerDead = true;
    157 }
    158 
    159 
    160 /**
    161141 * time tick
    162142 * @param dt time
     
    786766}
    787767
     768/**
     769 * this function is called on player respawn
     770 * @param we
     771 */
     772void MultiplayerTeamDeathmatch::registerSpawn( WorldEntity * we )
     773{
     774  onRespawn( we->getOwner() );
     775}
     776
  • branches/network/src/util/multiplayer_team_deathmatch.h

    r8782 r8801  
    4141    virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId );
    4242
    43     virtual void onPlayerSpawn();
    44     virtual void onPlayerDeath();
    45 
     43    virtual void registerSpawn( WorldEntity * we );
    4644
    4745    virtual void tick(float dt);
  • branches/network/src/world_entities/spawning_point.cc

    r8798 r8801  
    2424#include "compiler.h"
    2525
    26 #include <map>
     26#include "state.h"
     27#include "game_rules.h"
    2728
    2829
     
    107108void SpawningPoint::pushEntity(WorldEntity* entity, float delay)
    108109{
    109   this->queue[entity] = this->localTimer + delay;
     110  QueueEntry qe;
     111  qe.entity = entity;
     112  qe.list = entity->getOMListNumber();
     113  qe.respawnTime = this->localTimer + delay;
     114 
     115  queue.push_back( qe );
    110116}
    111117
     
    119125
    120126
    121   //BaseObject* spawningEntity = Factory::fabricate(this->classID);
    122   //   if( likely(this->world != NULL))
    123   //     this->world->spawn(dynamic_cast<WorldEntity*>(spawningEntity));
     127  entity->setAbsCoor( this->getAbsCoor() );
     128  entity->setAbsDir( this->getAbsDir() );
     129 
     130  //TODO set camera (not smooth)
    124131}
    125132
     
    135142  this->localTimer += dt;
    136143
    137   std::map<WorldEntity*, float>::iterator it = this->queue.begin();
    138   for( ; it != this->queue.end(); it++)
     144  std::list<QueueEntry>::iterator it = this->queue.begin();
     145  for( ; it != this->queue.end(); )
    139146  {
    140     //
    141     if( it->second <= this->localTimer)
     147   
     148    if( it->respawnTime <= this->localTimer)
    142149    {
    143150      //spawn the player
    144       this->spawn(it->first);
     151      this->spawn(it->entity);
     152     
     153      it->entity->toList( it->list );
     154     
     155      if ( State::getGameRules() )
     156      {
     157        (State::getGameRules())->registerSpawn( it->entity );
     158      }
     159     
     160      std::list<QueueEntry>::iterator delit = it;
     161      it++;
     162     
     163      queue.erase( delit );
     164     
     165      continue;
    145166    }
     167   
     168    it++;
    146169  }
    147170
  • branches/network/src/world_entities/spawning_point.h

    r8798 r8801  
    88#define _SPAWNING_POINT
    99
    10 #include "world_entity.h"
     10#include "playable.h"
    1111
    12 #include <map>
     12#include <list>
    1313
    1414class World;
    1515class TiXmlElement;
    1616
     17struct QueueEntry
     18{
     19  float respawnTime;
     20  WorldEntity * entity;
     21  OM_LIST list;
     22};
    1723
    1824//!< used to indicate what type of objects are spawned by this spawning point
     
    7884    ClassID                         classid;                        //!< the classid of the entity to spawn
    7985    SpawningPointMode               mode;                           //!< the mode of the spawning point
    80     std::map<WorldEntity*, float>   queue;                          //!< queue of waiting WorldEntities to be spawned
     86    std::list<QueueEntry>           queue;                          //!< queue of waiting WorldEntities to be spawned
    8187    bool                            bSpawning;                      //!< flag to indicate if this spawning point is active or not
    8288};
Note: See TracChangeset for help on using the changeset viewer.