mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 05:01:43 +00:00
SCUMM: Clean up Mac GUI things, and plug a few memory leaks
I've also added hard-coded button corners for the smaller buttons. It's still a hack, but a useful one.
This commit is contained in:
parent
3ab70467c5
commit
26b5c50195
@ -1622,7 +1622,7 @@ CharsetRendererMac::CharsetRendererMac(ScummEngine *vm, const Common::String &fo
|
||||
const Graphics::Font *font = _vm->_macGui->getFontByScummId(0);
|
||||
|
||||
_glyphSurface = new Graphics::Surface();
|
||||
_glyphSurface->create(font->getFontHeight(), font->getMaxCharWidth(), Graphics::PixelFormat::createFormatCLUT8());
|
||||
_glyphSurface->create(font->getMaxCharWidth(), font->getFontHeight(), Graphics::PixelFormat::createFormatCLUT8());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1637,28 +1637,8 @@ void CharsetRendererMac::setCurID(int32 id) {
|
||||
if (id == -1)
|
||||
return;
|
||||
|
||||
_useRealCharWidth = (id & 0x80) != 0;
|
||||
id = id & 0x7F;
|
||||
|
||||
// Indiana Jones and the Last Crusade uses font id 1 in a number of
|
||||
// places. In the DOS version, this is a bolder font than font 0, but
|
||||
// by the looks of it the Mac version uses the same font for both
|
||||
// cases. In ScummVM, we match id 0 and 1 to font 0 and id 2 (which is
|
||||
// only used to print the text box caption) to font 1.
|
||||
if (_vm->_game.id == GID_INDY3) {
|
||||
if (id == 0 || id == 1) {
|
||||
id = 0;
|
||||
} else if (id == 2) {
|
||||
id = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (id < 0 || id > 1) {
|
||||
warning("CharsetRendererMac::setCurID(%d) - invalid charset", id);
|
||||
id = 0;
|
||||
}
|
||||
|
||||
_curId = id;
|
||||
_font = _vm->_macGui->getFontByScummId(_curId);
|
||||
}
|
||||
|
||||
int CharsetRendererMac::getStringWidth(int arg, const byte *text) {
|
||||
@ -1683,36 +1663,20 @@ int CharsetRendererMac::getStringWidth(int arg, const byte *text) {
|
||||
}
|
||||
|
||||
int CharsetRendererMac::getDrawWidthIntern(uint16 chr) const {
|
||||
const Graphics::Font *font = _vm->_macGui->getFontByScummId(_curId);
|
||||
|
||||
return font->getCharWidth(chr);
|
||||
return _font->getCharWidth(chr);
|
||||
}
|
||||
|
||||
// HACK: Usually, we want the approximate width and height in the unscaled
|
||||
// graphics resolution. But for font 1 in Indiana Jones and the Last
|
||||
// crusade we want the actual dimensions for drawing the text boxes.
|
||||
|
||||
int CharsetRendererMac::getFontHeight() const {
|
||||
const Graphics::Font *font = _vm->_macGui->getFontByScummId(_curId);
|
||||
int height = font->getFontHeight();
|
||||
|
||||
// If we ever need the height for font 1 in Last Crusade (we don't at
|
||||
// the moment), we need the actual height.
|
||||
if (_curId == 0 || _vm->_game.id != GID_INDY3)
|
||||
height /= 2;
|
||||
|
||||
return height;
|
||||
return _font->getFontHeight() / 2;
|
||||
}
|
||||
|
||||
int CharsetRendererMac::getCharWidth(uint16 chr) const {
|
||||
int width = getDrawWidthIntern(chr);
|
||||
return _useRealCharWidth ? width : width / 2;
|
||||
return _font->getCharWidth(chr) / 2;
|
||||
}
|
||||
|
||||
void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
|
||||
// This function does most of the heavy lifting printing the game
|
||||
// text. It's the only function that needs to be able to handle
|
||||
// disabled text.
|
||||
// text.
|
||||
|
||||
// If this is the beginning of a line, assume the position will be
|
||||
// correct without any padding.
|
||||
@ -1761,17 +1725,17 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
|
||||
if ((chr >= 16 && chr <= 23) || chr == 60 || chr == 95) {
|
||||
enableShadow = true;
|
||||
}
|
||||
}
|
||||
|
||||
// HACK: Apparently, note names are never drawn in light gray. Only
|
||||
// white for known notes, and dark gray for unknown ones. This
|
||||
// hack ensures that we won't be left with a mix of white and
|
||||
// light gray note names, because apparently the game never
|
||||
// changes them back to light gray once the draft is done?
|
||||
// HACK: Apparently, note names are never drawn in light gray.
|
||||
// Only white for known notes, and dark gray for unknown ones.
|
||||
// This hack ensures that we won't be left with a mix of white
|
||||
// and light gray note names, because apparently the game never
|
||||
// changes them back to light gray once the draft is done?
|
||||
|
||||
if (_vm->_game.id == GID_LOOM) {
|
||||
if (chr >= 16 && chr <= 23 && _color == 7)
|
||||
color = 15;
|
||||
if (_vm->_game.id == GID_LOOM) {
|
||||
if (chr >= 16 && chr <= 23 && _color == 7)
|
||||
color = 15;
|
||||
}
|
||||
}
|
||||
|
||||
bool drawToTextBox = (vs->number == kTextVirtScreen && _vm->_game.id == GID_INDY3);
|
||||
@ -1789,9 +1753,6 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
|
||||
// redrawn along with its name. It's enough to redraw it on the
|
||||
// text surface. We can assume the correct color is already on
|
||||
// screen.
|
||||
//
|
||||
// Note that this will not affect the Practice Mode box, since
|
||||
// this note names are drawn by drawChar(), not printChar().
|
||||
|
||||
if (_vm->_game.id == GID_LOOM) {
|
||||
if (chr >= 16 && chr <= 23) {
|
||||
@ -1817,18 +1778,16 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) {
|
||||
if (!_useCorrectFontSpacing && !drawToTextBox && (width & 1))
|
||||
width++;
|
||||
|
||||
const Graphics::Font *font = _vm->_macGui->getFontByScummId(_curId);
|
||||
|
||||
if (enableShadow) {
|
||||
left = macLeft / 2;
|
||||
right = (macLeft + width + 3) / 2;
|
||||
top = macTop / 2;
|
||||
bottom = (macTop + font->getFontHeight() + 3) / 2;
|
||||
bottom = (macTop + _font->getFontHeight() + 3) / 2;
|
||||
} else {
|
||||
left = (macLeft + 1) / 2;
|
||||
right = (macLeft + width + 1) / 2;
|
||||
top = (macTop + 1) / 2;
|
||||
bottom = (macTop + font->getFontHeight() + 1) / 2;
|
||||
bottom = (macTop + _font->getFontHeight() + 1) / 2;
|
||||
}
|
||||
|
||||
if (_firstChar) {
|
||||
@ -1893,8 +1852,6 @@ void CharsetRendererMac::printCharInternal(int chr, int color, bool shadow, int
|
||||
y++;
|
||||
}
|
||||
|
||||
const Graphics::Font *font = _vm->_macGui->getFontByScummId(_curId);
|
||||
|
||||
if (shadow) {
|
||||
byte shadowColor = getTextShadowColor();
|
||||
|
||||
@ -1905,72 +1862,49 @@ void CharsetRendererMac::printCharInternal(int chr, int color, bool shadow, int
|
||||
// particularly good anyway). This seems to match the
|
||||
// original look for normal text.
|
||||
|
||||
font->drawChar(&_vm->_textSurface, chr, x + 1, y - 1, 0);
|
||||
font->drawChar(&_vm->_textSurface, chr, x - 1, y + 1, 0);
|
||||
font->drawChar(&_vm->_textSurface, chr, x + 2, y + 2, 0);
|
||||
_font->drawChar(&_vm->_textSurface, chr, x + 1, y - 1, 0);
|
||||
_font->drawChar(&_vm->_textSurface, chr, x - 1, y + 1, 0);
|
||||
_font->drawChar(&_vm->_textSurface, chr, x + 2, y + 2, 0);
|
||||
|
||||
if (color != -1) {
|
||||
font->drawChar(_vm->_macScreen, chr, x + 1, y - 1, shadowColor);
|
||||
font->drawChar(_vm->_macScreen, chr, x - 1, y + 1, shadowColor);
|
||||
font->drawChar(_vm->_macScreen, chr, x + 2, y + 2, shadowColor);
|
||||
_font->drawChar(_vm->_macScreen, chr, x + 1, y - 1, shadowColor);
|
||||
_font->drawChar(_vm->_macScreen, chr, x - 1, y + 1, shadowColor);
|
||||
_font->drawChar(_vm->_macScreen, chr, x + 2, y + 2, shadowColor);
|
||||
}
|
||||
} else {
|
||||
// Indy 3 uses simpler shadowing, and doesn't need the
|
||||
// "draw only on text surface" hack.
|
||||
|
||||
font->drawChar(&_vm->_textSurface, chr, x + 1, y + 1, 0);
|
||||
font->drawChar(_vm->_macScreen, chr, x + 1, y + 1, shadowColor);
|
||||
_font->drawChar(&_vm->_textSurface, chr, x + 1, y + 1, 0);
|
||||
_font->drawChar(_vm->_macScreen, chr, x + 1, y + 1, shadowColor);
|
||||
}
|
||||
}
|
||||
|
||||
font->drawChar(&_vm->_textSurface, chr, x, y, 0);
|
||||
_font->drawChar(&_vm->_textSurface, chr, x, y, 0);
|
||||
|
||||
if (color != -1) {
|
||||
color = getTextColor();
|
||||
|
||||
if (_vm->_renderMode == Common::kRenderMacintoshBW && color != 0 && color != 15) {
|
||||
_glyphSurface->fillRect(Common::Rect(_glyphSurface->w, _glyphSurface->h), 0);
|
||||
font->drawChar(_glyphSurface, chr, 0, 0, 15);
|
||||
_font->drawChar(_glyphSurface, chr, 0, 0, 15);
|
||||
|
||||
byte *src = (byte *)_glyphSurface->getBasePtr(0, 0);
|
||||
byte *dst = (byte *)_vm->_macScreen->getBasePtr(x, y);
|
||||
for (int y0 = 0; y0 < _glyphSurface->h; y0++) {
|
||||
for (int x0 = 0; x0 < _glyphSurface->w; x0++) {
|
||||
if (_glyphSurface->getPixel(x0, y0)) {
|
||||
int x1 = x + x0;
|
||||
int y1 = y + y0;
|
||||
|
||||
for (int h = 0; h < _glyphSurface->h; h++) {
|
||||
bool pixel = ((y + h + 1) & 1) == 0;
|
||||
|
||||
for (int w = 0; w < _glyphSurface->w; w++) {
|
||||
if (src[w]) {
|
||||
if (pixel)
|
||||
dst[w] = 15;
|
||||
else
|
||||
dst[w] = 0;
|
||||
_vm->_macScreen->setPixel(x1, y1, ((x1 + y1) & 1) ? 0 : 15);
|
||||
}
|
||||
pixel = !pixel;
|
||||
}
|
||||
src += _glyphSurface->pitch;
|
||||
dst += _vm->_macScreen->pitch;
|
||||
}
|
||||
} else {
|
||||
font->drawChar(_vm->_macScreen, chr, x, y, color);
|
||||
_font->drawChar(_vm->_macScreen, chr, x, y, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CharsetRendererMac::drawChar(int chr, Graphics::Surface &s, int x, int y) {
|
||||
// This function is used for drawing most of the text outside of what
|
||||
// the game scripts request. It's used for the text box captions in
|
||||
// Indiana Jones and the Last Crusade, and for the practice mode box
|
||||
// in Loom.
|
||||
int color = _color;
|
||||
|
||||
if (_vm->_renderMode == Common::kRenderMacintoshBW)
|
||||
color = 15;
|
||||
|
||||
const Graphics::Font *font = _vm->_macGui->getFontByScummId(_curId);
|
||||
|
||||
font->drawChar(&s, chr, x, y, color);
|
||||
}
|
||||
|
||||
void CharsetRendererMac::setColor(byte color) {
|
||||
_color = color;
|
||||
_enableShadow = false;
|
||||
|
@ -285,15 +285,12 @@ public:
|
||||
|
||||
class CharsetRendererMac : public CharsetRendererCommon {
|
||||
protected:
|
||||
bool _useRealCharWidth;
|
||||
const Graphics::Font *_font;
|
||||
bool _useCorrectFontSpacing;
|
||||
bool _pad;
|
||||
int _lastTop;
|
||||
|
||||
const Graphics::Font *getFont(int id) const;
|
||||
|
||||
int getDrawWidthIntern(uint16 chr) const;
|
||||
|
||||
void printCharInternal(int chr, int color, bool shadow, int x, int y);
|
||||
|
||||
byte getTextColor();
|
||||
@ -311,7 +308,6 @@ public:
|
||||
int getFontHeight() const override;
|
||||
int getCharWidth(uint16 chr) const override;
|
||||
void printChar(int chr, bool ignoreCharsetMask) override;
|
||||
void drawChar(int chr, Graphics::Surface &s, int x, int y) override;
|
||||
void setColor(byte color) override;
|
||||
};
|
||||
|
||||
|
@ -190,10 +190,10 @@ Common::KeyState ScummEngine::mac_showOldStyleBannerAndPause(const char *msg, in
|
||||
|
||||
// Pause the engine
|
||||
PauseToken pt = pauseEngine();
|
||||
|
||||
Common::KeyState ks = Common::KEYCODE_INVALID;
|
||||
bool leftBtnPressed = false, rightBtnPressed = false;
|
||||
|
||||
if (waitTime) {
|
||||
bool leftBtnPressed = false, rightBtnPressed = false;
|
||||
waitForBannerInput(waitTime, ks, leftBtnPressed, rightBtnPressed);
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ int MacGui::MacWidget::drawText(Common::String text, int x, int y, int w, Color
|
||||
y0 += font->getFontHeight();
|
||||
}
|
||||
|
||||
return lineWidth;
|
||||
return maxLineWidth;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -334,20 +334,17 @@ void MacGui::MacButton::draw(bool drawFocused) {
|
||||
|
||||
debug(1, "MacGui::MacButton: Drawing button %d (_fullRedraw = %d, drawFocused = %d, _value = %d)", _id, _fullRedraw, drawFocused, _value);
|
||||
|
||||
// ScummVM's rounded rectangles aren't a complete match for QuickDraw's
|
||||
// rounded rectangles, and for arcs this small they don't look very
|
||||
// good. So we draw the corners manually.
|
||||
|
||||
CornerLine buttonCorner[] = { { 0, 0 }, { 1, 2 }, { 1, 1 }, { 0, -1 } };
|
||||
CornerLine smallButtonCorner[] = { { 0, 0 }, { 1, 2 }, { 1, 1 }, { 0, -1 } };
|
||||
CornerLine frameCorner[] = { { 5, 1 }, { 3, 3 }, { 2, 4 }, { 1, 5 }, { 1, 3 }, { 0, 4 }, { 0, -1 } };
|
||||
|
||||
Graphics::Surface *s = _window->innerSurface();
|
||||
Color fg, bg;
|
||||
|
||||
int x0 = _bounds.left;
|
||||
int x1 = _bounds.right - 1;
|
||||
|
||||
int y0 = _bounds.top;
|
||||
int y1 = _bounds.bottom - 1;
|
||||
|
||||
s->hLine(x0 + 3, y0, x1 - 3, kBlack);
|
||||
s->hLine(x0 + 3, y1, x1 - 3, kBlack);
|
||||
s->vLine(x0, y0 + 3, y1 - 3, kBlack);
|
||||
s->vLine(x1, y0 + 3, y1 - 3, kBlack);
|
||||
|
||||
if (drawFocused || (_window->getFocusedWidget() == this && _bounds.contains(_window->getMousePos()))) {
|
||||
fg = kWhite;
|
||||
bg = kBlack;
|
||||
@ -356,20 +353,36 @@ void MacGui::MacButton::draw(bool drawFocused) {
|
||||
bg = kWhite;
|
||||
}
|
||||
|
||||
int x0 = _bounds.left;
|
||||
int x1 = _bounds.right - 1;
|
||||
|
||||
int y0 = _bounds.top;
|
||||
int y1 = _bounds.bottom - 1;
|
||||
|
||||
CornerLine *corner;
|
||||
int cornerSize;
|
||||
|
||||
if (_bounds.height() >= 20) {
|
||||
corner = buttonCorner;
|
||||
cornerSize = 3;
|
||||
} else {
|
||||
corner = smallButtonCorner;
|
||||
cornerSize = 2;
|
||||
}
|
||||
|
||||
s->hLine(x0 + cornerSize, y0, x1 - cornerSize, kBlack);
|
||||
s->hLine(x0 + cornerSize, y1, x1 - cornerSize, kBlack);
|
||||
s->vLine(x0, y0 + cornerSize, y1 - cornerSize, kBlack);
|
||||
s->vLine(x1, y0 + cornerSize, y1 - cornerSize, kBlack);
|
||||
|
||||
// The way the corners are rounded, we can fill this entire rectangle
|
||||
// in one go.
|
||||
|
||||
s->fillRect(Common::Rect(_bounds.left + 1, _bounds.top + 1, _bounds.right - 1, _bounds.bottom - 1), bg);
|
||||
Common::Rect inside = _bounds;
|
||||
inside.grow(-1);
|
||||
s->fillRect(inside, bg);
|
||||
|
||||
// ScummVM's rounded rectangles aren't a complete match for QuickDraw's
|
||||
// rounded rectangles, and for arcs this small they don't look very good.
|
||||
// So we draw the corners manually.
|
||||
//
|
||||
// Unfortunately, these hard-coded ones only work for most buttons.
|
||||
|
||||
CornerLine innerCorner[] = { { 0, 0 }, { 1, 2 }, { 1, 1 }, { 0, -1 } };
|
||||
|
||||
drawCorners(_bounds, innerCorner);
|
||||
drawCorners(_bounds, corner);
|
||||
|
||||
const Graphics::Font *font = _window->_gui->getFont(kSystemFont);
|
||||
|
||||
@ -393,13 +406,12 @@ void MacGui::MacButton::draw(bool drawFocused) {
|
||||
s->vLine(x1 - i, y0 + 6, y1 - 6, kBlack);
|
||||
}
|
||||
|
||||
CornerLine outerCorner[] = { { 5, 1 }, { 3, 3 }, { 2, 4 }, { 1, 5 }, { 1, 3 }, { 0, 4 }, { 0, -1 } };
|
||||
|
||||
drawCorners(bounds, outerCorner);
|
||||
drawCorners(bounds, frameCorner);
|
||||
}
|
||||
|
||||
_redraw = false;
|
||||
_fullRedraw = false;
|
||||
|
||||
_window->markRectAsDirty(bounds);
|
||||
}
|
||||
|
||||
@ -648,7 +660,7 @@ MacGui::MacDialogWindow::MacDialogWindow(MacGui *gui, OSystem *system, Graphics:
|
||||
_dirtyRects.clear();
|
||||
|
||||
Graphics::Surface *s = surface();
|
||||
Common::Rect r = Common::Rect(0, 0, s->w, s->h);
|
||||
Common::Rect r = Common::Rect(s->w, s->h);
|
||||
|
||||
r.grow(-1);
|
||||
s->fillRect(r, kWhite);
|
||||
@ -695,7 +707,7 @@ MacGui::MacDialogWindow::~MacDialogWindow() {
|
||||
|
||||
void MacGui::MacDialogWindow::copyToScreen(Graphics::Surface *s) const {
|
||||
if (s) {
|
||||
_from->copyRectToSurface(*s, _bounds.left, _bounds.top, Common::Rect(0, 0, _bounds.width(), _bounds.height()));
|
||||
_from->copyRectToSurface(*s, _bounds.left, _bounds.top, Common::Rect(_bounds.width(), _bounds.height()));
|
||||
}
|
||||
_system->copyRectToScreen(_from->getBasePtr(_bounds.left, _bounds.top), _from->pitch, _bounds.left, _bounds.top, _bounds.width(), _bounds.height());
|
||||
}
|
||||
@ -771,7 +783,7 @@ void MacGui::MacDialogWindow::update(bool fullRedraw) {
|
||||
|
||||
if (fullRedraw) {
|
||||
_dirtyRects.clear();
|
||||
markRectAsDirty(Common::Rect(0, 0, _innerSurface.w, _innerSurface.h));
|
||||
markRectAsDirty(Common::Rect(_innerSurface.w, _innerSurface.h));
|
||||
}
|
||||
|
||||
for (uint i = 0; i < _dirtyRects.size(); i++) {
|
||||
@ -800,10 +812,20 @@ int MacGui::MacDialogWindow::runDialog() {
|
||||
if (!_visible) {
|
||||
show();
|
||||
|
||||
Common::Rect windowBounds(_innerSurface.w, _innerSurface.h);
|
||||
|
||||
for (uint i = 0; i < _widgets.size(); i++) {
|
||||
_widgets[i]->setId(i);
|
||||
_widgets[i]->setRedraw(true);
|
||||
_widgets[i]->draw();
|
||||
|
||||
// We don't deal with off-window widgets. Not even
|
||||
// partly off-window.
|
||||
|
||||
if (windowBounds.contains(_widgets[i]->getBounds())) {
|
||||
_widgets[i]->setRedraw(true);
|
||||
_widgets[i]->draw();
|
||||
} else {
|
||||
_widgets[i]->setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -891,12 +913,12 @@ int MacGui::MacDialogWindow::runDialog() {
|
||||
}
|
||||
|
||||
void MacGui::MacDialogWindow::drawSprite(const Graphics::Surface *sprite, int x, int y) {
|
||||
_innerSurface.copyRectToSurface(*sprite, x, y, Common::Rect(0, 0, sprite->w, sprite->h));
|
||||
_innerSurface.copyRectToSurface(*sprite, x, y, Common::Rect(sprite->w, sprite->h));
|
||||
markRectAsDirty(Common::Rect(x, y, x + sprite->w, y + sprite->h));
|
||||
}
|
||||
|
||||
void MacGui::MacDialogWindow::drawSprite(const Graphics::Surface *sprite, int x, int y, Common::Rect(clipRect)) {
|
||||
Common::Rect subRect(0, 0, sprite->w, sprite->h);
|
||||
Common::Rect subRect(sprite->w, sprite->h);
|
||||
|
||||
if (x < clipRect.left) {
|
||||
subRect.left += (clipRect.left - x);
|
||||
@ -1035,11 +1057,10 @@ void MacGui::initialize() {
|
||||
_windowManager = new Graphics::MacWindowManager(Graphics::kWMModeNoDesktop | Graphics::kWMModeAutohideMenu | Graphics::kWMModalMenuMode | Graphics::kWMModeNoCursorOverride);
|
||||
_windowManager->setEngine(_vm);
|
||||
_windowManager->setScreen(640, 400);
|
||||
_windowManager->setMenuHotzone(Common::Rect(0, 0, 640, 23));
|
||||
_windowManager->setMenuHotzone(Common::Rect(640, 23));
|
||||
_windowManager->setMenuDelay(250000);
|
||||
|
||||
Common::MacResManager resource;
|
||||
Common::SeekableReadStream *res;
|
||||
Graphics::MacMenu *menu = _windowManager->addMenu();
|
||||
|
||||
resource.open(_resourceFile);
|
||||
@ -1059,7 +1080,7 @@ void MacGui::initialize() {
|
||||
menu->setCommandsCallback(menuCallback, this);
|
||||
|
||||
for (int i = 129; i <= 130; i++) {
|
||||
res = resource.getResource(MKTAG('M', 'E', 'N', 'U'), i);
|
||||
Common::SeekableReadStream *res = resource.getResource(MKTAG('M', 'E', 'N', 'U'), i);
|
||||
|
||||
if (!res)
|
||||
continue;
|
||||
@ -1069,6 +1090,9 @@ void MacGui::initialize() {
|
||||
Common::String string = menuDef->operator[](1);
|
||||
int id = menu->addMenuItem(nullptr, name);
|
||||
menu->createSubMenuFromString(id, string.c_str(), 0);
|
||||
|
||||
delete menuDef;
|
||||
delete res;
|
||||
}
|
||||
|
||||
resource.close();
|
||||
@ -1211,7 +1235,9 @@ Graphics::Surface *MacGui::loadPict(int id) {
|
||||
s = decodePictV1(res);
|
||||
}
|
||||
|
||||
delete res;
|
||||
resource.close();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -1556,7 +1582,6 @@ MacGui::MacDialogWindow *MacGui::createWindow(Common::Rect bounds, MacDialogWind
|
||||
MacGui::MacDialogWindow *MacGui::createDialog(int dialogId) {
|
||||
Common::MacResManager resource;
|
||||
Common::SeekableReadStream *res;
|
||||
int button = 0;
|
||||
|
||||
resource.open(_resourceFile);
|
||||
|
||||
@ -1584,6 +1609,8 @@ MacGui::MacDialogWindow *MacGui::createDialog(int dialogId) {
|
||||
bounds.translate(86, 88);
|
||||
}
|
||||
|
||||
delete res;
|
||||
|
||||
MacDialogWindow *window = createWindow(bounds);
|
||||
|
||||
res = resource.getResource(MKTAG('D', 'I', 'T', 'L'), dialogId);
|
||||
@ -1621,7 +1648,6 @@ MacGui::MacDialogWindow *MacGui::createDialog(int dialogId) {
|
||||
// Button
|
||||
str = getDialogString(res, len);
|
||||
window->addButton(r, str, enabled);
|
||||
button++;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
@ -1659,7 +1685,9 @@ MacGui::MacDialogWindow *MacGui::createDialog(int dialogId) {
|
||||
}
|
||||
}
|
||||
|
||||
delete res;
|
||||
resource.close();
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@ -1685,6 +1713,7 @@ const Graphics::Font *MacLoomGui::getFontByScummId(int32 id) {
|
||||
switch (id) {
|
||||
case 0:
|
||||
return getFont(kLoomFontLarge);
|
||||
|
||||
default:
|
||||
error("MacLoomGui::getFontByScummId: Invalid font id %d", id);
|
||||
}
|
||||
@ -1747,8 +1776,8 @@ void MacLoomGui::setupCursor(int &width, int &height, int &hotspotX, int &hotspo
|
||||
_windowManager->replaceCursor(Graphics::kMacCursorCustom, &macCursor);
|
||||
}
|
||||
|
||||
resource.close();
|
||||
delete curs;
|
||||
resource.close();
|
||||
}
|
||||
|
||||
bool MacLoomGui::handleMenu(int id, Common::String &name) {
|
||||
@ -1865,7 +1894,7 @@ void MacLoomGui::runAboutDialog() {
|
||||
window->show();
|
||||
|
||||
int scene = 0;
|
||||
int status;
|
||||
int status = 0;
|
||||
|
||||
Common::Rect r(0, 0, 404, 154);
|
||||
int growth = -2;
|
||||
@ -2025,16 +2054,15 @@ void MacLoomGui::runAboutDialog() {
|
||||
}
|
||||
|
||||
if (status != 2)
|
||||
status = delay(-1);
|
||||
delay(-1);
|
||||
|
||||
_windowManager->popCursor();
|
||||
|
||||
lucasFilm->free();
|
||||
delete lucasFilm;
|
||||
|
||||
loom->free();
|
||||
delete loom;
|
||||
|
||||
delete lucasFilm;
|
||||
delete loom;
|
||||
delete window;
|
||||
}
|
||||
|
||||
@ -2175,6 +2203,8 @@ void MacLoomGui::update(int delta) {
|
||||
int w = 64;
|
||||
int h = 24;
|
||||
|
||||
bool bw = (_vm->_renderMode == Common::kRenderMacintoshBW);
|
||||
|
||||
if (!_practiceBox) {
|
||||
debug(1, "MacLoomGui: Creating practice mode box");
|
||||
|
||||
@ -2182,12 +2212,14 @@ void MacLoomGui::update(int delta) {
|
||||
_practiceBox->create(w, h, Graphics::PixelFormat
|
||||
::createFormatCLUT8());
|
||||
|
||||
_practiceBox->fillRect(Common::Rect(0, 0, 62, 22), kBlack);
|
||||
_practiceBox->fillRect(Common::Rect(62, 22), kBlack);
|
||||
|
||||
_practiceBox->hLine(2, 1, w - 3, kLightGray);
|
||||
_practiceBox->hLine(2, h - 2, w - 3, kLightGray);
|
||||
_practiceBox->vLine(1, 2, h - 3, kLightGray);
|
||||
_practiceBox->vLine(w - 2, 2, h - 3, kLightGray);
|
||||
Color color = bw ? kWhite : kLightGray;
|
||||
|
||||
_practiceBox->hLine(2, 1, w - 3, color);
|
||||
_practiceBox->hLine(2, h - 2, w - 3, color);
|
||||
_practiceBox->vLine(1, 2, h - 3, color);
|
||||
_practiceBox->vLine(w - 2, 2, h - 3, color);
|
||||
_practiceBoxNotes = 0;
|
||||
}
|
||||
|
||||
@ -2202,8 +2234,9 @@ void MacLoomGui::update(int delta) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int note = (notes >> (4 * i)) & 0x0F;
|
||||
|
||||
if (note >= 2 && note <= 9)
|
||||
font->drawChar(_practiceBox, 14 + note, 9 + i * 13, 5, colors[note - 2]);
|
||||
if (note >= 2 && note <= 9) {
|
||||
font->drawChar(_practiceBox, 14 + note, 9 + i * 13, 5, bw ? kWhite : colors[note - 2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3248,9 +3281,16 @@ void MacIndy3Gui::setupCursor(int &width, int &height, int &hotspotX, int &hotsp
|
||||
}
|
||||
|
||||
const Graphics::Font *MacIndy3Gui::getFontByScummId(int32 id) {
|
||||
// The game seems to use font 0 most of the time, but during the intro
|
||||
// it switches to font 1 to print "BARNETT COLLEGE,", "NEW YORK," and
|
||||
// "1938". By the look of it, these map to the same font.
|
||||
//
|
||||
// This is different from the DOS version, where font 1 is bolder.
|
||||
switch (id) {
|
||||
case 0:
|
||||
case 1:
|
||||
return getFont(kIndy3FontMedium);
|
||||
|
||||
default:
|
||||
error("MacIndy3Gui::getFontByScummId: Invalid font id %d", id);
|
||||
}
|
||||
@ -3309,7 +3349,6 @@ void MacIndy3Gui::initTextAreaForActor(Actor *a, byte color) {
|
||||
_textArea.fillRect(Common::Rect(width, height), kBlack);
|
||||
|
||||
int nameWidth = 0;
|
||||
// byte color = _charset->getColor();
|
||||
|
||||
if (a) {
|
||||
const Graphics::Font *font = getFont(kIndy3FontSmall);
|
||||
@ -3410,7 +3449,7 @@ void MacIndy3Gui::runAboutDialog() {
|
||||
// cut out enough of the background so that each time they are drawn,
|
||||
// the visible remains of the previous frame is overdrawn.
|
||||
|
||||
Graphics::Surface train = pict->getSubArea(Common::Rect(0, 0, 249, 93));
|
||||
Graphics::Surface train = pict->getSubArea(Common::Rect(249, 93));
|
||||
|
||||
Graphics::Surface trolley[3];
|
||||
|
||||
@ -3430,7 +3469,7 @@ void MacIndy3Gui::runAboutDialog() {
|
||||
// 10 fps.
|
||||
|
||||
int scene = 0;
|
||||
int status;
|
||||
int status = 0;
|
||||
|
||||
int trainX = -2;
|
||||
int trolleyX = width + 1;
|
||||
@ -3612,7 +3651,7 @@ void MacIndy3Gui::runAboutDialog() {
|
||||
}
|
||||
|
||||
if (status != 2)
|
||||
status = delay(-1);
|
||||
delay(-1);
|
||||
|
||||
_windowManager->popCursor();
|
||||
|
||||
|
@ -273,7 +273,6 @@ public:
|
||||
private:
|
||||
OSystem *_system;
|
||||
Common::Rect _bounds;
|
||||
Common::Rect _innerBounds;
|
||||
int _margin;
|
||||
|
||||
bool _visible = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user