RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.fs.cache.decoder.AnimationDefinitionDecoder Class Reference

A class which parses animation definitions. More...

Inheritance diagram for com.runehive.fs.cache.decoder.AnimationDefinitionDecoder:
Collaboration diagram for com.runehive.fs.cache.decoder.AnimationDefinitionDecoder:

Public Member Functions

 AnimationDefinitionDecoder (final FileSystem fs)
void run ()

Static Public Attributes

static final Int2ObjectMap< AnimationDefinitiondefinitions = new Int2ObjectOpenHashMap<>()

Private Attributes

final FileSystem fs
 The IndexedFileSystem.

Static Private Attributes

static final Logger LOGGER = LogManager.getLogger(AnimationDefinitionDecoder.class)
 The logger to log process output.

Detailed Description

A class which parses animation definitions.

Definition at line 15 of file AnimationDefinitionDecoder.java.

Constructor & Destructor Documentation

◆ AnimationDefinitionDecoder()

com.runehive.fs.cache.decoder.AnimationDefinitionDecoder.AnimationDefinitionDecoder ( final FileSystem fs)

Definition at line 25 of file AnimationDefinitionDecoder.java.

25 {
26 this.fs = fs;
27 }

References fs.

Member Function Documentation

◆ run()

void com.runehive.fs.cache.decoder.AnimationDefinitionDecoder.run ( )

Definition at line 30 of file AnimationDefinitionDecoder.java.

30 {
31 LOGGER.info("Loading animation definitions.");
32
33 final Archive archive = fs.getArchive(FileSystem.CONFIG_ARCHIVE);
34 final ByteBuf buffer = Unpooled.wrappedBuffer(archive.getData("seq.dat"));
35 try {
36 final int highestFileId = buffer.readUnsignedShort();
37 for (int i = 0; i <= highestFileId; i++) {
38 final int id = buffer.readUnsignedShort();
39 if (id == 65535) break;
40
41 final int length = buffer.readUnsignedShort();
42 final ByteBuf animBuffer = buffer.readBytes(length);
43 try {
44 final AnimationDefinition definition = new AnimationDefinition(id);
45 definition.decode(animBuffer);
46
47 definitions.put(id, definition);
48 } finally {
49 animBuffer.release();
50 }
51
52 if (id >= highestFileId) break;
53 }
54 } finally {
55 buffer.release();
56 }
57
58 LOGGER.info("Loaded " + definitions.size() + " animation definitions.");
59 }

References com.runehive.fs.cache.FileSystem.CONFIG_ARCHIVE, com.runehive.fs.cache.decoder.AnimationDefinition.decode(), definitions, fs, and LOGGER.

Referenced by com.runehive.RuneHive.processSequentialStartupTasks().

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

Member Data Documentation

◆ definitions

final Int2ObjectMap<AnimationDefinition> com.runehive.fs.cache.decoder.AnimationDefinitionDecoder.definitions = new Int2ObjectOpenHashMap<>()
static

◆ fs

final FileSystem com.runehive.fs.cache.decoder.AnimationDefinitionDecoder.fs
private

The IndexedFileSystem.

Definition at line 23 of file AnimationDefinitionDecoder.java.

Referenced by AnimationDefinitionDecoder(), and run().

◆ LOGGER

final Logger com.runehive.fs.cache.decoder.AnimationDefinitionDecoder.LOGGER = LogManager.getLogger(AnimationDefinitionDecoder.class)
staticprivate

The logger to log process output.

Definition at line 18 of file AnimationDefinitionDecoder.java.

Referenced by run().


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