mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-20 17:03:05 +00:00
DM: Add F0341_INVENTORY_DrawPanel_Scroll
This commit is contained in:
parent
652b2c6f98
commit
49aae8932b
@ -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; }
|
||||
|
@ -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 {
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user