Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by fsdf ( 15 years ago )
void Map::toMapCoordinates( int* mx, int* my )
{
 signed int x, y;
 x = ( 2 * (*my) + (*mx) ) / 2;
    y = ( 2 * (*my) - (*mx) ) / 2;
    *mx = x >> Defines.lTileSize;
    *my = y >> Defines.lTileSize;
}

void Map::fromMapCoordinates( int* x, int* y )
{
 signed int mx, my;
 *x <<= Defines.lTileSize;
 *y <<= Defines.lTileSize;
 mx = (*x) - (*y);
 my = (*x) / 2 - (*y) / 2;
 *x = mx;
 *y = my;
}

 

Revise this Paste

Your Name: Code Language: