Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9494 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Jul 27, 2006, 10:44:28 AM (18 years ago)
Author:
bensch
Message:

merged the proxy back

Location:
trunk/src/world_entities
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/creatures/fps_player.cc

    r9406 r9494  
    287287  //dealing damage
    288288
    289   if ( State::isOnline() && (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer()))
     289  if ( State::isOnline() && (SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/))
    290290  {
    291291    this->damageTicker -= time;
  • trunk/src/world_entities/space_ships/space_ship.cc

    r9406 r9494  
    310310void SpaceShip::collidesWith(WorldEntity* entity, const Vector& location)
    311311{
    312   Playable::collidesWith(entity, location);
    313 
    314   if( entity->isA(CL_PROJECTILE) && entity != ref)
    315   {
    316     if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
    317     {
    318       //TODO handle this
    319     }
    320   }
    321   PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassCName(), entity->getClassCName(), location.x, location.y, location.z);
     312
    322313}
    323314
  • trunk/src/world_entities/space_ships/turbine_hover.cc

    r8623 r9494  
    126126  this->cameraNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
    127127  //this->cameraNode.setParentMode(PNODE_ROTATE_MOVEMENT);
    128   //this->cameraNode.setParent(this);
     128  this->cameraNode.setParent(this);
     129  this->cameraNode.setRelCoor(0,5,0);
    129130
    130131  // rotors
     
    211212  this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
    212213  this->getWeaponManager().getFixedTarget()->setRelCoor(1000,0,0);
    213  
     214
    214215  registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) );
    215216  registerVar( new SynchronizeableBool( &bBackward, &bBackward, "bBackward", PERMISSION_OWNER ) );
     
    218219  registerVar( new SynchronizeableBool( &bAscend, &bAscend, "bAscend", PERMISSION_OWNER ) );
    219220  registerVar( new SynchronizeableBool( &bDescend, &bDescend, "bDescend", PERMISSION_OWNER ) );
    220   //registerVar( new SynchronizeableQuaternion( &direction, &direction, "direction", PERMISSION_OWNER ) );
     221  registerVar( new SynchronizeableQuaternion( &direction, &direction, "direction", PERMISSION_OWNER ) );
    221222  registerVar( new SynchronizeableFloat( &cameraLook, &cameraLook, "cameraLook", PERMISSION_OWNER ) );
    222223  registerVar( new SynchronizeableFloat( &rotation, &rotation, "rotation", PERMISSION_OWNER ) );
     
    294295
    295296  // spaceship controlled movement
     297
     298  // TRYING TO FIX PNode.
     299  //this->cameraNode.setRelCoor(Vector(0.0f, 5.0f, 0.0f));//, 30.0f);
     300  //this->cameraNode.setRelDir(Quaternion(this->smoothRotator  *10.0, Vector(0,1,0)));
     301
    296302  this->movement(dt);
    297303  this->rotorCycle += this->rotorSpeed * dt;
    298 
    299   // TRYING TO FIX PNode.
    300   this->cameraNode.setAbsCoorSoft(this->getAbsCoor() + Vector(0.0f, 5.0f, 0.0f), 30.0f);
    301   this->cameraNode.setRelDirSoft(this->getAbsDir(), 30.0f);
    302 }
     304}
     305
     306
     307#include "shared_network_data.h"
    303308
    304309/**
     
    349354
    350355        this->velocity += (accelerationDir - damping)* dt;
    351         this->shiftCoor (this->velocity * dt);
     356        //if (this->getOwner() != SharedNetworkData::getInstance()->getHostID())
     357          this->shiftCoor (this->velocity * dt);
    352358
    353359        // limit the maximum rotation speed.
     
    362368        }
    363369
    364         this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);
     370        //if (this->getOwner() != SharedNetworkData::getInstance()->getHostID())
     371          this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);
    365372
    366373        this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
     
    407414
    408415    case Playable::Vertical:
    409     {
    410       accel.z = 0;
    411       Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration);
    412       accelerationDir.z=0;
     416      {
     417        accel.z = 0;
     418        Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration);
     419        accelerationDir.z=0;
    413420
    414421        // this is the air friction (necessary for a smooth control)
    415       Vector damping = (this->velocity * this->airFriction);
    416 
    417       this->velocity += (accelerationDir - damping)* dt;
    418       this->shiftCoor (this->velocity * dt);
    419 
    420       this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);
    421 
    422       this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
    423       this->rotorNodeLeft.setRelDirSoft(Quaternion(-accel.x * .07+this->rotation + cameraLook, Vector(0,0,1)), 5);
    424 
    425       this->wingNodeRight.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
    426       this->rotorNodeRight.setRelDirSoft(Quaternion(-accel.x*.07 -this->rotation + cameraLook, Vector(0,0,1)), 5);
    427     }
    428     break;
     422        Vector damping = (this->velocity * this->airFriction);
     423
     424        this->velocity += (accelerationDir - damping)* dt;
     425        this->shiftCoor (this->velocity * dt);
     426
     427        this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);
     428
     429        this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
     430        this->rotorNodeLeft.setRelDirSoft(Quaternion(-accel.x * .07+this->rotation + cameraLook, Vector(0,0,1)), 5);
     431
     432        this->wingNodeRight.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
     433        this->rotorNodeRight.setRelDirSoft(Quaternion(-accel.x*.07 -this->rotation + cameraLook, Vector(0,0,1)), 5);
     434      }
     435      break;
    429436    default:
    430437      PRINTF(2)("Playmode %s Not Implemented\n", Playable::playmodeToString(this->getPlaymode()).c_str());
  • trunk/src/world_entities/spawning_point.cc

    r9406 r9494  
    178178      }
    179179
    180       if ( found && SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     180      if ( found && SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/)
    181181        this->sendRespawnMessage( it->entity->getUniqueID() );
    182182
     
    201201 * Just override this function with whatever you want to be drawn.
    202202 */
    203 void SpawningPoint::draw()
     203void SpawningPoint::draw() const
    204204{
    205205}
     
    213213  assert( Converter::intToByteArray( uniqueId, buf + INTSIZE, INTSIZE ) == INTSIZE );
    214214
    215   MessageManager::getInstance()->sendMessage( MSGID_RESPAWN, buf, 2*INTSIZE, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH );
     215  MessageManager::getInstance()->sendMessage( MSGID_RESPAWN, buf, 2*INTSIZE, RT_ALL_BUT_ME, 0, MP_HIGHBANDWIDTH );
    216216}
    217217
    218218bool SpawningPoint::respawnMessageHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    219219{
    220   if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
     220  if ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/)
    221221  {
    222222    PRINTF(2)("server received spawn message!\n");
  • trunk/src/world_entities/spawning_point.h

    r9008 r9494  
    5050    virtual void loadParams(const TiXmlElement* root);
    5151
    52     inline int getTeamId(){ return this->teamId; }
    53     inline void setTeamId( int teamId ){ this->teamId = teamId; }
     52    inline int getTeamId() const { return this->teamId; }
     53    inline void setTeamId( int teamId ) { this->teamId = teamId; }
    5454
    5555    void pushEntity(Playable* entity, float delay = 0);
     
    6363
    6464    virtual void tick(float dt);
    65     virtual void draw();
     65    virtual void draw() const;
    6666
    6767
    6868  private:
    6969    void spawn(Playable* entity);
    70    
     70
    7171    void sendRespawnMessage( int uniqueId );
    7272    static bool respawnMessageHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
  • trunk/src/world_entities/world_entity.cc

    r9406 r9494  
    257257bool WorldEntity::buildObbTree(int depth)
    258258{
    259   if (this->obbTree)
     259  if( this->obbTree != NULL)
     260  {
    260261    delete this->obbTree;
     262    this->obbTree = NULL;
     263  }
    261264
    262265  if (this->models[0] != NULL)
     
    280283    this->aabbNode = new AABBTreeNode();
    281284    this->aabbNode->spawnBVTree(this->models[0]);
     285  }
     286  else
     287  {
     288    PRINTF(1)("could not create aabb bounding box, because no model was loaded yet\n");
     289    this->aabbNode = NULL;
     290    return false;
    282291  }
    283292  return true;
Note: See TracChangeset for help on using the changeset viewer.