Skip to content

Commit

Permalink
Merge pull request #2369 from ajrb/WDEfixes
Browse files Browse the repository at this point in the history
World Data Editor fixes
  • Loading branch information
ajrb committed Jun 29, 2022
2 parents 26bfce3 + 97105dc commit 9f650f8
Showing 1 changed file with 47 additions and 11 deletions.
58 changes: 47 additions & 11 deletions Assets/Game/Addons/WorldDataEditor/Editor/WorldDataEditor.cs
Expand Up @@ -306,7 +306,7 @@ private void EditorWindow()
if (dataMode == DataMode.Dungeon)
{
GUIElementFlatActionRecord(ref data, ref elementIndex);
GUIElementNextObject(ref data, ref elementIndex);
GUIElementFlatNextObject(ref data, ref elementIndex);
}
else
{
Expand Down Expand Up @@ -533,8 +533,8 @@ private void GUIElementModelActionRecord(ref WorldDataEditorObject data, ref int
GUI.Label(new Rect(224, 16, 72, 16), "Magnitude : ");
record.Magnitude = (ushort)EditorGUI.IntField(new Rect(296, 16, 48, 16), record.Magnitude);

GUI.Label(new Rect(354, 16, 48, 16), "Flags : ");
record.Flags = EditorGUI.IntField(new Rect(400, 16, 48, 16), record.Flags);
GUI.Label(new Rect(354, 16, 48, 16), "Action : ");
record.Flags = (int)(DFBlock.RdbActionFlags)EditorGUI.EnumPopup(new Rect(400, 16, 140, 16), (DFBlock.RdbActionFlags)record.Flags);
}
elementIndex++;
GUI.EndGroup();
Expand All @@ -544,12 +544,36 @@ private void GUIElementFlatActionRecord(ref WorldDataEditorObject data, ref int
{
GUI.BeginGroup(new Rect(8, 120 + (56 * elementIndex), Screen.width - 16, 48), lightMedBG);
{
ref DFBlock.RdbActionResource record = ref data.rdbObj.Resources.ModelResource.ActionResource;
ref DFBlock.RdbFlatResource record = ref data.rdbObj.Resources.FlatResource;
GUI.Label(new Rect(8, 16, 72, 16), "Magnitude : ");
record.Magnitude = (ushort)EditorGUI.IntField(new Rect(80, 16, 48, 16), record.Magnitude);
record.Magnitude = (byte)EditorGUI.IntField(new Rect(80, 16, 48, 16), record.Magnitude);

GUI.Label(new Rect(136, 16, 48, 16), "Flags : ");
record.Flags = EditorGUI.IntField(new Rect(186, 16, 48, 16), record.Flags);
record.Flags = (ushort)EditorGUI.IntField(new Rect(186, 16, 48, 16), record.Flags);

GUI.Label(new Rect(242, 16, 48, 16), "Action : ");
record.Action = (byte)(DFBlock.RdbActionFlags)EditorGUI.EnumPopup(new Rect(298, 16, 140, 16), (DFBlock.RdbActionFlags)record.Action);
GUI.Label(new Rect(242, 32, 260, 16), "(set to 'DoorText' for Passive Mob markers)");
}
elementIndex++;
GUI.EndGroup();
}

private void GUIElementFlatNextObject(ref WorldDataEditorObject data, ref int elementIndex)
{
GUI.BeginGroup(new Rect(8, 120 + (56 * elementIndex), Screen.width - 16, 48), lightMedBG);
{
GUI.Label(new Rect(8, 16, 96, 16), "Next Object Id : ");
data.rdbObj.Resources.FlatResource.NextObjectOffset =
EditorGUI.IntField(new Rect(96, 16, 96, 16), data.rdbObj.Resources.FlatResource.NextObjectOffset);

using (new EditorGUI.DisabledScope(data.rdbObj.Resources.FlatResource.NextObjectOffset == 0))
{
if (GUI.Button(new Rect(200, 12, 64, 24), "Select"))
{
SelectDungeonObject(data.rdbObj.Resources.FlatResource.NextObjectOffset);
}
}
}
elementIndex++;
GUI.EndGroup();
Expand All @@ -563,9 +587,12 @@ private void GUIElementNextObject(ref WorldDataEditorObject data, ref int elemen
data.rdbObj.Resources.ModelResource.ActionResource.NextObjectOffset =
EditorGUI.IntField(new Rect(96, 16, 96, 16), data.rdbObj.Resources.ModelResource.ActionResource.NextObjectOffset);

if (GUI.Button(new Rect(200, 12, 64, 24), "Select") && data.rdbObj.Resources.ModelResource.ActionResource.NextObjectOffset > 0)
using (new EditorGUI.DisabledScope(data.rdbObj.Resources.ModelResource.ActionResource.NextObjectOffset == 0))
{
SelectDungeonObject(data.rdbObj.Resources.ModelResource.ActionResource.NextObjectOffset);
if (GUI.Button(new Rect(200, 12, 64, 24), "Select"))
{
SelectDungeonObject(data.rdbObj.Resources.ModelResource.ActionResource.NextObjectOffset);
}
}
}
elementIndex++;
Expand All @@ -580,9 +607,12 @@ private void GUIElementPrevObject(ref WorldDataEditorObject data, ref int elemen
data.rdbObj.Resources.ModelResource.ActionResource.PreviousObjectOffset =
EditorGUI.IntField(new Rect(96, 16, 96, 16), data.rdbObj.Resources.ModelResource.ActionResource.PreviousObjectOffset);

if (GUI.Button(new Rect(200, 12, 64, 24), "Select") && data.rdbObj.Resources.ModelResource.ActionResource.PreviousObjectOffset > 0)
using (new EditorGUI.DisabledScope(data.rdbObj.Resources.ModelResource.ActionResource.PreviousObjectOffset == 0))
{
SelectDungeonObject(data.rdbObj.Resources.ModelResource.ActionResource.PreviousObjectOffset);
if (GUI.Button(new Rect(200, 12, 64, 24), "Select"))
{
SelectDungeonObject(data.rdbObj.Resources.ModelResource.ActionResource.PreviousObjectOffset);
}
}
}
elementIndex++;
Expand Down Expand Up @@ -1497,11 +1527,17 @@ private void UpdateBuildingWorldData()
}

//Loop through all NPCS to give them a unique position ID
for (int i = 0, NPC_ID = 0; i < buildingData.RmbSubRecord.Interior.BlockPeopleRecords.Length; i++)
int NPC_ID = buildingData.RmbSubRecord.XPos + buildingData.RmbSubRecord.ZPos + buildingData.RmbSubRecord.YRotation + buildingData.Quality;
for (int i = 0; i < buildingData.RmbSubRecord.Interior.BlockPeopleRecords.Length; i++)
{
buildingData.RmbSubRecord.Interior.BlockPeopleRecords[i].Position = NPC_ID;
NPC_ID++;
}
for (int i = 0; i < buildingData.RmbSubRecord.Exterior.BlockFlatObjectRecords.Length; i++)
{
buildingData.RmbSubRecord.Exterior.BlockFlatObjectRecords[i].Position = NPC_ID;
NPC_ID++;
}

for (int i = 0; i < buildingData.RmbSubRecord.Exterior.BlockSection3Records.Length; i++)
{
Expand Down

0 comments on commit 9f650f8

Please sign in to comment.