aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/xeen/dialogs_dismiss.cpp99
-rw-r--r--engines/xeen/dialogs_dismiss.h47
-rw-r--r--engines/xeen/interface.cpp17
-rw-r--r--engines/xeen/interface.h2
-rw-r--r--engines/xeen/module.mk1
-rw-r--r--engines/xeen/resources.cpp2
-rw-r--r--engines/xeen/resources.h2
7 files changed, 170 insertions, 0 deletions
diff --git a/engines/xeen/dialogs_dismiss.cpp b/engines/xeen/dialogs_dismiss.cpp
new file mode 100644
index 0000000000..304c7a0cef
--- /dev/null
+++ b/engines/xeen/dialogs_dismiss.cpp
@@ -0,0 +1,99 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "xeen/dialogs_dismiss.h"
+#include "xeen/party.h"
+#include "xeen/resources.h"
+#include "xeen/xeen.h"
+
+namespace Xeen {
+
+void Dismiss::show(XeenEngine *vm) {
+ Dismiss *dlg = new Dismiss(vm);
+ dlg->execute();
+ delete dlg;
+}
+
+void Dismiss::execute() {
+ Screen &screen = *_vm->_screen;
+ EventsManager &events = *_vm->_events;
+ Interface &intf = *_vm->_interface;
+ Party &party = *_vm->_party;
+ loadButtons();
+
+ Window &w = screen._windows[31];
+ w.open();
+ _iconSprites.draw(w, 0, Common::Point(225, 120));
+ w.update();
+
+ while (!_vm->shouldQuit()) {
+ do {
+ events.updateGameCounter();
+ intf.draw3d(false);
+ w.frame();
+ w.writeString("\r");
+ _iconSprites.draw(w, 0, Common::Point(225, 120));
+ screen._windows[3].update();
+ w.update();
+
+ do {
+ events.pollEventsAndWait();
+ checkEvents(_vm);
+ } while (!_vm->shouldQuit() && !_buttonValue && events.timeElapsed() == 0);
+ } while (!_vm->shouldQuit() && !_buttonValue);
+
+ if (_buttonValue >= Common::KEYCODE_F1 && _buttonValue <= Common::KEYCODE_F6) {
+ _buttonValue -= Common::KEYCODE_F1;
+
+ if (_buttonValue < (int)party._activeParty.size()) {
+ if (party._activeParty.size() == 1) {
+ w.close();
+ ErrorScroll::show(_vm, CANT_DISMISS_LAST_CHAR, WT_NONFREEZED_WAIT);
+ w.open();
+ } else {
+ Character tempChar = party._activeParty[_buttonValue];
+ int charIndex = party._partyMembers[_buttonValue];
+ intf._partyFaces[_buttonValue] = 0;
+
+ intf.sortFaces();
+// party.sortParty();
+
+ // TODO
+ }
+ break;
+ }
+ } else if (_buttonValue == Common::KEYCODE_ESCAPE) {
+
+ }
+ }
+}
+
+void Dismiss::loadButtons() {
+ _iconSprites.load("esc.icn");
+ addButton(Common::Rect(225, 120, 249, 140), Common::KEYCODE_ESCAPE, &_iconSprites);
+ addButton(Common::Rect(16, 16, 48, 48), Common::KEYCODE_1, &_iconSprites, false);
+ addButton(Common::Rect(117, 16, 149, 48), Common::KEYCODE_2, &_iconSprites, false);
+ addButton(Common::Rect(16, 59, 48, 91), Common::KEYCODE_3, &_iconSprites, false);
+ addButton(Common::Rect(117, 59, 149, 91), Common::KEYCODE_4, &_iconSprites, false);
+}
+
+} // End of namespace Xeen
diff --git a/engines/xeen/dialogs_dismiss.h b/engines/xeen/dialogs_dismiss.h
new file mode 100644
index 0000000000..ec40e87f7c
--- /dev/null
+++ b/engines/xeen/dialogs_dismiss.h
@@ -0,0 +1,47 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef XEEN_DIALOGS_DISMISS_H
+#define XEEN_DIALOGS_DISMISS_H
+
+#include "xeen/dialogs.h"
+#include "xeen/party.h"
+
+namespace Xeen {
+
+class Dismiss : public ButtonContainer {
+private:
+ XeenEngine *_vm;
+ SpriteResource _iconSprites;
+
+ Dismiss(XeenEngine *vm) : ButtonContainer(), _vm(vm) {}
+
+ void execute();
+
+ void loadButtons();
+public:
+ static void show(XeenEngine *vm);
+};
+
+} // End of namespace Xeen
+
+#endif /* XEEN_DIALOGS_DISMISS_H */
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 0d734aa0ce..b51801fd58 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -385,6 +385,23 @@ void Interface::charIconsPrint(bool updateFlag) {
screen._windows[33].update();
}
+/**
+ * Removes any empty character entries from the faces list
+ */
+void Interface::sortFaces() {
+ for (uint charIdx = 0; charIdx < MAX_ACTIVE_PARTY; ++charIdx) {
+ if (!_partyFaces[charIdx]) {
+ for (uint charIdx2 = charIdx + 1; charIdx2 < 8; ++charIdx2) {
+ if (_partyFaces[charIdx2]) {
+ _partyFaces[charIdx] = _partyFaces[charIdx2];
+ _partyFaces[charIdx2] = 0;
+ break;
+ }
+ }
+ }
+ }
+}
+
void Interface::drawViewBackground(int bgType) {
if (bgType >= 4)
return;
diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h
index 9d7cb5cd4f..0f5ca18780 100644
--- a/engines/xeen/interface.h
+++ b/engines/xeen/interface.h
@@ -97,6 +97,8 @@ public:
void charIconsPrint(bool updateFlag);
+ void sortFaces();
+
void doFalling();
void highlightChar(int charId);
diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk
index 8c526b4e46..50d7891ad2 100644
--- a/engines/xeen/module.mk
+++ b/engines/xeen/module.mk
@@ -12,6 +12,7 @@ MODULE_OBJS := \
automap.o \
dialogs_automap.o \
dialogs_char_info.o \
+ dialogs_dismiss.o \
dialogs_error.o \
dialogs_exchange.o \
dialogs_options.o \
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index d127ddcfc4..11b209274d 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -1432,4 +1432,6 @@ const char *const HIT_SPELL_POINTS_RESTORED = "Hit Pts and Spell Pts restored.";
const char *const TOO_DANGEROUS_TO_REST = "Too dangerous to rest here!";
const char *const SOME_CHARS_MAY_DIE = "Some Chars may die. Rest anyway?";
+const char *const CANT_DISMISS_LAST_CHAR = "You cannot dismiss your last character!";
+
} // End of namespace Xeen
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index 517d6e4caf..f7609bc2cd 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -492,6 +492,8 @@ extern const char *const HIT_SPELL_POINTS_RESTORED;
extern const char *const TOO_DANGEROUS_TO_REST;
extern const char *const SOME_CHARS_MAY_DIE;
+extern const char *const CANT_DISMISS_LAST_CHAR;
+
} // End of namespace Xeen
#endif /* XEEN_RESOURCES_H */