Refactor nested looping in collision detection.

Refactoring this allows collision detection to exit as soon as it's
found a colliding tile in the direction it's checking. It also made the
code a little easier to read since the main function isn't so long now.

This is just like it was before (almost), but now that I've worked
through it again mentally, things make a lot more sense...for example,
instead of returning a boolean and a pair of points in gTiles indicating
which tile collided, I just return a pointer to the colliding tile, or
NULL otherwise.