someone could help me about Map
Posted: Fri Jan 28, 2011 4:14 am
i've read some source of L2j. i wanna research the map technology.
but may be i am too dull to understand the below code
thanks i wanna someone help me to comprehend this code
but may be i am too dull to understand the below code
Code: Select all
/* * biteshift, defines number of regions * note, shifting by 15 will result in regions corresponding to map tiles * shifting by 12 divides one tile to 8x8 regions */ public static final int SHIFT_BY = 12; private static final int TILE_SIZE = 32768;//why here is 32768 /** Map dimensions */ //why subtractor is 17 18 19 20... public static final int MAP_MIN_X = (Config.WORLD_X_MIN - 20) * TILE_SIZE; public static final int MAP_MAX_X = (Config.WORLD_X_MAX - 19) * TILE_SIZE; public static final int MAP_MIN_Y = (Config.WORLD_Y_MIN - 18) * TILE_SIZE; public static final int MAP_MAX_Y = (Config.WORLD_Y_MAX - 17) * TILE_SIZE; /** calculated offset used so top left region is 0,0 */ public static final int OFFSET_X = Math.abs(MAP_MIN_X >> SHIFT_BY); public static final int OFFSET_Y = Math.abs(MAP_MIN_Y >> SHIFT_BY); /** number of regions */ private static final int REGIONS_X = (MAP_MAX_X >> SHIFT_BY) + OFFSET_X; private static final int REGIONS_Y = (MAP_MAX_Y >> SHIFT_BY) + OFFSET_Y;