[Scummvm-git-logs] scummvm master -> 2fdb55e0abb428d0523e8f0edbaa74aa9767d51f
mgerhardy
martin.gerhardy at gmail.com
Mon Dec 28 12:05:15 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8ac20a9540 TWINE: comments
367b46d325 TWINE: fixed continue reading button for fullscreen texts
2fdb55e0ab TWINE: renamed var
Commit: 8ac20a9540892cf9c7e22068706edbbc5099c3b3
https://github.com/scummvm/scummvm/commit/8ac20a9540892cf9c7e22068706edbbc5099c3b3
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-28T13:04:28+01:00
Commit Message:
TWINE: comments
Changed paths:
engines/twine/text.cpp
diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index 63acbb9ff2..0a9c95e256 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -414,6 +414,7 @@ void Text::processTextLine() {
break;
}
+ // @ is a line break
if (*wordBuf == '@') {
moreWordsFollowing = false;
buffer++;
@@ -422,6 +423,7 @@ void Text::processTextLine() {
*(_progressiveTextBuffer + 0) = ' ';
*(_progressiveTextBuffer + 1) = ' ';
}
+ // new page?
if (wordBuf[1] == 'P') {
_dialTextBoxCurrentLine = _dialTextBoxLines;
buffer++;
Commit: 367b46d325516e4a1780f52e50ca2d39fced9075
https://github.com/scummvm/scummvm/commit/367b46d325516e4a1780f52e50ca2d39fced9075
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-28T13:04:28+01:00
Commit Message:
TWINE: fixed continue reading button for fullscreen texts
Changed paths:
engines/twine/text.cpp
diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index 0a9c95e256..4577bc31d1 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -91,7 +91,7 @@ bool Text::initVoxToPlay(int32 index) { // setVoxFileAtDigit
Common::MemoryReadStream stream((const byte *)dialOrderPtr, dialOrderSize);
// choose right text from order index
for (int32 i = 0; i < numDialTextEntries; i++) {
- int32 orderIdx = stream.readSint16LE();
+ const int32 orderIdx = stream.readSint16LE();
if (orderIdx == index) {
currDialTextEntry = i;
break;
@@ -470,17 +470,17 @@ void Text::renderContinueReadingTriangle() {
Vertex vertices[3];
- vertices[0].colorIndex = _dialTextStopColor;
+ vertices[0].colorIndex = 136;
vertices[0].x = right;
vertices[0].y = top;
- vertices[1].colorIndex = _dialTextStopColor;
+ vertices[1].colorIndex = 136;
vertices[1].x = left;
vertices[1].y = bottom;
- vertices[2].colorIndex = _dialTextStartColor;
- vertices[2].x = _engine->_renderer->vertexCoordinates[1];
- vertices[2].y = _engine->_renderer->vertexCoordinates[5];
+ vertices[2].colorIndex = 136;
+ vertices[2].x = right;
+ vertices[2].y = bottom;
CmdRenderPolygon polygon;
polygon.numVertices = 3;
Commit: 2fdb55e0abb428d0523e8f0edbaa74aa9767d51f
https://github.com/scummvm/scummvm/commit/2fdb55e0abb428d0523e8f0edbaa74aa9767d51f
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-28T13:04:28+01:00
Commit Message:
TWINE: renamed var
Changed paths:
engines/twine/menu/menu.cpp
engines/twine/text.cpp
engines/twine/text.h
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index d6ac1fc982..bbf627017a 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -1129,6 +1129,7 @@ void Menu::processInventoryMenu() {
const bool cursorUp = _engine->_input->toggleActionIfActive(TwinEActionType::UIUp);
const bool cursorLeft = _engine->_input->toggleActionIfActive(TwinEActionType::UILeft);
const bool cursorRight = _engine->_input->toggleActionIfActive(TwinEActionType::UIRight);
+
if (cursorDown) {
inventorySelectedItem++;
if (inventorySelectedItem >= NUM_INVENTORY_ITEMS) {
@@ -1161,7 +1162,6 @@ void Menu::processInventoryMenu() {
if (updateItemText) {
_engine->_text->initInventoryDialogueBox();
-
if (inventorySelectedItem < NUM_INVENTORY_ITEMS && _engine->_gameState->hasItem((InventoryItems)inventorySelectedItem) && !_engine->_gameState->inventoryDisabled()) {
_engine->_text->initInventoryText(inventorySelectedItem);
} else {
diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index 4577bc31d1..80e6e23c70 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -329,7 +329,7 @@ void Text::initText(int32 index) {
_progressiveTextEnd = false;
_progressiveTextNextPage = false;
_dialTextYPos = _dialTextBox.top + 8;
- _progressiveTextNextWord = _currDialTextPtr;
+ _currentTextPosition = _currDialTextPtr;
// lba font is get while engine start
setFontParameters(2, 7);
@@ -385,7 +385,7 @@ Text::WordSize Text::getWordSize(const char *completeText, char *wordBuf, int32
}
void Text::processTextLine() {
- const char *buffer = _progressiveTextNextWord;
+ const char *buffer = _currentTextPosition;
_dialCharSpace = 7;
bool moreWordsFollowing = true;
@@ -407,7 +407,7 @@ void Text::processTextLine() {
break;
}
- _progressiveTextNextWord = buffer;
+ _currentTextPosition = buffer;
char wordBuf[256] = "";
WordSize wordSize = getWordSize(buffer, wordBuf, sizeof(wordBuf));
if (lineBreakX + _dialCharSpace + wordSize.inPixel >= _dialTextBoxMaxX) {
@@ -432,14 +432,14 @@ void Text::processTextLine() {
}
buffer += wordSize.inChar;
- _progressiveTextNextWord = buffer;
+ _currentTextPosition = buffer;
strncat(_progressiveTextBuffer, wordBuf, sizeof(_progressiveTextBuffer) - strlen(_progressiveTextBuffer) - 1);
strncat(_progressiveTextBuffer, " ", sizeof(_progressiveTextBuffer) - strlen(_progressiveTextBuffer) - 1); // not 100% accurate
spaceCharCount++;
lineBreakX += wordSize.inPixel + _dialCharSpace;
- if (*_progressiveTextNextWord != '\0') {
- _progressiveTextNextWord++;
+ if (*_currentTextPosition != '\0') {
+ _currentTextPosition++;
continue;
}
break;
@@ -449,7 +449,7 @@ void Text::processTextLine() {
spaceCharCount--;
}
- if (*_progressiveTextNextWord != '\0' && moreWordsFollowing) {
+ if (*_currentTextPosition != '\0' && moreWordsFollowing) {
if (spaceCharCount <= 0) {
spaceCharCount = 1;
}
@@ -457,7 +457,7 @@ void Text::processTextLine() {
_dialCharSpace += (_dialTextBoxMaxX - lineBreakX) / spaceCharCount;
}
- _progressiveTextNextWord = buffer;
+ _currentTextPosition = buffer;
_progressiveTextBufferPtr = _progressiveTextBuffer;
}
@@ -544,14 +544,13 @@ ProgressiveTextState Text::updateProgressiveText() {
_dialTextXPos = _dialTextBox.left + 8;
_dialTextYPos = _dialTextBox.top + 8;
}
- if (*_progressiveTextNextWord == '\0') {
+ if (*_currentTextPosition == '\0') {
initProgressiveTextBuffer();
_progressiveTextEnd = true;
return ProgressiveTextState::UNK1;
}
processTextLine();
}
-
const char currentChar = *_progressiveTextBufferPtr;
// RECHECK this later
if (currentChar == '\0') {
@@ -560,7 +559,7 @@ ProgressiveTextState Text::updateProgressiveText() {
fillFadeInBuffer(_dialTextXPos, _dialTextYPos, currentChar);
fadeInCharacters(_fadeInCharactersPos, _dialTextStartColor);
- int8 charWidth = getCharWidth(currentChar);
+ const int8 charWidth = getCharWidth(currentChar);
if (currentChar == ' ') {
_dialTextXPos += _dialCharSpace + 1;
@@ -571,6 +570,7 @@ ProgressiveTextState Text::updateProgressiveText() {
// next character
_progressiveTextBufferPtr++;
+ // reaching 0-byte means a new line - as we are fading in per line
if (*_progressiveTextBufferPtr != '\0') {
return ProgressiveTextState::UNK1;
}
@@ -592,7 +592,7 @@ ProgressiveTextState Text::updateProgressiveText() {
initProgressiveTextBuffer();
_progressiveTextNextPage = true;
- if (*_progressiveTextNextWord == '\0') {
+ if (*_currentTextPosition == '\0') {
_progressiveTextEnd = true;
}
diff --git a/engines/twine/text.h b/engines/twine/text.h
index 7e7a36f1fd..1256854a66 100644
--- a/engines/twine/text.h
+++ b/engines/twine/text.h
@@ -168,11 +168,14 @@ private:
// TODO: refactor all this variables and related functions
char _progressiveTextBuffer[256] {'\0'};
- const char *_progressiveTextNextWord = nullptr;
+ const char *_currentTextPosition = nullptr;
int32 _dialTextXPos = 0;
int32 _dialTextYPos = 0;
+
+ /** Current position of in the buffer of characters that are currently faded in */
char *_progressiveTextBufferPtr = nullptr;
+
int32 _dialTextBoxCurrentLine = 0;
bool _progressiveTextEnd = false;
bool _progressiveTextNextPage = false;
More information about the Scummvm-git-logs
mailing list