monrovia.client.ui
Class Map

java.lang.Object
  |
  +--monrovia.client.ui.Map

public class Map
extends java.lang.Object

This is the class for the game map which is built from bitmap tiles. The map can be redrawn when the game situation changes. The class has two inner structures. The other lists all the static objects and the other lists the dymanic objects which can change during the game. If the dynamic object for the file can't be found, the static tile will be drawn. Otherwise the dynamic will be drawn. Coordinates (0,0) represent the upper left corner of the map.


Constructor Summary
Map(int pScreenX, int pScreenY, int pTilesPerRow, int pBitmapWidth)
          Constructor for the map.
 
Method Summary
 void clear()
          Clears the dynamic map objects.
 boolean init(short[][] pAreaMap)
          Initializer for the map array structure of the bitmaps.
 void paint()
          Paint the bitmaps which make the map on the screen.
 void registerBitmap(int pBitmapID, short[] pBitmapData)
          Introduce a new bitmap to be shown in the map.
 void updateMap(int pDX, int pDY, int pTileID)
          Updates a dynamic map object.
 void updatePosition(int pX, int pY)
          Set a new center (player) position so that the map can be scrolled in the display.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Map

public Map(int pScreenX,
           int pScreenY,
           int pTilesPerRow,
           int pBitmapWidth)
Constructor for the map.
Parameters:
pScreenX - x coordinate of the upper left corner of the map
pScreenY - y coordinate of the upper left corner of the map
pTilesPerRow - number of the bitmap tiles per one map row
pBitmapWidth - the width (and the height) of one bitmap
Method Detail

init

public boolean init(short[][] pAreaMap)
Initializer for the map array structure of the bitmaps.
Parameters:
pAreaMap - the area map array
Returns:
true - initialization was successful
false - map data was somehow incorrect

registerBitmap

public void registerBitmap(int pBitmapID,
                           short[] pBitmapData)
Introduce a new bitmap to be shown in the map. This is done when the player enters to the new arena.
Parameters:
pBitmapID - ID number of the new bitmap
pBitmapData - data of the bitmap in Palm bitmap form

updatePosition

public void updatePosition(int pX,
                           int pY)
Set a new center (player) position so that the map can be scrolled in the display.
Parameters:
pX - X coordinate of the position
pY - Y coordinate of the position

clear

public void clear()
Clears the dynamic map objects.

updateMap

public void updateMap(int pDX,
                      int pDY,
                      int pTileID)
Updates a dynamic map object. Note that the coordinates are relative to the player position.
Parameters:
pDX - relative X coordinate of the new dynamic object
pDY - relative Y coordinate of the new dynamic object
pTileID - bitmap ID of the dynamic object

paint

public void paint()
Paint the bitmaps which make the map on the screen.