buying 317 animation header support implemented
add mikan#9999
Printable View
buying 317 animation header support implemented
add mikan#9999
Quote:
Originally Posted by mikan [Only registered and activated users can see links. Click Here To Register...]
Code:public static void load(byte[] data) {
Buffer buffer = new Buffer(data);
buffer.setPosition(data.length - 8);
int attributesOffset = buffer.readUShort();
int translationsOffset = buffer.readUShort();
int durationsOffset = buffer.readUShort();
int baseOffset = buffer.readUShort();
int offset = 0;
Buffer head = new Buffer(data);
head.setPosition(offset);
offset += attributesOffset + 2;
Buffer attributes = new Buffer(data);
attributes.setPosition(offset);
offset += translationsOffset;
Buffer translations = new Buffer(data);
translations.setPosition(offset);
offset += durationsOffset;
Buffer durations = new Buffer(data);
durations.setPosition(offset);
offset += baseOffset;
Buffer bases = new Buffer(data);
bases.setPosition(offset);
FrameBase base = new FrameBase(bases);
int frameCount = head.readUShort();
int[] translationIndices = new int[500];
int[] transformX = new int[500];
int[] transformY = new int[500];
int[] transformZ = new int[500];
for (int frameIndex = 0; frameIndex < frameCount; frameIndex++) {
int id = head.readUShort();
Frame frame = frames[id] = new Frame();
frame.duration = durations.readUByte();
frame.base = base;
int transformations = head.readUByte();
int lastIndex = -1;
int transformation = 0;
for (int index = 0; index < transformations; index++) {
int attribute = attributes.readUByte();
if (attribute > 0) {
if (base.getTransformationType(index) != FrameConstants.CENTROID_TRANSFORMATION) {
for (int next = index - 1; next > lastIndex; next--) {
if (base.getTransformationType(next) != FrameConstants.CENTROID_TRANSFORMATION) {
continue;
}
translationIndices[transformation] = next;
transformX[transformation] = 0;
transformY[transformation] = 0;
transformZ[transformation] = 0;
transformation++;
break;
}
}
translationIndices[transformation] = index;
int standard = (base.getTransformationType(index) == FrameConstants.SCALE_TRANSFORMATION) ? 128 : 0;
transformX[transformation] = ((attribute & TRANSFORM_X) != 0) ? translations.readSmart() : standard;
transformY[transformation] = ((attribute & TRANSFORM_Y) != 0) ? translations.readSmart() : standard;
transformZ[transformation] = ((attribute & TRANSFORM_Z) != 0) ? translations.readSmart() : standard;
lastIndex = index;
transformation++;
if (base.getTransformationType(index) == FrameConstants.ALPHA_TRANSFORMATION) {
opaque[id] = false;
}
}
}
frame.transformationCount = transformation;
frame.transformationIndices = new int[transformation];
frame.transformX = new int[transformation];
frame.transformY = new int[transformation];
frame.transformZ = new int[transformation];
for (int index = 0; index < transformation; index++) {
frame.transformationIndices[index] = translationIndices[index];
frame.transformX[index] = transformX[index];
frame.transformY[index] = transformY[index];
frame.transformZ[index] = transformZ[index];
}
}
}
yeah ive tried implementing this from a 317 repo on github, keeps T-posing and going out of bounds though, will have a go again with thisQuote:
Originally Posted by Zion [Only registered and activated users can see links. Click Here To Register...]
Quote:
Originally Posted by mikan [Only registered and activated users can see links. Click Here To Register...]
Code:public FrameBase(Buffer buffer) {
count = buffer.readUByte();
transformationType = new int[count];
labels = new int[count][];
for (int index = 0; index < count; index++) {
transformationType[index] = buffer.readUByte();
}
for (int label = 0; label < count; label++) {
int count = buffer.readUByte();
labels[label] = new int[count];
for (int index = 0; index < count; index++) {
labels[label][index] = buffer.readUByte();
}
}
}
it's like, so close but it keeps requesting stuff out of boundsQuote:
Originally Posted by Zion [Only registered and activated users can see links. Click Here To Register...]
Code:java.lang.ArrayIndexOutOfBoundsException: 2720
at com.runescape.cache.ResourceProvider.requestMandatory(ResourceProvider.java:584)
at com.runescape.cache.ResourceProvider.run(ResourceProvider.java:394)
Code:Exception in thread "Thread-1" java.lang.ArrayIndexOutOfBoundsException: 1
at com.runescape.cache.anim.FrameBase.getTransformationType(FrameBase.java:33)
bump, need this fixed, trying to load files that shouldnt exist in 317