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

Public Member Functions

 AnimationDefinition (final int id)
void decode (ByteBuf buffer)

Public Attributes

boolean allowsRotation
int[] duration
int durationTime = 0
final int id
int interleaveOrder []
int length
int padding
int[] primary
int priority
int resetCycle
int runFlag
int secondary []
int shield
int type
int walkFlag
int weapon

Private Member Functions

int calculateDuration ()

Detailed Description

Definition at line 5 of file AnimationDefinition.java.

Constructor & Destructor Documentation

◆ AnimationDefinition()

com.runehive.fs.cache.decoder.AnimationDefinition.AnimationDefinition ( final int id)

Definition at line 24 of file AnimationDefinition.java.

24 {
25 this.id = id;
26
27 padding = -1;
28 allowsRotation = false;
29 priority = 5;
30 shield = -1;
31 weapon = -1;
32 resetCycle = 99;
33 runFlag = -1;
34 walkFlag = -1;
35 type = 1;
36 }

References allowsRotation, id, padding, priority, resetCycle, runFlag, shield, type, walkFlag, and weapon.

Member Function Documentation

◆ calculateDuration()

int com.runehive.fs.cache.decoder.AnimationDefinition.calculateDuration ( )
private

Definition at line 145 of file AnimationDefinition.java.

145 {
146 int duration = 0;
147 if (this.duration == null) {
148 return 0;
149 }
150 for (final int i : this.duration) {
151 /*if (i < 0 || i > 30) {
152 continue;
153 }*/
154 duration += Math.abs(i) * 20;
155 }
156 return duration;
157 }

References duration.

Referenced by decode().

Here is the caller graph for this function:

◆ decode()

void com.runehive.fs.cache.decoder.AnimationDefinition.decode ( ByteBuf buffer)

Definition at line 38 of file AnimationDefinition.java.

38 {
39 while(true) {
40 final int opcode = buffer.readUnsignedByte();
41
42 if (opcode == 0) {
43 break;
44 } else if (opcode == 1) {
45 length = buffer.readUnsignedShort();
46 primary = new int[length];
47 secondary = new int[length];
48 duration = new int[length];
49
50 for (int i = 0; i < length; i++) {
51 duration[i] = buffer.readUnsignedShort();
52 }
53
54 for (int i = 0; i < length; i++) {
55 primary[i] = buffer.readUnsignedShort();
56 secondary[i] = -1;
57 }
58
59 for (int i = 0; i < length; i++) {
60 primary[i] += buffer.readUnsignedShort() << 16;
61 }
62 } else if (opcode == 2) {
63 padding = buffer.readUnsignedShort();
64 } else if (opcode == 3) {
65 int len = buffer.readUnsignedByte();
66 interleaveOrder = new int[len + 1];
67 for (int i = 0; i < len; i++) {
68 interleaveOrder[i] = buffer.readUnsignedByte();
69 }
70 interleaveOrder[len] = 9999999;
71 } else if (opcode == 4) {
72 allowsRotation = true;
73 } else if (opcode == 5) {
74 priority = buffer.readUnsignedByte();
75 } else if (opcode == 6) {
76 shield = buffer.readUnsignedShort();
77 } else if (opcode == 7) {
78 weapon = buffer.readUnsignedShort();
79 } else if (opcode == 8) {
80 resetCycle = buffer.readUnsignedByte();
81 } else if (opcode == 9) {
82 runFlag = buffer.readUnsignedByte();
83 } else if (opcode == 10) {
84 walkFlag = buffer.readUnsignedByte();
85 } else if (opcode == 11) {
86 type = buffer.readUnsignedByte();
87 } else if (opcode == 12) {
88 int len = buffer.readUnsignedByte();
89
90 for (int i = 0; i < len; i++) {
91 buffer.readUnsignedShort();
92 }
93
94 for (int i = 0; i < len; i++) {
95 buffer.readUnsignedShort();
96 }
97 } else if (opcode == 13) {
98 int len = buffer.readUnsignedByte();
99 for (int i = 0; i < len; i++) {
100 buffer.readUnsignedMedium();
101 }
102 } else if (opcode == 14) {
103 buffer.readUnsignedInt();
104 } else if (opcode == 15) {
105 int len = buffer.readUnsignedShort();
106
107 for (int index = 0; index < len; ++index) {
108 buffer.readUnsignedShort();
109 buffer.readUnsignedMedium();
110 }
111 } else if (opcode == 16) {
112 buffer.readUnsignedShort();
113 buffer.readUnsignedShort();
114 } else if (opcode == 17) {
115
116 int len = buffer.readUnsignedByte();
117 for (int i = 0; i < len; ++i) {
118 buffer.readUnsignedByte();
119 }
120 }
121 }
122 if (length == 0) {
123 length = 1;
124 primary = new int[1];
125 primary[0] = -1;
126 secondary = new int[1];
127 secondary[0] = -1;
128 duration = new int[1];
129 duration[0] = -1;
130 }
131
132 if (runFlag == -1) {
133 runFlag = (interleaveOrder == null) ? 0 : 2;
134 }
135
136 if (priority == -1) {
137 priority = (interleaveOrder == null) ? 0 : 2;
138 }
139
140 durationTime = calculateDuration();
141 }
val index

References allowsRotation, calculateDuration(), duration, durationTime, interleaveOrder, length, padding, primary, priority, resetCycle, runFlag, secondary, shield, type, walkFlag, and weapon.

Referenced by com.runehive.fs.cache.decoder.AnimationDefinitionDecoder.run().

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

Member Data Documentation

◆ allowsRotation

boolean com.runehive.fs.cache.decoder.AnimationDefinition.allowsRotation

Definition at line 15 of file AnimationDefinition.java.

Referenced by AnimationDefinition(), and decode().

◆ duration

int [] com.runehive.fs.cache.decoder.AnimationDefinition.duration

Definition at line 12 of file AnimationDefinition.java.

Referenced by calculateDuration(), and decode().

◆ durationTime

int com.runehive.fs.cache.decoder.AnimationDefinition.durationTime = 0

Definition at line 143 of file AnimationDefinition.java.

Referenced by decode().

◆ id

final int com.runehive.fs.cache.decoder.AnimationDefinition.id

Definition at line 7 of file AnimationDefinition.java.

Referenced by AnimationDefinition().

◆ interleaveOrder

int com.runehive.fs.cache.decoder.AnimationDefinition.interleaveOrder[]

Definition at line 14 of file AnimationDefinition.java.

Referenced by decode().

◆ length

int com.runehive.fs.cache.decoder.AnimationDefinition.length

Definition at line 9 of file AnimationDefinition.java.

Referenced by decode().

◆ padding

int com.runehive.fs.cache.decoder.AnimationDefinition.padding

Definition at line 13 of file AnimationDefinition.java.

Referenced by AnimationDefinition(), and decode().

◆ primary

int [] com.runehive.fs.cache.decoder.AnimationDefinition.primary

Definition at line 10 of file AnimationDefinition.java.

Referenced by decode().

◆ priority

int com.runehive.fs.cache.decoder.AnimationDefinition.priority

Definition at line 16 of file AnimationDefinition.java.

Referenced by AnimationDefinition(), and decode().

◆ resetCycle

int com.runehive.fs.cache.decoder.AnimationDefinition.resetCycle

Definition at line 19 of file AnimationDefinition.java.

Referenced by AnimationDefinition(), and decode().

◆ runFlag

int com.runehive.fs.cache.decoder.AnimationDefinition.runFlag

Definition at line 20 of file AnimationDefinition.java.

Referenced by AnimationDefinition(), and decode().

◆ secondary

int com.runehive.fs.cache.decoder.AnimationDefinition.secondary[]

Definition at line 11 of file AnimationDefinition.java.

Referenced by decode().

◆ shield

int com.runehive.fs.cache.decoder.AnimationDefinition.shield

Definition at line 17 of file AnimationDefinition.java.

Referenced by AnimationDefinition(), and decode().

◆ type

int com.runehive.fs.cache.decoder.AnimationDefinition.type

Definition at line 22 of file AnimationDefinition.java.

Referenced by AnimationDefinition(), and decode().

◆ walkFlag

int com.runehive.fs.cache.decoder.AnimationDefinition.walkFlag

Definition at line 21 of file AnimationDefinition.java.

Referenced by AnimationDefinition(), and decode().

◆ weapon

int com.runehive.fs.cache.decoder.AnimationDefinition.weapon

Definition at line 18 of file AnimationDefinition.java.

Referenced by AnimationDefinition(), and decode().


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