aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins/font.cpp
diff options
context:
space:
mode:
authorStrangerke2013-01-11 21:27:04 +0100
committerStrangerke2013-01-11 21:27:04 +0100
commit8fa4b4b8466a6b94523c40f57ce6459134fced54 (patch)
tree0aa94fcebad2db93c33374c941f3fbe6df70a35f /engines/hopkins/font.cpp
parent86eb21e8855e885b7a76cd4dfe57997d82e4eb80 (diff)
downloadscummvm-rg350-8fa4b4b8466a6b94523c40f57ce6459134fced54.tar.gz
scummvm-rg350-8fa4b4b8466a6b94523c40f57ce6459134fced54.tar.bz2
scummvm-rg350-8fa4b4b8466a6b94523c40f57ce6459134fced54.zip
HOPKINS: Start refactoring PARC_VOITURE, some renaming
Diffstat (limited to 'engines/hopkins/font.cpp')
-rw-r--r--engines/hopkins/font.cpp47
1 files changed, 22 insertions, 25 deletions
diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp
index 8b2bc51b90..492bde5ebd 100644
--- a/engines/hopkins/font.cpp
+++ b/engines/hopkins/font.cpp
@@ -450,35 +450,31 @@ void FontManager::displayText(int xp, int yp, const Common::String &message, int
}
}
-void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col) {
- const char *srcP;
- int v5;
- int v6;
- byte v7;
- int fontCol;
- int v9;
-
- srcP = msg.c_str();
- v9 = xp;
- fontCol = col;
- do {
- v7 = *srcP++;
- if (v7 == '&') {
+/**
+ * Compute character width and render text using variable width fonts
+ */
+void FontManager::renderTextDisplay(int xp, int yp, const Common::String &msg, int col) {
+ const char *srcP = msg.c_str();
+ int charEndPosX = xp;
+ int fontCol = col;
+ byte curChar = *srcP++;
+ while (curChar) {
+ if (curChar == '&') {
fontCol = 2;
- v7 = *srcP++;
+ curChar = *srcP++;
}
- if (v7 == '$') {
+ if (curChar == '$') {
fontCol = 4;
- v7 = *srcP++;
+ curChar = *srcP++;
}
- if (!v7)
+ if (!curChar)
break;
- if (v7 >= 32) {
- v5 = v7 - 32;
- _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, v9, yp, v7 - 32, fontCol);
- v9 += _vm->_objectsManager.getWidth(_vm->_globals.police, v5);
- v6 = _vm->_objectsManager.getWidth(_vm->_globals.police, v5);
- _vm->_graphicsManager.addVesaSegment(v9 - v6, yp, v9, yp + 12);
+ if (curChar >= 32) {
+ byte printChar = curChar - 32;
+ _vm->_graphicsManager.displayFont(_vm->_graphicsManager._vesaBuffer, _vm->_globals.police, charEndPosX, yp, printChar, fontCol);
+ charEndPosX += _vm->_objectsManager.getWidth(_vm->_globals.police, printChar);
+ int charWidth = _vm->_objectsManager.getWidth(_vm->_globals.police, printChar);
+ _vm->_graphicsManager.addVesaSegment(charEndPosX - charWidth, yp, charEndPosX, yp + 12);
if (_vm->_eventsManager._escKeyFl) {
_vm->_globals.iRegul = 1;
_vm->_eventsManager.VBL();
@@ -488,7 +484,8 @@ void FontManager::TEXT_COMPUT(int xp, int yp, const Common::String &msg, int col
_vm->_globals.iRegul = 1;
}
}
- } while (v7);
+ curChar = *srcP++;
+ }
}
} // End of namespace Hopkins