Skip to content

Commit 1dd8f76

Browse files
authored
Qtfred bugfix pass (scp-fs2open#7363)
1 parent 35e7bcf commit 1dd8f76

4 files changed

Lines changed: 11 additions & 16 deletions

File tree

code/missioneditor/common.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,12 @@ SCP_string Voice_script_instructions_string = "$name - name of the message\r\n"
2525
"$note - message notes\r\n\r\n"
2626
"Note that $persona and $sender will only appear for the Message section.";
2727

28-
// TODO: The implementation here is a direct copy of what was in the original FRED code. It is not clear whether the
29-
// original implementation was intentionally designed to produce the same output as the incorrect implementations in the
30-
// two editors, or whether it was intended to be a correct normalization but was implemented incorrectly. If the former,
31-
// then this implementation should be changed to produce the same output as the original implementations in the two
32-
// editors, even if that output is mathematically incorrect. If the latter, then this implementation should be changed
33-
// to produce correct normalization into [-180, 180] using a step of 360 instead of 180. This should be evaluated and
34-
// decided upon before making any changes to this implementation.
35-
36-
// NOTE: FRED and QtFRED Relative coordinates used this version exactly while QtFRED Object orient editor used the
37-
// correct 360 step version. This version was preserved here to avoid silent behavior changes to FRED during a routine
38-
// cleanup pass. This should be fixed intentionally in a dedicated pass once the impact on both editors has been evaluated.
3928
float normalize_degrees(float deg)
4029
{
4130
while (deg < -180.0f)
42-
deg += 180.0f; // was 360.0f in the qtfred object orient version, but this is the original FRED implementation
31+
deg += 360.0f;
4332
while (deg > 180.0f)
44-
deg -= 180.0f; // was 360.0f in the qtfred object orient version, but this is the original FRED implementation
33+
deg -= 360.0f;
4534
// check for negative zero
4635
if (deg == -0.0f)
4736
deg = 0.0f;

qtfred/src/mission/Editor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,6 @@ void Editor::clearMission(bool fast_reload) {
664664
// however, FRED expects to parse comments from the raw buffer, so we need a nominal string for that
665665
allocate_parse_text(1);
666666

667-
missionLoaded("");
668667
}
669668

670669
void Editor::initialSetup() {
@@ -893,6 +892,7 @@ void Editor::createNewMission() {
893892
stars_post_level_init();
894893
undoCount = undoAvailable = 0;
895894
autosave("nothing");
895+
missionLoaded("");
896896
}
897897
void Editor::hideMarkedObjects() {
898898
object* ptr;

qtfred/src/mission/dialogs/WaypointEditorDialogModel.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@ void WaypointEditorDialogModel::setCurrentlySelectedPath(int id)
214214
return; // out of range; ignore
215215
}
216216

217-
if (apply()) {
217+
// Only apply if there is actually a current path to save changes to.
218+
bool canProceed = (_editor->cur_waypoint_list == nullptr) || apply();
219+
220+
if (canProceed) {
218221
_editor->unmark_all();
219222

220223
// mark all waypoints belonging to the selected list

qtfred/src/ui/dialogs/EventEditor/HeadAnimationPickerDialog.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,10 @@ void HeadAnimationPickerDialog::setSelectedByName(const QString& name)
315315
for (int i = 0; i < _list->count(); ++i) {
316316
auto* it = _list->item(i);
317317
if (it->data(Qt::UserRole).toString() == name) {
318-
_list->setCurrentItem(it);
318+
{
319+
const QSignalBlocker blocker(_list);
320+
_list->setCurrentItem(it);
321+
}
319322
_list->scrollToItem(it, QAbstractItemView::PositionAtCenter);
320323
_previewingName = name;
321324
_previewElapsedSeconds = 0.0f;

0 commit comments

Comments
 (0)