im not quite sure i understand you correctly, but but heres a slightly simplified version of the function i wrote for the site that takes the pathfind location and zonerect and gives you the x,y coordinates on the map
incase mean is lost in translation this function is
need: pathfind location, zonerect
returns: x,y location on map.
PHP Code:
function GetCoords($PathfindLocation, $ZoneRect){
//Assume Map images size
$MAP_1x = 436;
$MAP_1y = 506;
//the 2 below should always be zero
$MAP_0x = 0;
$MAP_0y = 0;
//Set Icons Width and height
$IconW = 12;
$IconH = 12;
//split the pathfind location into 2 variables (assumes there is no Z coordinate given in pathfind location
//normally i have a check that splits it differently depending on if there is 1 comma or 2.
list($LOC_x, $LOC_y) = explode(",",$PathfindLocation);
//split the zonerect up so i can use each value
list($LOC_0x, $LOC_0y, $LOC_1x, $LOC_1y) = explode(",",$ZoneRect);
$LOC_0x = $LOC_0x * -1;
//Calculate WDPP_X and WDPP_Y
$wdpp_x = ((-$LOC_1x - $LOC_0x) / $MAP_1x);
$wdpp_y = (($LOC_1y - $LOC_0y) / $MAP_1y);
//calculate Location
$MAP_x = (((-$LOC_0x + $LOC_x) / $wdpp_x) + $MAP_0x) - ($IconW / 2);
$MAP_y = (((-$LOC_0y + $LOC_y) / $wdpp_y) + $MAP_0y) - ($IconH / 2);
//round the Location so that there are no decimals
$MAP_x = round($MAP_x, 0);
$MAP_y = round($MAP_y, 0);
$xml_loc = "$MAP_x,$MAP_y";
//return location in format x,y
return($xml_loc);
//end calculations
}
does this help at all?