Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 29, 2006, 4:03:42 PM (18 years ago)
Author:
bottac
Message:

Still not working.

Location:
branches/single_player_map/src/lib/graphics/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc

    r8907 r8910  
    8282    delete this->bspFile;
    8383}
    84  
     84
    8585int BspManager::load(const char* fileName, float scale)
    8686{
    8787  // open a BSP file
    88  
    89  
     88
     89
    9090  this->bspFile = new BspFile();
    9191  this->bspFile->scale =  scale;
    9292  if(this->bspFile->read(ResourceManager::getFullName(fileName).c_str()) == -1)
    93   return -1;
    94  
     93    return -1;
     94
    9595  this->bspFile->build_tree();
    9696  this->root  = this->bspFile->get_root();
     
    9898
    9999  this->outputFraction = 1.0f;
    100  
     100
    101101  return 0;
    102102}
     
    998998  } else {
    999999    // Init positions and destinations to anything useful!
    1000 
     1000   
    10011001  }
    10021002
     
    10451045  }
    10461046
    1047   plane* testPlane = this->collPlane;
     1047  plane* testPlane = new plane;
     1048  testPlane->x =  this->collPlane->x;
     1049  testPlane->y = this->collPlane->y;
     1050  testPlane->z = this->collPlane->z;
    10481051
    10491052
    10501053  bool xCollision = false;
    10511054  bool zCollision = false;
    1052   if(!SolidFlag) {
     1055 
    10531056
    10541057    // 2nd Collision Detection
     
    10601063    this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );
    10611064
    1062     if(!this->outputAllSolid != 1.0f) {
     1065    if(this->outputFraction < 1.0f) {
    10631066      out.x = dest1.x + (dest1.x -position1.x) * this->outputFraction;
    10641067      xCollision = true;
    10651068      testPlane = this->collPlane;
    10661069    }
    1067     if(this->outputAllSolid) {
     1070    if(this->outputAllSolid || !this->outputStartsOut) {
    10681071      SolidFlag = true;
    1069       xCollision = true; 
     1072      xCollision = true;
    10701073    }
    10711074    //out.z = this->outputFraction;
    10721075
    1073     if(!SolidFlag) {
     1076   
    10741077
    10751078      // 3rd Collision Detection
     
    10821085      //out.x = this->outputFraction;
    10831086
    1084       if(this->outputFraction != 1.0f ) {
     1087      if(this->outputFraction < 1.0f ) {
    10851088        out.z = out.z = dest2.z + (dest2.z -position2.z) * this->outputFraction;
    10861089        zCollision = true;
     
    10881091
    10891092      }
    1090       if(this->outputAllSolid) {
    1091           SolidFlag = true;
    1092           zCollision = true;   
     1093      if(this->outputAllSolid || !this->outputStartsOut) {
     1094        SolidFlag = true;
     1095        zCollision = true;
    10931096      }
    1094     }
    1095   }//end if
     1097   
     1098  //end if
    10961099  /*
    10971100  This is how you would calculate the Coordinates where worldEntity Collided with the BSP world.
     
    11041107  if( collision) {
    11051108    PRINTF(5)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction);
    1106     worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y || (xCollision ? COLLISION_TYPE_AXIS_X :0) | (zCollision ? COLLISION_TYPE_AXIS_Z :0), this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
    1107   } else {
    1108     if(xCollision || zCollision) {
    1109 
    1110       worldEntity->registerCollision((xCollision ? COLLISION_TYPE_AXIS_X :0) | (zCollision ? COLLISION_TYPE_AXIS_Z :0) , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
    1111     }
    1112 
    1113   }
     1109    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
     1110  }
     1111  if(xCollision) {
     1112    worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
     1113  }
     1114  if(zCollision) {
     1115    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
     1116  }
     1117
     1118
    11141119  //else  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y, this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest, false);
    11151120
  • branches/single_player_map/src/lib/graphics/importer/bsp_manager.h

    r8904 r8910  
    119119  ::std::deque<int> opal; //!< the others here.
    120120
    121   Vector out;  //!< For debugging only
     121  Vector out;  //!< Stores collision coordinates
    122122  Vector out1; //!< For debugging only
    123123  Vector out2; //!< For debugging only
Note: See TracChangeset for help on using the changeset viewer.