- for(i = 1; i < v; ++i)
- {
- if( issolid(pbase->x + 1, pbase->y + i*16))
- return true;
- }
- for(i = 1; i < v; ++i)
- {
- if( issolid(pbase->x + pbase->width - 1, pbase->y + i*16))
- return true;
+void* collision_func(const base_type& base, tiletestfunction function)
+{
+ const Level& level = *World::current()->get_level();
+ TileManager& tilemanager = *TileManager::instance();
+
+ int starttilex = int(base.x) / 32;
+ int starttiley = int(base.y) / 32;
+ int max_x = int(base.x + base.width);
+ int max_y = int(base.y + base.height);
+
+ for(int x = starttilex; x*32 < max_x; ++x) {
+ for(int y = starttiley; y*32 < max_y; ++y) {
+ Tile* tile = tilemanager.get(level.get_tile_at(x, y));
+ void* result = function(tile);
+ if(result != 0)
+ return result;