0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-05-18 19:31:17 +03:00

add gameobjects view

This commit is contained in:
bird_egop 2024-11-28 05:07:17 +03:00
parent e16b219854
commit c50512ea52
4 changed files with 240 additions and 29 deletions

View File

@ -7,18 +7,3 @@ public enum ClanType
AI = 2,
Neutral = 3
}
public static class Extensions
{
public static string ToReadableString(this ClanType clanType)
{
return clanType switch
{
ClanType.Environment => $"Окружение ({clanType:D})",
ClanType.Player => $"Игрок ({clanType:D})",
ClanType.AI => $"AI ({clanType:D})",
ClanType.Neutral => $"Нейтральный ({clanType:D})",
_ => $"Неизвестный ({clanType:D})"
};
}
}

View File

@ -0,0 +1,28 @@
namespace MissionTmaLib;
public static class Extensions
{
public static string ToReadableString(this ClanType clanType)
{
return clanType switch
{
ClanType.Environment => $"Окружение ({clanType:D})",
ClanType.Player => $"Игрок ({clanType:D})",
ClanType.AI => $"AI ({clanType:D})",
ClanType.Neutral => $"Нейтральный ({clanType:D})",
_ => $"Неизвестный ({clanType:D})"
};
}
public static string ToReadableString(this GameObjectType type)
{
return type switch
{
GameObjectType.Building => $"Строение {type:D}",
GameObjectType.Warbot => $"Варбот {type:D}",
GameObjectType.Tree => $"Дерево {type:D}",
GameObjectType.Stone => $"Камень {type:D}",
_ => $"Неизвестный ({type:D})"
};
}
}

View File

@ -1,3 +1,3 @@
namespace MissionTmaLib;
public record LodeInfo(Vector3 UnknownVector, int UnknownInt1, int UnknownInt2, float UnknownFloat, int UnknownInt3);
public record LodeInfo(Vector3 UnknownVector, int UnknownInt1, int UnknownFlags2, float UnknownFloat, int UnknownInt3);

View File

@ -21,6 +21,8 @@ public class MissionTmaExplorer : IImGuiPanel
var mission = _viewModel.Mission;
if (_viewModel.HasFile && mission is not null)
{
ImGui.Columns(2);
ImGui.Text("Путь к файлу: ");
ImGui.SameLine();
ImGui.Text(_viewModel.Path);
@ -65,20 +67,32 @@ public class MissionTmaExplorer : IImGuiPanel
{
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text(arealInfo.Coords[k].X.ToString("F2"));
ImGui.Text(
arealInfo.Coords[k]
.X.ToString("F2")
);
ImGui.TableNextColumn();
ImGui.Text(arealInfo.Coords[k].Y.ToString("F2"));
ImGui.Text(
arealInfo.Coords[k]
.Y.ToString("F2")
);
ImGui.TableNextColumn();
ImGui.Text(arealInfo.Coords[k].Z.ToString("F2"));
ImGui.Text(
arealInfo.Coords[k]
.Z.ToString("F2")
);
}
ImGui.EndTable();
}
ImGui.TreePop();
}
}
ImGui.TreePop();
}
ImGui.TreePop();
}
@ -185,7 +199,10 @@ public class MissionTmaExplorer : IImGuiPanel
ImGui.TableNextColumn();
ImGui.Text(alliesMapKey);
ImGui.TableNextColumn();
ImGui.Text(clanInfo.AlliesMap[alliesMapKey].ToString());
ImGui.Text(
clanInfo.AlliesMap[alliesMapKey]
.ToString()
);
}
ImGui.EndTable();
@ -204,8 +221,189 @@ public class MissionTmaExplorer : IImGuiPanel
if (ImGui.TreeNodeEx("Объекты"))
{
var gameObjectsData = mission.GameObjectsData;
ImGui.Text("Фиче-сет: ");
Utils.ShowHint("Магическое число из файла, на основе которого игра читает разные секции об объекте");
ImGui.SameLine();
ImGui.Text(gameObjectsData.GameObjectsFeatureSet.ToString());
ImGui.Text("Кол-во объектов: ");
ImGui.SameLine();
ImGui.Text(gameObjectsData.GameObjectsCount.ToString());
for (var i = 0; i < gameObjectsData.GameObjectInfos.Count; i++)
{
var gameObjectInfo = gameObjectsData.GameObjectInfos[i];
if (ImGui.TreeNodeEx($"Объект {i} - {gameObjectInfo.DatString}"))
{
ImGui.Text("Тип объекта: ");
ImGui.SameLine();
ImGui.Text(gameObjectInfo.Type.ToReadableString());
ImGui.Text("Неизвестные флаги: ");
ImGui.SameLine();
ImGui.Text(gameObjectInfo.UnknownFlags.ToString("X8"));
ImGui.Text("Путь к файлу .dat: ");
ImGui.SameLine();
ImGui.Text(gameObjectInfo.DatString);
ImGui.Text("Индекс владеющего клана: ");
Utils.ShowHint("-1 если объект никому не принадлежит");
ImGui.SameLine();
ImGui.Text(gameObjectInfo.OwningClanIndex.ToString());
ImGui.Text("Неизвестное число 3: ");
ImGui.SameLine();
ImGui.Text(gameObjectInfo.UnknownInt3.ToString());
ImGui.Text("Вектор позиции: ");
ImGui.SameLine();
ImGui.Text($"{gameObjectInfo.Position.X} : {gameObjectInfo.Position.Y} : {gameObjectInfo.Position.Z}");
ImGui.Text("Вектор поворота: ");
ImGui.SameLine();
ImGui.Text($"{gameObjectInfo.Rotation.X} : {gameObjectInfo.Rotation.Y} : {gameObjectInfo.Rotation.Z}");
ImGui.Text("Вектор масштаба: ");
ImGui.SameLine();
ImGui.Text($"{gameObjectInfo.Scale.X} : {gameObjectInfo.Scale.Y} : {gameObjectInfo.Scale.Z}");
ImGui.Text("Неизвестная строка 2: ");
ImGui.SameLine();
ImGui.Text(gameObjectInfo.UnknownString2);
ImGui.Text("Неизвестное число 4: ");
ImGui.SameLine();
ImGui.Text(gameObjectInfo.UnknownInt4.ToString());
ImGui.Text("Неизвестное число 5: ");
ImGui.SameLine();
ImGui.Text(gameObjectInfo.UnknownInt5.ToString());
ImGui.Text("Неизвестное число 6: ");
ImGui.SameLine();
ImGui.Text(gameObjectInfo.UnknownInt6.ToString());
if (ImGui.TreeNodeEx("Настройки"))
{
ImGui.Text("Неиспользуемый заголовок: ");
ImGui.SameLine();
ImGui.Text(gameObjectInfo.Settings.Unused.ToString());
ImGui.Text("Кол-во настроек: ");
ImGui.SameLine();
ImGui.Text(gameObjectInfo.Settings.SettingsCount.ToString());
ImGui.Text("0 - дробное число, 1 - целое число");
if (ImGui.BeginTable("Настройки", 5, ImGuiTableFlags.Borders | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.NoHostExtendX))
{
ImGui.TableSetupColumn("Тип");
ImGui.TableSetupColumn("Число 1");
ImGui.TableSetupColumn("Число 2");
ImGui.TableSetupColumn("Число 3");
ImGui.TableSetupColumn("Название");
ImGui.TableHeadersRow();
for (var i1 = 0; i1 < gameObjectInfo.Settings.Settings.Count; i1++)
{
var setting = gameObjectInfo.Settings.Settings[i1];
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text(setting.SettingType.ToString());
ImGui.TableNextColumn();
ImGui.Text(setting.SettingType == 0 ? setting.Unk1.AsFloat.ToString() : setting.Unk1.AsInt.ToString());
ImGui.TableNextColumn();
ImGui.Text(setting.SettingType == 0 ? setting.Unk1.AsFloat.ToString() : setting.Unk1.AsInt.ToString());
ImGui.TableNextColumn();
ImGui.Text(setting.SettingType == 0 ? setting.Unk1.AsFloat.ToString() : setting.Unk1.AsInt.ToString());
ImGui.TableNextColumn();
ImGui.Text(setting.Name);
}
ImGui.EndTable();
}
ImGui.TreePop();
}
ImGui.TreePop();
}
}
ImGui.Text("LAND строка: ");
Utils.ShowHint("Видимо это путь к настройкам поверхности");
ImGui.SameLine();
ImGui.Text(gameObjectsData.LandString);
ImGui.Text("Неизвестное число: ");
ImGui.SameLine();
ImGui.Text(gameObjectsData.UnknownInt.ToString());
ImGui.Text("Техническое описание: ");
ImGui.SameLine();
ImGui.Text(gameObjectsData.MissionTechDescription?.Replace((char)0xcd, '.') ?? "Отсутствует");
var lodeData = gameObjectsData.LodeData;
if (lodeData is not null)
{
ImGui.Text("Информация о LOD-ах");
ImGui.Text("Неиспользуемый заголовок: ");
ImGui.SameLine();
ImGui.Text(lodeData.Unused.ToString());
ImGui.Text("Кол-во LOD-ов: ");
ImGui.SameLine();
ImGui.Text(lodeData.LodeCount.ToString());
if (ImGui.BeginTable("Информация о лодах", 7, ImGuiTableFlags.Borders | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.NoHostExtendX))
{
ImGui.TableSetupColumn("X");
ImGui.TableSetupColumn("Y");
ImGui.TableSetupColumn("Z");
ImGui.TableSetupColumn("Число 1");
ImGui.TableSetupColumn("Флаги 2");
ImGui.TableSetupColumn("Число 3");
ImGui.TableSetupColumn("Число 4");
ImGui.TableHeadersRow();
for (var i1 = 0; i1 < lodeData.Lodes.Count; i1++)
{
var lode = lodeData.Lodes[i1];
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text(lode.UnknownVector.X.ToString());
ImGui.TableNextColumn();
ImGui.Text(lode.UnknownVector.Y.ToString());
ImGui.TableNextColumn();
ImGui.Text(lode.UnknownVector.Z.ToString());
ImGui.TableNextColumn();
ImGui.Text(lode.UnknownInt1.ToString());
ImGui.TableNextColumn();
ImGui.Text(lode.UnknownFlags2.ToString());
ImGui.TableNextColumn();
ImGui.Text(lode.UnknownFloat.ToString());
ImGui.TableNextColumn();
ImGui.Text(lode.UnknownInt3.ToString());
}
ImGui.EndTable();
}
}
else
{
ImGui.Text("Информаия о LOD-ах отсутствует");
}
ImGui.TreePop();
}
ImGui.NextColumn();
ImGui.Text("Тут хочу сделать карту");
}
else
{