mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-30 15:31:59 +00:00
SCI/newgui: cleanup, fixing uninitialized variable in SciGuiPalette
svn-id: r44796
This commit is contained in:
parent
d56d072fb2
commit
b0eeb3636c
@ -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);
|
||||
|
@ -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
|
||||
|
@ -135,7 +135,6 @@ private:
|
||||
uint16 _clrPowers[256];
|
||||
|
||||
byte bMapColors;
|
||||
GuiPalette *pPicPal;
|
||||
Common::Array<GuiPalSchedule> _palSchedules;
|
||||
|
||||
int _textFontsCount;
|
||||
|
@ -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
|
||||
|
@ -58,8 +58,7 @@ private:
|
||||
|
||||
uint16 _clrPowers[256];
|
||||
|
||||
GuiPalette *pPicPal;
|
||||
Common::Array<GuiPalSchedule> _palSchedules;
|
||||
Common::Array<GuiPalSchedule> _schedules;
|
||||
};
|
||||
|
||||
} // End of namespace Sci
|
||||
|
Loading…
x
Reference in New Issue
Block a user