set_rectangle_rectangle_constraints(constraints, rect, area);
} else {
if(outvec.x < 0) {
- constraints->min_right(rect.get_right() + outvec.x);
+ constraints->constrain_right(rect.get_right() + outvec.x);
} else {
- constraints->max_left(rect.get_left() + outvec.x);
+ constraints->constrain_left(rect.get_left() + outvec.x);
}
if(outvec.y < 0) {
- constraints->min_bottom(rect.get_bottom() + outvec.y);
+ constraints->constrain_bottom(rect.get_bottom() + outvec.y);
constraints->hit.bottom = true;
constraints->ground_movement += addl_ground_movement;
} else {
- constraints->max_top(rect.get_top() + outvec.y);
+ constraints->constrain_top(rect.get_top() + outvec.y);
constraints->hit.top = true;
}
constraints->hit.slope_normal = normal;
float horiz_penetration = std::min(ileft, iright);
if(vert_penetration < horiz_penetration) {
if(itop < ibottom) {
- constraints->min_bottom(r2.get_top());
+ constraints->constrain_bottom(r2.get_top());
constraints->hit.bottom = true;
constraints->ground_movement += addl_ground_movement;
} else {
- constraints->max_top(r2.get_bottom());
+ constraints->constrain_top(r2.get_bottom());
constraints->hit.top = true;
}
} else {
if(ileft < iright) {
- constraints->min_right(r2.get_left());
+ constraints->constrain_right(r2.get_left());
constraints->hit.right = true;
} else {
- constraints->max_left(r2.get_right());
+ constraints->constrain_left(r2.get_right());
constraints->hit.left = true;
}
}
float top;
float bottom;
- void max_left (float left2 ) { left = std::max(left , left2 ); }
- void min_right (float right2 ) { right = std::min(right , right2 ); }
- void max_top (float top2 ) { top = std::max(top , top2 ); }
- void min_bottom(float bottom2) { bottom = std::min(bottom, bottom2); }
+ void constrain_left (float left2 ) { left = std::max(left , left2 ); }
+ void constrain_right (float right2 ) { right = std::min(right , right2 ); }
+ void constrain_top (float top2 ) { top = std::max(top , top2 ); }
+ void constrain_bottom(float bottom2) { bottom = std::min(bottom, bottom2); }
Vector ground_movement;
CollisionHit hit;
if(fabsf(movement.y) > fabsf(movement.x)) {
if(ileft < SHIFT_DELTA) {
- constraints->min_right(r2.get_left());
+ constraints->constrain_right(r2.get_left());
return;
} else if(iright < SHIFT_DELTA) {
- constraints->max_left(r2.get_right());
+ constraints->constrain_left(r2.get_right());
return;
}
} else {
// shiftout bottom/top
if(itop < SHIFT_DELTA) {
- constraints->min_bottom(r2.get_top());
+ constraints->constrain_bottom(r2.get_top());
return;
} else if(ibottom < SHIFT_DELTA) {
- constraints->max_top(r2.get_bottom());
+ constraints->constrain_top(r2.get_bottom());
return;
}
}
float horiz_penetration = std::min(ileft, iright);
if(vert_penetration < horiz_penetration) {
if(itop < ibottom) {
- constraints->min_bottom(r2.get_top());
+ constraints->constrain_bottom(r2.get_top());
constraints->hit.bottom = true;
} else {
- constraints->max_top(r2.get_bottom());
+ constraints->constrain_top(r2.get_bottom());
constraints->hit.top = true;
}
} else {
if(ileft < iright) {
- constraints->min_right(r2.get_left());
+ constraints->constrain_right(r2.get_left());
constraints->hit.right = true;
} else {
- constraints->max_left(r2.get_right());
+ constraints->constrain_left(r2.get_right());
constraints->hit.left = true;
}
}