Skip to content

Commit f94f8f8

Browse files
committed
A bit of cleanup to editCommmon.
1 parent d858005 commit f94f8f8

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

TheForceEngine/TFE_Editor/LevelEditor/editCommon.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace LevelEditor
2727
EditorSector* sector = nullptr;
2828
s32 featureIndex = -1;
2929
HitPart part = HP_FLOOR;
30+
selection_get(hasFeature ? 0 : SEL_INDEX_HOVERED, sector, featureIndex, &part);
3031

3132
// Specific code for feature type.
3233
switch (s_editMode)
@@ -35,39 +36,38 @@ namespace LevelEditor
3536
{
3637
// TODO: Currently, you can only delete one vertex at a time. It should be possible to delete multiple.
3738
// Choose the selected feature over the hovered feature.
38-
selection_getVertex(hasFeature ? 0 : SEL_INDEX_HOVERED, sector, featureIndex);
3939
if (sector)
4040
{
4141
edit_deleteVertex(sector->id, featureIndex, LName_DeleteVertex);
4242
}
4343
} break;
4444
case LEDIT_WALL:
4545
{
46-
selection_getSurface(hasFeature ? 0 : SEL_INDEX_HOVERED, sector, featureIndex, &part);
47-
if (!sector) { return; }
48-
49-
if (part == HP_FLOOR || part == HP_CEIL)
50-
{
51-
edit_deleteSector(sector->id);
52-
}
53-
else if (part == HP_SIGN)
46+
if (sector)
5447
{
55-
if (sector && featureIndex >= 0)
48+
if (part == HP_FLOOR || part == HP_CEIL)
5649
{
57-
// Clear the selections when deleting a sign -
58-
// otherwise the source wall will still be selected.
59-
edit_clearSelections();
60-
61-
FeatureId id = createFeatureId(sector, featureIndex, HP_SIGN);
62-
edit_clearTexture(1, &id);
50+
edit_deleteSector(sector->id);
51+
}
52+
else if (part == HP_SIGN)
53+
{
54+
if (featureIndex >= 0)
55+
{
56+
// Clear the selections when deleting a sign -
57+
// otherwise the source wall will still be selected.
58+
edit_clearSelections();
59+
60+
FeatureId id = createFeatureId(sector, featureIndex, HP_SIGN);
61+
edit_clearTexture(1, &id);
62+
}
63+
}
64+
else
65+
{
66+
// Deleting a wall is the same as deleting vertex 0.
67+
// So re-use the same command, but with the delete wall name.
68+
const s32 vertexIndex = sector->walls[featureIndex].idx[0];
69+
edit_deleteVertex(sector->id, vertexIndex, LName_DeleteWall);
6370
}
64-
}
65-
else
66-
{
67-
// Deleting a wall is the same as deleting vertex 0.
68-
// So re-use the same command, but with the delete wall name.
69-
const s32 vertexIndex = sector->walls[featureIndex].idx[0];
70-
edit_deleteVertex(sector->id, vertexIndex, LName_DeleteWall);
7171
}
7272
} break;
7373
}
@@ -122,14 +122,14 @@ namespace LevelEditor
122122
if (hasHovered && selection_get(SEL_INDEX_HOVERED, sector, featureIndex, &part))
123123
{
124124
s32 modeIndex = featureIndex;
125-
if (part == HP_FLOOR || part == HP_CEIL || s_editMode == LEDIT_VERTEX)
125+
if (part == HP_FLOOR || part == HP_CEIL || s_editMode == LEDIT_VERTEX || s_editMode == LEDIT_SECTOR)
126126
{
127127
modeIndex = -1;
128128
}
129129
handleSelectMode(sector, modeIndex);
130130
if (!selection_action(SA_CHECK_INCLUSION, sector, featureIndex, part))
131131
{
132-
selection_surface(SA_SET, sector, featureIndex, part);
132+
selection_action(SA_SET, sector, featureIndex, part);
133133
edit_applyTransformChange();
134134
}
135135

@@ -152,7 +152,7 @@ namespace LevelEditor
152152
}
153153
else if (s_doubleClick && s_editMode == LEDIT_WALL) // functionality for vertices, sectors, etc.?
154154
{
155-
if (hasHovered && selection_getSurface(SEL_INDEX_HOVERED, sector, featureIndex, &part))
155+
if (hasHovered && selection_get(SEL_INDEX_HOVERED, sector, featureIndex, &part))
156156
{
157157
if (!TFE_Input::keyModDown(KEYMOD_SHIFT))
158158
{

0 commit comments

Comments
 (0)