diff options
author | Bendegúz Nagy | 2016-06-28 00:30:32 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 49aae8932bcb4698c37516f00ae2f6728044b0bd (patch) | |
tree | 1300c683f4196e05186eeb1bd8585ea741171b6f /engines/dm | |
parent | 652b2c6f98f291a76397c9035e4f8338b9c792f9 (diff) | |
download | scummvm-rg350-49aae8932bcb4698c37516f00ae2f6728044b0bd.tar.gz scummvm-rg350-49aae8932bcb4698c37516f00ae2f6728044b0bd.tar.bz2 scummvm-rg350-49aae8932bcb4698c37516f00ae2f6728044b0bd.zip |
DM: Add F0341_INVENTORY_DrawPanel_Scroll
Diffstat (limited to 'engines/dm')
-rw-r--r-- | engines/dm/dm.h | 2 | ||||
-rw-r--r-- | engines/dm/dungeonman.h | 1 | ||||
-rw-r--r-- | engines/dm/gfx.h | 3 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 48 | ||||
-rw-r--r-- | engines/dm/inventory.h | 2 |
5 files changed, 54 insertions, 2 deletions
diff --git a/engines/dm/dm.h b/engines/dm/dm.h index 5a7e548448..19eda10dfd 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -106,7 +106,7 @@ public: byte getCell() const { return _data >> 14; } ThingType getType() const { return (ThingType)((_data >> 10) & 0xF); } - uint16 getIndex() const { return _data & 0x1FF; } + uint16 getIndex() const { return _data & 0x3FF; } uint16 toUint16() const { return _data; } // I don't like 'em cast operators bool operator==(const Thing &rhs) const { return _data == rhs._data; } bool operator!=(const Thing &rhs) const { return _data != rhs._data; } diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h index 1175298917..767044e9af 100644 --- a/engines/dm/dungeonman.h +++ b/engines/dm/dungeonman.h @@ -389,6 +389,7 @@ public: } Thing getNextThing() { return _nextThing; } uint16 getClosed() { return (_attributes >> 10) & 0x3F; } // ??? dunno why, the original bitfield is 6 bits long + uint16 getTextStringThingIndex() { return _attributes & 0x3FF; } }; // @ SCROLL enum PotionType { diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 9354b99de3..3ff4bf5c33 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -74,7 +74,8 @@ enum GraphicIndice { kPanelRenameChampionIndice = 27, // @ C027_GRAPHIC_PANEL_RENAME_CHAMPION kMenuActionAreaIndice = 10, // @ C010_GRAPHIC_MENU_ACTION_AREA kMenuSpellAreLinesIndice = 11, // @ C011_GRAPHIC_MENU_SPELL_AREA_LINES - kMenuSpellAreaBackground = 9 // @ C009_GRAPHIC_MENU_SPELL_AREA_BACKGROUND + kMenuSpellAreaBackground = 9, // @ C009_GRAPHIC_MENU_SPELL_AREA_BACKGROUND + kPanelOpenScrollIndice = 23 // @ C023_GRAPHIC_PANEL_OPEN_SCROLL }; extern uint16 gPalSwoosh[16]; diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 1a08022e62..eb3192aae1 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -246,4 +246,52 @@ void InventoryMan::drawPanelScrollTextLine(int16 yPos, char* text) { } _vm->_textMan->printToViewport(162 - (6 * strlen(text) / 2), yPos, kColorBlack, text, kColorWhite); } + +void InventoryMan::drawPanelScroll(Scroll* scroll) { + DisplayMan &dispMan = *_vm->_displayMan; + + char stringFirstLine[300]; + _vm->_dungeonMan->decodeText(stringFirstLine, Thing(scroll->getTextStringThingIndex()), (TextType)(kTextTypeScroll | kDecodeEvenIfInvisible)); + char *charRed = stringFirstLine; + while (*charRed && (*charRed != '\n')) { + charRed++; + } + *charRed = '\0'; + dispMan.blitToScreen(dispMan.getBitmap(kPanelOpenScrollIndice), 144, 0, 0, gBoxPanel, kColorRed, gDungeonViewport); + int16 lineCount = 1; + charRed++; + char *charGreen = charRed; // first char of the second line + while (*charGreen) { + warning("BUG0_47"); + /* BUG0_47 Graphical glitch when you open a scroll. If there is a single line of text in a scroll + (with no carriage return) then charGreen points to undefined data. This may result in a graphical + glitch and also corrupt other memory. This is not an issue in the original dungeons where all + scrolls contain at least one carriage return character */ + if (*charGreen == '\n') { + lineCount++; + } + charGreen++; + } + if (*(charGreen - 1) != '\n') { + lineCount++; + } else if (*(charGreen - 2) == '\n') { + lineCount--; + } + int16 yPos = 92 - (7 * lineCount) / 2; // center the text vertically + drawPanelScrollTextLine(yPos, stringFirstLine); + charGreen = charRed; + while (*charGreen) { + yPos += 7; + while (*charRed && (*charRed != '\n')) { + charRed++; + } + if (!(*charRed)) { + charRed[1] = '\0'; + } + *charRed++ = '\0'; + drawPanelScrollTextLine(yPos, charGreen); + charGreen = charRed; + } +} + } diff --git a/engines/dm/inventory.h b/engines/dm/inventory.h index fe974b6c1b..3f6783b37c 100644 --- a/engines/dm/inventory.h +++ b/engines/dm/inventory.h @@ -28,6 +28,7 @@ #include "dm.h" #include "gfx.h" #include "champion.h" +#include "dungeonman.h" @@ -66,6 +67,7 @@ public: void drawPanel(); // @ F0347_INVENTORY_DrawPanel void closeChest(); // @ F0334_INVENTORY_CloseChest void drawPanelScrollTextLine(int16 yPos, char *text); // @ F0340_INVENTORY_DrawPanel_ScrollTextLine + void drawPanelScroll(Scroll *scoll); // @ F0341_INVENTORY_DrawPanel_Scroll }; |