Added editor functionality to edit bound boxes

This commit is contained in:
Vladislav Khorev committed 2026-06-02 12:11:37 +03:00
1 parent 22b0e1992f
commit 4b868f47c2
12 files changed
+779 -307

No files matched your search

+36 -21
View File
@@ -694,9 +694,9 @@ namespace ZL
}
else if (event.button.button == SDL_BUTTON_RIGHT
&& event.type == SDL_MOUSEBUTTONUP
&& navigationEditorMode
&& editorMode == EditorMode::Navigation
&& currentLocation) {
currentLocation->navigationEditorHandleRightClick();
currentLocation->editor.handleRightClick();
}
}
else if (event.type == SDL_MOUSEMOTION) {
@@ -727,16 +727,20 @@ namespace ZL
if (event.type == SDL_KEYDOWN && event.key.repeat == 0) {
switch (event.key.keysym.sym) {
case SDLK_0:
startDarklandsTransition();
break;
case SDLK_1:
//if (audioPlayer) audioPlayer->playSoundAsync("audio/background.wav");
break;
case SDLK_2:
//if (audioPlayer) audioPlayer->playMusicAsync("audio/lullaby-music-vol20-186394--online-audio-convert.com.ogg");
break;
case SDLK_3:
//if (audioPlayer) audioPlayer->stopMusicAsync();
case SDLK_4:
case SDLK_5:
case SDLK_6:
case SDLK_7:
case SDLK_8:
case SDLK_9:
if (editorMode == EditorMode::InteractiveObjects && currentLocation) {
currentLocation->editor.selectInteractiveObject(event.key.keysym.sym - SDLK_0);
} else if (event.key.keysym.sym == SDLK_0) {
startDarklandsTransition();
}
break;
case SDLK_f:
currentLocation->dialogueSystem.startDialogue("dialog_start001");
@@ -747,14 +751,25 @@ namespace ZL
break;
case SDLK_n:
navigationEditorMode = !navigationEditorMode;
if (editorMode == EditorMode::None)
editorMode = EditorMode::Navigation;
else if (editorMode == EditorMode::Navigation)
editorMode = EditorMode::InteractiveObjects;
else
editorMode = EditorMode::None;
if (currentLocation) {
currentLocation->navigationEditorMode = navigationEditorMode;
if (navigationEditorMode) {
currentLocation->navigationEditorBuildNavMeshes();
}
currentLocation->editorMode = editorMode;
if (editorMode == EditorMode::Navigation)
currentLocation->editor.buildNavMeshes();
else if (editorMode == EditorMode::InteractiveObjects)
currentLocation->editor.buildInteractiveObjectBoundsMeshes();
}
{
const char* modeName = (editorMode == EditorMode::Navigation) ? "Navigation"
: (editorMode == EditorMode::InteractiveObjects) ? "InteractiveObjects"
: "None";
std::cout << "[EDITOR] Mode: " << modeName << std::endl;
}
std::cout << "[NAV_EDITOR] Mode: " << (navigationEditorMode ? "ON" : "OFF") << std::endl;
break;
case SDLK_o:
@@ -802,22 +817,22 @@ namespace ZL
break;
case SDLK_b:
if (navigationEditorMode && currentLocation) {
currentLocation->navigationEditorSave();
if (editorMode != EditorMode::None && currentLocation) {
currentLocation->editor.saveAll();
}
break;
case SDLK_j:
if (navigationEditorMode && currentLocation) {
currentLocation->gameObjectEditorPlaceTree();
if (editorMode != EditorMode::None && currentLocation) {
currentLocation->editor.placeTree();
} else {
menuManager.toggleQuestJournal();
}
break;
case SDLK_v:
if (navigationEditorMode && currentLocation) {
currentLocation->gameObjectEditorSave();
if (editorMode != EditorMode::None && currentLocation) {
currentLocation->editor.saveObjects();
}
break;