[Scummvm-git-logs] scummvm master -> e8ed87b77be7bb100918828ac3bf9c13d479e5dd
dreammaster
noreply at scummvm.org
Wed May 31 04:07:09 UTC 2023
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:
772f2e58fa MM: MM1: Fix renaming characters
e8ed87b77b MM: MM1: Simplify rendering enhanced title screen
Commit: 772f2e58fade57761154ef3d0675cb6b011ec3ef
https://github.com/scummvm/scummvm/commit/772f2e58fade57761154ef3d0675cb6b011ec3ef
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-05-30T20:01:01-07:00
Commit Message:
MM: MM1: Fix renaming characters
Changed paths:
engines/mm/mm1/views_enh/character_manage.cpp
diff --git a/engines/mm/mm1/views_enh/character_manage.cpp b/engines/mm/mm1/views_enh/character_manage.cpp
index c9f51e619a4..e7225ea1577 100644
--- a/engines/mm/mm1/views_enh/character_manage.cpp
+++ b/engines/mm/mm1/views_enh/character_manage.cpp
@@ -63,6 +63,7 @@ void CharacterManage::draw() {
break;
case RENAME:
+ _state = DISPLAY;
writeString(80, 172, STRING["dialogs.view_character.name"]);
_textEntry.display(130, 180, 15, false,
[]() {
Commit: e8ed87b77be7bb100918828ac3bf9c13d479e5dd
https://github.com/scummvm/scummvm/commit/e8ed87b77be7bb100918828ac3bf9c13d479e5dd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-05-30T21:06:54-07:00
Commit Message:
MM: MM1: Simplify rendering enhanced title screen
Changed paths:
engines/mm/mm1/views_enh/main_menu.cpp
engines/mm/mm1/views_enh/main_menu.h
diff --git a/engines/mm/mm1/views_enh/main_menu.cpp b/engines/mm/mm1/views_enh/main_menu.cpp
index efd179250f2..0270cc35233 100644
--- a/engines/mm/mm1/views_enh/main_menu.cpp
+++ b/engines/mm/mm1/views_enh/main_menu.cpp
@@ -31,21 +31,7 @@ namespace MM {
namespace MM1 {
namespace ViewsEnh {
-bool MainMenu::msgFocus(const FocusMessage &msg) {
- ScrollView::msgFocus(msg);
- loadCircles();
- return true;
-}
-
-bool MainMenu::msgUnfocus(const UnfocusMessage &msg) {
- ScrollView::msgUnfocus(msg);
- _circles[0].clear();
- _circles[1].clear();
- return true;
-}
-
-void MainMenu::loadCircles() {
- const Common::Rect r(0, 0, (CIRCLE_RADIUS + 1) * 2, (CIRCLE_RADIUS + 1) * 2);
+void MainMenu::drawCircles() {
Gfx::ScreenDecoder decoder;
decoder._indexes[0] = 0;
decoder._indexes[1] = 2;
@@ -55,25 +41,30 @@ void MainMenu::loadCircles() {
for (int i = 0; i < 2; ++i) {
if (decoder.loadFile(Common::String::format("screen%d", i))) {
const Graphics::Surface *src = decoder.getSurface();
- Graphics::ManagedSurface *dest = &_circles[i];
- dest->create((CIRCLE_RADIUS + 1) * 2, (CIRCLE_RADIUS + 1) * 2);
- dest->fillRect(r, 255);
- dest->setTransparentColor(255);
- copyCircle(src, dest);
+ if (i == 0) {
+ copyCircle(src, Common::Point(160 - CIRCLE_RADIUS * 2 - 10, 10));
+ } else {
+ copyCircle(src, Common::Point(160 + 10, 10));
+ }
}
}
}
void MainMenu::copyCircle(const Graphics::Surface *src,
- Graphics::ManagedSurface *dest) {
+ const Common::Point &destPos) {
int radius = CIRCLE_RADIUS;
int x = 0;
int y = radius;
int p = 1 - radius;
- /* Plot first set of points */
- drawCircleLine(src, dest, x, y);
+ Graphics::ManagedSurface s = getSurface();
+ Graphics::ManagedSurface dest(s, Common::Rect(
+ destPos.x, destPos.y, destPos.x + CIRCLE_RADIUS * 2,
+ destPos.y + CIRCLE_RADIUS * 2));
+
+ // Plot first set of points
+ drawCircleLine(src, &dest, x, y);
while (x < y) {
x++;
@@ -83,7 +74,7 @@ void MainMenu::copyCircle(const Graphics::Surface *src,
y--;
p += 2 * (x - y) + 1;
}
- drawCircleLine(src, dest, x + 1, y + 1);
+ drawCircleLine(src, &dest, x + 1, y + 1);
}
}
@@ -95,9 +86,6 @@ void MainMenu::drawCircleLine(const Graphics::Surface *src,
src1 = (const byte *)src->getBasePtr(CIRCLE_X + CIRCLE_RADIUS - x, CIRCLE_Y + CIRCLE_RADIUS + y);
src2 = (const byte *)src->getBasePtr(CIRCLE_X + CIRCLE_RADIUS + x, CIRCLE_Y + CIRCLE_RADIUS + y);
dest1 = (byte *)dest->getBasePtr(CIRCLE_RADIUS - x, CIRCLE_RADIUS + y);
-
-const byte *dest2 = dest1 + (src2 - src1);
-assert(dest2 < (const byte *)dest->getBasePtr(0, dest->h));
Common::copy(src1, src2, dest1);
src1 = (const byte *)src->getBasePtr(CIRCLE_X + CIRCLE_RADIUS - x, CIRCLE_Y + CIRCLE_RADIUS - y);
@@ -121,8 +109,7 @@ void MainMenu::draw() {
s.clear(0);
ScrollView::draw();
- s.blitFrom(_circles[0], Common::Point(160 - CIRCLE_RADIUS * 2 - 10, 10));
- s.blitFrom(_circles[1], Common::Point(160 + 10, 10));
+ drawCircles();
writeString(0, 100, STRING["dialogs.main_menu.title3"], ALIGN_MIDDLE);
writeString(0, 110, STRING["dialogs.main_menu.title4"], ALIGN_MIDDLE);
diff --git a/engines/mm/mm1/views_enh/main_menu.h b/engines/mm/mm1/views_enh/main_menu.h
index f0bf23fc0fd..1e17e7e84d3 100644
--- a/engines/mm/mm1/views_enh/main_menu.h
+++ b/engines/mm/mm1/views_enh/main_menu.h
@@ -33,16 +33,14 @@ private:
Graphics::ManagedSurface _circles[2];
/**
- * Loads the two title surfaces and extracts the
- * circle area from them for display
+ * Draws the two circles from the original game screens
*/
- void loadCircles();
+ void drawCircles();
/**
* Copies the circle
*/
- void copyCircle(const Graphics::Surface *src,
- Graphics::ManagedSurface *dest);
+ void copyCircle(const Graphics::Surface *src, const Common::Point &destPos);
/**
* Copies a line segment within the circle
@@ -54,8 +52,6 @@ public:
MainMenu() : ScrollView("MainMenu") {}
virtual ~MainMenu() {}
- bool msgFocus(const FocusMessage &msg) override;
- bool msgUnfocus(const UnfocusMessage &msg) override;
bool msgKeypress(const KeypressMessage &msg) override;
void draw() override;
};
More information about the Scummvm-git-logs
mailing list