- if(other.get_flags() & FLAG_PORTABLE) {
- Portable* portable = dynamic_cast<Portable*> (&other);
- if(portable && grabbed_object == 0 && controller->hold(Controller::ACTION)
- && fabsf(hit.normal.x) > .9) {
- grabbed_object = portable;
- return CONTINUE;
- }
- }
-
- if(other.get_flags() & FLAG_SOLID) {
- /*
- printf("Col %p: HN: %3.1f %3.1f D %.1f P: %3.1f %3.1f M: %3.1f %3.1f\n",
- &other,
- hit.normal.x, hit.normal.y, hit.depth,
- get_pos().x, get_pos().y,
- movement.x, movement.y);
- */
-
- if(hit.normal.y < 0) { // landed on floor?
- if(physic.get_velocity_y() < 0)
- physic.set_velocity_y(0);
-
- on_ground_flag = true;
-
- // remember normal of this tile
- if (hit.normal.y > -0.9) {
- floor_normal.x = hit.normal.x;
- floor_normal.y = hit.normal.y;
- } else {
- // slowly adjust to unisolid tiles.
- // Necessary because our bounding box sometimes reaches through slopes and thus hits unisolid tiles
- floor_normal.x = (floor_normal.x * 0.9) + (hit.normal.x * 0.1);
- floor_normal.y = (floor_normal.y * 0.9) + (hit.normal.y * 0.1);
- }
-
- // hack platforms so that we stand normally on them when going down...
- Platform* platform = dynamic_cast<Platform*> (&other);
- if(platform != NULL) {
- if(platform->get_speed().y > 0)
- physic.set_velocity_y(-platform->get_speed().y);
- //physic.set_velocity_x(platform->get_speed().x);
- }
- } else if(hit.normal.y > 0) { // bumped against the roof
- physic.set_velocity_y(.1);
-
- // hack platform so that we are not glued to it from below
- Platform* platform = dynamic_cast<Platform*> (&other);
- if(platform != NULL) {
- physic.set_velocity_y(-platform->get_speed().y);
- }
- }
-
- if(fabsf(hit.normal.x) > .9) { // hit on the side?
- physic.set_velocity_x(0);
- }
-
- MovingObject* omov = dynamic_cast<MovingObject*> (&other);
- if(omov != NULL) {
- Vector mov = movement - omov->get_movement();
- /*
- printf("W %p - HITN: %3.1f %3.1f D:%3.1f TM: %3.1f %3.1f TD: %3.1f %3.1f PM: %3.2f %3.1f\n",
- omov,
- hit.normal.x, hit.normal.y,
- hit.depth,
- movement.x, movement.y,
- dest.p1.x, dest.p1.y,
- omov->get_movement().x, omov->get_movement().y);
- */
- }
-
- return CONTINUE;