aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-08 20:13:52 +0000
committerMartin Kiewitz2009-10-08 20:13:52 +0000
commitb0eeb3636ca801e2f40ef05b014d3ec40488704f (patch)
tree92b51a4dc56892661d06618c4b0049e0a780187d /engines/sci
parentd56d072fb21fe201d533b4d92a698284549a0cbe (diff)
downloadscummvm-rg350-b0eeb3636ca801e2f40ef05b014d3ec40488704f.tar.gz
scummvm-rg350-b0eeb3636ca801e2f40ef05b014d3ec40488704f.tar.bz2
scummvm-rg350-b0eeb3636ca801e2f40ef05b014d3ec40488704f.zip
SCI/newgui: cleanup, fixing uninitialized variable in SciGuiPalette
svn-id: r44796
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/gui/gui.cpp4
-rw-r--r--engines/sci/gui/gui_gfx.cpp89
-rw-r--r--engines/sci/gui/gui_gfx.h1
-rw-r--r--engines/sci/gui/gui_palette.cpp39
-rw-r--r--engines/sci/gui/gui_palette.h3
5 files changed, 72 insertions, 64 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 279b88bf89..3754634287 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -402,9 +402,9 @@ void SciGui::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
// _gfx->AnimateSort();
if (old_picNotValid) {
- //_windowMgr->BeginUpdate(_windowMgr->_picWind);
+ _windowMgr->BeginUpdate(_windowMgr->_picWind);
_gfx->AnimateUpdate(list);
- //_windowMgr->EndUpdate(_windowMgr->_picWind);
+ _windowMgr->EndUpdate(_windowMgr->_picWind);
}
_gfx->AnimateDrawCels(list);
diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp
index c8ceaf9b87..7a673ae8a4 100644
--- a/engines/sci/gui/gui_gfx.cpp
+++ b/engines/sci/gui/gui_gfx.cpp
@@ -1067,17 +1067,17 @@ void SciGuiGfx::AnimateDisposeLastCast() {
}
enum {
- SCI_ANIMATE_MASK_STOPUPDATE = 0x0001,
- SCI_ANIMATE_MASK_VIEWUPDATED = 0x0002,
- SCI_ANIMATE_MASK_NOUPDATE = 0x0004,
- SCI_ANIMATE_MASK_HIDDEN = 0x0008,
- SCI_ANIMATE_MASK_FIXEDPRIORITY = 0x0010,
- SCI_ANIMATE_MASK_ALWAYSUPDATE = 0x0020,
- SCI_ANIMATE_MASK_FORCEUPDATE = 0x0040,
- SCI_ANIMATE_MASK_REMOVEVIEW = 0x0080,
- SCI_ANIMATE_MASK_FROZEN = 0x0100,
- SCI_ANIMATE_MASK_IGNOREACTOR = 0x4000,
- SCI_ANIMATE_MASK_DISPOSEME = 0x8000
+ SCI_ANIMATE_SIGNAL_STOPUPDATE = 0x0001,
+ SCI_ANIMATE_SIGNAL_VIEWUPDATED = 0x0002,
+ SCI_ANIMATE_SIGNAL_NOUPDATE = 0x0004,
+ SCI_ANIMATE_SIGNAL_HIDDEN = 0x0008,
+ SCI_ANIMATE_SIGNAL_FIXEDPRIORITY = 0x0010,
+ SCI_ANIMATE_SIGNAL_ALWAYSUPDATE = 0x0020,
+ SCI_ANIMATE_SIGNAL_FORCEUPDATE = 0x0040,
+ SCI_ANIMATE_SIGNAL_REMOVEVIEW = 0x0080,
+ SCI_ANIMATE_SIGNAL_FROZEN = 0x0100,
+ SCI_ANIMATE_SIGNAL_IGNOREACTOR = 0x4000,
+ SCI_ANIMATE_SIGNAL_DISPOSEME = 0x8000
};
void SciGuiGfx::AnimateInvoke(List *list, int argc, reg_t *argv) {
@@ -1090,7 +1090,7 @@ void SciGuiGfx::AnimateInvoke(List *list, int argc, reg_t *argv) {
while (curNode) {
curObject = curNode->value;
mask = GET_SEL32V(curObject, signal);
- if (!(mask & SCI_ANIMATE_MASK_FROZEN)) {
+ if (!(mask & SCI_ANIMATE_SIGNAL_FROZEN)) {
// Call .doit method of that object
invoke_selector(_s, curObject, _s->_kernel->_selectorCache.doit, kContinueOnInvalidSelector, argv, argc, __FILE__, __LINE__, 0);
// Lookup node again, since the nodetable it was in may have been reallocated
@@ -1146,20 +1146,20 @@ void SciGuiGfx::AnimateFill(List *list, byte &old_picNotValid) {
PUT_SEL32V(curObject, nsRight, celRect.right);
PUT_SEL32V(curObject, nsBottom, celRect.bottom);
- if (!(signal & SCI_ANIMATE_MASK_FIXEDPRIORITY))
+ if (!(signal & SCI_ANIMATE_SIGNAL_FIXEDPRIORITY))
PUT_SEL32V(curObject, priority, 0); // CoordPri(y) FIXME
- if (signal & SCI_ANIMATE_MASK_NOUPDATE) {
- if (signal & (SCI_ANIMATE_MASK_FORCEUPDATE | SCI_ANIMATE_MASK_VIEWUPDATED)
- || (signal & SCI_ANIMATE_MASK_HIDDEN && !(signal & SCI_ANIMATE_MASK_REMOVEVIEW))
- || (!(signal & SCI_ANIMATE_MASK_HIDDEN) && signal & SCI_ANIMATE_MASK_REMOVEVIEW)
- || (signal & SCI_ANIMATE_MASK_ALWAYSUPDATE))
+ if (signal & SCI_ANIMATE_SIGNAL_NOUPDATE) {
+ if (signal & (SCI_ANIMATE_SIGNAL_FORCEUPDATE | SCI_ANIMATE_SIGNAL_VIEWUPDATED)
+ || (signal & SCI_ANIMATE_SIGNAL_HIDDEN && !(signal & SCI_ANIMATE_SIGNAL_REMOVEVIEW))
+ || (!(signal & SCI_ANIMATE_SIGNAL_HIDDEN) && signal & SCI_ANIMATE_SIGNAL_REMOVEVIEW)
+ || (signal & SCI_ANIMATE_SIGNAL_ALWAYSUPDATE))
old_picNotValid++;
- signal &= 0xFFFF ^ SCI_ANIMATE_MASK_STOPUPDATE;
+ signal &= 0xFFFF ^ SCI_ANIMATE_SIGNAL_STOPUPDATE;
} else {
- if (signal & SCI_ANIMATE_MASK_STOPUPDATE || signal & SCI_ANIMATE_MASK_ALWAYSUPDATE)
+ if (signal & SCI_ANIMATE_SIGNAL_STOPUPDATE || signal & SCI_ANIMATE_SIGNAL_ALWAYSUPDATE)
old_picNotValid++;
- signal &= 0xFFFF ^ SCI_ANIMATE_MASK_FORCEUPDATE;
+ signal &= 0xFFFF ^ SCI_ANIMATE_SIGNAL_FORCEUPDATE;
}
PUT_SEL32V(curObject, signal, signal);
@@ -1249,8 +1249,8 @@ void SciGuiGfx::AnimateUpdate(List *list) {
// Remove all previous cels from screen
for (listNr = listCount - 1; listNr >= 0; listNr--) {
curObject = object[listNr];
- if (signal[listNr] & SCI_ANIMATE_MASK_NOUPDATE) {
- if (!(signal[listNr] & SCI_ANIMATE_MASK_REMOVEVIEW)) {
+ if (signal[listNr] & SCI_ANIMATE_SIGNAL_NOUPDATE) {
+ if (!(signal[listNr] & SCI_ANIMATE_SIGNAL_REMOVEVIEW)) {
bitsHandle = GET_SEL32(curObject, underBits);
if (_screen->_picNotValid != 1) {
RestoreBits(bitsHandle);
@@ -1260,22 +1260,22 @@ void SciGuiGfx::AnimateUpdate(List *list) {
}
PUT_SEL32V(curObject, underBits, 0);
}
- signal[listNr] &= 0xFFFF ^ SCI_ANIMATE_MASK_FORCEUPDATE;
- signal[listNr] &= signal[listNr] & SCI_ANIMATE_MASK_VIEWUPDATED ? 0xFFFF ^ (SCI_ANIMATE_MASK_VIEWUPDATED | SCI_ANIMATE_MASK_NOUPDATE) : 0xFFFF;
- } else if (signal[listNr] & SCI_ANIMATE_MASK_STOPUPDATE) {
- signal[listNr] = (signal[listNr] & (0xFFFF ^ SCI_ANIMATE_MASK_STOPUPDATE)) | SCI_ANIMATE_MASK_NOUPDATE;
+ signal[listNr] &= 0xFFFF ^ SCI_ANIMATE_SIGNAL_FORCEUPDATE;
+ signal[listNr] &= signal[listNr] & SCI_ANIMATE_SIGNAL_VIEWUPDATED ? 0xFFFF ^ (SCI_ANIMATE_SIGNAL_VIEWUPDATED | SCI_ANIMATE_SIGNAL_NOUPDATE) : 0xFFFF;
+ } else if (signal[listNr] & SCI_ANIMATE_SIGNAL_STOPUPDATE) {
+ signal[listNr] = (signal[listNr] & (0xFFFF ^ SCI_ANIMATE_SIGNAL_STOPUPDATE)) | SCI_ANIMATE_SIGNAL_NOUPDATE;
}
}
for (listNr = 0; listNr < listCount; listNr++) {
- if (signal[listNr] & SCI_ANIMATE_MASK_ALWAYSUPDATE) {
+ if (signal[listNr] & SCI_ANIMATE_SIGNAL_ALWAYSUPDATE) {
curObject = object[listNr];
// draw corresponding cel
drawCel(viewId[listNr], loopNo[listNr], celNo[listNr], celRect[listNr].left, celRect[listNr].top, z[listNr], paletteNo[listNr]);
// arr1[i] = 1;
- signal[listNr] &= 0xFFFF ^ (SCI_ANIMATE_MASK_STOPUPDATE | SCI_ANIMATE_MASK_VIEWUPDATED | SCI_ANIMATE_MASK_NOUPDATE | SCI_ANIMATE_MASK_FORCEUPDATE);
- if ((signal[listNr] & SCI_ANIMATE_MASK_IGNOREACTOR) == 0) {
+ signal[listNr] &= 0xFFFF ^ (SCI_ANIMATE_SIGNAL_STOPUPDATE | SCI_ANIMATE_SIGNAL_VIEWUPDATED | SCI_ANIMATE_SIGNAL_NOUPDATE | SCI_ANIMATE_SIGNAL_FORCEUPDATE);
+ if ((signal[listNr] & SCI_ANIMATE_SIGNAL_IGNOREACTOR) == 0) {
rect = celRect[listNr];
rect.top = rect.top; // CLIP<int16>(PriCoord(zs[i]) - 1, rect.top, rect.bottom - 1);
FillRect(rect, SCI_SCREEN_MASK_CONTROL, 0, 0, 15);
@@ -1284,13 +1284,13 @@ void SciGuiGfx::AnimateUpdate(List *list) {
}
for (listNr = 0; listNr < listCount; listNr++) {
- if (signal[listNr] & SCI_ANIMATE_MASK_NOUPDATE) {
- if (signal[listNr] & SCI_ANIMATE_MASK_HIDDEN) {
- signal[listNr] |= SCI_ANIMATE_MASK_REMOVEVIEW;
+ if (signal[listNr] & SCI_ANIMATE_SIGNAL_NOUPDATE) {
+ if (signal[listNr] & SCI_ANIMATE_SIGNAL_HIDDEN) {
+ signal[listNr] |= SCI_ANIMATE_SIGNAL_REMOVEVIEW;
} else {
- signal[listNr] &= 0xFFFF ^ SCI_ANIMATE_MASK_REMOVEVIEW;
+ signal[listNr] &= 0xFFFF ^ SCI_ANIMATE_SIGNAL_REMOVEVIEW;
curObject = object[listNr];
- if (signal[listNr] & SCI_ANIMATE_MASK_IGNOREACTOR)
+ if (signal[listNr] & SCI_ANIMATE_SIGNAL_IGNOREACTOR)
bitsHandle = SaveBits(celRect[listNr], SCI_SCREEN_MASK_PRIORITY|SCI_SCREEN_MASK_PRIORITY);
else
bitsHandle = SaveBits(celRect[listNr], SCI_SCREEN_MASK_ALL);
@@ -1301,11 +1301,11 @@ void SciGuiGfx::AnimateUpdate(List *list) {
for (listNr = 0; listNr < listCount; listNr++) {
curObject = object[listNr];
- if (signal[listNr] & SCI_ANIMATE_MASK_NOUPDATE && !(signal[listNr] & SCI_ANIMATE_MASK_HIDDEN)) {
+ if (signal[listNr] & SCI_ANIMATE_SIGNAL_NOUPDATE && !(signal[listNr] & SCI_ANIMATE_SIGNAL_HIDDEN)) {
// draw corresponding cel
drawCel(viewId[listNr], loopNo[listNr], celNo[listNr], celRect[listNr].left, celRect[listNr].top, z[listNr], paletteNo[listNr]);
// arr1[i] = 1;
- if ((signal[listNr] & SCI_ANIMATE_MASK_IGNOREACTOR) == 0) {
+ if ((signal[listNr] & SCI_ANIMATE_SIGNAL_IGNOREACTOR) == 0) {
rect = celRect[listNr];
//rect.top = CLIP<int16>(PriCoord(zs[i]) - 1, rect.top, rect.bottom - 1);
FillRect(rect, SCI_SCREEN_MASK_CONTROL, 0, 0, 15);
@@ -1332,7 +1332,7 @@ void SciGuiGfx::AnimateDrawCels(List *list) {
curObject = curNode->value;
signal = GET_SEL32V(curObject, signal);
- if (!(signal & (SCI_ANIMATE_MASK_NOUPDATE | SCI_ANIMATE_MASK_HIDDEN | SCI_ANIMATE_MASK_ALWAYSUPDATE))) {
+ if (!(signal & (SCI_ANIMATE_SIGNAL_NOUPDATE | SCI_ANIMATE_SIGNAL_HIDDEN | SCI_ANIMATE_SIGNAL_ALWAYSUPDATE))) {
// Get animation data...
viewId = GET_SEL32V(curObject, view);
loopNo = GET_SEL32V(curObject, loop);
@@ -1355,7 +1355,7 @@ void SciGuiGfx::AnimateDrawCels(List *list) {
drawCel(viewId, loopNo, celNo, celRect.left, celRect.top, z, paletteNo);
// arr1[inx] = 1;
- if (signal & SCI_ANIMATE_MASK_REMOVEVIEW) {
+ if (signal & SCI_ANIMATE_SIGNAL_REMOVEVIEW) {
signal &= 0xFFFF ^ GFX_REMOVEVIEW;
PUT_SEL32V(curObject, signal, signal);
}
@@ -1384,16 +1384,23 @@ void SciGuiGfx::AnimateRestoreAndDelete(List *list, int argc, reg_t *argv) {
reg_t curObject;
uint16 signal;
+ // FIXME: we are supposed to go through this table backwards
while (curNode) {
curObject = curNode->value;
signal = GET_SEL32V(curObject, signal);
- if ((signal & (SCI_ANIMATE_MASK_NOUPDATE | SCI_ANIMATE_MASK_REMOVEVIEW)) == 0) {
+ // FIXME: this is supposed to go into the loop above (same method)
+ if (signal & SCI_ANIMATE_SIGNAL_HIDDEN) {
+ signal |= SCI_ANIMATE_SIGNAL_REMOVEVIEW;
+ PUT_SEL32V(curObject, signal, signal);
+ }
+
+ if ((signal & (SCI_ANIMATE_SIGNAL_NOUPDATE | SCI_ANIMATE_SIGNAL_REMOVEVIEW)) == 0) {
RestoreBits(GET_SEL32(curObject, underBits));
PUT_SEL32V(curObject, underBits, 0);
}
- if (signal & SCI_ANIMATE_MASK_DISPOSEME) {
+ if (signal & SCI_ANIMATE_SIGNAL_DISPOSEME) {
// Call .delete_ method of that object
invoke_selector(_s, curObject, _s->_kernel->_selectorCache.delete_, kContinueOnInvalidSelector, argv, argc, __FILE__, __LINE__, 0);
// Lookup node again, since the nodetable it was in may have been reallocated
diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h
index 26261aab75..8b89741b2a 100644
--- a/engines/sci/gui/gui_gfx.h
+++ b/engines/sci/gui/gui_gfx.h
@@ -135,7 +135,6 @@ private:
uint16 _clrPowers[256];
byte bMapColors;
- GuiPalette *pPicPal;
Common::Array<GuiPalSchedule> _palSchedules;
int _textFontsCount;
diff --git a/engines/sci/gui/gui_palette.cpp b/engines/sci/gui/gui_palette.cpp
index e5254f30c9..56072ecaef 100644
--- a/engines/sci/gui/gui_palette.cpp
+++ b/engines/sci/gui/gui_palette.cpp
@@ -36,15 +36,18 @@ namespace Sci {
SciGuiPalette::SciGuiPalette(ResourceManager *resMan, SciGuiScreen *screen)
: _resMan(resMan), _screen(screen) {
- int16 i;
- for (i = 0; i < 256; i++) {
- _sysPalette.colors[i].used = 0;
- _sysPalette.colors[i].r = 0;
- _sysPalette.colors[i].g = 0;
- _sysPalette.colors[i].b = 0;
- _sysPalette.intensity[i] = 100;
- _sysPalette.mapping[i] = i;
+ int16 color;
+
+ _sysPalette.timestamp = 0;
+ for (color = 0; color < 256; color++) {
+ _sysPalette.colors[color].used = 0;
+ _sysPalette.colors[color].r = 0;
+ _sysPalette.colors[color].g = 0;
+ _sysPalette.colors[color].b = 0;
+ _sysPalette.intensity[color] = 100;
+ _sysPalette.mapping[color] = color;
}
+ // Black and white are hardcoded
_sysPalette.colors[0].used = 1;
_sysPalette.colors[255].used = 1;
_sysPalette.colors[255].r = 255;
@@ -61,8 +64,8 @@ SciGuiPalette::SciGuiPalette(ResourceManager *resMan, SciGuiScreen *screen)
};
// Init _clrPowers used in MatchColor
- for(i = 0; i < 256; i++)
- _clrPowers[i] = i*i;
+ for(color = 0; color < 256; color++)
+ _clrPowers[color] = color*color;
}
SciGuiPalette::~SciGuiPalette() {
@@ -281,10 +284,10 @@ void SciGuiPalette::animate(byte fromColor, byte toColor, int speed) {
int len = toColor - fromColor - 1;
uint32 now = g_system->getMillis() * 60 / 1000;;
// search for sheduled animations with the same 'from' value
- int sz = _palSchedules.size();
+ int sz = _schedules.size();
for (int i = 0; i < sz; i++) {
- if (_palSchedules[i].from == fromColor) {
- if (_palSchedules[i].schedule < now) {
+ if (_schedules[i].from == fromColor) {
+ if (_schedules[i].schedule < now) {
if (speed > 0) {
col = _sysPalette.colors[fromColor];
memmove(&_sysPalette.colors[fromColor], &_sysPalette.colors[fromColor + 1], len * sizeof(GuiColor));
@@ -295,17 +298,17 @@ void SciGuiPalette::animate(byte fromColor, byte toColor, int speed) {
_sysPalette.colors[fromColor] = col;
}
// removing schedule
- _palSchedules.remove_at(i);
+ _schedules.remove_at(i);
}
setOnScreen();
return;
}
}
// adding a new schedule
- GuiPalSchedule sched;
- sched.from = fromColor;
- sched.schedule = now + ABS(speed);
- _palSchedules.push_back(sched);
+ GuiPalSchedule newSchedule;
+ newSchedule.from = fromColor;
+ newSchedule.schedule = now + ABS(speed);
+ _schedules.push_back(newSchedule);
}
} // End of namespace Sci
diff --git a/engines/sci/gui/gui_palette.h b/engines/sci/gui/gui_palette.h
index 0cb337996e..1924dae7e6 100644
--- a/engines/sci/gui/gui_palette.h
+++ b/engines/sci/gui/gui_palette.h
@@ -58,8 +58,7 @@ private:
uint16 _clrPowers[256];
- GuiPalette *pPicPal;
- Common::Array<GuiPalSchedule> _palSchedules;
+ Common::Array<GuiPalSchedule> _schedules;
};
} // End of namespace Sci