- [FIX] Per a crear noves habitacions descartar clicks fora del canvas

- [FIX] Nomes crear nova habitació si s'està pulsant LCTRL
- [NEW] Minimapa en l'editor
This commit is contained in:
2024-07-30 13:01:33 +02:00
parent 8725532586
commit b0dd34b5df
13 changed files with 199 additions and 56 deletions

View File

@@ -265,16 +265,19 @@ namespace modules
else
return GAME_MENU;
}
if (input::keyPressed(SDL_SCANCODE_TAB) || input::keyPressed(SDL_SCANCODE_GRAVE) ) console::toggle();
// WHILE EDITING...
if (editor::isEditing())
{
if (input::keyPressed(SDL_SCANCODE_TAB)) return GAME_EDITOR_MAP;
editor_move_selected();
actor::updateEditor(actor::getFirst());
}
else
{
if (input::keyPressed(SDL_SCANCODE_TAB) || input::keyPressed(SDL_SCANCODE_GRAVE) ) console::toggle();
if (!console::update())
{
actor::update(actor::getFirst());
@@ -387,12 +390,32 @@ namespace modules
if (input::mouseClk(1)) {
const int mx = draw::getLocalX(input::mouseX());
const int my = draw::getLocalY(input::mouseY());
if (mx<32 && my<24) room::load(room::editor::refExit(XN), XP);
if (mx>288 && my<24) room::load(room::editor::refExit(YN), YP);
if (mx>288 && my>216) room::load(room::editor::refExit(XP), XN);
if (mx<32 && my>216) room::load(room::editor::refExit(YP), YN);
if (mx>144 && mx<176 && my<24) room::load(room::editor::refExit(ZP), ZN);
if (mx>144 && mx<176 && my>216) room::load(room::editor::refExit(ZN), ZP);
if (mx>=0 && my>=0 && mx<320 && my<240) {
if (mx<32 && my<24) {
int room = room::editor::refExit(XN);
if (room>=0 || input::keyPressed(SDL_SCANCODE_LCTRL)) room::load(room, XP);
}
if (mx>288 && my<24) {
int room = room::editor::refExit(YN);
if (room>=0 || input::keyPressed(SDL_SCANCODE_LCTRL)) room::load(room, YP);
}
if (mx>288 && my>216) {
int room = room::editor::refExit(XP);
if (room>=0 || input::keyPressed(SDL_SCANCODE_LCTRL)) room::load(room, XN);
}
if (mx<32 && my>216) {
int room = room::editor::refExit(YP);
if (room>=0 || input::keyPressed(SDL_SCANCODE_LCTRL)) room::load(room, YN);
}
if (mx>144 && mx<176 && my<24) {
int room = room::editor::refExit(ZP);
if (room>=0 || input::keyPressed(SDL_SCANCODE_LCTRL)) room::load(room, ZN);
}
if (mx>144 && mx<176 && my>216) {
int room = room::editor::refExit(ZN);
if (room>=0 || input::keyPressed(SDL_SCANCODE_LCTRL)) room::load(room, ZP);
}
}
}
ui::start();