Gradient counter fix

master
1987kostya 4 years ago
parent 228dc1083e
commit d78f67057a

@ -938,7 +938,7 @@ namespace CTFAK.GUI
{ {
var node = (ChunkNode) objTreeView.SelectedNode; var node = (ChunkNode) objTreeView.SelectedNode;
var path = var path =
$"{Settings.ImagePath}\\{Helper.GetTreePath(objTreeView, (ChunkNode) objTreeView.SelectedNode)}"; $"{Settings.ImagePath}\\{objTreeView.SelectedNode.FullPath}";
if (node == null) return; if (node == null) return;
ImageDumper.SaveFromNode(node); ImageDumper.SaveFromNode(node);
} }
@ -972,7 +972,7 @@ namespace CTFAK.GUI
Logger.Log("Dumping"); Logger.Log("Dumping");
var node = (ChunkNode) LastSelected; var node = (ChunkNode) LastSelected;
var path = var path =
$"{Settings.ImagePath}\\{Helper.GetTreePath(objTreeView, (ChunkNode) objTreeView.SelectedNode)}"; $"{Settings.ImagePath}\\{objTreeView.SelectedNode.FullPath}";
if (node == null) return; if (node == null) return;
ImageDumper.SaveFromNode(node); ImageDumper.SaveFromNode(node);
} }

@ -104,6 +104,7 @@ namespace CTFAK.MMFParser.EXE.Loaders.Objects
} }
else if (DisplayType == 2 || DisplayType == 3 || DisplayType == 5) else if (DisplayType == 2 || DisplayType == 3 || DisplayType == 5)
{ {
Frames=new List<int>(){0};
Shape = new Shape(Reader); Shape = new Shape(Reader);
Shape.Read(); Shape.Read();
} }

@ -153,13 +153,14 @@ namespace CTFAK.MMFParser.EXE.Loaders.Objects
_extensionOffset = Reader.ReadUInt16(); _extensionOffset = Reader.ReadUInt16();
_counterOffset = Reader.ReadUInt16(); _counterOffset = Reader.ReadUInt16();
Flags.flag = Reader.ReadUInt16(); Flags.flag = Reader.ReadUInt16();
Reader.Skip(2);
var end = Reader.Tell()+(8+1)*2; var end = Reader.Tell()+(8+1)*2;
for (int i = 0; i < 8; i++) Reader.Skip(2);
for (int i = 0; i < 9; i++)
{ {
var value = Reader.ReadInt16(); var value = Reader.ReadInt16();
_qualifiers[i]=value; // _qualifiers[i]=value;
} }
Reader.Seek(end); Reader.Seek(end);
_systemObjectOffset = Reader.ReadUInt16(); _systemObjectOffset = Reader.ReadUInt16();

@ -68,13 +68,13 @@ namespace CTFAK.MMFParser.MFA.Loaders.mfachunks
NewObjectFlags = Reader.ReadInt32(); NewObjectFlags = Reader.ReadInt32();
BackgroundColor = Reader.ReadColor(); BackgroundColor = Reader.ReadColor();
var end = Reader.Tell() + 2 * (8+1); var end = Reader.Tell() + 2 * (8+1);
for (int i = 0; i < 8+1; i++) for (int i = 0; i < 8; i++)
{ {
var value = Reader.ReadInt16(); var value = Reader.ReadInt16();
if(value==-1) // if(value==-1)
{ // {
break; // break;
} // }
Qualifiers[i]=value; Qualifiers[i]=value;
} }
Reader.Seek(end); Reader.Seek(end);

@ -593,16 +593,7 @@ namespace CTFAK.MMFParser.Translation
newCount.Images = new List<int>() {0}; newCount.Images = new List<int>() {0};
var shape = counter?.Shape; var shape = counter?.Shape;
if(counter==null) throw new NullReferenceException(nameof(counter));
if (counter != null)
{
if(counter.DisplayType==2||counter.DisplayType==3)
{
counter = null;
shape = null;
}
}
if (counter == null) if (counter == null)
{ {
newCount.DisplayType = 0; newCount.DisplayType = 0;
@ -613,7 +604,6 @@ namespace CTFAK.MMFParser.Translation
} }
else else
{ {
newCount.DisplayType = counter.DisplayType; newCount.DisplayType = counter.DisplayType;
newCount.CountType = counter.Inverse ? 1 : 0; newCount.CountType = counter.Inverse ? 1 : 0;
newCount.Width = (int) counter.Width; newCount.Width = (int) counter.Width;
@ -631,8 +621,8 @@ namespace CTFAK.MMFParser.Translation
} }
else else
{ {
newCount.Color1 = Color.Green; newCount.Color1 = shape.Color1;
newCount.Color2 = Color.Red; newCount.Color2 = shape.Color2;
newCount.VerticalGradient = (uint) shape.GradFlags; newCount.VerticalGradient = (uint) shape.GradFlags;
newCount.Flags = (uint) shape.FillType; newCount.Flags = (uint) shape.FillType;

@ -24,7 +24,6 @@ namespace CTFAK.Utils
public static ByteReader DecompressAsReader(ByteReader exeReader, out int decompressed) public static ByteReader DecompressAsReader(ByteReader exeReader, out int decompressed)
{ {
return new ByteReader(Decompress(exeReader, out decompressed)); return new ByteReader(Decompress(exeReader, out decompressed));
} }

@ -36,39 +36,6 @@ namespace CTFAK.Utils
var date = DateTime.Now; var date = DateTime.Now;
return $"[{date.Hour,2}:{date.Minute,2}:{date.Second,2}:{date.Millisecond,3}]"; return $"[{date.Hour,2}:{date.Minute,2}:{date.Second,2}:{date.Millisecond,3}]";
} }
public static string GetTreePath(TreeView tree, ChunkNode node)
{
string CombinedPath=node.FullPath;
return CombinedPath;
}
public static string Log(this byte[] bytes, bool log = true, string format = "")
{
string temp = String.Empty;
for (int i = 0; i < bytes.Length; i++)
{
var item = bytes[i];
if (i > 0)
{
temp += " " + item.ToString(format);
}
else
{
temp += item.ToString(format);
}
}
if (log)
{
Console.WriteLine(temp);
}
return temp;
}
public static string FirstCharToUpper(this string input) public static string FirstCharToUpper(this string input)
{ {
switch (input) switch (input)

Loading…
Cancel
Save