TRECISION: Fix incorrect object rects

This commit is contained in:
SupSuper 2021-04-29 02:28:29 +01:00
parent 4c78fb9fbe
commit 3f6196f31b
3 changed files with 6 additions and 4 deletions

View file

@ -44,7 +44,7 @@ DialogManager::~DialogManager() {}
void DialogManager::dialogPrint(int x, int y, int c, const char *txt) { void DialogManager::dialogPrint(int x, int y, int c, const char *txt) {
SDText curChoice; SDText curChoice;
curChoice.set( curChoice.set(
Common::Rect(x, y, _vm->textLength(txt, 0), 0), Common::Rect(x, y, _vm->textLength(txt, 0) + x, y),
Common::Rect(0, 0, MAXX, MAXY), Common::Rect(0, 0, MAXX, MAXY),
c, c,
MASKCOL, MASKCOL,

View file

@ -501,10 +501,12 @@ void TrecisionEngine::LoadAll() {
} }
for (int i = 0; i < MAXOBJ; ++i) { for (int i = 0; i < MAXOBJ; ++i) {
uint16 w = dataNl.readUint16LE();
uint16 h = dataNl.readUint16LE();
_obj[i]._rect.left = dataNl.readUint16LE(); _obj[i]._rect.left = dataNl.readUint16LE();
_obj[i]._rect.top = dataNl.readUint16LE(); _obj[i]._rect.top = dataNl.readUint16LE();
_obj[i]._rect.right = dataNl.readUint16LE(); _obj[i]._rect.right = w + _obj[i]._rect.left;
_obj[i]._rect.bottom = dataNl.readUint16LE(); _obj[i]._rect.bottom = h + _obj[i]._rect.top;
_obj[i]._lim.left = dataNl.readUint16LE(); _obj[i]._lim.left = dataNl.readUint16LE();
_obj[i]._lim.top = dataNl.readUint16LE(); _obj[i]._lim.top = dataNl.readUint16LE();

View file

@ -257,7 +257,7 @@ bool TrecisionEngine::checkMask(uint16 mx, uint16 my) {
for (uint16 b = _obj[checkedObj]._rect.top; b < max; b++) { for (uint16 b = _obj[checkedObj]._rect.top; b < max; b++) {
bool insideObj = false; bool insideObj = false;
int16 e = 0; int16 e = 0;
while (e < _obj[checkedObj]._rect.right) { while (e < _obj[checkedObj]._rect.width()) {
if (!insideObj) { // not inside an object if (!insideObj) { // not inside an object
if (b + TOP == my) { if (b + TOP == my) {
if ((mx >= d + e) && (mx < d + e + *mask)) { if ((mx >= d + e) && (mx < d + e + *mask)) {