2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-04-29 14:11:29 +00:00
|
|
|
*
|
|
|
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-08-05 10:16:03 +00:00
|
|
|
#include "common/endian.h"
|
2006-04-29 14:11:29 +00:00
|
|
|
#include "common/system.h"
|
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
#include "graphics/surface.h"
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "graphics/palette.h"
|
2007-06-21 03:14:20 +00:00
|
|
|
|
2006-09-29 08:14:27 +00:00
|
|
|
#include "agos/agos.h"
|
|
|
|
#include "agos/intern.h"
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
namespace AGOS {
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
byte *AGOSEngine::getBackBuf() {
|
2009-07-06 06:21:59 +00:00
|
|
|
return (byte *)_backBuf->pixels;
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
byte *AGOSEngine::getBackGround() {
|
2009-07-06 06:21:59 +00:00
|
|
|
return (byte *)_backGroundBuf->pixels;
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
byte *AGOSEngine::getScaleBuf() {
|
2009-07-06 06:21:59 +00:00
|
|
|
return (byte *)_scaleBuf->pixels;
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
|
2009-08-11 14:42:44 +00:00
|
|
|
#ifdef ENABLE_AGOS2
|
2007-05-13 08:46:48 +00:00
|
|
|
void AGOSEngine_Feeble::animateSpritesByY() {
|
|
|
|
VgaSprite *vsp;
|
|
|
|
VgaPointersEntry *vpe;
|
|
|
|
int16 spriteTable[180][2];
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
byte *src;
|
|
|
|
int height, slot, y;
|
|
|
|
uint i, numSprites = 0;
|
|
|
|
|
|
|
|
vsp = _vgaSprites;
|
|
|
|
while (vsp->id) {
|
|
|
|
if (vsp->flags & kDFScaled) {
|
|
|
|
y = vsp->y;
|
|
|
|
} else if (vsp->flags & kDFMasked) {
|
|
|
|
vpe = &_vgaBufferPointers[vsp->zoneNum];
|
|
|
|
src = vpe->vgaFile2 + vsp->image * 8;
|
|
|
|
height = READ_LE_UINT16(src + 4) & 0x7FFF;
|
|
|
|
y = vsp->y + height;
|
|
|
|
} else {
|
|
|
|
y = vsp->priority;
|
|
|
|
}
|
|
|
|
|
|
|
|
spriteTable[numSprites][0] = y;
|
|
|
|
spriteTable[numSprites][1] = numSprites;
|
|
|
|
numSprites++;
|
|
|
|
vsp++;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
y = spriteTable[0][0];
|
|
|
|
slot = spriteTable[0][1];
|
|
|
|
|
|
|
|
for (i = 0; i < numSprites; i++) {
|
|
|
|
if (y >= spriteTable[i][0]) {
|
|
|
|
y = spriteTable[i][0];
|
|
|
|
slot = spriteTable[i][1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (y == 9999)
|
|
|
|
break;
|
|
|
|
|
|
|
|
for (i = 0; i < numSprites; i++) {
|
|
|
|
if (slot == spriteTable[i][1]) {
|
|
|
|
spriteTable[i][0] = 9999;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
vsp = &_vgaSprites[slot];
|
|
|
|
|
2008-03-01 03:59:56 +00:00
|
|
|
vsp->windowNum &= ~0x8000;
|
2007-05-13 08:46:48 +00:00
|
|
|
|
|
|
|
vpe = &_vgaBufferPointers[vsp->zoneNum];
|
|
|
|
_curVgaFile1 = vpe->vgaFile1;
|
|
|
|
_curVgaFile2 = vpe->vgaFile2;
|
|
|
|
_curSfxFile = vpe->sfxFile;
|
|
|
|
_windowNum = vsp->windowNum;
|
|
|
|
_vgaCurSpriteId = vsp->id;
|
|
|
|
_vgaCurSpritePriority = vsp->priority;
|
|
|
|
|
|
|
|
drawImage_init(vsp->image, vsp->palette, vsp->x, vsp->y, vsp->flags);
|
|
|
|
}
|
|
|
|
|
2010-03-23 00:42:42 +00:00
|
|
|
_displayFlag++;
|
2007-05-13 08:46:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine_Feeble::animateSprites() {
|
2006-04-29 14:11:29 +00:00
|
|
|
VgaSprite *vsp;
|
|
|
|
VgaPointersEntry *vpe;
|
|
|
|
|
|
|
|
if (_paletteFlag == 2)
|
|
|
|
_paletteFlag = 1;
|
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
if (_scrollCount) {
|
2006-04-29 14:11:29 +00:00
|
|
|
scrollEvent();
|
|
|
|
}
|
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
if (getBitFlag(84)) {
|
2006-04-29 14:11:29 +00:00
|
|
|
animateSpritesByY();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
vsp = _vgaSprites;
|
|
|
|
while (vsp->id) {
|
2008-03-01 03:59:56 +00:00
|
|
|
vsp->windowNum &= ~0x8000;
|
2007-05-13 08:46:48 +00:00
|
|
|
|
|
|
|
vpe = &_vgaBufferPointers[vsp->zoneNum];
|
|
|
|
_curVgaFile1 = vpe->vgaFile1;
|
|
|
|
_curVgaFile2 = vpe->vgaFile2;
|
|
|
|
_curSfxFile = vpe->sfxFile;
|
|
|
|
_windowNum = vsp->windowNum;
|
|
|
|
_vgaCurSpriteId = vsp->id;
|
|
|
|
_vgaCurSpritePriority = vsp->priority;
|
|
|
|
|
|
|
|
drawImage_init(vsp->image, vsp->palette, vsp->x, vsp->y, vsp->flags);
|
|
|
|
vsp++;
|
|
|
|
}
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2010-03-23 00:42:42 +00:00
|
|
|
_displayFlag++;
|
2007-05-13 08:46:48 +00:00
|
|
|
}
|
2009-08-11 14:42:44 +00:00
|
|
|
#endif
|
2007-05-13 08:46:48 +00:00
|
|
|
|
|
|
|
void AGOSEngine::animateSprites() {
|
|
|
|
VgaSprite *vsp;
|
|
|
|
VgaPointersEntry *vpe;
|
|
|
|
|
|
|
|
if (_copyScnFlag) {
|
|
|
|
_copyScnFlag--;
|
|
|
|
_vgaSpriteChanged++;
|
|
|
|
}
|
|
|
|
|
2007-06-18 06:12:54 +00:00
|
|
|
if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2) {
|
|
|
|
const uint8 var = (getGameType() == GType_ELVIRA1) ? 293 : 71;
|
|
|
|
if (_wallOn && !_variableArray[var]) {
|
|
|
|
_wallOn--;
|
|
|
|
|
|
|
|
VC10_state state;
|
2009-07-06 06:21:59 +00:00
|
|
|
state.srcPtr = getBackGround() + 3 * _backGroundBuf->pitch + 3 * 16;
|
2007-06-18 06:12:54 +00:00
|
|
|
state.height = state.draw_height = 127;
|
|
|
|
state.width = state.draw_width = 14;
|
|
|
|
state.y = 0;
|
|
|
|
state.x = 0;
|
|
|
|
state.palette = 0;
|
|
|
|
state.paletteMod = 0;
|
|
|
|
state.flags = kDFNonTrans;
|
|
|
|
|
|
|
|
_windowNum = 4;
|
|
|
|
|
2010-07-04 07:32:12 +00:00
|
|
|
_backFlag = true;
|
2007-06-18 06:12:54 +00:00
|
|
|
drawImage(&state);
|
2010-07-04 07:32:12 +00:00
|
|
|
_backFlag = false;
|
2007-06-18 06:12:54 +00:00
|
|
|
|
|
|
|
_vgaSpriteChanged++;
|
|
|
|
}
|
2007-05-16 12:58:47 +00:00
|
|
|
}
|
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
if (!_scrollFlag && !_vgaSpriteChanged) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_vgaSpriteChanged = 0;
|
|
|
|
|
|
|
|
if (_paletteFlag == 2)
|
|
|
|
_paletteFlag = 1;
|
|
|
|
|
|
|
|
if (getGameType() == GType_SIMON2 && _scrollFlag) {
|
|
|
|
scrollScreen();
|
2007-05-09 15:36:05 +00:00
|
|
|
}
|
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
|
|
|
|
dirtyClips();
|
|
|
|
}
|
|
|
|
|
|
|
|
restoreBackGround();
|
|
|
|
|
2007-05-09 15:36:05 +00:00
|
|
|
vsp = _vgaSprites;
|
2007-06-09 05:30:20 +00:00
|
|
|
for (; vsp->id !=0; vsp++) {
|
|
|
|
if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
|
|
|
|
!(vsp->windowNum & 0x8000)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2008-03-01 03:59:56 +00:00
|
|
|
vsp->windowNum &= ~0x8000;
|
2006-04-29 14:11:29 +00:00
|
|
|
|
|
|
|
vpe = &_vgaBufferPointers[vsp->zoneNum];
|
|
|
|
_curVgaFile1 = vpe->vgaFile1;
|
|
|
|
_curVgaFile2 = vpe->vgaFile2;
|
|
|
|
_curSfxFile = vpe->sfxFile;
|
|
|
|
_windowNum = vsp->windowNum;
|
|
|
|
_vgaCurSpriteId = vsp->id;
|
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
saveBackGround(vsp);
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2007-05-09 15:36:05 +00:00
|
|
|
drawImage_init(vsp->image, vsp->palette, vsp->x, vsp->y, vsp->flags);
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
|
2007-05-16 12:58:47 +00:00
|
|
|
if (getGameType() == GType_ELVIRA1 && _variableArray[293]) {
|
2007-06-06 10:41:27 +00:00
|
|
|
// Used by the Fire Wall and Ice Wall spells
|
2007-05-16 12:58:47 +00:00
|
|
|
debug(0, "Using special wall");
|
|
|
|
|
|
|
|
uint8 color, h, len;
|
2009-07-06 06:21:59 +00:00
|
|
|
byte *dst = (byte *)_window4BackScn->pixels;
|
2007-05-16 12:58:47 +00:00
|
|
|
|
|
|
|
color = (_variableArray[293] & 1) ? 13 : 15;
|
|
|
|
_wallOn = 2;
|
|
|
|
|
|
|
|
h = 127;
|
|
|
|
while (h) {
|
|
|
|
len = 112;
|
|
|
|
while (len--) {
|
|
|
|
*dst++ = color;
|
|
|
|
dst++;
|
|
|
|
}
|
|
|
|
|
|
|
|
h--;
|
|
|
|
if (h == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
len = 112;
|
|
|
|
while (len--) {
|
|
|
|
dst++;
|
|
|
|
*dst++ = color;
|
|
|
|
}
|
|
|
|
h--;
|
2007-09-19 08:40:12 +00:00
|
|
|
}
|
2007-05-16 12:58:47 +00:00
|
|
|
|
|
|
|
_window4Flag = 1;
|
2007-06-06 10:41:27 +00:00
|
|
|
setMoveRect(0, 0, 224, 127);
|
2007-05-16 12:58:47 +00:00
|
|
|
} else if (getGameType() == GType_ELVIRA2 && _variableArray[71] & 2) {
|
2007-06-06 10:41:27 +00:00
|
|
|
// Used by the Unholy Barrier spell
|
2007-05-16 12:58:47 +00:00
|
|
|
uint8 color, h, len;
|
2009-07-06 06:21:59 +00:00
|
|
|
byte *dst = (byte *)_window4BackScn->pixels;
|
2007-05-16 12:58:47 +00:00
|
|
|
|
|
|
|
color = 1;
|
|
|
|
_wallOn = 2;
|
|
|
|
|
|
|
|
h = 43;
|
|
|
|
while (h) {
|
|
|
|
len = 56;
|
|
|
|
while (len--) {
|
|
|
|
*dst++ = color;
|
|
|
|
dst += 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
h--;
|
|
|
|
if (h == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
dst += 448;
|
|
|
|
|
|
|
|
len = 56;
|
|
|
|
while (len--) {
|
|
|
|
dst += 2;
|
|
|
|
*dst++ = color;
|
2007-06-06 10:41:27 +00:00
|
|
|
dst += 1;
|
2007-05-16 12:58:47 +00:00
|
|
|
}
|
|
|
|
dst += 448;
|
|
|
|
h--;
|
2007-09-19 08:40:12 +00:00
|
|
|
}
|
2007-05-16 12:58:47 +00:00
|
|
|
|
|
|
|
_window4Flag = 1;
|
2007-06-06 10:41:27 +00:00
|
|
|
setMoveRect(0, 0, 224, 127);
|
2007-05-16 12:58:47 +00:00
|
|
|
}
|
|
|
|
|
2007-05-09 15:36:05 +00:00
|
|
|
if (_window6Flag == 1)
|
|
|
|
_window6Flag++;
|
|
|
|
|
|
|
|
if (_window4Flag == 1)
|
|
|
|
_window4Flag++;
|
|
|
|
|
2010-03-23 00:42:42 +00:00
|
|
|
_displayFlag++;
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
|
2007-05-09 15:36:05 +00:00
|
|
|
void AGOSEngine::dirtyClips() {
|
2007-06-09 05:30:20 +00:00
|
|
|
int16 x, y, w, h;
|
|
|
|
restart:
|
|
|
|
_newDirtyClip = 0;
|
|
|
|
|
|
|
|
VgaSprite *vsp = _vgaSprites;
|
|
|
|
while (vsp->id != 0) {
|
|
|
|
if (vsp->windowNum & 0x8000) {
|
|
|
|
x = vsp->x;
|
|
|
|
y = vsp->y;
|
|
|
|
w = 1;
|
|
|
|
h = 1;
|
|
|
|
|
|
|
|
if (vsp->image != 0) {
|
2007-06-19 11:12:56 +00:00
|
|
|
VgaPointersEntry *vpe = &_vgaBufferPointers[vsp->zoneNum];
|
|
|
|
const byte *ptr = vpe->vgaFile2 + vsp->image * 8;
|
2007-06-09 05:30:20 +00:00
|
|
|
w = READ_BE_UINT16(ptr + 6) / 8;
|
|
|
|
h = ptr[5];
|
|
|
|
}
|
|
|
|
|
|
|
|
dirtyClipCheck(x, y, w, h);
|
|
|
|
}
|
|
|
|
vsp++;
|
|
|
|
}
|
|
|
|
|
|
|
|
AnimTable *animTable = _screenAnim1;
|
|
|
|
while (animTable->srcPtr != 0) {
|
|
|
|
if (animTable->windowNum & 0x8000) {
|
|
|
|
x = animTable->x + _scrollX;
|
|
|
|
y = animTable->y;
|
|
|
|
w = animTable->width * 2;
|
|
|
|
h = animTable->height;
|
|
|
|
|
|
|
|
dirtyClipCheck(x, y, w, h);
|
|
|
|
}
|
|
|
|
animTable++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_newDirtyClip != 0)
|
|
|
|
goto restart;
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-06-09 05:30:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::dirtyClipCheck(int16 x, int16 y, int16 w, int16 h) {
|
|
|
|
int16 width, height, tmp;
|
|
|
|
|
|
|
|
VgaSprite *vsp = _vgaSprites;
|
|
|
|
for (; vsp->id != 0; vsp++) {
|
|
|
|
if (vsp->windowNum & 0x8000)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (vsp->image == 0)
|
|
|
|
continue;
|
|
|
|
|
2007-06-19 11:12:56 +00:00
|
|
|
VgaPointersEntry *vpe = &_vgaBufferPointers[vsp->zoneNum];
|
|
|
|
const byte *ptr = vpe->vgaFile2 + vsp->image * 8;
|
2007-06-09 05:30:20 +00:00
|
|
|
width = READ_BE_UINT16(ptr + 6) / 8;
|
|
|
|
height = ptr[5];
|
|
|
|
|
|
|
|
tmp = vsp->x;
|
|
|
|
if (tmp >= x) {
|
|
|
|
tmp -= w;
|
|
|
|
if (tmp >= x)
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
tmp += width;
|
|
|
|
if (tmp < x)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = vsp->y;
|
|
|
|
if (tmp >= y) {
|
|
|
|
tmp -= h;
|
|
|
|
if (tmp >= y)
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
tmp += height;
|
|
|
|
if (tmp < y)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
vsp->windowNum |= 0x8000;
|
|
|
|
_newDirtyClip = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
AnimTable *animTable = _screenAnim1;
|
|
|
|
for (; animTable->srcPtr != 0; animTable++) {
|
|
|
|
if (animTable->windowNum & 0x8000)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
width = animTable->width * 2;
|
|
|
|
height = animTable->height;
|
|
|
|
|
|
|
|
tmp = animTable->x + _scrollX;
|
|
|
|
if (tmp >= x) {
|
|
|
|
tmp -= w;
|
|
|
|
if (tmp >= x)
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
tmp += width;
|
|
|
|
if (tmp < x)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = animTable->y;
|
|
|
|
if (tmp >= y) {
|
|
|
|
tmp -= h;
|
|
|
|
if (tmp >= y)
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
tmp += height;
|
|
|
|
if (tmp < y)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
animTable->windowNum |= 0x8000;
|
|
|
|
_newDirtyClip = 1;
|
|
|
|
}
|
2007-05-09 15:36:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::restoreBackGround() {
|
|
|
|
AnimTable *animTable;
|
|
|
|
uint images = 0;
|
|
|
|
|
|
|
|
animTable = _screenAnim1;
|
|
|
|
while (animTable->srcPtr) {
|
|
|
|
animTable++;
|
|
|
|
images++;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (images--) {
|
|
|
|
animTable--;
|
|
|
|
|
|
|
|
if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
|
2007-06-09 05:30:20 +00:00
|
|
|
!(animTable->windowNum & 0x8000)) {
|
|
|
|
continue;
|
2007-05-09 15:36:05 +00:00
|
|
|
}
|
|
|
|
|
2008-03-01 03:59:56 +00:00
|
|
|
_windowNum = animTable->windowNum & ~0x8000;
|
2007-05-09 15:36:05 +00:00
|
|
|
|
|
|
|
VC10_state state;
|
2009-02-07 01:11:51 +00:00
|
|
|
state.srcPtr = animTable->srcPtr;
|
2007-05-09 15:36:05 +00:00
|
|
|
state.height = state.draw_height = animTable->height;
|
|
|
|
state.width = state.draw_width = animTable->width;
|
|
|
|
state.y = animTable->y;
|
|
|
|
state.x = animTable->x;
|
|
|
|
state.palette = 0;
|
|
|
|
state.paletteMod = 0;
|
|
|
|
state.flags = kDFNonTrans;
|
|
|
|
|
2010-07-04 07:32:12 +00:00
|
|
|
_backFlag = true;
|
2007-05-09 15:36:05 +00:00
|
|
|
drawImage(&state);
|
|
|
|
|
2007-06-09 05:30:20 +00:00
|
|
|
if (getGameType() != GType_SIMON1 && getGameType() != GType_SIMON2) {
|
2007-05-09 15:36:05 +00:00
|
|
|
animTable->srcPtr = 0;
|
2007-06-09 05:30:20 +00:00
|
|
|
}
|
2007-05-09 15:36:05 +00:00
|
|
|
}
|
2010-07-04 07:32:12 +00:00
|
|
|
_backFlag = false;
|
2007-05-09 15:36:05 +00:00
|
|
|
|
|
|
|
if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
|
|
|
|
AnimTable *animTableTmp;
|
|
|
|
|
|
|
|
animTable = animTableTmp = _screenAnim1;
|
2007-05-15 13:01:36 +00:00
|
|
|
while (animTable->srcPtr) {
|
2007-06-09 05:30:20 +00:00
|
|
|
if (!(animTable->windowNum & 0x8000)) {
|
2008-05-13 16:09:57 +00:00
|
|
|
memmove(animTableTmp, animTable, sizeof(AnimTable));
|
2007-05-09 15:36:05 +00:00
|
|
|
animTableTmp++;
|
|
|
|
}
|
|
|
|
animTable++;
|
|
|
|
}
|
2007-05-15 13:01:36 +00:00
|
|
|
animTableTmp->srcPtr = 0;
|
2007-05-09 15:36:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::saveBackGround(VgaSprite *vsp) {
|
2007-05-28 13:01:08 +00:00
|
|
|
if (getGameType() == GType_ELVIRA1 && getPlatform() == Common::kPlatformAtariST &&
|
|
|
|
(getFeatures() & GF_DEMO)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-05-15 13:01:36 +00:00
|
|
|
if ((vsp->flags & kDFSkipStoreBG) || !vsp->image)
|
2007-05-09 15:36:05 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
AnimTable *animTable = _screenAnim1;
|
|
|
|
|
|
|
|
while (animTable->srcPtr)
|
|
|
|
animTable++;
|
|
|
|
|
|
|
|
const byte *ptr = _curVgaFile2 + vsp->image * 8;
|
|
|
|
int16 x = vsp->x - _scrollX;
|
|
|
|
int16 y = vsp->y - _scrollY;
|
|
|
|
|
|
|
|
if (_window3Flag == 1) {
|
2009-07-06 06:21:59 +00:00
|
|
|
animTable->srcPtr = (const byte *)_window4BackScn->pixels;
|
2007-05-09 15:36:05 +00:00
|
|
|
} else {
|
2007-08-20 20:18:06 +00:00
|
|
|
int xoffs = (_videoWindows[vsp->windowNum * 4 + 0] * 2 + x) * 8;
|
|
|
|
int yoffs = (_videoWindows[vsp->windowNum * 4 + 1] + y);
|
2009-07-06 06:21:59 +00:00
|
|
|
animTable->srcPtr = getBackGround() + yoffs * _backGroundBuf->pitch + xoffs;
|
2007-05-09 15:36:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
animTable->x = x;
|
|
|
|
animTable->y = y;
|
|
|
|
|
|
|
|
animTable->width = READ_BE_UINT16(ptr + 6) / 16;
|
2009-07-17 10:48:30 +00:00
|
|
|
if (vsp->flags & 0x40) {
|
2007-05-09 15:36:05 +00:00
|
|
|
animTable->width++;
|
|
|
|
}
|
|
|
|
|
|
|
|
animTable->height = ptr[5];
|
2007-06-09 05:30:20 +00:00
|
|
|
animTable->windowNum = vsp->windowNum;
|
2007-05-09 15:36:05 +00:00
|
|
|
animTable->id = vsp->id;
|
2007-06-09 05:30:20 +00:00
|
|
|
animTable->zoneNum = vsp->zoneNum;
|
|
|
|
|
|
|
|
animTable++;
|
|
|
|
animTable->srcPtr = 0;
|
2007-05-09 15:36:05 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::displayBoxStars() {
|
2006-04-29 14:11:29 +00:00
|
|
|
HitArea *ha, *dha;
|
|
|
|
uint count;
|
|
|
|
uint y_, x_;
|
|
|
|
byte *dst;
|
2009-11-10 22:18:12 +00:00
|
|
|
uint color;
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
o_haltAnimation();
|
2006-04-29 14:11:29 +00:00
|
|
|
|
|
|
|
if (getGameType() == GType_SIMON2)
|
|
|
|
color = 236;
|
|
|
|
else
|
|
|
|
color = 225;
|
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
uint curHeight = (getGameType() == GType_SIMON2) ? _boxStarHeight : 134;
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
|
2006-04-29 14:11:29 +00:00
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
ha = _hitAreas;
|
|
|
|
count = ARRAYSIZE(_hitAreas);
|
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
Graphics::Surface *screen = _system->lockScreen();
|
|
|
|
|
2006-04-29 14:11:29 +00:00
|
|
|
do {
|
|
|
|
if (ha->id != 0 && ha->flags & kBFBoxInUse && !(ha->flags & kBFBoxDead)) {
|
|
|
|
|
|
|
|
dha = _hitAreas;
|
|
|
|
if (ha->flags & kBFTextBox) {
|
|
|
|
while (dha != ha && dha->flags != ha->flags)
|
|
|
|
++dha;
|
|
|
|
if (dha != ha && dha->flags == ha->flags)
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
dha = _hitAreas;
|
2009-02-07 01:11:51 +00:00
|
|
|
while (dha != ha && dha->itemPtr != ha->itemPtr)
|
2006-04-29 14:11:29 +00:00
|
|
|
++dha;
|
2009-02-07 01:11:51 +00:00
|
|
|
if (dha != ha && dha->itemPtr == ha->itemPtr)
|
2006-04-29 14:11:29 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
if (ha->y >= curHeight)
|
2006-04-29 14:11:29 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
y_ = (ha->height / 2) - 4 + ha->y;
|
|
|
|
|
|
|
|
x_ = (ha->width / 2) - 4 + ha->x - (_scrollX * 8);
|
|
|
|
|
|
|
|
if (x_ >= 311)
|
|
|
|
continue;
|
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
dst = (byte *)screen->pixels;
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2009-07-06 06:21:59 +00:00
|
|
|
dst += (((screen->pitch / 4) * y_) * 4) + x_;
|
2006-04-29 14:11:29 +00:00
|
|
|
|
|
|
|
dst[4] = color;
|
2009-11-10 22:18:12 +00:00
|
|
|
dst += screen->pitch;
|
|
|
|
dst[1] = color;
|
|
|
|
dst[4] = color;
|
|
|
|
dst[7] = color;
|
|
|
|
dst += screen->pitch;
|
|
|
|
dst[2] = color;
|
|
|
|
dst[4] = color;
|
|
|
|
dst[6] = color;
|
|
|
|
dst += screen->pitch;
|
|
|
|
dst[3] = color;
|
|
|
|
dst[5] = color;
|
|
|
|
dst += screen->pitch;
|
|
|
|
dst[0] = color;
|
|
|
|
dst[1] = color;
|
|
|
|
dst[2] = color;
|
|
|
|
dst[6] = color;
|
|
|
|
dst[7] = color;
|
|
|
|
dst[8] = color;
|
|
|
|
dst += screen->pitch;
|
|
|
|
dst[3] = color;
|
|
|
|
dst[5] = color;
|
|
|
|
dst += screen->pitch;
|
|
|
|
dst[2] = color;
|
|
|
|
dst[4] = color;
|
|
|
|
dst[6] = color;
|
|
|
|
dst += screen->pitch;
|
|
|
|
dst[1] = color;
|
|
|
|
dst[4] = color;
|
|
|
|
dst[7] = color;
|
|
|
|
dst += screen->pitch;
|
|
|
|
dst[4] = color;
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
} while (ha++, --count);
|
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
_system->unlockScreen();
|
|
|
|
|
2006-04-29 14:11:29 +00:00
|
|
|
delay(100);
|
2007-05-13 08:46:48 +00:00
|
|
|
|
|
|
|
setMoveRect(0, 0, 320, curHeight);
|
|
|
|
_window4Flag = 2;
|
|
|
|
|
|
|
|
displayScreen();
|
2006-04-29 14:11:29 +00:00
|
|
|
delay(100);
|
|
|
|
}
|
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
o_restartAnimation();
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::scrollScreen() {
|
2007-05-09 15:36:05 +00:00
|
|
|
byte *dst;
|
2006-04-29 14:11:29 +00:00
|
|
|
const byte *src;
|
|
|
|
uint x, y;
|
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
dst = getBackGround();
|
2007-05-09 15:36:05 +00:00
|
|
|
|
2006-04-29 14:11:29 +00:00
|
|
|
if (_scrollXMax == 0) {
|
|
|
|
uint screenSize = 8 * _screenWidth;
|
|
|
|
if (_scrollFlag < 0) {
|
|
|
|
memmove(dst + screenSize, dst, _scrollWidth * _screenHeight - screenSize);
|
|
|
|
} else {
|
|
|
|
memmove(dst, dst + screenSize, _scrollWidth * _screenHeight - screenSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
y = _scrollY - 8;
|
|
|
|
|
|
|
|
if (_scrollFlag > 0) {
|
|
|
|
dst += _screenHeight * _screenWidth - screenSize;
|
|
|
|
y += 488;
|
|
|
|
}
|
|
|
|
|
|
|
|
src = _scrollImage + y / 2;
|
2009-07-06 06:21:59 +00:00
|
|
|
decodeRow(dst, src + readUint32Wrapper(src), _scrollWidth, _backGroundBuf->pitch);
|
2006-04-29 14:11:29 +00:00
|
|
|
|
|
|
|
_scrollY += _scrollFlag;
|
|
|
|
vcWriteVar(250, _scrollY);
|
2006-05-03 01:11:50 +00:00
|
|
|
|
2007-06-21 05:10:42 +00:00
|
|
|
fillBackFromBackGround(_screenHeight, _scrollWidth);
|
2006-04-29 14:11:29 +00:00
|
|
|
} else {
|
|
|
|
if (_scrollFlag < 0) {
|
|
|
|
memmove(dst + 8, dst, _screenWidth * _scrollHeight - 8);
|
|
|
|
} else {
|
|
|
|
memmove(dst, dst + 8, _screenWidth * _scrollHeight - 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
x = _scrollX;
|
|
|
|
x -= (getGameType() == GType_FF) ? 8 : 1;
|
|
|
|
|
|
|
|
if (_scrollFlag > 0) {
|
|
|
|
dst += _screenWidth - 8;
|
|
|
|
x += (getGameType() == GType_FF) ? 648 : 41;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (getGameType() == GType_FF)
|
|
|
|
src = _scrollImage + x / 2;
|
|
|
|
else
|
|
|
|
src = _scrollImage + x * 4;
|
2009-07-06 06:21:59 +00:00
|
|
|
decodeColumn(dst, src + readUint32Wrapper(src), _scrollHeight, _backGroundBuf->pitch);
|
2006-04-29 14:11:29 +00:00
|
|
|
|
|
|
|
_scrollX += _scrollFlag;
|
|
|
|
vcWriteVar(251, _scrollX);
|
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
if (getGameType() == GType_SIMON2) {
|
2009-07-06 06:21:59 +00:00
|
|
|
src = getBackGround();
|
|
|
|
dst = (byte *)_window4BackScn->pixels;
|
|
|
|
for (int i = 0; i < _scrollHeight; i++) {
|
|
|
|
memcpy(dst, src, _screenWidth);
|
|
|
|
src += _backGroundBuf->pitch;
|
|
|
|
dst += _window4BackScn->pitch;
|
|
|
|
}
|
2007-05-13 08:46:48 +00:00
|
|
|
} else {
|
2007-06-21 05:10:42 +00:00
|
|
|
fillBackFromBackGround(_scrollHeight, _screenWidth);
|
2007-05-09 15:36:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setMoveRect(0, 0, 320, _scrollHeight);
|
|
|
|
|
|
|
|
_window4Flag = 1;
|
2006-05-03 01:11:50 +00:00
|
|
|
}
|
2006-04-29 14:11:29 +00:00
|
|
|
|
|
|
|
_scrollFlag = 0;
|
2007-06-09 05:30:20 +00:00
|
|
|
|
|
|
|
if (getGameType() == GType_SIMON2) {
|
|
|
|
AnimTable *animTable = _screenAnim1;
|
|
|
|
while (animTable->srcPtr) {
|
|
|
|
animTable->srcPtr = 0;
|
|
|
|
animTable++;
|
|
|
|
}
|
|
|
|
|
|
|
|
VgaSprite *vsp = _vgaSprites;
|
|
|
|
while (vsp->id) {
|
|
|
|
vsp->windowNum |= 0x8000;
|
|
|
|
vsp++;
|
|
|
|
}
|
|
|
|
}
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
|
2007-06-21 05:10:42 +00:00
|
|
|
void AGOSEngine::clearSurfaces() {
|
2009-02-15 21:20:21 +00:00
|
|
|
_system->fillScreen(0);
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2007-06-21 05:10:42 +00:00
|
|
|
if (_backBuf) {
|
2009-07-06 06:21:59 +00:00
|
|
|
memset(getBackBuf(), 0, _backBuf->h * _backBuf->pitch);
|
2007-06-21 05:10:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::fillBackFromBackGround(uint16 height, uint16 width) {
|
2009-07-06 06:21:59 +00:00
|
|
|
byte *src = getBackGround();
|
|
|
|
byte *dst = getBackBuf();
|
|
|
|
for (int i = 0; i < height; i++) {
|
|
|
|
memcpy(dst, src, width);
|
|
|
|
src += _backGroundBuf->pitch;
|
|
|
|
dst += _backBuf->pitch;
|
|
|
|
}
|
2007-06-21 05:10:42 +00:00
|
|
|
}
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2007-06-21 05:10:42 +00:00
|
|
|
void AGOSEngine::fillBackFromFront() {
|
|
|
|
Graphics::Surface *screen = _system->lockScreen();
|
2009-07-06 06:21:59 +00:00
|
|
|
byte *src = (byte *)screen->pixels;
|
|
|
|
byte *dst = getBackBuf();
|
|
|
|
|
|
|
|
for (int i = 0; i < _screenHeight; i++) {
|
|
|
|
memcpy(dst, src, _screenWidth);
|
|
|
|
src += screen->pitch;
|
|
|
|
dst += _backBuf->pitch;
|
|
|
|
}
|
2007-06-21 03:14:20 +00:00
|
|
|
_system->unlockScreen();
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
|
2007-06-21 05:10:42 +00:00
|
|
|
void AGOSEngine::fillBackGroundFromBack() {
|
2009-07-06 06:21:59 +00:00
|
|
|
byte *src = getBackBuf();
|
|
|
|
byte *dst = getBackGround();
|
|
|
|
for (int i = 0; i < _screenHeight; i++) {
|
|
|
|
memcpy(dst, src, _screenWidth);
|
|
|
|
src += _backBuf->pitch;
|
|
|
|
dst += _backGroundBuf->pitch;
|
|
|
|
}
|
2007-06-21 05:10:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::fillBackGroundFromFront() {
|
|
|
|
Graphics::Surface *screen = _system->lockScreen();
|
2009-07-06 06:21:59 +00:00
|
|
|
byte *src = (byte *)screen->pixels;
|
|
|
|
byte *dst = getBackGround();
|
|
|
|
|
|
|
|
for (int i = 0; i < _screenHeight; i++) {
|
|
|
|
memcpy(dst, src, _screenWidth);
|
|
|
|
src += screen->pitch;
|
|
|
|
dst += _backGroundBuf->pitch;
|
|
|
|
}
|
2007-06-21 05:10:42 +00:00
|
|
|
_system->unlockScreen();
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
|
2007-05-09 15:36:05 +00:00
|
|
|
void AGOSEngine::setMoveRect(uint16 x, uint16 y, uint16 width, uint16 height) {
|
|
|
|
if (x < _moveXMin)
|
|
|
|
_moveXMin = x;
|
|
|
|
|
|
|
|
if (y < _moveYMin)
|
|
|
|
_moveYMin = y;
|
|
|
|
|
|
|
|
if (width > _moveXMax)
|
|
|
|
_moveXMax = width;
|
|
|
|
|
|
|
|
if (height > _moveYMax)
|
|
|
|
_moveYMax = height;
|
|
|
|
}
|
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
void AGOSEngine::displayScreen() {
|
2006-05-05 05:53:36 +00:00
|
|
|
if (_fastFadeInFlag == 0 && _paletteFlag == 1) {
|
2006-04-29 14:11:29 +00:00
|
|
|
_paletteFlag = 0;
|
2011-02-15 22:22:30 +00:00
|
|
|
if (memcmp(_displayPalette, _currentPalette, sizeof(_currentPalette))) {
|
|
|
|
memcpy(_currentPalette, _displayPalette, sizeof(_displayPalette));
|
2011-02-07 17:52:38 +00:00
|
|
|
_system->getPaletteManager()->setPalette(_displayPalette, 0, 256);
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
Graphics::Surface *screen = _system->lockScreen();
|
2007-05-13 08:46:48 +00:00
|
|
|
if (getGameType() == GType_PP || getGameType() == GType_FF) {
|
2009-07-06 06:21:59 +00:00
|
|
|
byte *src = getBackBuf();
|
|
|
|
byte *dst = (byte *)screen->pixels;
|
|
|
|
for (int i = 0; i < _screenHeight; i++) {
|
|
|
|
memcpy(dst, src, _screenWidth);
|
|
|
|
src += _backBuf->pitch;
|
|
|
|
dst += screen->pitch;
|
|
|
|
}
|
2007-05-13 08:46:48 +00:00
|
|
|
if (getGameId() != GID_DIMP)
|
2007-06-21 05:10:42 +00:00
|
|
|
fillBackFromBackGround(_screenHeight, _screenWidth);
|
2007-05-13 08:46:48 +00:00
|
|
|
} else {
|
2007-05-09 15:36:05 +00:00
|
|
|
if (_window4Flag == 2) {
|
|
|
|
_window4Flag = 0;
|
|
|
|
|
|
|
|
uint16 srcWidth, width, height;
|
2007-06-21 03:14:20 +00:00
|
|
|
byte *dst = (byte *)screen->pixels;
|
2007-05-09 15:36:05 +00:00
|
|
|
|
2009-07-06 06:21:59 +00:00
|
|
|
const byte *src = (const byte *)_window4BackScn->pixels;
|
2007-05-09 15:36:05 +00:00
|
|
|
if (_window3Flag == 1) {
|
|
|
|
src = getBackGround();
|
|
|
|
}
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2009-07-06 06:21:59 +00:00
|
|
|
dst += (_moveYMin + _videoWindows[17]) * screen->pitch;
|
2007-05-09 15:36:05 +00:00
|
|
|
dst += (_videoWindows[16] * 16) + _moveXMin;
|
|
|
|
|
|
|
|
src += (_videoWindows[18] * 16 * _moveYMin);
|
|
|
|
src += _moveXMin;
|
|
|
|
|
|
|
|
srcWidth = _videoWindows[18] * 16;
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-05-09 15:36:05 +00:00
|
|
|
width = _moveXMax - _moveXMin;
|
|
|
|
height = _moveYMax - _moveYMin;
|
|
|
|
|
|
|
|
for (; height > 0; height--) {
|
|
|
|
memcpy(dst, src, width);
|
2009-07-06 06:21:59 +00:00
|
|
|
dst += screen->pitch;
|
2007-05-09 15:36:05 +00:00
|
|
|
src += srcWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
_moveXMin = 0xFFFF;
|
|
|
|
_moveYMin = 0xFFFF;
|
|
|
|
_moveXMax = 0;
|
|
|
|
_moveYMax = 0;
|
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-05-13 08:46:48 +00:00
|
|
|
if (_window6Flag == 2) {
|
2007-05-09 15:36:05 +00:00
|
|
|
_window6Flag = 0;
|
|
|
|
|
2009-07-06 06:21:59 +00:00
|
|
|
byte *src = (byte *)_window6BackScn->pixels;
|
|
|
|
byte *dst = (byte *)screen->pixels + 51 * screen->pitch;
|
2007-05-09 15:36:05 +00:00
|
|
|
for (int i = 0; i < 80; i++) {
|
2009-07-06 06:21:59 +00:00
|
|
|
memcpy(dst, src, _window6BackScn->w);
|
|
|
|
dst += screen->pitch;
|
|
|
|
src += _window6BackScn->pitch;
|
2007-05-09 15:36:05 +00:00
|
|
|
}
|
2007-05-13 08:46:48 +00:00
|
|
|
}
|
2007-05-09 15:36:05 +00:00
|
|
|
}
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
_system->unlockScreen();
|
|
|
|
|
2006-04-29 14:11:29 +00:00
|
|
|
if (getGameType() == GType_FF && _scrollFlag) {
|
|
|
|
scrollScreen();
|
|
|
|
}
|
|
|
|
|
2006-05-05 05:53:36 +00:00
|
|
|
if (_fastFadeInFlag) {
|
2006-04-29 14:11:29 +00:00
|
|
|
fastFadeIn();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::fastFadeIn() {
|
2006-05-05 05:53:36 +00:00
|
|
|
if (_fastFadeInFlag & 0x8000) {
|
2006-04-29 14:11:29 +00:00
|
|
|
slowFadeIn();
|
|
|
|
} else {
|
|
|
|
_paletteFlag = false;
|
2011-02-15 22:22:30 +00:00
|
|
|
memcpy(_currentPalette, _displayPalette, sizeof(_displayPalette));
|
2011-02-07 17:52:38 +00:00
|
|
|
_system->getPaletteManager()->setPalette(_displayPalette, 0, _fastFadeInFlag);
|
2006-05-05 05:53:36 +00:00
|
|
|
_fastFadeInFlag = 0;
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::slowFadeIn() {
|
2006-04-29 14:11:29 +00:00
|
|
|
uint8 *src, *dst;
|
|
|
|
int c, p;
|
|
|
|
|
2008-03-01 03:59:56 +00:00
|
|
|
_fastFadeInFlag &= ~0x8000;
|
2006-04-29 14:11:29 +00:00
|
|
|
_paletteFlag = false;
|
|
|
|
|
2009-07-22 09:52:44 +00:00
|
|
|
memset(_currentPalette, 0, sizeof(_currentPalette));
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2006-05-03 11:40:11 +00:00
|
|
|
for (c = 255; c >= 0; c -= 4) {
|
2009-07-22 09:52:44 +00:00
|
|
|
src = _displayPalette;
|
|
|
|
dst = _currentPalette;
|
2006-04-29 14:11:29 +00:00
|
|
|
|
2011-02-15 22:22:30 +00:00
|
|
|
for (p = _fastFadeInFlag; p != 0; p -= 3) {
|
2006-05-07 00:32:00 +00:00
|
|
|
if (src[0] >= c)
|
|
|
|
dst[0] += 4;
|
|
|
|
if (src[1] >= c)
|
|
|
|
dst[1] += 4;
|
|
|
|
if (src[2] >= c)
|
|
|
|
dst[2] += 4;
|
2011-02-15 22:22:30 +00:00
|
|
|
src += 3;
|
|
|
|
dst += 3;
|
2008-01-28 00:14:17 +00:00
|
|
|
}
|
2011-02-07 17:52:38 +00:00
|
|
|
_system->getPaletteManager()->setPalette(_currentPalette, 0, _fastFadeCount);
|
2008-01-28 00:14:17 +00:00
|
|
|
delay(5);
|
|
|
|
}
|
2006-05-05 05:53:36 +00:00
|
|
|
_fastFadeInFlag = 0;
|
2006-04-29 14:11:29 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
} // End of namespace AGOS
|