[Scummvm-git-logs] scummvm master -> 934719321ed8a938a17acde96fe9296ab01924d0
mgerhardy
noreply at scummvm.org
Sat Oct 5 11:18:52 UTC 2024
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3ced0bacdf TWINE: renamed a few variables and function in the text code
3e7134f401 TWINE: renamed text related methods to match original sources
4453d04864 TWINE: renamed text related vars and methods to match the original sources
ff23c1d5c5 TWINE: add dirty rects for rendering lines
934719321e TWINE: fixed position of inventory item box
Commit: 3ced0bacdf022bdacebb0f9aa2cfef8dd476ff5e
https://github.com/scummvm/scummvm/commit/3ced0bacdf022bdacebb0f9aa2cfef8dd476ff5e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-05T13:14:25+02:00
Commit Message:
TWINE: renamed a few variables and function in the text code
also added comments about original function names
Changed paths:
engines/twine/menu/menu.cpp
engines/twine/scene/gamestate.cpp
engines/twine/text.cpp
engines/twine/text.h
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index c01b8ec06cc..ed73063b498 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -1363,7 +1363,7 @@ void Menu::processInventoryMenu() {
_engine->_text->setFontCrossColor(COLOR_BRIGHT_BLUE);
_engine->_text->initDialogueBox();
- ProgressiveTextState textState = ProgressiveTextState::ContinueRunning;
+ ProgressiveTextState dialstate = ProgressiveTextState::ContinueRunning;
bool updateItemText = true;
ScopedCursor scopedCursor(_engine);
@@ -1429,24 +1429,24 @@ void Menu::processInventoryMenu() {
} else {
_engine->_text->initInventoryText(InventoryItems::MaxInventoryItems);
}
- textState = ProgressiveTextState::ContinueRunning;
+ dialstate = ProgressiveTextState::ContinueRunning;
updateItemText = false;
}
- if (textState == ProgressiveTextState::ContinueRunning) {
- textState = _engine->_text->updateProgressiveText();
+ if (dialstate == ProgressiveTextState::ContinueRunning) {
+ dialstate = _engine->_text->nextDialChar();
} else {
_engine->_text->fadeInRemainingChars();
}
if (_engine->_input->toggleActionIfActive(TwinEActionType::UINextPage)) {
// restart the item description to appear from the beginning
- if (textState == ProgressiveTextState::End) {
+ if (dialstate == ProgressiveTextState::End) {
updateItemText = true;
}
- if (textState == ProgressiveTextState::NextPage) {
+ if (dialstate == ProgressiveTextState::NextPage) {
_engine->_text->initInventoryDialogueBox();
- textState = ProgressiveTextState::ContinueRunning;
+ dialstate = ProgressiveTextState::ContinueRunning;
}
}
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index d9cddbdae21..2b061ff0578 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -428,7 +428,7 @@ void GameState::doFoundObj(InventoryItems item) {
if (textState == ProgressiveTextState::ContinueRunning) {
_engine->_interface->unsetClip();
- textState = _engine->_text->updateProgressiveText();
+ textState = _engine->_text->nextDialChar();
} else {
_engine->_text->fadeInRemainingChars();
}
diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index 41d78d7d9ec..94ee7849434 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -177,7 +177,7 @@ void Text::initSceneTextBank() {
initDial((TextBankId)(textBankId + (int)TextBankId::Citadel_Island));
}
-void Text::drawCharacter(int32 x, int32 y, uint16 character) {
+void Text::drawCharacter(int32 x, int32 y, uint16 character) { // CarFont
const uint8 usedColor = _dialTextColor;
if (_isShiftJIS && character > 0x100 && _engine->_resources->_sjisFontPtr) {
@@ -257,7 +257,7 @@ void Text::drawCharacter(int32 x, int32 y, uint16 character) {
}
}
-void Text::drawCharacterShadow(int32 x, int32 y, uint16 character, int32 color, Common::Rect &dirtyRect) {
+void Text::drawCharacterShadow(int32 x, int32 y, uint16 character, int32 color, Common::Rect &dirtyRect) { // AffOneCar
if (character == ' ') {
return;
}
@@ -346,14 +346,14 @@ void Text::initDialogueBox() {
_engine->_interface->drawTransparentBox(rect, 3);
}
- _fadeInCharactersPos = 0;
+ _nbChar = 0;
_engine->blitFrontToWork(_dialTextBox);
}
// TODO: this blits a few pixels too much when switching an item in the inventory menu.
void Text::initInventoryDialogueBox() { // SecondInitDialWindow
_engine->blitWorkToFront(_dialTextBox);
- _fadeInCharactersPos = 0;
+ _nbChar = 0;
}
void Text::initInventoryText(InventoryItems index) { // OpenDialNoWindow
@@ -378,7 +378,7 @@ void Text::initText(TextId index) {
_dialTextBoxCurrentLine = 0;
_progressiveTextBuffer[0].chr = '\0';
_progressiveTextBuffer[0].x = 0;
- _fadeInCharactersPos = 0;
+ _nbChar = 0;
_dialTextBaseXPos = _dialTextBox.left + PADDING;
_dialTextYPos = _dialTextBox.top + PADDING;
_currentTextPosition = _currDialTextPtr;
@@ -404,24 +404,21 @@ void Text::initProgressiveTextBuffer() {
_dialTextBoxCurrentLine = 0;
}
-void Text::fillFadeInBuffer(int16 baseX, int16 y, const LineCharacter &chr) {
- if (_fadeInCharactersPos < TEXT_MAX_FADE_IN_CHR) {
- _fadeInCharacters[_fadeInCharactersPos].chr = chr.chr;
- _fadeInCharacters[_fadeInCharactersPos].x = baseX + chr.x;
- _fadeInCharacters[_fadeInCharactersPos].y = y;
- _fadeInCharactersPos++;
+void Text::pushChar(int16 baseX, int16 y, const LineCharacter &chr) {
+ if (_nbChar < TEXT_MAX_FADE_IN_CHR) {
+ _stackChar[_nbChar].chr = chr.chr;
+ _stackChar[_nbChar].x = baseX + chr.x;
+ _stackChar[_nbChar].y = y;
+ _nbChar++;
return;
}
- int32 counter2 = 0;
- while (counter2 < TEXT_MAX_FADE_IN_CHR - 1) {
- const int32 var1 = (counter2 + 1);
- const int32 var2 = counter2;
- _fadeInCharacters[var2] = _fadeInCharacters[var1];
- counter2++;
+ int32 i = 0;
+ for (i = 0; i < TEXT_MAX_FADE_IN_CHR - 1; ++i) {
+ _stackChar[i] = _stackChar[i + 1];
}
- _fadeInCharacters[TEXT_MAX_FADE_IN_CHR - 1].chr = chr.chr;
- _fadeInCharacters[TEXT_MAX_FADE_IN_CHR - 1].x = baseX + chr.x;
- _fadeInCharacters[TEXT_MAX_FADE_IN_CHR - 1].y = y;
+ _stackChar[TEXT_MAX_FADE_IN_CHR - 1].chr = chr.chr;
+ _stackChar[TEXT_MAX_FADE_IN_CHR - 1].x = baseX + chr.x;
+ _stackChar[TEXT_MAX_FADE_IN_CHR - 1].y = y;
}
Text::WordSize Text::getWordSize(const char *completeText, char *wordBuf, int32 wordBufSize) {
@@ -455,7 +452,7 @@ void Text::appendProgressiveTextBuffer(const char *s, int &x, uint &i) {
i++;
if (chr == ' ') {
- x += _dialCharSpace + 1;
+ x += _dialCharSpace + 1;
} else {
x += getCharWidth(chr) + 2;
}
@@ -580,7 +577,7 @@ void Text::renderContinueReadingTriangle() { // AffFleche
CmdRenderPolygon polygon;
polygon.numVertices = ARRAYSIZE(vertices);
- polygon.colorIndex = _dialTextStopColor;
+ polygon.colorIndex = _minDegrade;
polygon.renderType = POLYGONTYPE_FLAT;
_engine->_renderer->renderPolygons(polygon, vertices);
@@ -590,12 +587,12 @@ void Text::renderContinueReadingTriangle() { // AffFleche
void Text::fadeInCharacters(int32 counter, int32 fontColor) {
Common::Rect dirtyRect;
while (--counter >= 0) {
- const BlendInCharacter *ptr = &_fadeInCharacters[counter];
+ const BlendInCharacter *ptr = &_stackChar[counter];
setFontColor(fontColor);
drawCharacterShadow(ptr->x, ptr->y, ptr->chr, fontColor, dirtyRect);
- fontColor -= _dialTextStepSize;
- if (fontColor > _dialTextStopColor) {
- fontColor = _dialTextStopColor;
+ fontColor -= _stepDegrade;
+ if (fontColor > _minDegrade) {
+ fontColor = _minDegrade;
}
}
if (dirtyRect.isEmpty()) {
@@ -627,14 +624,14 @@ int32 Text::getCharHeight(uint16 chr) const {
}
void Text::fadeInRemainingChars() {
- if (_fadeInCharactersPos <= 0) {
+ if (_nbChar <= 0) {
return;
}
- fadeInCharacters(_fadeInCharactersPos, _dialTextStopColor);
- --_fadeInCharactersPos;
+ fadeInCharacters(_nbChar, _minDegrade);
+ --_nbChar;
}
-ProgressiveTextState Text::updateProgressiveText() { // NextDialCar
+ProgressiveTextState Text::nextDialChar() { // NextDialCar
if (!_hasValidTextHandle) {
return ProgressiveTextState::End;
}
@@ -648,8 +645,8 @@ ProgressiveTextState Text::updateProgressiveText() { // NextDialCar
}
LineCharacter currentChar = *_progressiveTextBufferPtr++;
assert(currentChar.chr != '\0');
- fillFadeInBuffer(_dialTextBaseXPos, _dialTextYPos, currentChar);
- fadeInCharacters(_fadeInCharactersPos, _dialTextStartColor);
+ pushChar(_dialTextBaseXPos, _dialTextYPos, currentChar);
+ fadeInCharacters(_nbChar, _maxDegrade);
// reaching 0-byte means a new line - as we are fading in per line
if (_progressiveTextBufferPtr->chr != '\0') {
@@ -700,7 +697,7 @@ bool Text::displayText(TextId index, bool showText, bool playVox, bool loop) {
FrameMarker frame(_engine, 66);
_engine->readKeys();
if (textState == ProgressiveTextState::ContinueRunning) {
- textState = updateProgressiveText();
+ textState = nextDialChar();
} else {
fadeInRemainingChars();
}
@@ -767,22 +764,22 @@ void Text::setFontParameters(int32 spaceBetween, int32 charSpace) {
_dialCharSpace = charSpace;
}
-void Text::setFontCrossColor(int32 color) { // TestCoulDial
- _dialTextStepSize = -1;
- _dialTextBufferSize = 14;
- _dialTextStartColor = color * 16;
- _dialTextStopColor = _dialTextStartColor + 12;
+void Text::setTextCrossColor(int32 stopColor, int32 startColor, int32 stepSize) { // CoulDial
+ _maxDegrade = startColor;
+ _minDegrade = stopColor;
+ _stepDegrade = stepSize;
+ _nbDegrade = ((startColor - stopColor) + 1) / stepSize;
}
-void Text::setFontColor(int32 color) {
- _dialTextColor = color;
+void Text::setFontCrossColor(int32 color) { // TestCoulDial
+ _stepDegrade = -1;
+ _nbDegrade = 14;
+ _maxDegrade = color * 16;
+ _minDegrade = _maxDegrade + 12;
}
-void Text::setTextCrossColor(int32 stopColor, int32 startColor, int32 stepSize) { // CoulDial
- _dialTextStartColor = startColor;
- _dialTextStopColor = stopColor;
- _dialTextStepSize = stepSize;
- _dialTextBufferSize = ((startColor - stopColor) + 1) / stepSize;
+void Text::setFontColor(int32 color) { // CoulFont
+ _dialTextColor = color;
}
bool Text::getText(TextId index) {
diff --git a/engines/twine/text.h b/engines/twine/text.h
index 1f511f0b263..5ea8c8df8e1 100644
--- a/engines/twine/text.h
+++ b/engines/twine/text.h
@@ -31,6 +31,7 @@ namespace TwinE {
class TextEntry;
+// MAX_CAR
#define TEXT_MAX_FADE_IN_CHR 32
enum class ProgressiveTextState {
@@ -78,12 +79,11 @@ private:
/**
* @see fadeInCharacters
*/
- void fillFadeInBuffer(int16 baseX, int16 y, const LineCharacter &chr);
+ void pushChar(int16 baseX, int16 y, const LineCharacter &chr); // PushCar
/**
* Blend in characters for a text scrolling in
*
- * @see fillFadeInBuffer
- * @param counter The amount of characters to handle - max 32
+ * @see pushChar()
*/
void fadeInCharacters(int32 counter, int32 fontColor);
@@ -104,8 +104,8 @@ private:
int16 x = 0;
int16 y = 0;
};
- BlendInCharacter _fadeInCharacters[TEXT_MAX_FADE_IN_CHR];
- int32 _fadeInCharactersPos = 0;
+ BlendInCharacter _stackChar[TEXT_MAX_FADE_IN_CHR]; // StackCar
+ int32 _nbChar = 0; // NbCar
/** Current dialogue text pointer */
const char *_currDialTextPtr = nullptr;
@@ -124,18 +124,19 @@ private:
int32 _dialTextColor = 0;
/** Dialogue text start color for cross coloring dialogues */
- int32 _dialTextStartColor = 0;
+ int32 _maxDegrade = 0;
/** Dialogue text stop color for cross coloring dialogues */
- int32 _dialTextStopColor = 0;
+ int32 _minDegrade = 0;
/**
* Dialogue text step size for cross coloring dialogues
*
* The speed in which the color reaches it's destination color while fading in.
*/
- int32 _dialTextStepSize = 0;
+ int32 _stepDegrade = 0;
/** Dialogue text buffer size for cross coloring dialogues */
- int32 _dialTextBufferSize = 0;
+ int32 _nbDegrade = 0;
+ // Dial_X1, Dial_Y1
Common::Rect _dialTextBox { 0, 0, 0, 0};
int32 _dialTextBoxLines = 0; // dialogueBoxParam1
@@ -156,7 +157,7 @@ public:
// renders a triangle if the next side of the text can get activated
bool _renderTextTriangle = false;
bool _drawTextBoxBackground = false;
- bool _hasHiddenVox = false; // printTextVar5
+ bool _hasHiddenVox = false;
int32 _voxHiddenIndex = 0;
// ---
@@ -203,7 +204,7 @@ public:
void initInventoryText(InventoryItems index);
void initItemFoundText(InventoryItems index);
void fadeInRemainingChars();
- ProgressiveTextState updateProgressiveText();
+ ProgressiveTextState nextDialChar();
/**
* Set font type parameters
Commit: 3e7134f401ddb2f2b856e1f85680a97ebf372e80
https://github.com/scummvm/scummvm/commit/3e7134f401ddb2f2b856e1f85680a97ebf372e80
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-05T13:14:25+02:00
Commit Message:
TWINE: renamed text related methods to match original sources
Changed paths:
engines/twine/debugger/debug.cpp
engines/twine/holomap_v1.cpp
engines/twine/menu/menu.cpp
engines/twine/menu/menuoptions.cpp
engines/twine/renderer/redraw.cpp
engines/twine/script/script_life.cpp
engines/twine/slideshow.cpp
engines/twine/text.cpp
engines/twine/text.h
engines/twine/twine.cpp
diff --git a/engines/twine/debugger/debug.cpp b/engines/twine/debugger/debug.cpp
index 127ba9f5ee1..812ef0dee72 100644
--- a/engines/twine/debugger/debug.cpp
+++ b/engines/twine/debugger/debug.cpp
@@ -388,7 +388,7 @@ int32 Debug::debugProcessButton(int32 x, int32 y) {
void Debug::debugPlasmaWindow(const char *text, int32 color) {
_engine->_menu->processPlasmaEffect(Common::Rect(0, 0, PLASMA_WIDTH, PLASMA_HEIGHT), color);
- const int32 textSize = _engine->_text->getTextSize(text);
+ const int32 textSize = _engine->_text->sizeFont(text);
_engine->_text->drawText((_engine->width() / 2) - (textSize / 2), 10, text);
const Common::Rect rect(5, 5, _engine->width() - 5, 50);
_engine->_menu->drawRectBorders(rect);
diff --git a/engines/twine/holomap_v1.cpp b/engines/twine/holomap_v1.cpp
index 46109233a3f..bbfdfa17021 100644
--- a/engines/twine/holomap_v1.cpp
+++ b/engines/twine/holomap_v1.cpp
@@ -282,7 +282,7 @@ void HolomapV1::drawHoloMap(uint8 *holomapImage, uint32 holomapImageSize) {
}
void HolomapV1::drawHolomapText(int32 centerx, int32 top, const char *title) {
- const int32 size = _engine->_text->getTextSize(title);
+ const int32 size = _engine->_text->sizeFont(title);
const int32 x = centerx - size / 2;
const int32 y = top;
_engine->_text->setFontColor(COLOR_WHITE);
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index ed73063b498..e681536419a 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -335,7 +335,7 @@ void Menu::drawButtonGfx(const MenuSettings *menuSettings, const Common::Rect &r
_engine->_text->setFontColor(COLOR_WHITE);
_engine->_text->setFontParameters(2, 8);
- const int32 textSize = _engine->_text->getTextSize(dialText);
+ const int32 textSize = _engine->_text->sizeFont(dialText);
_engine->_text->drawText((_engine->width() / 2) - (textSize / 2), rect.top + 7, dialText);
}
@@ -1151,7 +1151,7 @@ void Menu::drawBehaviour(int32 left, int32 top, HeroBehaviourType behaviour, int
char dialText[256];
_engine->_text->getMenuText(_engine->_actor->getTextIdForBehaviour(), dialText, sizeof(dialText));
- _engine->_text->drawText(titleBoxCenter - _engine->_text->getTextSize(dialText) / 2, titleBoxTop + 1, dialText);
+ _engine->_text->drawText(titleBoxCenter - _engine->_text->sizeFont(dialText) / 2, titleBoxTop + 1, dialText);
} else {
_engine->_interface->drawFilledRect(boxRect, COLOR_BLACK);
}
diff --git a/engines/twine/menu/menuoptions.cpp b/engines/twine/menu/menuoptions.cpp
index 9cda9713d17..12a0347244c 100644
--- a/engines/twine/menu/menuoptions.cpp
+++ b/engines/twine/menu/menuoptions.cpp
@@ -213,7 +213,7 @@ void MenuOptions::drawInputText(int32 centerx, int32 top, int32 type, const char
_engine->_menu->drawRectBorders(rect);
_engine->_interface->drawTransparentBox(rectBox, 3);
- _engine->_text->drawText(centerx - _engine->_text->getTextSize(text) / 2, top + 6, text);
+ _engine->_text->drawText(centerx - _engine->_text->sizeFont(text) / 2, top + 6, text);
_engine->copyBlockPhys(rect);
}
@@ -243,7 +243,7 @@ bool MenuOptions::enterText(TextId textIdx, char *textTargetBuf, size_t bufSize)
_engine->_text->getMenuText(textIdx, buffer, sizeof(buffer));
_engine->_text->setFontColor(COLOR_WHITE);
const int halfScreenWidth = (_engine->width() / 2);
- _engine->_text->drawText(halfScreenWidth - (_engine->_text->getTextSize(buffer) / 2), 20, buffer);
+ _engine->_text->drawText(halfScreenWidth - (_engine->_text->sizeFont(buffer) / 2), 20, buffer);
_engine->copyBlockPhys(0, 0, _engine->width() - 1, 99);
Common::fill(&_onScreenKeyboardDirty[0], &_onScreenKeyboardDirty[ARRAYSIZE(_onScreenKeyboardDirty)], 1);
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index abf4abe66b1..c929a431fd1 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -746,7 +746,7 @@ void Redraw::renderOverlays() {
char text[10];
snprintf(text, sizeof(text), "%d", overlay->num);
- const int32 textLength = _engine->_text->getTextSize(text);
+ const int32 textLength = _engine->_text->sizeFont(text);
const int32 textHeight = 48;
Common::Rect renderRect;
@@ -772,7 +772,7 @@ void Redraw::renderOverlays() {
char text[10];
Common::sprintf_s(text, "%d", range);
- const int32 textLength = _engine->_text->getTextSize(text);
+ const int32 textLength = _engine->_text->sizeFont(text);
const int32 textHeight = 48;
Common::Rect renderRect;
@@ -811,7 +811,7 @@ void Redraw::renderOverlays() {
char text[256];
_engine->_text->getMenuText((TextId)overlay->num, text, sizeof(text));
- const int32 textLength = _engine->_text->getTextSize(text);
+ const int32 textLength = _engine->_text->sizeFont(text);
const int32 textHeight = 48;
Common::Rect renderRect;
@@ -865,7 +865,7 @@ void Redraw::renderText() {
const int x = padding;
const int height = _engine->_text->lineHeight;
const int y = _engine->height() - height - padding;
- const int width = _engine->_text->getTextSize(_text.c_str());
+ const int width = _engine->_text->sizeFont(_text.c_str());
_engine->_text->drawText(x, y, _text.c_str(), true);
_engine->copyBlockPhys(x, y, x + width, y + height);
const Common::Rect redraw(x, y, x + width, y + height);
diff --git a/engines/twine/script/script_life.cpp b/engines/twine/script/script_life.cpp
index 4dedfc7c885..f2c4a35cb25 100644
--- a/engines/twine/script/script_life.cpp
+++ b/engines/twine/script/script_life.cpp
@@ -2033,7 +2033,7 @@ int32 ScriptLife::lTEXT(TwinEEngine *engine, LifeScriptContext &ctx) {
char textStr[256];
engine->_text->getMenuText(textIdx, textStr, sizeof(textStr));
- const int32 textSize = engine->_text->getTextSize(textStr);
+ const int32 textSize = engine->_text->sizeFont(textStr);
int32 textBoxRight = textSize;
const int32 textBoxBottom = lTextYPos + textHeight;
engine->_text->setFontColor(COLOR_WHITE);
diff --git a/engines/twine/slideshow.cpp b/engines/twine/slideshow.cpp
index 9c7c42f2266..6a6542b610a 100644
--- a/engines/twine/slideshow.cpp
+++ b/engines/twine/slideshow.cpp
@@ -111,7 +111,7 @@ private:
if (!params.empty()) {
_pal[255] = _pal[15] = 0xffffffff;
_engine->setPalette(_pal);
- const int32 length = _engine->_text->getTextSize(params.c_str());
+ const int32 length = _engine->_text->sizeFont(params.c_str());
const int x = 0;
_engine->_text->drawText(x, _textY, params.c_str());
_engine->_frontVideoBuffer.addDirtyRect(Common::Rect(x, _textY, x + length, _textY + _lineHeight));
@@ -123,7 +123,7 @@ private:
if (!params.empty()) {
_pal[255] = _pal[15] = 0xffffffff;
_engine->setPalette(_pal);
- const int32 length = _engine->_text->getTextSize(params.c_str());
+ const int32 length = _engine->_text->sizeFont(params.c_str());
const int x = _engine->width() - length;
_engine->_text->drawText(x, _textY, params.c_str());
_engine->_frontVideoBuffer.update();
@@ -136,7 +136,7 @@ private:
if (!params.empty()) {
_pal[255] = _pal[15] = 0xffffffff;
_engine->setPalette(_pal);
- const int32 length = _engine->_text->getTextSize(params.c_str());
+ const int32 length = _engine->_text->sizeFont(params.c_str());
const int x = _engine->width() / 2 - length / 2;
_engine->_text->drawText(x, _textY, params.c_str());
_engine->_frontVideoBuffer.addDirtyRect(Common::Rect(x, _textY, x + length, _textY + _lineHeight));
diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index 94ee7849434..83288557b98 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -299,7 +299,7 @@ void Text::drawText(int32 x, int32 y, const char *dialogue, bool shadow) {
}
if (currChar == ' ') {
- x += _dialCharSpace;
+ x += _sizeSpace;
} else {
const int32 dialTextSize = getCharWidth(currChar);
if (shadow) {
@@ -316,7 +316,7 @@ void Text::drawText(int32 x, int32 y, const char *dialogue, bool shadow) {
} while (1);
}
-int32 Text::getTextSize(const char *dialogue) {
+int32 Text::sizeFont(const char *dialogue) {
int32 dialTextSize = 0;
do {
@@ -326,7 +326,7 @@ int32 Text::getTextSize(const char *dialogue) {
}
if (currChar == ' ') {
- dialTextSize += _dialCharSpace;
+ dialTextSize += _sizeSpace;
} else {
dialTextSize += _dialSpaceBetween;
dialTextSize += getCharWidth(currChar);
@@ -375,7 +375,7 @@ void Text::initText(TextId index) {
_hasValidTextHandle = true;
- _dialTextBoxCurrentLine = 0;
+ _nbLineDial = 0;
_progressiveTextBuffer[0].chr = '\0';
_progressiveTextBuffer[0].x = 0;
_nbChar = 0;
@@ -387,13 +387,13 @@ void Text::initText(TextId index) {
setFontParameters(2, 7);
// fetch the first line
- processTextLine();
+ getNextLine();
}
void Text::initProgressiveTextBuffer() {
for (uint i = 0; i < ARRAYSIZE(_progressiveTextBuffer); i++) {
_progressiveTextBuffer[i].chr = ' ';
- _progressiveTextBuffer[i].x = (_dialCharSpace + 1) * i;
+ _progressiveTextBuffer[i].x = (_sizeSpace + 1) * i;
}
// the end of the buffer defines how fast the next page is shown - as the
// whitespaces are handled in the fade in process, too. But we need at least 32 chars,
@@ -401,7 +401,7 @@ void Text::initProgressiveTextBuffer() {
_progressiveTextBuffer[ARRAYSIZE(_progressiveTextBuffer) - 1].chr = '\0';
_progressiveTextBuffer[ARRAYSIZE(_progressiveTextBuffer) - 1].x = 0;
_progressiveTextBufferPtr = _progressiveTextBuffer;
- _dialTextBoxCurrentLine = 0;
+ _nbLineDial = 0;
}
void Text::pushChar(int16 baseX, int16 y, const LineCharacter &chr) {
@@ -421,13 +421,13 @@ void Text::pushChar(int16 baseX, int16 y, const LineCharacter &chr) {
_stackChar[TEXT_MAX_FADE_IN_CHR - 1].y = y;
}
-Text::WordSize Text::getWordSize(const char *completeText, char *wordBuf, int32 wordBufSize) {
+Text::WordSize Text::getNextWord(const char *completeText, char *dst, int32 wordBufSize) {
int32 temp = 0;
- const char *arg2Save = wordBuf;
+ const char *arg2Save = dst;
while (*completeText != '\0' && *completeText != '\1' && *completeText != ' ') {
temp++;
- *wordBuf++ = *completeText++;
+ *dst++ = *completeText++;
if (temp >= wordBufSize - 1) {
break;
}
@@ -435,8 +435,8 @@ Text::WordSize Text::getWordSize(const char *completeText, char *wordBuf, int32
WordSize size;
size.inChar = temp;
- *wordBuf = '\0';
- size.inPixel = getTextSize(arg2Save);
+ *dst = '\0';
+ size.inPixel = sizeFont(arg2Save);
return size;
}
@@ -452,20 +452,19 @@ void Text::appendProgressiveTextBuffer(const char *s, int &x, uint &i) {
i++;
if (chr == ' ') {
- x += _dialCharSpace + 1;
+ x += _sizeSpace + 1;
} else {
x += getCharWidth(chr) + 2;
}
}
}
-
-void Text::processTextLine() {
+void Text::getNextLine() {
const char *buffer = _currentTextPosition;
- _dialCharSpace = 7;
- bool moreWordsFollowing = true;
+ _sizeSpace = INTER_SPACE;
+ bool flag = true;
- int32 lineBreakX = 0;
+ int32 _sizeLine = 0;
int32 spaceCharCount = 0;
int x = 0;
uint i = 0;
@@ -482,41 +481,41 @@ void Text::processTextLine() {
}
_currentTextPosition = buffer;
- char wordBuf[256] = "";
- WordSize wordSize = getWordSize(buffer, wordBuf, sizeof(wordBuf));
- if (lineBreakX + _dialCharSpace + wordSize.inPixel >= _dialTextBoxMaxX) {
+ char ptDial[256] = "";
+ WordSize _sizeWord = getNextWord(buffer, ptDial, sizeof(ptDial));
+ if (_sizeLine + _sizeSpace + _sizeWord.inPixel >= _dialMaxSize) {
break;
}
- if (*wordBuf == '\1') {
- moreWordsFollowing = false;
+ if (*ptDial == '\1') {
+ flag = false;
buffer++;
break;
}
// @ is a line break
- if (*wordBuf == '@') {
- moreWordsFollowing = false;
+ if (*ptDial == '@') {
+ flag = false;
buffer++;
- if (lineBreakX == 0) {
- lineBreakX = 7;
+ if (_sizeLine == 0) {
+ _sizeLine = INTER_SPACE;
appendProgressiveTextBuffer(" ", x, i);
}
// new page?
- if (wordBuf[1] == 'P') {
- _dialTextBoxCurrentLine = _dialTextBoxLines;
+ if (ptDial[1] == 'P') {
+ _nbLineDial = _maxLineDial;
buffer++;
}
break;
}
- buffer += wordSize.inChar;
+ buffer += _sizeWord.inChar;
_currentTextPosition = buffer;
- appendProgressiveTextBuffer(wordBuf, x, i);
+ appendProgressiveTextBuffer(ptDial, x, i);
appendProgressiveTextBuffer(" ", x, i);
spaceCharCount++;
- lineBreakX += wordSize.inPixel + _dialCharSpace;
+ _sizeLine += _sizeWord.inPixel + _sizeSpace;
if (*_currentTextPosition != '\0') {
_currentTextPosition++;
continue;
@@ -539,12 +538,12 @@ void Text::processTextLine() {
spaceCharCount--;
}
- if (*_currentTextPosition != '\0' && moreWordsFollowing) {
+ if (*_currentTextPosition != '\0' && flag) {
if (spaceCharCount <= 0) {
spaceCharCount = 1;
}
// split the remaining space between the words
- _dialCharSpace += (_dialTextBoxMaxX - lineBreakX) / spaceCharCount;
+ _sizeSpace += (_dialMaxSize - _sizeLine) / spaceCharCount;
}
_currentTextPosition = buffer;
@@ -584,7 +583,7 @@ void Text::renderContinueReadingTriangle() { // AffFleche
_engine->copyBlockPhys(left, top, right, bottom);
}
-void Text::fadeInCharacters(int32 counter, int32 fontColor) {
+void Text::fadeInCharacters(int32 counter, int32 fontColor) { // AffAllCar
Common::Rect dirtyRect;
while (--counter >= 0) {
const BlendInCharacter *ptr = &_stackChar[counter];
@@ -638,7 +637,7 @@ ProgressiveTextState Text::nextDialChar() { // NextDialCar
if (_progressiveTextBufferPtr->chr == '\0') {
initProgressiveTextBuffer();
- processTextLine();
+ getNextLine();
initDialogueBox();
_dialTextBaseXPos = _dialTextBox.left + PADDING;
_dialTextYPos = _dialTextBox.top + PADDING;
@@ -660,17 +659,17 @@ ProgressiveTextState Text::nextDialChar() { // NextDialCar
}
// reached a new line that is about get faded in
- _dialTextBoxCurrentLine++;
+ _nbLineDial++;
_dialTextYPos += lineHeight;
_dialTextBaseXPos = _dialTextBox.left + PADDING;
- if (_dialTextBoxCurrentLine >= _dialTextBoxLines) {
+ if (_nbLineDial >= _maxLineDial) {
renderContinueReadingTriangle();
return ProgressiveTextState::NextPage;
}
- processTextLine();
+ getNextLine();
return ProgressiveTextState::ContinueRunning;
}
@@ -761,7 +760,7 @@ bool Text::drawTextProgressive(TextId index, bool playVox, bool loop) { // Dial
void Text::setFontParameters(int32 spaceBetween, int32 charSpace) {
_dialSpaceBetween = spaceBetween;
- _dialCharSpace = charSpace;
+ _sizeSpace = charSpace;
}
void Text::setTextCrossColor(int32 stopColor, int32 startColor, int32 stepSize) { // CoulDial
@@ -830,21 +829,21 @@ void Text::bigWinDial() {
_dialTextBox.right = _engine->width() - margin;
_dialTextBox.bottom = _engine->height() - margin;
- _dialTextBoxLines = (int32)(_dialTextBox.height() / lineHeight) - 1;
- _dialTextBoxMaxX = _engine->width() - 2 * margin - 2 * PADDING;
+ _maxLineDial = (int32)(_dialTextBox.height() / lineHeight) - 1;
+ _dialMaxSize = _engine->width() - 2 * margin - 2 * PADDING;
}
void Text::normalWinDial() {
const int32 margin = 16;
- _dialTextBoxLines = 3;
- const int32 textHeight = _dialTextBoxLines * lineHeight;
+ _maxLineDial = 3;
+ const int32 textHeight = _maxLineDial * lineHeight;
_dialTextBox.left = margin;
_dialTextBox.top = _engine->height() - textHeight - margin - PADDING;
_dialTextBox.right = _engine->width() - margin;
_dialTextBox.bottom = _engine->height() - margin;
- _dialTextBoxMaxX = _engine->width() - 2 * margin - 2 * PADDING;
+ _dialMaxSize = _engine->width() - 2 * margin - 2 * PADDING;
}
void Text::drawAskQuestion(TextId index) {
diff --git a/engines/twine/text.h b/engines/twine/text.h
index 5ea8c8df8e1..981b47ecda7 100644
--- a/engines/twine/text.h
+++ b/engines/twine/text.h
@@ -33,6 +33,9 @@ class TextEntry;
// MAX_CAR
#define TEXT_MAX_FADE_IN_CHR 32
+#define INTER_LINE 38
+#define INTER_SPACE 7
+#define INTER_LEAVE 2
enum class ProgressiveTextState {
End = 0, /**< Text has reached its end and we are waiting for user input */
@@ -70,9 +73,9 @@ private:
int16 chr = 0;
int16 x = 0;
};
- WordSize getWordSize(const char *completeText, char *wordBuf, int32 wordBufSize);
+ WordSize getNextWord(const char *completeText, char *wordBuf, int32 wordBufSize);
uint16 getNextChar(const char *&dialogue);
- void processTextLine();
+ void getNextLine();
void appendProgressiveTextBuffer(const char *s, int &x, uint &i);
// draw next page arrow polygon
void renderContinueReadingTriangle();
@@ -98,7 +101,7 @@ private:
/** Current position of in the buffer of characters that are currently faded in */
const LineCharacter *_progressiveTextBufferPtr = nullptr;
- int32 _dialTextBoxCurrentLine = 0;
+ int32 _nbLineDial = 0;
struct BlendInCharacter {
int16 chr = 0;
int16 x = 0;
@@ -119,7 +122,7 @@ private:
/** Pixel size between dialogue text */
int32 _dialSpaceBetween = 0;
/** Pixel size of the space character - recalculated per per line */
- int32 _dialCharSpace = 0;
+ int32 _sizeSpace = 0;
/** Dialogue text color */
int32 _dialTextColor = 0;
@@ -139,8 +142,8 @@ private:
// Dial_X1, Dial_Y1
Common::Rect _dialTextBox { 0, 0, 0, 0};
- int32 _dialTextBoxLines = 0; // dialogueBoxParam1
- int32 _dialTextBoxMaxX = 0; // dialogueBoxParam2
+ int32 _maxLineDial = 0;
+ int32 _dialMaxSize = 0;
bool _isShiftJIS = false;
bool _isVisualRTL = false;
@@ -150,7 +153,7 @@ public:
Text(TwinEEngine *engine);
~Text();
- static const int32 lineHeight = 38;
+ static const int32 lineHeight = INTER_LINE;
// TODO: refactor all this variables and related functions
bool _hasValidTextHandle = false;
@@ -192,7 +195,7 @@ public:
* Gets dialogue text width size
* @param dialogue ascii text to display
*/
- int32 getTextSize(const char *dialogue);
+ int32 sizeFont(const char *dialogue);
int32 getCharWidth(uint16 chr) const;
int32 getCharHeight(uint16 chr) const;
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 923fd7a4b20..917baf5af36 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -984,7 +984,7 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
if (_redraw->_flagMCGA) {
_text->drawText(_redraw->_sceneryViewX + 5, _redraw->_sceneryViewY, PauseString);
} else {
- const int width = _text->getTextSize(PauseString);
+ const int width = _text->sizeFont(PauseString);
const int bottom = height() - _text->lineHeight;
_text->drawText(5, bottom, PauseString);
copyBlockPhys(5, bottom, 5 + width, bottom + _text->lineHeight);
Commit: 4453d048646e3d1f1e5e0b6f2d1ce7b1109b4b9c
https://github.com/scummvm/scummvm/commit/4453d048646e3d1f1e5e0b6f2d1ce7b1109b4b9c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-05T13:14:25+02:00
Commit Message:
TWINE: renamed text related vars and methods to match the original sources
Changed paths:
engines/twine/debugger/debug.cpp
engines/twine/holomap_v1.cpp
engines/twine/menu/interface.cpp
engines/twine/menu/interface.h
engines/twine/menu/menu.cpp
engines/twine/menu/menu.h
engines/twine/menu/menuoptions.cpp
engines/twine/resources/resources.cpp
engines/twine/scene/gamestate.cpp
engines/twine/scene/gamestate.h
engines/twine/script/script_life.cpp
engines/twine/slideshow.cpp
engines/twine/text.cpp
engines/twine/text.h
engines/twine/twine.cpp
diff --git a/engines/twine/debugger/debug.cpp b/engines/twine/debugger/debug.cpp
index 812ef0dee72..b8effbc262c 100644
--- a/engines/twine/debugger/debug.cpp
+++ b/engines/twine/debugger/debug.cpp
@@ -69,7 +69,7 @@ void Debug::debugDrawWindow(int32 w) {
const Common::Rect &rect = window.rect;
const int32 alpha = window.alpha;
- _engine->_interface->drawTransparentBox(rect, alpha);
+ _engine->_interface->shadeBox(rect, alpha);
_engine->_menu->drawRectBorders(rect);
if (window.numLines > 0) {
diff --git a/engines/twine/holomap_v1.cpp b/engines/twine/holomap_v1.cpp
index bbfdfa17021..a4907c04c1d 100644
--- a/engines/twine/holomap_v1.cpp
+++ b/engines/twine/holomap_v1.cpp
@@ -676,7 +676,7 @@ void HolomapV1::holoMap() {
}
_engine->_screens->clearScreen();
- _engine->_text->_drawTextBoxBackground = true;
+ _engine->_text->_flagMessageShade = true;
_engine->setPalette(_engine->_screens->_paletteRGBA);
_engine->_scene->_alphaLight = alphaLightTmp;
_engine->_scene->_betaLight = betaLightTmp;
diff --git a/engines/twine/menu/interface.cpp b/engines/twine/menu/interface.cpp
index 09bf3627f57..9134c2f91fc 100644
--- a/engines/twine/menu/interface.cpp
+++ b/engines/twine/menu/interface.cpp
@@ -152,7 +152,7 @@ void Interface::blitBox(const Common::Rect &rect, const Graphics::ManagedSurface
dest.blitFrom(source, r, Common::Point(rect.left, rect.top));
}
-void Interface::drawTransparentBox(const Common::Rect &rect, int32 colorAdj) {
+void Interface::shadeBox(const Common::Rect &rect, int32 colorAdj) {
Common::Rect r = rect;
r.clip(_engine->rect());
if (r.isEmpty()) {
diff --git a/engines/twine/menu/interface.h b/engines/twine/menu/interface.h
index 0c2696723b0..f02124f7d20 100644
--- a/engines/twine/menu/interface.h
+++ b/engines/twine/menu/interface.h
@@ -63,7 +63,7 @@ public:
* Draws inside buttons transparent area
* @param colorAdj index to adjust the transparent box color
*/
- void drawTransparentBox(const Common::Rect &rect, int32 colorAdj);
+ void shadeBox(const Common::Rect &rect, int32 colorAdj);
void drawFilledRect(const Common::Rect &rect, uint8 colorIndex);
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index e681536419a..9d3ed207057 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -59,6 +59,9 @@ static const uint32 kPlasmaEffectFilesize = 262176;
#define HEIGHT_STANDARD 50
#define MENU_SPACE 6
+#define SIZE_INV_OBJ_X 75
+#define SIZE_INV_OBJ_Y 65
+
namespace MenuButtonTypes {
enum MenuButtonTypesEnum {
kMusicVolume = 1,
@@ -278,10 +281,10 @@ void Menu::processPlasmaEffect(const Common::Rect &rect, int32 color) {
}
void Menu::drawRectBorders(const Common::Rect &rect, int32 colorLeftTop, int32 colorRightBottom) {
- _engine->_interface->drawLine(rect.left, rect.top, rect.right, rect.top, colorLeftTop); // top line
- _engine->_interface->drawLine(rect.left, rect.top, rect.left, rect.bottom, colorLeftTop); // left line
- _engine->_interface->drawLine(rect.right, rect.top + 1, rect.right, rect.bottom, colorRightBottom); // right line
- _engine->_interface->drawLine(rect.left + 1, rect.bottom, rect.right, rect.bottom, colorRightBottom); // bottom line
+ _engine->_interface->drawLine(rect.left, rect.top, rect.right, rect.top, colorLeftTop); // top line
+ _engine->_interface->drawLine(rect.left, rect.top + 1, rect.left, rect.bottom, colorLeftTop); // left line
+ _engine->_interface->drawLine(rect.right, rect.top + 1, rect.right, rect.bottom, colorRightBottom); // right line
+ _engine->_interface->drawLine(rect.left + 1, rect.bottom, rect.right - 1, rect.bottom, colorRightBottom); // bottom line
}
void Menu::drawRectBorders(int32 left, int32 top, int32 right, int32 bottom, int32 colorLeftTop, int32 colorRightBottom) {
@@ -328,13 +331,13 @@ void Menu::drawButtonGfx(const MenuSettings *menuSettings, const Common::Rect &r
}
} else {
_engine->blitWorkToFront(rect);
- _engine->_interface->drawTransparentBox(rect, 4);
+ _engine->_interface->shadeBox(rect, 4);
}
drawRectBorders(rect);
_engine->_text->setFontColor(COLOR_WHITE);
- _engine->_text->setFontParameters(2, 8);
+ _engine->_text->setFont(INTER_LEAVE, INTER_SPACE);
const int32 textSize = _engine->_text->sizeFont(dialText);
_engine->_text->drawText((_engine->width() / 2) - (textSize / 2), rect.top + 7, dialText);
}
@@ -1178,7 +1181,7 @@ void Menu::drawBehaviourMenu(int32 left, int32 top, int32 angle) {
Common::Rect boxRect(titleRect);
boxRect.grow(-1);
- _engine->_interface->drawTransparentBox(boxRect, 2);
+ _engine->_interface->shadeBox(boxRect, 2);
prepareAndDrawBehaviour(left, top, angle, HeroBehaviourType::kNormal);
prepareAndDrawBehaviour(left, top, angle, HeroBehaviourType::kAthletic);
@@ -1290,8 +1293,8 @@ void Menu::processBehaviourMenu(bool behaviourMenu) {
}
Common::Rect Menu::calcItemRect(int32 left, int32 top, int32 item, int32 *centerX, int32 *centerY) const {
- const int32 itemWidth = 74;
- const int32 itemHeight = 64;
+ const int32 itemWidth = SIZE_INV_OBJ_X;
+ const int32 itemHeight = SIZE_INV_OBJ_Y;
const int32 itemPadding = 11;
const int32 itemWidthHalf = itemWidth / 2;
const int32 itemHeightHalf = itemHeight / 2;
@@ -1329,8 +1332,10 @@ void Menu::drawOneInventory(int32 left, int32 top, int32 item) {
}
void Menu::drawListInventory(int32 left, int32 top) {
- const Common::Rect rect(left, top, left + 605, top + 310);
- _engine->_interface->drawTransparentBox(rect, 4);
+ constexpr int w = (SIZE_INV_OBJ_X + 10) * 7 + 10;
+ constexpr int h = (SIZE_INV_OBJ_Y + 10) * 4 + 10;
+ const Common::Rect rect(left, top, left + w, top + h);
+ _engine->_interface->shadeBox(rect, 4);
drawRectBorders(rect);
for (int32 item = 0; item < NUM_INVENTORY_ITEMS; item++) {
drawOneInventory(left, top, item);
@@ -1338,7 +1343,7 @@ void Menu::drawListInventory(int32 left, int32 top) {
_engine->_interface->unsetClip();
}
-void Menu::processInventoryMenu() {
+void Menu::inventory() {
int32 tmpAlphaLight = _engine->_scene->_alphaLight;
int32 tmpBetaLight = _engine->_scene->_betaLight;
@@ -1361,7 +1366,7 @@ void Menu::processInventoryMenu() {
_engine->_text->initDial(TextBankId::Inventory_Intro_and_Holomap);
_engine->_text->setFontCrossColor(COLOR_BRIGHT_BLUE);
- _engine->_text->initDialogueBox();
+ _engine->_text->initDialWindow();
ProgressiveTextState dialstate = ProgressiveTextState::ContinueRunning;
bool updateItemText = true;
@@ -1423,20 +1428,18 @@ void Menu::processInventoryMenu() {
}
if (updateItemText) {
- _engine->_text->initInventoryDialogueBox();
+ _engine->_text->secondInitDialWindow();
if (_inventorySelectedItem < NUM_INVENTORY_ITEMS && _engine->_gameState->hasItem((InventoryItems)_inventorySelectedItem) && !_engine->_gameState->inventoryDisabled()) {
_engine->_text->initInventoryText((InventoryItems)_inventorySelectedItem);
} else {
_engine->_text->initInventoryText(InventoryItems::MaxInventoryItems);
}
- dialstate = ProgressiveTextState::ContinueRunning;
+ dialstate = ProgressiveTextState::End;
updateItemText = false;
}
- if (dialstate == ProgressiveTextState::ContinueRunning) {
+ if (dialstate != ProgressiveTextState::NextPage) {
dialstate = _engine->_text->nextDialChar();
- } else {
- _engine->_text->fadeInRemainingChars();
}
if (_engine->_input->toggleActionIfActive(TwinEActionType::UINextPage)) {
@@ -1445,7 +1448,7 @@ void Menu::processInventoryMenu() {
updateItemText = true;
}
if (dialstate == ProgressiveTextState::NextPage) {
- _engine->_text->initInventoryDialogueBox();
+ _engine->_text->secondInitDialWindow();
dialstate = ProgressiveTextState::ContinueRunning;
}
}
@@ -1460,7 +1463,7 @@ void Menu::processInventoryMenu() {
}
}
- _engine->_text->_hasValidTextHandle = false;
+ _engine->_text->closeDial();
_engine->_scene->_alphaLight = tmpAlphaLight;
_engine->_scene->_betaLight = tmpBetaLight;
diff --git a/engines/twine/menu/menu.h b/engines/twine/menu/menu.h
index de1e49fb5bb..c43ae0442ba 100644
--- a/engines/twine/menu/menu.h
+++ b/engines/twine/menu/menu.h
@@ -251,7 +251,7 @@ public:
int32 newGameClassicMenu();
/** Process in-game inventory menu */
- void processInventoryMenu();
+ void inventory();
};
} // namespace TwinE
diff --git a/engines/twine/menu/menuoptions.cpp b/engines/twine/menu/menuoptions.cpp
index 12a0347244c..57f95398812 100644
--- a/engines/twine/menu/menuoptions.cpp
+++ b/engines/twine/menu/menuoptions.cpp
@@ -55,7 +55,7 @@ void MenuOptions::newGame() {
// intro screen 1 - twinsun
_engine->_screens->loadImage(TwineImage(Resources::HQR_RESS_FILE, 15, 16));
- _engine->_text->_drawTextBoxBackground = false;
+ _engine->_text->_flagMessageShade = false;
_engine->_text->_renderTextTriangle = true;
_engine->_text->initDial(TextBankId::Inventory_Intro_and_Holomap);
@@ -90,7 +90,7 @@ void MenuOptions::newGame() {
}
_engine->_screens->clearScreen();
- _engine->_text->_drawTextBoxBackground = true;
+ _engine->_text->_flagMessageShade = true;
_engine->_text->_renderTextTriangle = false;
// set main palette back
@@ -153,7 +153,7 @@ void MenuOptions::drawSelectableCharacter(int32 x, int32 y) {
_engine->_interface->drawFilledRect(rect, COLOR_91);
} else {
_engine->blitWorkToFront(rect);
- _engine->_interface->drawTransparentBox(rect, 4);
+ _engine->_interface->shadeBox(rect, 4);
}
_engine->_menu->drawRectBorders(rect);
@@ -211,7 +211,7 @@ void MenuOptions::drawInputText(int32 centerx, int32 top, int32 type, const char
Common::Rect rectBox(rect);
rectBox.grow(-1);
_engine->_menu->drawRectBorders(rect);
- _engine->_interface->drawTransparentBox(rectBox, 3);
+ _engine->_interface->shadeBox(rectBox, 3);
_engine->_text->drawText(centerx - _engine->_text->sizeFont(text) / 2, top + 6, text);
_engine->copyBlockPhys(rect);
diff --git a/engines/twine/resources/resources.cpp b/engines/twine/resources/resources.cpp
index 7e81b2d64ac..f6b57c37a3c 100644
--- a/engines/twine/resources/resources.cpp
+++ b/engines/twine/resources/resources.cpp
@@ -188,7 +188,7 @@ void Resources::initResources() {
f24.read(_sjisFontPtr, kMinSjisSize);
}
- _engine->_text->setFontParameters(2, 8);
+ _engine->_text->setFont(INTER_LEAVE, INTER_SPACE);
_engine->_text->setFontColor(COLOR_14);
_engine->_text->setTextCrossColor(136, 143, 2);
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 2b061ff0578..dee74152914 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -54,7 +54,7 @@ GameState::GameState(TwinEEngine *engine) : _engine(engine) {
clearGameFlags();
Common::fill(&_inventoryFlags[0], &_inventoryFlags[NUM_INVENTORY_ITEMS], 0);
Common::fill(&_holomapFlags[0], &_holomapFlags[MAX_HOLO_POS_2], 0);
- Common::fill(&_gameChoices[0], &_gameChoices[10], TextId::kNone);
+ Common::fill(&_gameListChoice[0], &_gameListChoice[10], TextId::kNone);
}
void GameState::init3DGame() {
@@ -377,7 +377,7 @@ void GameState::doFoundObj(InventoryItems item) {
_engine->_interface->unsetClip();
_engine->_text->initItemFoundText(item);
- _engine->_text->initDialogueBox();
+ _engine->_text->initDialWindow();
ProgressiveTextState textState = ProgressiveTextState::ContinueRunning;
@@ -401,7 +401,7 @@ void GameState::doFoundObj(InventoryItems item) {
_engine->_interface->unsetClip();
_engine->_redraw->_currNumOfRedrawBox = 0;
_engine->_redraw->blitBackgroundAreas();
- _engine->_interface->drawTransparentBox(boxRect, 4);
+ _engine->_interface->shadeBox(boxRect, 4);
_engine->_interface->setClip(boxRect);
@@ -474,25 +474,25 @@ void GameState::doFoundObj(InventoryItems item) {
_engine->_interface->unsetClip();
}
-void GameState::processGameChoices(TextId choiceIdx) {
+void GameState::gameAskChoice(TextId choiceIdx) {
_engine->saveFrontBuffer();
_gameChoicesSettings.reset();
_gameChoicesSettings.setTextBankId((TextBankId)((int)_engine->_scene->_sceneTextBank + (int)TextBankId::Citadel_Island));
// filled via script
- for (int32 i = 0; i < _numChoices; i++) {
- _gameChoicesSettings.addButton(_gameChoices[i], 0);
+ for (int32 i = 0; i < _gameNbChoices; i++) {
+ _gameChoicesSettings.addButton(_gameListChoice[i], 0);
}
_engine->_text->drawAskQuestion(choiceIdx);
_engine->_menu->doGameMenu(&_gameChoicesSettings);
const int16 activeButton = _gameChoicesSettings.getActiveButton();
- _choiceAnswer = _gameChoices[activeButton];
+ _gameChoice = _gameListChoice[activeButton];
// get right VOX entry index
- if (_engine->_text->initVoxToPlayTextId(_choiceAnswer)) {
+ if (_engine->_text->initVoxToPlayTextId(_gameChoice)) {
while (_engine->_text->playVoxSimple(_engine->_text->_currDialTextEntry)) {
FrameMarker frame(_engine);
if (_engine->shouldQuit()) {
diff --git a/engines/twine/scene/gamestate.h b/engines/twine/scene/gamestate.h
index c5a1e99707d..d77b8eaafd6 100644
--- a/engines/twine/scene/gamestate.h
+++ b/engines/twine/scene/gamestate.h
@@ -135,9 +135,9 @@ public:
char _sceneName[30] {};
- TextId _gameChoices[10]; // inGameMenuData
- int32 _numChoices = 0; // numOfOptionsInChoice
- TextId _choiceAnswer = TextId::kNone; // inGameMenuAnswer
+ TextId _gameListChoice[10]; // inGameMenuData
+ int32 _gameNbChoices = 0; // numOfOptionsInChoice
+ TextId _gameChoice = TextId::kNone; // inGameMenuAnswer
void setDarts(int16 value) {
setGameFlag(InventoryItems::kiDart, value);
@@ -210,7 +210,7 @@ public:
bool loadGame(Common::SeekableReadStream *file);
bool saveGame(Common::WriteStream *file);
- void processGameChoices(TextId choiceIdx);
+ void gameAskChoice(TextId choiceIdx);
void processGameoverAnimation();
};
diff --git a/engines/twine/script/script_life.cpp b/engines/twine/script/script_life.cpp
index f2c4a35cb25..6a9fef534f3 100644
--- a/engines/twine/script/script_life.cpp
+++ b/engines/twine/script/script_life.cpp
@@ -375,7 +375,7 @@ static ReturnType processLifeConditions(TwinEEngine *engine, LifeScriptContext &
case kcCHOICE:
debugCN(3, kDebugLevels::kDebugScripts, "choice(");
conditionValueSize = ReturnType::RET_S16;
- engine->_scene->_currentScriptValue = (int16)engine->_gameState->_choiceAnswer;
+ engine->_scene->_currentScriptValue = (int16)engine->_gameState->_gameChoice;
break;
case kcFUEL:
debugCN(3, kDebugLevels::kDebugScripts, "fuel(");
@@ -1554,7 +1554,7 @@ int32 ScriptLife::lSET_USED_INVENTORY(TwinEEngine *engine, LifeScriptContext &ct
int32 ScriptLife::lADD_CHOICE(TwinEEngine *engine, LifeScriptContext &ctx) {
const TextId choiceIdx = (TextId)ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScripts, "LIFE::ADD_CHOICE(%i)", (int)choiceIdx);
- engine->_gameState->_gameChoices[engine->_gameState->_numChoices++] = choiceIdx;
+ engine->_gameState->_gameListChoice[engine->_gameState->_gameNbChoices++] = choiceIdx;
return 0;
}
@@ -1572,8 +1572,8 @@ int32 ScriptLife::lASK_CHOICE(TwinEEngine *engine, LifeScriptContext &ctx) {
engine->_redraw->drawBubble(ctx.actorIdx);
}
engine->_text->setFontCrossColor(ctx.actor->_talkColor);
- engine->_gameState->processGameChoices(choiceIdx);
- engine->_gameState->_numChoices = 0;
+ engine->_gameState->gameAskChoice(choiceIdx);
+ engine->_gameState->_gameNbChoices = 0;
engine->_redraw->redrawEngineActions(true);
return 0;
@@ -1866,8 +1866,8 @@ int32 ScriptLife::lASK_CHOICE_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
engine->_redraw->drawBubble(otherActorIdx);
}
engine->_text->setFontCrossColor(engine->_scene->getActor(otherActorIdx)->_talkColor);
- engine->_gameState->processGameChoices(choiceIdx);
- engine->_gameState->_numChoices = 0;
+ engine->_gameState->gameAskChoice(choiceIdx);
+ engine->_gameState->_gameNbChoices = 0;
engine->_redraw->redrawEngineActions(true);
return 0;
@@ -1905,12 +1905,12 @@ int32 ScriptLife::lMESSAGE_SENDELL(TwinEEngine *engine, LifeScriptContext &ctx)
engine->_screens->loadImage(TwineImage(Resources::HQR_RESS_FILE, 25, 26));
engine->_text->bigWinDial();
engine->_text->setFontCrossColor(COLOR_WHITE);
- engine->_text->_drawTextBoxBackground = false;
+ engine->_text->_flagMessageShade = false;
const bool tmpFlagDisplayText = engine->_cfgfile.FlagDisplayText;
engine->_cfgfile.FlagDisplayText = true;
engine->_text->drawTextProgressive(TextId::kSendell);
engine->_cfgfile.FlagDisplayText = tmpFlagDisplayText;
- engine->_text->_drawTextBoxBackground = true;
+ engine->_text->_flagMessageShade = true;
engine->_text->normalWinDial();
engine->_screens->fadeToBlack(engine->_screens->_paletteRGBACustom);
engine->_screens->clearScreen();
diff --git a/engines/twine/slideshow.cpp b/engines/twine/slideshow.cpp
index 6a6542b610a..4c1282cb270 100644
--- a/engines/twine/slideshow.cpp
+++ b/engines/twine/slideshow.cpp
@@ -85,7 +85,7 @@ private:
_engine->_resources->_fontPtr = (uint8 *)malloc(_engine->_resources->_fontBufSize);
font.read(_engine->_resources->_fontPtr, _engine->_resources->_fontBufSize);
- _engine->_text->setFontParameters(4, 8);
+ _engine->_text->setFont(4, 8);
return true;
}
diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index 83288557b98..4e5df5c9bdc 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -162,16 +162,6 @@ bool Text::stopVox(const TextEntry *text) {
return true;
}
-void Text::initDial(TextBankId bankIdx) {
- // don't load if we already have the dialogue text bank loaded
- if (bankIdx == _currentBankIdx) {
- return;
- }
-
- _currentBankIdx = bankIdx;
- initVoxBank(bankIdx);
-}
-
void Text::initSceneTextBank() {
const int textBankId = (int)_engine->_scene->_sceneTextBank;
initDial((TextBankId)(textBankId + (int)TextBankId::Citadel_Island));
@@ -179,7 +169,6 @@ void Text::initSceneTextBank() {
void Text::drawCharacter(int32 x, int32 y, uint16 character) { // CarFont
const uint8 usedColor = _dialTextColor;
-
if (_isShiftJIS && character > 0x100 && _engine->_resources->_sjisFontPtr) {
int index = 0;
if (character >= 0x8140 && character <= 0x9fff)
@@ -219,7 +208,7 @@ void Text::drawCharacter(int32 x, int32 y, uint16 character) { // CarFont
Common::MemoryReadStream stream(_engine->_resources->_fontPtr, _engine->_resources->_fontBufSize);
stream.seek(character * 4);
stream.seek(stream.readSint16LE());
- /*uint8 charWidth =*/ stream.readByte();
+ /*uint8 charWidth =*/stream.readByte();
const uint8 sizeY = stream.readByte();
x += stream.readByte();
y += stream.readByte();
@@ -238,7 +227,7 @@ void Text::drawCharacter(int32 x, int32 y, uint16 character) { // CarFont
}
const uint8 number = stream.readByte();
tempX += jump;
- uint8* basePtr = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(tempX, tempY);
+ uint8 *basePtr = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(tempX, tempY);
for (uint8 i = 0; i < number; i++) {
if (tempX >= 0 && tempX < (_engine->width() - 1) && tempY >= 0 && tempY < (_engine->height() - 1)) {
*basePtr = usedColor;
@@ -257,31 +246,9 @@ void Text::drawCharacter(int32 x, int32 y, uint16 character) { // CarFont
}
}
-void Text::drawCharacterShadow(int32 x, int32 y, uint16 character, int32 color, Common::Rect &dirtyRect) { // AffOneCar
- if (character == ' ') {
- return;
- }
- // shadow color
- setFontColor(COLOR_BLACK);
- drawCharacter(x + 2, y + 4, character);
-
- // text color
- setFontColor(color);
- drawCharacter(x, y, character);
-
- // TODO: get font size
- const Common::Rect rect(x, y, x + 32, y + 38);
- if (dirtyRect.isEmpty()) {
- dirtyRect = rect;
- } else {
- dirtyRect.extend(rect);
- }
-}
-
uint16 Text::getNextChar(const char *&dialogue) {
uint16 currChar = *dialogue++ & 0xff;
- if (_isShiftJIS && ((currChar >= 0x81 && currChar <= 0x9f)
- || (currChar >= 0xe0 && currChar <= 0xea)) && ((*dialogue & 0xff) >= 0x40))
+ if (_isShiftJIS && ((currChar >= 0x81 && currChar <= 0x9f) || (currChar >= 0xe0 && currChar <= 0xea)) && ((*dialogue & 0xff) >= 0x40))
currChar = (currChar << 8) | (*dialogue++ & 0xff);
return currChar;
}
@@ -299,7 +266,7 @@ void Text::drawText(int32 x, int32 y, const char *dialogue, bool shadow) {
}
if (currChar == ' ') {
- x += _sizeSpace;
+ x += _interSpace;
} else {
const int32 dialTextSize = getCharWidth(currChar);
if (shadow) {
@@ -309,7 +276,7 @@ void Text::drawText(int32 x, int32 y, const char *dialogue, bool shadow) {
drawCharacter(x, y, currChar); // draw the character on screen
}
// add the length of the space between 2 characters
- x += _dialSpaceBetween;
+ x += _interLeave;
// add the length of the current character
x += dialTextSize;
}
@@ -326,9 +293,9 @@ int32 Text::sizeFont(const char *dialogue) {
}
if (currChar == ' ') {
- dialTextSize += _sizeSpace;
+ dialTextSize += _interSpace;
} else {
- dialTextSize += _dialSpaceBetween;
+ dialTextSize += _interLeave;
dialTextSize += getCharWidth(currChar);
}
} while (1);
@@ -336,268 +303,411 @@ int32 Text::sizeFont(const char *dialogue) {
return dialTextSize;
}
-void Text::initDialogueBox() {
- _engine->blitWorkToFront(_dialTextBox);
-
- if (_drawTextBoxBackground) {
- _engine->_menu->drawRectBorders(_dialTextBox);
- Common::Rect rect(_dialTextBox);
- rect.grow(-1);
- _engine->_interface->drawTransparentBox(rect, 3);
- }
-
- _nbChar = 0;
- _engine->blitFrontToWork(_dialTextBox);
-}
-
-// TODO: this blits a few pixels too much when switching an item in the inventory menu.
-void Text::initInventoryDialogueBox() { // SecondInitDialWindow
- _engine->blitWorkToFront(_dialTextBox);
- _nbChar = 0;
-}
-
void Text::initInventoryText(InventoryItems index) { // OpenDialNoWindow
// 100 if the offset for the inventory item descriptions
- initText((TextId)(100 + (int)index));
+ commonOpenDial((TextId)(100 + (int)index));
}
-void Text::initItemFoundText(InventoryItems index) {
- initText((TextId)index);
+void Text::initItemFoundText(InventoryItems index) { // OpenDialNoWindow
+ commonOpenDial((TextId)index);
}
-void Text::initText(TextId index) {
- if (!getText(index)) {
- _hasValidTextHandle = false;
+void Text::initDial(TextBankId bankIdx) {
+ // don't load if we already have the dialogue text bank loaded
+ if (bankIdx == _currentBankIdx) {
return;
}
- _progressiveTextBufferPtr = _progressiveTextBuffer;
-
- _hasValidTextHandle = true;
+ _currentBankIdx = bankIdx;
+ initVoxBank(bankIdx);
+}
- _nbLineDial = 0;
- _progressiveTextBuffer[0].chr = '\0';
- _progressiveTextBuffer[0].x = 0;
- _nbChar = 0;
- _dialTextBaseXPos = _dialTextBox.left + PADDING;
- _dialTextYPos = _dialTextBox.top + PADDING;
- _currentTextPosition = _currDialTextPtr;
+Text::WordSize Text::getNextWord(const char *completeText, char *dst, int32 wordBufSize) {
+ int32 lenword = 0;
+ const char *word = dst;
- // lba font is get while engine start
- setFontParameters(2, 7);
+ while (*completeText != '\0' && *completeText != '\1' && *completeText != ' ') {
+ lenword++;
+ *dst++ = *completeText++;
+ if (lenword >= wordBufSize - 1) {
+ break;
+ }
+ }
- // fetch the first line
- getNextLine();
-}
+ *dst = '\0';
-void Text::initProgressiveTextBuffer() {
- for (uint i = 0; i < ARRAYSIZE(_progressiveTextBuffer); i++) {
- _progressiveTextBuffer[i].chr = ' ';
- _progressiveTextBuffer[i].x = (_sizeSpace + 1) * i;
- }
- // the end of the buffer defines how fast the next page is shown - as the
- // whitespaces are handled in the fade in process, too. But we need at least 32 chars,
- // to completly fade in the last characters of a full page (see TEXT_MAX_FADE_IN_CHR)
- _progressiveTextBuffer[ARRAYSIZE(_progressiveTextBuffer) - 1].chr = '\0';
- _progressiveTextBuffer[ARRAYSIZE(_progressiveTextBuffer) - 1].x = 0;
- _progressiveTextBufferPtr = _progressiveTextBuffer;
- _nbLineDial = 0;
+ WordSize size;
+ size.lenWord = lenword;
+ size.sizeWord = sizeFont(word);
+ return size;
}
-void Text::pushChar(int16 baseX, int16 y, const LineCharacter &chr) {
+void Text::pushChar(int16 x, int16 y, const LineCharacter &chr) {
if (_nbChar < TEXT_MAX_FADE_IN_CHR) {
_stackChar[_nbChar].chr = chr.chr;
- _stackChar[_nbChar].x = baseX + chr.x;
+ _stackChar[_nbChar].x = x;
_stackChar[_nbChar].y = y;
_nbChar++;
return;
}
- int32 i = 0;
- for (i = 0; i < TEXT_MAX_FADE_IN_CHR - 1; ++i) {
+ for (int32 i = 0; i < TEXT_MAX_FADE_IN_CHR - 1; ++i) {
_stackChar[i] = _stackChar[i + 1];
}
_stackChar[TEXT_MAX_FADE_IN_CHR - 1].chr = chr.chr;
- _stackChar[TEXT_MAX_FADE_IN_CHR - 1].x = baseX + chr.x;
+ _stackChar[TEXT_MAX_FADE_IN_CHR - 1].x = x;
_stackChar[TEXT_MAX_FADE_IN_CHR - 1].y = y;
}
-Text::WordSize Text::getNextWord(const char *completeText, char *dst, int32 wordBufSize) {
- int32 temp = 0;
- const char *arg2Save = dst;
+void Text::drawCharacterShadow(int32 x, int32 y, uint16 character, int32 color, Common::Rect &dirtyRect) { // AffOneCar
+ if (character == ' ') {
+ return;
+ }
+ // shadow color
+ setFontColor(COLOR_BLACK);
+ drawCharacter(x + 2, y + 4, character);
- while (*completeText != '\0' && *completeText != '\1' && *completeText != ' ') {
- temp++;
- *dst++ = *completeText++;
- if (temp >= wordBufSize - 1) {
- break;
+ // text color
+ setFontColor(color);
+ drawCharacter(x, y, character);
+
+ // TODO: get font size
+ const Common::Rect rect(x, y, x + 32, y + 38);
+ if (dirtyRect.isEmpty()) {
+ dirtyRect = rect;
+ } else {
+ dirtyRect.extend(rect);
+ }
+}
+
+void Text::fadeInCharacters(int32 counter, int32 fontColor) { // AffAllCar
+ Common::Rect dirtyRect;
+ while (--counter >= 0) {
+ const BlendInCharacter *ptr = &_stackChar[counter];
+ setFontColor(fontColor);
+ drawCharacterShadow(ptr->x, ptr->y, ptr->chr, fontColor, dirtyRect);
+ fontColor -= _stepDegrade;
+ if (fontColor > _minDegrade) {
+ fontColor = _minDegrade;
}
}
+ if (dirtyRect.isEmpty()) {
+ return;
+ }
+ _engine->copyBlockPhys(dirtyRect);
+}
- WordSize size;
- size.inChar = temp;
- *dst = '\0';
- size.inPixel = sizeFont(arg2Save);
- return size;
+void Text::setTextCrossColor(int32 stopColor, int32 startColor, int32 stepSize) { // CoulDial
+ _maxDegrade = startColor;
+ _minDegrade = stopColor;
+ _stepDegrade = stepSize;
+ _nbDegrade = ((startColor - stopColor) + 1) / stepSize;
}
-void Text::appendProgressiveTextBuffer(const char *s, int &x, uint &i) {
- while (1) {
- if (i >= ARRAYSIZE(_progressiveTextBuffer) - 1)
- return;
- uint16 chr = getNextChar(s);
- if (!chr)
- return;
- _progressiveTextBuffer[i].chr = chr;
- _progressiveTextBuffer[i].x = x;
- i++;
+void Text::setFontCrossColor(int32 color) { // TestCoulDial
+ _stepDegrade = -1;
+ _nbDegrade = 14;
+ _maxDegrade = color * 16;
+ _minDegrade = _maxDegrade + 12;
+}
- if (chr == ' ') {
- x += _sizeSpace + 1;
- } else {
- x += getCharWidth(chr) + 2;
- }
+bool Text::getText(TextId index) {
+ const TextEntry *textEntry = _engine->_resources->getText(_currentBankIdx, index);
+ if (textEntry == nullptr) {
+ return false;
}
+ _ptText = textEntry->string.c_str();
+ _currDialTextSize = textEntry->string.size();
+
+ // RECHECK: this was added for vox playback
+ _currDialTextEntry = textEntry;
+
+ debug(3, "text for bank %i with index %i (currIndex: %i): %s", (int)_currentBankIdx, textEntry->index, (int)textEntry->textIndex, _ptText);
+ return true;
+}
+
+void Text::renderContinueReadingTriangle() { // AffFleche
+ const int32 border = 3;
+ const int32 size = 21;
+ const int16 color = 136;
+ const int32 right = _dialTextBox.right - border;
+ const int32 left = _dialTextBox.right - (size + border);
+ const int32 top = _dialTextBox.bottom - (size + border);
+ const int32 bottom = _dialTextBox.bottom - border;
+
+ ComputedVertex vertices[3];
+
+ vertices[0].intensity = color;
+ vertices[0].x = right;
+ vertices[0].y = top;
+
+ vertices[1].intensity = color;
+ vertices[1].x = left;
+ vertices[1].y = bottom;
+
+ vertices[2].intensity = color;
+ vertices[2].x = right;
+ vertices[2].y = bottom;
+
+ CmdRenderPolygon polygon;
+ polygon.numVertices = ARRAYSIZE(vertices);
+ polygon.colorIndex = _minDegrade;
+ polygon.renderType = POLYGONTYPE_FLAT;
+ _engine->_renderer->renderPolygons(polygon, vertices);
+
+ _engine->copyBlockPhys(left, top, right, bottom);
+}
+
+void Text::initDialWindow() {
+ _engine->blitWorkToFront(_dialTextBox);
+
+ if (_flagMessageShade) {
+ _engine->_menu->drawRectBorders(_dialTextBox);
+ Common::Rect rect(_dialTextBox);
+ rect.grow(-1);
+ _engine->_interface->shadeBox(rect, 3);
+ }
+
+ _nbChar = 0;
+ _engine->blitFrontToWork(_dialTextBox);
+}
+
+void Text::secondInitDialWindow() {
+ _engine->blitWorkToFront(_dialTextBox);
+ _nbChar = 0;
+}
+
+void Text::normalWinDial() {
+ const int32 margin = 16;
+ _maxLineDial = 3; //(int32)(_dialTextBox.height() / lineHeight) - 1;
+ const int32 textHeight = _maxLineDial * lineHeight;
+
+ _dialTextBox.left = margin;
+ _dialTextBox.top = _engine->height() - textHeight - margin - PADDING;
+ _dialTextBox.right = _engine->width() - 1 - margin;
+ _dialTextBox.bottom = _engine->height() - 1 - margin;
+
+ _dialMaxSize = _dialTextBox.width() - (2 * PADDING);
+}
+
+void Text::bigWinDial() {
+ const int32 margin = 8;
+ _dialTextBox.left = margin;
+ _dialTextBox.top = margin;
+ _dialTextBox.right = _engine->width() - 1 - margin;
+ _dialTextBox.bottom = _engine->height() - 1 - margin;
+
+ _maxLineDial = (int32)(_dialTextBox.height() / lineHeight) - 1;
+ _dialMaxSize = _dialTextBox.width() - (2 * PADDING);
+}
+
+void Text::commonOpenDial(TextId index) {
+ closeDial();
+
+ if (!getText(index)) {
+ return;
+ }
+ _xDial = _dialTextBox.left + PADDING;
+ _yDial = _dialTextBox.top + PADDING;
+ _nbLineDial = 0;
+ _ptDial = _ptText;
+ // _word = '\0';
+ // _ptWord = _word;
+ _bufLine[0].chr = '\0';
+ _bufLine[0].width = 0;
+ _ptLine = _bufLine;
+ _nbChar = 0;
+ _flagEndDial = false;
+ _flagEnd3Line = false;
+ _flagRunningDial = true;
+
+ // lba font is loaded during engine start
+ setFont(INTER_LEAVE, INTER_SPACE);
}
void Text::getNextLine() {
- const char *buffer = _currentTextPosition;
+ _sizeLine = 0;
+ _nbSpace = 0;
_sizeSpace = INTER_SPACE;
+ _bufLine[0].chr = '\0';
+ _bufLine[0].width = 0;
bool flag = true;
- int32 _sizeLine = 0;
- int32 spaceCharCount = 0;
- int x = 0;
uint i = 0;
- _progressiveTextBuffer[0].chr = '\0';
- _progressiveTextBuffer[0].x = '\0';
- for (;;) {
- if (*buffer == ' ') {
- buffer++;
+ while (true) {
+ if (*_ptDial == ' ') {
+ _ptDial++;
continue;
}
- if (*buffer == '\0') {
+ if (*_ptDial == '\0') {
break;
}
- _currentTextPosition = buffer;
- char ptDial[256] = "";
- WordSize _sizeWord = getNextWord(buffer, ptDial, sizeof(ptDial));
- if (_sizeLine + _sizeSpace + _sizeWord.inPixel >= _dialMaxSize) {
+ char word[256] = "";
+ WordSize sizeWord = getNextWord(_ptDial, word, sizeof(word));
+ if (_sizeLine + _sizeSpace + sizeWord.sizeWord > _dialMaxSize) {
break;
}
- if (*ptDial == '\1') {
+ if (*word == '\1') {
+ _ptDial++;
flag = false;
- buffer++;
break;
}
// @ is a line break
- if (*ptDial == '@') {
+ if (*word == '@') {
flag = false;
- buffer++;
+ _ptDial++;
if (_sizeLine == 0) {
+ _bufLine[0].chr = '\0';
+ _bufLine[0].width = 0;
_sizeLine = INTER_SPACE;
- appendProgressiveTextBuffer(" ", x, i);
}
// new page?
- if (ptDial[1] == 'P') {
+ if (word[1] == 'P') {
_nbLineDial = _maxLineDial;
- buffer++;
+ _ptDial++;
}
break;
}
- buffer += _sizeWord.inChar;
- _currentTextPosition = buffer;
- appendProgressiveTextBuffer(ptDial, x, i);
- appendProgressiveTextBuffer(" ", x, i);
- spaceCharCount++;
+ _ptDial += sizeWord.lenWord;
+ appendText(word, i);
+ appendText(" ", i);
- _sizeLine += _sizeWord.inPixel + _sizeSpace;
- if (*_currentTextPosition != '\0') {
- _currentTextPosition++;
- continue;
+ _sizeLine += sizeWord.sizeWord + _sizeSpace;
+ _nbSpace++;
+
+ if (*_ptDial == '\0') {
+ break;
}
- break;
+ _ptDial++;
}
- _progressiveTextBuffer[i].chr = 0;
- _progressiveTextBuffer[i].x = 0;
+ _bufLine[i].chr = 0;
+ _bufLine[i].width = 0;
if (_isVisualRTL) {
for (uint j = 0; j < i / 2; j++) {
- LineCharacter t = _progressiveTextBuffer[j];
- _progressiveTextBuffer[j] = _progressiveTextBuffer[i - j - 1];
- _progressiveTextBuffer[i - j - 1] = t;
+ LineCharacter t = _bufLine[j];
+ _bufLine[j] = _bufLine[i - j - 1];
+ _bufLine[i - j - 1] = t;
}
}
- if (spaceCharCount > 0) {
- spaceCharCount--;
+ if (_nbSpace) {
+ _nbSpace--;
}
- if (*_currentTextPosition != '\0' && flag) {
- if (spaceCharCount <= 0) {
- spaceCharCount = 1;
+ if (*_ptDial != '\0' && flag) {
+ if (_nbSpace == 0) {
+ _nbSpace = 1;
}
- // split the remaining space between the words
- _sizeSpace += (_dialMaxSize - _sizeLine) / spaceCharCount;
+ int32 dx = _dialMaxSize - _sizeLine;
+ int32 dd = dx / _nbSpace;
+ _sizeSpace += dd;
+ dd = _nbSpace * dd;
+ _nbBigSpace = dx - dd;
}
- _currentTextPosition = buffer;
+ _ptLine = _bufLine;
+}
- _progressiveTextBufferPtr = _progressiveTextBuffer;
+void Text::initEndPage() {
+ for (uint i = 0; i < ARRAYSIZE(_bufLine); i++) {
+ _bufLine[i].chr = ' ';
+ _bufLine[i].width = _sizeSpace;
+ }
+ // the end of the buffer defines how fast the next page is shown - as the
+ // whitespaces are handled in the fade in process, too. But we need at least 32 chars,
+ // to completly fade in the last characters of a full page (see TEXT_MAX_FADE_IN_CHR)
+ _bufLine[ARRAYSIZE(_bufLine) - 1].chr = '\0';
+ _bufLine[ARRAYSIZE(_bufLine) - 1].width = 0;
+ _ptLine = _bufLine;
+ _nbLineDial = 0;
+ _sizeLine = 16; // hack
}
-void Text::renderContinueReadingTriangle() { // AffFleche
- const int32 border = 3;
- const int32 size = 21;
- const int16 color = 136;
- const int32 right = _dialTextBox.right - border;
- const int32 left = _dialTextBox.right - (size + border);
- const int32 top = _dialTextBox.bottom - (size + border);
- const int32 bottom = _dialTextBox.bottom - border;
+ProgressiveTextState Text::nextDialChar() { // NextDialCar
+ if (!_flagRunningDial) {
+ return ProgressiveTextState::End;
+ }
- ComputedVertex vertices[3];
+ if (_ptLine->chr == '\0') {
+ if (_flagEndDial) {
+ _flagRunningDial = false;
+ return ProgressiveTextState::End;
+ }
+ if (_flagEnd3Line) {
+ secondInitDialWindow();
+ _flagEnd3Line = false;
+ _xDial = _dialTextBox.left + PADDING;
+ _yDial = _dialTextBox.top + PADDING;
+ }
+ if (*_ptDial == '\0') {
+ initEndPage();
+ _flagEndDial = true;
+ return ProgressiveTextState::ContinueRunning;
+ }
- vertices[0].intensity = color;
- vertices[0].x = right;
- vertices[0].y = top;
+ getNextLine();
+ }
- vertices[1].intensity = color;
- vertices[1].x = left;
- vertices[1].y = bottom;
+ if (_ptLine->chr != '\0') {
+ pushChar(_xDial, _yDial, *_ptLine);
+ fadeInCharacters(_nbChar, _maxDegrade);
- vertices[2].intensity = color;
- vertices[2].x = right;
- vertices[2].y = bottom;
+ if (_ptLine->chr != ' ')
+ _xDial += _ptLine->width + INTER_LEAVE;
+ else {
+ if (_nbBigSpace) {
+ _nbBigSpace--;
+ _xDial++;
+ }
+ _xDial += _sizeSpace;
+ }
- CmdRenderPolygon polygon;
- polygon.numVertices = ARRAYSIZE(vertices);
- polygon.colorIndex = _minDegrade;
- polygon.renderType = POLYGONTYPE_FLAT;
- _engine->_renderer->renderPolygons(polygon, vertices);
+ ++_ptLine;
- _engine->copyBlockPhys(left, top, right, bottom);
-}
+ if (_ptLine->chr == '\0') {
+ _xDial = _dialTextBox.left + PADDING;
+ _yDial += lineHeight;
-void Text::fadeInCharacters(int32 counter, int32 fontColor) { // AffAllCar
- Common::Rect dirtyRect;
- while (--counter >= 0) {
- const BlendInCharacter *ptr = &_stackChar[counter];
- setFontColor(fontColor);
- drawCharacterShadow(ptr->x, ptr->y, ptr->chr, fontColor, dirtyRect);
- fontColor -= _stepDegrade;
- if (fontColor > _minDegrade) {
- fontColor = _minDegrade;
+ if (_flagEnd3Line && !_flagEndDial) {
+ renderContinueReadingTriangle();
+ return ProgressiveTextState::NextPage;
+ }
+
+ _nbLineDial++;
+ if (_nbLineDial >= _maxLineDial) {
+ initEndPage();
+ _flagEnd3Line = true;
+ if (*_ptDial == '\0') {
+ _flagEndDial = true;
+ }
+ }
}
}
- if (dirtyRect.isEmpty()) {
- return;
+
+ return ProgressiveTextState::ContinueRunning;
+}
+
+void Text::closeDial() {
+ _flagRunningDial = false;
+}
+
+void Text::appendText(const char *s, uint &i) {
+ while (1) {
+ if (i >= ARRAYSIZE(_bufLine) - 1)
+ return;
+ uint16 chr = getNextChar(s);
+ if (!chr)
+ return;
+ _bufLine[i].chr = chr;
+ _bufLine[i].width = getCharWidth(chr);
+ i++;
}
- _engine->copyBlockPhys(dirtyRect);
}
int32 Text::getCharWidth(uint16 chr) const {
@@ -630,53 +740,9 @@ void Text::fadeInRemainingChars() {
--_nbChar;
}
-ProgressiveTextState Text::nextDialChar() { // NextDialCar
- if (!_hasValidTextHandle) {
- return ProgressiveTextState::End;
- }
-
- if (_progressiveTextBufferPtr->chr == '\0') {
- initProgressiveTextBuffer();
- getNextLine();
- initDialogueBox();
- _dialTextBaseXPos = _dialTextBox.left + PADDING;
- _dialTextYPos = _dialTextBox.top + PADDING;
- }
- LineCharacter currentChar = *_progressiveTextBufferPtr++;
- assert(currentChar.chr != '\0');
- pushChar(_dialTextBaseXPos, _dialTextYPos, currentChar);
- fadeInCharacters(_nbChar, _maxDegrade);
-
- // reaching 0-byte means a new line - as we are fading in per line
- if (_progressiveTextBufferPtr->chr != '\0') {
- return ProgressiveTextState::ContinueRunning;
- }
-
- if (*_currentTextPosition == '\0') {
- _hasValidTextHandle = false;
- renderContinueReadingTriangle();
- return ProgressiveTextState::End;
- }
-
- // reached a new line that is about get faded in
- _nbLineDial++;
-
- _dialTextYPos += lineHeight;
- _dialTextBaseXPos = _dialTextBox.left + PADDING;
-
- if (_nbLineDial >= _maxLineDial) {
- renderContinueReadingTriangle();
- return ProgressiveTextState::NextPage;
- }
-
- getNextLine();
-
- return ProgressiveTextState::ContinueRunning;
-}
-
bool Text::displayText(TextId index, bool showText, bool playVox, bool loop) {
debug(3, "displayText(index = %i, showText = %s, playVox = %s)",
- (int)index, showText ? "true" : "false", playVox ? "true" : "false");
+ (int)index, showText ? "true" : "false", playVox ? "true" : "false");
if (playVox) {
const TextEntry *textEntry = _engine->_resources->getText(_currentBankIdx, index);
// get right VOX entry index
@@ -687,8 +753,8 @@ bool Text::displayText(TextId index, bool showText, bool playVox, bool loop) {
// if we don't display text, than still plays vox file
if (showText) {
- initText(index);
- initDialogueBox();
+ commonOpenDial(index);
+ initDialWindow();
ScopedKeyMap uiKeyMap(_engine, uiKeyMapId);
ProgressiveTextState textState = ProgressiveTextState::ContinueRunning;
@@ -731,6 +797,8 @@ bool Text::displayText(TextId index, bool showText, bool playVox, bool loop) {
}
}
}
+
+ // Wait until silence
while (playVox && playVoxSimple(_currDialTextEntry)) {
FrameMarker frame(_engine);
_engine->readKeys();
@@ -742,7 +810,7 @@ bool Text::displayText(TextId index, bool showText, bool playVox, bool loop) {
}
_voxHiddenIndex = 0;
_hasHiddenVox = false;
- _hasValidTextHandle = false;
+ _flagRunningDial = false;
_engine->_input->resetHeroActions();
return aborted;
@@ -758,44 +826,15 @@ bool Text::drawTextProgressive(TextId index, bool playVox, bool loop) { // Dial
return aborted;
}
-void Text::setFontParameters(int32 spaceBetween, int32 charSpace) {
- _dialSpaceBetween = spaceBetween;
- _sizeSpace = charSpace;
-}
-
-void Text::setTextCrossColor(int32 stopColor, int32 startColor, int32 stepSize) { // CoulDial
- _maxDegrade = startColor;
- _minDegrade = stopColor;
- _stepDegrade = stepSize;
- _nbDegrade = ((startColor - stopColor) + 1) / stepSize;
-}
-
-void Text::setFontCrossColor(int32 color) { // TestCoulDial
- _stepDegrade = -1;
- _nbDegrade = 14;
- _maxDegrade = color * 16;
- _minDegrade = _maxDegrade + 12;
+void Text::setFont(int32 interLeave, int32 interSpace) {
+ _interLeave = interLeave;
+ _interSpace = interSpace;
}
void Text::setFontColor(int32 color) { // CoulFont
_dialTextColor = color;
}
-bool Text::getText(TextId index) {
- const TextEntry *textEntry = _engine->_resources->getText(_currentBankIdx, index);
- if (textEntry == nullptr) {
- return false;
- }
- _currDialTextPtr = textEntry->string.c_str();
- _currDialTextSize = textEntry->string.size();
-
- // RECHECK: this was added for vox playback
- _currDialTextEntry = textEntry;
-
- debug(3, "text for bank %i with index %i (currIndex: %i): %s", (int)_currentBankIdx, textEntry->index, (int)textEntry->textIndex, _currDialTextPtr);
- return true;
-}
-
bool Text::getMenuText(TextId index, char *text, uint32 textSize) {
if (index == _currMenuTextIndex) {
if (_currMenuTextBank == _engine->_scene->_sceneTextBank) {
@@ -813,7 +852,7 @@ bool Text::getMenuText(TextId index, char *text, uint32 textSize) {
_currDialTextSize = 0xFF;
}
- Common::strlcpy(text, _currDialTextPtr, MIN<int32>(textSize, _currDialTextSize + 1));
+ Common::strlcpy(text, _ptText, MIN<int32>(textSize, _currDialTextSize + 1));
_currDialTextSize++;
Common::strlcpy(_currMenuTextBuffer, text, MIN<int32>(sizeof(_currMenuTextBuffer), _currDialTextSize));
@@ -822,30 +861,6 @@ bool Text::getMenuText(TextId index, char *text, uint32 textSize) {
return true;
}
-void Text::bigWinDial() {
- const int32 margin = 8;
- _dialTextBox.left = margin;
- _dialTextBox.top = margin;
- _dialTextBox.right = _engine->width() - margin;
- _dialTextBox.bottom = _engine->height() - margin;
-
- _maxLineDial = (int32)(_dialTextBox.height() / lineHeight) - 1;
- _dialMaxSize = _engine->width() - 2 * margin - 2 * PADDING;
-}
-
-void Text::normalWinDial() {
- const int32 margin = 16;
- _maxLineDial = 3;
- const int32 textHeight = _maxLineDial * lineHeight;
-
- _dialTextBox.left = margin;
- _dialTextBox.top = _engine->height() - textHeight - margin - PADDING;
- _dialTextBox.right = _engine->width() - margin;
- _dialTextBox.bottom = _engine->height() - margin;
-
- _dialMaxSize = _engine->width() - 2 * margin - 2 * PADDING;
-}
-
void Text::drawAskQuestion(TextId index) {
displayText(index, true, true, true);
}
diff --git a/engines/twine/text.h b/engines/twine/text.h
index 981b47ecda7..576ad826500 100644
--- a/engines/twine/text.h
+++ b/engines/twine/text.h
@@ -64,19 +64,19 @@ private:
* @param color character color
*/
void drawCharacterShadow(int32 x, int32 y, uint16 character, int32 color, Common::Rect& dirtyRect);
- void initProgressiveTextBuffer();
+ void initEndPage();
struct WordSize {
- int32 inChar = 0;
- int32 inPixel = 0;
+ int32 lenWord = 0;
+ int32 sizeWord = 0;
};
struct LineCharacter {
int16 chr = 0;
- int16 x = 0;
+ int16 width = 0;
};
WordSize getNextWord(const char *completeText, char *wordBuf, int32 wordBufSize);
uint16 getNextChar(const char *&dialogue);
void getNextLine();
- void appendProgressiveTextBuffer(const char *s, int &x, uint &i);
+ void appendText(const char *s, uint &i);
// draw next page arrow polygon
void renderContinueReadingTriangle();
/**
@@ -92,26 +92,30 @@ private:
TextBankId _currentBankIdx = TextBankId::None;
- LineCharacter _progressiveTextBuffer[256];
- const char *_currentTextPosition = nullptr;
+ LineCharacter _bufLine[256];
+ const char *_ptDial = nullptr;
- int32 _dialTextBaseXPos = 0;
- int32 _dialTextYPos = 0;
+ int32 _xDial = 0;
+ int32 _yDial = 0;
/** Current position of in the buffer of characters that are currently faded in */
- const LineCharacter *_progressiveTextBufferPtr = nullptr;
+ const LineCharacter *_ptLine = nullptr;
int32 _nbLineDial = 0;
- struct BlendInCharacter {
+ struct BlendInCharacter { // T_STACKCAR
int16 chr = 0;
int16 x = 0;
int16 y = 0;
};
BlendInCharacter _stackChar[TEXT_MAX_FADE_IN_CHR]; // StackCar
int32 _nbChar = 0; // NbCar
+ int32 _sizeLine = 0;
+ int32 _nbSpace = 0;
+ int32 _nbBigSpace = 0;
+ int32 _sizeSpace = 0;
/** Current dialogue text pointer */
- const char *_currDialTextPtr = nullptr;
+ const char *_ptText = nullptr;
/** Current dialogue text size */
int32 _currDialTextSize = 0;
@@ -120,9 +124,9 @@ private:
TextId _currMenuTextIndex = TextId::kNone;
/** Pixel size between dialogue text */
- int32 _dialSpaceBetween = 0;
+ int32 _interLeave = 0;
/** Pixel size of the space character - recalculated per per line */
- int32 _sizeSpace = 0;
+ int32 _interSpace = 0;
/** Dialogue text color */
int32 _dialTextColor = 0;
@@ -148,18 +152,19 @@ private:
bool _isShiftJIS = false;
bool _isVisualRTL = false;
- bool displayText(TextId index, bool showText, bool playVox, bool loop);
+ bool displayText(TextId index, bool showText, bool playVox, bool loop); // MyDial
public:
Text(TwinEEngine *engine);
~Text();
static const int32 lineHeight = INTER_LINE;
- // TODO: refactor all this variables and related functions
- bool _hasValidTextHandle = false;
+ bool _flagRunningDial = false;
+ bool _flagEndDial = false;
+ bool _flagEnd3Line = false;
// renders a triangle if the next side of the text can get activated
bool _renderTextTriangle = false;
- bool _drawTextBoxBackground = false;
+ bool _flagMessageShade = false;
bool _hasHiddenVox = false;
int32 _voxHiddenIndex = 0;
// ---
@@ -180,7 +185,7 @@ public:
inline TextBankId textBank() const {
return _currentBankIdx;
}
-
+ void closeDial();
/**
* Display a certain dialogue text in the screen
* @param x X coordinate in screen
@@ -199,10 +204,10 @@ public:
int32 getCharWidth(uint16 chr) const;
int32 getCharHeight(uint16 chr) const;
- void initDialogueBox();
- void initInventoryDialogueBox();
+ void initDialWindow();
+ void secondInitDialWindow();
- void initText(TextId index);
+ void commonOpenDial(TextId index);
void initLine();
void initInventoryText(InventoryItems index);
void initItemFoundText(InventoryItems index);
@@ -211,10 +216,10 @@ public:
/**
* Set font type parameters
- * @param spaceBetween number in pixels of space between characters
- * @param charSpace number in pixels of the character space
+ * @param interLeave number in pixels of space between characters
+ * @param interSpace number in pixels of the character space
*/
- void setFontParameters(int32 spaceBetween, int32 charSpace);
+ void setFont(int32 interLeave, int32 interSpace);
/**
* Set the font cross color
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 917baf5af36..8aed3bdcb27 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -332,7 +332,7 @@ Common::Error TwinEEngine::run() {
debug("Boot parameter: %i", sceneIndex);
_gameState->initEngineVars();
_text->normalWinDial();
- _text->_drawTextBoxBackground = true;
+ _text->_flagMessageShade = true;
_text->_renderTextTriangle = false;
_scene->_needChangeScene = sceneIndex;
_scene->_heroPositionType = ScenePositionType::kScene;
@@ -355,7 +355,7 @@ Common::Error TwinEEngine::run() {
}
_text->_renderTextTriangle = false;
_text->normalWinDial();
- _text->_drawTextBoxBackground = true;
+ _text->_flagMessageShade = true;
_state = EngineState::GameLoop;
break;
case EngineState::GameLoop:
@@ -702,7 +702,7 @@ void TwinEEngine::processBookOfBu() {
_screens->fadeToBlack(_screens->_paletteRGBA);
_screens->loadImage(TwineImage(Resources::HQR_RESS_FILE, 15, 16));
_text->initDial(TextBankId::Inventory_Intro_and_Holomap);
- _text->_drawTextBoxBackground = false;
+ _text->_flagMessageShade = false;
_text->bigWinDial();
_text->setFontCrossColor(COLOR_WHITE);
const bool tmpFlagDisplayText = _cfgfile.FlagDisplayText;
@@ -710,7 +710,7 @@ void TwinEEngine::processBookOfBu() {
_text->drawTextProgressive(TextId::kBookOfBu);
_cfgfile.FlagDisplayText = tmpFlagDisplayText;
_text->normalWinDial();
- _text->_drawTextBoxBackground = true;
+ _text->_flagMessageShade = true;
_text->initSceneTextBank();
_screens->fadeToBlack(_screens->_paletteRGBACustom);
_screens->clearScreen();
@@ -734,7 +734,7 @@ void TwinEEngine::processBonusList() {
void TwinEEngine::processInventoryAction() {
ScopedEngineFreeze scoped(this);
extInitSvga();
- _menu->processInventoryMenu();
+ _menu->inventory();
switch (_loopInventoryItem) {
case kiHolomap:
Commit: ff23c1d5c576a272106c5a2ae55eb421a847096e
https://github.com/scummvm/scummvm/commit/ff23c1d5c576a272106c5a2ae55eb421a847096e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-05T13:14:25+02:00
Commit Message:
TWINE: add dirty rects for rendering lines
Changed paths:
engines/twine/menu/interface.cpp
diff --git a/engines/twine/menu/interface.cpp b/engines/twine/menu/interface.cpp
index 9134c2f91fc..9d859ea6e66 100644
--- a/engines/twine/menu/interface.cpp
+++ b/engines/twine/menu/interface.cpp
@@ -142,6 +142,9 @@ bool Interface::drawLine(int32 x0, int32 y0, int32 x1, int32 y1, uint8 color) {
}
} while (--x1);
}
+
+ _engine->_frontVideoBuffer.addDirtyRect(Common::Rect(MIN<int16>(x0, x1), MIN<int16>(y0, y1), MAX<int16>(x0, x1), MAX<int16>(x0, x1)));
+
return true;
}
Commit: 934719321ed8a938a17acde96fe9296ab01924d0
https://github.com/scummvm/scummvm/commit/934719321ed8a938a17acde96fe9296ab01924d0
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-05T13:17:26+02:00
Commit Message:
TWINE: fixed position of inventory item box
Changed paths:
engines/twine/menu/menu.cpp
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index 9d3ed207057..ba8a84ed011 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -1360,7 +1360,7 @@ void Menu::inventory() {
}
const int32 left = _engine->width() / 2 - 303;
- const int32 top = _engine->height() / 2 - 210;
+ const int32 top = _engine->height() / 2 - 230;
drawListInventory(left, top);
_engine->_text->initDial(TextBankId::Inventory_Intro_and_Holomap);
More information about the Scummvm-git-logs
mailing list