[Scummvm-git-logs] scummvm master -> 89c843b286aea1a11b9988eb70fec0d215d474e2
dreammaster
noreply at scummvm.org
Tue Mar 14 02:19:41 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:
47ec70d6cb LURE: Original VGA background color in popup menus
89c843b286 LURE: Refresh background only in popup menus
Commit: 47ec70d6cb097f76c066740d1c74f3dc0a6353ef
https://github.com/scummvm/scummvm/commit/47ec70d6cb097f76c066740d1c74f3dc0a6353ef
Author: Matteo Bini (matteobin at tiepi.it)
Date: 2023-03-13T19:19:10-07:00
Commit Message:
LURE: Original VGA background color in popup menus
Changed paths:
engines/lure/menu.cpp
engines/lure/surface.cpp
engines/lure/surface.h
diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp
index 37d0770241e..8c96f6171ab 100644
--- a/engines/lure/menu.cpp
+++ b/engines/lure/menu.cpp
@@ -479,9 +479,7 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
Mouse &mouse = Mouse::getReference();
OSystem &system = *g_system;
Screen &screen = Screen::getReference();
- Common::Rect r;
bool isEGA = LureEngine::getReference().isEGA();
- byte bgColor = isEGA ? EGA_DIALOG_BG_COLOR : 0;
byte textColor = isEGA ? EGA_DIALOG_TEXT_COLOR : VGA_DIALOG_TEXT_COLOR;
byte whiteColor = isEGA ? EGA_DIALOG_WHITE_COLOR : VGA_DIALOG_WHITE_COLOR;
@@ -515,21 +513,17 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
Common::Point size;
Surface::getDialogBounds(size, numCols, numLines, false);
Surface *s = new Surface(size.x, size.y);
- s->createDialog(true);
+ s->createDialog();
int selectedIndex = 0;
bool refreshFlag = true;
- r.left = Surface::textX();
- r.right = s->width() - Surface::textX() + 1;
- r.top = Surface::textY();
- r.bottom = s->height() - Surface::textY() + 1;
bool bailOut = false;
while (!bailOut) {
if (refreshFlag) {
// Set up the contents of the menu
- s->fillRect(r, bgColor);
+ s->refreshDialog();
for (int index = 0; index < numLines; ++index) {
#ifndef LURE_CLICKABLE_MENUS
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index 4e9b7979493..2d8b7c45bd2 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -120,12 +120,12 @@ void Surface::getDialogBounds(Common::Point &size, int charWidth, int numLines,
// egaCreateDialog
// Forms a dialog encompassing the entire surface
-void Surface::egaCreateDialog(bool blackFlag) {
+void Surface::egaCreateDialog() {
byte lineColors1[3] = {6, 0, 9};
byte lineColors2[3] = {7, 0, 12};
// Surface contents
- data().setBytes(blackFlag ? 0 : EGA_DIALOG_BG_COLOR, 0, data().size());
+ data().setBytes(EGA_DIALOG_BG_COLOR, 0, data().size());
// Top/bottom lines
for (int y = 2; y >= 0; --y) {
@@ -157,7 +157,7 @@ void copyLine(byte *pSrc, byte *pDest, uint16 leftSide, uint16 center, uint16 ri
#define VGA_DIALOG_EDGE_WIDTH 9
-void Surface::vgaCreateDialog(bool blackFlag) {
+void Surface::vgaCreateDialog() {
byte *pSrc = int_dialog_frame->data();
byte *pDest = _data->data();
uint16 xCenter = _width - VGA_DIALOG_EDGE_WIDTH * 2;
@@ -184,12 +184,33 @@ void Surface::vgaCreateDialog(bool blackFlag) {
pSrc += VGA_DIALOG_EDGE_WIDTH + 1 + (VGA_DIALOG_EDGE_WIDTH - 1);
pDest += _width;
}
+}
+
+void Surface::egaRefreshDialog() {
+ Common::Rect r;
+
+ r.left = Surface::textX();
+ r.right = this->width() - textX() + 1;
+ r.top = Surface::textY();
+ r.bottom = this->height() - textY() + 1;
+
+ this->fillRect(r, EGA_DIALOG_BG_COLOR);
+}
- // Final processing - if black flag set, clear dialog inside area
- if (blackFlag) {
- Common::Rect r = Common::Rect(VGA_DIALOG_EDGE_WIDTH, VGA_DIALOG_EDGE_WIDTH,
- _width - VGA_DIALOG_EDGE_WIDTH, _height-VGA_DIALOG_EDGE_WIDTH);
- fillRect(r, 0);
+void Surface::vgaRefreshDialog() {
+ byte *pSrc = int_dialog_frame->data();
+ byte *pDest = _data->data();
+ uint16 xCenter = _width - VGA_DIALOG_EDGE_WIDTH * 2;
+ uint16 yCenter = _height - VGA_DIALOG_EDGE_WIDTH * 2;
+ int y;
+
+ // Skip dialog top
+ pSrc += ((VGA_DIALOG_EDGE_WIDTH - 2) + 1 + VGA_DIALOG_EDGE_WIDTH) * 9;
+ pDest += _width * 9;
+
+ for (y = 0; y < yCenter; ++y) {
+ copyLine(pSrc, pDest, VGA_DIALOG_EDGE_WIDTH, xCenter, VGA_DIALOG_EDGE_WIDTH);
+ pDest += _width;
}
}
@@ -354,11 +375,18 @@ void Surface::fillRect(const Common::Rect &r, uint8 color) {
}
}
-void Surface::createDialog(bool blackFlag) {
+void Surface::createDialog() {
+ if (LureEngine::getReference().isEGA())
+ egaCreateDialog();
+ else
+ vgaCreateDialog();
+}
+
+void Surface::refreshDialog() {
if (LureEngine::getReference().isEGA())
- egaCreateDialog(blackFlag);
+ egaRefreshDialog();
else
- vgaCreateDialog(blackFlag);
+ vgaRefreshDialog();
}
void Surface::copyToScreen(uint16 x, uint16 y) {
diff --git a/engines/lure/surface.h b/engines/lure/surface.h
index 0a759047baf..72ec2ce2746 100644
--- a/engines/lure/surface.h
+++ b/engines/lure/surface.h
@@ -37,8 +37,10 @@ private:
MemoryBlock *_data;
uint16 _width, _height;
- void egaCreateDialog(bool blackFlag);
- void vgaCreateDialog(bool blackFlag);
+ void egaCreateDialog();
+ void vgaCreateDialog();
+ void egaRefreshDialog();
+ void vgaRefreshDialog();
public:
Surface(MemoryBlock *src, uint16 width, uint16 height);
Surface(uint16 width, uint16 height);
@@ -71,7 +73,8 @@ public:
void copyFrom(MemoryBlock *src, uint32 destOffset);
void empty() { _data->empty(); }
void fillRect(const Common::Rect &r, uint8 color);
- void createDialog(bool blackFlag = false);
+ void createDialog();
+ void refreshDialog();
void copyToScreen(uint16 x, uint16 y);
void centerOnScreen();
Commit: 89c843b286aea1a11b9988eb70fec0d215d474e2
https://github.com/scummvm/scummvm/commit/89c843b286aea1a11b9988eb70fec0d215d474e2
Author: Matteo Bini (matteobin at tiepi.it)
Date: 2023-03-13T19:19:11-07:00
Commit Message:
LURE: Refresh background only in popup menus
Changed paths:
engines/lure/surface.cpp
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index 2d8b7c45bd2..91da5f66ac6 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -207,9 +207,12 @@ void Surface::vgaRefreshDialog() {
// Skip dialog top
pSrc += ((VGA_DIALOG_EDGE_WIDTH - 2) + 1 + VGA_DIALOG_EDGE_WIDTH) * 9;
pDest += _width * 9;
+ // Skip dialog left border
+ pSrc += VGA_DIALOG_EDGE_WIDTH;
+ pDest += VGA_DIALOG_EDGE_WIDTH;
for (y = 0; y < yCenter; ++y) {
- copyLine(pSrc, pDest, VGA_DIALOG_EDGE_WIDTH, xCenter, VGA_DIALOG_EDGE_WIDTH);
+ copyLine(pSrc, pDest, 0, xCenter, 0);
pDest += _width;
}
}
More information about the Scummvm-git-logs
mailing list