aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2008-04-22 07:40:28 +0000
committerFilippos Karapetis2008-04-22 07:40:28 +0000
commitf1a27858d54c55dc916c6aa6a3e85f0651596e75 (patch)
treeb3f8214115095f3491d0982cb92e947ee5f7d44f /engines
parent056547f45f25d7618754cf82def5fa4d67b3b474 (diff)
downloadscummvm-rg350-f1a27858d54c55dc916c6aa6a3e85f0651596e75.tar.gz
scummvm-rg350-f1a27858d54c55dc916c6aa6a3e85f0651596e75.tar.bz2
scummvm-rg350-f1a27858d54c55dc916c6aa6a3e85f0651596e75.zip
Added palette locking and some wip sound playing code. Some cleanup
svn-id: r31654
Diffstat (limited to 'engines')
-rw-r--r--engines/made/screen.cpp48
-rw-r--r--engines/made/screen.h7
-rw-r--r--engines/made/scriptfuncs.cpp11
3 files changed, 32 insertions, 34 deletions
diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp
index f189331dd4..c809749cf1 100644
--- a/engines/made/screen.cpp
+++ b/engines/made/screen.cpp
@@ -33,29 +33,25 @@ Screen::Screen(MadeEngine *vm) : _vm(vm) {
_screen1 = new Graphics::Surface();
_screen1->create(320, 200, 1);
- _clipInfo1.x = 0;
- _clipInfo1.y = 0;
- _clipInfo1.w = 320;
- _clipInfo1.h = 200;
- _clipInfo1.destSurface = _screen1;
-
_screen2 = new Graphics::Surface();
_screen2->create(320, 200, 1);
- _clipInfo2.x = 0;
- _clipInfo2.y = 0;
- _clipInfo2.w = 320;
- _clipInfo2.h = 200;
- _clipInfo2.destSurface = _screen2;
+ _clipInfo1.x = _clipInfo2.x = 0;
+ _clipInfo1.y = _clipInfo2.y = 0;
+ _clipInfo1.w = _clipInfo2.w = 320;
+ _clipInfo1.h = _clipInfo2.h = 200;
+
+ _clipInfo1.destSurface = _screen1;
+ _clipInfo2.destSurface = _screen2;
_clipArea.destSurface = _screen2;
- _excludeClipAreaEnabled[0] = false;
- _excludeClipAreaEnabled[1] = false;
- _excludeClipAreaEnabled[2] = false;
- _excludeClipAreaEnabled[3] = false;
+ for (int i = 0; i <= 3; i++)
+ _excludeClipAreaEnabled[i] = false;
+
+ _screenLock = false;
+ _paletteLock = false;
clearChannels();
-
}
Screen::~Screen() {
@@ -135,19 +131,16 @@ uint16 Screen::setChannelContent(uint16 channelIndex, uint16 index) {
void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask, int16 excludeStateMask) {
- _excludeClipArea[0].destSurface = clipInfo.destSurface;
- _excludeClipArea[1].destSurface = clipInfo.destSurface;
- _excludeClipArea[2].destSurface = clipInfo.destSurface;
- _excludeClipArea[3].destSurface = clipInfo.destSurface;
+ for (int i = 0; i <= 3; i++)
+ _excludeClipArea[i].destSurface = clipInfo.destSurface;
+
_clipArea.destSurface = clipInfo.destSurface;
for (uint16 i = 0; i < _channelsUsedCount; i++) {
debug(2, "drawSpriteChannels() i = %d\n", i);
- if (((_channels[i].state & includeStateMask) == includeStateMask) && (_channels[i].state & excludeStateMask) == 0)
- {
-
+ if (((_channels[i].state & includeStateMask) == includeStateMask) && (_channels[i].state & excludeStateMask) == 0) {
uint16 flag1 = _channels[i].state & 0x10;
uint16 flag2 = _channels[i].state & 0x20;
@@ -203,18 +196,15 @@ void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask
}
void Screen::updateSprites() {
-
- // TODO: This needs some more work, I don't use dirty rectangles for now
+ // TODO: This needs some more work, dirty rectangles are currently not used
memcpy(_screen2->pixels, _screen1->pixels, 64000);
//drawSpriteChannels(_clipInfo1, 3, 0x40);//CHECKME
-
drawSpriteChannels(_clipInfo1, 3, 0);//CHECKME
drawSpriteChannels(_clipInfo2, 1, 2);//CHECKME
_vm->_system->copyRectToScreen((const byte*)_screen2->pixels, _screen2->pitch, 0, 0, _screen2->w, _screen2->h);
-
}
void Screen::clearChannels() {
@@ -287,7 +277,6 @@ void Screen::drawAnimFrame(uint16 animIndex, int16 x, int16 y, int16 frameNum, u
}
_vm->_res->freeResource(anim);
-
}
uint16 Screen::drawPic(uint16 index, int16 x, int16 y, uint16 flag1, uint16 flag2) {
@@ -304,11 +293,10 @@ uint16 Screen::drawAnimPic(uint16 animIndex, int16 x, int16 y, int16 frameNum, u
return 0;
}
-uint16 Screen::addSprite(uint16 spriteIndex) {
+void Screen::addSprite(uint16 spriteIndex) {
bool oldScreenLock = _screenLock;
drawFlex(spriteIndex, 0, 0, 0, 0, _clipInfo1);
_screenLock = oldScreenLock;
- return 0;
}
uint16 Screen::drawSprite(uint16 flexIndex, int16 x, int16 y) {
diff --git a/engines/made/screen.h b/engines/made/screen.h
index d6040e7dcc..c25ddbd6fb 100644
--- a/engines/made/screen.h
+++ b/engines/made/screen.h
@@ -63,6 +63,8 @@ public:
void drawSurface(Graphics::Surface *source, int x, int y);
void loadRGBPalette(byte *palRGB, int count = 256);
void setRGBPalette(byte *palRGB, int start = 0, int count = 256);
+ bool isPaletteLocked() { return _paletteLock; }
+ void setPaletteLock(bool lock) { _paletteLock = lock; }
uint16 updateChannel(uint16 channelIndex);
void deleteChannel(uint16 channelIndex);
@@ -81,7 +83,7 @@ public:
uint16 drawPic(uint16 index, int16 x, int16 y, uint16 flag1, uint16 flag2);
uint16 drawAnimPic(uint16 animIndex, int16 x, int16 y, int16 frameNum, uint16 flag1, uint16 flag2);
- uint16 addSprite(uint16 spriteIndex);
+ void addSprite(uint16 spriteIndex);
uint16 drawSprite(uint16 flexIndex, int16 x, int16 y);
uint16 placeSprite(uint16 channelIndex, uint16 flexIndex, int16 x, int16 y);
@@ -106,7 +108,8 @@ protected:
MadeEngine *_vm;
bool _screenLock;
-
+ bool _paletteLock;
+
uint16 _clip, _exclude, _ground;
Graphics::Surface *_screen1, *_screen2;
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index 5aa4b41eaa..4519803101 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -190,7 +190,8 @@ int16 ScriptFunctionsRtz::o1_CLS(int16 argc, int16 *argv) {
}
int16 ScriptFunctionsRtz::o1_SHOWPAGE(int16 argc, int16 *argv) {
- _vm->_system->setPalette(_vm->_screen->_screenPalette, 0, 256);
+ if (!_vm->_screen->isPaletteLocked())
+ _vm->_system->setPalette(_vm->_screen->_screenPalette, 0, 256);
_vm->_screen->show();
return 0;
}
@@ -274,6 +275,11 @@ int16 ScriptFunctionsRtz::o1_VISUALFX(int16 argc, int16 *argv) {
}
int16 ScriptFunctionsRtz::o1_PLAYSND(int16 argc, int16 *argv) {
+ /*
+ Audio::SoundHandle audioStreamHandle;
+ _vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &audioStreamHandle,
+ _vm->_res->getSound(argv[0])->getAudioStream());
+ */
return 0;
}
@@ -332,6 +338,7 @@ int16 ScriptFunctionsRtz::o1_SCREENLOCK(int16 argc, int16 *argv) {
}
int16 ScriptFunctionsRtz::o1_ADDSPRITE(int16 argc, int16 *argv) {
+ //_vm->_screen->addSprite(argv[0]);
g_system->delayMillis(5000);
return 0;
}
@@ -381,7 +388,7 @@ int16 ScriptFunctionsRtz::o1_FREETIMER(int16 argc, int16 *argv) {
}
int16 ScriptFunctionsRtz::o1_PALETTELOCK(int16 argc, int16 *argv) {
- //g_system->delayMillis(1000);
+ _vm->_screen->setPaletteLock(argv[0] != 0);
return 0;
}