diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index b2a252c8f89..be722c4bd02 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -24,6 +24,7 @@ #include "sound/mididrv.h" #include "scumm.h" #include "imuse.h" +#include "verbs.h" #include "gui/newgui.h" #include "gui/ListWidget.h" diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 71dbe9e03b8..6451c3f7e38 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -1756,8 +1756,6 @@ void Gdi::unkDecode11() void Scumm::restoreCharsetBg() { - _bkColor = 0; - if (gdi._mask_left != -1) { restoreBG(gdi._mask_left, gdi._mask_top, gdi._mask_right, gdi._mask_bottom); charset._hasMask = false; @@ -1770,7 +1768,7 @@ void Scumm::restoreCharsetBg() charset._ypos2 = _string[0].ypos; } -void Scumm::restoreBG(int left, int top, int right, int bottom) +void Scumm::restoreBG(int left, int top, int right, int bottom, byte backColor) { VirtScreen *vs; int topline, height, width; @@ -1832,7 +1830,7 @@ void Scumm::restoreBG(int left, int top, int right, int bottom) } } else { while (height--) { - memset(backbuff, _bkColor, width); + memset(backbuff, backColor, width); backbuff += _realWidth; } } diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 31c86c81a41..24cf0df85d4 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -23,6 +23,7 @@ #include "stdafx.h" #include "scumm.h" #include "resource.h" +#include "verbs.h" #include "scumm/sound.h" #include diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index 83917078c60..bedb3eebb98 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -29,6 +29,7 @@ #include "config-file.h" #include "resource.h" #include "saveload.h" +#include "verbs.h" struct SaveGameHeader { uint32 type; diff --git a/scumm/script_v1.cpp b/scumm/script_v1.cpp index 09958af3efd..6a6146d9cb0 100644 --- a/scumm/script_v1.cpp +++ b/scumm/script_v1.cpp @@ -23,6 +23,7 @@ #include "stdafx.h" #include "scumm.h" #include "actor.h" +#include "verbs.h" #include "scumm/sound.h" #define OPCODE(x) { &Scumm::x, #x } diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index 048a809edf2..9f53e85386a 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -24,6 +24,7 @@ #include "stdafx.h" #include "scumm.h" #include "actor.h" +#include "verbs.h" #include "smush/player.h" #include "smush/scumm_renderer.h" diff --git a/scumm/scumm.h b/scumm/scumm.h index f1458183bac..620e398f78a 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -72,19 +72,7 @@ struct MemBlkHeader { uint32 size; }; -struct VerbSlot { - int16 x, y; - int16 right, bottom; - int16 oldleft, oldtop, oldright, oldbottom; - uint8 verbid; - uint8 color, hicolor, dimcolor, bkcolor, type; - uint8 charset_nr, curmode; - uint8 saveid; - uint8 key; - bool center; - uint8 field_1B; - uint16 imgindex; -}; +struct VerbSlot; class ObjectData { public: @@ -733,7 +721,7 @@ public: void drawRoomObject(int i, int arg); void drawBox(int x, int y, int x2, int y2, int color); - void restoreBG(int left, int top, int right, int bottom); + void restoreBG(int left, int top, int right, int bottom, byte backColor = 0); void redrawBGStrip(int start, int num); void redrawBGAreas(); @@ -850,7 +838,6 @@ public: byte _proc_special_palette[256]; int _palDirtyMin, _palDirtyMax; - byte _bkColor; uint16 _lastXstart; byte _haveMsg; diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index b674c6556e1..322f976d74e 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -22,21 +22,22 @@ #include "stdafx.h" #include "scumm.h" -#include "sound/mixer.h" -#include "sound/mididrv.h" -#include "scumm/sound.h" -#include "scumm/imuse.h" -#include "scumm/bundle.h" #include "actor.h" +#include "bundle.h" #include "debug.h" #include "dialogs.h" -#include "gameDetector.h" -#include "gui/newgui.h" -#include "gui/message.h" +#include "imuse.h" #include "object.h" #include "resource.h" +#include "sound.h" #include "string.h" +#include "verbs.h" +#include "common/gameDetector.h" #include "common/config-file.h" +#include "gui/newgui.h" +#include "gui/message.h" +#include "sound/mixer.h" +#include "sound/mididrv.h" #ifdef _WIN32_WCE extern void drawError(char*); diff --git a/scumm/string.cpp b/scumm/string.cpp index 2ac6f4cfc65..89dd4b97212 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -24,6 +24,7 @@ #include "scumm.h" #include "actor.h" #include "dialogs.h" +#include "verbs.h" #include "scumm/sound.h" int CharsetRenderer::getStringWidth(int arg, byte *text, int pos) @@ -42,9 +43,7 @@ int CharsetRenderer::getStringWidth(int arg, byte *text, int pos) break; if (chr == '@') continue; - if (chr == 254) - chr = 255; - if (chr == 255) { + if (chr == 254 || chr == 255) { chr = text[pos++]; if (chr == 3) // 'WAIT' break; @@ -252,7 +251,6 @@ void Scumm::CHARSET_1() charset._center = _string[0].center; charset._right = _string[0].right; charset._color = _charsetColor; - _bkColor = 0; if (!(_features & GF_OLD256)) // FIXME for (i = 0; i < 4; i++) @@ -485,7 +483,6 @@ void Scumm::description() charset._curId = 3; charset._center = false; charset._color = 15; - _bkColor = 0; // FIXME: _talkdelay = 1 - display description, not correct ego actor talking, // 0 - no display, correct ego actor talking _talkDelay = 0; @@ -540,7 +537,6 @@ void Scumm::drawDescString(byte *msg) charset._xpos2 = 0; charset._disableOffsX = charset._firstChar = true; - _bkColor = 0; _talkDelay = 1; restoreCharsetBg(); @@ -584,7 +580,6 @@ void Scumm::drawString(int a) charset._center = _string[a].center; charset._right = _string[a].right; charset._color = _string[a].color; - _bkColor = 0; charset._disableOffsX = charset._firstChar = true; if (!(_features & GF_OLD256)) { diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp index 0be0ac59dc4..bd81c22eb7a 100644 --- a/scumm/verbs.cpp +++ b/scumm/verbs.cpp @@ -24,6 +24,7 @@ #include "scumm.h" #include "object.h" #include "resource.h" +#include "verbs.h" void Scumm::redrawVerbs() { @@ -81,6 +82,8 @@ void Scumm::verbMouseOver(int verb) if (_verbMouseOver == verb) return; +printf("verbMouseOver: verb = %d, type = %d\n", verb, _verbs[verb].type); + if (_verbs[_verbMouseOver].type != 1) { drawVerb(_verbMouseOver, 0); _verbMouseOver = verb; @@ -179,8 +182,7 @@ void Scumm::restoreVerbBG(int verb) vs = &_verbs[verb]; if (vs->oldleft != -1) { - _bkColor = vs->bkcolor; - restoreBG(vs->oldleft, vs->oldtop, vs->oldright, vs->oldbottom); + restoreBG(vs->oldleft, vs->oldtop, vs->oldright, vs->oldbottom, vs->bkcolor); vs->oldleft = -1; } } diff --git a/scumm/verbs.h b/scumm/verbs.h new file mode 100644 index 00000000000..50570ffd73a --- /dev/null +++ b/scumm/verbs.h @@ -0,0 +1,40 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#ifndef VERBS_H +#define VERBS_H + +#include "scummsys.h" + +struct VerbSlot { + int16 x, y; + int16 right, bottom; + int16 oldleft, oldtop, oldright, oldbottom; + uint8 verbid; + uint8 color, hicolor, dimcolor, bkcolor, type; + uint8 charset_nr, curmode; + uint8 saveid; + uint8 key; + bool center; + uint8 field_1B; + uint16 imgindex; +}; + +#endif