diff options
author | Paul Gilbert | 2013-07-20 18:46:55 -0400 |
---|---|---|
committer | Paul Gilbert | 2013-07-20 18:46:55 -0400 |
commit | b79fd7e965e2792a18e477b830067182f35a216a (patch) | |
tree | 33cce23bc9bc0888a272ec09c5e66a494b3011fb /engines/tsage/ringworld2/ringworld2_scenes0.cpp | |
parent | a790fe0e80b6b0b8c45c5d37de2eb6faf221444c (diff) | |
download | scummvm-rg350-b79fd7e965e2792a18e477b830067182f35a216a.tar.gz scummvm-rg350-b79fd7e965e2792a18e477b830067182f35a216a.tar.bz2 scummvm-rg350-b79fd7e965e2792a18e477b830067182f35a216a.zip |
TSAGE: Work on setup of R2R engine palette maps
Diffstat (limited to 'engines/tsage/ringworld2/ringworld2_scenes0.cpp')
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes0.cpp | 60 |
1 files changed, 41 insertions, 19 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 634ecf3ddb..92e92ea578 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -226,9 +226,9 @@ bool Scene100::Terminal::startAction(CursorType action, Event &event) { /*--------------------------------------------------------------------------*/ void Scene100::postInit(SceneObjectList *OwnerList) { - SceneExt::postInit(); loadScene(100); R2_GLOBALS._scenePalette.loadPalette(0); + SceneExt::postInit(); if (R2_GLOBALS._sceneManager._previousScene != 125) R2_GLOBALS._sound1.play(10); @@ -5345,20 +5345,6 @@ void Scene525::signal() { * *--------------------------------------------------------------------------*/ -Scene600::Scene600() { - _field412 = 0; - for (int i = 0; i < 256; i++) - _fieldAD2[i] = 0; -} - -void Scene600::synchronize(Serializer &s) { - SceneExt::synchronize(s); - - s.syncAsSint16LE(_field412); - for (int i = 0; i < 256; i++) - s.syncAsByte(_fieldAD2[i]); -} - bool Scene600::CompartmentHotspot::startAction(CursorType action, Event &event) { if ((action != R2_NEGATOR_GUN) || (!R2_GLOBALS.getFlag(5)) || (R2_GLOBALS.getFlag(8))) return SceneHotspot::startAction(action, event); @@ -5415,9 +5401,22 @@ bool Scene600::Actor4::startAction(CursorType action, Event &event) { return false; } -void Scene600::Actor4::draw() { - warning("TODO: Actor4::draw()"); - SceneActor::draw(); +GfxSurface Scene600::Actor4::getFrame() { + GfxSurface frame = SceneActor::getFrame(); + + if (_effect) { + // Translate the frame using the scene's pixel map + byte *pixelMap = static_cast<Scene600 *>(R2_GLOBALS._sceneManager._scene)->_pixelMap; + Graphics::Surface surface = frame.lockSurface(); + byte *srcP = (byte *)surface.pixels; + + while (srcP < ((byte *)surface.pixels + (surface.w * surface.h))) + *srcP++ = pixelMap[*srcP]; + + frame.unlockSurface(); + } + + return frame; } bool Scene600::Doorway::startAction(CursorType action, Event &event) { @@ -5545,6 +5544,21 @@ bool Scene600::Aerosol::startAction(CursorType action, Event &event) { } } +/*--------------------------------------------------------------------------*/ + +Scene600::Scene600() { + _field412 = 0; + Common::fill(&_pixelMap[0], &_pixelMap[256], 0); +} + +void Scene600::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + for (int i = 0; i < 256; i++) + s.syncAsByte(_pixelMap[i]); +} + bool Scene600::Actor8::startAction(CursorType action, Event &event) { Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene; @@ -5570,7 +5584,15 @@ void Scene600::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._walkRegions.enableRegion(3); _field412 = 0; - warning("FIXME: loop to initialize _fieldAD2[]"); + // Initialise pixel map for the obscuring effect + ScenePalette &pal = R2_GLOBALS._scenePalette; + uint r, g, b; + for (int i = 0; i < 256; ++i) { + pal.getEntry(i, &r, &g, &b); + int av = ((r + g + b) / 48); + + _pixelMap[i] = R2_GLOBALS._paletteMap[(av << 8) | (av << 4) | av]; + } _doorway.postInit(); _doorway.setVisage(600); |