Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9061 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Jul 3, 2006, 6:39:10 PM (18 years ago)
Author:
patrick
Message:

merged the single_player branche to trunk

Location:
trunk/src/lib
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_reaction/cr_defs.h

    r8894 r9061  
    2929
    3030//!< the collision axis x collision event
    31 #define COLLISION_TYPE_AXIS_X   1
     31#define COLLISION_TYPE_AXIS_X      1
     32#define COLLISION_TZPE_AXIS_X_NEG  2
    3233//!< the collision axis y collision event
    33 #define COLLISION_TYPE_AXIS_Y   2
     34#define COLLISION_TYPE_AXIS_Y      3
     35#define COLLISION_TYPE_AXIS_Y_NEG  4
    3436//!< the collision axis z collision event
    35 #define COLLISION_TYPE_AXIS_Z   4
     37#define COLLISION_TYPE_AXIS_Z      5
     38#define COLLISION_TYPE_AXIS_Z_NEG  6
    3639//!< the collision is a obb collision
    3740#define COLLISION_TYPE_OBB      8
  • trunk/src/lib/collision_reaction/cr_object_damage.cc

    r9027 r9061  
    6464    damage = collision->getEntityB()->getDamage();
    6565    collision->getEntityA()->hit(damage, collision->getEntityB());
     66    PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassName());
    6667  }
    67   PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassName());
    6868
    6969  if( collision->isEntityBCollide()) {
    7070    damage = collision->getEntityA()->getDamage();
    7171    collision->getEntityB()->hit(damage, collision->getEntityA());
     72    PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassName());
    7273  }
    73   PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassName());
    7474
    7575  collision->flushCollisionEvents();
  • trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r9027 r9061  
    9595        // collision in the x-axis
    9696      case COLLISION_TYPE_AXIS_X:
    97         front = collPos.x - box->halfLength[0]; // should be [0]
     97        front = collPos.len() - box->halfLength[0]; // should be [0]
    9898
    9999        // object is beneath the plane (ground)
    100100        if( front <= 0.0f )
    101101        {
    102           Vector backoff = entity->getAbsDirX() * front;
    103 //           entity->shiftCoor(backoff);
    104         }
    105         // object is already in the wall
    106         else if( ce->isInWall())
    107         {
    108 //           entity->setAbsCoor(entity->getLastAbsCoor());
     102          Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
     103          Vector backoff = dirX * front;
     104         
     105          entity->setAbsCoor(entity->getLastAbsCoor());
     106         // entity->shiftCoor(backoff);
     107        }
     108        // object is already in the wall
     109        else if( ce->isInWall())
     110        {
     111              entity->setAbsCoor(entity->getLastAbsCoor());
     112        }
     113        break;
     114       
     115      case COLLISION_TYPE_AXIS_X_NEG:
     116        front = collPos.len() - box->halfLength[0]; // should be [0]
     117
     118        // object is beneath the plane (ground)
     119        if( front <= 0.0f )
     120        {
     121          Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
     122          Vector backoff = dirX * front * -1.0f;
     123         
     124          entity->setAbsCoor(entity->getLastAbsCoor());
     125         // entity->shiftCoor(backoff);
     126        }
     127        // object is already in the wall
     128        else if( ce->isInWall())
     129        {
     130          entity->setAbsCoor(entity->getLastAbsCoor());
    109131        }
    110132        break;
     
    112134
    113135        // collision in the y-axis
    114       case COLLISION_TYPE_AXIS_Y:
     136      case COLLISION_TYPE_AXIS_Y_NEG:
    115137        // calulate the height above ground
    116138        height = collPos.y - box->halfLength[1];
     
    118140
    119141        // object is beneath the plane (ground)
    120         if( height <= 0.0f )
    121         {
    122           entity->shiftCoor(Vector(0.0f, -height, 0.0f));
     142        if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing
     143        else if( height < 0.0f )
     144        {
     145          entity->shiftCoor(Vector(0.0f, -height + 0.00001, 0.0f));
    123146          entity->setOnGround(true);
    124147        }
     
    140163      case COLLISION_TYPE_AXIS_Z:
    141164
    142         side = collPos.z - box->halfLength[2]; // should be [2]
     165        side = collPos.len() - box->halfLength[2]; // should be [2]
    143166
    144167        // object is beneath the plane (ground)
    145168        if( side <= 0.0f )
    146169        {
    147           Vector backoff = entity->getAbsDirX() * side;
    148 //           entity->shiftCoor(backoff);
    149         }
    150         // object is already in the wall
    151         else if( ce->isInWall())
    152         {
    153 //           entity->setAbsCoor(entity->getLastAbsCoor());
     170          entity->setAbsCoor(entity->getAbsCoor());
     171          Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
     172          Vector backoff = dirZ * side;
     173          entity->shiftCoor(backoff);
     174        }
     175        // object is already in the wall
     176        else if( ce->isInWall())
     177        {
     178          entity->setAbsCoor(entity->getLastAbsCoor());
     179        }
     180        break;
     181       
     182       
     183         // collision in the z-axis
     184      case COLLISION_TYPE_AXIS_Z_NEG:
     185
     186        side = collPos.len()  - box->halfLength[2]; // should be [2]
     187
     188        // object is beneath the plane (ground)
     189        if( side <= 0.0f )
     190        {
     191         
     192          Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
     193          Vector backoff = dirZ * side*-1.0f;
     194          entity->shiftCoor(backoff);
     195        }
     196        // object is already in the wall
     197        else if( ce->isInWall())
     198        {
     199          entity->setAbsCoor(entity->getLastAbsCoor());
    154200        }
    155201        break;
  • trunk/src/lib/graphics/importer/bsp_manager.cc

    r9003 r9061  
    972972  Vector position1 = position;
    973973  Vector position2 = position + Vector(0.0,1.0,0.0);
     974  Vector position3 = position;
     975  Vector position4 = position + Vector(0.0,1.0,0.0);
    974976  Vector dest = worldEntity->getAbsCoor() - upDir*40.0f; //
    975977  Vector dest1 = position + forwardDir*4.0f;
    976978  Vector dest2 = position2 + forwardDir*4.0;
     979  Vector dest3 = position + forwardDir*4.0f;
     980  Vector dest4 = position2 + forwardDir*4.0;
    977981  dest = position - Vector(0.0, 40.0,0.0);
    978982  Vector out = dest;
     
    986990
    987991  if( box != NULL) {
    988     position = worldEntity->getAbsCoor() +  box->center + Vector(0.0, 1.0, 0.0) * box->halfLength[1];
    989     dest     = worldEntity->getAbsCoor() +  box->center - Vector(0.0, 1.0, 0.0) * (box->halfLength[1] + BSP_Y_OFFSET);
    990 
    991     position1 = worldEntity->getAbsCoor() +  box->center - worldEntity->getAbsDirX() * (box->halfLength[0]  + BSP_X_OFFSET);
    992     dest1     = worldEntity->getAbsCoor() +  box->center + worldEntity->getAbsDirX() * (box->halfLength[0]  + BSP_X_OFFSET);
    993 
    994     position2 = worldEntity->getAbsCoor() +  box->center - worldEntity->getAbsDirZ() * (box->halfLength[2]  + BSP_Z_OFFSET);
    995     dest2     = worldEntity->getAbsCoor() +  box->center + worldEntity->getAbsDirZ() * (box->halfLength[2]  + BSP_Z_OFFSET);
    996 
     992    position = worldEntity->getAbsCoor() +  box->center; // + Vector(0.0, 1.0, 0.0) * box->halfLength[1] * 1.0f;
     993    dest     = worldEntity->getAbsCoor() +  box->center - Vector(0.0, 1.0, 0.0) * (box->halfLength[1] + BSP_Y_OFFSET) *   100;
     994
     995    Vector dirX =  worldEntity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
     996
     997    //position1 = worldEntity->getAbsCoor() +  box->center - dirX * (box->halfLength[0]  + BSP_X_OFFSET);
     998    dest1     = worldEntity->getAbsCoor() +  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
     999    dest2     = worldEntity->getAbsCoor() -  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
     1000   
     1001    Vector dirZ =  worldEntity->getAbsDirZ(); dirX.y = 0.0f; dirZ.normalize();
     1002    //position2 = worldEntity->getAbsCoor() +  box->center - dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
     1003    dest3     = worldEntity->getAbsCoor() +  box->center + dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
     1004    dest4     = worldEntity->getAbsCoor() -  box->center + dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
    9971005  } else {
    9981006    // Init positions and destinations to anything useful!
     
    10521060  bool xCollision = false;
    10531061  bool zCollision = false;
     1062  bool xCollisionNeg = false;
     1063  bool zCollisionNeg = false;
     1064 
    10541065
    10551066
     
    11201131  // Return the normal here: Normal's stored in this->collPlane;
    11211132  if( collision) {
    1122     worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
     1133    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
    11231134}
    11241135  if(xCollision) {
    11251136    worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z),dest1 , SolidFlag);
    11261137  }
     1138 
    11271139  if(zCollision) {
    11281140    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), dest2 , SolidFlag);
  • trunk/src/lib/graphics/importer/bsp_manager.h

    r9003 r9061  
    2828
    2929
    30 #define BSP_X_OFFSET 20.0f
     30#define BSP_X_OFFSET 40.0f
    3131#define BSP_Y_OFFSET 40.0f
    32 #define BSP_Z_OFFSET 20.0f
     32#define BSP_Z_OFFSET 40.0f
    3333
    3434
  • trunk/src/lib/graphics/text_engine/font_data.cc

    r8765 r9061  
    279279    Glyph* tmpGlyph;
    280280
    281     if (tmpGlyph = this->glyphArray[i])
     281    if ((tmpGlyph = this->glyphArray[i]) != NULL)
    282282    {
    283283      if (tmpGlyph->height*this->renderSize > maxLineHeight)
  • trunk/src/lib/script_engine/script.cc

    r9003 r9061  
    2424
    2525#include "class_list.h"
    26 // uncommet this when the std:string and the const bug is fixed
    27 //CREATE_SCRIPTABLE_CLASS(Script, CL_SCRIPT,
    28 //                               addMethod("addObject", ExecutorLua2<Script,std::string,std::string>(&Script::addObject))
    29 //                               ):
     26CREATE_SCRIPTABLE_CLASS(Script, CL_SCRIPT,
     27                    addMethod("addObject", ExecutorLua2<Script,const std::string&, const std::string& >(&Script::addObject))
     28                    ->addMethod("selectFunction", ExecutorLua2ret<Script, bool, const std::string&, int >(&Script::selectFunction))
     29                    ->addMethod("executeFunction", ExecutorLua0ret<Script,bool >(&Script::executeFunction))
     30                     );
    3031
    3132Script::Script(const TiXmlElement* root)
     
    8182   filedest += "scripts/" + filename;
    8283   
     84   this->addThisScript();
     85   this->registerStandartClasses();
     86   
    8387   if(currentFile.length() != 0)
    8488   {
     
    97101     {
    98102      currentFile = filename;
    99       //this->addThisScript();
    100103      return true;
    101104     }
     
    119122 void Script::addObject(const std::string& className, const std::string& objectName)
    120123 {
    121   // printf("Script %p: I am about to add %s of class %s\n",this,objectName.c_str(),className.c_str());
     124   //printf("Script %s: I am about to add %s of class %s\n",this->getName(),objectName.c_str(),className.c_str());
    122125
    123126   BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS);
     
    163166 }
    164167
    165  bool Script::selectFunction(std::string& functionName, int retCount)
     168 bool Script::selectFunction(const std::string& functionName, int retCount)
    166169 {
    167170   if(returnCount == 0 && currentFunction.length() == 0) //no return values left on the stack and no other function selected
     
    356359   
    357360   //success = this->registerClass(std::string("Vector"));
    358    
     361    success = this->registerClass("ScriptTrigger");
     362
    359363   return success;
    360364 }
  • trunk/src/lib/script_engine/script.h

    r9003 r9061  
    4242    /// EXECUTING
    4343    // first select function
    44     bool selectFunction(std::string& functionName, int retCount);
     44    bool selectFunction(const std::string& functionName, int retCount);
    4545
    4646    // push parameters for luafunction
Note: See TracChangeset for help on using the changeset viewer.