| 51 | } |
| 52 | |
| 53 | void SnapItemToGrid(ItemInfo* item, CollisionInfo* coll) |
| 54 | { |
| 55 | SnapItemToLedge(item, coll); |
| 56 | |
| 57 | int direction = (unsigned short)(item->Pose.Orientation.y + ANGLE(45.0f)) / ANGLE(90.0f); |
| 58 | |
| 59 | switch (direction) |
| 60 | { |
| 61 | case NORTH: |
| 62 | item->Pose.Position.z = (item->Pose.Position.z | WALL_MASK) - coll->Setup.Radius; |
| 63 | break; |
| 64 | |
| 65 | case EAST: |
| 66 | item->Pose.Position.x = (item->Pose.Position.x | WALL_MASK) - coll->Setup.Radius; |
| 67 | break; |
| 68 | |
| 69 | case SOUTH: |
| 70 | item->Pose.Position.z = (item->Pose.Position.z & ~WALL_MASK) + coll->Setup.Radius; |
| 71 | break; |
| 72 | |
| 73 | case WEST: |
| 74 | item->Pose.Position.x = (item->Pose.Position.x & ~WALL_MASK) + coll->Setup.Radius; |
| 75 | break; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | int FindGridShift(int x, int z) |
| 80 | { |