-
Notifications
You must be signed in to change notification settings - Fork 12
/
OffsetAllObjectCoordsForm.cs
64 lines (59 loc) · 2.21 KB
/
OffsetAllObjectCoordsForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
namespace SM64DSe
{
public partial class OffsetAllObjectCoordsForm : Form
{
public static readonly LevelObject.Type[] k_MovableLevelObjectTypes = new LevelObject.Type[] {
LevelObject.Type.STANDARD,
LevelObject.Type.SIMPLE,
LevelObject.Type.ENTRANCE,
LevelObject.Type.EXIT,
LevelObject.Type.DOOR,
LevelObject.Type.PATH_NODE,
LevelObject.Type.VIEW,
LevelObject.Type.TELEPORT_SOURCE,
LevelObject.Type.TELEPORT_DESTINATION
};
protected LevelEditorForm _owner;
public OffsetAllObjectCoordsForm()
{
InitializeComponent();
}
private void btnUpdate_Click(object sender, EventArgs e)
{
this._owner = (LevelEditorForm)Owner;
IEnumerable<LevelObject> objects =
_owner.m_Level.m_LevelObjects.Values.Where(obj => k_MovableLevelObjectTypes.Contains(obj.m_Type));
try
{
foreach (LevelObject obj in objects)
{
if (chkOffsetAll.Checked)
{
obj.Position.X += Helper.ParseFloat(txtOffsetX.Text);
obj.Position.Y += Helper.ParseFloat(txtOffsetY.Text);
obj.Position.Z += Helper.ParseFloat(txtOffsetZ.Text);
}
if (chkScaleAll.Checked)
{
obj.Position.X *= Helper.ParseFloat(txtScaleX.Text);
obj.Position.Y *= Helper.ParseFloat(txtScaleY.Text);
obj.Position.Z *= Helper.ParseFloat(txtScaleZ.Text);
}
obj.GenerateProperties();
}
for (int area = 0; area < Level.k_MaxNumAreas; area++)
_owner.RefreshObjects(area);
}
catch { MessageBox.Show("Please enter a valid value in the format x.xxxxxx"); }
}
}
}