[Scummvm-git-logs] scummvm master -> 4f3dc247e425445aa5c51f0604e5151d401cef76
sev-
noreply at scummvm.org
Fri Aug 5 18:15:25 UTC 2022
This automated email contains information about 43 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
007cc0a5c0 GRAPHICS: MACGUI: Scroll MacText whenever MacTextWindow is scrolled
d933b504ed GRAPHICS: MACGUI: Change MacText's dimensions when MacTextWindow's dimensions are changed
02194c87af GRAPHICS: MACGUI: Make MacText editable when MacTextWindow is editable
6721620826 WAGE: Enable autoscroll by making MacTextWindow editable
94efaeb278 GRAPHICS: MACGUI: Draw SubMenu over copy of game screen
efea402993 GRAPHICS: MACGUI: Don't consider right and bottom edges while drawing round rect
8a8d278529 WAGE: Set scene title before dimension
ca5aedc6b2 WAGE: Fix window alignment
c0cf312748 GRAPHICS: MACGUI: Account for characters having 1 white space around them
920a925265 GRAPHICS: Round border length to nearest interger
dc52ccaec9 GRAPHICS: MACGUI: Enable blinking cursor on input line
ac847e4117 GRAPHICS: MACGUI: Refactor wage/dialog.cpp to macgui/macdialog.cpp
27f48f6d41 GRAPHICS: MACGUI: Use MacText in MacDialog
c4ede93e79 WAGE: Add about screen
2c905885c4 GRAPHICS: MACGUI: Fix text alignment for MacDialog
2779b25abc WAGE: Fix unclickable house in Messy Hosue
3257e88630 WAGE: Fix unclickable image in Intro to Gothic
c3c1c908f1 WAGE: Fix first scene in Twisted
9aa5fa02a7 WAGE: Fix out of bound array index
4099e49a70 WAGE: Fix font type in Dune Eternity
9b52b4b384 WAGE: Add resolution flag to game detection entry
d2a06c1d42 WAGE: Fix drawRect
706a2abbbb WAGE: Fix shapes with thick borders
dbb09bb6a1 WAGE: Fix drawOval
104565e281 WAGE: Update detection table
e5d0b01d89 WAGE: Use uint for loop index
3b96ffd875 WAGE: Add comment
0e8c75359d WAGE: Formatting fixes
e61f47e07d WAGE: Add comments
e8fee0ccc2 JANITORIAL: Formatting fix
9f6d054f5d WAGE: Refactor getFeatures()
1b955dc90c GRAPHICS: MACGUI: Refactor MacDialog to not use WAGE functions
f0894c277e WAGE: Fix cropped graphics in Intro to Gothic
e1c1413222 WAGE: Fix buttons in Explorer
fe7aa6eefd WAGE: Update detection table
0824d1ad58 WAGE: Use bounding box for click detection
83f8eb7b19 WAGE: Rewrite object detection
223258af81 WAGE: Better error message in isInBounds()
033bc00cd1 GRAPHICS: MACGUI: Poll events in MacDialog itself
eac2717abb WAGE: Move getFeatures() to metaengine.cpp
f9fd3b699c WAGE: Move pollEvent's definition to wage.cpp
1ad34487ee GRAPHICS: MACGUI: Remove unnecessary headers from macdialog.h
4f3dc247e4 GRAPHICS: MACGUI: Handle EVENT_QUIT properly in MacDialog
Commit: 007cc0a5c0cf63e1f5d65b8a0634932dfe2b3e96
https://github.com/scummvm/scummvm/commit/007cc0a5c0cf63e1f5d65b8a0634932dfe2b3e96
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Scroll MacText whenever MacTextWindow is scrolled
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 3cec71271e5..c5bc938bdf6 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -447,7 +447,6 @@ bool MacTextWindow::processEvent(Common::Event &event) {
setHighlight(kBorderScrollUp);
scroll(-2);
calcScrollBar();
- _mactext->scroll(-2);
return true;
}
@@ -455,7 +454,6 @@ bool MacTextWindow::processEvent(Common::Event &event) {
setHighlight(kBorderScrollDown);
scroll(2);
calcScrollBar();
- _mactext->scroll(2);
return true;
}
@@ -468,11 +466,9 @@ bool MacTextWindow::processEvent(Common::Event &event) {
switch (click) {
case kBorderScrollUp:
scroll(-1);
- _mactext->scroll(-1);
break;
case kBorderScrollDown:
scroll(1);
- _mactext->scroll(1);
break;
default:
return false;
@@ -539,6 +535,8 @@ void MacTextWindow::scroll(int delta) {
_cursorY -= (_scrollPos - oldScrollPos);
_contentIsDirty = true;
_borderIsDirty = true;
+
+ _mactext->scroll(delta);
}
void MacTextWindow::startMarking(int x, int y) {
Commit: d933b504ed4b662f27045e149bdf90067d0738f2
https://github.com/scummvm/scummvm/commit/d933b504ed4b662f27045e149bdf90067d0738f2
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Change MacText's dimensions when MacTextWindow's dimensions are changed
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
graphics/macgui/macwindow.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index c5bc938bdf6..c48b9965b88 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -111,6 +111,17 @@ void MacTextWindow::resize(int w, int h, bool inner) {
_mactext->resize(_maxWidth, h);
}
+void MacTextWindow::setDimensions(const Common::Rect &r) {
+ resize(r.width(), r.height());
+ _dims.moveTo(r.left, r.top);
+ updateInnerDims();
+
+ _contentIsDirty = true;
+ _wm->setFullRefresh(true);
+
+ _mactext->setDimensions(Common::Rect(_innerDims.width(), _innerDims.height()));
+}
+
void MacTextWindow::appendText(const Common::U32String &str, const MacFont *macFont, bool skipAdd) {
// the reason we put undrawInput here before appendText, is we don't want the appended text affect our input
// thus, we first delete all of out input, and we append new text, and we redraw the input
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 3937afe8551..56e7d213183 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -34,6 +34,7 @@ public:
virtual ~MacTextWindow();
virtual void resize(int w, int h, bool inner = false);
+ void setDimensions(const Common::Rect &r) override;
virtual bool processEvent(Common::Event &event);
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index 2803b929e9d..2c10b4ca03c 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -350,13 +350,14 @@ public:
void setMode(uint32 mode) { _mode = mode; }
+ void updateInnerDims();
+
private:
void drawBorderFromSurface(ManagedSurface *g, uint32 flags);
void drawPattern();
void drawBox(ManagedSurface *g, int x, int y, int w, int h);
void fillRect(ManagedSurface *g, int x, int y, int w, int h, int color);
const Font *getTitleFont();
- void updateInnerDims();
void updateOuterDims();
bool isInCloseButton(int x, int y) const;
Commit: 02194c87af65e9b520f82c975190263c4d184745
https://github.com/scummvm/scummvm/commit/02194c87af65e9b520f82c975190263c4d184745
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Make MacText editable when MacTextWindow is editable
Changed paths:
graphics/macgui/mactextwindow.h
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 56e7d213183..e6dd57b8178 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -49,7 +49,7 @@ public:
void appendText(const Common::String &str, const MacFont *macFont = nullptr, bool skipAdd = false);
void clearText();
- void setEditable(bool editable) { _editable = editable; }
+ void setEditable(bool editable) { _editable = editable; _mactext->setEditable(editable); }
void setSelectable(bool selectable) { _selectable = selectable; }
void undrawCursor();
Commit: 6721620826abd198d81937368752c1d4c5b7b804
https://github.com/scummvm/scummvm/commit/6721620826abd198d81937368752c1d4c5b7b804
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Enable autoscroll by making MacTextWindow editable
Changed paths:
engines/wage/gui.cpp
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 89e4d323a89..55aa88490e9 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -131,6 +131,7 @@ Gui::Gui(WageEngine *engine) {
uint maxWidth = _screen.w;
_consoleWindow = _wm->addTextWindow(font, kColorBlack, kColorWhite, maxWidth, Graphics::kTextAlignLeft, _menu);
+ _consoleWindow->setEditable(true);
loadBorders();
}
Commit: 94efaeb2785e7d2d3c3b7d7b08c81bd2de4ff5ff
https://github.com/scummvm/scummvm/commit/94efaeb2785e7d2d3c3b7d7b08c81bd2de4ff5ff
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Draw SubMenu over copy of game screen
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macmenu.h
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index cccb5537419..051beb5c4aa 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -1094,7 +1094,7 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) {
for (uint i = 0; i < _menustack.size(); i++) {
- renderSubmenu(g, _menustack[i], (i == _menustack.size() - 1));
+ renderSubmenu(_menustack[i], (i == _menustack.size() - 1));
}
if (g)
@@ -1106,7 +1106,7 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) {
return true;
}
-void MacMenu::renderSubmenu(ManagedSurface *g, MacMenuSubMenu *menu, bool recursive) {
+void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) {
Common::Rect *r = &menu->bbox;
if (r->width() == 0 || r->height() == 0)
@@ -1217,7 +1217,7 @@ void MacMenu::renderSubmenu(ManagedSurface *g, MacMenuSubMenu *menu, bool recurs
}
if (recursive && menu->highlight != -1 && menu->items[menu->highlight]->submenu != nullptr)
- renderSubmenu(g, menu->items[menu->highlight]->submenu, false);
+ renderSubmenu(menu->items[menu->highlight]->submenu, false);
if (_wm->_mode & kWMModalMenuMode) {
// TODO: Instead of cropping, reposition the submenu
@@ -1229,8 +1229,9 @@ void MacMenu::renderSubmenu(ManagedSurface *g, MacMenuSubMenu *menu, bool recurs
if (r->top + h >= _screen.h)
h = _screen.h - 1 - r->top;
- g->transBlitFrom(_screen, _wm->_colorGreen);
- g_system->copyRectToScreen(g->getBasePtr(r->left, r->top), g->pitch, r->left, r->top, w, h);
+ Graphics::ManagedSurface g = *_wm->_screenCopy;
+ g.transBlitFrom(_screen, _wm->_colorGreen);
+ g_system->copyRectToScreen(g.getBasePtr(r->left, r->top), g.pitch, r->left, r->top, w, h);
}
}
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index 5517faac8a2..d474a961db9 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -140,7 +140,7 @@ private:
int calcSubMenuWidth(MacMenuSubMenu *menu);
void calcSubMenuBounds(MacMenuSubMenu *menu, int x, int y);
- void renderSubmenu(ManagedSurface *g, MacMenuSubMenu *menu, bool recursive = true);
+ void renderSubmenu(MacMenuSubMenu *menu, bool recursive = true);
bool keyEvent(Common::Event &event);
bool mouseClick(int x, int y);
Commit: efea402993cd7121fc46958d26e0d2ae0ee38db9
https://github.com/scummvm/scummvm/commit/efea402993cd7121fc46958d26e0d2ae0ee38db9
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Don't consider right and bottom edges while drawing round rect
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macwindowmanager.cpp
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 051beb5c4aa..75fce6e114b 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -1005,7 +1005,7 @@ static void drawPixelPlain(int x, int y, int color, void *data) {
}
static void drawFilledRoundRect(ManagedSurface *surface, Common::Rect &rect, int arc, int color) {
- drawRoundRect1(rect, arc, color, true, drawPixelPlain, surface);
+ drawRoundRect(rect, arc, color, true, drawPixelPlain, surface);
}
static void underlineAccelerator(ManagedSurface *dst, const Font *font, const Common::UnicodeBiDiText &txt, int x, int y, int shortcutPos, uint32 color) {
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 5b6bd14aaa1..1f0576d098e 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -817,7 +817,7 @@ void MacWindowManager::drawDesktop() {
MacPlotData pd(_desktop, nullptr, &_patterns, kPatternCheckers, 0, 0, 1, _colorWhite);
- Graphics::drawRoundRect1(r, kDesktopArc, _colorBlack, true, getDrawPixel(), &pd);
+ Graphics::drawRoundRect(r, kDesktopArc, _colorBlack, true, getDrawPixel(), &pd);
}
}
Commit: 8a8d278529cd5e9740771b0e822f97c9518fd0d3
https://github.com/scummvm/scummvm/commit/8a8d278529cd5e9740771b0e822f97c9518fd0d3
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Set scene title before dimension
Changed paths:
engines/wage/gui.cpp
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 55aa88490e9..4fcaf887e7d 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -157,8 +157,8 @@ void Gui::draw() {
_scene = _engine->_world->_player->_currentScene;
- _sceneWindow->setDimensions(*_scene->_designBounds);
_sceneWindow->setTitle(_scene->_name);
+ _sceneWindow->setDimensions(*_scene->_designBounds);
_consoleWindow->setDimensions(*_scene->_textBounds);
_wm->setFullRefresh(true);
Commit: ca5aedc6b2e4065125c2153d542d96458d809afa
https://github.com/scummvm/scummvm/commit/ca5aedc6b2e4065125c2153d542d96458d809afa
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Fix window alignment
Changed paths:
engines/wage/util.cpp
diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp
index b49743b4671..b4ff8e4ca81 100644
--- a/engines/wage/util.cpp
+++ b/engines/wage/util.cpp
@@ -53,10 +53,10 @@ namespace Wage {
Common::Rect *readRect(Common::SeekableReadStream *in) {
int x1, y1, x2, y2;
- y1 = in->readSint16BE();
- x1 = in->readSint16BE();
- y2 = in->readSint16BE() + 4;
- x2 = in->readSint16BE() + 4;
+ y1 = in->readSint16BE() - 2;
+ x1 = in->readSint16BE() - 2;
+ y2 = in->readSint16BE() + 2;
+ x2 = in->readSint16BE() + 2;
bool normalized = false;
Commit: c0cf312748c5812b88c7c91c3fe0ebeb57bc1384
https://github.com/scummvm/scummvm/commit/c0cf312748c5812b88c7c91c3fe0ebeb57bc1384
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Account for characters having 1 white space around them
Changed paths:
graphics/macgui/macwindowborder.cpp
diff --git a/graphics/macgui/macwindowborder.cpp b/graphics/macgui/macwindowborder.cpp
index 42100ac0019..67ee83f1b24 100644
--- a/graphics/macgui/macwindowborder.cpp
+++ b/graphics/macgui/macwindowborder.cpp
@@ -144,7 +144,7 @@ void MacWindowBorder::setTitle(const Common::String& title, int width, MacWindow
_title = title;
const Graphics::Font *font = wm->_fontMan->getFont(Graphics::MacFont(kMacFontChicago, 12));
int sidesWidth = getOffset().left + getOffset().right;
- int titleWidth = font->getStringWidth(_title) + 10;
+ int titleWidth = font->getStringWidth(_title) + 8;
int maxWidth = MAX<int>(width - sidesWidth - 7, 0);
if (titleWidth > maxWidth)
titleWidth = maxWidth;
@@ -184,13 +184,13 @@ void MacWindowBorder::drawTitle(ManagedSurface *g, MacWindowManager *wm, int tit
int titleColor = getOffset().dark ? wm->_colorWhite: wm->_colorBlack;
int titleY = getOffset().titleTop;
int sidesWidth = getOffset().left + getOffset().right;
- int titleWidth = font->getStringWidth(_title) + 10;
+ int titleWidth = font->getStringWidth(_title) + 8;
int yOff = wm->_fontMan->hasBuiltInFonts() ? 3 : 1;
int maxWidth = width - sidesWidth - 7;
if (titleWidth > maxWidth)
titleWidth = maxWidth;
- font->drawString(g, _title, titleOffset + 5, titleY + yOff, titleWidth, titleColor);
+ font->drawString(g, _title, titleOffset + 4, titleY + yOff, titleWidth, titleColor);
}
void MacWindowBorder::setBorderType(int type) {
Commit: 920a9252655f0598e9bfec17e37861c34c2a6c96
https://github.com/scummvm/scummvm/commit/920a9252655f0598e9bfec17e37861c34c2a6c96
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: Round border length to nearest interger
Changed paths:
graphics/nine_patch.cpp
diff --git a/graphics/nine_patch.cpp b/graphics/nine_patch.cpp
index 32aea2ebebc..e7f7fd58c8f 100644
--- a/graphics/nine_patch.cpp
+++ b/graphics/nine_patch.cpp
@@ -149,7 +149,7 @@ void NinePatchSide::calcOffsets(int len, int titleIndex, int titleWidth) {
if (_m[i]->ratio == 0) {
_m[i]->dest_length = _m[i]->length;
} else {
- _m[i]->dest_length = (len - _fix - titleWidth) * _m[i]->ratio;
+ _m[i]->dest_length = (len - _fix - titleWidth) * _m[i]->ratio + 0.5;
remaining_stretch -= _m[i]->dest_length;
j = i;
}
Commit: dc52ccaec91c83cf3d00d9bd69eefcd1965211f0
https://github.com/scummvm/scummvm/commit/dc52ccaec91c83cf3d00d9bd69eefcd1965211f0
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Enable blinking cursor on input line
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index c48b9965b88..1b51ced7863 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -227,6 +227,9 @@ bool MacTextWindow::draw(bool forceRedraw) {
// Compose
_mactext->draw(_composeSurface, true);
+ if (_cursorState)
+ _composeSurface->blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX, _cursorY));
+
return true;
}
@@ -634,7 +637,7 @@ static void cursorTimerHandler(void *refCon) {
void MacTextWindow::updateCursorPos() {
_cursorY = _mactext->getTextHeight() - _scrollPos - kCursorHeight;
-
+ _cursorY += _inputText.empty() ? 3 : 0;
_cursorDirty = true;
}
Commit: ac847e411727af76f56761acd2d932547dcae049
https://github.com/scummvm/scummvm/commit/ac847e411727af76f56761acd2d932547dcae049
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Refactor wage/dialog.cpp to macgui/macdialog.cpp
Changed paths:
A graphics/macgui/macdialog.cpp
A graphics/macgui/macdialog.h
R engines/wage/dialog.cpp
R engines/wage/dialog.h
engines/wage/module.mk
engines/wage/wage.cpp
engines/wage/wage.h
graphics/module.mk
diff --git a/engines/wage/module.mk b/engines/wage/module.mk
index 8e38cbc2363..0e19348c96e 100644
--- a/engines/wage/module.mk
+++ b/engines/wage/module.mk
@@ -4,7 +4,6 @@ MODULE_OBJS := \
combat.o \
debugger.o \
design.o \
- dialog.o \
entities.o \
gui.o \
guiborders.o \
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index d1850c10adc..4a438dc21d5 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -54,10 +54,11 @@
#include "engines/engine.h"
#include "engines/util.h"
+#include "graphics/macgui/macdialog.h"
+
#include "wage/wage.h"
#include "wage/entities.h"
#include "wage/gui.h"
-#include "wage/dialog.h"
#include "wage/script.h"
#include "wage/world.h"
@@ -203,11 +204,11 @@ void WageEngine::appendText(const char *str) {
}
void WageEngine::gameOver() {
- DialogButtonArray buttons;
+ Graphics::MacDialogButtonArray buttons;
- buttons.push_back(new DialogButton("OK", 66, 67, 68, 28));
+ buttons.push_back(new Graphics::MacDialogButton("OK", 66, 67, 68, 28));
- Dialog gameOverDialog(_gui, 199, _world->_gameOverMessage->c_str(), &buttons, 0);
+ Graphics::MacDialog gameOverDialog(_gui, 199, _world->_gameOverMessage->c_str(), &buttons, 0);
gameOverDialog.run();
@@ -218,13 +219,13 @@ void WageEngine::gameOver() {
}
bool WageEngine::saveDialog() {
- DialogButtonArray buttons;
+ Graphics::MacDialogButtonArray buttons;
- buttons.push_back(new DialogButton("No", 19, 67, 68, 28));
- buttons.push_back(new DialogButton("Yes", 112, 67, 68, 28));
- buttons.push_back(new DialogButton("Cancel", 205, 67, 68, 28));
+ buttons.push_back(new Graphics::MacDialogButton("No", 19, 67, 68, 28));
+ buttons.push_back(new Graphics::MacDialogButton("Yes", 112, 67, 68, 28));
+ buttons.push_back(new Graphics::MacDialogButton("Cancel", 205, 67, 68, 28));
- Dialog save(_gui, 291, _world->_saveBeforeCloseMessage->c_str(), &buttons, 1);
+ Graphics::MacDialog save(_gui, 291, _world->_saveBeforeCloseMessage->c_str(), &buttons, 1);
int button = save.run();
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 7122b08ab49..a9c83ca2734 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -54,6 +54,7 @@
#include "common/rect.h"
#include "common/macresman.h"
#include "common/random.h"
+#include "common/events.h"
#include "wage/debugger.h"
@@ -127,6 +128,7 @@ public:
void regen();
const char *getTargetName() { return _targetName.c_str(); }
+ bool pollEvent(Common::Event &event) { return _eventMan->pollEvent(event); }
private:
bool loadWorld(Common::MacResManager *resMan);
diff --git a/engines/wage/dialog.cpp b/graphics/macgui/macdialog.cpp
similarity index 80%
rename from engines/wage/dialog.cpp
rename to graphics/macgui/macdialog.cpp
index 713c9d1f410..2e6b20ffc4d 100644
--- a/engines/wage/dialog.cpp
+++ b/graphics/macgui/macdialog.cpp
@@ -44,25 +44,26 @@
*
*/
-#include "common/system.h"
#include "common/events.h"
+#include "common/system.h"
+
+//#include "engines/engine.h"
+#include "engines/wage/design.h"
+#include "engines/wage/gui.h"
+#include "engines/wage/wage.h"
#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/macwindowmanager.h"
+#include "graphics/macgui/macdialog.h"
-#include "wage/wage.h"
-#include "wage/design.h"
-#include "wage/gui.h"
-#include "wage/dialog.h"
-
-namespace Wage {
+namespace Graphics {
enum {
kDialogHeight = 113
};
-Dialog::Dialog(Gui *gui, int width, const char *text, DialogButtonArray *buttons, uint defaultButton) :
- _gui(gui), _text(text), _buttons(buttons), _defaultButton(defaultButton) {
+MacDialog::MacDialog(Wage::Gui *gui, int width, const char *text, MacDialogButtonArray *buttons, uint defaultButton) :
+ _gui(gui), _text(text), _buttons(buttons), _defaultButton(defaultButton) {
assert(_gui->_engine);
assert(_gui->_engine->_world);
@@ -86,25 +87,25 @@ Dialog::Dialog(Gui *gui, int width, const char *text, DialogButtonArray *buttons
_needsRedraw = true;
}
-Dialog::~Dialog() {
+MacDialog::~MacDialog() {
for (uint i = 0; i < _buttons->size(); i++)
delete _buttons->operator[](i);
}
-const Graphics::Font *Dialog::getDialogFont() {
+const Graphics::Font *MacDialog::getDialogFont() {
return _gui->_wm->_fontMan->getFont(Graphics::MacFont(Graphics::kMacFontChicago, 12));
}
-void Dialog::paint() {
- Design::drawFilledRect(&_gui->_screen, _bbox, kColorWhite, _gui->_wm->getPatterns(), kPatternSolid);
+void MacDialog::paint() {
+ Wage::Design::drawFilledRect(&_gui->_screen, _bbox, kColorWhite, _gui->_wm->getPatterns(), kPatternSolid);
_font->drawString(&_gui->_screen, _text, _bbox.left + 24, _bbox.top + 16, _bbox.width(), kColorBlack);
- static int boxOutline[] = { 1, 0, 0, 1, 1 };
+ static int boxOutline[] = {1, 0, 0, 1, 1};
drawOutline(_bbox, boxOutline, ARRAYSIZE(boxOutline));
for (uint i = 0; i < _buttons->size(); i++) {
- DialogButton *button = _buttons->operator[](i);
- static int buttonOutline[] = { 0, 0, 0, 0, 1 };
+ MacDialogButton *button = _buttons->operator[](i);
+ static int buttonOutline[] = {0, 0, 0, 0, 1};
if (i == _defaultButton) {
buttonOutline[0] = buttonOutline[1] = 1;
@@ -116,9 +117,9 @@ void Dialog::paint() {
if ((int)i == _pressedButton && _mouseOverPressedButton) {
Common::Rect bb(button->bounds.left + 5, button->bounds.top + 5,
- button->bounds.right - 5, button->bounds.bottom - 5);
+ button->bounds.right - 5, button->bounds.bottom - 5);
- Design::drawFilledRect(&_gui->_screen, bb, kColorBlack, _gui->_wm->getPatterns(), kPatternSolid);
+ Wage::Design::drawFilledRect(&_gui->_screen, bb, kColorBlack, _gui->_wm->getPatterns(), kPatternSolid);
color = kColorWhite;
}
@@ -132,19 +133,19 @@ void Dialog::paint() {
}
g_system->copyRectToScreen(_gui->_screen.getBasePtr(_bbox.left, _bbox.top), _gui->_screen.pitch,
- _bbox.left, _bbox.top, _bbox.width() + 1, _bbox.height() + 1);
+ _bbox.left, _bbox.top, _bbox.width() + 1, _bbox.height() + 1);
_needsRedraw = false;
}
-void Dialog::drawOutline(Common::Rect &bounds, int *spec, int speclen) {
+void MacDialog::drawOutline(Common::Rect &bounds, int *spec, int speclen) {
for (int i = 0; i < speclen; i++)
if (spec[i] != 0)
- Design::drawRect(&_gui->_screen, bounds.left + i, bounds.top + i, bounds.right - i, bounds.bottom - i,
- 1, kColorBlack, _gui->_wm->getPatterns(), kPatternSolid);
+ Wage::Design::drawRect(&_gui->_screen, bounds.left + i, bounds.top + i, bounds.right - i, bounds.bottom - i,
+ 1, kColorBlack, _gui->_wm->getPatterns(), kPatternSolid);
}
-int Dialog::run() {
+int MacDialog::run() {
bool shouldQuit = false;
Common::Rect r(_bbox);
@@ -154,7 +155,7 @@ int Dialog::run() {
while (!shouldQuit) {
Common::Event event;
- while (_gui->_engine->_eventMan->pollEvent(event)) {
+ while (_gui->_engine->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_QUIT:
_gui->_engine->_shouldQuit = true;
@@ -198,7 +199,7 @@ int Dialog::run() {
return _pressedButton;
}
-int Dialog::matchButton(int x, int y) {
+int MacDialog::matchButton(int x, int y) {
for (uint i = 0; i < _buttons->size(); i++)
if (_buttons->operator[](i)->bounds.contains(x, y))
return i;
@@ -206,7 +207,7 @@ int Dialog::matchButton(int x, int y) {
return -1;
}
-void Dialog::mouseMove(int x, int y) {
+void MacDialog::mouseMove(int x, int y) {
if (_pressedButton != -1) {
int match = matchButton(x, y);
@@ -220,7 +221,7 @@ void Dialog::mouseMove(int x, int y) {
}
}
-void Dialog::mouseClick(int x, int y) {
+void MacDialog::mouseClick(int x, int y) {
int match = matchButton(x, y);
if (match != -1) {
@@ -231,7 +232,7 @@ void Dialog::mouseClick(int x, int y) {
}
}
-int Dialog::mouseRaise(int x, int y) {
+int MacDialog::mouseRaise(int x, int y) {
bool res = false;
if (_pressedButton != -1) {
diff --git a/engines/wage/dialog.h b/graphics/macgui/macdialog.h
similarity index 80%
rename from engines/wage/dialog.h
rename to graphics/macgui/macdialog.h
index 75982272431..e16cbd81397 100644
--- a/engines/wage/dialog.h
+++ b/graphics/macgui/macdialog.h
@@ -44,16 +44,26 @@
*
*/
-#ifndef WAGE_DIALOG_H
-#define WAGE_DIALOG_H
+#ifndef GRAPHICS_MACGUI_MACDIALOG_H
+#define GRAPHICS_MACGUI_MACDIALOG_H
+
+#include "common/str.h"
+#include "common/rect.h"
+
+#include "graphics/managed_surface.h"
+#include "graphics/font.h"
namespace Wage {
+class Gui;
+}
+
+namespace Graphics {
-struct DialogButton {
+struct MacDialogButton {
Common::String text;
Common::Rect bounds;
- DialogButton(const char *t, int x1, int y1, int w, int h) {
+ MacDialogButton(const char *t, int x1, int y1, int w, int h) {
text = t;
bounds.left = x1;
bounds.top = y1;
@@ -62,23 +72,23 @@ struct DialogButton {
}
};
-typedef Common::Array<DialogButton *> DialogButtonArray;
+typedef Common::Array<MacDialogButton *> MacDialogButtonArray;
-class Dialog {
+class MacDialog {
public:
- Dialog(Gui *gui, int width, const char *text, DialogButtonArray *buttons, uint defaultButton);
- ~Dialog();
+ MacDialog(Wage::Gui *gui, int width, const char *text, MacDialogButtonArray *buttons, uint defaultButton);
+ ~MacDialog();
int run();
private:
- Gui *_gui;
- Graphics::ManagedSurface _tempSurface;
+ Wage::Gui *_gui;
+ ManagedSurface _tempSurface;
Common::Rect _bbox;
Common::String _text;
- const Graphics::Font *_font;
- DialogButtonArray *_buttons;
+ const Font *_font;
+ MacDialogButtonArray *_buttons;
int _pressedButton;
uint _defaultButton;
bool _mouseOverPressedButton;
@@ -86,7 +96,7 @@ private:
bool _needsRedraw;
private:
- const Graphics::Font *getDialogFont();
+ const Font *getDialogFont();
void drawOutline(Common::Rect &bounds, int *spec, int speclen);
void paint();
void mouseMove(int x, int y);
diff --git a/graphics/module.mk b/graphics/module.mk
index d512f4859af..213b8ff35a4 100644
--- a/graphics/module.mk
+++ b/graphics/module.mk
@@ -20,6 +20,7 @@ MODULE_OBJS := \
maccursor.o \
macgui/datafiles.o \
macgui/macbutton.o \
+ macgui/macdialog.o \
macgui/macfontmanager.o \
macgui/macmenu.o \
macgui/mactext.o \
Commit: 27f48f6d412bae5104931c4d546865c0f121a19e
https://github.com/scummvm/scummvm/commit/27f48f6d412bae5104931c4d546865c0f121a19e
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Use MacText in MacDialog
Changed paths:
engines/wage/wage.cpp
graphics/macgui/macdialog.cpp
graphics/macgui/macdialog.h
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 4a438dc21d5..e60114cef7b 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -208,7 +208,12 @@ void WageEngine::gameOver() {
buttons.push_back(new Graphics::MacDialogButton("OK", 66, 67, 68, 28));
- Graphics::MacDialog gameOverDialog(_gui, 199, _world->_gameOverMessage->c_str(), &buttons, 0);
+ Graphics::MacFont font;
+
+ Graphics::MacText gameOverMessage(*_world->_gameOverMessage, _gui->_wm, &font, Graphics::kColorBlack,
+ Graphics::kColorWhite, 199, Graphics::kTextAlignCenter);
+
+ Graphics::MacDialog gameOverDialog(_gui, 199, &gameOverMessage, &buttons, 0);
gameOverDialog.run();
@@ -225,7 +230,12 @@ bool WageEngine::saveDialog() {
buttons.push_back(new Graphics::MacDialogButton("Yes", 112, 67, 68, 28));
buttons.push_back(new Graphics::MacDialogButton("Cancel", 205, 67, 68, 28));
- Graphics::MacDialog save(_gui, 291, _world->_saveBeforeCloseMessage->c_str(), &buttons, 1);
+ Graphics::MacFont font;
+
+ Graphics::MacText saveBeforeCloseMessage(*_world->_saveBeforeCloseMessage, _gui->_wm, &font, Graphics::kColorBlack,
+ Graphics::kColorWhite, 291, Graphics::kTextAlignLeft);
+
+ Graphics::MacDialog save(_gui, 291, &saveBeforeCloseMessage, &buttons, 1);
int button = save.run();
diff --git a/graphics/macgui/macdialog.cpp b/graphics/macgui/macdialog.cpp
index 2e6b20ffc4d..771d9dea808 100644
--- a/graphics/macgui/macdialog.cpp
+++ b/graphics/macgui/macdialog.cpp
@@ -52,6 +52,7 @@
#include "engines/wage/gui.h"
#include "engines/wage/wage.h"
+#include "graphics/macgui/mactext.h"
#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/macwindowmanager.h"
#include "graphics/macgui/macdialog.h"
@@ -62,8 +63,8 @@ enum {
kDialogHeight = 113
};
-MacDialog::MacDialog(Wage::Gui *gui, int width, const char *text, MacDialogButtonArray *buttons, uint defaultButton) :
- _gui(gui), _text(text), _buttons(buttons), _defaultButton(defaultButton) {
+MacDialog::MacDialog(Wage::Gui *gui, int width, MacText *mactext, MacDialogButtonArray *buttons, uint defaultButton) :
+ _gui(gui), _mactext(mactext), _buttons(buttons), _defaultButton(defaultButton) {
assert(_gui->_engine);
assert(_gui->_engine->_world);
@@ -98,7 +99,7 @@ const Graphics::Font *MacDialog::getDialogFont() {
void MacDialog::paint() {
Wage::Design::drawFilledRect(&_gui->_screen, _bbox, kColorWhite, _gui->_wm->getPatterns(), kPatternSolid);
- _font->drawString(&_gui->_screen, _text, _bbox.left + 24, _bbox.top + 16, _bbox.width(), kColorBlack);
+ _mactext->draw(&_gui->_screen, 0, 0, _bbox.width(), _bbox.height(), _bbox.left + 24, _bbox.top + 16);
static int boxOutline[] = {1, 0, 0, 1, 1};
drawOutline(_bbox, boxOutline, ARRAYSIZE(boxOutline));
diff --git a/graphics/macgui/macdialog.h b/graphics/macgui/macdialog.h
index e16cbd81397..14c4665b843 100644
--- a/graphics/macgui/macdialog.h
+++ b/graphics/macgui/macdialog.h
@@ -59,6 +59,8 @@ class Gui;
namespace Graphics {
+class MacText;
+
struct MacDialogButton {
Common::String text;
Common::Rect bounds;
@@ -76,7 +78,7 @@ typedef Common::Array<MacDialogButton *> MacDialogButtonArray;
class MacDialog {
public:
- MacDialog(Wage::Gui *gui, int width, const char *text, MacDialogButtonArray *buttons, uint defaultButton);
+ MacDialog(Wage::Gui *gui, int width, MacText *mactext, MacDialogButtonArray *buttons, uint defaultButton);
~MacDialog();
int run();
@@ -85,7 +87,7 @@ private:
Wage::Gui *_gui;
ManagedSurface _tempSurface;
Common::Rect _bbox;
- Common::String _text;
+ MacText *_mactext;
const Font *_font;
MacDialogButtonArray *_buttons;
Commit: c4ede93e79101439af7f4934e6702fa2dfbb05af
https://github.com/scummvm/scummvm/commit/c4ede93e79101439af7f4934e6702fa2dfbb05af
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Add about screen
Changed paths:
engines/wage/gui.cpp
engines/wage/wage.cpp
engines/wage/wage.h
graphics/macgui/macdialog.cpp
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 4fcaf887e7d..ac2550cff6d 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -264,6 +264,8 @@ void menuCommandsCallback(int action, Common::String &text, void *data) {
void Gui::executeMenuCommand(int action, Common::String &text) {
switch(action) {
case kMenuActionAbout:
+ _engine->aboutDialog();
+ break;
case kMenuActionNew:
case kMenuActionClose:
case kMenuActionRevert:
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index e60114cef7b..823b14d58bf 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -250,6 +250,23 @@ bool WageEngine::saveDialog() {
return true;
}
+void WageEngine::aboutDialog() {
+ Graphics::MacDialogButtonArray buttons;
+
+ buttons.push_back(new Graphics::MacDialogButton("OK", 191, 167, 68, 28));
+
+ Graphics::MacText aboutMessage(_world->_aboutMessage, _gui->_wm, _gui->_consoleWindow->getTextWindowFont(), Graphics::kColorBlack,
+ Graphics::kColorWhite, 400, Graphics::kTextAlignCenter);
+
+ Common::U32String disclaimer("\n\n\n\nThis adventure was produced with World Builder\xAA\nthe adventure game creation system.\n© Copyright 1986 by William C. Appleton, All Right Reserved\nPublished by Silicon Beach Software, Inc.");
+
+ aboutMessage.appendText(disclaimer, 3, 9, 0, false);
+
+ Graphics::MacDialog save(_gui, 450, &aboutMessage, &buttons, 0);
+
+ save.run();
+}
+
void WageEngine::saveGame() {
warning("STUB: saveGame()");
}
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index a9c83ca2734..bbae24cfc34 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -202,6 +202,7 @@ public:
void appendText(const char *str);
void gameOver();
bool saveDialog();
+ void aboutDialog();
Obj *getOffer();
Chr *getMonster();
void processEvents();
diff --git a/graphics/macgui/macdialog.cpp b/graphics/macgui/macdialog.cpp
index 771d9dea808..31f47157cfe 100644
--- a/graphics/macgui/macdialog.cpp
+++ b/graphics/macgui/macdialog.cpp
@@ -68,14 +68,16 @@ MacDialog::MacDialog(Wage::Gui *gui, int width, MacText *mactext, MacDialogButto
assert(_gui->_engine);
assert(_gui->_engine->_world);
+ int height = kDialogHeight + _mactext->getTextHeight();
+
_font = getDialogFont();
- _tempSurface.create(width + 1, kDialogHeight + 1, Graphics::PixelFormat::createFormatCLUT8());
+ _tempSurface.create(width + 1, height + 1, Graphics::PixelFormat::createFormatCLUT8());
_bbox.left = (_gui->_screen.w - width) / 2;
- _bbox.top = (_gui->_screen.h - kDialogHeight) / 2;
+ _bbox.top = (_gui->_screen.h - height) / 2;
_bbox.right = (_gui->_screen.w + width) / 2;
- _bbox.bottom = (_gui->_screen.h + kDialogHeight) / 2;
+ _bbox.bottom = (_gui->_screen.h + height) / 2;
_pressedButton = -1;
@@ -99,7 +101,7 @@ const Graphics::Font *MacDialog::getDialogFont() {
void MacDialog::paint() {
Wage::Design::drawFilledRect(&_gui->_screen, _bbox, kColorWhite, _gui->_wm->getPatterns(), kPatternSolid);
- _mactext->draw(&_gui->_screen, 0, 0, _bbox.width(), _bbox.height(), _bbox.left + 24, _bbox.top + 16);
+ _mactext->draw(&_gui->_screen, 0, 0, _bbox.width(), _bbox.height(), _bbox.left + (_bbox.width() - _mactext->getTextMaxWidth())/2, _bbox.top + 16);
static int boxOutline[] = {1, 0, 0, 1, 1};
drawOutline(_bbox, boxOutline, ARRAYSIZE(boxOutline));
Commit: 2c905885c44273f1951a4b20f38f3eb96dc64c95
https://github.com/scummvm/scummvm/commit/2c905885c44273f1951a4b20f38f3eb96dc64c95
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Fix text alignment for MacDialog
Changed paths:
engines/wage/wage.cpp
graphics/macgui/macdialog.cpp
graphics/macgui/macdialog.h
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 823b14d58bf..446a2add1eb 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -213,7 +213,7 @@ void WageEngine::gameOver() {
Graphics::MacText gameOverMessage(*_world->_gameOverMessage, _gui->_wm, &font, Graphics::kColorBlack,
Graphics::kColorWhite, 199, Graphics::kTextAlignCenter);
- Graphics::MacDialog gameOverDialog(_gui, 199, &gameOverMessage, &buttons, 0);
+ Graphics::MacDialog gameOverDialog(_gui, 199, &gameOverMessage, 199, &buttons, 0);
gameOverDialog.run();
@@ -233,9 +233,9 @@ bool WageEngine::saveDialog() {
Graphics::MacFont font;
Graphics::MacText saveBeforeCloseMessage(*_world->_saveBeforeCloseMessage, _gui->_wm, &font, Graphics::kColorBlack,
- Graphics::kColorWhite, 291, Graphics::kTextAlignLeft);
+ Graphics::kColorWhite, 291, Graphics::kTextAlignCenter);
- Graphics::MacDialog save(_gui, 291, &saveBeforeCloseMessage, &buttons, 1);
+ Graphics::MacDialog save(_gui, 291, &saveBeforeCloseMessage, 291, &buttons, 1);
int button = save.run();
@@ -262,7 +262,7 @@ void WageEngine::aboutDialog() {
aboutMessage.appendText(disclaimer, 3, 9, 0, false);
- Graphics::MacDialog save(_gui, 450, &aboutMessage, &buttons, 0);
+ Graphics::MacDialog save(_gui, 450, &aboutMessage, 400, &buttons, 0);
save.run();
}
diff --git a/graphics/macgui/macdialog.cpp b/graphics/macgui/macdialog.cpp
index 31f47157cfe..4b4fc535005 100644
--- a/graphics/macgui/macdialog.cpp
+++ b/graphics/macgui/macdialog.cpp
@@ -63,8 +63,8 @@ enum {
kDialogHeight = 113
};
-MacDialog::MacDialog(Wage::Gui *gui, int width, MacText *mactext, MacDialogButtonArray *buttons, uint defaultButton) :
- _gui(gui), _mactext(mactext), _buttons(buttons), _defaultButton(defaultButton) {
+MacDialog::MacDialog(Wage::Gui *gui, int width, MacText *mactext, int maxTextWidth, MacDialogButtonArray *buttons, uint defaultButton) :
+ _gui(gui), _mactext(mactext), _maxTextWidth(maxTextWidth), _buttons(buttons), _defaultButton(defaultButton) {
assert(_gui->_engine);
assert(_gui->_engine->_world);
@@ -101,8 +101,7 @@ const Graphics::Font *MacDialog::getDialogFont() {
void MacDialog::paint() {
Wage::Design::drawFilledRect(&_gui->_screen, _bbox, kColorWhite, _gui->_wm->getPatterns(), kPatternSolid);
- _mactext->draw(&_gui->_screen, 0, 0, _bbox.width(), _bbox.height(), _bbox.left + (_bbox.width() - _mactext->getTextMaxWidth())/2, _bbox.top + 16);
-
+ _mactext->drawToPoint(&_gui->_screen, Common::Point(_bbox.left + (_bbox.width() - _maxTextWidth)/2, _bbox.top + 16));
static int boxOutline[] = {1, 0, 0, 1, 1};
drawOutline(_bbox, boxOutline, ARRAYSIZE(boxOutline));
diff --git a/graphics/macgui/macdialog.h b/graphics/macgui/macdialog.h
index 14c4665b843..76add790a11 100644
--- a/graphics/macgui/macdialog.h
+++ b/graphics/macgui/macdialog.h
@@ -78,7 +78,7 @@ typedef Common::Array<MacDialogButton *> MacDialogButtonArray;
class MacDialog {
public:
- MacDialog(Wage::Gui *gui, int width, MacText *mactext, MacDialogButtonArray *buttons, uint defaultButton);
+ MacDialog(Wage::Gui *gui, int width, MacText *mactext, int maxTextWidth, MacDialogButtonArray *buttons, uint defaultButton);
~MacDialog();
int run();
@@ -88,6 +88,7 @@ private:
ManagedSurface _tempSurface;
Common::Rect _bbox;
MacText *_mactext;
+ int _maxTextWidth;
const Font *_font;
MacDialogButtonArray *_buttons;
Commit: 2779b25abce748de8a2947dec1ac80ced1baf1e3
https://github.com/scummvm/scummvm/commit/2779b25abce748de8a2947dec1ac80ced1baf1e3
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Fix unclickable house in Messy Hosue
Changed paths:
engines/wage/entities.cpp
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index 6b5c0d81bfe..48978f213a3 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -159,6 +159,9 @@ void Scene::paint(Graphics::ManagedSurface *surface, int x, int y) {
Designed *Scene::lookUpEntity(int x, int y) {
for (ObjList::const_iterator it = _objs.end(); it != _objs.begin(); ) {
it--;
+ if ((*it)->_name == "continue" && (*it)->_resourceId == 22259)
+ if (_design->isPointOpaque(x, y))
+ return *it;
if ((*it)->_design->isPointOpaque(x, y))
return *it;
}
Commit: 3257e8863028fcfdbd5969e6896121822bbf2274
https://github.com/scummvm/scummvm/commit/3257e8863028fcfdbd5969e6896121822bbf2274
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Fix unclickable image in Intro to Gothic
Changed paths:
engines/wage/entities.cpp
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index 48978f213a3..82efe6d2678 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -159,7 +159,8 @@ void Scene::paint(Graphics::ManagedSurface *surface, int x, int y) {
Designed *Scene::lookUpEntity(int x, int y) {
for (ObjList::const_iterator it = _objs.end(); it != _objs.begin(); ) {
it--;
- if ((*it)->_name == "continue" && (*it)->_resourceId == 22259)
+ if (((*it)->_name == "continue" && (*it)->_resourceId == 22259) ||
+ ((*it)->_name == "Goth" && (*it)->_resourceId == 18623))
if (_design->isPointOpaque(x, y))
return *it;
if ((*it)->_design->isPointOpaque(x, y))
Commit: c3c1c908f106526d4938bf3f7c9c1c39917e8340
https://github.com/scummvm/scummvm/commit/c3c1c908f106526d4938bf3f7c9c1c39917e8340
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Fix first scene in Twisted
Changed paths:
engines/wage/entities.cpp
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index 82efe6d2678..f86a8483095 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -163,6 +163,9 @@ Designed *Scene::lookUpEntity(int x, int y) {
((*it)->_name == "Goth" && (*it)->_resourceId == 18623))
if (_design->isPointOpaque(x, y))
return *it;
+
+ if ((*it)->_name == "TWIST.CLICK")
+ return *it;
if ((*it)->_design->isPointOpaque(x, y))
return *it;
}
Commit: 9aa5fa02a7af2e9b59137e25c17114ee63701f4d
https://github.com/scummvm/scummvm/commit/9aa5fa02a7af2e9b59137e25c17114ee63701f4d
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Fix out of bound array index
Changed paths:
engines/wage/script.cpp
diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index 43af847b451..7b3d31df4ff 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -351,11 +351,11 @@ Script::Operand *Script::readOperand() {
case 0xC3: // MONSTER@
return new Operand(_engine->getMonster(), CHR);
case 0xC4: // RANDOMSCN@
- return new Operand(_world->_orderedScenes[_engine->_rnd->getRandomNumber(_world->_orderedScenes.size())], SCENE);
+ return new Operand(_world->_orderedScenes[_engine->_rnd->getRandomNumber(_world->_orderedScenes.size() - 1)], SCENE);
case 0xC5: // RANDOMCHR@
- return new Operand(_world->_orderedChrs[_engine->_rnd->getRandomNumber(_world->_orderedChrs.size())], CHR);
+ return new Operand(_world->_orderedChrs[_engine->_rnd->getRandomNumber(_world->_orderedChrs.size() - 1)], CHR);
case 0xC6: // RANDOMOBJ@
- return new Operand(_world->_orderedObjs[_engine->_rnd->getRandomNumber(_world->_orderedObjs.size())], OBJ);
+ return new Operand(_world->_orderedObjs[_engine->_rnd->getRandomNumber(_world->_orderedObjs.size() - 1)], OBJ);
case 0xB0: // VISITS#
return new Operand(cont->_visits, NUMBER);
case 0xB1: // RANDOM# for Star Trek, but VISITS# for some other games?
Commit: 4099e49a703a51a3b7642417472eb7bdfb94a06b
https://github.com/scummvm/scummvm/commit/4099e49a703a51a3b7642417472eb7bdfb94a06b
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Fix font type in Dune Eternity
Changed paths:
engines/wage/world.cpp
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp
index 24705e763a1..698eba8f559 100644
--- a/engines/wage/world.cpp
+++ b/engines/wage/world.cpp
@@ -215,6 +215,9 @@ bool World::loadWorld(Common::MacResManager *resMan) {
if (res != NULL) {
scene->_textBounds = readRect(res);
int fontType = res->readUint16BE();
+ if (_name == "***DUNE ETERNITY*** ")
+ fontType = 3;
+
int fontSize = res->readUint16BE();
scene->_font = new Graphics::MacFont(fontType, fontSize, Graphics::kMacFontRegular);
const Graphics::Font *fallback = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
Commit: 9b52b4b384b706fac4eea0881c1d69702fd3c140
https://github.com/scummvm/scummvm/commit/9b52b4b384b706fac4eea0881c1d69702fd3c140
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Add resolution flag to game detection entry
Changed paths:
engines/wage/detection_tables.h
engines/wage/metaengine.cpp
engines/wage/wage.cpp
engines/wage/wage.h
diff --git a/engines/wage/detection_tables.h b/engines/wage/detection_tables.h
index ee7a4648b4c..baaad8ca9e9 100644
--- a/engines/wage/detection_tables.h
+++ b/engines/wage/detection_tables.h
@@ -19,17 +19,24 @@
*
*/
+#include "engines/wage/wage.h"
+
namespace Wage {
#define ADGF_DEFAULT (ADGF_DROPLANGUAGE|ADGF_DROPPLATFORM|ADGF_MACRESFORK|ADGF_UNSTABLE)
#define ADGF_GENERIC (ADGF_DEFAULT|ADGF_USEEXTRAASTITLE|ADGF_AUTOGENTARGET)
#define ADGF_DEMO (ADGF_GENERIC|ADGF_DEMO)
-#define FANGAME(n,m,s) { "wage",n,AD_ENTRY1s(n,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_GENERIC,GUIO0()}
-#define FANGAMEN(n,f,m,s) { "wage",n,AD_ENTRY1s(f,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_GENERIC,GUIO0()}
-#define FANGAMEND(n,f,m,s) { "wage",n,AD_ENTRY1s(f,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_DEMO,GUIO0()}
-#define BIGGAME(t,v,f,m,s) { t,v,AD_ENTRY1s(f,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_DEFAULT,GUIO0()}
-#define BIGGAMED(t,v,f,m,s) { t,v,AD_ENTRY1s(f,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_DEMO,GUIO0()}
+#define FANGAME(n,m,s) { "wage",n,AD_ENTRY1s(n,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_GENERIC,GUIO0() }
+#define FANGAMEr(n,m,s,r) { "wage",n,AD_ENTRY1s(n,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_GENERIC | r,GUIO0() }
+#define FANGAMEN(n,f,m,s) { "wage",n,AD_ENTRY1s(f,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_GENERIC,GUIO0() }
+#define FANGAMENr(n,f,m,s,r) { "wage",n,AD_ENTRY1s(f,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_GENERIC | r,GUIO0() }
+#define FANGAMEND(n,f,m,s) { "wage",n,AD_ENTRY1s(f,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_DEMO,GUIO0() }
+#define FANGAMENDr(n,f,m,s,r) { "wage",n,AD_ENTRY1s(f,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_DEMO | r,GUIO0() }
+#define BIGGAME(t,v,f,m,s) { t,v,AD_ENTRY1s(f,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_DEFAULT,GUIO0() }
+#define BIGGAMEr(t,v,f,m,s,r) { t,v,AD_ENTRY1s(f,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_DEFAULT | r,GUIO0() }
+#define BIGGAMED(t,v,f,m,s) { t,v,AD_ENTRY1s(f,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_DEMO,GUIO0() }
+#define BIGGAMEDr(t,v,f,m,s,r) { t,v,AD_ENTRY1s(f,m,s),Common::EN_ANY,Common::kPlatformMacintosh,ADGF_DEMO | r,GUIO0() }
static const ADGameDescription gameDescriptions[] = {
FANGAMEND("World Builder Demo World", "Demo World", "e221e6f9631f110b484f239e58137a3f", 45467),
@@ -79,11 +86,11 @@ static const ADGameDescription gameDescriptions[] = {
BIGGAME("drakmythcastle", "Disk I", "Drakmyth Castle", "b796545fc4b7c2b89683db873e005e92", 792355), // alt version
BIGGAME("drakmythcastle", "Disk II", "Drakmyth Castle II", "b57af17c805775d7d68b62133164c4e4", 1685403),
// Crash at start in GUI rendering
- FANGAMEN("Dune Eternity", "xn--DUNE ETERNITY -paaanaa75fbbobb", "4946bc99cc42bf83b628352aa9b81a7b", 289945), // Original file name is "***DUNE ETERNITY*** "
+ FANGAMENr("Dune Eternity", "xn--DUNE ETERNITY -paaanaa75fbbobb", "4946bc99cc42bf83b628352aa9b81a7b", 289945, GF_RES800), // Original file name is "***DUNE ETERNITY*** "
FANGAMEN("Dungeon World II", "DungeonWorld2", "74a7153f9ae61a59a216078a37f68f2c", 229943),
// Made for bigger resolution
- FANGAME("Dynasty of Dar", "e118a261d33831c224f3b776ec5dd2a8", 275437),
- FANGAME("Dynasty of Dar", "e15eae8d9a4c40512be3bb81ecedf32c", 275423), // alt version
+ FANGAMEr("Dynasty of Dar", "e118a261d33831c224f3b776ec5dd2a8", 275437, GF_RES800),
+ FANGAMEr("Dynasty of Dar", "e15eae8d9a4c40512be3bb81ecedf32c", 275423, GF_RES800), // alt version
FANGAME("Edg's World", "480bcf68be49ee3765902e922ccdc833", 106513),
FANGAME("Edg's World", "bcbfbf4d2baeadc345f62246279ce3d6", 105927), // alt version
FANGAME("Eidisi I", "ed8fec61ad94ddec06feaf4eb720084b", 172296),
diff --git a/engines/wage/metaengine.cpp b/engines/wage/metaengine.cpp
index 25b592cc0ab..30c60a0e7ff 100644
--- a/engines/wage/metaengine.cpp
+++ b/engines/wage/metaengine.cpp
@@ -30,6 +30,10 @@
namespace Wage {
+void WageEngine::initFeatures() {
+ _gameFeatures = _gameDescription->flags;
+}
+
const char *WageEngine::getGameFile() const {
return _gameDescription->filesDescriptions[0].fileName;
}
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 446a2add1eb..b11ee5fe49a 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -88,6 +88,9 @@ WageEngine::WageEngine(OSystem *syst, const ADGameDescription *desc) : Engine(sy
_resManager = NULL;
+ _gameFeatures = 0;
+ initFeatures();
+
debug("WageEngine::WageEngine()");
}
@@ -103,7 +106,18 @@ WageEngine::~WageEngine() {
Common::Error WageEngine::run() {
debug("WageEngine::init");
- initGraphics(512, 342);
+ int width = 512;
+ int height = 342;
+
+ if (getFeatures() & GF_RES800) {
+ width = 800;
+ height = 600;
+ } else if (getFeatures() & GF_RES1024) {
+ width = 1024;
+ height = 768;
+ }
+
+ initGraphics(width, height);
setDebugger(new Debugger(this));
@@ -271,6 +285,10 @@ void WageEngine::saveGame() {
warning("STUB: saveGame()");
}
+uint32 WageEngine::getFeatures() {
+ return _gameFeatures;
+}
+
void WageEngine::performInitialSetup() {
debug(5, "Resetting Objs: %d", _world->_orderedObjs.size());
for (uint i = 0; i < _world->_orderedObjs.size() - 1; i++)
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index bbae24cfc34..825a5704e48 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -104,6 +104,11 @@ enum {
// the current limitation is 32 debug levels (1 << 31 is the last one)
};
+enum Resolution {
+ GF_RES800 = 1 << 0,
+ GF_RES1024 = 1 << 1
+};
+
Common::Rect *readRect(Common::SeekableReadStream *in);
const char *getIndefiniteArticle(const Common::String &word);
const char *prependGenderSpecificPronoun(int gender);
@@ -197,6 +202,8 @@ public:
Common::String _inputText;
+ uint32 _gameFeatures;
+
void playSound(Common::String soundName);
void setMenu(Common::String soundName);
void appendText(const char *str);
@@ -212,6 +219,9 @@ public:
void redrawScene();
void saveGame();
+ void initFeatures();
+ uint32 getFeatures();
+
Common::Error loadGameState(int slot) override;
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
bool scummVMSaveLoadDialog(bool isSave);
Commit: d2a06c1d42210894be16c5e95acfeca9b9c85cf8
https://github.com/scummvm/scummvm/commit/d2a06c1d42210894be16c5e95acfeca9b9c85cf8
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Fix drawRect
Changed paths:
engines/wage/design.cpp
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 05cac77790f..46bfef2e4e6 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -269,8 +269,8 @@ void Design::drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
int16 y1 = in.readSint16BE();
int16 x1 = in.readSint16BE();
- int16 y2 = in.readSint16BE();
- int16 x2 = in.readSint16BE();
+ int16 y2 = in.readSint16BE() - 1;
+ int16 x2 = in.readSint16BE() - 1;
if (x1 > x2)
SWAP(x1, x2);
@@ -286,6 +286,13 @@ void Design::drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
pd.fillType = borderFillType;
pd.thickness = borderThickness;
+ if (borderThickness > 1) {
+ x1 += borderThickness / 2;
+ y1 += borderThickness / 2;
+ x2 -= (borderThickness - 1) / 2;
+ y2 -= (borderThickness - 1) / 2;
+ }
+
if (borderThickness > 0 && borderFillType <= patterns.size()) {
Graphics::drawLine(x1, y1, x2, y1, kColorBlack, drawPixel, &pd);
Graphics::drawLine(x2, y1, x2, y2, kColorBlack, drawPixel, &pd);
Commit: 706a2abbbb1b93eab0168827bc334470d408c808
https://github.com/scummvm/scummvm/commit/706a2abbbb1b93eab0168827bc334470d408c808
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Fix shapes with thick borders
Changed paths:
engines/wage/design.cpp
engines/wage/detection_tables.h
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 46bfef2e4e6..7b0c97bbf00 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -303,10 +303,11 @@ void Design::drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
void Design::drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
+ debug("thickness: %d", borderThickness);
int16 y1 = in.readSint16BE();
int16 x1 = in.readSint16BE();
- int16 y2 = in.readSint16BE();
- int16 x2 = in.readSint16BE();
+ int16 y2 = in.readSint16BE() - 1;
+ int16 x2 = in.readSint16BE() - 1;
int16 arc = in.readSint16BE();
if (x1 > x2)
@@ -314,6 +315,13 @@ void Design::drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream
if (y1 > y2)
SWAP(y1, y2);
+ if (borderThickness > 1) {
+ x1 += borderThickness / 2;
+ y1 += borderThickness / 2;
+ x2 -= (borderThickness - 1) / 2;
+ y2 -= (borderThickness - 1) / 2;
+ }
+
Common::Rect r(x1, y1, x2, y2);
PlotData pd(surface, &patterns, fillType, 1, this);
@@ -324,7 +332,7 @@ void Design::drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream
pd.thickness = borderThickness;
if (borderThickness > 0 && borderFillType <= patterns.size())
- Graphics::drawRoundRect1(r, arc / 2, kColorBlack, false, drawPixel, &pd);
+ Graphics::drawRoundRect1(r, arc / 2 - 1, kColorBlack, false, drawPixel, &pd);
}
void Design::drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &in,
@@ -379,6 +387,13 @@ void Design::drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &
xcoords.push_back(x1);
ycoords.push_back(y1);
+ if (borderThickness > 1) {
+ for (int i = 0; i < xcoords.size(); ++i) {
+ xcoords[i] += borderThickness / 2;
+ ycoords[i] += borderThickness / 2;
+ }
+ }
+
int npoints = xcoords.size();
int *xpoints = (int *)calloc(npoints, sizeof(int));
int *ypoints = (int *)calloc(npoints, sizeof(int));
diff --git a/engines/wage/detection_tables.h b/engines/wage/detection_tables.h
index baaad8ca9e9..8aff1e8df92 100644
--- a/engines/wage/detection_tables.h
+++ b/engines/wage/detection_tables.h
@@ -41,6 +41,12 @@ namespace Wage {
static const ADGameDescription gameDescriptions[] = {
FANGAMEND("World Builder Demo World", "Demo World", "e221e6f9631f110b484f239e58137a3f", 45467),
+ FANGAME("Rects", "03d2f93b1cafe963a0e29232f4867cc4", 38177),
+ FANGAME("Filled Rects", "835ae43bf16a8d83b84a99724eaec79d", 38194),
+ FANGAME("Round Rects", "9602f7baafb13fd1c7fd00f92743227c", 38194),
+ FANGAME("Filled Round Rects", "4d880677a97fd07e6a4f04a46f147084", 38194),
+ FANGAME("Polygon", "c84d8065c6a4eb7dd232003954ba7cab", 38352),
+
FANGAME("3rd Floor", "931aa0b6ada3aced5117ee6e6daf2fb8", 281153),
FANGAME("3rd Floor", "140883954b7cd89b0ffabde6ee0073d4", 281167), // alt version
FANGAME("3rd Floor", "afe1a9eb0d4e5857f9f748570862c88e", 281213), // v1.3
Commit: dbb09bb6a15805c8de02f6ed9fa5530877fcf8cb
https://github.com/scummvm/scummvm/commit/dbb09bb6a15805c8de02f6ed9fa5530877fcf8cb
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Fix drawOval
Changed paths:
engines/wage/design.cpp
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 7b0c97bbf00..7bb1e5e14c4 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -253,6 +253,53 @@ void drawPixel(int x, int y, int color, void *data) {
}
}
+void drawPixelCircle(int x, int y, int color, void *data) {
+ PlotData *p = (PlotData *)data;
+
+ if (p->fillType > p->patterns->size())
+ return;
+
+ if (p->design && p->design->isBoundsCalculation()) {
+ if (x < 0 || y < 0)
+ return;
+ if (p->thickness == 1) {
+ p->design->adjustBounds(x, y);
+ } else {
+ int x1 = x;
+ int x2 = x1 + p->thickness;
+ int y1 = y;
+ int y2 = y1 + p->thickness;
+
+ for (y = y1; y < y2; y++)
+ for (x = x1; x < x2; x++)
+ p->design->adjustBounds(x, y);
+ }
+
+ return;
+ }
+
+ byte *pat = p->patterns->operator[](p->fillType - 1);
+
+ if (p->thickness == 1) {
+ if (x >= 0 && x < p->surface->w && y >= 0 && y < p->surface->h) {
+ uint xu = (uint)x; // for letting compiler optimize it
+ uint yu = (uint)y;
+
+ *((byte *)p->surface->getBasePtr(xu, yu)) =
+ (pat[yu % 8] & (1 << (7 - xu % 8))) ? color : kColorWhite;
+ }
+ } else {
+ int x1 = x - p->thickness / 2;
+ int x2 = x1 + p->thickness;
+ int y1 = y - p->thickness / 2;
+ int y2 = y1 + p->thickness;
+
+ PlotData pd(p->surface, p->patterns, p->fillType, 1, p->design);
+
+ Graphics::drawEllipse(x1, y1, x2 - 1, y2 - 1, kColorBlack, true, drawPixel, &pd);
+ }
+}
+
void drawPixelPlain(int x, int y, int color, void *data) {
PlotData *p = (PlotData *)data;
@@ -303,7 +350,6 @@ void Design::drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
void Design::drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
- debug("thickness: %d", borderThickness);
int16 y1 = in.readSint16BE();
int16 x1 = in.readSint16BE();
int16 y2 = in.readSint16BE() - 1;
@@ -433,8 +479,15 @@ void Design::drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in,
pd.fillType = borderFillType;
pd.thickness = borderThickness;
+ if (borderThickness > 1) {
+ x1 += borderThickness / 2;
+ y1 += borderThickness / 2;
+ x2 -= (borderThickness - 1) / 2;
+ y2 -= (borderThickness - 1) / 2;
+ }
+
if (borderThickness > 0 && borderFillType <= patterns.size())
- Graphics::drawEllipse(x1, y1, x2-1, y2-1, kColorBlack, false, drawPixel, &pd);
+ Graphics::drawEllipse(x1, y1, x2-1, y2-1, kColorBlack, false, drawPixelCircle, &pd);
}
void Design::drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadStream &in) {
Commit: 104565e281e2bcd7df8ad87c9ddfba86f07353e2
https://github.com/scummvm/scummvm/commit/104565e281e2bcd7df8ad87c9ddfba86f07353e2
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Update detection table
Changed paths:
engines/wage/detection_tables.h
diff --git a/engines/wage/detection_tables.h b/engines/wage/detection_tables.h
index 8aff1e8df92..4237ed78eec 100644
--- a/engines/wage/detection_tables.h
+++ b/engines/wage/detection_tables.h
@@ -41,11 +41,15 @@ namespace Wage {
static const ADGameDescription gameDescriptions[] = {
FANGAMEND("World Builder Demo World", "Demo World", "e221e6f9631f110b484f239e58137a3f", 45467),
- FANGAME("Rects", "03d2f93b1cafe963a0e29232f4867cc4", 38177),
- FANGAME("Filled Rects", "835ae43bf16a8d83b84a99724eaec79d", 38194),
- FANGAME("Round Rects", "9602f7baafb13fd1c7fd00f92743227c", 38194),
- FANGAME("Filled Round Rects", "4d880677a97fd07e6a4f04a46f147084", 38194),
- FANGAME("Polygon", "c84d8065c6a4eb7dd232003954ba7cab", 38352),
+ // Render Tests
+ //FANGAME("Rects", "03d2f93b1cafe963a0e29232f4867cc4", 38177),
+ //FANGAME("Filled Rects", "835ae43bf16a8d83b84a99724eaec79d", 38194),
+ //FANGAME("Round Rects", "9602f7baafb13fd1c7fd00f92743227c", 38194),
+ //FANGAME("Filled Round Rects", "4d880677a97fd07e6a4f04a46f147084", 38194),
+ //FANGAME("Polygon", "c84d8065c6a4eb7dd232003954ba7cab", 38352),
+ //FANGAME("Filled Polygon", "2d5a3c952c6c43c0456eae9bbc52867d", 38310),
+ //FANGAME("Ovals", "9b5e3d5afe3b4c46e506216a5ae16e14", 38194),
+ //FANGAME("Filled Ovals", "6990174e0b39d85f3069f98511bb0074", 38194),
FANGAME("3rd Floor", "931aa0b6ada3aced5117ee6e6daf2fb8", 281153),
FANGAME("3rd Floor", "140883954b7cd89b0ffabde6ee0073d4", 281167), // alt version
@@ -86,15 +90,12 @@ static const ADGameDescription gameDescriptions[] = {
FANGAMEN("Deep Angst", "xn--DEEP ANGST 1987Ronald Wartow-k8a2050w", "38cc0c9a301e63b0a942677a0d19b0ac", 337122), // original file name "DEEP ANGST⢠©1987Ronald Wartow", v..90B
FANGAMEN("Deep Angst II: The Nightmare Ends", "Deep Angst II", "2e468021416bc2b82e283030c7f6bc5d", 408761),
FANGAME("Deep Ennui", "9879bf659f11c9177d578a347da0c658", 85819),
- // Polygons with ignored byte 1
FANGAME("Double Trouble", "1cd05d66163b44f9f0d8c3e7232bc2db", 542115),
BIGGAME("drakmythcastle", "Disk I", "Drakmyth Castle disk I of II", "54dd0a817b667fc05c4f2dee6abe126a", 793528),
BIGGAME("drakmythcastle", "Disk I", "Drakmyth Castle", "b796545fc4b7c2b89683db873e005e92", 792355), // alt version
BIGGAME("drakmythcastle", "Disk II", "Drakmyth Castle II", "b57af17c805775d7d68b62133164c4e4", 1685403),
- // Crash at start in GUI rendering
FANGAMENr("Dune Eternity", "xn--DUNE ETERNITY -paaanaa75fbbobb", "4946bc99cc42bf83b628352aa9b81a7b", 289945, GF_RES800), // Original file name is "***DUNE ETERNITY*** "
FANGAMEN("Dungeon World II", "DungeonWorld2", "74a7153f9ae61a59a216078a37f68f2c", 229943),
- // Made for bigger resolution
FANGAMEr("Dynasty of Dar", "e118a261d33831c224f3b776ec5dd2a8", 275437, GF_RES800),
FANGAMEr("Dynasty of Dar", "e15eae8d9a4c40512be3bb81ecedf32c", 275423, GF_RES800), // alt version
FANGAME("Edg's World", "480bcf68be49ee3765902e922ccdc833", 106513),
@@ -103,7 +104,6 @@ static const ADGameDescription gameDescriptions[] = {
FANGAME("Eidisi I", "a20f080d6109d8e253d74b0dfb4b2ae5", 172296), // alt version
FANGAME("Eidisi I", "06ae31c4361f9bd5b91593858b6d0d79", 172310), // alt version
FANGAME("Elite Commando", "3fc74f1403c1529b52f3cd4d60771dac", 293704), // v1.0
- // Problems(?) with text on the first screen
FANGAMEN("Enchanted Pencils", "Enchanted Pencils 0.99 (PG)", "49a0708da81dbeb28c6e607429c92209", 408657),
FANGAMEN("Enchanted Pencils", "Enchanted Pencils 0.99 (PG)", "0095d0e069851521c44ca3cdc94bcba3", 414464), // alt?
FANGAMEN("Escape!", "xn--Escape!-z46c", "28a9658ee846a34f133df29b54cf255a", 64819), // Original file name "Escape!â "
@@ -118,7 +118,6 @@ static const ADGameDescription gameDescriptions[] = {
// Cannot proceed past the first scene
FANGAMEND("Explorer", "Explorer DEMO", "0ae79f48754466c4cd65137c7f186384", 460972),
FANGAMEND("Explorer", "Explorer DEMO", "6b22972808630201ece7cc96a0ef17f7", 460959), // alt version
- // Crash in console rendering on the first scene
FANGAME("Fantasy Quest", "b52d3e2680a76c23b2791e2c87f6b6bd", 762498),
FANGAME("Find the Heart", "0c0c282649597ea1ac82d97c8d4029a2", 105979), // From Joshua's Worlds 1.0
FANGAME("Find the Heart", "6fb8c6b8bc2287ba225b0ac6580dc073", 105675), // From Joshua's Worlds 1.0, alt version
@@ -143,7 +142,6 @@ static const ADGameDescription gameDescriptions[] = {
// Cropped graphics on first scene, cannot pass to in-game
FANGAMEN("Introduction to Gothic", "Intro to Gothic", "606eec666f0b2d767e4423747e740434", 207811),
FANGAMEN("James Bond 007", "007", "2449924f2cb43454489a4ef91c0ee702", 50407),
- // Lots of unhandled comparisons
FANGAME("Jamie the Demon Slayer", "ed054aa760569059c7ea554e822089a6", 232533),
FANGAMEN("Journey", "The Journey 1.6.2 US", "588a516caa187005fdfcbc72823c8eff", 820316),
FANGAMEN("Jumble", "xn--LSJUMBLE -", "555ead186ec1683157e53b96fc4a99d5", 647083), // Original file name is "LSJUMBLEâ "
@@ -162,7 +160,6 @@ static const ADGameDescription gameDescriptions[] = {
FANGAME("Magic Rings", "263e2c90af61f0798bf41f6a1e3f6345", 108788),
FANGAMEN("Maze of the Questing Beast", "MQB", "03775e1894809f24234aeaab18f39451", 134444),
FANGAMEN("Maze of the Questing Beast Solutions", "MQB Solutions", "8a27e515f12162cc8b85e4f2bd16a1e5", 37606),
- // No way to click on the house
FANGAME("Messy House", "32ca71f2ff37997407cead590c2dd306", 176864),
FANGAME("Midnight Snack", "70ba8a5a1f0304669c9987360bba236f", 67696),
FANGAME("Midnight Snack", "24973af10822979e23866d88a7d2e15c", 67710), // alt version
@@ -175,20 +172,16 @@ static const ADGameDescription gameDescriptions[] = {
FANGAMEN("Mormonoids from the Deep", "Mormonoids 1.0", "15c99d26ac2abb9eb4802a7dd5326086", 642975),
FANGAMEN("Mormonoids from the Deep", "Mormonoids 1.25", "4730d0c47d13401d73353e980f91a304", 645062),
FANGAMEN("Mormonoids from the Deep", "Mormonoids 1.25", "1a7ee052b375f0c0a4c18836c978ce5b", 645077), // alt version
- // Unhandled comparison case
FANGAMEN("Mountain of Mayhem", "xn--Mountain of Mayhem -3g6k", "634211b004371635d191ae0687035501", 749747), // Original file name "Mountain of Mayhem â "
FANGAME("Mountain of Mayhem", "c83a5703b3ea95f465839f4f54ef0805", 749733), // alt version
FANGAME("Muddy Water", "711dd9d154d13c31bc216ef8539bb095", 662438), // v1.3.2
// No way to pass through the first screen
FANGAME("Nightcrawler Ned", "8423fc015c395bd6be54a7ea69170d99", 366286),
- // No player in the world
FANGAMEN("Parrot Talk", "PARROT TALK V1", "c38c090be8c078d931905c93bc0689f5", 118680),
- // No player in the world
FANGAMEN("Parrot Talk", "PARROT TALKV2", "5ec1df9e2d6d0dcf1a040a95500d9551", 118628),
FANGAME("Pavilion", "a980e60a291c0a7b949474177affa134", 231431),
FANGAMEN("Pencils", "Pencils.99", "09dbcdbefe20536c2db1b1a4fb4e5ed3", 408295),
FANGAMEN("Pencils", "Pencils.99", "9757cc28d82cea636ee260b9aa33c167", 407695), // alt version
- // Polygons with byte 1
FANGAME("Periapt", "7e26a7827c694232624321a5a6844511", 405750),
FANGAME("Periapt", "bc36e40de279d5f0844577fe702d9f64", 405750), // alt version
FANGAME("Periapt", "661642865321fa81ce84ae2eedbc1aff", 405736), // alt version
@@ -205,9 +198,7 @@ static const ADGameDescription gameDescriptions[] = {
FANGAME("Puzzle Piece Search", "6c21c1e0c6afef9300941abd7782dd16", 247437), // From Joshua's Worlds 1.0
FANGAME("The Puzzle Piece Search", "8fa1d80dd3f1ed69f45d15d774968995", 247082), // From Joshua's Worlds
FANGAME("The Puzzle Piece Search", "fb839ac4f22427f44e99bcc5afd57a0b", 247068), // Standalone
- // Empty(?) first scene
FANGAME("Pyramid of No Return", "4bf4c39b140f5aadb5f8c9a50153d18e", 384889),
- // Cropped graphics at the first scene
FANGAME("P-W Adventure", "a8e9f97ee02f01de588a4dbabe55ca3f", 218960),
FANGAMEN("Pyramid of Ert", "Pyramid of Ert V1.2", "358b03ea9c978fbfd2ce2833daea00f8", 315527),
FANGAME("Queen Quest", "7ca009dad76827ce008c3c7fa01cab0a", 56770),
@@ -225,7 +216,6 @@ static const ADGameDescription gameDescriptions[] = {
BIGGAME("raysmaze", "v1.5/alt", "Ray's Maze1.5", "401cd46df5e49fa4171ed398b3e0227b", 1408260),
FANGAME("Ray's World Builder Demo", "eafea10db54530ac6e6128be31741542", 115800),
FANGAME("Robot Planet", "1066f6b2892cda16c2f365d1ec97537c", 107089),
- // Unhandled comparison case
FANGAMEN("Sands of Time", "xn--Sands of Time-1s6g", "d065662865d0cb9065812479ed7d2795", 122416), // Original file name "Sands of Timeâ "
FANGAMEN("Sands of Time", "Sands of Time", "d065662865d0cb9065812479ed7d2795", 122416), // same version, normal file name
BIGGAME("scepters", "", "Scepters", "ecb776fb660205fad5819a26f7e180b5", 347103), // original 1986 version
@@ -252,20 +242,15 @@ static const ADGameDescription gameDescriptions[] = {
FANGAME("Swamp Witch", "07463c8b3b908b0c493a41b949ac1ff5", 739875), // alt version
FANGAME("Swamp Witch", "865a07a0356926d6cab8f14208e11f9c", 739511), // another alt version
FANGAME("Sweetspace Now!", "574dc7dd25543f7a516d6524f0c5ab33", 123557), // Comes with Jumble
- // Wrong scrolling in the first console text
FANGAMEN("Sword of Siegfried", "Sword of Siegfried 1.0", "2ae8f21cfb228ce58ee47b767bdd8820", 234507),
FANGAMEN("Sword of Siegfried", "Sword of Siegfried 1.0", "7a68b00019592f3aa671cae024f7e843", 234493), // alt version
FANGAME("Time Bomb", "e96f3e2efd1e3db6ad0be22180f5473c", 64308),
FANGAME("Time Bomb", "976180f9be0d1029aaba7774fec9767c", 64322), // alt version
FANGAMEN("The Time Squisher", "Time Squisher v 1.1", "3e296141e7a7c9b05e0dde779d9bb50d", 463526),
- // Admission for on 3rd screen is messed up
FANGAME("The Tower", "4cd8755ccb5bbeaf2e5f7848a8daa033", 556283),
- // Messed up first scene
FANGAMEND("Tombworld", "xn--Demo TombWorld-8ra", "695734292024290d5d0aa6a66ff628f6", 663996), // Original file name "Demo TombWorld©"
FANGAMEND("Tombworld", "DemoTombWorld", "4b3f56cfa595eab3919a918767e11870", 387403), // alt version
- // Doesn't go past first scene
BIGGAME("twisted", "", "Twisted! 1.6", "6e0be4c7d83231e56a431dc4ef7bf978", 960698),
- // Polygons with ignored byte 1 and 2 on second scene
FANGAME("The Village", "fd35cad8c61064d6c8aaadab7070ccad", 314572),
FANGAME("The Village", "b84ac84be610498c4de5d9bd4fd36175", 314620), // alt version
FANGAMEN("Volcano II", "xn--Volcano II-0y6e", "7941c08b34bc2408b98c0004c7154aeb", 82735), // Original file name "Volcano IIâ "
Commit: e5d0b01d89efcc8541ce385262a33ad9797f3b2b
https://github.com/scummvm/scummvm/commit/e5d0b01d89efcc8541ce385262a33ad9797f3b2b
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Use uint for loop index
Changed paths:
engines/wage/design.cpp
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 7bb1e5e14c4..3aeca6fc8a7 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -434,7 +434,7 @@ void Design::drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &
ycoords.push_back(y1);
if (borderThickness > 1) {
- for (int i = 0; i < xcoords.size(); ++i) {
+ for (uint i = 0; i < xcoords.size(); ++i) {
xcoords[i] += borderThickness / 2;
ycoords[i] += borderThickness / 2;
}
Commit: 3b96ffd8752d27a92379341774007eab916df44d
https://github.com/scummvm/scummvm/commit/3b96ffd8752d27a92379341774007eab916df44d
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Add comment
Changed paths:
engines/wage/design.cpp
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 3aeca6fc8a7..95caeee33db 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -280,6 +280,7 @@ void drawPixelCircle(int x, int y, int color, void *data) {
byte *pat = p->patterns->operator[](p->fillType - 1);
+ // Draw circle when thickness is > 1, put a pixel otherwise
if (p->thickness == 1) {
if (x >= 0 && x < p->surface->w && y >= 0 && y < p->surface->h) {
uint xu = (uint)x; // for letting compiler optimize it
Commit: 0e8c75359dbe93509aa5b5e25a8590ab7fb1a543
https://github.com/scummvm/scummvm/commit/0e8c75359dbe93509aa5b5e25a8590ab7fb1a543
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Formatting fixes
Changed paths:
engines/wage/design.cpp
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 95caeee33db..8a9b9d96791 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -488,7 +488,7 @@ void Design::drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in,
}
if (borderThickness > 0 && borderFillType <= patterns.size())
- Graphics::drawEllipse(x1, y1, x2-1, y2-1, kColorBlack, false, drawPixelCircle, &pd);
+ Graphics::drawEllipse(x1, y1, x2 - 1, y2 - 1, kColorBlack, false, drawPixelCircle, &pd);
}
void Design::drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadStream &in) {
Commit: e61f47e07d9531e81818379e26e726e1889ac5d9
https://github.com/scummvm/scummvm/commit/e61f47e07d9531e81818379e26e726e1889ac5d9
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Add comments
Changed paths:
engines/wage/entities.cpp
engines/wage/util.cpp
engines/wage/world.cpp
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index f86a8483095..40046ec657f 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -159,11 +159,13 @@ void Scene::paint(Graphics::ManagedSurface *surface, int x, int y) {
Designed *Scene::lookUpEntity(int x, int y) {
for (ObjList::const_iterator it = _objs.end(); it != _objs.begin(); ) {
it--;
+ // WORKAROUND: Some games draw objects on a different surface
if (((*it)->_name == "continue" && (*it)->_resourceId == 22259) ||
((*it)->_name == "Goth" && (*it)->_resourceId == 18623))
if (_design->isPointOpaque(x, y))
return *it;
+ // WORKAROUND: Twister needs special check to handle intro sequence
if ((*it)->_name == "TWIST.CLICK")
return *it;
if ((*it)->_design->isPointOpaque(x, y))
diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp
index b4ff8e4ca81..70559f3d663 100644
--- a/engines/wage/util.cpp
+++ b/engines/wage/util.cpp
@@ -53,6 +53,7 @@ namespace Wage {
Common::Rect *readRect(Common::SeekableReadStream *in) {
int x1, y1, x2, y2;
+ // Account for the extra two pixels because of the squares on the border
y1 = in->readSint16BE() - 2;
x1 = in->readSint16BE() - 2;
y2 = in->readSint16BE() + 2;
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp
index 698eba8f559..a5b83675f1e 100644
--- a/engines/wage/world.cpp
+++ b/engines/wage/world.cpp
@@ -215,6 +215,7 @@ bool World::loadWorld(Common::MacResManager *resMan) {
if (res != NULL) {
scene->_textBounds = readRect(res);
int fontType = res->readUint16BE();
+ // WORKAROUND: Dune Eternity has a weird fontType ID so we override it to the correct one
if (_name == "***DUNE ETERNITY*** ")
fontType = 3;
Commit: e8fee0ccc27eed435dfc1160787c457659aca67b
https://github.com/scummvm/scummvm/commit/e8fee0ccc27eed435dfc1160787c457659aca67b
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
JANITORIAL: Formatting fix
Changed paths:
engines/wage/wage.h
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 825a5704e48..1c66f9091fb 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -105,8 +105,8 @@ enum {
};
enum Resolution {
- GF_RES800 = 1 << 0,
- GF_RES1024 = 1 << 1
+ GF_RES800 = 1 << 0,
+ GF_RES1024 = 1 << 1
};
Common::Rect *readRect(Common::SeekableReadStream *in);
Commit: 9f6d054f5d169f2ca0c24b9ceeb50fdef1073646
https://github.com/scummvm/scummvm/commit/9f6d054f5d169f2ca0c24b9ceeb50fdef1073646
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Refactor getFeatures()
Changed paths:
engines/wage/metaengine.cpp
engines/wage/wage.cpp
engines/wage/wage.h
diff --git a/engines/wage/metaengine.cpp b/engines/wage/metaengine.cpp
index 30c60a0e7ff..25b592cc0ab 100644
--- a/engines/wage/metaengine.cpp
+++ b/engines/wage/metaengine.cpp
@@ -30,10 +30,6 @@
namespace Wage {
-void WageEngine::initFeatures() {
- _gameFeatures = _gameDescription->flags;
-}
-
const char *WageEngine::getGameFile() const {
return _gameDescription->filesDescriptions[0].fileName;
}
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index b11ee5fe49a..a29546b062b 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -53,6 +53,7 @@
#include "engines/engine.h"
#include "engines/util.h"
+#include "engines/advancedDetector.h"
#include "graphics/macgui/macdialog.h"
@@ -88,9 +89,6 @@ WageEngine::WageEngine(OSystem *syst, const ADGameDescription *desc) : Engine(sy
_resManager = NULL;
- _gameFeatures = 0;
- initFeatures();
-
debug("WageEngine::WageEngine()");
}
@@ -286,7 +284,7 @@ void WageEngine::saveGame() {
}
uint32 WageEngine::getFeatures() {
- return _gameFeatures;
+ return _gameDescription->flags;
}
void WageEngine::performInitialSetup() {
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 1c66f9091fb..b59d9ed2536 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -202,8 +202,6 @@ public:
Common::String _inputText;
- uint32 _gameFeatures;
-
void playSound(Common::String soundName);
void setMenu(Common::String soundName);
void appendText(const char *str);
@@ -219,7 +217,6 @@ public:
void redrawScene();
void saveGame();
- void initFeatures();
uint32 getFeatures();
Common::Error loadGameState(int slot) override;
Commit: 1b955dc90c7f1ad0e910db39b9a7cc291a04a36e
https://github.com/scummvm/scummvm/commit/1b955dc90c7f1ad0e910db39b9a7cc291a04a36e
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Refactor MacDialog to not use WAGE functions
Changed paths:
engines/wage/wage.cpp
engines/wage/wage.h
graphics/macgui/macdialog.cpp
graphics/macgui/macdialog.h
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index a29546b062b..24c980a4fb7 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -215,6 +215,48 @@ void WageEngine::appendText(const char *str) {
_inputText.clear();
}
+void WageEngine::pollDialogEvents(Graphics::MacDialog &dialog) {
+ bool shouldQuit = false;
+ while (!shouldQuit) {
+ Common::Event event;
+
+ while (_gui->_engine->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_QUIT:
+ _gui->_engine->_shouldQuit = true;
+ shouldQuit = true;
+ break;
+ case Common::EVENT_MOUSEMOVE:
+ dialog.mouseMove(event.mouse.x, event.mouse.y);
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ dialog.mouseClick(event.mouse.x, event.mouse.y);
+ break;
+ case Common::EVENT_LBUTTONUP:
+ shouldQuit = dialog.mouseRaise(event.mouse.x, event.mouse.y);
+ break;
+ case Common::EVENT_KEYDOWN:
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
+ dialog._pressedButton = -1;
+ shouldQuit = true;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (dialog._needsRedraw)
+ dialog.paint();
+
+ g_system->updateScreen();
+ g_system->delayMillis(50);
+ }
+}
+
void WageEngine::gameOver() {
Graphics::MacDialogButtonArray buttons;
@@ -225,9 +267,11 @@ void WageEngine::gameOver() {
Graphics::MacText gameOverMessage(*_world->_gameOverMessage, _gui->_wm, &font, Graphics::kColorBlack,
Graphics::kColorWhite, 199, Graphics::kTextAlignCenter);
- Graphics::MacDialog gameOverDialog(_gui, 199, &gameOverMessage, 199, &buttons, 0);
+ Graphics::MacDialog gameOverDialog(&_gui->_screen, _gui->_wm, 199, &gameOverMessage, 199, &buttons, 0);
- gameOverDialog.run();
+ gameOverDialog.start();
+ pollDialogEvents(gameOverDialog);
+ gameOverDialog.stop();
doClose();
@@ -247,9 +291,11 @@ bool WageEngine::saveDialog() {
Graphics::MacText saveBeforeCloseMessage(*_world->_saveBeforeCloseMessage, _gui->_wm, &font, Graphics::kColorBlack,
Graphics::kColorWhite, 291, Graphics::kTextAlignCenter);
- Graphics::MacDialog save(_gui, 291, &saveBeforeCloseMessage, 291, &buttons, 1);
+ Graphics::MacDialog save(&_gui->_screen, _gui->_wm, 291, &saveBeforeCloseMessage, 291, &buttons, 1);
- int button = save.run();
+ save.start();
+ pollDialogEvents(save);
+ int button = save.stop();
if (button == 2) // Cancel
return false;
@@ -274,9 +320,11 @@ void WageEngine::aboutDialog() {
aboutMessage.appendText(disclaimer, 3, 9, 0, false);
- Graphics::MacDialog save(_gui, 450, &aboutMessage, 400, &buttons, 0);
+ Graphics::MacDialog about(&_gui->_screen, _gui->_wm, 450, &aboutMessage, 400, &buttons, 0);
- save.run();
+ about.start();
+ pollDialogEvents(about);
+ about.stop();
}
void WageEngine::saveGame() {
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index b59d9ed2536..511c5efcf52 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -60,6 +60,10 @@
struct ADGameDescription;
+namespace Graphics {
+class MacDialog;
+}
+
namespace Wage {
class Console;
@@ -205,6 +209,7 @@ public:
void playSound(Common::String soundName);
void setMenu(Common::String soundName);
void appendText(const char *str);
+ void pollDialogEvents(Graphics::MacDialog &dialog);
void gameOver();
bool saveDialog();
void aboutDialog();
diff --git a/graphics/macgui/macdialog.cpp b/graphics/macgui/macdialog.cpp
index 4b4fc535005..8b38e6edcdc 100644
--- a/graphics/macgui/macdialog.cpp
+++ b/graphics/macgui/macdialog.cpp
@@ -47,10 +47,7 @@
#include "common/events.h"
#include "common/system.h"
-//#include "engines/engine.h"
-#include "engines/wage/design.h"
-#include "engines/wage/gui.h"
-#include "engines/wage/wage.h"
+#include "graphics/primitives.h"
#include "graphics/macgui/mactext.h"
#include "graphics/macgui/macfontmanager.h"
@@ -63,10 +60,8 @@ enum {
kDialogHeight = 113
};
-MacDialog::MacDialog(Wage::Gui *gui, int width, MacText *mactext, int maxTextWidth, MacDialogButtonArray *buttons, uint defaultButton) :
- _gui(gui), _mactext(mactext), _maxTextWidth(maxTextWidth), _buttons(buttons), _defaultButton(defaultButton) {
- assert(_gui->_engine);
- assert(_gui->_engine->_world);
+MacDialog::MacDialog(ManagedSurface *screen, MacWindowManager *wm, int width, MacText *mactext, int maxTextWidth, MacDialogButtonArray *buttons, uint defaultButton) :
+ _screen(screen), _wm(wm), _mactext(mactext), _maxTextWidth(maxTextWidth), _buttons(buttons), _defaultButton(defaultButton) {
int height = kDialogHeight + _mactext->getTextHeight();
@@ -74,10 +69,10 @@ MacDialog::MacDialog(Wage::Gui *gui, int width, MacText *mactext, int maxTextWid
_tempSurface.create(width + 1, height + 1, Graphics::PixelFormat::createFormatCLUT8());
- _bbox.left = (_gui->_screen.w - width) / 2;
- _bbox.top = (_gui->_screen.h - height) / 2;
- _bbox.right = (_gui->_screen.w + width) / 2;
- _bbox.bottom = (_gui->_screen.h + height) / 2;
+ _bbox.left = (_screen->w - width) / 2;
+ _bbox.top = (_screen->h - height) / 2;
+ _bbox.right = (_screen->w + width) / 2;
+ _bbox.bottom = (_screen->h + height) / 2;
_pressedButton = -1;
@@ -96,12 +91,13 @@ MacDialog::~MacDialog() {
}
const Graphics::Font *MacDialog::getDialogFont() {
- return _gui->_wm->_fontMan->getFont(Graphics::MacFont(Graphics::kMacFontChicago, 12));
+ return _wm->_fontMan->getFont(Graphics::MacFont(Graphics::kMacFontChicago, 12));
}
void MacDialog::paint() {
- Wage::Design::drawFilledRect(&_gui->_screen, _bbox, kColorWhite, _gui->_wm->getPatterns(), kPatternSolid);
- _mactext->drawToPoint(&_gui->_screen, Common::Point(_bbox.left + (_bbox.width() - _maxTextWidth)/2, _bbox.top + 16));
+ MacPlotData pd(_screen, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorBlack, false);
+ drawFilledRect1(_bbox, kColorWhite, _wm->getDrawPixel(), &pd);
+ _mactext->drawToPoint(_screen, Common::Point(_bbox.left + (_bbox.width() - _maxTextWidth)/2, _bbox.top + 16));
static int boxOutline[] = {1, 0, 0, 1, 1};
drawOutline(_bbox, boxOutline, ARRAYSIZE(boxOutline));
@@ -121,7 +117,7 @@ void MacDialog::paint() {
Common::Rect bb(button->bounds.left + 5, button->bounds.top + 5,
button->bounds.right - 5, button->bounds.bottom - 5);
- Wage::Design::drawFilledRect(&_gui->_screen, bb, kColorBlack, _gui->_wm->getPatterns(), kPatternSolid);
+ drawFilledRect1(bb, kColorBlack, _wm->getDrawPixel(), &pd);
color = kColorWhite;
}
@@ -129,74 +125,38 @@ void MacDialog::paint() {
int x = button->bounds.left + (button->bounds.width() - w) / 2;
int y = button->bounds.top + 6;
- _font->drawString(&_gui->_screen, button->text, x, y, _bbox.width(), color);
+ _font->drawString(_screen, button->text, x, y, _bbox.width(), color);
drawOutline(button->bounds, buttonOutline, ARRAYSIZE(buttonOutline));
}
- g_system->copyRectToScreen(_gui->_screen.getBasePtr(_bbox.left, _bbox.top), _gui->_screen.pitch,
+ g_system->copyRectToScreen(_screen->getBasePtr(_bbox.left, _bbox.top), _screen->pitch,
_bbox.left, _bbox.top, _bbox.width() + 1, _bbox.height() + 1);
_needsRedraw = false;
}
void MacDialog::drawOutline(Common::Rect &bounds, int *spec, int speclen) {
+ MacPlotData pd(_screen, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorBlack, false);
for (int i = 0; i < speclen; i++)
- if (spec[i] != 0)
- Wage::Design::drawRect(&_gui->_screen, bounds.left + i, bounds.top + i, bounds.right - i, bounds.bottom - i,
- 1, kColorBlack, _gui->_wm->getPatterns(), kPatternSolid);
-}
-
-int MacDialog::run() {
- bool shouldQuit = false;
- Common::Rect r(_bbox);
-
- _tempSurface.copyRectToSurface(_gui->_screen.getBasePtr(_bbox.left, _bbox.top), _gui->_screen.pitch, 0, 0, _bbox.width() + 1, _bbox.height() + 1);
- _gui->_wm->pushCursor(kMacCursorArrow, nullptr);
-
- while (!shouldQuit) {
- Common::Event event;
-
- while (_gui->_engine->pollEvent(event)) {
- switch (event.type) {
- case Common::EVENT_QUIT:
- _gui->_engine->_shouldQuit = true;
- shouldQuit = true;
- break;
- case Common::EVENT_MOUSEMOVE:
- mouseMove(event.mouse.x, event.mouse.y);
- break;
- case Common::EVENT_LBUTTONDOWN:
- mouseClick(event.mouse.x, event.mouse.y);
- break;
- case Common::EVENT_LBUTTONUP:
- shouldQuit = mouseRaise(event.mouse.x, event.mouse.y);
- break;
- case Common::EVENT_KEYDOWN:
- switch (event.kbd.keycode) {
- case Common::KEYCODE_ESCAPE:
- _pressedButton = -1;
- shouldQuit = true;
- default:
- break;
- }
- break;
- default:
- break;
- }
+ if (spec[i] != 0) {
+ Common::Rect r(bounds.left + i, bounds.top + i, bounds.right - i, bounds.bottom - i);
+ drawRect1(r, kColorBlack, _wm->getDrawPixel(), &pd);
}
+}
- if (_needsRedraw)
- paint();
+void MacDialog::start() {
+ _r = Common::Rect(_bbox);
- g_system->updateScreen();
- g_system->delayMillis(50);
- }
+ _tempSurface.copyRectToSurface(_screen->getBasePtr(_bbox.left, _bbox.top), _screen->pitch, 0, 0, _bbox.width() + 1, _bbox.height() + 1);
+ _wm->pushCursor(kMacCursorArrow, nullptr);
+}
- _gui->_screen.copyRectToSurface(_tempSurface.getBasePtr(0, 0), _tempSurface.pitch, _bbox.left, _bbox.top, _bbox.width() + 1, _bbox.height() + 1);
- g_system->copyRectToScreen(_gui->_screen.getBasePtr(r.left, r.top), _gui->_screen.pitch, r.left, r.top, r.width() + 1, r.height() + 1);
+int MacDialog::stop() {
+ _screen->copyRectToSurface(_tempSurface.getBasePtr(0, 0), _tempSurface.pitch, _bbox.left, _bbox.top, _bbox.width() + 1, _bbox.height() + 1);
+ g_system->copyRectToScreen(_screen->getBasePtr(_r.left, _r.top), _screen->pitch, _r.left, _r.top, _r.width() + 1, _r.height() + 1);
- _gui->_wm->popCursor();
+ _wm->popCursor();
return _pressedButton;
}
diff --git a/graphics/macgui/macdialog.h b/graphics/macgui/macdialog.h
index 76add790a11..2e913d3ba4d 100644
--- a/graphics/macgui/macdialog.h
+++ b/graphics/macgui/macdialog.h
@@ -53,13 +53,10 @@
#include "graphics/managed_surface.h"
#include "graphics/font.h"
-namespace Wage {
-class Gui;
-}
-
namespace Graphics {
class MacText;
+class MacWindowManager;
struct MacDialogButton {
Common::String text;
@@ -78,29 +75,35 @@ typedef Common::Array<MacDialogButton *> MacDialogButtonArray;
class MacDialog {
public:
- MacDialog(Wage::Gui *gui, int width, MacText *mactext, int maxTextWidth, MacDialogButtonArray *buttons, uint defaultButton);
+ MacDialog(ManagedSurface *screen, MacWindowManager *wm, int width, MacText *mactext, int maxTextWidth, MacDialogButtonArray *buttons, uint defaultButton);
~MacDialog();
- int run();
+ void start();
+ int stop();
private:
- Wage::Gui *_gui;
+ ManagedSurface *_screen;
+ MacWindowManager *_wm;
ManagedSurface _tempSurface;
Common::Rect _bbox;
+ Common::Rect _r;
MacText *_mactext;
int _maxTextWidth;
const Font *_font;
MacDialogButtonArray *_buttons;
- int _pressedButton;
uint _defaultButton;
bool _mouseOverPressedButton;
+public:
+ int _pressedButton;
bool _needsRedraw;
private:
const Font *getDialogFont();
void drawOutline(Common::Rect &bounds, int *spec, int speclen);
+
+public:
void paint();
void mouseMove(int x, int y);
void mouseClick(int x, int y);
Commit: f0894c277e3920829431a5c7215aa64ce0c7698f
https://github.com/scummvm/scummvm/commit/f0894c277e3920829431a5c7215aa64ce0c7698f
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Fix cropped graphics in Intro to Gothic
Changed paths:
engines/wage/entities.cpp
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index 40046ec657f..39a45f7f979 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -206,7 +206,16 @@ Obj::Obj(Common::String name, Common::SeekableReadStream *data, int resourceId)
_design = new Design(data);
- setDesignBounds(readRect(data));
+ // WORKAROUND: Intro to Gothic has wrong design bounds for a button
+ if (name == "go" && resourceId == 27613) {
+ int y1 = data->readSint16BE() - 2;
+ int x1 = data->readSint16BE() - 2;
+ int y2 = data->readSint16BE() + 2;
+ int x2 = data->readSint16BE() + 2;
+ setDesignBounds(new Common::Rect(x1, y1, x2 + 50, y2));
+ }
+ else
+ setDesignBounds(readRect(data));
int16 namePlural = data->readSint16BE();
Commit: e1c1413222d8a549a06d392ca0502816baaa1983
https://github.com/scummvm/scummvm/commit/e1c1413222d8a549a06d392ca0502816baaa1983
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Fix buttons in Explorer
Changed paths:
engines/wage/design.cpp
engines/wage/design.h
engines/wage/entities.cpp
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 8a9b9d96791..5ca71ff8dec 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -194,6 +194,24 @@ bool Design::isPointOpaque(int x, int y) {
return pixel != kColorGreen;
}
+bool Design::isInBounds(int x, int y) {
+ if (_surface == NULL)
+ error("Surface is null");
+
+ Common::MemoryReadStream in(_data, _len);
+ in.skip(4);
+
+ int16 y1 = in.readSint16BE();
+ int16 x1 = in.readSint16BE();
+ int16 y2 = in.readSint16BE() - 1;
+ int16 x2 = in.readSint16BE() - 1;
+
+ if (x >= x1 && x < x2 && y >= y1 && y < y2)
+ return true;
+ else
+ return false;
+}
+
void Design::adjustBounds(int16 x, int16 y) {
_bounds->right = MAX(x, _bounds->right);
_bounds->bottom = MAX(y, _bounds->bottom);
diff --git a/engines/wage/design.h b/engines/wage/design.h
index ad755b4bc2b..6b06b866de1 100644
--- a/engines/wage/design.h
+++ b/engines/wage/design.h
@@ -74,6 +74,7 @@ public:
void paint(Graphics::ManagedSurface *canvas, Graphics::MacPatterns &patterns, int x, int y);
bool isPointOpaque(int x, int y);
+ bool isInBounds(int x, int y);
static void drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
static void drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
static void drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Graphics::MacPatterns &patterns, byte fillType);
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index 39a45f7f979..54672ff2fc0 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -159,6 +159,13 @@ void Scene::paint(Graphics::ManagedSurface *surface, int x, int y) {
Designed *Scene::lookUpEntity(int x, int y) {
for (ObjList::const_iterator it = _objs.end(); it != _objs.begin(); ) {
it--;
+ // WORKAROUND: Some games don't draw all pixels
+ if (_name == " Introduction" && _resourceId == 18634 ||
+ _name == " Descriptions" && _resourceId == 17079 ||
+ _name == " Descriptions 2" && _resourceId == 17198)
+ if ((*it)->_design->isInBounds(x, y))
+ return *it;
+
// WORKAROUND: Some games draw objects on a different surface
if (((*it)->_name == "continue" && (*it)->_resourceId == 22259) ||
((*it)->_name == "Goth" && (*it)->_resourceId == 18623))
Commit: fe7aa6eefda4832b4bfdbbb08491da94a75a1a68
https://github.com/scummvm/scummvm/commit/fe7aa6eefda4832b4bfdbbb08491da94a75a1a68
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Update detection table
Changed paths:
engines/wage/detection_tables.h
diff --git a/engines/wage/detection_tables.h b/engines/wage/detection_tables.h
index 4237ed78eec..67270fe9292 100644
--- a/engines/wage/detection_tables.h
+++ b/engines/wage/detection_tables.h
@@ -115,7 +115,6 @@ static const ADGameDescription gameDescriptions[] = {
FANGAME("EveryMan 1", "9104b23c8978c7db118bb60fb5f8bf0f", 335435), // alt version
FANGAME("EveryMan 1", "829aabea15e143f20fe692f0bc38e56a", 335444), // alt version
FANGAME("Exploration Zeta!", "9006eff549afadc956e5de4ae6a24fbd", 366343),
- // Cannot proceed past the first scene
FANGAMEND("Explorer", "Explorer DEMO", "0ae79f48754466c4cd65137c7f186384", 460972),
FANGAMEND("Explorer", "Explorer DEMO", "6b22972808630201ece7cc96a0ef17f7", 460959), // alt version
FANGAME("Fantasy Quest", "b52d3e2680a76c23b2791e2c87f6b6bd", 762498),
@@ -139,7 +138,6 @@ static const ADGameDescription gameDescriptions[] = {
FANGAMEN("The Hotel Caper", "The Hotel Caper V1.0", "baaaae4569fbb1947d74667ac484bea9", 231773), // alt version
FANGAMEN("The Hotel Caper", "Hotel Caper V1.0", "138e89e5d5bcac6aba222cf33677bcec", 231127),
FANGAMEN(".i.f.", "xn--.i.f.-", "575fc0c25e9823dd742de1acdcaac325", 183221),
- // Cropped graphics on first scene, cannot pass to in-game
FANGAMEN("Introduction to Gothic", "Intro to Gothic", "606eec666f0b2d767e4423747e740434", 207811),
FANGAMEN("James Bond 007", "007", "2449924f2cb43454489a4ef91c0ee702", 50407),
FANGAME("Jamie the Demon Slayer", "ed054aa760569059c7ea554e822089a6", 232533),
@@ -175,7 +173,6 @@ static const ADGameDescription gameDescriptions[] = {
FANGAMEN("Mountain of Mayhem", "xn--Mountain of Mayhem -3g6k", "634211b004371635d191ae0687035501", 749747), // Original file name "Mountain of Mayhem â "
FANGAME("Mountain of Mayhem", "c83a5703b3ea95f465839f4f54ef0805", 749733), // alt version
FANGAME("Muddy Water", "711dd9d154d13c31bc216ef8539bb095", 662438), // v1.3.2
- // No way to pass through the first screen
FANGAME("Nightcrawler Ned", "8423fc015c395bd6be54a7ea69170d99", 366286),
FANGAMEN("Parrot Talk", "PARROT TALK V1", "c38c090be8c078d931905c93bc0689f5", 118680),
FANGAMEN("Parrot Talk", "PARROT TALKV2", "5ec1df9e2d6d0dcf1a040a95500d9551", 118628),
Commit: 0824d1ad582d165c9eb9078f4262172afa3f33a3
https://github.com/scummvm/scummvm/commit/0824d1ad582d165c9eb9078f4262172afa3f33a3
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Use bounding box for click detection
Changed paths:
engines/wage/design.cpp
engines/wage/design.h
engines/wage/detection_tables.h
engines/wage/entities.cpp
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 5ca71ff8dec..19f85248b74 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -185,21 +185,18 @@ void Design::render(Graphics::MacPatterns &patterns) {
}
}
-bool Design::isPointOpaque(int x, int y) {
- if (_surface == NULL)
- error("Surface is null");
-
- byte pixel = ((byte *)_surface->getBasePtr(x, y))[0];
-
- return pixel != kColorGreen;
-}
-
bool Design::isInBounds(int x, int y) {
if (_surface == NULL)
error("Surface is null");
+ if (_len == 0)
+ return true;
Common::MemoryReadStream in(_data, _len);
- in.skip(4);
+ in.skip(3);
+ int type = in.readByte();
+
+ if (type == 24)
+ in.skip(2);
int16 y1 = in.readSint16BE();
int16 x1 = in.readSint16BE();
diff --git a/engines/wage/design.h b/engines/wage/design.h
index 6b06b866de1..a202f503c95 100644
--- a/engines/wage/design.h
+++ b/engines/wage/design.h
@@ -73,7 +73,6 @@ public:
}
void paint(Graphics::ManagedSurface *canvas, Graphics::MacPatterns &patterns, int x, int y);
- bool isPointOpaque(int x, int y);
bool isInBounds(int x, int y);
static void drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
static void drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
diff --git a/engines/wage/detection_tables.h b/engines/wage/detection_tables.h
index 67270fe9292..7cb81bf39d4 100644
--- a/engines/wage/detection_tables.h
+++ b/engines/wage/detection_tables.h
@@ -183,7 +183,6 @@ static const ADGameDescription gameDescriptions[] = {
FANGAME("Periapt", "bc36e40de279d5f0844577fe702d9f64", 405750), // alt version
FANGAME("Periapt", "661642865321fa81ce84ae2eedbc1aff", 405736), // alt version
FANGAME("The Phoenix", "bd6dabf7a19d2ab7902498a8513f8c71", 431387),
- // Cannot push buttons
FANGAMEN("The Phoenix v1.2", "The Phoenix", "fee9f1de7ad9096d084461d6066192b1", 431384),
FANGAME("Pirate Attack!", "d4d3f59b57d5bf3dd690fd657ecdd9c6", 323722),
FANGAME("Porno Writer", "9d521bf40f6824228266923774aadfea", 467342),
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index 54672ff2fc0..aa260b5bbaa 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -159,29 +159,13 @@ void Scene::paint(Graphics::ManagedSurface *surface, int x, int y) {
Designed *Scene::lookUpEntity(int x, int y) {
for (ObjList::const_iterator it = _objs.end(); it != _objs.begin(); ) {
it--;
- // WORKAROUND: Some games don't draw all pixels
- if (_name == " Introduction" && _resourceId == 18634 ||
- _name == " Descriptions" && _resourceId == 17079 ||
- _name == " Descriptions 2" && _resourceId == 17198)
- if ((*it)->_design->isInBounds(x, y))
- return *it;
-
- // WORKAROUND: Some games draw objects on a different surface
- if (((*it)->_name == "continue" && (*it)->_resourceId == 22259) ||
- ((*it)->_name == "Goth" && (*it)->_resourceId == 18623))
- if (_design->isPointOpaque(x, y))
- return *it;
-
- // WORKAROUND: Twister needs special check to handle intro sequence
- if ((*it)->_name == "TWIST.CLICK")
- return *it;
- if ((*it)->_design->isPointOpaque(x, y))
+ if ((*it)->_design->isInBounds(x, y))
return *it;
}
for (ChrList::const_iterator it = _chrs.end(); it != _chrs.begin(); ) {
it--;
- if ((*it)->_design->isPointOpaque(x, y))
+ if ((*it)->_design->isInBounds(x, y))
return *it;
}
Commit: 83f8eb7b19bdb1731387a196b84fdf4507cecec8
https://github.com/scummvm/scummvm/commit/83f8eb7b19bdb1731387a196b84fdf4507cecec8
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Rewrite object detection
Changed paths:
engines/wage/design.cpp
engines/wage/design.h
engines/wage/entities.cpp
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 19f85248b74..20e1eab04a8 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -72,7 +72,8 @@ Design::Design(Common::SeekableReadStream *data) {
data->read(_data, _len);
_surface = NULL;
- _bounds = NULL;
+ _bounds = new Common::Rect();
+ _maskImage = nullptr;
_boundsCalculationMode = false;
}
@@ -82,6 +83,8 @@ Design::~Design() {
if (_surface)
_surface->free();
delete _surface;
+ delete _bounds;
+ delete _maskImage;
}
void Design::paint(Graphics::ManagedSurface *surface, Graphics::MacPatterns &patterns, int x, int y) {
@@ -98,7 +101,7 @@ void Design::paint(Graphics::ManagedSurface *surface, Graphics::MacPatterns &pat
_bounds->debugPrint(4, "Calculated bounds:");
_surface = new Graphics::ManagedSurface;
- _surface->create(_bounds->width(), _bounds->height(), Graphics::PixelFormat::createFormatCLUT8());
+ _surface->create(_bounds->width() + 1, _bounds->height(), Graphics::PixelFormat::createFormatCLUT8());
_surface->clear(kColorGreen);
@@ -188,25 +191,13 @@ void Design::render(Graphics::MacPatterns &patterns) {
bool Design::isInBounds(int x, int y) {
if (_surface == NULL)
error("Surface is null");
- if (_len == 0)
- return true;
-
- Common::MemoryReadStream in(_data, _len);
- in.skip(3);
- int type = in.readByte();
-
- if (type == 24)
- in.skip(2);
-
- int16 y1 = in.readSint16BE();
- int16 x1 = in.readSint16BE();
- int16 y2 = in.readSint16BE() - 1;
- int16 x2 = in.readSint16BE() - 1;
-
- if (x >= x1 && x < x2 && y >= y1 && y < y2)
- return true;
- else
+ if (_maskImage == nullptr)
return false;
+ if (x > _maskImage->w || y > _maskImage->h)
+ return false;
+
+ byte pixel = ((byte *)_maskImage->getBasePtr(x, y))[0];
+ return pixel != kColorGreen;
}
void Design::adjustBounds(int16 x, int16 y) {
@@ -340,6 +331,21 @@ void Design::drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
if (y1 > y2)
SWAP(y1, y2);
+ if (_boundsCalculationMode) {
+ _bounds->top = MIN(y1, _bounds->top);
+ _bounds->left = MIN(x1, _bounds->left);
+ _bounds->right = MAX(x2, _bounds->right);
+ _bounds->bottom = MAX(y2, _bounds->bottom);
+ }
+
+ if (_surface) {
+ if (!_maskImage) {
+ _maskImage = new Graphics::ManagedSurface(_surface->w, _surface->h);
+ _maskImage->clear(kColorGreen);
+ }
+ _maskImage->fillRect(Common::Rect(x1, y1, x2, y2), kColorBlack);
+ }
+
Common::Rect r(x1, y1, x2, y2);
PlotData pd(surface, &patterns, fillType, 1, this);
@@ -377,6 +383,14 @@ void Design::drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream
if (y1 > y2)
SWAP(y1, y2);
+ if (_surface) {
+ if (!_maskImage) {
+ _maskImage = new Graphics::ManagedSurface(_surface->w, _surface->h);
+ _maskImage->clear(kColorGreen);
+ }
+ _maskImage->fillRect(Common::Rect(x1, y1, x2, y2), kColorBlack);
+ }
+
if (borderThickness > 1) {
x1 += borderThickness / 2;
y1 += borderThickness / 2;
@@ -412,6 +426,14 @@ void Design::drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &
int16 bx2 = in.readSint16BE();
Common::Rect bbox(bx1, by1, bx2, by2);
+ if (_surface) {
+ if (!_maskImage) {
+ _maskImage = new Graphics::ManagedSurface(_surface->w, _surface->h);
+ _maskImage->clear(kColorGreen);
+ }
+ _maskImage->fillRect(Common::Rect(bx1, by1, bx2, by2), kColorBlack);
+ }
+
numBytes -= 8;
int y1 = in.readSint16BE();
@@ -489,6 +511,14 @@ void Design::drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in,
int16 x2 = in.readSint16BE();
PlotData pd(surface, &patterns, fillType, 1, this);
+ if (_surface) {
+ if (!_maskImage) {
+ _maskImage = new Graphics::ManagedSurface(_surface->w, _surface->h);
+ _maskImage->clear(kColorGreen);
+ }
+ _maskImage->fillRect(Common::Rect(x1, y1, x2, y2), kColorBlack);
+ }
+
if (fillType <= patterns.size())
Graphics::drawEllipse(x1, y1, x2-1, y2-1, kColorBlack, true, drawPixel, &pd);
@@ -514,6 +544,14 @@ void Design::drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadS
int x2 = in.readSint16BE();
int w = x2 - x1;
int h = y2 - y1;
+
+ if (_surface) {
+ if (!_maskImage) {
+ _maskImage = new Graphics::ManagedSurface(_surface->w, _surface->h);
+ _maskImage->clear(kColorGreen);
+ }
+ }
+
Graphics::Surface tmp;
tmp.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
@@ -586,11 +624,15 @@ void Design::drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadS
for (; y < h && y1 + y < surface->h; y++) {
byte *src = (byte *)tmp.getBasePtr(0, y);
byte *dst = (byte *)surface->getBasePtr(x1, y1 + y);
+ byte *mask = (byte *)_maskImage->getBasePtr(x1, y1 + y);
for (x = 0; x < w; x++) {
- if (*src != kColorGreen)
+ if (*src != kColorGreen) {
*dst = *src;
+ *mask = kColorBlack;
+ }
src++;
dst++;
+ mask++;
}
}
}
diff --git a/engines/wage/design.h b/engines/wage/design.h
index a202f503c95..62cc48ae8ea 100644
--- a/engines/wage/design.h
+++ b/engines/wage/design.h
@@ -90,6 +90,7 @@ private:
Common::Rect *_bounds;
Graphics::ManagedSurface *_surface;
bool _boundsCalculationMode;
+ Graphics::ManagedSurface *_maskImage;
private:
void render(Graphics::MacPatterns &patterns);
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index aa260b5bbaa..35930e65610 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -59,7 +59,6 @@ namespace Wage {
void Designed::setDesignBounds(Common::Rect *bounds) {
_designBounds = bounds;
- _design->setBounds(bounds);
}
Designed::~Designed() {
@@ -197,16 +196,7 @@ Obj::Obj(Common::String name, Common::SeekableReadStream *data, int resourceId)
_design = new Design(data);
- // WORKAROUND: Intro to Gothic has wrong design bounds for a button
- if (name == "go" && resourceId == 27613) {
- int y1 = data->readSint16BE() - 2;
- int x1 = data->readSint16BE() - 2;
- int y2 = data->readSint16BE() + 2;
- int x2 = data->readSint16BE() + 2;
- setDesignBounds(new Common::Rect(x1, y1, x2 + 50, y2));
- }
- else
- setDesignBounds(readRect(data));
+ setDesignBounds(readRect(data));
int16 namePlural = data->readSint16BE();
Commit: 223258af81f87130343ad9491f557cac7fddeabc
https://github.com/scummvm/scummvm/commit/223258af81f87130343ad9491f557cac7fddeabc
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Better error message in isInBounds()
Changed paths:
engines/wage/design.cpp
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 20e1eab04a8..781064bb8a0 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -190,7 +190,7 @@ void Design::render(Graphics::MacPatterns &patterns) {
bool Design::isInBounds(int x, int y) {
if (_surface == NULL)
- error("Surface is null");
+ error("Design::isInBounds(): Surface is null");
if (_maskImage == nullptr)
return false;
if (x > _maskImage->w || y > _maskImage->h)
Commit: 033bc00cd105fbd1b6705bc5b2c87f5658682448
https://github.com/scummvm/scummvm/commit/033bc00cd105fbd1b6705bc5b2c87f5658682448
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Poll events in MacDialog itself
Changed paths:
engines/wage/wage.cpp
engines/wage/wage.h
graphics/macgui/macdialog.cpp
graphics/macgui/macdialog.h
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 24c980a4fb7..80bc5ec3fe6 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -215,48 +215,6 @@ void WageEngine::appendText(const char *str) {
_inputText.clear();
}
-void WageEngine::pollDialogEvents(Graphics::MacDialog &dialog) {
- bool shouldQuit = false;
- while (!shouldQuit) {
- Common::Event event;
-
- while (_gui->_engine->pollEvent(event)) {
- switch (event.type) {
- case Common::EVENT_QUIT:
- _gui->_engine->_shouldQuit = true;
- shouldQuit = true;
- break;
- case Common::EVENT_MOUSEMOVE:
- dialog.mouseMove(event.mouse.x, event.mouse.y);
- break;
- case Common::EVENT_LBUTTONDOWN:
- dialog.mouseClick(event.mouse.x, event.mouse.y);
- break;
- case Common::EVENT_LBUTTONUP:
- shouldQuit = dialog.mouseRaise(event.mouse.x, event.mouse.y);
- break;
- case Common::EVENT_KEYDOWN:
- switch (event.kbd.keycode) {
- case Common::KEYCODE_ESCAPE:
- dialog._pressedButton = -1;
- shouldQuit = true;
- default:
- break;
- }
- break;
- default:
- break;
- }
- }
-
- if (dialog._needsRedraw)
- dialog.paint();
-
- g_system->updateScreen();
- g_system->delayMillis(50);
- }
-}
-
void WageEngine::gameOver() {
Graphics::MacDialogButtonArray buttons;
@@ -269,9 +227,7 @@ void WageEngine::gameOver() {
Graphics::MacDialog gameOverDialog(&_gui->_screen, _gui->_wm, 199, &gameOverMessage, 199, &buttons, 0);
- gameOverDialog.start();
- pollDialogEvents(gameOverDialog);
- gameOverDialog.stop();
+ gameOverDialog.run();
doClose();
@@ -293,9 +249,7 @@ bool WageEngine::saveDialog() {
Graphics::MacDialog save(&_gui->_screen, _gui->_wm, 291, &saveBeforeCloseMessage, 291, &buttons, 1);
- save.start();
- pollDialogEvents(save);
- int button = save.stop();
+ int button = save.run();
if (button == 2) // Cancel
return false;
@@ -322,9 +276,7 @@ void WageEngine::aboutDialog() {
Graphics::MacDialog about(&_gui->_screen, _gui->_wm, 450, &aboutMessage, 400, &buttons, 0);
- about.start();
- pollDialogEvents(about);
- about.stop();
+ about.run();
}
void WageEngine::saveGame() {
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 511c5efcf52..b16ce0656fc 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -209,7 +209,6 @@ public:
void playSound(Common::String soundName);
void setMenu(Common::String soundName);
void appendText(const char *str);
- void pollDialogEvents(Graphics::MacDialog &dialog);
void gameOver();
bool saveDialog();
void aboutDialog();
diff --git a/graphics/macgui/macdialog.cpp b/graphics/macgui/macdialog.cpp
index 8b38e6edcdc..48ab65ab41c 100644
--- a/graphics/macgui/macdialog.cpp
+++ b/graphics/macgui/macdialog.cpp
@@ -145,16 +145,54 @@ void MacDialog::drawOutline(Common::Rect &bounds, int *spec, int speclen) {
}
}
-void MacDialog::start() {
- _r = Common::Rect(_bbox);
+int MacDialog::run() {
+ bool shouldQuit = false;
+ Common::Rect r(_bbox);
_tempSurface.copyRectToSurface(_screen->getBasePtr(_bbox.left, _bbox.top), _screen->pitch, 0, 0, _bbox.width() + 1, _bbox.height() + 1);
_wm->pushCursor(kMacCursorArrow, nullptr);
-}
-int MacDialog::stop() {
+ while (!shouldQuit) {
+ Common::Event event;
+
+ while (g_system->getEventManager()->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_QUIT:
+ //_shouldQuit = true;
+ shouldQuit = true;
+ break;
+ case Common::EVENT_MOUSEMOVE:
+ mouseMove(event.mouse.x, event.mouse.y);
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ mouseClick(event.mouse.x, event.mouse.y);
+ break;
+ case Common::EVENT_LBUTTONUP:
+ shouldQuit = mouseRaise(event.mouse.x, event.mouse.y);
+ break;
+ case Common::EVENT_KEYDOWN:
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
+ _pressedButton = -1;
+ shouldQuit = true;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (_needsRedraw)
+ paint();
+
+ g_system->updateScreen();
+ g_system->delayMillis(50);
+ }
+
_screen->copyRectToSurface(_tempSurface.getBasePtr(0, 0), _tempSurface.pitch, _bbox.left, _bbox.top, _bbox.width() + 1, _bbox.height() + 1);
- g_system->copyRectToScreen(_screen->getBasePtr(_r.left, _r.top), _screen->pitch, _r.left, _r.top, _r.width() + 1, _r.height() + 1);
+ g_system->copyRectToScreen(_screen->getBasePtr(r.left, r.top), _screen->pitch, r.left, r.top, r.width() + 1, r.height() + 1);
_wm->popCursor();
diff --git a/graphics/macgui/macdialog.h b/graphics/macgui/macdialog.h
index 2e913d3ba4d..a46c0dba444 100644
--- a/graphics/macgui/macdialog.h
+++ b/graphics/macgui/macdialog.h
@@ -78,8 +78,7 @@ public:
MacDialog(ManagedSurface *screen, MacWindowManager *wm, int width, MacText *mactext, int maxTextWidth, MacDialogButtonArray *buttons, uint defaultButton);
~MacDialog();
- void start();
- int stop();
+ int run();
private:
ManagedSurface *_screen;
Commit: eac2717abbea9f6ed222481323c4fca433a9ef29
https://github.com/scummvm/scummvm/commit/eac2717abbea9f6ed222481323c4fca433a9ef29
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Move getFeatures() to metaengine.cpp
Changed paths:
engines/wage/metaengine.cpp
engines/wage/wage.cpp
diff --git a/engines/wage/metaengine.cpp b/engines/wage/metaengine.cpp
index 25b592cc0ab..0dc7f3964f1 100644
--- a/engines/wage/metaengine.cpp
+++ b/engines/wage/metaengine.cpp
@@ -29,6 +29,10 @@
#include "wage/wage.h"
namespace Wage {
+
+uint32 WageEngine::getFeatures() {
+ return _gameDescription->flags;
+}
const char *WageEngine::getGameFile() const {
return _gameDescription->filesDescriptions[0].fileName;
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 80bc5ec3fe6..794217b39ba 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -53,7 +53,6 @@
#include "engines/engine.h"
#include "engines/util.h"
-#include "engines/advancedDetector.h"
#include "graphics/macgui/macdialog.h"
@@ -283,10 +282,6 @@ void WageEngine::saveGame() {
warning("STUB: saveGame()");
}
-uint32 WageEngine::getFeatures() {
- return _gameDescription->flags;
-}
-
void WageEngine::performInitialSetup() {
debug(5, "Resetting Objs: %d", _world->_orderedObjs.size());
for (uint i = 0; i < _world->_orderedObjs.size() - 1; i++)
Commit: f9fd3b699c3155173391089f5fa086ce9c8745b1
https://github.com/scummvm/scummvm/commit/f9fd3b699c3155173391089f5fa086ce9c8745b1
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
WAGE: Move pollEvent's definition to wage.cpp
Changed paths:
engines/wage/wage.cpp
engines/wage/wage.h
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 794217b39ba..2f17f55382c 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -100,6 +100,10 @@ WageEngine::~WageEngine() {
delete _rnd;
}
+bool WageEngine::pollEvent(Common::Event &event) {
+ return _eventMan->pollEvent(event);
+}
+
Common::Error WageEngine::run() {
debug("WageEngine::init");
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index b16ce0656fc..e4d8d5c98a3 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -54,12 +54,15 @@
#include "common/rect.h"
#include "common/macresman.h"
#include "common/random.h"
-#include "common/events.h"
#include "wage/debugger.h"
struct ADGameDescription;
+namespace Common {
+class Event;
+}
+
namespace Graphics {
class MacDialog;
}
@@ -137,7 +140,7 @@ public:
void regen();
const char *getTargetName() { return _targetName.c_str(); }
- bool pollEvent(Common::Event &event) { return _eventMan->pollEvent(event); }
+ bool pollEvent(Common::Event &event);
private:
bool loadWorld(Common::MacResManager *resMan);
Commit: 1ad34487eedb7713c89ab8ac3259a04622a29c1f
https://github.com/scummvm/scummvm/commit/1ad34487eedb7713c89ab8ac3259a04622a29c1f
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Remove unnecessary headers from macdialog.h
Changed paths:
graphics/macgui/macdialog.cpp
graphics/macgui/macdialog.h
diff --git a/graphics/macgui/macdialog.cpp b/graphics/macgui/macdialog.cpp
index 48ab65ab41c..91a67d313d7 100644
--- a/graphics/macgui/macdialog.cpp
+++ b/graphics/macgui/macdialog.cpp
@@ -47,6 +47,8 @@
#include "common/events.h"
#include "common/system.h"
+#include "graphics/font.h"
+#include "graphics/managed_surface.h"
#include "graphics/primitives.h"
#include "graphics/macgui/mactext.h"
@@ -67,7 +69,8 @@ MacDialog::MacDialog(ManagedSurface *screen, MacWindowManager *wm, int width, Ma
_font = getDialogFont();
- _tempSurface.create(width + 1, height + 1, Graphics::PixelFormat::createFormatCLUT8());
+ _tempSurface = new ManagedSurface();
+ _tempSurface->create(width + 1, height + 1, Graphics::PixelFormat::createFormatCLUT8());
_bbox.left = (_screen->w - width) / 2;
_bbox.top = (_screen->h - height) / 2;
@@ -88,6 +91,7 @@ MacDialog::MacDialog(ManagedSurface *screen, MacWindowManager *wm, int width, Ma
MacDialog::~MacDialog() {
for (uint i = 0; i < _buttons->size(); i++)
delete _buttons->operator[](i);
+ delete _tempSurface;
}
const Graphics::Font *MacDialog::getDialogFont() {
@@ -95,7 +99,7 @@ const Graphics::Font *MacDialog::getDialogFont() {
}
void MacDialog::paint() {
- MacPlotData pd(_screen, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorBlack, false);
+ MacPlotData pd(_screen, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorBlack, false);
drawFilledRect1(_bbox, kColorWhite, _wm->getDrawPixel(), &pd);
_mactext->drawToPoint(_screen, Common::Point(_bbox.left + (_bbox.width() - _maxTextWidth)/2, _bbox.top + 16));
static int boxOutline[] = {1, 0, 0, 1, 1};
@@ -149,7 +153,7 @@ int MacDialog::run() {
bool shouldQuit = false;
Common::Rect r(_bbox);
- _tempSurface.copyRectToSurface(_screen->getBasePtr(_bbox.left, _bbox.top), _screen->pitch, 0, 0, _bbox.width() + 1, _bbox.height() + 1);
+ _tempSurface->copyRectToSurface(_screen->getBasePtr(_bbox.left, _bbox.top), _screen->pitch, 0, 0, _bbox.width() + 1, _bbox.height() + 1);
_wm->pushCursor(kMacCursorArrow, nullptr);
while (!shouldQuit) {
@@ -191,7 +195,7 @@ int MacDialog::run() {
g_system->delayMillis(50);
}
- _screen->copyRectToSurface(_tempSurface.getBasePtr(0, 0), _tempSurface.pitch, _bbox.left, _bbox.top, _bbox.width() + 1, _bbox.height() + 1);
+ _screen->copyRectToSurface(_tempSurface->getBasePtr(0, 0), _tempSurface->pitch, _bbox.left, _bbox.top, _bbox.width() + 1, _bbox.height() + 1);
g_system->copyRectToScreen(_screen->getBasePtr(r.left, r.top), _screen->pitch, r.left, r.top, r.width() + 1, r.height() + 1);
_wm->popCursor();
diff --git a/graphics/macgui/macdialog.h b/graphics/macgui/macdialog.h
index a46c0dba444..3c50b6d377f 100644
--- a/graphics/macgui/macdialog.h
+++ b/graphics/macgui/macdialog.h
@@ -50,11 +50,11 @@
#include "common/str.h"
#include "common/rect.h"
-#include "graphics/managed_surface.h"
-#include "graphics/font.h"
-
namespace Graphics {
+class Font;
+class ManagedSurface;
+
class MacText;
class MacWindowManager;
@@ -83,7 +83,7 @@ public:
private:
ManagedSurface *_screen;
MacWindowManager *_wm;
- ManagedSurface _tempSurface;
+ ManagedSurface *_tempSurface;
Common::Rect _bbox;
Common::Rect _r;
MacText *_mactext;
Commit: 4f3dc247e425445aa5c51f0604e5151d401cef76
https://github.com/scummvm/scummvm/commit/4f3dc247e425445aa5c51f0604e5151d401cef76
Author: Avijeet (am388488 at gmail.com)
Date: 2022-08-05T20:15:03+02:00
Commit Message:
GRAPHICS: MACGUI: Handle EVENT_QUIT properly in MacDialog
Changed paths:
engines/wage/wage.cpp
graphics/macgui/macdialog.cpp
graphics/macgui/macdialog.h
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 2f17f55382c..13837a1f53e 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -230,7 +230,10 @@ void WageEngine::gameOver() {
Graphics::MacDialog gameOverDialog(&_gui->_screen, _gui->_wm, 199, &gameOverMessage, 199, &buttons, 0);
- gameOverDialog.run();
+ int button = gameOverDialog.run();
+
+ if (button == Graphics::kMacDialogQuitRequested)
+ _shouldQuit = true;
doClose();
@@ -254,10 +257,11 @@ bool WageEngine::saveDialog() {
int button = save.run();
- if (button == 2) // Cancel
+ if (button == Graphics::kMacDialogQuitRequested)
+ _shouldQuit = true;
+ else if (button == 2) // Cancel
return false;
-
- if (button == 1)
+ else if (button == 1)
saveGame();
doClose();
@@ -279,7 +283,10 @@ void WageEngine::aboutDialog() {
Graphics::MacDialog about(&_gui->_screen, _gui->_wm, 450, &aboutMessage, 400, &buttons, 0);
- about.run();
+ int button = about.run();
+
+ if (button == Graphics::kMacDialogQuitRequested)
+ _shouldQuit = true;
}
void WageEngine::saveGame() {
diff --git a/graphics/macgui/macdialog.cpp b/graphics/macgui/macdialog.cpp
index 91a67d313d7..733a0c6d32f 100644
--- a/graphics/macgui/macdialog.cpp
+++ b/graphics/macgui/macdialog.cpp
@@ -150,6 +150,7 @@ void MacDialog::drawOutline(Common::Rect &bounds, int *spec, int speclen) {
}
int MacDialog::run() {
+ bool shouldQuitEngine = false;
bool shouldQuit = false;
Common::Rect r(_bbox);
@@ -162,7 +163,7 @@ int MacDialog::run() {
while (g_system->getEventManager()->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_QUIT:
- //_shouldQuit = true;
+ shouldQuitEngine = true;
shouldQuit = true;
break;
case Common::EVENT_MOUSEMOVE:
@@ -200,6 +201,9 @@ int MacDialog::run() {
_wm->popCursor();
+ if (shouldQuitEngine)
+ return kMacDialogQuitRequested;
+
return _pressedButton;
}
diff --git a/graphics/macgui/macdialog.h b/graphics/macgui/macdialog.h
index 3c50b6d377f..27d375f652f 100644
--- a/graphics/macgui/macdialog.h
+++ b/graphics/macgui/macdialog.h
@@ -58,6 +58,10 @@ class ManagedSurface;
class MacText;
class MacWindowManager;
+enum {
+ kMacDialogQuitRequested = -2
+};
+
struct MacDialogButton {
Common::String text;
Common::Rect bounds;
More information about the Scummvm-git-logs
mailing list