diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index 1ed9b2b..90e0556 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -5908,7 +5908,9 @@ namespace DSPRE { owYMapUpDown.Value = selectedOw.yMapPosition; owXMatrixUpDown.Value = selectedOw.xMatrixPosition; owYMatrixUpDown.Value = selectedOw.yMatrixPosition; - owZPositionUpDown.Value = selectedOw.zPosition; + + int zFld = (selectedOw.zPosition >> 4) /*convert from overworld units to fx*/; + owZPositionUpDown.Value = zFld / 0x1000; //then convert from fixed point to decimal /*ID, Flag and Script number controls */ owIDNumericUpDown.Value = selectedOw.owID; @@ -6095,7 +6097,8 @@ namespace DSPRE { return; } - currentEvFile.overworlds[selection].zPosition = (short)owZPositionUpDown.Value; + int zFld = (short)owZPositionUpDown.Value >> 4; //decimal to overworld units + currentEvFile.overworlds[selection].zPosition = zFld * 0x1000; //overworld units to fixed point } private void owXMatrixUpDown_ValueChanged(object sender, EventArgs e) { int selection = overworldsListBox.SelectedIndex; diff --git a/DS_Map/ROMFiles/EventFile.cs b/DS_Map/ROMFiles/EventFile.cs index c3f3ed2..8aed995 100644 --- a/DS_Map/ROMFiles/EventFile.cs +++ b/DS_Map/ROMFiles/EventFile.cs @@ -119,7 +119,7 @@ namespace DSPRE.ROMFiles { public short xMapPosition; public short yMapPosition; - public short zPosition; + public int zPosition; //fixed point! public ushort xMatrixPosition; public ushort yMatrixPosition; #endregion @@ -292,8 +292,7 @@ namespace DSPRE.ROMFiles { xMatrixPosition = (ushort)(xPosition / MapFile.mapSize); yMatrixPosition = (ushort)(yPosition / MapFile.mapSize); - zPosition = reader.ReadInt16(); - unknown3 = reader.ReadUInt16(); + zPosition = reader.ReadInt32(); } } public Overworld(int owID, int xMatrixPosition, int yMatrixPosition) {