1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
MotionRect::hit_t MotionRect::DoMoveHit(Map::Block& blk,Point& mov,const Map::Corner*& cornerhit,const Map::Line*& linehit,bool dropthru)
{
hit_t hit = hit_none;
double dropx = dropthru ? 2.0 : mSlideFootUnit.x;
if(blk.PointMove( Pt(Focal), mov, &linehit, dropx )) hit = hit_focal;
if(blk.PointMove( Pt(SL), mov, &linehit )) hit = hit_vlcorner;
if(blk.PointMove( Pt(SR), mov, &linehit )) hit = hit_vrcorner;
if(blk.LineMove( Pt(UL), Pt(SL), mov, &cornerhit )) hit = hit_lside;
if(blk.LineMove( Pt(UR), Pt(SR), mov, &cornerhit )) hit = hit_rside;
if(blk.LineMove( Pt(UL), Pt(UR), mov, &cornerhit )) hit = hit_top;
if(blk.LineMove( Pt(Focal), Pt(SL), mov, &cornerhit )) hit = hit_vlside;
if(blk.LineMove( Pt(Focal), Pt(SR), mov, &cornerhit )) hit = hit_vrside;
// have to test the upper left/right corners last, to reduce side effects
if(blk.PointMove( Pt(UL), mov, &linehit )) hit = hit_ul;
if(blk.PointMove( Pt(UR), mov, &linehit )) hit = hit_ur;
return hit;
}
|