diff options
author | Travis Howell | 2005-03-22 00:46:48 +0000 |
---|---|---|
committer | Travis Howell | 2005-03-22 00:46:48 +0000 |
commit | 097a3a0aacbeeba4a87332a2fabe3b9e38a821cb (patch) | |
tree | f47c84aa0c565da357cd7e37b9f9f6859399a8a3 | |
parent | 0bcb0ac2579faf061ec677e0b4ac8e37697d6dc7 (diff) | |
download | scummvm-rg350-097a3a0aacbeeba4a87332a2fabe3b9e38a821cb.tar.gz scummvm-rg350-097a3a0aacbeeba4a87332a2fabe3b9e38a821cb.tar.bz2 scummvm-rg350-097a3a0aacbeeba4a87332a2fabe3b9e38a821cb.zip |
Cleanup
svn-id: r17192
-rw-r--r-- | scumm/intern.h | 1 | ||||
-rw-r--r-- | scumm/scumm.cpp | 4 | ||||
-rw-r--r-- | scumm/verbs.cpp | 155 |
3 files changed, 87 insertions, 73 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index cc504bf166..07df03a8ed 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -244,6 +244,7 @@ protected: void setUserState(byte state); void initV2MouseOver(); + void initNESMouseOver(); /* Version 2 script opcodes */ void o2_actorFromPos(); diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 347d840252..033d2d8888 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1532,11 +1532,11 @@ void ScummEngine::scummInit() { void ScummEngine_v2::scummInit() { ScummEngine::scummInit(); - initV2MouseOver(); - if (_features & GF_NES) { + initNESMouseOver(); _switchRoomEffect2 = _switchRoomEffect = 6; } else { + initV2MouseOver(); // Seems in V2 there was only a single room effect (iris), // so we set that here. _switchRoomEffect2 = 1; diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp index be210b5239..982954f308 100644 --- a/scumm/verbs.cpp +++ b/scumm/verbs.cpp @@ -40,11 +40,7 @@ void ScummEngine_v2::initV2MouseOver() { int i; int arrow_color, color, hi_color; - if (_features & GF_NES) { - color = 0; - hi_color = 0; - arrow_color = 0; - } else if (_version == 1) { + if (_version == 1) { color = 16; hi_color = 7; arrow_color = 6; @@ -59,32 +55,18 @@ void ScummEngine_v2::initV2MouseOver() { // Inventory items for (i = 0; i < 2; i++) { - if (_features & GF_NES) { - v2_mouseover_boxes[2 * i].rect.left = 0; - v2_mouseover_boxes[2 * i].rect.right = 104; - v2_mouseover_boxes[2 * i].rect.top = 48 + 8 * i; - v2_mouseover_boxes[2 * i].rect.bottom = v2_mouseover_boxes[2 * i].rect.top + 8; - } else { - v2_mouseover_boxes[2 * i].rect.left = 0; - v2_mouseover_boxes[2 * i].rect.right = 144; - v2_mouseover_boxes[2 * i].rect.top = 32 + 8 * i; - v2_mouseover_boxes[2 * i].rect.bottom = v2_mouseover_boxes[2 * i].rect.top + 8; - } + v2_mouseover_boxes[2 * i].rect.left = 0; + v2_mouseover_boxes[2 * i].rect.right = 144; + v2_mouseover_boxes[2 * i].rect.top = 32 + 8 * i; + v2_mouseover_boxes[2 * i].rect.bottom = v2_mouseover_boxes[2 * i].rect.top + 8; v2_mouseover_boxes[2 * i].color = color; v2_mouseover_boxes[2 * i].hicolor = hi_color; - if (_features & GF_NES) { - v2_mouseover_boxes[2 * i + 1].rect.left = 120; - v2_mouseover_boxes[2 * i + 1].rect.right = 224; - v2_mouseover_boxes[2 * i + 1].rect.top = v2_mouseover_boxes[2 * i].rect.top; - v2_mouseover_boxes[2 * i + 1].rect.bottom = v2_mouseover_boxes[2 * i].rect.bottom; - } else { - v2_mouseover_boxes[2 * i + 1].rect.left = 176; - v2_mouseover_boxes[2 * i + 1].rect.right = 320; - v2_mouseover_boxes[2 * i + 1].rect.top = v2_mouseover_boxes[2 * i].rect.top; - v2_mouseover_boxes[2 * i + 1].rect.bottom = v2_mouseover_boxes[2 * i].rect.bottom; - } + v2_mouseover_boxes[2 * i + 1].rect.left = 176; + v2_mouseover_boxes[2 * i + 1].rect.right = 320; + v2_mouseover_boxes[2 * i + 1].rect.top = v2_mouseover_boxes[2 * i].rect.top; + v2_mouseover_boxes[2 * i + 1].rect.bottom = v2_mouseover_boxes[2 * i].rect.bottom; v2_mouseover_boxes[2 * i + 1].color = color; v2_mouseover_boxes[2 * i + 1].hicolor = hi_color; @@ -92,43 +74,85 @@ void ScummEngine_v2::initV2MouseOver() { // Inventory arrows - if (_features & GF_NES) { - v2_mouseover_boxes[kInventoryUpArrow].rect.left = 104; - v2_mouseover_boxes[kInventoryUpArrow].rect.right = 112; - v2_mouseover_boxes[kInventoryUpArrow].rect.top = 48; - v2_mouseover_boxes[kInventoryUpArrow].rect.bottom = 56; - } else { - v2_mouseover_boxes[kInventoryUpArrow].rect.left = 144; - v2_mouseover_boxes[kInventoryUpArrow].rect.right = 176; - v2_mouseover_boxes[kInventoryUpArrow].rect.top = 32; - v2_mouseover_boxes[kInventoryUpArrow].rect.bottom = 40; - } + v2_mouseover_boxes[kInventoryUpArrow].rect.left = 144; + v2_mouseover_boxes[kInventoryUpArrow].rect.right = 176; + v2_mouseover_boxes[kInventoryUpArrow].rect.top = 32; + v2_mouseover_boxes[kInventoryUpArrow].rect.bottom = 40; v2_mouseover_boxes[kInventoryUpArrow].color = arrow_color; v2_mouseover_boxes[kInventoryUpArrow].hicolor = hi_color; - if (_features & GF_NES) { - v2_mouseover_boxes[kInventoryDownArrow].rect.left = 112; - v2_mouseover_boxes[kInventoryDownArrow].rect.right = 120; - v2_mouseover_boxes[kInventoryDownArrow].rect.top = 48; - v2_mouseover_boxes[kInventoryDownArrow].rect.bottom = 56; - } else { - v2_mouseover_boxes[kInventoryDownArrow].rect.left = 144; - v2_mouseover_boxes[kInventoryDownArrow].rect.right = 176; - v2_mouseover_boxes[kInventoryDownArrow].rect.top = 40; - v2_mouseover_boxes[kInventoryDownArrow].rect.bottom = 48; + v2_mouseover_boxes[kInventoryDownArrow].rect.left = 144; + v2_mouseover_boxes[kInventoryDownArrow].rect.right = 176; + v2_mouseover_boxes[kInventoryDownArrow].rect.top = 40; + v2_mouseover_boxes[kInventoryDownArrow].rect.bottom = 48; + + v2_mouseover_boxes[kInventoryDownArrow].color = arrow_color; + v2_mouseover_boxes[kInventoryDownArrow].hicolor = hi_color; + + // Sentence line + + v2_mouseover_boxes[kSentenceLine].rect.left = 0; + v2_mouseover_boxes[kSentenceLine].rect.right = 320; + v2_mouseover_boxes[kSentenceLine].rect.top = 0; + v2_mouseover_boxes[kSentenceLine].rect.bottom = 8; + + v2_mouseover_boxes[kSentenceLine].color = color; + v2_mouseover_boxes[kSentenceLine].hicolor = hi_color; +} + +void ScummEngine_v2::initNESMouseOver() { + int i; + int arrow_color, color, hi_color; + + color = 0; + hi_color = 0; + arrow_color = 0; + + v2_mouseover_box = -1; + + // Inventory items + + for (i = 0; i < 2; i++) { + v2_mouseover_boxes[2 * i].rect.left = 0; + v2_mouseover_boxes[2 * i].rect.right = 104; + v2_mouseover_boxes[2 * i].rect.top = 48 + 8 * i; + v2_mouseover_boxes[2 * i].rect.bottom = v2_mouseover_boxes[2 * i].rect.top + 8; + + v2_mouseover_boxes[2 * i].color = color; + v2_mouseover_boxes[2 * i].hicolor = hi_color; + + v2_mouseover_boxes[2 * i + 1].rect.left = 120; + v2_mouseover_boxes[2 * i + 1].rect.right = 224; + v2_mouseover_boxes[2 * i + 1].rect.top = v2_mouseover_boxes[2 * i].rect.top; + v2_mouseover_boxes[2 * i + 1].rect.bottom = v2_mouseover_boxes[2 * i].rect.bottom; + + v2_mouseover_boxes[2 * i + 1].color = color; + v2_mouseover_boxes[2 * i + 1].hicolor = hi_color; } + // Inventory arrows + + v2_mouseover_boxes[kInventoryUpArrow].rect.left = 104; + v2_mouseover_boxes[kInventoryUpArrow].rect.right = 112; + v2_mouseover_boxes[kInventoryUpArrow].rect.top = 48; + v2_mouseover_boxes[kInventoryUpArrow].rect.bottom = 56; + + v2_mouseover_boxes[kInventoryUpArrow].color = arrow_color; + v2_mouseover_boxes[kInventoryUpArrow].hicolor = hi_color; + + v2_mouseover_boxes[kInventoryDownArrow].rect.left = 112; + v2_mouseover_boxes[kInventoryDownArrow].rect.right = 120; + v2_mouseover_boxes[kInventoryDownArrow].rect.top = 48; + v2_mouseover_boxes[kInventoryDownArrow].rect.bottom = 56; + v2_mouseover_boxes[kInventoryDownArrow].color = arrow_color; v2_mouseover_boxes[kInventoryDownArrow].hicolor = hi_color; // Sentence line v2_mouseover_boxes[kSentenceLine].rect.left = 0; - if (_features & GF_NES) - v2_mouseover_boxes[kSentenceLine].rect.right = 224; - else - v2_mouseover_boxes[kSentenceLine].rect.right = 320; + v2_mouseover_boxes[kSentenceLine].rect.right = 224; v2_mouseover_boxes[kSentenceLine].rect.top = 0; v2_mouseover_boxes[kSentenceLine].rect.bottom = 8; @@ -238,6 +262,7 @@ void ScummEngine::redrawV2Inventory() { int max_inv; Common::Rect inventoryBox; int inventoryArea = (_features & GF_NES) ? 48: 32; + int maxChars = (_features & GF_NES) ? 13: 18; v2_mouseover_box = -1; @@ -269,25 +294,13 @@ void ScummEngine::redrawV2Inventory() { const byte *tmp = getObjOrActorName(obj); assert(tmp); - if (_features & GF_NES) { - // Prevent inventory entries from overflowing by truncating the text - // after 104/8 = 13 chars - byte msg[13 + 1]; - msg[13] = 0; - strncpy((char *)msg, (const char *)tmp, 13); - - // Draw it - drawString(1, msg); - } else { - // Prevent inventory entries from overflowing by truncating the text - // after 144/8 = 18 chars - byte msg[18 + 1]; - msg[18] = 0; - strncpy((char *)msg, (const char *)tmp, 18); - - // Draw it - drawString(1, msg); - } + // Prevent inventory entries from overflowing by truncating the text + byte msg[20]; + msg[maxChars] = 0; + strncpy((char *)msg, (const char *)tmp, maxChars); + + // Draw it + drawString(1, msg); } |