Crossfire JXClient, Trunk
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.realtime.crossfire.jxclient.map.CfAnimations Class Reference
Collaboration diagram for com.realtime.crossfire.jxclient.map.CfAnimations:
Collaboration graph

Public Member Functions

 CfAnimations (@NotNull final ItemSet itemSet, @NotNull final FacesManager facesManager, @NotNull final Animations animations)
 
void mapAdd (@NotNull final Location location, @NotNull final Animation animation, final int type)
 
void mapClear ()
 
void mapRemove (@NotNull final Location location)
 
void mapRemove (final int x, final int y)
 
void mapScroll (final int dx, final int dy)
 
void mapSetSize (final int mapWidth, final int mapHeight)
 
void mapUpdateSpeed (@NotNull final Location location, final int speed)
 
void setMapListener (@NotNull final CfAnimationsMapListener mapListener)
 
void tick (final int tickNo)
 

Private Member Functions

AnimationState add (@NotNull final Animation animation, final int type)
 
void tagAdd (final int tag, @NotNull final Animation animation, final int type)
 
void tagRemove (final int tag)
 

Private Attributes

final Animations animations
 
final Collection< AnimationStateanimationStates = new HashSet<>()
 
final FacesManager facesManager
 
final ItemSet itemSet
 
final ItemSetListener itemSetListener
 
final AnimationMap mapAnimations = new AnimationMap()
 
int mapHeight
 
CfAnimationsMapListener mapListener
 
int mapWidth
 
final Collection< AnimationStatependingTickUpdates = new ArrayList<>()
 
final ItemListener playerInventoryListener
 
int playerTag = -1
 
final Random random = new Random()
 
final Map< Integer, AnimationStatesyncAnimationStates = new HashMap<>()
 
final AnimationSet tagAnimations = new AnimationSet()
 
final Map< Integer, Integer > tags = new HashMap<>()
 
final Collection< Integer > unknownAnimations = new HashSet<>()
 

Static Private Attributes

static final Object SYNC = new Object()
 

Detailed Description

Manages a set of animated faces.

Author
Andreas Kirschbaum

Definition at line 46 of file CfAnimations.java.

Constructor & Destructor Documentation

◆ CfAnimations()

com.realtime.crossfire.jxclient.map.CfAnimations.CfAnimations ( @NotNull final ItemSet  itemSet,
@NotNull final FacesManager  facesManager,
@NotNull final Animations  animations 
)

Creates a new instance.

Parameters
itemSetthe item set to notify of changes
facesManagerthe faces manager to track for updated faces
animationsthe global animations instance

Definition at line 248 of file CfAnimations.java.

References com.realtime.crossfire.jxclient.items.ItemSet.addItemSetListener(), com.realtime.crossfire.jxclient.map.CfAnimations.animations, com.realtime.crossfire.jxclient.map.CfAnimations.facesManager, com.realtime.crossfire.jxclient.map.CfAnimations.itemSet, and com.realtime.crossfire.jxclient.map.CfAnimations.itemSetListener.

Here is the call graph for this function:

Member Function Documentation

◆ add()

AnimationState com.realtime.crossfire.jxclient.map.CfAnimations.add ( @NotNull final Animation  animation,
final int  type 
)
private

◆ mapAdd()

void com.realtime.crossfire.jxclient.map.CfAnimations.mapAdd ( @NotNull final Location  location,
@NotNull final Animation  animation,
final int  type 
)

Adds a visible map animation.

Parameters
locationthe location to animate
animationthe animation to display
typethe animation type

Definition at line 284 of file CfAnimations.java.

References com.realtime.crossfire.jxclient.map.AnimationMap.add(), com.realtime.crossfire.jxclient.map.CfAnimations.add(), and com.realtime.crossfire.jxclient.map.CfAnimations.mapAnimations.

Referenced by com.realtime.crossfire.jxclient.map.MapUpdaterState.mapAnimation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mapClear()

void com.realtime.crossfire.jxclient.map.CfAnimations.mapClear ( )

◆ mapRemove() [1/2]

void com.realtime.crossfire.jxclient.map.CfAnimations.mapRemove ( @NotNull final Location  location)

Removes a visible map animation.

Parameters
locationthe location to un-animate

Definition at line 303 of file CfAnimations.java.

References com.realtime.crossfire.jxclient.map.CfAnimations.mapAnimations, and com.realtime.crossfire.jxclient.map.AnimationMap.remove().

Here is the call graph for this function:

◆ mapRemove() [2/2]

void com.realtime.crossfire.jxclient.map.CfAnimations.mapRemove ( final int  x,
final int  y 
)

Removes all visible map animations for a tile.

Parameters
xthe x-coordinate to un-animate
ythe y-coordinate to un-animate

Definition at line 293 of file CfAnimations.java.

References com.realtime.crossfire.jxclient.map.CfAnimations.mapAnimations, com.realtime.crossfire.jxclient.protocol.Map2.NUM_LAYERS, and com.realtime.crossfire.jxclient.map.AnimationMap.remove().

Referenced by com.realtime.crossfire.jxclient.map.MapUpdaterState.mapClear(), com.realtime.crossfire.jxclient.map.MapUpdaterState.mapFace(), and com.realtime.crossfire.jxclient.map.MapUpdaterState.mapScroll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mapScroll()

void com.realtime.crossfire.jxclient.map.CfAnimations.mapScroll ( final int  dx,
final int  dy 
)

Scrolls the map animations. Map animations scrolled off the visible are are dropped.

Parameters
dxthe x-distance to scroll
dythe y-distance to scroll

Definition at line 322 of file CfAnimations.java.

References com.realtime.crossfire.jxclient.map.CfAnimations.mapAnimations, com.realtime.crossfire.jxclient.map.CfAnimations.mapHeight, com.realtime.crossfire.jxclient.map.CfAnimations.mapWidth, and com.realtime.crossfire.jxclient.map.AnimationMap.scroll().

Referenced by com.realtime.crossfire.jxclient.map.MapUpdaterState.mapScroll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mapSetSize()

void com.realtime.crossfire.jxclient.map.CfAnimations.mapSetSize ( final int  mapWidth,
final int  mapHeight 
)

Updates the map size.

Parameters
mapWidththe map width
mapHeightthe map height

Definition at line 331 of file CfAnimations.java.

References com.realtime.crossfire.jxclient.map.CfAnimations.mapClear(), com.realtime.crossfire.jxclient.map.CfAnimations.mapHeight, and com.realtime.crossfire.jxclient.map.CfAnimations.mapWidth.

Referenced by com.realtime.crossfire.jxclient.map.MapUpdaterState.newMap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mapUpdateSpeed()

void com.realtime.crossfire.jxclient.map.CfAnimations.mapUpdateSpeed ( @NotNull final Location  location,
final int  speed 
)

Updates the map animation speed value.

Parameters
locationthe location to update
speedthe new animation speed

Definition at line 312 of file CfAnimations.java.

References com.realtime.crossfire.jxclient.map.CfAnimations.mapAnimations, and com.realtime.crossfire.jxclient.map.AnimationMap.updateSpeed().

Referenced by com.realtime.crossfire.jxclient.map.MapUpdaterState.mapAnimationSpeed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMapListener()

void com.realtime.crossfire.jxclient.map.CfAnimations.setMapListener ( @NotNull final CfAnimationsMapListener  mapListener)

Sets the CfAnimationsMapListener to notify of changes.

Parameters
mapListenerthe listener to notify

Definition at line 260 of file CfAnimations.java.

References com.realtime.crossfire.jxclient.map.CfAnimations.mapListener.

Referenced by com.realtime.crossfire.jxclient.map.MapUpdaterState.MapUpdaterState().

Here is the caller graph for this function:

◆ tagAdd()

void com.realtime.crossfire.jxclient.map.CfAnimations.tagAdd ( final int  tag,
@NotNull final Animation  animation,
final int  type 
)
private

Adds a visible animation for an item tag.

Parameters
tagthe item tag to animate
animationthe animation to display
typethe animation type

Definition at line 361 of file CfAnimations.java.

References com.realtime.crossfire.jxclient.map.AnimationSet.add(), com.realtime.crossfire.jxclient.map.CfAnimations.add(), and com.realtime.crossfire.jxclient.map.CfAnimations.tagAnimations.

Here is the call graph for this function:

◆ tagRemove()

void com.realtime.crossfire.jxclient.map.CfAnimations.tagRemove ( final int  tag)
private

Removes a visible animation for an item tag.

Parameters
tagthe item tag to un-animate

Definition at line 369 of file CfAnimations.java.

References com.realtime.crossfire.jxclient.map.AnimationSet.remove(), and com.realtime.crossfire.jxclient.map.CfAnimations.tagAnimations.

Here is the call graph for this function:

◆ tick()

void com.realtime.crossfire.jxclient.map.CfAnimations.tick ( final int  tickNo)

Member Data Documentation

◆ animations

final Animations com.realtime.crossfire.jxclient.map.CfAnimations.animations
private

The global Animations instance.

Definition at line 70 of file CfAnimations.java.

Referenced by com.realtime.crossfire.jxclient.map.CfAnimations.CfAnimations().

◆ animationStates

final Collection<AnimationState> com.realtime.crossfire.jxclient.map.CfAnimations.animationStates = new HashSet<>()
private

◆ facesManager

final FacesManager com.realtime.crossfire.jxclient.map.CfAnimations.facesManager
private

◆ itemSet

final ItemSet com.realtime.crossfire.jxclient.map.CfAnimations.itemSet
private

◆ itemSetListener

final ItemSetListener com.realtime.crossfire.jxclient.map.CfAnimations.itemSetListener
private
Initial value:
= new ItemSetListener() {
@Override
public void playerChanged(@Nullable final CfItem player) {
if (!tags.isEmpty()) {
System.err.println("Warning: player inventory is not empty when changing players");
for (final int tag : tags.values()) {
tagRemove(tag);
}
tags.clear();
}
if (playerTag != -1) {
}
playerTag = player == null ? -1 : player.getTag();
if (playerTag != -1) {
}
}
@Override
public void openContainerChanged(final int tag) {
}
}

The listener added to itemSet.

Definition at line 90 of file CfAnimations.java.

Referenced by com.realtime.crossfire.jxclient.map.CfAnimations.CfAnimations().

◆ mapAnimations

final AnimationMap com.realtime.crossfire.jxclient.map.CfAnimations.mapAnimations = new AnimationMap()
private

◆ mapHeight

int com.realtime.crossfire.jxclient.map.CfAnimations.mapHeight
private

◆ mapListener

CfAnimationsMapListener com.realtime.crossfire.jxclient.map.CfAnimations.mapListener
private
Initial value:
= new CfAnimationsMapListener() {
@NotNull
@Override
public Object mapBegin() {
return SYNC;
}
@Override
public void mapFace(@NotNull final Location location, final int faceNum) {
}
@Override
public void mapEnd() {
}
}

The CfAnimationsMapListener that is notified of changes.

Definition at line 122 of file CfAnimations.java.

Referenced by com.realtime.crossfire.jxclient.map.CfAnimations.add(), com.realtime.crossfire.jxclient.map.CfAnimations.setMapListener(), and com.realtime.crossfire.jxclient.map.CfAnimations.tick().

◆ mapWidth

int com.realtime.crossfire.jxclient.map.CfAnimations.mapWidth
private

◆ pendingTickUpdates

final Collection<AnimationState> com.realtime.crossfire.jxclient.map.CfAnimations.pendingTickUpdates = new ArrayList<>()
private

◆ playerInventoryListener

final ItemListener com.realtime.crossfire.jxclient.map.CfAnimations.playerInventoryListener
private

Listener added to all items in itemSet.

Definition at line 186 of file CfAnimations.java.

◆ playerTag

int com.realtime.crossfire.jxclient.map.CfAnimations.playerTag = -1
private

The tag of the player object or

-1

if none exists.

Definition at line 240 of file CfAnimations.java.

◆ random

final Random com.realtime.crossfire.jxclient.map.CfAnimations.random = new Random()
private

The random number generator for Map2#ANIM_RANDOM type animations.

Definition at line 83 of file CfAnimations.java.

Referenced by com.realtime.crossfire.jxclient.map.CfAnimations.add().

◆ SYNC

final Object com.realtime.crossfire.jxclient.map.CfAnimations.SYNC = new Object()
staticprivate

Dummy synchronization object if no map listener has been set.

Definition at line 52 of file CfAnimations.java.

◆ syncAnimationStates

final Map<Integer, AnimationState> com.realtime.crossfire.jxclient.map.CfAnimations.syncAnimationStates = new HashMap<>()
private

◆ tagAnimations

final AnimationSet com.realtime.crossfire.jxclient.map.CfAnimations.tagAnimations = new AnimationSet()
private

◆ tags

final Map<Integer, Integer> com.realtime.crossfire.jxclient.map.CfAnimations.tags = new HashMap<>()
private

Maps inventory index to item tag.

Definition at line 235 of file CfAnimations.java.

◆ unknownAnimations

final Collection<Integer> com.realtime.crossfire.jxclient.map.CfAnimations.unknownAnimations = new HashSet<>()
private

The animation IDs for which a warning has been printed.

Definition at line 76 of file CfAnimations.java.


The documentation for this class was generated from the following file:
com.realtime.crossfire.jxclient.map.CfAnimations.itemSet
final ItemSet itemSet
Definition: CfAnimations.java:58
com.realtime.crossfire.jxclient.items.ItemSet.removeInventoryListener
void removeInventoryListener(final int tag, @NotNull final ItemListener listener)
Definition: ItemSet.java:121
com.realtime.crossfire.jxclient.map.CfAnimations.SYNC
static final Object SYNC
Definition: CfAnimations.java:52
com.realtime.crossfire.jxclient.map.CfAnimations.playerInventoryListener
final ItemListener playerInventoryListener
Definition: CfAnimations.java:186
com.realtime.crossfire.jxclient.map.CfAnimations.tags
final Map< Integer, Integer > tags
Definition: CfAnimations.java:235
com.realtime.crossfire.jxclient.items.ItemSet.addInventoryListener
void addInventoryListener(final int tag, @NotNull final ItemListener listener)
Definition: ItemSet.java:112
com.realtime.crossfire.jxclient.map.CfAnimations.tagRemove
void tagRemove(final int tag)
Definition: CfAnimations.java:369
com.realtime.crossfire.jxclient.map.CfAnimations.playerTag
int playerTag
Definition: CfAnimations.java:240