wyvern.common.tiles
Class TileInfo

java.lang.Object
  extended bywyvern.common.tiles.TileInfo

public final class TileInfo
extends java.lang.Object

This class encapsulates information about a set of images in the database. Many images have more than one direction for the image, and some images have multiple animation frames per direction.

A TileInfo is never created for images with no directions or animations.

Version:
1.0, Jun 17, 1998
Author:
Steve Yegge

Field Summary
static int D
           
static int E
           
static int N
           
static int NE
           
static TileInfo NO_INFO
          A placeholder for wyvern.lib.properties.Appearance that tells us not to keep looking for the info.
static int NONE
           
static int NUM_DIRS
           
static int NW
           
static int S
           
static int SE
           
static int SW
           
static int U
           
static int W
           
 
Method Summary
 int[] getDirections()
          Returns an array of the directions available for this image.
 java.lang.String[] getDirs()
          Returns a list of the directions available for this image.
 java.lang.String getName()
          Returns the base name for this tile (e.g.
 int getNumDirs()
          Returns the number of directional versions there are of the base image.
 int getNumFrames()
          Returns the number of animation frames per direction.
 java.lang.String getPath()
          Returns the relative art path for this image.
 int getTile(int dir, int frame)
          Returns the tile number for the specified direction and animation frame for the object.
 java.lang.String toString()
          Returns a String representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_INFO

public static final TileInfo NO_INFO
A placeholder for wyvern.lib.properties.Appearance that tells us not to keep looking for the info.


NONE

public static final int NONE
See Also:
Constant Field Values

N

public static final int N
See Also:
Constant Field Values

S

public static final int S
See Also:
Constant Field Values

E

public static final int E
See Also:
Constant Field Values

W

public static final int W
See Also:
Constant Field Values

NE

public static final int NE
See Also:
Constant Field Values

NW

public static final int NW
See Also:
Constant Field Values

SE

public static final int SE
See Also:
Constant Field Values

SW

public static final int SW
See Also:
Constant Field Values

U

public static final int U
See Also:
Constant Field Values

D

public static final int D
See Also:
Constant Field Values

NUM_DIRS

public static final int NUM_DIRS
See Also:
Constant Field Values
Method Detail

getTile

public int getTile(int dir,
                   int frame)
Returns the tile number for the specified direction and animation frame for the object.

Parameters:
dir - a wyvern.lib.Direction constant
frame - the animation frame (0 if not animated)
Returns:
the tile number, if there's a match, or -1 if we didn't have this particular dir + frame

getName

public java.lang.String getName()
Returns the base name for this tile (e.g. "fireball")


getPath

public java.lang.String getPath()
Returns the relative art path for this image.

Returns:
the relative path, such as "wiz/foo/bar" or "monsters/undead"

getNumDirs

public int getNumDirs()
Returns the number of directional versions there are of the base image. For instance, if there's a "ratS", "ratN", "ratE" and "ratW", then there are four directions available. If the image is something like "bureau", with no directions, it returns zero.


getNumFrames

public int getNumFrames()
Returns the number of animation frames per direction.

For example, if there's a "fireball.1" and "fireball.2", then it's 2. If an image group consists of "dog.N", "dog.S", then it's 1. (Basically it returns the highest number it finds at the end of an image group).


getDirs

public java.lang.String[] getDirs()
Returns a list of the directions available for this image. The directions are strings, such as "N" or "SW".

Returns:
an array of direction strings; will always be non-null, even if there are zero available directions (which shouldn't happen, in any case).

getDirections

public int[] getDirections()
Returns an array of the directions available for this image.


toString

public java.lang.String toString()
Returns a String representation of this object.