mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
HUGO: Avoid drawing text above screen (bug #6799)
When drawing cursor text, don't draw it above the top of the screen, since this would lead to memory corruption and crashes. I'm not quite sure this is all of bug #6799 since it also mentioned that "sometimes simply using a hotspot will be enough", but it's a start.
This commit is contained in:
parent
666a4f3a57
commit
531029f54a
@ -121,12 +121,24 @@ void MouseHandler::cursorText(const char *buffer, const int16 cx, const int16 cy
|
||||
int16 sx, sy;
|
||||
if (cx < kXPix / 2) {
|
||||
sx = cx + kCursorNameOffX;
|
||||
sy = (_vm->_inventory->getInventoryObjId() == -1) ? cy + kCursorNameOffY : cy + kCursorNameOffY - (_vm->_screen->fontHeight() + 1);
|
||||
if (_vm->_inventory->getInventoryObjId() == -1) {
|
||||
sy = cy + kCursorNameOffY;
|
||||
} else {
|
||||
sy = cy + kCursorNameOffY - (_vm->_screen->fontHeight() + 1);
|
||||
if (sy < 0) {
|
||||
sx = cx + kCursorNameOffX + 25;
|
||||
sy = cy + kCursorNameOffY;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sx = cx - sdx - kCursorNameOffX / 2;
|
||||
sy = cy + kCursorNameOffY;
|
||||
}
|
||||
|
||||
if (sy < 0) {
|
||||
sy = 0;
|
||||
}
|
||||
|
||||
// Display the string and add rect to display list
|
||||
_vm->_screen->shadowStr(sx, sy, buffer, _TBRIGHTWHITE);
|
||||
_vm->_screen->displayList(kDisplayAdd, sx, sy, sdx, sdy);
|
||||
|
Loading…
Reference in New Issue
Block a user