summaryrefslogtreecommitdiff
path: root/NW4RTools/BrresReader.cs
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-02-20 05:30:01 +0100
committerTreeki <treeki@gmail.com>2012-02-20 05:30:01 +0100
commit31380b4bb93d1fb65faff8f71753de80fb0a8c9d (patch)
tree8880321028df33877fec9af6c424afe48e7ac4ef /NW4RTools/BrresReader.cs
parent364e99d849378546323d1d06307b6773e813b742 (diff)
downloadnw4rtools-31380b4bb93d1fb65faff8f71753de80fb0a8c9d.tar.gz
nw4rtools-31380b4bb93d1fb65faff8f71753de80fb0a8c9d.zip
AnmChr/Clr/TexSrt writing done for now. Not 100% perfect but it works!
Diffstat (limited to '')
-rwxr-xr-x[-rw-r--r--]NW4RTools/BrresReader.cs33
1 files changed, 23 insertions, 10 deletions
diff --git a/NW4RTools/BrresReader.cs b/NW4RTools/BrresReader.cs
index f120943..9616b5b 100644..100755
--- a/NW4RTools/BrresReader.cs
+++ b/NW4RTools/BrresReader.cs
@@ -153,8 +153,15 @@ namespace NW4RTools {
// handle mipmaps
tex.Images = new System.Drawing.Bitmap[mipmapCount];
+#if DEV_DONT_MODIFY_TEXTURE
+ tex.ImageData = new byte[mipmapCount][];
+#endif
for (int i = 0; i < mipmapCount; i++) {
- tex.ImportData(i, ins.ReadBytes(Texture.GetDataSize(width, height, format)), width, height, format);
+ byte[] data = ins.ReadBytes(Texture.GetDataSize(width, height, format));
+#if DEV_DONT_MODIFY_TEXTURE
+ tex.ImageData[i] = data;
+#endif
+ tex.ImportData(i, data, width, height, format);
width /= 2;
height /= 2;
}
@@ -223,6 +230,10 @@ namespace NW4RTools {
node.Flags = flags & CharacterAnim.Flags.NonComputableFlags;
+ node.ScaleUseModel = ((flags & CharacterAnim.Flags.ScaleUseModel) != 0);
+ node.RotateUseModel = ((flags & CharacterAnim.Flags.RotateUseModel) != 0);
+ node.TranslateUseModel = ((flags & CharacterAnim.Flags.TranslateUseModel) != 0);
+
// SCALES
bool needScaleYZ = true;
@@ -482,7 +493,7 @@ namespace NW4RTools {
node.Elements = new ColorAnim.Element[(int)ColorAnim.TargetType.Count];
for (int i = 0; i < node.Elements.Length; i++) {
- node.Elements[i] = ReadAnmClrElement(ins, startPos, flags);
+ node.Elements[i] = ReadAnmClrElement(ins, flags);
flags >>= 2;
}
@@ -490,7 +501,7 @@ namespace NW4RTools {
}
}
- private ColorAnim.Element ReadAnmClrElement(InputStream ins, int startPos, UInt32 flags) {
+ private ColorAnim.Element ReadAnmClrElement(InputStream ins, UInt32 flags) {
var elem = new ColorAnim.Element();
elem.Exists = (flags & 1) != 0;
@@ -498,16 +509,16 @@ namespace NW4RTools {
OffsetMap[ins.Position] = String.Format("Element [{0}]", elem.IsConstant ? "Constant" : "Colours");
- elem.Mask = ins.ReadUInt32();
-
if (!elem.Exists)
return elem;
+ elem.Mask = ins.ReadUInt32();
+
if (elem.IsConstant) {
elem.ConstValue = ins.ReadColor();
- } else {
+ } else {
int savePos = ins.Position;
- ins.Seek(startPos + ins.ReadInt32());
+ ins.Seek(savePos + ins.ReadInt32());
elem.Colors = new Color[COLOR_ANIM_HACK.FrameCount + 1];
@@ -597,7 +608,9 @@ namespace NW4RTools {
var elem = new TextureSRTAnim.Element();
int savePos = ins.Position;
- ins.Seek(startPos + ins.ReadInt32());
+ ins.Seek(startPos + ins.ReadInt32());
+
+ elem.Exists = true;
OffsetMap.Add(ins.Position, String.Format("Element"));
@@ -863,8 +876,8 @@ namespace NW4RTools {
var insn4 = new ByteCode.DrawShapeInstruction();
insn4.MaterialID = ins.ReadUInt16();
insn4.ShapeID = ins.ReadUInt16();
- insn4.NodeID = ins.ReadUInt16();
- ins.Skip(1);
+ insn4.NodeID = ins.ReadUInt16();
+ insn4.Unk = ins.ReadByte();
bc.Instructions.Add(insn4);
break;