[Scummvm-git-logs] scummvm master -> 209bcd342608f08460ccd828f11dc649c1019c44
yuv422
noreply at scummvm.org
Mon Nov 18 22:36:57 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
209bcd3426 DARKSEED: Add in-game menu
Commit: 209bcd342608f08460ccd828f11dc649c1019c44
https://github.com/scummvm/scummvm/commit/209bcd342608f08460ccd828f11dc649c1019c44
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2024-11-19T09:35:15+11:00
Commit Message:
DARKSEED: Add in-game menu
Changed paths:
A engines/darkseed/menu.cpp
A engines/darkseed/menu.h
engines/darkseed/console.cpp
engines/darkseed/console.h
engines/darkseed/darkseed.h
engines/darkseed/inventory.cpp
engines/darkseed/module.mk
diff --git a/engines/darkseed/console.cpp b/engines/darkseed/console.cpp
index 64e9e0a745e..0b08cbed82c 100644
--- a/engines/darkseed/console.cpp
+++ b/engines/darkseed/console.cpp
@@ -73,6 +73,10 @@ void Console::draw() {
g_engine->_screen->addDirtyRect(consoleArea);
}
+void Console::drawStringAt(const int x, const int y, const Common::String &text) const {
+ _font.drawString(g_engine->_screen, text, x, y, _font.getStringWidth(text), 0);
+}
+
void Console::addLine(const Common::String &line) {
_text[_startIdx] = line;
_startIdx = (_startIdx + 1) % _text.size();
diff --git a/engines/darkseed/console.h b/engines/darkseed/console.h
index 8d0792db797..bd5524d279f 100644
--- a/engines/darkseed/console.h
+++ b/engines/darkseed/console.h
@@ -46,6 +46,7 @@ public:
void addToCurrentLine(const Common::String &text);
void draw();
+ void drawStringAt(int x, int y, const Common::String &text) const;
private:
void addLine(const Common::String &line);
diff --git a/engines/darkseed/darkseed.h b/engines/darkseed/darkseed.h
index e57c10d1ed9..e5af69c7183 100644
--- a/engines/darkseed/darkseed.h
+++ b/engines/darkseed/darkseed.h
@@ -140,6 +140,7 @@ public:
int16 _soundTimer = 0;
bool _printedcomeheredawson = false;
void zeroMouseButtons();
+ void updateEvents();
void gotoNextMorning();
@@ -249,7 +250,7 @@ public:
private:
void updateBaseSprites();
void gameLoop();
- void updateEvents();
+
void handleInput();
void handlePointerAction();
void loadRoom(int roomNumber);
diff --git a/engines/darkseed/inventory.cpp b/engines/darkseed/inventory.cpp
index 206105cfe3f..61e5fb931f1 100644
--- a/engines/darkseed/inventory.cpp
+++ b/engines/darkseed/inventory.cpp
@@ -21,6 +21,7 @@
#include "darkseed/darkseed.h"
#include "darkseed/inventory.h"
+#include "darkseed/menu.h"
namespace Darkseed {
@@ -140,7 +141,7 @@ void Inventory::handleClick() {
} else if (icon == 43) {
rightArrowClicked();
} else if (icon == 4) {
- // TODO handle in-game menu
+ loadMenu();
} else if (icon == 21) {
g_engine->_console->printTosText(935);
g_engine->_objectVar[21] = 1;
diff --git a/engines/darkseed/menu.cpp b/engines/darkseed/menu.cpp
new file mode 100644
index 00000000000..983f1bff84a
--- /dev/null
+++ b/engines/darkseed/menu.cpp
@@ -0,0 +1,88 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "darkseed/menu.h"
+#include "darkseed/darkseed.h"
+
+namespace Darkseed {
+
+void loadMenu() {
+ g_engine->showFullscreenPic(g_engine->_room->isGiger() ? "glady.pic" : "clady.pic");
+ g_engine->_frame.draw();
+ g_engine->drawFullscreenPic();
+
+ g_engine->_console->drawStringAt(127, 62, "Load");
+ g_engine->_console->drawStringAt(127, 99, "Save");
+ if (true) { // TODO check if sound is enabled
+ g_engine->_console->drawStringAt(117, 136, "Sounds");
+ } else {
+ g_engine->_console->drawStringAt(123, 136, "Silent");
+ }
+ g_engine->_console->drawStringAt(118, 173, "Resume");
+ g_engine->_console->drawStringAt(129, 210, "Quit");
+
+ g_engine->_screen->makeAllDirty();
+ g_engine->_screen->update();
+
+ g_engine->zeroMouseButtons();
+
+ while (!g_engine->shouldQuit()) {
+ g_engine->updateEvents();
+
+ if (g_engine->_isLeftMouseClicked) {
+ g_engine->zeroMouseButtons();
+
+ int menuItemIdx = -1;
+ Common::Point cursorPos = g_engine->_cursor.getPosition();
+
+ if (cursorPos.x > 111 && cursorPos.x < 178 && cursorPos.y > 50 && cursorPos.y < 235) {
+ menuItemIdx = (cursorPos.y - 50) / 37;
+ }
+ if (menuItemIdx > -1 && menuItemIdx < 5) {
+ // FUN_1208_0dac_sound_related(14);
+ }
+
+ if (menuItemIdx == 0) {
+ g_engine->loadGameDialog();
+ break;
+ }
+ if (menuItemIdx == 1) {
+ g_engine->saveGameDialog();
+ break;
+ }
+ if (menuItemIdx == 3) { // Resume
+ break;
+ }
+
+ if (menuItemIdx == 4) {
+ g_engine->quitGame();
+ break;
+ }
+
+ }
+
+ g_engine->_screen->update();
+ }
+
+ g_engine->removeFullscreenPic();
+}
+
+} // End of namespace Darkseed
diff --git a/engines/darkseed/menu.h b/engines/darkseed/menu.h
new file mode 100644
index 00000000000..c19c2610e5f
--- /dev/null
+++ b/engines/darkseed/menu.h
@@ -0,0 +1,31 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef DARKSEED_MENU_H
+#define DARKSEED_MENU_H
+
+namespace Darkseed {
+
+void loadMenu();
+
+} // namespace Darkseed
+
+#endif //DARKSEED_MENU_H
diff --git a/engines/darkseed/module.mk b/engines/darkseed/module.mk
index 9408516237e..e43b8a22880 100644
--- a/engines/darkseed/module.mk
+++ b/engines/darkseed/module.mk
@@ -12,6 +12,7 @@ MODULE_OBJS = \
gamefont.o \
img.o \
inventory.o \
+ menu.o \
metaengine.o \
morph.o \
music.o \
More information about the Scummvm-git-logs
mailing list