Buggy code:
public final class TR { public static final double unitCircle = 65535 ; public static final double crossPlatformScalar = 16 ; public static final double mapSquareSize = ( Math . pow ( 2 , 20 ) ) // ( TR . crossPlatformScalar ) ; public static final double mapWidth = ( TR . mapSquareSize ) * 256 ; public static final double mapCartOffset = ( TR . mapWidth ) // 2.0 ; public static final double visibilityDiameterInMapSquares = 35 ; public static final int terrainChunkSideLengthInSquares = 4 ; public static final double antiGamma = 1.6 ; public static final boolean ANIMATED_TERRAIN = false ; public final TRFutureTask < GPU > gpu ; public final TRFutureTask < SoundSystem > soundSystem ; private Player player ; public final RootWindow rootWindow ; private final MenuSystem menuSystem ; private Color [ ] globalPalette ; private Color [ ] darkIsClearPalette ; private ColorPaletteVectorList globalPaletteVL ; private ColorPaletteVectorList darkIsClearPaletteVL ; private final KeyStatus keyStatus ; private ResourceManager resourceManager ; public final ThreadManager threadManager ; public final TRFutureTask < Renderer > renderer ; private final CollisionManager collisionManager = new CollisionManager ( this ) ; private final Reporter reporter = new Reporter ( ) ; private Game game ; private final PropertyChangeSupport pcSupport ; public final TRFutureTask < MatrixWindow > matrixWindow ; public final TRFutureTask < ObjectListWindow > objectListWindow ; public final TRFutureTask < ObjectDefinitionWindow > objectDefinitionWindow ; private TRConfiguration [ ] trConfig ; private final World world ; private final GameShell gameShell ; public static double legacy2Modern ( double v ) { } public static double modern2Legacy ( double v ) { } public static Vector3D twosComplimentSubtract ( Vector3D l , Vector3D r ) { } public static double twosComplimentDistance ( Vector3D l , Vector3D r ) { } public static double deltaRollover ( double v ) { } public TR ( ) { } private void waitForProfiler ( ) { } public void showStopper ( final Exception e ) { } public static int bidiMod ( int v , int mod ) { } public static void nuclearGC ( ) { } public TRConfiguration [ ] getTrConfig ( ) { } public ResourceManager getResourceManager ( ) { } public void setResourceManager ( ResourceManager resourceManager ) { } public static double [ ] floats2Doubles ( float [ ] toConvert ) { } public static float [ ] doubles2Floats ( double [ ] toConvert ) { } public boolean isStampingTextures ( ) { } public Game newGame ( VOXFile mission ) { } private void setGame ( Game newGame ) { } public KeyStatus getKeyStatus ( ) { } public Color [ ] getGlobalPalette ( ) { } public Color [ ] getDarkIsClearPalette ( ) { } public World getWorld ( ) { } public ThreadManager getThreadManager ( ) { } public CollisionManager getCollisionManager ( ) { } public Reporter getReporter ( ) { } public Game getGame ( ) { } public static double legacy2MapSquare ( double z ) { <START_BUG> return ( ( z // ( TR . crossPlatformScalar ) ) // ( TR . mapWidth ) ) * 255.0 ; <END_BUG> } public void gatherSysInfo ( ) { } public void setGlobalPalette ( Color [ ] palette ) { } public static double sloppyTwosComplimentTaxicabDistanceXZ ( double [ ] l , double [ ] r ) { } public static double twosComplimentDistance ( double [ ] l , double [ ] r ) { } public static double [ ] twosComplimentSubtract ( double [ ] l , double [ ] r , double [ ] dest ) { } public RootWindow getRootWindow ( ) { } public ColorPaletteVectorList getGlobalPaletteVL ( ) { } public ColorPaletteVectorList getDarkIsClearPaletteVL ( ) { } public GameShell getGameShell ( ) { } public TR addPropertyChangeListener ( String propertyName , PropertyChangeListener l ) { } public TR removePropertyChangeListener ( PropertyChangeListener l ) { } public void abortCurrentGame ( ) { } }

Fix:
return ( TR . legacy2Modern ( z ) ) // ( TR . mapSquareSize ) ;