[Scummvm-git-logs] scummvm master -> 85b9fa20c7ce8568c12aba4285ef7f1d7e9bdeb7
dreammaster
noreply at scummvm.org
Sat Jun 3 03:32:37 UTC 2023
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8d46e1c5a5 MM: MM1: Further fixes for cast spell display
e7d1ddd36d MM: MM1: Fix Location spell in original
85b9fa20c7 MM: MM1: Location spell view for enhanced mode
Commit: 8d46e1c5a5c9e7ffec60fbf309e2ea0422e9ffa7
https://github.com/scummvm/scummvm/commit/8d46e1c5a5c9e7ffec60fbf309e2ea0422e9ffa7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-06-02T20:32:28-07:00
Commit Message:
MM: MM1: Further fixes for cast spell display
Changed paths:
engines/mm/mm1/views/spells/cast_spell.cpp
engines/mm/mm1/views/spells/cast_spell.h
diff --git a/engines/mm/mm1/views/spells/cast_spell.cpp b/engines/mm/mm1/views/spells/cast_spell.cpp
index 29ba7a0d57d..95ee9152470 100644
--- a/engines/mm/mm1/views/spells/cast_spell.cpp
+++ b/engines/mm/mm1/views/spells/cast_spell.cpp
@@ -81,8 +81,10 @@ void CastSpell::setState(State state) {
void CastSpell::draw() {
clearSurface();
- escToGoBack(0);
+ if (_state == NONE)
+ return;
+ escToGoBack(0);
writeString(7, 0, STRING["dialogs.character.cast_spell"]);
if (_state >= SELECT_NUMBER) {
writeChar(' ');
@@ -92,12 +94,12 @@ void CastSpell::draw() {
if (_state > SELECT_NUMBER) {
writeChar(' ');
- writeNumber(_spellIndex);
+ writeNumber(_spellNumber);
}
switch (_state) {
case SELECT_SPELL:
- _state = ENDING;
+ _state = NONE;
_textEntry.display(27, 20, 1, true,
[]() {
CastSpell *view =
@@ -113,7 +115,7 @@ void CastSpell::draw() {
break;
case SELECT_NUMBER:
- _state = ENDING;
+ _state = NONE;
_textEntry.display(27, 21, 1, true,
[]() {
CastSpell *view =
@@ -139,8 +141,13 @@ void CastSpell::draw() {
writeString(24, 4, STRING["spells.enter_to_cast"]);
break;
- default:
+ case ENDING:
clearSurface();
+ writeString(_spellResultX, 1, _spellResult);
+ delaySeconds(3);
+ break;
+
+ default:
break;
}
}
@@ -163,6 +170,7 @@ void CastSpell::spellNumberEntered(uint num) {
return;
}
+ _spellNumber = num;
setSpell(g_globals->_currCharacter, _spellLevel, num);
if (!canCast()) {
spellDone();
@@ -248,11 +256,10 @@ void CastSpell::spellDone(const Common::String &msg, int xp) {
g_events->focusedView()->send(gameMsg);
} else {
- _state = ENDING;
Sound::sound(SOUND_2);
- clearSurface();
- writeString(xp, 1, msg);
- delaySeconds(3);
+ _spellResult = msg;
+ _spellResultX = xp;
+ setState(ENDING);
}
}
diff --git a/engines/mm/mm1/views/spells/cast_spell.h b/engines/mm/mm1/views/spells/cast_spell.h
index 64e2073721b..e04cb6d1372 100644
--- a/engines/mm/mm1/views/spells/cast_spell.h
+++ b/engines/mm/mm1/views/spells/cast_spell.h
@@ -33,13 +33,16 @@ namespace Spells {
class CastSpell : public SpellView, public MM1::Game::SpellCasting {
enum State {
- SELECT_SPELL, SELECT_NUMBER, SELECT_CHAR, PRESS_ENTER,
- ENDING
+ NONE, SELECT_SPELL, SELECT_NUMBER, SELECT_CHAR, PRESS_ENTER, ENDING
};
private:
State _state = SELECT_SPELL;
TextEntry _textEntry;
int _spellLevel = -1;
+ int _spellNumber = -1;
+ Common::String _spellResult;
+ int _spellResultX = -1;
+
private:
/**
* Set the current state
Commit: e7d1ddd36dfc224ed9dd2d55a2896bac8667b5a8
https://github.com/scummvm/scummvm/commit/e7d1ddd36dfc224ed9dd2d55a2896bac8667b5a8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-06-02T20:32:28-07:00
Commit Message:
MM: MM1: Fix Location spell in original
Changed paths:
engines/mm/mm1/game/spells_party.cpp
engines/mm/mm1/views/spells/cast_spell.cpp
engines/mm/mm1/views/spells/location.cpp
engines/mm/mm1/views/spells/location.h
diff --git a/engines/mm/mm1/game/spells_party.cpp b/engines/mm/mm1/game/spells_party.cpp
index d4803c57c52..1c4caa7fba2 100644
--- a/engines/mm/mm1/game/spells_party.cpp
+++ b/engines/mm/mm1/game/spells_party.cpp
@@ -690,7 +690,7 @@ SpellResult SpellsParty::wizard15_leatherSkin() {
}
SpellResult SpellsParty::wizard17_location() {
- Views::Spells::Location::show();
+ g_events->replaceView("Location");
return SR_SUCCESS_SILENT;
}
@@ -974,7 +974,7 @@ SpellResult SpellsParty::wizard71_astralSpell() {
}
SpellResult SpellsParty::wizard72_duplication() {
- g_events->addView("Duplication");
+ g_events->replaceView("Duplication");
return SR_SUCCESS_SILENT;
}
diff --git a/engines/mm/mm1/views/spells/cast_spell.cpp b/engines/mm/mm1/views/spells/cast_spell.cpp
index 95ee9152470..fa2fae7db4c 100644
--- a/engines/mm/mm1/views/spells/cast_spell.cpp
+++ b/engines/mm/mm1/views/spells/cast_spell.cpp
@@ -233,7 +233,7 @@ void CastSpell::performSpell(Character *chr) {
default:
// Spell done, but don't display done message
- if (isInCombat())
+ if (isFocused())
close();
break;
}
diff --git a/engines/mm/mm1/views/spells/location.cpp b/engines/mm/mm1/views/spells/location.cpp
index b34cd0c404b..154b5ab4bfa 100644
--- a/engines/mm/mm1/views/spells/location.cpp
+++ b/engines/mm/mm1/views/spells/location.cpp
@@ -27,13 +27,6 @@ namespace MM1 {
namespace Views {
namespace Spells {
-void Location::show() {
- UIElement *view = dynamic_cast<Location *>(g_events->findView("Location"));
- assert(view);
-
- view->open();
-}
-
Location::Location() : SpellView("Location") {
_bounds = getLineBounds(20, 24);
}
@@ -100,8 +93,10 @@ void Location::draw() {
}
}
-bool Location::msgKeypress(const KeypressMessage &msg) {
- close();
+bool Location::msgAction(const ActionMessage &msg) {
+ if (msg._action == KEYBIND_SELECT || msg._action == KEYBIND_ESCAPE)
+ close();
+
return true;
}
diff --git a/engines/mm/mm1/views/spells/location.h b/engines/mm/mm1/views/spells/location.h
index 103b0eb35f8..43804c97dc8 100644
--- a/engines/mm/mm1/views/spells/location.h
+++ b/engines/mm/mm1/views/spells/location.h
@@ -30,11 +30,6 @@ namespace Views {
namespace Spells {
class Location : public SpellView {
-public:
- /**
- * Show the view
- */
- static void show();
public:
/**
* Constructor
@@ -52,9 +47,9 @@ public:
void draw() override;
/**
- * Keypress handler
+ * Action handler
*/
- bool msgKeypress(const KeypressMessage &msg) override;
+ bool msgAction(const ActionMessage &msg) override;
};
} // namespace Spells
Commit: 85b9fa20c7ce8568c12aba4285ef7f1d7e9bdeb7
https://github.com/scummvm/scummvm/commit/85b9fa20c7ce8568c12aba4285ef7f1d7e9bdeb7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-06-02T20:32:28-07:00
Commit Message:
MM: MM1: Location spell view for enhanced mode
Changed paths:
A engines/mm/mm1/views_enh/spells/location.cpp
A engines/mm/mm1/views_enh/spells/location.h
devtools/create_mm/files/mm1/strings_en.yml
engines/mm/mm1/maps/map.h
engines/mm/mm1/views/spells/location.cpp
engines/mm/mm1/views_enh/dialogs.h
engines/mm/module.mk
diff --git a/devtools/create_mm/files/mm1/strings_en.yml b/devtools/create_mm/files/mm1/strings_en.yml
index f0241e292fb..77dee261f86 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -323,20 +323,20 @@ dialogs:
not_enough_sp: "Not enough spell points"
backpack_full: "Backpack is full"
spells:
- detect_charges: "magic (charges)"
- fly_to_x: "fly to (a-e): "
+ detect_charges: "Magic (charges)"
+ fly_to_x: "Fly to (A-E): "
fly_to_y: "(1-4): "
- location_loc: "location: "
- location_town: "in town"
+ location_loc: "Location: "
+ location_town: "In town"
location_castle: "in castle"
- location_outdoors: "outdoors"
- location_unknown: "unknown"
+ location_outdoors: "Outdoors"
+ location_unknown: "Unknown"
location_under: "0' under"
- location_sector: "map sector: "
- location_surface_x: "surface: x="
- location_inside_x: "inside: x="
- location_facing: "facing: "
- teleport_dir: "direction (n,e,s,w): "
+ location_sector: "Map sector: "
+ location_surface_x: "Surface: "
+ location_inside_x: "Inside: "
+ location_facing: "Facing: "
+ teleport_dir: "Direction (N,E,S,W): "
teleport_squares: "# of squares (0-9): "
encounter:
title: " Encounter! "
diff --git a/engines/mm/mm1/maps/map.h b/engines/mm/mm1/maps/map.h
index f2969f6c43b..2020e1ad056 100644
--- a/engines/mm/mm1/maps/map.h
+++ b/engines/mm/mm1/maps/map.h
@@ -66,9 +66,9 @@ enum DataOffset {
MAP_32 = 32,
MAP_33 = 33,
MAP_MAX_MONSTERS = 34,
- MAP_35 = 35,
- MAP_36 = 36,
- MAP_37 = 37,
+ MAP_SECTOR1 = 35,
+ MAP_SECTOR2 = 36,
+ MAP_TYPE = 37,
MAP_DISPEL_THRESHOLD = 38,
MAP_SURFACE_ID = 39,
MAP_SURFACE_SECTION = 41,
diff --git a/engines/mm/mm1/views/spells/location.cpp b/engines/mm/mm1/views/spells/location.cpp
index 154b5ab4bfa..571c45c797c 100644
--- a/engines/mm/mm1/views/spells/location.cpp
+++ b/engines/mm/mm1/views/spells/location.cpp
@@ -41,7 +41,7 @@ void Location::draw() {
writeString(0, 0, STRING["dialogs.spells.location_loc"]);
- v = map[37];
+ v = map[Maps::MAP_TYPE];
if (v == 0xff) {
writeString(STRING["dialogs.spells.location_unknown"]);
} else {
@@ -49,7 +49,7 @@ void Location::draw() {
writeString(STRING["dialogs.spells.location_outdoors"]);
} else if (!(v & 0x80)) {
writeChar('0' + map[37]);
- writeString(STRING["dialogs.spells.location_undoor"]);
+ writeString(STRING["dialogs.spells.location_under"]);
} else if (v == 0xfe) {
writeString(STRING["dialogs.spells.location_town"]);
} else {
@@ -57,18 +57,20 @@ void Location::draw() {
}
writeString(21, 0, STRING["dialogs.spells.location_sector"]);
- writeChar(map[Maps::MAP_35] & 0x7f);
+ writeChar(map[Maps::MAP_SECTOR1] & 0x7f);
writeChar('-');
- writeChar(map[Maps::MAP_36] & 0x7f);
+ writeChar(map[Maps::MAP_SECTOR2] & 0x7f);
writeString(21, 1, STRING["dialogs.spells.location_surface_x"]);
+ writeString("X=");
- if (map[Maps::MAP_37]) {
+ if (map[Maps::MAP_TYPE]) {
writeNumber(map[Maps::MAP_SURFACE_X]);
writeString(35, 1, "Y=");
writeNumber(map[Maps::MAP_SURFACE_Y]);
writeString(22, 2, STRING["dialogs.spells.location_inside_x"]);
+ writeString("X=");
}
writeNumber(maps._mapPos.x);
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index 075935cff4b..f63678cef85 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -87,6 +87,7 @@
#include "mm/mm1/views_enh/locations/training.h"
#include "mm/mm1/views_enh/spells/cast_spell.h"
#include "mm/mm1/views_enh/spells/spellbook.h"
+#include "mm/mm1/views_enh/spells/location.h"
namespace MM {
namespace MM1 {
@@ -137,6 +138,7 @@ private:
ViewsEnh::Locations::Training _training;
ViewsEnh::Spells::CastSpell _castSpell;
ViewsEnh::Spells::Spellbook _spellbook;
+ ViewsEnh::Spells::Location _location;
ViewsEnh::CharacterInfo _characterInfo;
ViewsEnh::CharacterInfoCombat _characterInfoCombat;
ViewsEnh::CharacterInventory _characterInventory;
diff --git a/engines/mm/mm1/views_enh/spells/location.cpp b/engines/mm/mm1/views_enh/spells/location.cpp
new file mode 100644
index 00000000000..c7a40cd0527
--- /dev/null
+++ b/engines/mm/mm1/views_enh/spells/location.cpp
@@ -0,0 +1,117 @@
+/* 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 "mm/mm1/views_enh/spells/location.h"
+#include "mm/mm1/globals.h"
+
+#define TEXT_X1 160
+#define TEXT_X2 195
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Spells {
+
+Location::Location() : ScrollView("Location") {
+ setBounds(Common::Rect(0, 144, 234, 200));
+ addButton(&g_globals->_escSprites, Common::Point(5, 28), 0, KEYBIND_ESCAPE, true);
+}
+
+void Location::draw() {
+ Maps::Maps &maps = *g_maps;
+ Maps::Map &map = *maps._currentMap;
+ byte v;
+
+ ScrollView::draw();
+
+ setReduced(true);
+ writeString(20, 30, STRING["enhdialogs.misc.go_back"]);
+
+ writeLine(0, STRING["dialogs.spells.location_loc"], ALIGN_LEFT, 0);
+
+ v = map[Maps::MAP_TYPE];
+ if (v == 0xff) {
+ writeString(STRING["dialogs.spells.location_unknown"]);
+ } else {
+ if (v == 0) {
+ writeString(STRING["dialogs.spells.location_outdoors"]);
+ } else if (!(v & 0x80)) {
+ writeChar('0' + map[37]);
+ writeString(STRING["dialogs.spells.location_under"]);
+ } else if (v == 0xfe) {
+ writeString(STRING["dialogs.spells.location_town"]);
+ } else {
+ writeString(STRING["dialogs.spells.location_castle"]);
+ }
+
+ writeLine(0, STRING["dialogs.spells.location_sector"], ALIGN_LEFT, 111);
+ writeChar(map[Maps::MAP_SECTOR1] & 0x7f);
+ writeChar('-');
+ writeChar(map[Maps::MAP_SECTOR2] & 0x7f);
+
+ writeLine(1, STRING["dialogs.spells.location_surface_x"], ALIGN_RIGHT, TEXT_X1);
+ writeString("X=");
+
+ if (map[Maps::MAP_TYPE]) {
+ writeNumber(map[Maps::MAP_SURFACE_X]);
+ writeLine(1, "Y=", ALIGN_LEFT, TEXT_X2);
+ writeNumber(map[Maps::MAP_SURFACE_Y]);
+
+ writeLine(2, STRING["dialogs.spells.location_inside_x"], ALIGN_RIGHT, TEXT_X1);
+ writeString("X=");
+ }
+
+ writeNumber(maps._mapPos.x);
+ _textPos.x = TEXT_X2;
+ writeString("Y=");
+ writeNumber(maps._mapPos.y);
+
+ writeLine(3, STRING["dialogs.spells.location_facing"], ALIGN_RIGHT, TEXT_X1);
+ switch (maps._forwardMask) {
+ case Maps::DIRMASK_N:
+ writeChar('N');
+ break;
+ case Maps::DIRMASK_S:
+ writeChar('S');
+ break;
+ case Maps::DIRMASK_E:
+ writeChar('E');
+ break;
+ default:
+ writeChar('W');
+ break;
+ }
+ }
+
+ setReduced(false);
+}
+
+bool Location::msgAction(const ActionMessage &msg) {
+ if (msg._action == KEYBIND_SELECT || msg._action == KEYBIND_ESCAPE)
+ g_events->replaceView("Game", true);
+
+ return true;
+}
+
+} // namespace Spells
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/spells/location.h b/engines/mm/mm1/views_enh/spells/location.h
new file mode 100644
index 00000000000..edf32d9eb97
--- /dev/null
+++ b/engines/mm/mm1/views_enh/spells/location.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 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 MM1_VIEWS_ENH_SPELLS_LOCATION_H
+#define MM1_VIEWS_ENH_SPELLS_LOCATION_H
+
+#include "mm/mm1/views_enh/scroll_view.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+namespace Spells {
+
+class Location : public ScrollView {
+public:
+ Location();
+ virtual ~Location() {
+ }
+
+ void draw() override;
+ bool msgAction(const ActionMessage &msg) override;
+};
+
+} // namespace Spells
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index b376e0f5a96..eeaf4def54a 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -134,6 +134,7 @@ MODULE_OBJS += \
mm1/views/wheel_spin.o \
mm1/views_enh/spells/cast_spell.o \
mm1/views_enh/spells/spellbook.o \
+ mm1/views_enh/spells/location.o \
mm1/views_enh/button_container.o \
mm1/views_enh/character_base.o \
mm1/views_enh/character_info.o \
More information about the Scummvm-git-logs
mailing list