public virtual Pair <int, int> getAnimationOffsets(int idx) { return(parentLoader.getAnimationOffsets(idx)); }
private static void processPerFinalAllPointsSample(object objIn) { FinalPointsProcessData curProcessData = (FinalPointsProcessData)objIn; int idx = curProcessData.idx; CreaturePackLoader parentLoader = curProcessData.parentLoader; var deformCompressType = parentLoader.hasDeformCompress(); bool has_deform_compress = (deformCompressType.Length > 0); var curOffsetPair = parentLoader.getAnimationOffsets(idx); var animName = (string)(parentLoader.fileData[curOffsetPair.first]); var k = curOffsetPair.first; k++; byte[] bytes2Data = new byte[2]; while (k < curOffsetPair.second) { var pts_raw_array = parentLoader.fileData[k + 1]; int raw_num = 0; if (pts_raw_array.GetType() == typeof(object[])) { raw_num = ((object[])pts_raw_array).Length; } else if (pts_raw_array.GetType() == typeof(byte[])) { if (deformCompressType == "deform_comp1_1") { raw_num = ((byte[])pts_raw_array).Length / 2; } else { raw_num = ((byte[])pts_raw_array).Length; } } var final_pts_array = new float[raw_num]; if (!has_deform_compress) { var pts_array = (object[])pts_raw_array; for (int m = 0; m < raw_num; m++) { final_pts_array[m] = (float)pts_array[m]; } } else { object[] pts_obj_array = null; byte[] pts_byte_array = null; float recp_x = 0, recp_y = 9; float numBuckets = 0.0f; if (deformCompressType == "deform_comp1") { pts_obj_array = (object[])pts_raw_array; numBuckets = 65535.0f; } else if (deformCompressType == "deform_comp2") { pts_byte_array = (byte[])pts_raw_array; numBuckets = 255.0f; } else if (deformCompressType == "deform_comp1_1") { pts_byte_array = (byte[])pts_raw_array; numBuckets = 65535.0f; } recp_x = 1.0f / numBuckets * (parentLoader.dMaxX - parentLoader.dMinX); recp_y = 1.0f / numBuckets * (parentLoader.dMaxY - parentLoader.dMinY); int bucketType = 0; if (deformCompressType == "deform_comp1") { bucketType = 1; } else if (deformCompressType == "deform_comp2") { bucketType = 2; } else if (deformCompressType == "deform_comp1_1") { bucketType = 3; } float bucketVal = 0.0f; float setVal = 0.0f; for (int m = 0; m < raw_num; m++) { bucketVal = 0.0f; if (bucketType == 1) { bucketVal = (float)((int)pts_obj_array[m]); } else if (bucketType == 2) { bucketVal = (float)((byte)pts_byte_array[m]); } else if (bucketType == 3) { bytes2Data[0] = pts_byte_array[m * 2]; bytes2Data[1] = pts_byte_array[m * 2 + 1]; int int_val = (int)BitConverter.ToUInt16(bytes2Data, 0); bucketVal = (float)int_val; } setVal = 0.0f; if (m % 2 == 0) { setVal = bucketVal * recp_x + parentLoader.dMinX; setVal += parentLoader.points[m]; } else { setVal = bucketVal * recp_y + parentLoader.dMinY; setVal += parentLoader.points[m]; } final_pts_array[m] = setVal; } } parentLoader.fileData[k + 1] = final_pts_array; k += 4; } }