Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7116 in orxonox.OLD for trunk


Ignore:
Timestamp:
Feb 8, 2006, 9:39:53 AM (19 years ago)
Author:
rennerc
Message:

terrain collision hack

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/multiplayer_team_deathmatch.cc

    r7101 r7116  
    2828#include "space_ships/space_ship.h"
    2929
     30
    3031#include "shared_network_data.h"
    31 
    32 #include <list>
     32#include "terrain.h"
     33#include "class_list.h"
     34#include "space_ships/space_ship.h"
     35
    3336
    3437using namespace std;
     
    181184  }
    182185
    183 
    184 
    185 
     186 
     187  if ( SharedNetworkData::getInstance()->isGameServer() )
     188  {
     189    float offsetx = 500.0f;
     190    float offsety = 323.0f;
     191    float offsetz = 200.0f;
     192   
     193    offsetz += 10;
     194   
     195    Terrain * terrain = dynamic_cast<Terrain*>(*(ClassList::getList( CL_TERRAIN )->begin()));
     196    const std::list<BaseObject*> * list = ClassList::getList( CL_SPACE_SHIP );
     197    for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++)
     198    {
     199      SpaceShip * ss = dynamic_cast<SpaceShip*>(*it);
     200      float terrx = ss->getAbsCoor().x + offsetx;
     201      float terry = ss->getAbsCoor().z + offsetz;
     202      float terrz = ss->getAbsCoor().y + offsety;
     203      if ( terrz < terrain->getHeight( terrx, terry ) && ss->getAbsCoor().x > -1000 )
     204      {
     205        //PRINTF(0)("COLLLLLLIIIIIDDDDEEEE\n");
     206        ss->networkCollisionList.push_back( 1234567890 );
     207        ss->doCollideNetwork( 1234567890 );
     208      }
     209      //PRINTF(0)("x = %f, y = %f, z = %f, height = %f\n", terrx, terry, terrz, terrain->getHeight( terrx, terry ));
     210      //ss->setRelCoorSoft( ss->getAbsCoor().x, terrain->getHeight( terrx, terry )-offsety, ss->getAbsCoor().z );
     211     
     212      float dist = (dynamic_cast<Playable*>(*it)->getAbsCoor() - big_left).len();
     213      if( (dynamic_cast<Playable*>(*it)->getAbsCoor() - big_left).len() > rBig &&
     214           (dynamic_cast<Playable*>(*it)->getAbsCoor() - big_right).len() > rBig &&
     215           (dynamic_cast<Playable*>(*it)->getAbsCoor() - small_left).len() > rSmall &&
     216           (dynamic_cast<Playable*>(*it)->getAbsCoor() - small_middle).len() > rSmall &&
     217           (dynamic_cast<Playable*>(*it)->getAbsCoor() - small_right).len() > rSmall)
     218      {
     219        PRINTF(0)("KILLLLLLLL\n");
     220
     221        if((*it)->isA(CL_SPACE_SHIP))
     222        {
     223          dynamic_cast<SpaceShip*>(*it)->networkCollisionList.push_back(116369220.33434f);
     224          dynamic_cast<SpaceShip*>(*it)->doCollideNetwork(116369220.33434f);
     225        }
     226      }
     227    }
     228  }
     229
     230
     231#if 0
    186232  std::list<BaseObject*>::const_iterator it;
    187233  const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);
     
    205251    }
    206252  }
    207 
    208 
    209 }
    210 
    211 
    212 
    213 
    214 
    215 
     253#endif
     254
     255}
     256
     257
     258
     259
     260
     261
  • trunk/src/world_entities/space_ships/space_ship.h

    r7101 r7116  
    4646    virtual int       readBytes(byte* data, int maxLength, int * reciever);
    4747
    48 
    49     //HACK HACK HACK make this private or remove it
     48    //HACK HACK HACK HACK make this private or remove it
    5049    void doCollideNetwork( float energy );
     50    std::list<float>        networkCollisionList;
    5151
    5252  private:
     
    5454
    5555    void calculateVelocity(float time);
    56 
    57 
    5856
    5957    bool                  bUp;                //!< up button pressed.
     
    9189    ParticleEmitter*      burstEmitter;
    9290    ParticleSystem*       burstSystem;
    93 
    94     std::list<float>        networkCollisionList;
    9591};
    9692
Note: See TracChangeset for help on using the changeset viewer.