diff options
author | Max Horn | 2004-01-15 19:25:17 +0000 |
---|---|---|
committer | Max Horn | 2004-01-15 19:25:17 +0000 |
commit | ac8243d22919a9da621daef429058d75b504c264 (patch) | |
tree | 6a1257b858c90ac6b94f0a1680415d978ecde093 | |
parent | d45682f7c50a558ff6609e443ed70f786567ff72 (diff) | |
download | scummvm-rg350-ac8243d22919a9da621daef429058d75b504c264.tar.gz scummvm-rg350-ac8243d22919a9da621daef429058d75b504c264.tar.bz2 scummvm-rg350-ac8243d22919a9da621daef429058d75b504c264.zip |
use Rect in struct VerbSlot
svn-id: r12413
-rw-r--r-- | scumm/saveload.cpp | 16 | ||||
-rw-r--r-- | scumm/script_v2.cpp | 4 | ||||
-rw-r--r-- | scumm/script_v5.cpp | 24 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 8 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 4 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 4 | ||||
-rw-r--r-- | scumm/verbs.cpp | 33 | ||||
-rw-r--r-- | scumm/verbs.h | 5 |
8 files changed, 47 insertions, 51 deletions
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index d90d34341a..a3ab239b5b 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -326,14 +326,14 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) { const SaveLoadEntry *actorEntries = Actor::getSaveLoadEntries(); const SaveLoadEntry verbEntries[] = { - MKLINE(VerbSlot, x, sleInt16, VER(8)), - MKLINE(VerbSlot, y, sleInt16, VER(8)), - MKLINE(VerbSlot, right, sleInt16, VER(8)), - MKLINE(VerbSlot, bottom, sleInt16, VER(8)), - MKLINE(VerbSlot, old.left, sleInt16, VER(8)), - MKLINE(VerbSlot, old.top, sleInt16, VER(8)), - MKLINE(VerbSlot, old.right, sleInt16, VER(8)), - MKLINE(VerbSlot, old.bottom, sleInt16, VER(8)), + MKLINE(VerbSlot, curRect.left, sleInt16, VER(8)), + MKLINE(VerbSlot, curRect.top, sleInt16, VER(8)), + MKLINE(VerbSlot, curRect.right, sleInt16, VER(8)), + MKLINE(VerbSlot, curRect.bottom, sleInt16, VER(8)), + MKLINE(VerbSlot, oldRect.left, sleInt16, VER(8)), + MKLINE(VerbSlot, oldRect.top, sleInt16, VER(8)), + MKLINE(VerbSlot, oldRect.right, sleInt16, VER(8)), + MKLINE(VerbSlot, oldRect.bottom, sleInt16, VER(8)), MKLINE_OLD(VerbSlot, verbid, sleByte, VER(8), VER(11)), MKLINE(VerbSlot, verbid, sleInt16, VER(12)), diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index 5768f27189..f1cc18b4ab 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -844,8 +844,8 @@ void ScummEngine_v2::o2_verbOps() { vs->imgindex = 0; vs->prep = prep; - vs->x = x; - vs->y = y; + vs->curRect.left = x; + vs->curRect.top = y; // FIXME: again, this map depends on the language of the game. // E.g. a german keyboard has 'z' and 'y' swapped, while a french diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index 777723cde3..9d93ac4b93 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -2421,8 +2421,8 @@ void ScummEngine_v5::o5_verbOps() { vs->hicolor = getVarOrDirectByte(PARAM_1); break; case 5: // SO_VERB_AT - vs->x = getVarOrDirectWord(PARAM_1); - vs->y = getVarOrDirectWord(PARAM_2); + vs->curRect.left = getVarOrDirectWord(PARAM_1); + vs->curRect.top = getVarOrDirectWord(PARAM_2); // Macintosh verison of indy3ega used different interface, so adjust values. if ((_features & GF_MACINTOSH) && (_gameId == GID_INDY3)) { if ((verb > 0) && (verb < 14) || (verb > 31) && (verb < 35)) { @@ -2430,23 +2430,23 @@ void ScummEngine_v5::o5_verbOps() { case 1: case 2: case 9: - vs->x += 16; + vs->curRect.left += 16; break; case 10: case 11: case 12: - vs->x += 36; + vs->curRect.left += 36; break; case 4: case 5: case 8: - vs->x += 60; + vs->curRect.left += 60; break; case 13: case 32: case 33: case 34: - vs->x += 90; + vs->curRect.left += 90; break; } } @@ -2456,22 +2456,22 @@ void ScummEngine_v5::o5_verbOps() { switch (verb) { case 90: case 91: - vs->y -= 7; + vs->curRect.top -= 7; break; case 92: - vs->y -= 6; + vs->curRect.top -= 6; break; case 93: - vs->y -= 4; + vs->curRect.top -= 4; break; case 94: - vs->y -= 3; + vs->curRect.top -= 3; break; case 95: - vs->y -= 1; + vs->curRect.top -= 1; break; case 97: - vs->y -= 5; + vs->curRect.top -= 5; } } } diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index abf6b601d7..dc316d271c 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -1867,8 +1867,8 @@ void ScummEngine_v6::o6_verbOps() { vs->hicolor = pop(); break; case 128: // SO_VERB_AT - vs->y = pop(); - vs->x = pop(); + vs->curRect.top = pop(); + vs->curRect.left = pop(); break; case 129: // SO_VERB_ON vs->curmode = 1; @@ -2682,11 +2682,11 @@ void ScummEngine_v6::o6_kernelGetFunctions() { break; case 213: slot = getVerbSlot(args[1], 0); - push(_verbs[slot].x); + push(_verbs[slot].curRect.left); break; case 214: slot = getVerbSlot(args[1], 0); - push(_verbs[slot].y); + push(_verbs[slot].curRect.top); break; case 215: if ((_extraBoxFlags[args[1]] & 0x00FF) == 0x00C0) { diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 9abaff196c..acb9b06d59 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -1155,8 +1155,8 @@ void ScummEngine_v8::o8_verbOps() { vs->imgindex = 0; break; case 0x9A: // SO_VERB_AT Set verb (X,Y) placement - vs->y = pop(); - vs->x = pop(); + vs->curRect.top = pop(); + vs->curRect.left = pop(); break; case 0x9B: // SO_VERB_ON Turn verb on vs->curmode = 1; diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 688be0424e..8786d9cca9 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -1073,8 +1073,8 @@ void ScummEngine::scummInit() { for (i = 0; i < _numVerbs; i++) { _verbs[i].verbid = 0; - _verbs[i].right = _screenWidth - 1; - _verbs[i].old.left = -1; + _verbs[i].curRect.right = _screenWidth - 1; + _verbs[i].oldRect.left = -1; _verbs[i].type = 0; _verbs[i].color = 2; _verbs[i].hicolor = 0; diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp index 6e22fcc561..93a0d13fd8 100644 --- a/scumm/verbs.cpp +++ b/scumm/verbs.cpp @@ -345,13 +345,13 @@ int ScummEngine::checkMouseOver(int x, int y) const { vs = &_verbs[i]; do { - if (vs->curmode != 1 || !vs->verbid || vs->saveid || y < vs->y || y >= vs->bottom) + if (vs->curmode != 1 || !vs->verbid || vs->saveid || y < vs->curRect.top || y >= vs->curRect.bottom) continue; if (vs->center) { - if (x < -(vs->right - vs->x - vs->x) || x >= vs->right) + if (x < -(vs->curRect.right - 2 * vs->curRect.left) || x >= vs->curRect.right) continue; } else { - if (x < vs->x || x >= vs->right) + if (x < vs->curRect.left || x >= vs->curRect.right) continue; } @@ -372,15 +372,15 @@ void ScummEngine::drawVerb(int verb, int mode) { if (!vs->saveid && vs->curmode && vs->verbid) { if (vs->type == kImageVerbType) { - drawVerbBitmap(verb, vs->x, vs->y); + drawVerbBitmap(verb, vs->curRect.left, vs->curRect.top); return; } restoreVerbBG(verb); _string[4].charset = vs->charset_nr; - _string[4].xpos = vs->x; - _string[4].ypos = vs->y; + _string[4].xpos = vs->curRect.left; + _string[4].ypos = vs->curRect.top; _string[4].right = _screenWidth - 1; _string[4].center = vs->center; @@ -412,9 +412,9 @@ void ScummEngine::drawVerb(int verb, int mode) { drawString(4); _charset->_center = tmp; - vs->right = _charset->_str.right; - vs->bottom = _charset->_str.bottom; - vs->old = _charset->_str; + vs->curRect.right = _charset->_str.right; + vs->curRect.bottom = _charset->_str.bottom; + vs->oldRect = _charset->_str; _charset->_str.left = _charset->_str.right; } else { restoreVerbBG(verb); @@ -426,9 +426,9 @@ void ScummEngine::restoreVerbBG(int verb) { vs = &_verbs[verb]; - if (vs->old.left != -1) { - restoreBG(vs->old, vs->bkcolor); - vs->old.left = -1; + if (vs->oldRect.left != -1) { + restoreBG(vs->oldRect, vs->bkcolor); + vs->oldRect.left = -1; } } @@ -490,12 +490,9 @@ void ScummEngine::drawVerbBitmap(int verb, int x, int y) { } vst = &_verbs[verb]; - vst->right = vst->x + imgw * 8; - vst->bottom = vst->y + imgh * 8; - vst->old.left = vst->x; - vst->old.right = vst->right; - vst->old.top = vst->y; - vst->old.bottom = vst->bottom; + vst->curRect.right = vst->curRect.left + imgw * 8; + vst->curRect.bottom = vst->curRect.right + imgh * 8; + vst->oldRect = vst->curRect; gdi.enableZBuffer(); diff --git a/scumm/verbs.h b/scumm/verbs.h index 11955b02b3..79f9c958b0 100644 --- a/scumm/verbs.h +++ b/scumm/verbs.h @@ -32,9 +32,8 @@ enum { }; struct VerbSlot { - int16 x, y; - int16 right, bottom; - Common::Rect old; + Common::Rect curRect; + Common::Rect oldRect; uint16 verbid; uint8 color, hicolor, dimcolor, bkcolor, type; uint8 charset_nr, curmode; |