diff options
author | Matthew Stewart | 2018-05-28 18:45:44 -0400 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-09 08:37:30 +0200 |
commit | 30c41ae6341045ca6aacf0532aa413402a5c0656 (patch) | |
tree | 3d2ff57c15b999add6a626e3cb8f786c972541f1 /engines/startrek/room.cpp | |
parent | 29e62d1a187e0df65411b8c5e3f7ed663dc421d5 (diff) | |
download | scummvm-rg350-30c41ae6341045ca6aacf0532aa413402a5c0656.tar.gz scummvm-rg350-30c41ae6341045ca6aacf0532aa413402a5c0656.tar.bz2 scummvm-rg350-30c41ae6341045ca6aacf0532aa413402a5c0656.zip |
STARTREK: Refactor text using integer constants
Diffstat (limited to 'engines/startrek/room.cpp')
-rw-r--r-- | engines/startrek/room.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp index 1de12153f1..d44ad9632a 100644 --- a/engines/startrek/room.cpp +++ b/engines/startrek/room.cpp @@ -160,8 +160,6 @@ void Room::loadActorAnim2(int actorIndex, Common::String anim, int16 x, int16 y, loadActorAnim(actorIndex, anim, x, y, finishedAnimActionParam); } -// TODO: replace "rdfOffset" with a pointer, so we no longer read from RDF files? (This -// may be necessary to support other platforms; can't leave offsets hardcoded.) int Room::showRoomSpecificText(const char **array) { Common::String speaker; byte textColor; @@ -191,6 +189,32 @@ int Room::showRoomSpecificText(const char **array) { return _vm->showText(&StarTrekEngine::readTextFromArray, (uintptr)array, 20, 20, textColor, true, false, false); } +int Room::showText(const int *textIDs) { + int numIDs = 0; + while (textIDs[numIDs] != TX_BLANK) + numIDs++; + + const char **text = (const char **)malloc(sizeof(const char *) * (numIDs + 1)); + for (int i = 0; i <= numIDs; i++) + text[i] = g_gameStrings[textIDs[i]]; + int retval = showRoomSpecificText(text); + free(text); + + return retval; +} + +int Room::showText(int speaker, int text) { + int textIDs[3]; + textIDs[0] = speaker; + textIDs[1] = text; + textIDs[2] = TX_BLANK; + showText(textIDs); +} + +int Room::showText(int text) { + showText(TX_NULL, text); +} + void Room::giveItem(int item) { _vm->_itemList[item - ITEMS_START].have = true; } |