Expose MapElevation function to JS for retrieving Z level
Posted: Sun Mar 15, 2009 4:17 pm
We currently have the following bit of code in mapstuff.cpp to retrieve the elevation of the map at some given coordinates:
As far as I can see we don't have this exposed to the JS engine, though it would be very handy if that was the case.
Code: Select all
// return the elevation of MAP0.MUL at given coordinates, we'll assume since its land
// the height is inherently 0
SI08 CMulHandler::MapElevation( SI16 x, SI16 y, UI08 worldNumber )
{
const map_st map = SeekMap( x, y, worldNumber );
// make sure nothing can move into black areas
if( 430 == map.id || 431 == map.id || 432 == map.id ||
433 == map.id || 434 == map.id || 475 == map.id ||
580 == map.id || 610 == map.id || 611 == map.id ||
612 == map.id || 613 == map.id)
return ILLEGAL_Z;
return map.z;
}