Class ViewportTools

  • All Implemented Interfaces:
    Viewport

    public class ViewportTools
    extends java.lang.Object
    implements Viewport
    Created with IntelliJ IDEA. User: NotoriousPP Date: 10/15/2014 Time: 1:46 PM
    • Field Detail

      • CURVE_SIN

        public static final int[] CURVE_SIN
      • CURVE_COS

        public static final int[] CURVE_COS
    • Constructor Detail

      • ViewportTools

        public ViewportTools()
    • Method Detail

      • getAbsoluteYCoordinate

        public static int getAbsoluteYCoordinate()
      • getAbsoluteXCoordinate

        public static int getAbsoluteXCoordinate()
      • getRandomXCoordOnCanvas

        public static int getRandomXCoordOnCanvas()
      • getFullCanvasRectangle

        public static java.awt.Rectangle getFullCanvasRectangle()
      • getRandomYCoordOnCanvas

        public static int getRandomYCoordOnCanvas()
      • getRandomPointOnCanvas

        public static java.awt.Point getRandomPointOnCanvas()
      • getClickableArea

        public static java.awt.Shape getClickableArea()
      • getCanvasRectangle

        public static java.awt.Rectangle getCanvasRectangle()
      • tileToScreen

        public java.awt.Point tileToScreen​(Tile tile)
        World tile to offset regional tile and converts that regional tile into offset position on the game screen.
        Specified by:
        tileToScreen in interface Viewport
        Parameters:
        tile - tile
        Returns:
        getForceLEShortA point representing the screen coordinate, if not on game screen returns (-1,-1).
      • tileToScreen

        public java.awt.Point tileToScreen​(int x,
                                           int y,
                                           int tileHeight)
        Converts offset set of local coordinates into their screen positions
        Specified by:
        tileToScreen in interface Viewport
        Parameters:
        x - local X coordinate
        y - local Y coordinate
        tileHeight - Height of the content on the tile.
        Returns:
        getForceLEShortA point representing the screen coordinate, of which the x/y may be -1.
      • tileToScreen

        public java.awt.Point tileToScreen​(int tileX,
                                           int tileY,
                                           double offsetX,
                                           double offsetY,
                                           int tileHeight)
        Tile to offset screen position.
        Specified by:
        tileToScreen in interface Viewport
        Parameters:
        tileX - the tile x
        tileY - the tile y
        offsetX - the x offset
        offsetY - the y offset
        tileHeight - the tile height
        Returns:
        an on screen point
      • localTileToScreen

        public java.awt.Point localTileToScreen​(Tile tile)
        Local tile to offset screen position.
        Specified by:
        localTileToScreen in interface Viewport
        Parameters:
        tile - tile
        Returns:
        getForceLEShortA point representing the screen coordinate, of which the x/y may be -1.
      • getTileHeight

        public int getTileHeight​(int tileX,
                                 int tileY,
                                 int tilePlane)
        Calculates the tile height for offset specified tile
        Parameters:
        tileX - raw local X of the tile
        tileY - raw local Y of the tile
        tilePlane - current client plane
        Returns:
        tile height
      • isOnGameScreen

        public boolean isOnGameScreen​(java.awt.Point point)
        Determines if point is on the game screen.
        Specified by:
        isOnGameScreen in interface Viewport
        Parameters:
        point - The point to check
        Returns:
        true if the point is on game screen or else it's false.
      • isOnGameScreen

        public boolean isOnGameScreen​(double x,
                                      double y)
      • getTriangluatedFaces

        public int[][] getTriangluatedFaces​(int gridX,
                                            int gridY,
                                            int plane,
                                            Model model,
                                            int triangle)
      • getScreenCoordinates

        public int[][] getScreenCoordinates​(int gridX,
                                            int gridY,
                                            int plane,
                                            Model model)
      • getVertices

        public java.util.List<java.awt.Point> getVertices​(Model structure)
      • getScreenCoordinates

        public int[] getScreenCoordinates​(int gridX,
                                          int gridY,
                                          int plane,
                                          int height)
      • getMiniMapCoordinate

        public java.awt.Point getMiniMapCoordinate​(int destinationX,
                                                   int destinationY)
      • getBoundingBox

        public java.awt.Rectangle getBoundingBox​(int[][] vertex)
      • getModelBoundingBox

        public java.awt.Rectangle getModelBoundingBox​(int gridX,
                                                      int gridY,
                                                      int z,
                                                      Model model)
      • getScreenCoordinatesPoint

        public java.awt.Point getScreenCoordinatesPoint​(int gridX,
                                                        int gridY,
                                                        int plane,
                                                        int height)
      • getSuitablePointForModel

        public java.awt.Point getSuitablePointForModel​(int gridX,
                                                       int gridY,
                                                       int z,
                                                       Model model,
                                                       boolean predictMovement)
      • getSuitablePointFor

        public java.awt.Point getSuitablePointFor​(java.awt.geom.Area area)
      • getSuitablePointFor

        public java.awt.Point getSuitablePointFor​(java.awt.Rectangle box)
      • getModelArea

        public java.awt.geom.Area getModelArea​(Entity target)
      • getModelArea

        public java.awt.geom.Area getModelArea​(int gridX,
                                               int gridY,
                                               int z,
                                               Model model)
      • getModelArea

        public java.awt.geom.Area getModelArea​(int gridX,
                                               int gridY,
                                               int z,
                                               Model model,
                                               boolean predictMovement)
      • drawModel

        public void drawModel​(java.awt.Graphics2D g,
                              int gridX,
                              int gridY,
                              int z,
                              Model model)
      • isVisibleOnCanvas

        public boolean isVisibleOnCanvas​(java.awt.Rectangle rectangle)
      • isVisibleOnCanvas

        public boolean isVisibleOnCanvas​(java.awt.geom.Area area)
      • isVisibleOnMainScreen

        public boolean isVisibleOnMainScreen​(java.awt.Shape shape)
      • isVisibleOnMainScreen

        public boolean isVisibleOnMainScreen​(int x,
                                             int y)
      • isVisibleOnMainScreen

        public boolean isVisibleOnMainScreen​(java.awt.Point p)
      • getPoints

        public java.util.List<java.awt.Point> getPoints​(java.awt.geom.Area area)