[Scummvm-git-logs] scummvm master -> b02d9a017477647de78b4ab682b870b6e93c9fe3
sev-
sev at scummvm.org
Tue Aug 1 11:22:25 CEST 2017
This automated email contains information about 34 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2092c10d33 WAGE: Fix compilation with MacTextWindow enabled
bfb757c3c0 GRAPHICS: Load Mac font heights too (still unused)
6443bee147 JANITORIAL: Fix code identation
68cd5c8868 GRAPHICS: MACGUI: Added method to remove last line from MacText
ff8a2ade68 GRAPHICS: MACGUI: Made more MacWindow methods public
9fe79b9e19 GRAPHICS: MACGUI: Made MacTextWindow processing keyboard input
042b3dc60e WAGE: Switched Console window to MacTextWindow
dbc247cc3f JANITORIAL: Code formatting
73b6b12cbb GRAPHICS: MACGUI: Correctly process empty inpt strings in MacTextWindow
645ee64da0 GRAPHICS: MACGUI: Avoid double free of MacTextWindow
511b21d3cf GRAPHICS: MACGUI: Added font specifying to MacTextWindow
e5ccc3fd55 WAGE: Correctly set font in MacTextWindow console
15d0d12c71 WAGE: Draw cursor only when MacTextWindow is not used
62a2ac8c2b GRAPHICS: MACGUI: Added more getters to MacText
a2427fddd7 GRAPHICS: MACGUI: Initial code for cursor drawing in MacTextWindow
c2944fb5b8 GRAPHICS: MACGUI: Simplified cursor code is MacTextWindow
94a0eadd30 GRAPHICS: MACGUI: Added hack for fixing cursor position in MacTextWindow
e832f1d650 GRAPHICS: MACGUI: Update cursor position as text being added to MacTextWindow
3e96a0909d GRAPHICS: MACGUI: Replace magic numbers with named constants
81c26caaf8 GRAPHICS: MACGUI: Exposed input text from the MacTextWindow
5149226255 WAGE: Started processing of input text from MacTextWindow
da9e02cebb GRAPHICS: MACGUI: Fix crash on backspace in MacTextWindow input
ebcff3a0aa GRAPHICS: MACGUI: Do not pass event when ascii characters are pressed
8643a08350 WAGE: Properly add input text to console on Enter
2c0b73aaef GRAPHICS: MACGUI: Set MacTextWindow as active when keys are pressed
8319e4093f GRAPHICS: MACGUI: Force redraw of dirty part of MacTextWindow
a5c99c99f5 GRAPHICS: MACGUI: Remove redundant method from MacTextWindow
f7ba4f1b0b GRAPHICS: MACGUI: Properly process border dragging in MacTextWindow
63e9f41f4e WAGE: Simplified text adding to MacTextWindow
48f07f0276 GRAPHICS: MACGUI: Render MacTextWindow internally
2f5b1f08ef WAGE: Render console text in MacTextWindow
115a7407e9 GRAPHICS: MACGUI: Keep original string in MacText
73c5c85210 DIRECTOR: Clarified STXT field names
b02d9a0174 GRAPHICS: MACGUI: unk3f is not needed in MacText
Commit: 2092c10d3306126f180f8017627754134350c032
https://github.com/scummvm/scummvm/commit/2092c10d3306126f180f8017627754134350c032
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:21+02:00
Commit Message:
WAGE: Fix compilation with MacTextWindow enabled
Changed paths:
engines/wage/gui.cpp
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 54601cc..541b7ff 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -177,14 +177,13 @@ Gui::Gui(WageEngine *engine) {
//TODO: Make the font we use here work
// (currently MacFontRun::getFont gets called with the fonts being uninitialized,
// so it initializes them by itself with default params, and not those here)
- const Graphics::Font *font = _wm._fontMan->getFont(Graphics::MacFont(Graphics::kMacFontChicago, 8));
+ const Graphics::MacFont *font = new Graphics::MacFont(Graphics::kMacFontChicago, 8);
uint maxWidth = _screen.w;
- _consoleWindow = new Graphics::MacTextWindow(&_wm, const_cast<Graphics::Font *>(font), kColorBlack, kColorWhite,
- maxWidth, Graphics::kTextAlignLeft);
+ _consoleWindow = new Graphics::MacTextWindow(&_wm, font, kColorBlack, kColorWhite, maxWidth, Graphics::kTextAlignLeft);
#else
- _consoleWindow = _wm.addWindow(true, true, true);
+ _consoleWindow = _wm.addWindow(true, true, true);
#endif // USE_MACTEXTWINDOW
_consoleWindow->setCallback(consoleWindowCallback, this);
Commit: bfb757c3c0d3e7b1281ae3059e31cd53742644ab
https://github.com/scummvm/scummvm/commit/bfb757c3c0d3e7b1281ae3059e31cd53742644ab
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:21+02:00
Commit Message:
GRAPHICS: Load Mac font heights too (still unused)
Changed paths:
graphics/fonts/macfont.cpp
graphics/fonts/macfont.h
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index 9ddb5a6..80c1dc4 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -328,10 +328,8 @@ bool MacFONTFont::loadFont(Common::SeekableReadStream &stream, MacFontFamily *fa
}
if (_data._fontType & kFontTypeImageHeightTable) {
- warning("Skipping image height table");
-
for (uint16 i = 0; i < glyphCount; i++)
- stream.readUint16BE();
+ _data._glyphs[i].height = stream.readUint16BE();
}
free(bitmapOffsets);
diff --git a/graphics/fonts/macfont.h b/graphics/fonts/macfont.h
index 874d304..b2e1fb0 100644
--- a/graphics/fonts/macfont.h
+++ b/graphics/fonts/macfont.h
@@ -102,12 +102,14 @@ struct MacGlyph {
void clear() {
bitmapOffset = 0;
width = 0;
+ height = 0;
bitmapWidth = 0;
kerningOffset = 0;
}
uint16 bitmapOffset;
byte width;
+ uint16 height;
uint16 bitmapWidth;
int kerningOffset;
};
Commit: 6443bee147a1f5a5fd969d1e59695e13e9f79fb6
https://github.com/scummvm/scummvm/commit/6443bee147a1f5a5fd969d1e59695e13e9f79fb6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:21+02:00
Commit Message:
JANITORIAL: Fix code identation
Changed paths:
engines/wage/gui-console.cpp
engines/wage/gui.h
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index b97b76e..e759883 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -224,7 +224,7 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
#ifndef USE_MACTEXTWINDOW
- for (int line = firstLine; line < lastLine; line++) {
+ for (int line = firstLine; line < lastLine; line++) {
const char *str = _lines[line].c_str();
int color = kColorBlack;
@@ -348,7 +348,7 @@ void Gui::drawInput() {
appendText(_engine->_inputText.c_str());
_inputTextLineNum = _out.size() - 1;
- #ifndef USE_MACTEXTWINDOW
+#ifndef USE_MACTEXTWINDOW
const Graphics::Font *font = getConsoleFont();
if (_engine->_inputText.contains('\n')) {
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 5f8be34..53e6f99 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -186,9 +186,9 @@ public:
Graphics::MacWindow *_sceneWindow;
#ifdef USE_MACTEXTWINDOW
- Graphics::MacTextWindow *_consoleWindow;
+ Graphics::MacTextWindow *_consoleWindow;
#else
- Graphics::MacWindow *_consoleWindow;
+ Graphics::MacWindow *_consoleWindow;
#endif
private:
Commit: 68cd5c8868ade8ebfd331e4fea25d47fe899dc42
https://github.com/scummvm/scummvm/commit/68cd5c8868ade8ebfd331e4fea25d47fe899dc42
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:21+02:00
Commit Message:
GRAPHICS: MACGUI: Added method to remove last line from MacText
Changed paths:
graphics/macgui/mactext.cpp
graphics/macgui/mactext.h
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index fa0510b..2ca60a1 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -410,4 +410,14 @@ void MacText::replaceLastLine(Common::String str) {
render(oldLen, _textLines.size());
}
+void MacText::removeLastLine() {
+ if (!_textLines.size())
+ return;
+
+ int h = getLineHeight(_textLines.size() - 1) + _interLinear;
+
+ _textLines.pop_back();
+ _textMaxHeight -= h;
+}
+
} // End of namespace Graphics
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 3870451..526d526 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -101,6 +101,7 @@ public:
void appendTextDefault(Common::String str);
void clearText();
void replaceLastLine(Common::String str);
+ void removeLastLine();
int getLineCount() { return _textLines.size(); }
void render();
Commit: ff8a2ade68cc6751c1825f149f2efe9f78c9fe3d
https://github.com/scummvm/scummvm/commit/ff8a2ade68cc6751c1825f149f2efe9f78c9fe3d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:21+02:00
Commit Message:
GRAPHICS: MACGUI: Made more MacWindow methods public
Changed paths:
graphics/macgui/macwindow.h
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index 5446b65..3db9096 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -262,7 +262,7 @@ public:
/**
* See BaseMacWindow.
*/
- bool processEvent(Common::Event &event);
+ virtual bool processEvent(Common::Event &event);
bool hasAllFocus() { return _beingDragged || _beingResized; }
/**
@@ -285,6 +285,8 @@ public:
*/
void setCloseable(bool closeable);
+ WindowClick isInBorder(int x, int y);
+
private:
void drawBorder();
void prepareBorderSurface(ManagedSurface *g);
@@ -295,7 +297,6 @@ private:
void fillRect(ManagedSurface *g, int x, int y, int w, int h, int color);
const Font *getTitleFont();
void updateInnerDims();
- WindowClick isInBorder(int x, int y);
bool isInCloseButton(int x, int y);
bool isInResizeButton(int x, int y);
Commit: 9fe79b9e198740c4544bb56784c9b861c8113e6f
https://github.com/scummvm/scummvm/commit/9fe79b9e198740c4544bb56784c9b861c8113e6f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:21+02:00
Commit Message:
GRAPHICS: MACGUI: Made MacTextWindow processing keyboard input
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
graphics/macgui/macwindowmanager.cpp
graphics/macgui/macwindowmanager.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 19ed9a8..c34f428 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -27,14 +27,18 @@
namespace Graphics {
-MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgcolor,
- int bgcolor, int maxWidth, TextAlign textAlignment) :
+MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment) :
MacWindow(wm->getNextId(), true, true, true, wm) {
wm->addWindowInitialized(this);
_font = font;
_mactext = new MacText("", _wm, font, fgcolor, bgcolor, maxWidth, textAlignment);
+
+ _fontRef = wm->_fontMan->getFont(*font);
+
+ _inputTextHeight = 0;
+ _maxWidth = maxWidth;
}
void MacTextWindow::drawText(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff) {
@@ -67,4 +71,50 @@ const MacFont *MacTextWindow::getTextWindowFont() {
return _font;
}
+bool MacTextWindow::processEvent(Common::Event &event) {
+ WindowClick click = isInBorder(event.mouse.x, event.mouse.y);
+
+ if (event.type == Common::EVENT_KEYDOWN) {
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_BACKSPACE:
+ if (!_inputText.empty()) {
+ _inputText.deleteLastChar();
+ drawInput();
+ }
+ break;
+
+ case Common::KEYCODE_RETURN:
+ return false; // Pass it to the higher level for processing
+
+ default:
+ if (event.kbd.ascii == '~')
+ return false;
+
+ if (event.kbd.ascii >= 0x20 && event.kbd.ascii <= 0x7f) {
+ _inputText += (char)event.kbd.ascii;
+ drawInput();
+ }
+
+ break;
+ }
+ }
+
+ return false;
+}
+
+void MacTextWindow::drawInput() {
+ // First, we kill previous input text
+ for (uint i = 0; i < _inputTextHeight; i++)
+ _mactext->removeLastLine();
+
+ Common::Array<Common::String> text;
+
+ // Now recalc new text height
+ _fontRef->wordWrapText(_inputText, _maxWidth, text);
+ _inputTextHeight = text.size();
+
+ // And add new input line to the text
+ appendText(_inputText, _font);
+}
+
} // End of namespace Graphics
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 11b845f..dcefa00 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -44,9 +44,10 @@ struct SelectedText {
class MacTextWindow : public MacWindow {
public:
- MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgcolor,
- int bgcolor, int maxWidth, TextAlign textAlignment);
- ~MacTextWindow();
+ MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment);
+ virtual ~MacTextWindow();
+
+ virtual bool processEvent(Common::Event &event);
const MacFont *getTextWindowFont();
@@ -58,10 +59,18 @@ public:
void setSelection(int selStartX, int selStartY, int selEndX, int selEndY);
private:
+ void drawInput();
+
+private:
MacText *_mactext;
const MacFont *_font;
+ const Font *_fontRef;
SelectedText _selectedText;
+
+ int _maxWidth;
+ Common::String _inputText;
+ uint _inputTextHeight;
};
} // End of namespace Graphics
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index b64ff10..1e4c49f 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -31,6 +31,7 @@
#include "graphics/macgui/macwindowmanager.h"
#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/macwindow.h"
+#include "graphics/macgui/mactextwindow.h"
#include "graphics/macgui/macmenu.h"
namespace Graphics {
@@ -183,6 +184,18 @@ MacWindow *MacWindowManager::addWindow(bool scrollable, bool resizable, bool edi
return w;
}
+MacTextWindow *MacWindowManager::addTextWindow(const MacFont *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment) {
+ MacTextWindow *w = new MacTextWindow(this, font, fgcolor, bgcolor, maxWidth, textAlignment);
+
+ _windows.push_back(w);
+ _windowStack.push_back(w);
+
+ setActive(getNextId());
+
+ return w;
+}
+
+
void MacWindowManager::addWindowInitialized(MacWindow *macwindow) {
_windows.push_back(macwindow);
_windowStack.push_back(macwindow);
@@ -300,7 +313,7 @@ bool MacWindowManager::processEvent(Common::Event &event) {
return true;
if (event.type != Common::EVENT_MOUSEMOVE && event.type != Common::EVENT_LBUTTONDOWN &&
- event.type != Common::EVENT_LBUTTONUP)
+ event.type != Common::EVENT_LBUTTONUP && event.type != Common::EVENT_KEYDOWN)
return false;
if (_windows[_activeWindow]->isEditable() && _windows[_activeWindow]->getType() == kWindowWindow &&
@@ -320,8 +333,8 @@ bool MacWindowManager::processEvent(Common::Event &event) {
it--;
BaseMacWindow *w = *it;
-
- if (w->hasAllFocus() || w->getDimensions().contains(event.mouse.x, event.mouse.y)) {
+ if (w->hasAllFocus() || (w->isEditable() && event.type == Common::EVENT_KEYDOWN) ||
+ w->getDimensions().contains(event.mouse.x, event.mouse.y)) {
if (event.type == Common::EVENT_LBUTTONDOWN || event.type == Common::EVENT_LBUTTONUP)
setActive(w->getId());
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index ec7f4f1..61f4899 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -27,6 +27,7 @@
#include "common/list.h"
#include "common/events.h"
+#include "graphics/font.h"
#include "graphics/fontman.h"
#include "graphics/macgui/macwindow.h"
@@ -60,6 +61,9 @@ using namespace MacGUIConstants;
class ManagedSurface;
class MacMenu;
+class MacTextWindow;
+
+class MacFont;
class MacFontManager;
@@ -103,6 +107,8 @@ public:
* @return Pointer to the newly created window.
*/
MacWindow *addWindow(bool scrollable, bool resizable, bool editable);
+ MacTextWindow *addTextWindow(const MacFont *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment);
+
/**
* Adds a window that has already been initialized to the registry.
* Like addWindow, but this doesn't create/allocate the Window.
Commit: 042b3dc60e82592b714129d96f82fd7fb04b8aea
https://github.com/scummvm/scummvm/commit/042b3dc60e82592b714129d96f82fd7fb04b8aea
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:21+02:00
Commit Message:
WAGE: Switched Console window to MacTextWindow
Changed paths:
engines/wage/gui.cpp
engines/wage/gui.h
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 541b7ff..377816b 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -181,7 +181,7 @@ Gui::Gui(WageEngine *engine) {
uint maxWidth = _screen.w;
- _consoleWindow = new Graphics::MacTextWindow(&_wm, font, kColorBlack, kColorWhite, maxWidth, Graphics::kTextAlignLeft);
+ _consoleWindow = _wm.addTextWindow(font, kColorBlack, kColorWhite, maxWidth, Graphics::kTextAlignLeft);
#else
_consoleWindow = _wm.addWindow(true, true, true);
#endif // USE_MACTEXTWINDOW
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 53e6f99..64d40bd 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -49,7 +49,7 @@
#define WAGE_GUI_H
// Whether to use the new MacTextWindow class for rendering the console
-// #define USE_MACTEXTWINDOW
+#define USE_MACTEXTWINDOW
#include "common/str-array.h"
#include "graphics/font.h"
Commit: dbc247cc3ff3862b28bb6a83bcced50e52e69b96
https://github.com/scummvm/scummvm/commit/dbc247cc3ff3862b28bb6a83bcced50e52e69b96
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:21+02:00
Commit Message:
JANITORIAL: Code formatting
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 2ca60a1..fe6cf4e 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -327,7 +327,8 @@ void MacText::recalcDims() {
}
void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff) {
- if (_textLines.empty()) return;
+ if (_textLines.empty())
+ return;
render();
Commit: 73b6b12cbb926c2e21020afa4a984bbeaeac3db6
https://github.com/scummvm/scummvm/commit/73b6b12cbb926c2e21020afa4a984bbeaeac3db6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:21+02:00
Commit Message:
GRAPHICS: MACGUI: Correctly process empty inpt strings in MacTextWindow
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index c34f428..333bdcd 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -111,7 +111,7 @@ void MacTextWindow::drawInput() {
// Now recalc new text height
_fontRef->wordWrapText(_inputText, _maxWidth, text);
- _inputTextHeight = text.size();
+ _inputTextHeight = MAX(1u, text.size()); // We always have line to clean
// And add new input line to the text
appendText(_inputText, _font);
Commit: 645ee64da0f837245443842d53621e8fd5ac924f
https://github.com/scummvm/scummvm/commit/645ee64da0f837245443842d53621e8fd5ac924f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:21+02:00
Commit Message:
GRAPHICS: MACGUI: Avoid double free of MacTextWindow
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/macwindowmanager.cpp
graphics/macgui/macwindowmanager.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 333bdcd..e3e2f16 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -28,9 +28,7 @@
namespace Graphics {
MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment) :
- MacWindow(wm->getNextId(), true, true, true, wm) {
-
- wm->addWindowInitialized(this);
+ MacWindow(wm->getLastId(), true, true, true, wm) {
_font = font;
_mactext = new MacText("", _wm, font, fgcolor, bgcolor, maxWidth, textAlignment);
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 1e4c49f..d3f7d22 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -176,8 +176,7 @@ MacWindowManager::~MacWindowManager() {
MacWindow *MacWindowManager::addWindow(bool scrollable, bool resizable, bool editable) {
MacWindow *w = new MacWindow(_lastId, scrollable, resizable, editable, this);
- _windows.push_back(w);
- _windowStack.push_back(w);
+ addWindowInitialized(w);
setActive(getNextId());
@@ -187,8 +186,7 @@ MacWindow *MacWindowManager::addWindow(bool scrollable, bool resizable, bool edi
MacTextWindow *MacWindowManager::addTextWindow(const MacFont *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment) {
MacTextWindow *w = new MacTextWindow(this, font, fgcolor, bgcolor, maxWidth, textAlignment);
- _windows.push_back(w);
- _windowStack.push_back(w);
+ addWindowInitialized(w);
setActive(getNextId());
@@ -201,10 +199,6 @@ void MacWindowManager::addWindowInitialized(MacWindow *macwindow) {
_windowStack.push_back(macwindow);
}
-int MacWindowManager::getNextId() {
- return _lastId++;
-}
-
MacMenu *MacWindowManager::addMenu() {
_menu = new MacMenu(getNextId(), _screen->getBounds(), this);
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 61f4899..963fc35 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -116,10 +116,15 @@ public:
*/
void addWindowInitialized(MacWindow *macwindow);
/**
+ * Returns the last allocated id
+ * @return last allocated window id
+ */
+ int getLastId() { return _lastId; }
+ /**
* Returns the next available id and the increments the internal counter.
* @return next (new) window id that can be used
*/
- int getNextId();
+ int getNextId() { return _lastId++; }
/**
* Add the menu to the desktop.
* Note that the returned menu is empty, and therefore must be filled
Commit: 511b21d3cfa78c42c16921907e724d5e3789e7b3
https://github.com/scummvm/scummvm/commit/511b21d3cfa78c42c16921907e724d5e3789e7b3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:21+02:00
Commit Message:
GRAPHICS: MACGUI: Added font specifying to MacTextWindow
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index e3e2f16..9373751 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -65,6 +65,12 @@ void MacTextWindow::setSelection(int selStartX, int selStartY, int selEndX, int
MacTextWindow::~MacTextWindow() {
}
+void MacTextWindow::setTextWindowFont(const MacFont *font) {
+ _font = font;
+
+ _fontRef = _wm->_fontMan->getFont(*font);
+}
+
const MacFont *MacTextWindow::getTextWindowFont() {
return _font;
}
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index dcefa00..802d02b 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -49,6 +49,7 @@ public:
virtual bool processEvent(Common::Event &event);
+ void setTextWindowFont(const MacFont *macFont);
const MacFont *getTextWindowFont();
void drawText(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff);
Commit: e5ccc3fd559f6756e43e57687e6653b718b1686f
https://github.com/scummvm/scummvm/commit/e5ccc3fd559f6756e43e57687e6653b718b1686f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:21+02:00
Commit Message:
WAGE: Correctly set font in MacTextWindow console
Changed paths:
engines/wage/wage.cpp
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 54d821f..6205185 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -134,6 +134,8 @@ Common::Error WageEngine::run() {
_gui->regenWeaponsMenu();
}
+ _gui->_consoleWindow->setTextWindowFont(_world->_player->_currentScene->getFont());
+
Common::String input("look");
processTurn(&input, NULL);
_temporarilyHidden = false;
@@ -440,6 +442,7 @@ void WageEngine::processTurnInternal(Common::String *textInput, Designed *clickI
if (playerScene != _lastScene) {
_temporarilyHidden = true;
_gui->clearOutput();
+ _gui->_consoleWindow->setTextWindowFont(_world->_player->_currentScene->getFont());
regen();
Common::String input("look");
processTurnInternal(&input, NULL);
Commit: 15d0d12c719cafaddf59274fd3052491f79f222a
https://github.com/scummvm/scummvm/commit/15d0d12c719cafaddf59274fd3052491f79f222a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
WAGE: Draw cursor only when MacTextWindow is not used
Changed paths:
engines/wage/gui.cpp
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 377816b..04419d5 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -148,7 +148,9 @@ Gui::Gui(WageEngine *engine) {
_inputTextLineNum = 0;
+#ifndef USE_MACTEXTWINDOW
g_system->getTimerManager()->installTimerProc(&cursorTimerHandler, 200000, this, "wageCursor");
+#endif
_menu = _wm.addMenu();
@@ -194,7 +196,10 @@ Gui::Gui(WageEngine *engine) {
Gui::~Gui() {
_screen.free();
_console.free();
+
+#ifndef USE_MACTEXTWINDOW
g_system->getTimerManager()->removeTimerProc(&cursorTimerHandler);
+#endif
}
void Gui::undrawCursor() {
Commit: 62a2ac8c2bf2113e6cd96c232f6d68bcb6d42929
https://github.com/scummvm/scummvm/commit/62a2ac8c2bf2113e6cd96c232f6d68bcb6d42929
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Added more getters to MacText
Changed paths:
graphics/macgui/mactext.h
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 526d526..2f001f7 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -93,6 +93,7 @@ public:
// 0 pixels between the lines by default
~MacText();
+ int getInterLinear() { return _interLinear; }
void setInterLinear(int interLinear);
void draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff);
@@ -103,6 +104,7 @@ public:
void replaceLastLine(Common::String str);
void removeLastLine();
int getLineCount() { return _textLines.size(); }
+ int getTextHeight() { return _textMaxHeight; }
void render();
Graphics::ManagedSurface *getSurface() { return _surface; }
Commit: a2427fddd72f6c18c1609e50393950c8f2cb20ba
https://github.com/scummvm/scummvm/commit/a2427fddd72f6c18c1609e50393950c8f2cb20ba
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Initial code for cursor drawing in MacTextWindow
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 9373751..c4395cd 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -20,6 +20,8 @@
*
*/
+#include "common/timer.h"
+#include "common/system.h"
#include "graphics/macgui/macwindowmanager.h"
#include "graphics/macgui/macfontmanager.h"
@@ -27,6 +29,8 @@
namespace Graphics {
+static void cursorTimerHandler(void *refCon);
+
MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment) :
MacWindow(wm->getLastId(), true, true, true, wm) {
@@ -37,6 +41,15 @@ MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgco
_inputTextHeight = 0;
_maxWidth = maxWidth;
+
+ _scrollPos = 0;
+
+ _cursorX = 0;
+ _cursorY = 0;
+ _cursorState = false;
+ _cursorOff = false;
+
+ g_system->getTimerManager()->installTimerProc(&cursorTimerHandler, 200000, this, "textWindowCursor");
}
void MacTextWindow::drawText(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff) {
@@ -63,6 +76,7 @@ void MacTextWindow::setSelection(int selStartX, int selStartY, int selEndX, int
}
MacTextWindow::~MacTextWindow() {
+ g_system->getTimerManager()->removeTimerProc(&cursorTimerHandler);
}
void MacTextWindow::setTextWindowFont(const MacFont *font) {
@@ -75,6 +89,24 @@ const MacFont *MacTextWindow::getTextWindowFont() {
return _font;
}
+bool MacTextWindow::draw(ManagedSurface *g, bool forceRedraw) {
+ if (!_borderIsDirty && !_contentIsDirty && !_cursorDirty && !forceRedraw)
+ return false;
+
+ if (_borderIsDirty || forceRedraw)
+ drawBorder();
+
+ _contentIsDirty = false;
+
+ // Compose
+ _composeSurface.blitFrom(_surface, Common::Rect(0, 0, _surface.w - 2, _surface.h - 2), Common::Point(2, 2));
+ _composeSurface.transBlitFrom(_borderSurface, kColorGreen);
+
+ g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left - 2, _dims.top - 2), kColorGreen2);
+
+ return true;
+}
+
bool MacTextWindow::processEvent(Common::Event &event) {
WindowClick click = isInBorder(event.mouse.x, event.mouse.y);
@@ -119,6 +151,55 @@ void MacTextWindow::drawInput() {
// And add new input line to the text
appendText(_inputText, _font);
+
+ _cursorX = _fontRef->getStringWidth(text[_inputTextHeight - 1]);
+
+ if (_scrollPos)
+ _cursorY = _mactext->getTextHeight() - kCursorHeight * 2;
+ else
+ _cursorY = _mactext->getTextHeight() - kCursorHeight;
+
}
+//////////////////
+// Cursor stuff
+static void cursorTimerHandler(void *refCon) {
+ MacTextWindow *w = (MacTextWindow *)refCon;
+
+ int x = w->_cursorX;
+ int y = w->_cursorY;
+
+ if (x == 0 && y == 0)
+ return;
+
+ x += w->getInnerDimensions().left;
+ y += w->getInnerDimensions().top;
+ int h = kCursorHeight;
+
+ if (y + h > w->getInnerDimensions().bottom) {
+ h = w->getInnerDimensions().bottom - y;
+ }
+
+ if (h > 0)
+ w->getSurface()->vLine(x, y, y + h, w->_cursorState ? kColorBlack : kColorWhite);
+
+ if (!w->_cursorOff)
+ w->_cursorState = !w->_cursorState;
+
+ w->_cursorRect.left = x;
+ w->_cursorRect.right = MIN<uint16>(x + 1, w->getInnerDimensions().right);
+ w->_cursorRect.top = MIN<uint16>(y - 1, w->getInnerDimensions().top);
+ w->_cursorRect.bottom = MIN<uint16>(y + h, w->getInnerDimensions().bottom);
+
+ w->_cursorDirty = true;
+}
+
+void MacTextWindow::undrawCursor() {
+ _cursorOff = true;
+ _cursorState = false;
+ cursorTimerHandler(this);
+ _cursorOff = false;
+}
+
+
} // End of namespace Graphics
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 802d02b..0e48122 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -28,6 +28,10 @@
namespace Graphics {
+enum {
+ kCursorHeight = 12
+};
+
struct SelectedText {
int startX, startY;
int endX, endY;
@@ -49,6 +53,13 @@ public:
virtual bool processEvent(Common::Event &event);
+ /**
+ * Similar to that described in BaseMacWindow.
+ * @param g See BaseMacWindow.
+ * @param forceRedraw If true, the borders are guarranteed to redraw.
+ */
+ virtual bool draw(ManagedSurface *g, bool forceRedraw = false);
+
void setTextWindowFont(const MacFont *macFont);
const MacFont *getTextWindowFont();
@@ -59,9 +70,21 @@ public:
void setSelection(int selStartX, int selStartY, int selEndX, int selEndY);
+ void undrawCursor();
+
private:
void drawInput();
+public:
+ int _cursorX, _cursorY;
+ bool _cursorState;
+
+ bool _cursorDirty;
+ Common::Rect _cursorRect;
+ bool _cursorOff;
+
+ int _scrollPos;
+
private:
MacText *_mactext;
const MacFont *_font;
@@ -72,6 +95,7 @@ private:
int _maxWidth;
Common::String _inputText;
uint _inputTextHeight;
+
};
} // End of namespace Graphics
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index 3db9096..77be0ae 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -228,7 +228,7 @@ public:
* @param g See BaseMacWindow.
* @param forceRedraw If true, the borders are guarranteed to redraw.
*/
- bool draw(ManagedSurface *g, bool forceRedraw = false);
+ virtual bool draw(ManagedSurface *g, bool forceRedraw = false);
/**
* Mutator to change the active state of the window.
@@ -285,10 +285,7 @@ public:
*/
void setCloseable(bool closeable);
- WindowClick isInBorder(int x, int y);
-
private:
- void drawBorder();
void prepareBorderSurface(ManagedSurface *g);
void drawSimpleBorder(ManagedSurface *g);
void drawBorderFromSurface(ManagedSurface *g);
@@ -302,10 +299,17 @@ private:
bool isInResizeButton(int x, int y);
WindowClick isInScroll(int x, int y);
-private:
+protected:
+ void drawBorder();
+ WindowClick isInBorder(int x, int y);
+
+protected:
ManagedSurface _borderSurface;
ManagedSurface _composeSurface;
+ bool _borderIsDirty;
+
+private:
MacWindowBorder _macBorder;
int _pattern;
@@ -314,7 +318,6 @@ private:
bool _scrollable;
bool _resizable;
bool _active;
- bool _borderIsDirty;
bool _closeable;
Commit: c2944fb5b8912b2d1c1e9207116f249efa46b5ac
https://github.com/scummvm/scummvm/commit/c2944fb5b8912b2d1c1e9207116f249efa46b5ac
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Simplified cursor code is MacTextWindow
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index c4395cd..cf2702a 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -49,6 +49,11 @@ MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgco
_cursorState = false;
_cursorOff = false;
+ _cursorRect = new Common::Rect(0, 0, 1, kCursorHeight);
+
+ _cursorSurface = new ManagedSurface(1, kCursorHeight);
+ _cursorSurface->fillRect(*_cursorRect, kColorBlack);
+
g_system->getTimerManager()->installTimerProc(&cursorTimerHandler, 200000, this, "textWindowCursor");
}
@@ -76,6 +81,8 @@ void MacTextWindow::setSelection(int selStartX, int selStartY, int selEndX, int
}
MacTextWindow::~MacTextWindow() {
+ delete _cursorSurface;
+
g_system->getTimerManager()->removeTimerProc(&cursorTimerHandler);
}
@@ -100,6 +107,10 @@ bool MacTextWindow::draw(ManagedSurface *g, bool forceRedraw) {
// Compose
_composeSurface.blitFrom(_surface, Common::Rect(0, 0, _surface.w - 2, _surface.h - 2), Common::Point(2, 2));
+
+ if (_cursorState)
+ _composeSurface.blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX, _cursorY));
+
_composeSurface.transBlitFrom(_borderSurface, kColorGreen);
g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left - 2, _dims.top - 2), kColorGreen2);
@@ -158,7 +169,6 @@ void MacTextWindow::drawInput() {
_cursorY = _mactext->getTextHeight() - kCursorHeight * 2;
else
_cursorY = _mactext->getTextHeight() - kCursorHeight;
-
}
//////////////////
@@ -166,39 +176,15 @@ void MacTextWindow::drawInput() {
static void cursorTimerHandler(void *refCon) {
MacTextWindow *w = (MacTextWindow *)refCon;
- int x = w->_cursorX;
- int y = w->_cursorY;
-
- if (x == 0 && y == 0)
- return;
-
- x += w->getInnerDimensions().left;
- y += w->getInnerDimensions().top;
- int h = kCursorHeight;
-
- if (y + h > w->getInnerDimensions().bottom) {
- h = w->getInnerDimensions().bottom - y;
- }
-
- if (h > 0)
- w->getSurface()->vLine(x, y, y + h, w->_cursorState ? kColorBlack : kColorWhite);
-
if (!w->_cursorOff)
w->_cursorState = !w->_cursorState;
- w->_cursorRect.left = x;
- w->_cursorRect.right = MIN<uint16>(x + 1, w->getInnerDimensions().right);
- w->_cursorRect.top = MIN<uint16>(y - 1, w->getInnerDimensions().top);
- w->_cursorRect.bottom = MIN<uint16>(y + h, w->getInnerDimensions().bottom);
-
w->_cursorDirty = true;
}
void MacTextWindow::undrawCursor() {
- _cursorOff = true;
_cursorState = false;
- cursorTimerHandler(this);
- _cursorOff = false;
+ _cursorDirty = true;
}
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 0e48122..58cd0db 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -80,7 +80,7 @@ public:
bool _cursorState;
bool _cursorDirty;
- Common::Rect _cursorRect;
+ Common::Rect *_cursorRect;
bool _cursorOff;
int _scrollPos;
@@ -90,6 +90,8 @@ private:
const MacFont *_font;
const Font *_fontRef;
+ ManagedSurface *_cursorSurface;
+
SelectedText _selectedText;
int _maxWidth;
Commit: 94a0eadd308dd6cc21dd6102886fcf767df37c66
https://github.com/scummvm/scummvm/commit/94a0eadd308dd6cc21dd6102886fcf767df37c66
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Added hack for fixing cursor position in MacTextWindow
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index cf2702a..3bb626b 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -109,7 +109,7 @@ bool MacTextWindow::draw(ManagedSurface *g, bool forceRedraw) {
_composeSurface.blitFrom(_surface, Common::Rect(0, 0, _surface.w - 2, _surface.h - 2), Common::Point(2, 2));
if (_cursorState)
- _composeSurface.blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX, _cursorY));
+ _composeSurface.blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX + 20, _cursorY + 20));
_composeSurface.transBlitFrom(_borderSurface, kColorGreen);
Commit: e832f1d650fbd66c5a180903d06b089b30bc2a07
https://github.com/scummvm/scummvm/commit/e832f1d650fbd66c5a180903d06b089b30bc2a07
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Update cursor position as text being added to MacTextWindow
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 3bb626b..19e1b7d 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -39,7 +39,7 @@ MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgco
_fontRef = wm->_fontMan->getFont(*font);
- _inputTextHeight = 0;
+ _inputTextHeight = 1;
_maxWidth = maxWidth;
_scrollPos = 0;
@@ -49,6 +49,8 @@ MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgco
_cursorState = false;
_cursorOff = false;
+ _cursorDirty = true;
+
_cursorRect = new Common::Rect(0, 0, 1, kCursorHeight);
_cursorSurface = new ManagedSurface(1, kCursorHeight);
@@ -63,14 +65,20 @@ void MacTextWindow::drawText(ManagedSurface *g, int x, int y, int w, int h, int
void MacTextWindow::appendText(Common::String str, int id, int size, int slant) {
_mactext->appendText(str, id, size, slant);
+
+ updateCursorPos();
}
void MacTextWindow::appendText(Common::String str, const MacFont *macFont) {
_mactext->appendText(str, macFont->getId(), macFont->getSize(), macFont->getSlant());
+
+ updateCursorPos();
}
void MacTextWindow::clearText() {
_mactext->clearText();
+
+ updateCursorPos();
}
void MacTextWindow::setSelection(int selStartX, int selStartY, int selEndX, int selEndY) {
@@ -165,10 +173,7 @@ void MacTextWindow::drawInput() {
_cursorX = _fontRef->getStringWidth(text[_inputTextHeight - 1]);
- if (_scrollPos)
- _cursorY = _mactext->getTextHeight() - kCursorHeight * 2;
- else
- _cursorY = _mactext->getTextHeight() - kCursorHeight;
+ updateCursorPos();
}
//////////////////
@@ -182,6 +187,13 @@ static void cursorTimerHandler(void *refCon) {
w->_cursorDirty = true;
}
+void MacTextWindow::updateCursorPos() {
+ if (_scrollPos)
+ _cursorY = _mactext->getTextHeight() - kCursorHeight * 2;
+ else
+ _cursorY = _mactext->getTextHeight() - kCursorHeight;
+}
+
void MacTextWindow::undrawCursor() {
_cursorState = false;
_cursorDirty = true;
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 58cd0db..ddd6c44 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -74,6 +74,7 @@ public:
private:
void drawInput();
+ void updateCursorPos();
public:
int _cursorX, _cursorY;
Commit: 3e96a0909d4c96f3994e6f3115c22ffdb28562dd
https://github.com/scummvm/scummvm/commit/3e96a0909d4c96f3994e6f3115c22ffdb28562dd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Replace magic numbers with named constants
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 19e1b7d..bba4929 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -29,6 +29,14 @@
namespace Graphics {
+enum {
+ kConWOverlap = 20,
+ kConHOverlap = 20,
+ kConWPadding = 3,
+ kConHPadding = 4,
+ kConOverscan = 3
+};
+
static void cursorTimerHandler(void *refCon);
MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment) :
@@ -117,7 +125,7 @@ bool MacTextWindow::draw(ManagedSurface *g, bool forceRedraw) {
_composeSurface.blitFrom(_surface, Common::Rect(0, 0, _surface.w - 2, _surface.h - 2), Common::Point(2, 2));
if (_cursorState)
- _composeSurface.blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX + 20, _cursorY + 20));
+ _composeSurface.blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX + kConWOverlap, _cursorY + kConHOverlap));
_composeSurface.transBlitFrom(_borderSurface, kColorGreen);
Commit: 81c26caaf86f439ed3f1699f13252afd45c52e18
https://github.com/scummvm/scummvm/commit/81c26caaf86f439ed3f1699f13252afd45c52e18
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Exposed input text from the MacTextWindow
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index bba4929..d7c97c0 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -184,6 +184,13 @@ void MacTextWindow::drawInput() {
updateCursorPos();
}
+void MacTextWindow::clearInput() {
+ undrawCursor();
+
+ _cursorX = 0;
+ _inputText.clear();
+}
+
//////////////////
// Cursor stuff
static void cursorTimerHandler(void *refCon) {
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index ddd6c44..00bca8b 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -72,6 +72,9 @@ public:
void undrawCursor();
+ const Common::String getInput() { return _inputText; }
+ void clearInput();
+
private:
void drawInput();
void updateCursorPos();
Commit: 5149226255279c8e417a3bb9d1a473530c423117
https://github.com/scummvm/scummvm/commit/5149226255279c8e417a3bb9d1a473530c423117
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
WAGE: Started processing of input text from MacTextWindow
Changed paths:
engines/wage/gui-console.cpp
engines/wage/wage.cpp
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index e759883..5b61318 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -330,9 +330,7 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
rr.bottom = _screen.h - 1;
#ifdef USE_MACTEXTWINDOW
- _consoleWindow->drawText(&_console, 0, 0,
- boundsR.width(), boundsR.height(),
- boundsR.left + 7, boundsR.top + 7);
+ _consoleWindow->drawText(&_console, 0, 0, boundsR.width(), boundsR.height(), boundsR.left + 7, boundsR.top + 7);
#endif // USE_MACTEXTWINDOW
g->copyRectToSurface(_console, xcon, ycon, boundsR);
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 6205185..64965de 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -177,6 +177,12 @@ void WageEngine::processEvents() {
break;
case Common::KEYCODE_RETURN:
+ _inputText = _gui->_consoleWindow->getInput();
+
+ _gui->appendText(_inputText.c_str());
+
+ _gui->_consoleWindow->clearInput();
+
if (_inputText.empty())
break;
Commit: da9e02cebb8027a38ef10f3c990ae0ae816e0228
https://github.com/scummvm/scummvm/commit/da9e02cebb8027a38ef10f3c990ae0ae816e0228
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Fix crash on backspace in MacTextWindow input
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index d7c97c0..9f8a2e2 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -179,7 +179,7 @@ void MacTextWindow::drawInput() {
// And add new input line to the text
appendText(_inputText, _font);
- _cursorX = _fontRef->getStringWidth(text[_inputTextHeight - 1]);
+ _cursorX = _inputText.empty() ? 0 : _fontRef->getStringWidth(text[_inputTextHeight - 1]);
updateCursorPos();
}
Commit: ebcff3a0aaa47afe6024fa753852a6585e91edf0
https://github.com/scummvm/scummvm/commit/ebcff3a0aaa47afe6024fa753852a6585e91edf0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Do not pass event when ascii characters are pressed
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 9f8a2e2..5d503cb 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -156,6 +156,8 @@ bool MacTextWindow::processEvent(Common::Event &event) {
if (event.kbd.ascii >= 0x20 && event.kbd.ascii <= 0x7f) {
_inputText += (char)event.kbd.ascii;
drawInput();
+
+ return true;
}
break;
Commit: 8643a0835074a05e4ff5db8378a51201953a314f
https://github.com/scummvm/scummvm/commit/8643a0835074a05e4ff5db8378a51201953a314f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
WAGE: Properly add input text to console on Enter
Changed paths:
engines/wage/wage.cpp
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 64965de..8d5a1e0 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -178,6 +178,7 @@ void WageEngine::processEvents() {
case Common::KEYCODE_RETURN:
_inputText = _gui->_consoleWindow->getInput();
+ _inputText += '\n';
_gui->appendText(_inputText.c_str());
Commit: 2c0b73aaeff80d715b1dbb979ff720005d8b9ed2
https://github.com/scummvm/scummvm/commit/2c0b73aaeff80d715b1dbb979ff720005d8b9ed2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Set MacTextWindow as active when keys are pressed
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 5d503cb..d57fdf8 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -138,6 +138,8 @@ bool MacTextWindow::processEvent(Common::Event &event) {
WindowClick click = isInBorder(event.mouse.x, event.mouse.y);
if (event.type == Common::EVENT_KEYDOWN) {
+ _wm->setActive(getId());
+
switch (event.kbd.keycode) {
case Common::KEYCODE_BACKSPACE:
if (!_inputText.empty()) {
Commit: 8319e4093fe204743736ae7bac28f810b9034533
https://github.com/scummvm/scummvm/commit/8319e4093fe204743736ae7bac28f810b9034533
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Force redraw of dirty part of MacTextWindow
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index d57fdf8..fb2b167 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -186,6 +186,8 @@ void MacTextWindow::drawInput() {
_cursorX = _inputText.empty() ? 0 : _fontRef->getStringWidth(text[_inputTextHeight - 1]);
updateCursorPos();
+
+ _contentIsDirty = true;
}
void MacTextWindow::clearInput() {
@@ -211,6 +213,8 @@ void MacTextWindow::updateCursorPos() {
_cursorY = _mactext->getTextHeight() - kCursorHeight * 2;
else
_cursorY = _mactext->getTextHeight() - kCursorHeight;
+
+ _cursorDirty = true;
}
void MacTextWindow::undrawCursor() {
Commit: a5c99c99f56307be77722d778c3c014a5845ac4a
https://github.com/scummvm/scummvm/commit/a5c99c99f56307be77722d778c3c014a5845ac4a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Remove redundant method from MacTextWindow
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index fb2b167..e238c50 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -71,12 +71,6 @@ void MacTextWindow::drawText(ManagedSurface *g, int x, int y, int w, int h, int
_mactext->draw(g, x, y, w, h, xoff, yoff);
}
-void MacTextWindow::appendText(Common::String str, int id, int size, int slant) {
- _mactext->appendText(str, id, size, slant);
-
- updateCursorPos();
-}
-
void MacTextWindow::appendText(Common::String str, const MacFont *macFont) {
_mactext->appendText(str, macFont->getId(), macFont->getSize(), macFont->getSlant());
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 00bca8b..db9b5a1 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -64,7 +64,6 @@ public:
const MacFont *getTextWindowFont();
void drawText(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff);
- void appendText(Common::String str, int fontId = kMacFontChicago, int fontSize = 12, int fontSlant = kMacFontRegular);
void appendText(Common::String str, const MacFont *macFont);
void clearText();
Commit: f7ba4f1b0baeafba04a736bbe8f1249884a0d21a
https://github.com/scummvm/scummvm/commit/f7ba4f1b0baeafba04a736bbe8f1249884a0d21a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Properly process border dragging in MacTextWindow
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index e238c50..862bce2 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -160,7 +160,7 @@ bool MacTextWindow::processEvent(Common::Event &event) {
}
}
- return false;
+ return MacWindow::processEvent(event);
}
void MacTextWindow::drawInput() {
Commit: 63e9f41f4e1a10574e999cac63f1b1c5351037d3
https://github.com/scummvm/scummvm/commit/63e9f41f4e1a10574e999cac63f1b1c5351037d3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
WAGE: Simplified text adding to MacTextWindow
Changed paths:
engines/wage/gui-console.cpp
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index 5b61318..16da99f 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -108,11 +108,8 @@ void Gui::appendText(const char *s) {
_out.push_back(tmp);
flowText(tmp);
-#ifdef USE_MACTEXTWINDOW
- // Append _lines content to MacTextWindow after it has
- // been processed by flowText above
- for (uint line = 0; line < _lines.size(); ++line)
- _consoleWindow->appendText(_lines[line], getConsoleMacFont());
+#ifdef USE_MACTEXTWINDOW1
+ _consoleWindow->appendText(s, getConsoleMacFont());
#endif // USE_MACTEXTWINDOW
}
Commit: 48f07f027655c231117142d012c8d7fdc6808cbd
https://github.com/scummvm/scummvm/commit/48f07f027655c231117142d012c8d7fdc6808cbd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Render MacTextWindow internally
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 862bce2..b02fe56 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -110,13 +110,16 @@ bool MacTextWindow::draw(ManagedSurface *g, bool forceRedraw) {
if (!_borderIsDirty && !_contentIsDirty && !_cursorDirty && !forceRedraw)
return false;
- if (_borderIsDirty || forceRedraw)
+ if (_borderIsDirty || forceRedraw) {
drawBorder();
+ _composeSurface.clear(kColorWhite);
+ }
+
_contentIsDirty = false;
// Compose
- _composeSurface.blitFrom(_surface, Common::Rect(0, 0, _surface.w - 2, _surface.h - 2), Common::Point(2, 2));
+ _mactext->draw(&_composeSurface, 0, 0, _surface.w - 2, _surface.h - 2, kConWOverlap - 2, kConWOverlap - 2);
if (_cursorState)
_composeSurface.blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX + kConWOverlap, _cursorY + kConHOverlap));
@@ -206,7 +209,7 @@ void MacTextWindow::updateCursorPos() {
if (_scrollPos)
_cursorY = _mactext->getTextHeight() - kCursorHeight * 2;
else
- _cursorY = _mactext->getTextHeight() - kCursorHeight;
+ _cursorY = _mactext->getTextHeight() - kCursorHeight - 2;
_cursorDirty = true;
}
Commit: 2f5b1f08efe697287c3e28c2cf97eb31996f23a9
https://github.com/scummvm/scummvm/commit/2f5b1f08efe697287c3e28c2cf97eb31996f23a9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
WAGE: Render console text in MacTextWindow
Changed paths:
engines/wage/gui-console.cpp
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index 16da99f..c2f1753 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -203,12 +203,14 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
const Graphics::Font *font = getConsoleFont();
_consoleLineHeight = font->getFontHeight();
- int textW = r.width() - kConWPadding * 2;
- int textH = r.height() - kConHPadding * 2;
if (textReflow)
reflowText();
+#ifndef USE_MACTEXTWINDOW
+ int textW = r.width() - kConWPadding * 2;
+ int textH = r.height() - kConHPadding * 2;
+
const int firstLine = _scrollPos / _consoleLineHeight;
const int lastLine = MIN((_scrollPos + textH) / _consoleLineHeight + 1, _lines.size());
const int xOff = kConWOverlap;
@@ -219,8 +221,6 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
if (fullRedraw)
_consoleNumLines = (r.height() - 2 * kConWPadding) / _consoleLineHeight - 2;
-#ifndef USE_MACTEXTWINDOW
-
for (int line = firstLine; line < lastLine; line++) {
const char *str = _lines[line].c_str();
int color = kColorBlack;
@@ -302,8 +302,6 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
y1 += _consoleLineHeight;
}
-#endif
-
// Now we need to clip it to the screen
int xcon = r.left - kConOverscan;
int ycon = r.top - kConOverscan;
@@ -326,11 +324,8 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
if (rr.bottom > _screen.h - 1)
rr.bottom = _screen.h - 1;
-#ifdef USE_MACTEXTWINDOW
- _consoleWindow->drawText(&_console, 0, 0, boundsR.width(), boundsR.height(), boundsR.left + 7, boundsR.top + 7);
-#endif // USE_MACTEXTWINDOW
-
g->copyRectToSurface(_console, xcon, ycon, boundsR);
+#endif
}
void Gui::drawInput() {
Commit: 115a7407e974198450cc7bffeaf664c98c44f72a
https://github.com/scummvm/scummvm/commit/115a7407e974198450cc7bffeaf664c98c44f72a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: Keep original string in MacText
Changed paths:
graphics/macgui/mactext.cpp
graphics/macgui/mactext.h
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index fe6cf4e..b2ea784 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -37,6 +37,15 @@ const Font *MacFontRun::getFont() {
return font;
}
+const Common::String MacFontRun::toString() {
+ return Common::String::format("\001\015%c%c%c%c%c%c%c%c%c%c%c%c",
+ (fontId >> 8) & 0xff, fontId & 0xff,
+ textSlant & 0xff, unk3f & 0xff,
+ (fontSize >> 8) & 0xff, fontSize & 0xff,
+ (palinfo1 >> 8) & 0xff, palinfo1 & 0xff,
+ (palinfo2 >> 8) & 0xff, palinfo2 & 0xff,
+ (palinfo3 >> 8) & 0xff, palinfo3 & 0xff);
+}
MacText::~MacText(){
delete _macFont;
@@ -370,6 +379,9 @@ void MacText::appendText(Common::String str, int fontId = kMacFontChicago, int f
MacFontRun fontRun = MacFontRun(_wm, fontId, fontSlant, 0, fontSize, 0, 0, 0);
+ _str += fontRun.toString();
+ _str += str;
+
resizeAndFormatLines(newLines, &fontRun);
splitString(str);
@@ -382,6 +394,9 @@ void MacText::appendTextDefault(Common::String str) {
uint oldLen = _textLines.size();
uint newLines = 1 + getNewlinesInString(str);
+ _str += _defaultFormatting.toString();
+ _str += str;
+
resizeAndFormatLines(newLines, &_defaultFormatting);
splitString(str);
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 2f001f7..1cdb0d3 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -71,6 +71,8 @@ struct MacFontRun {
}
const Font *getFont();
+
+ const Common::String toString();
};
struct MacTextLine {
Commit: 73c5c85210d47829d933dc8a10a7bda772569fa4
https://github.com/scummvm/scummvm/commit/73c5c85210d47829d933dc8a10a7bda772569fa4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
DIRECTOR: Clarified STXT field names
Changed paths:
engines/director/stxt.cpp
diff --git a/engines/director/stxt.cpp b/engines/director/stxt.cpp
index 5d5515b..071a629 100644
--- a/engines/director/stxt.cpp
+++ b/engines/director/stxt.cpp
@@ -47,22 +47,22 @@ Stxt::Stxt(Common::SeekableSubReadStreamEndian &textStream) {
while (formattingCount) {
uint32 formatStartOffset = textStream.readUint32();
- uint16 unk1f = textStream.readUint16();
- uint16 unk2f = textStream.readUint16();
+ uint16 height = textStream.readUint16();
+ uint16 ascent = textStream.readUint16();
_fontId = textStream.readUint16();
_textSlant = textStream.readByte();
- byte unk3f = textStream.readByte();
+ byte padding = textStream.readByte();
_fontSize = textStream.readUint16();
_palinfo1 = textStream.readUint16();
_palinfo2 = textStream.readUint16();
_palinfo3 = textStream.readUint16();
- debugC(3, kDebugText, "Stxt init: formattingCount: %u, formatStartOffset: %d, unk1: %d unk2: %d, fontId: %d, textSlant: %d",
- formattingCount, formatStartOffset, unk1f, unk2f, _fontId, _textSlant);
+ debugC(3, kDebugText, "Stxt init: formattingCount: %u, formatStartOffset: %d, height: %d ascent: %d, fontId: %d, textSlant: %d",
+ formattingCount, formatStartOffset, height, ascent, _fontId, _textSlant);
- debugC(3, kDebugText, " unk3: %d, fontSize: %d, p0: %x p1: %x p2: %x", unk3f, _fontSize, _palinfo1, _palinfo2, _palinfo3);
+ debugC(3, kDebugText, " fontSize: %d, p0: %x p1: %x p2: %x", _fontSize, _palinfo1, _palinfo2, _palinfo3);
assert(prevPos <= formatStartOffset); // If this is triggered, we have to implement sorting
@@ -81,9 +81,9 @@ Stxt::Stxt(Common::SeekableSubReadStreamEndian &textStream) {
debugCN(4, kDebugText, "*");
- _ftext += Common::String::format("\001\015%c%c%c%c%c%c%c%c%c%c%c%c",
+ _ftext += Common::String::format("\001\015%c%c%c%c%c%c%c%c%c%c%c",
(_fontId >> 8) & 0xff, _fontId & 0xff,
- _textSlant & 0xff, unk3f & 0xff,
+ _textSlant & 0xff,
(_fontSize >> 8) & 0xff, _fontSize & 0xff,
(_palinfo1 >> 8) & 0xff, _palinfo1 & 0xff,
(_palinfo2 >> 8) & 0xff, _palinfo2 & 0xff,
Commit: b02d9a017477647de78b4ab682b870b6e93c9fe3
https://github.com/scummvm/scummvm/commit/b02d9a017477647de78b4ab682b870b6e93c9fe3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-01T10:42:22+02:00
Commit Message:
GRAPHICS: MACGUI: unk3f is not needed in MacText
Changed paths:
graphics/macgui/mactext.cpp
graphics/macgui/mactext.h
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index b2ea784..ea02e9e 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -38,9 +38,9 @@ const Font *MacFontRun::getFont() {
}
const Common::String MacFontRun::toString() {
- return Common::String::format("\001\015%c%c%c%c%c%c%c%c%c%c%c%c",
+ return Common::String::format("\001\015%c%c%c%c%c%c%c%c%c%c%c",
(fontId >> 8) & 0xff, fontId & 0xff,
- textSlant & 0xff, unk3f & 0xff,
+ textSlant & 0xff,
(fontSize >> 8) & 0xff, fontSize & 0xff,
(palinfo1 >> 8) & 0xff, palinfo1 & 0xff,
(palinfo2 >> 8) & 0xff, palinfo2 & 0xff,
@@ -119,17 +119,16 @@ void MacText::splitString(Common::String &str) {
uint16 fontId = *s++; fontId = (fontId << 8) | *s++;
byte textSlant = *s++;
- byte unk3f = *s++;
uint16 fontSize = *s++; fontSize = (fontSize << 8) | *s++;
uint16 palinfo1 = *s++; palinfo1 = (palinfo1 << 8) | *s++;
uint16 palinfo2 = *s++; palinfo2 = (palinfo2 << 8) | *s++;
uint16 palinfo3 = *s++; palinfo3 = (palinfo3 << 8) | *s++;
- debug(8, "******** splitString: fontId: %d, textSlant: %d, unk3: %d, fontSize: %d, p0: %x p1: %x p2: %x",
- fontId, textSlant, unk3f, fontSize, palinfo1, palinfo2, palinfo3);
+ debug(8, "******** splitString: fontId: %d, textSlant: %d, fontSize: %d, p0: %x p1: %x p2: %x",
+ fontId, textSlant, fontSize, palinfo1, palinfo2, palinfo3);
previousFormatting = _currentFormatting;
- _currentFormatting.setValues(_wm, fontId, textSlant, unk3f, fontSize, palinfo1, palinfo2, palinfo3);
+ _currentFormatting.setValues(_wm, fontId, textSlant, fontSize, palinfo1, palinfo2, palinfo3);
if (curLine == 0 && curChunk == 0 && tmp.empty())
previousFormatting = _currentFormatting;
@@ -377,7 +376,7 @@ void MacText::appendText(Common::String str, int fontId = kMacFontChicago, int f
uint oldLen = _textLines.size();
uint newLines = 1 + getNewlinesInString(str);
- MacFontRun fontRun = MacFontRun(_wm, fontId, fontSlant, 0, fontSize, 0, 0, 0);
+ MacFontRun fontRun = MacFontRun(_wm, fontId, fontSlant, fontSize, 0, 0, 0);
_str += fontRun.toString();
_str += str;
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 1cdb0d3..fdb90d4 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -36,7 +36,6 @@ struct MacFontRun {
uint16 fontId;
byte textSlant;
- byte unk3f;
uint16 fontSize;
uint16 palinfo1;
uint16 palinfo2;
@@ -47,22 +46,21 @@ struct MacFontRun {
MacFontRun() {
wm = nullptr;
- fontId = textSlant = unk3f = fontSize = 0;
+ fontId = textSlant = fontSize = 0;
palinfo1 = palinfo2 = palinfo3 = 0;
font = nullptr;
}
- MacFontRun(MacWindowManager *wm_, uint16 fontId_, byte textSlant_, byte unk3f_, uint16 fontSize_,
+ MacFontRun(MacWindowManager *wm_, uint16 fontId_, byte textSlant_, uint16 fontSize_,
uint16 palinfo1_, uint16 palinfo2_, uint16 palinfo3_) {
- setValues(wm_, fontId_, textSlant_, unk3f_, fontSize_, palinfo1_, palinfo2_, palinfo3_);
+ setValues(wm_, fontId_, textSlant_, fontSize_, palinfo1_, palinfo2_, palinfo3_);
}
- void setValues(MacWindowManager *wm_, uint16 fontId_, byte textSlant_, byte unk3f_, uint16 fontSize_,
+ void setValues(MacWindowManager *wm_, uint16 fontId_, byte textSlant_, uint16 fontSize_,
uint16 palinfo1_, uint16 palinfo2_, uint16 palinfo3_) {
wm = wm_;
fontId = fontId_;
textSlant = textSlant_;
- unk3f = unk3f_;
fontSize = fontSize_;
palinfo1 = palinfo1_;
palinfo2 = palinfo2_;
More information about the Scummvm-git-logs
mailing list