Skip to content

Commit

Permalink
Merge branch 'master' into wip-translator
Browse files Browse the repository at this point in the history
  • Loading branch information
Wohlstand committed Dec 30, 2024
2 parents 3e00fea + 5efd980 commit e647c63
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Editor/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class HistorySettings{
SETTING_EV_DEATH, //extraData: String [new event]
SETTING_EV_TALK, //extraData: String [new event]
SETTING_EV_WARP_ENTER, //extraData: String [new event]
SETTING_EV_WARP_EXIT, //extraData: String [new event]
SETTING_SPECIAL_DATA, //extraData: int [new type]
SETTING_EV_AUTOSTART, //extraData: bool [Activated?]
SETTING_EV_SMOKE, //extraData: bool [Activated?]
Expand Down Expand Up @@ -222,6 +223,7 @@ class HistorySettings{
case SETTING_EV_DEATH: return QObject::tr("Event NPC Die");
case SETTING_EV_TALK: return QObject::tr("Event NPC Talk");
case SETTING_EV_WARP_ENTER: return QObject::tr("Event Warp Enter");
case SETTING_EV_WARP_EXIT: return QObject::tr("Event Warp Exit");
case SETTING_SPECIAL_DATA: return QObject::tr("NPC Special Data");
case SETTING_EV_AUTOSTART: return QObject::tr("Autostart");
case SETTING_EV_SMOKE: return QObject::tr("Layer Smoke Effect");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ void HistoryElementSettingsWarp::undo()
doorp->event_enter = extraData.toList()[0].toString();
}
else
if(subtype == HistorySettings::SETTING_EV_WARP_EXIT){
doorp->event_exit = extraData.toList()[0].toString();
}
else
if(subtype == HistorySettings::SETTING_LEVELEXIT){
doorp->lvl_o = !extraData.toList()[0].toBool();
if(!doorp->lvl_o && !doorp->isSetOut && extraData.toList().size() >= 3){
Expand Down Expand Up @@ -264,6 +268,10 @@ void HistoryElementSettingsWarp::redo()
doorp->event_enter = extraData.toList()[1].toString();
}
else
if(subtype == HistorySettings::SETTING_EV_WARP_EXIT){
doorp->event_exit = extraData.toList()[1].toString();
}
else
if(subtype == HistorySettings::SETTING_LEVELEXIT){
doorp->lvl_o = extraData.toList()[0].toBool();
if(!(((!doorp->lvl_o) && (!doorp->lvl_i)) || (doorp->lvl_i)))
Expand Down
6 changes: 6 additions & 0 deletions Editor/main_window/dock/lvl_events_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ void MainWindow::EventListsSync()
QComboBox *_sb_npc_el = dock_LvlSearchBox->cbox_event_npc_empty_layer();
QComboBox *_eb_trigger = dock_LvlEvents->cbox_event_trigger();
QComboBox *_w_ent = dock_LvlWarpProps->cbox_event_enter();
QComboBox *_w_ex = dock_LvlWarpProps->cbox_event_exit();
QString curDestroyedBlock = _sb_block_d->currentText();
QString curHitedBlock = _sb_block_h->currentText();
QString curLayerEmptyBlock = _sb_block_l->currentText();
Expand All @@ -204,6 +205,7 @@ void MainWindow::EventListsSync()
QString curTalkNpc = _sb_npc_t->currentText();
QString curEmptyLayerNpc = _sb_npc_el->currentText();
QString curEnterEventWarp = _w_ent->currentText();
QString curExitEventWarp = _w_ex->currentText();
int WinType = activeChildWindow();
_ip_block_d->clear();
_ip_block_h->clear();
Expand All @@ -221,6 +223,7 @@ void MainWindow::EventListsSync()
_sb_npc_t->clear();
_sb_npc_el->clear();
_w_ent->clear();
_w_ex->clear();
QString noEvent = tr("[None]");
_ip_block_d->addItem(noEvent);
_ip_block_h->addItem(noEvent);
Expand All @@ -235,6 +238,7 @@ void MainWindow::EventListsSync()
_sb_npc_t->addItem(noEvent);
_sb_npc_el->addItem(noEvent);
_w_ent->addItem(noEvent);
_w_ex->addItem(noEvent);

if(WinType == MainWindow::WND_Level)
{
Expand All @@ -256,6 +260,7 @@ void MainWindow::EventListsSync()
_sb_npc_t->addItem(event.name);
_sb_npc_el->addItem(event.name);
_w_ent->addItem(event.name);
_w_ex->addItem(event.name);
}
}

Expand All @@ -267,6 +272,7 @@ void MainWindow::EventListsSync()
_sb_npc_t->setCurrentText(curTalkNpc);
_sb_npc_el->setCurrentText(curEmptyLayerNpc);
_w_ent->setCurrentText(curEnterEventWarp);
_w_ex->setCurrentText(curExitEventWarp);
dock_LvlEvents->m_internalLock = false;
dock_LvlWarpProps->setSettingsLock(false);

Expand Down
44 changes: 44 additions & 0 deletions Editor/main_window/dock/lvl_warp_props.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ QComboBox *LvlWarpBox::cbox_event_enter()
return ui->WarpEnterEvent;
}

QComboBox *LvlWarpBox::cbox_event_exit()
{
return ui->WarpExitEvent;
}

void LvlWarpBox::setSettingsLock(bool locked)
{
m_lockSettings = locked;
Expand Down Expand Up @@ -192,6 +197,8 @@ void LvlWarpBox::setSMBX64Strict(bool en)
ui->warpBoxEnterEvent->setHidden(c.editor.supported_features.level_warp_on_enter_event == EditorSetup::FeaturesSupport::F_HIDDEN);
ui->WarpEnterEvent->setDisabled(en);
ui->WarpEnterEvent_label->setDisabled(en);
ui->WarpExitEvent->setDisabled(en);
ui->WarpExitEvent_label->setDisabled(en);
}

void LvlWarpBox::re_translate()
Expand Down Expand Up @@ -312,6 +319,15 @@ void LvlWarpBox::setDoorData(long index)
ui->WarpEnterEvent->setCurrentIndex(0);
}

if(door.event_exit.isEmpty())
ui->WarpExitEvent->setCurrentIndex(0);
else
{
ui->WarpExitEvent->setCurrentText(door.event_exit);
if(ui->WarpExitEvent->currentIndex() < 0)
ui->WarpExitEvent->setCurrentIndex(0);
}

ui->entrance->setDirection(door.idirect);
ui->exit->setDirection(door.odirect);

Expand Down Expand Up @@ -606,6 +622,34 @@ void LvlWarpBox::on_WarpEnterEvent_currentIndexChanged(const QString &arg1)
edit->LvlData.meta.modified = true;
}

void LvlWarpBox::on_WarpExitEvent_currentIndexChanged(const QString &arg1)
{
if(m_lockSettings)
return;

if(mw()->activeChildWindow() != MainWindow::WND_Level)
return;

LevelEdit *edit = mw()->activeLvlEditWin();
QList<QVariant> dirData;
unsigned int warpId = getWarpId();

auto *w = findWarp(edit->LvlData, warpId);
if(w)
{
dirData.push_back(w->event_exit);
dirData.push_back(arg1);
w->event_exit = arg1;
}

edit->scene->m_history->addChangeWarpSettings(static_cast<int>(warpId),
HistorySettings::SETTING_EV_WARP_EXIT,
QVariant(dirData));
edit->scene->doorPointsSync((unsigned int)ui->warpsList->currentData().toInt());
edit->scene->applyLayersVisible();
edit->LvlData.meta.modified = true;
}


// ////////// Flags///////////
void LvlWarpBox::on_WarpTwoWay_clicked(bool checked)
Expand Down
2 changes: 2 additions & 0 deletions Editor/main_window/dock/lvl_warp_props.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class LvlWarpBox : public QDockWidget, public MWDock_Base
public:
QComboBox *cbox_layer();
QComboBox *cbox_event_enter();
QComboBox *cbox_event_exit();

void setSettingsLock(bool locked);

Expand All @@ -48,6 +49,7 @@ private slots:
void on_warpsList_currentIndexChanged(int index); //Door list
void on_WarpLayer_currentIndexChanged(const QString &arg1); //Door's layers list
void on_WarpEnterEvent_currentIndexChanged(const QString &arg1);
void on_WarpExitEvent_currentIndexChanged(const QString &arg1);
void addWarpEntry();
void removeWarpEntry();
void duplicateWarpEntry();
Expand Down
26 changes: 20 additions & 6 deletions Editor/main_window/dock/lvl_warp_props.ui
Original file line number Diff line number Diff line change
Expand Up @@ -988,10 +988,7 @@ number of existing and collected stars in the level will not be shown.</string>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,80">
<property name="spacing">
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout_8" columnstretch="0,10000">
<property name="leftMargin">
<number>0</number>
</property>
Expand All @@ -1004,14 +1001,21 @@ number of existing and collected stars in the level will not be shown.</string>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<item row="0" column="0">
<widget class="QLabel" name="WarpEnterEvent_label">
<property name="text">
<string>On-Enter event:</string>
</property>
</widget>
</item>
<item>
<item row="1" column="0">
<widget class="QLabel" name="WarpExitEvent_label">
<property name="text">
<string>On-Exit event:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="WarpEnterEvent">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
Expand All @@ -1021,6 +1025,16 @@ number of existing and collected stars in the level will not be shown.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="WarpExitEvent">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="toolTip">
<string>Trigger event when he player exists this warp from other side</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
6 changes: 4 additions & 2 deletions Editor/main_window/menubar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,15 @@ void MainWindow::updateMenus(QMdiSubWindow* subWindow, bool force)

setCurrentLevelSection(0, 1);

dock_LvlWarpProps->init();
dock_LvlLayers->setLayersBox();
dock_LvlEvents->setEventsBox();

//Sync lists in properties windows
EventListsSync();
LayerListsSync();
EventListsSync();

dock_LvlWarpProps->init();

dock_BookmarksBox->updateBookmarkBoxByData();

dock_LvlSectionProps->initDefaults();
Expand Down
2 changes: 2 additions & 0 deletions changelog.editor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ beta2
- Added layer and event statistics that can be opened by layer's or event's context menu
- Fixed random crashes when removing objects from the scene
- Resolved the problem of abnormal duplicates of layers and events entries appear in the GUI lists
- Added On-Exit warp event entry for supported engines
- Fixed the incorrect refreshing of selected layers and events in some toolboxes when switching between opened files

Editor 0.3.2
- Added support for an element (Block, BGO, NPC), section, and level-wide Extra Settings
Expand Down

0 comments on commit e647c63

Please sign in to comment.