public static Translate ( int &body ) : void | ||
body | int | |
Résultat | void |
public static Frame[] GetAnimation(int body, int action, int direction, int hue, bool preserveHue) { Ultima.FileIndex mFileIndex2; int num; int num1; int num2; bool flag; if (!preserveHue) { Animations.Translate(ref body, ref hue); } else { Animations.Translate(ref body); } switch (BodyConverter.Convert(ref body)) { case 2: { mFileIndex2 = Animations.m_FileIndex2; if (body >= 200) { num = 22000 + (body - 200) * 65; break; } else { num = body * 110; break; } } case 3: { mFileIndex2 = Animations.m_FileIndex3; if (body < 300) { num = body * 65; break; } else if (body >= 400) { num = 35000 + (body - 400) * 175; break; } else { num = 33000 + (body - 300) * 110; break; } } default: { mFileIndex2 = Animations.m_FileIndex; if (body < 200) { num = body * 110; break; } else if (body >= 400) { num = 35000 + (body - 400) * 175; break; } else { num = 22000 + (body - 200) * 65; break; } } } num = num + action * 5; num = (direction > 4 ? num + (direction - (direction - 4) * 2) : num + direction); Stream stream = mFileIndex2.Seek(num, out num1, out num2, out flag); if (stream == null) { return(null); } bool flag1 = direction > 4; BinaryReader binaryReader = new BinaryReader(stream); ushort[] numArray = new ushort[256]; for (int i = 0; i < 256; i++) { numArray[i] = (ushort)(binaryReader.ReadUInt16() ^ 32768); } int position = (int)binaryReader.BaseStream.Position; int num3 = binaryReader.ReadInt32(); int[] numArray1 = new int[num3]; for (int j = 0; j < num3; j++) { numArray1[j] = position + binaryReader.ReadInt32(); } bool flag2 = (hue & 32768) == 0; hue = (hue & 16383) - 1; Hue list = null; if (hue >= 0 && hue < (int)Hues.List.Length) { list = Hues.List[hue]; } Frame[] frame = new Frame[num3]; for (int k = 0; k < num3; k++) { binaryReader.BaseStream.Seek((long)numArray1[k], SeekOrigin.Begin); frame[k] = new Frame(numArray, binaryReader, flag1); if (list != null) { list.ApplyTo(frame[k].Bitmap, flag2); } } return(frame); }
public static Frame[] GetAnimation(int body, int action, int direction, int hue, bool preserveHue) { if (preserveHue) { Animations.Translate(ref body); } else { Animations.Translate(ref body, ref hue); } FileIndex fileIndex; int num1; switch (BodyConverter.Convert(ref body)) { case 2: fileIndex = Animations.m_FileIndex2; num1 = body >= 200 ? 22000 + (body - 200) * 65 : body * 110; break; case 3: fileIndex = Animations.m_FileIndex3; num1 = body >= 300 ? (body >= 400 ? 35000 + (body - 400) * 175 : 33000 + (body - 300) * 110) : body * 65; break; default: fileIndex = Animations.m_FileIndex; num1 = body >= 200 ? (body >= 400 ? 35000 + (body - 400) * 175 : 22000 + (body - 200) * 65) : body * 110; break; } int num2 = num1 + action * 5; int index1 = direction > 4 ? num2 + (direction - (direction - 4) * 2) : num2 + direction; int length1; int extra; bool patched; Stream input = fileIndex.Seek(index1, out length1, out extra, out patched); if (input == null) { return((Frame[])null); } bool flip = direction > 4; BinaryReader bin = new BinaryReader(input); ushort[] palette = new ushort[256]; for (int index2 = 0; index2 < 256; ++index2) { palette[index2] = (ushort)((uint)bin.ReadUInt16() ^ 32768U); } int num3 = (int)bin.BaseStream.Position; int length2 = bin.ReadInt32(); int[] numArray = new int[length2]; for (int index2 = 0; index2 < length2; ++index2) { numArray[index2] = num3 + bin.ReadInt32(); } bool onlyHueGrayPixels = (hue & 32768) == 0; hue = (hue & 16383) - 1; Hue hue1 = (Hue)null; if (hue >= 0 && hue < Hues.List.Length) { hue1 = Hues.List[hue]; } Frame[] frameArray = new Frame[length2]; for (int index2 = 0; index2 < length2; ++index2) { bin.BaseStream.Seek((long)numArray[index2], SeekOrigin.Begin); frameArray[index2] = new Frame(palette, bin, flip); if (hue1 != null) { hue1.ApplyTo(frameArray[index2].Bitmap, onlyHueGrayPixels); } } return(frameArray); }