Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.map.CfMapAnimations Class Reference

Manages a set of animated map squares. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.map.CfMapAnimations:

Public Member Functions

void add (@NotNull final MapUpdaterState mapUpdaterState, @NotNull final Location location, @NotNull final Animation animation, final int type)
 Adds a visible animation. More...
 
void clear ()
 Forgets all animations. More...
 
void remove (final int x, final int y)
 Removes all visible animations for a tile. More...
 
void remove (@NotNull final Location location)
 Removes a visible animation. More...
 
void scroll (final int dx, final int dy)
 Scrolls the animations. More...
 
void setMapSize (final int width, final int height)
 Updates the map size. More...
 
void tick (@NotNull final MapUpdaterState mapUpdaterState, final int tickNo)
 Processes a tick command. More...
 
void updateSpeed (@NotNull final MapUpdaterState mapUpdaterState, @NotNull final Location location, final int speed)
 Updates the animation speed value. More...
 

Private Attributes

final AnimationMap animations = new AnimationMap()
 The animations in the visible map area. More...
 
final Map< AnimationState, Void > animationStates = new WeakHashMap<>()
 All AnimationState instances referenced by animations. More...
 
int height
 The height of the visible map area. More...
 
final Collection< AnimationStatependingTickUpdates = new ArrayList<>()
 The AnimationState instances that have been added but not yet received a "tick" value. More...
 
final Random random = new Random()
 The random number generator for Map2#ANIM_RANDOM type animations. More...
 
final Map< Integer, AnimationStatesyncAnimationStates = new HashMap<>()
 All AnimationState for Map2#ANIM_SYNC animations. More...
 
int width
 The width of the visible map area. More...
 

Detailed Description

Manages a set of animated map squares.

Author
Andreas Kirschbaum

Definition at line 38 of file CfMapAnimations.java.

Member Function Documentation

◆ add()

void com.realtime.crossfire.jxclient.map.CfMapAnimations.add ( @NotNull final MapUpdaterState  mapUpdaterState,
@NotNull final Location  location,
@NotNull final Animation  animation,
final int  type 
)

Adds a visible animation.

Parameters
mapUpdaterStatethe map updater state instance to use
locationthe location to animate
animationthe animation to display
typethe animation type

Definition at line 99 of file CfMapAnimations.java.

References com.realtime.crossfire.jxclient.map.AnimationMap.add(), com.realtime.crossfire.jxclient.protocol.Map2.ANIM_NORMAL, com.realtime.crossfire.jxclient.protocol.Map2.ANIM_RANDOM, and com.realtime.crossfire.jxclient.protocol.Map2.ANIM_SYNC.

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:

◆ clear()

void com.realtime.crossfire.jxclient.map.CfMapAnimations.clear ( )

Forgets all animations.

Definition at line 85 of file CfMapAnimations.java.

References com.realtime.crossfire.jxclient.map.AnimationMap.clear().

Referenced by com.realtime.crossfire.jxclient.map.MapUpdaterState.mapScroll(), and com.realtime.crossfire.jxclient.map.CfMapAnimations.setMapSize().

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

◆ remove() [1/2]

void com.realtime.crossfire.jxclient.map.CfMapAnimations.remove ( final int  x,
final int  y 
)

Removes all visible animations for a tile.

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

Definition at line 144 of file CfMapAnimations.java.

References 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:

◆ remove() [2/2]

void com.realtime.crossfire.jxclient.map.CfMapAnimations.remove ( @NotNull final Location  location)

Removes a visible animation.

Parameters
locationthe location to un-animate

Definition at line 154 of file CfMapAnimations.java.

References com.realtime.crossfire.jxclient.map.AnimationMap.remove().

+ Here is the call graph for this function:

◆ scroll()

void com.realtime.crossfire.jxclient.map.CfMapAnimations.scroll ( final int  dx,
final int  dy 
)

Scrolls the animations.

Animations scrolled off the visible are are dropped.

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

Definition at line 174 of file CfMapAnimations.java.

References 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:

◆ setMapSize()

void com.realtime.crossfire.jxclient.map.CfMapAnimations.setMapSize ( final int  width,
final int  height 
)

Updates the map size.

Parameters
widththe map width
heightthe map height

Definition at line 202 of file CfMapAnimations.java.

References com.realtime.crossfire.jxclient.map.CfMapAnimations.clear(), com.realtime.crossfire.jxclient.map.CfMapAnimations.height, and com.realtime.crossfire.jxclient.map.CfMapAnimations.width.

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:

◆ tick()

void com.realtime.crossfire.jxclient.map.CfMapAnimations.tick ( @NotNull final MapUpdaterState  mapUpdaterState,
final int  tickNo 
)

Processes a tick command.

Parameters
mapUpdaterStatethe instance to update
tickNothe current tick number

Definition at line 183 of file CfMapAnimations.java.

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

+ Here is the caller graph for this function:

◆ updateSpeed()

void com.realtime.crossfire.jxclient.map.CfMapAnimations.updateSpeed ( @NotNull final MapUpdaterState  mapUpdaterState,
@NotNull final Location  location,
final int  speed 
)

Updates the animation speed value.

Parameters
mapUpdaterStatethe map updater state instance to use
locationthe location to update
speedthe new animation speed

Definition at line 164 of file CfMapAnimations.java.

References 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:

Member Data Documentation

◆ animations

final AnimationMap com.realtime.crossfire.jxclient.map.CfMapAnimations.animations = new AnimationMap()
private

The animations in the visible map area.

Definition at line 61 of file CfMapAnimations.java.

◆ animationStates

final Map<AnimationState, Void> com.realtime.crossfire.jxclient.map.CfMapAnimations.animationStates = new WeakHashMap<>()
private

All AnimationState instances referenced by animations.

Definition at line 67 of file CfMapAnimations.java.

◆ height

int com.realtime.crossfire.jxclient.map.CfMapAnimations.height
private

The height of the visible map area.

Definition at line 55 of file CfMapAnimations.java.

Referenced by com.realtime.crossfire.jxclient.map.CfMapAnimations.setMapSize().

◆ pendingTickUpdates

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

The AnimationState instances that have been added but not yet received a "tick" value.

Definition at line 80 of file CfMapAnimations.java.

◆ random

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

The random number generator for Map2#ANIM_RANDOM type animations.

Definition at line 45 of file CfMapAnimations.java.

◆ syncAnimationStates

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

All AnimationState for Map2#ANIM_SYNC animations.

Definition at line 73 of file CfMapAnimations.java.

◆ width

int com.realtime.crossfire.jxclient.map.CfMapAnimations.width
private

The width of the visible map area.

Definition at line 50 of file CfMapAnimations.java.

Referenced by com.realtime.crossfire.jxclient.map.CfMapAnimations.setMapSize().


The documentation for this class was generated from the following file: