[Scummvm-git-logs] scummvm master -> db07aeb51d9ddcd1dca0a2b4c56c9cd5b8a4955f
dreammaster
dreammaster at scummvm.org
Mon Feb 19 18:00:06 CET 2018
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a282cea492 XEEN: Fix shadowed field warning in SpriteResource
db07aeb51d XEEN: Implement Quick Fight Options dialog
Commit: a282cea4921d7004b4a6360cdb4ed68c94345487
https://github.com/scummvm/scummvm/commit/a282cea4921d7004b4a6360cdb4ed68c94345487
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-02-19T10:28:18-05:00
Commit Message:
XEEN: Fix shadowed field warning in SpriteResource
Changed paths:
engines/xeen/sprites.cpp
diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp
index 2959d87..ea0400b 100644
--- a/engines/xeen/sprites.cpp
+++ b/engines/xeen/sprites.cpp
@@ -352,7 +352,7 @@ uint SpriteResource::getScaledVal(int xy, uint16 &scaleMask) {
Common::Point SpriteResource::getFrameSize(int frame) const {
Common::MemoryReadStream f(_data, _filesize);
- Common::Point size;
+ Common::Point frameSize;
for (int idx = 0; idx < (_index[frame]._offset2 ? 2 : 1); ++idx) {
f.seek((idx == 0) ? _index[frame]._offset1 : _index[frame]._offset2);
@@ -361,11 +361,11 @@ Common::Point SpriteResource::getFrameSize(int frame) const {
int yOffset = f.readUint16LE();
int height = f.readUint16LE();
- size.x = MAX((int)size.x, xOffset + width);
- size.y = MAX((int)size.y, yOffset + height);
+ frameSize.x = MAX((int)frameSize.x, xOffset + width);
+ frameSize.y = MAX((int)frameSize.y, yOffset + height);
}
- return size;
+ return frameSize;
}
} // End of namespace Xeen
Commit: db07aeb51d9ddcd1dca0a2b4c56c9cd5b8a4955f
https://github.com/scummvm/scummvm/commit/db07aeb51d9ddcd1dca0a2b4c56c9cd5b8a4955f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-02-19T11:59:59-05:00
Commit Message:
XEEN: Implement Quick Fight Options dialog
Changed paths:
A engines/xeen/dialogs_quick_fight.cpp
A engines/xeen/dialogs_quick_fight.h
R engines/xeen/dialogs_fight_options.cpp
R engines/xeen/dialogs_fight_options.h
engines/xeen/interface.cpp
engines/xeen/module.mk
engines/xeen/resources.cpp
engines/xeen/resources.h
diff --git a/engines/xeen/dialogs_fight_options.cpp b/engines/xeen/dialogs_fight_options.cpp
deleted file mode 100644
index c84e754..0000000
--- a/engines/xeen/dialogs_fight_options.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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_fight_options.h"
-#include "xeen/resources.h"
-#include "xeen/xeen.h"
-
-namespace Xeen {
-
-void FightOptions::show(XeenEngine *vm) {
- FightOptions *dlg = new FightOptions(vm);
- dlg->execute();
- delete dlg;
-}
-
-void FightOptions::execute() {
- error("TODO: FightOptions");
-}
-
-} // End of namespace Xeen
diff --git a/engines/xeen/dialogs_fight_options.h b/engines/xeen/dialogs_fight_options.h
deleted file mode 100644
index 823a716..0000000
--- a/engines/xeen/dialogs_fight_options.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* 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_FIGHT_OPTIONS_H
-#define XEEN_DIALOGS_FIGHT_OPTIONS_H
-
-#include "xeen/dialogs.h"
-
-namespace Xeen {
-
-class FightOptions : public ButtonContainer {
-private:
- FightOptions(XeenEngine *vm) : ButtonContainer(vm) {}
-
- void execute();
-public:
- static void show(XeenEngine *vm);
-};
-
-} // End of namespace Xeen
-
-#endif /* XEEN_DIALOGS_FIGHT_OPTIONS_H */
diff --git a/engines/xeen/dialogs_quick_fight.cpp b/engines/xeen/dialogs_quick_fight.cpp
new file mode 100644
index 0000000..74261a8
--- /dev/null
+++ b/engines/xeen/dialogs_quick_fight.cpp
@@ -0,0 +1,105 @@
+/* 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_quick_fight.h"
+#include "xeen/resources.h"
+#include "xeen/xeen.h"
+
+namespace Xeen {
+
+void QuickFight::show(XeenEngine *vm, Character *currentChar) {
+ QuickFight *dlg = new QuickFight(vm, currentChar);
+ dlg->execute();
+ delete dlg;
+}
+
+QuickFight::QuickFight(XeenEngine *vm, Character *currentChar) : ButtonContainer(vm),
+ _currentChar(currentChar) {
+ loadButtons();
+}
+
+void QuickFight::execute() {
+ Combat &combat = *_vm->_combat;
+ EventsManager &events = *_vm->_events;
+ Interface &intf = *_vm->_interface;
+ Party &party = *_vm->_party;
+ Windows &windows = *_vm->_windows;
+ Window &w = windows[10];
+ w.open();
+
+ do {
+ // Draw the dialog text and buttons
+ Common::String msg = Common::String::format(Res.QUICK_FIGHT_TEXT,
+ _currentChar->_name.c_str(),
+ Res.QUICK_FIGHT_OPTIONS[_currentChar->_quickOption]);
+ w.writeString(msg);
+ drawButtons(&w);
+
+ // Wait for selection
+ _buttonValue = 0;
+ events.updateGameCounter();
+ do {
+ intf.draw3d(false, false);
+
+ events.pollEventsAndWait();
+ checkEvents(_vm);
+ if (_vm->shouldExit())
+ return;
+ } while (!_buttonValue && !events.timeElapsed());
+
+ switch (_buttonValue) {
+ case Common::KEYCODE_n:
+ case Common::KEYCODE_t:
+ _currentChar->_quickOption = (QuickAction)(((int)_currentChar->_quickOption + 1) % 4);
+ break;
+
+ case Common::KEYCODE_F1:
+ case Common::KEYCODE_F2:
+ case Common::KEYCODE_F3:
+ case Common::KEYCODE_F4:
+ case Common::KEYCODE_F5:
+ case Common::KEYCODE_F6: {
+ int charIdx = _buttonValue - Common::KEYCODE_F1;
+ if (charIdx < (int)combat._combatParty.size()) {
+ // Highlight new character
+ _currentChar = &party._activeParty[charIdx];
+ intf.highlightChar(charIdx);
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ } while (_buttonValue != Common::KEYCODE_RETURN && _buttonValue != Common::KEYCODE_ESCAPE);
+
+ w.close();
+ events.clearEvents();
+}
+
+void QuickFight::loadButtons() {
+ _icons.load("train.icn");
+ addButton(Common::Rect(281, 108, 305, 128), Common::KEYCODE_ESCAPE, &_icons);
+ addButton(Common::Rect(242, 108, 266, 128), Common::KEYCODE_t, &_icons);
+}
+
+} // End of namespace Xeen
diff --git a/engines/xeen/dialogs_quick_fight.h b/engines/xeen/dialogs_quick_fight.h
new file mode 100644
index 0000000..66f4d3c
--- /dev/null
+++ b/engines/xeen/dialogs_quick_fight.h
@@ -0,0 +1,60 @@
+/* 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_QUICK_FIGHT_H
+#define XEEN_DIALOGS_QUICK_FIGHT_H
+
+#include "xeen/character.h"
+#include "xeen/dialogs.h"
+#include "xeen/sprites.h"
+
+namespace Xeen {
+
+class QuickFight : public ButtonContainer {
+private:
+ SpriteResource _icons;
+ Character *_currentChar;
+private:
+ /**
+ * Constructor
+ */
+ QuickFight(XeenEngine *vm, Character *currentChar);
+
+ /**
+ * Executes the display of the dialog
+ */
+ void execute();
+
+ /**
+ * Load butons for the dialog
+ */
+ void loadButtons();
+public:
+ /**
+ * Show the dialog
+ */
+ static void show(XeenEngine *vm, Character *currentChar);
+};
+
+} // End of namespace Xeen
+
+#endif /* XEEN_DIALOGS_QUICK_FIGHT_H */
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 0e29ffa..9ce2553 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -24,7 +24,7 @@
#include "xeen/dialogs_char_info.h"
#include "xeen/dialogs_control_panel.h"
#include "xeen/dialogs_message.h"
-#include "xeen/dialogs_fight_options.h"
+#include "xeen/dialogs_quick_fight.h"
#include "xeen/dialogs_info.h"
#include "xeen/dialogs_items.h"
#include "xeen/dialogs_map.h"
@@ -1578,8 +1578,8 @@ void Interface::doCombat() {
break;
case Common::KEYCODE_o:
- // Fight Options
- FightOptions::show(_vm);
+ // Quick Fight Options
+ QuickFight::show(_vm, combat._combatParty[combat._whosTurn]);
highlightChar(combat._whosTurn);
break;
diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk
index a7ac73e..c963ad3 100644
--- a/engines/xeen/module.mk
+++ b/engines/xeen/module.mk
@@ -20,7 +20,6 @@ MODULE_OBJS := \
dialogs_create_char.o \
dialogs_dismiss.o \
dialogs_exchange.o \
- dialogs_fight_options.o \
dialogs_info.o \
dialogs_input.o \
dialogs_items.o \
@@ -29,6 +28,7 @@ MODULE_OBJS := \
dialogs_party.o \
dialogs_query.o \
dialogs_quests.o \
+ dialogs_quick_fight.o \
dialogs_quick_ref.o \
dialogs_spells.o \
dialogs_whowill.o \
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index 47d2959..7048726 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -1693,6 +1693,12 @@ const char *const Resources::NO_LOADING_IN_COMBAT =
"No Loading Allowed in Combat!";
const char *const Resources::NO_SAVING_IN_COMBAT =
"No Saving Allowed in Combat!";
+const char *const Resources::QUICK_FIGHT_TEXT = "\r\fd\x3""c\v000\t000QuickFight Options\n\n"
+ "%s\x3l\n\n"
+ "Current\x3r\n"
+ "\t000%s\x2\x3""c\v122\t021\f37N\f04ext\t060Exit\x1";
+const char *const Resources::QUICK_FIGHT_OPTIONS[4] = { "Attack", "Cast", "Block", "Run" };
+
const char *const Resources::WORLD_END_TEXT[9] = {
"\n\n\n\n\n\n\n"
"Congratulations Adventurers!\n\n"
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index dbf8767..c9e0c2f 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -361,6 +361,8 @@ public:
static const char *const MR_WIZARD;
static const char *const NO_LOADING_IN_COMBAT;
static const char *const NO_SAVING_IN_COMBAT;
+ static const char *const QUICK_FIGHT_TEXT;
+ static const char *const QUICK_FIGHT_OPTIONS[4];
static const char *const WORLD_END_TEXT[9];
static const char *const WORLD_CONGRATULATIONS;
static const char *const WORLD_CONGRATULATIONS2;
More information about the Scummvm-git-logs
mailing list