diff options
author | Strangerke | 2012-01-07 21:47:11 +0100 |
---|---|---|
committer | Strangerke | 2012-01-07 21:47:47 +0100 |
commit | 9ddabeca32c453d77d9407e8134ab499550d19d1 (patch) | |
tree | 6e578eae26bb2e8aba6024b19e358667f2e5deaf /engines/tsage | |
parent | 103ae27d3ae0c27baf4bfb4cc2d9a356f26506f1 (diff) | |
download | scummvm-rg350-9ddabeca32c453d77d9407e8134ab499550d19d1.tar.gz scummvm-rg350-9ddabeca32c453d77d9407e8134ab499550d19d1.tar.bz2 scummvm-rg350-9ddabeca32c453d77d9407e8134ab499550d19d1.zip |
TSAGE: R2R - Fix sub1B00, rename it to scalePalette
Thanks wjp for the namings
Diffstat (limited to 'engines/tsage')
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.cpp | 33 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.h | 3 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes1.cpp | 2 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes3.cpp | 36 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes3.h | 1 |
5 files changed, 38 insertions, 37 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 260eb701f2..1a9a03b37c 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -270,7 +270,7 @@ SceneExt::SceneExt(): Scene() { _stripManager._onBegin = SceneExt::startStrip; _stripManager._onEnd = SceneExt::endStrip; - for (int i = 0; i < 44; i++) + for (int i = 0; i < 256; i++) _field312[i] = 0; _field372 = _field37A = 0; _savedPlayerEnabled = false; @@ -478,6 +478,37 @@ void SceneExt::saveCharacter(int characterIndex) { R2_GLOBALS._player._characterFrame[characterIndex] = R2_GLOBALS._player._frame; } +void SceneExt::scalePalette(int RFactor, int GFactor, int BFactor) { + byte *tmpPal = R2_GLOBALS._scenePalette._palette; + byte newR, newG, newB; + int tmp, varC, varD = 0; + + for (int i = 0; i < 256; i++) { + newR = (RFactor * tmpPal[(3 * i)]) / 100; + newG = (GFactor * tmpPal[(3 * i) + 1]) / 100; + newB = (BFactor * tmpPal[(3 * i) + 2]) / 100; + + varC = 769; + for (int j = 255; j >= 0; j--) { + tmp = abs(tmpPal[(3 * j)] - newR); + if (tmp >= varC) + continue; + + tmp += abs(tmpPal[(3 * j) + 1] - newG); + if (tmp >= varC) + continue; + + tmp += abs(tmpPal[(3 * j) + 2] - newB); + if (tmp >= varC) + continue; + + varC = tmp; + varD = j; + } + this->_field312[i] = varD; + } +} + /*--------------------------------------------------------------------------*/ void SceneHandlerExt::postInit(SceneObjectList *OwnerList) { diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 4805de48bb..bb6aa25f85 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -79,7 +79,7 @@ private: static void startStrip(); static void endStrip(); public: - byte _field312[44]; + byte _field312[256]; int _field372; bool _savedPlayerEnabled; bool _savedUiEnabled; @@ -106,6 +106,7 @@ public: bool display(CursorType action, Event &event); void fadeOut(); void clearScreen(); + void scalePalette(int RFactor, int GFactor, int BFactor); }; class SceneHandlerExt: public SceneHandler { diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 5a6a70015c..e773c52805 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -355,7 +355,7 @@ void Scene1100::postInit(SceneObjectList *OwnerList) { _stripManager.addSpeaker(&_quinnSpeaker); _stripManager.addSpeaker(&_chiefSpeaker); - warning("sub1B007(65, 65, 65);"); + scalePalette(65, 65, 65); _actor2.postInit(); _actor2.setup(1100, 1, 1); diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 5ae15d9c08..266098a2ca 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3929,37 +3929,6 @@ void Scene3800::sub110BBD() { } } -void Scene3800::sub1B007(int arg1, int arg2, int arg3) { - byte *tmpPal = R2_GLOBALS._scenePalette._palette; - byte newR, newG, newB; - int tmp, varC, varD = 0; - - for (int i = 0; i < 256; i++) { - newR = (arg1 * tmpPal[(3 * i)]) / 100; - newG = (arg2 * tmpPal[(3 * i) + 1]) / 100; - newB = (arg3 * tmpPal[(3 * i) + 2]) / 100; - - varC = 769; - for (int j = 255; j >= 0; j--) { - tmp = abs(tmpPal[(3 * j)] - newR); - if (tmp >= varC) - continue; - - tmp += abs(tmpPal[(3 * j) + 1] - newG); - if (tmp >= varC) - continue; - - tmp += abs(tmpPal[(3 * j) + 2] - newB); - if (tmp >= varC) - continue; - - varC = tmp; - varD = j; - } - this->_field312[i] = varD; - } -} - void Scene3800::postInit(SceneObjectList *OwnerList) { _field412 = 0; @@ -3968,7 +3937,7 @@ void Scene3800::postInit(SceneObjectList *OwnerList) { SceneExt::postInit(); R2_GLOBALS._sound1.play(231); - warning("sub1B007(65, 65, 65)"); + scalePalette(65, 65, 65); setZoomPercents(87, 40, 144, 100); @@ -4218,7 +4187,8 @@ void Scene3900::postInit(SceneObjectList *OwnerList) { _exit5._insideArea = false; _exit5._moving = false; - warning("sub1B007(65, 65, 65)"); + scalePalette(65, 65, 65); + _exit1.setDest(Common::Point(160, 126)); _exit1._enabled = true; _exit1._insideArea = false; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index c925871747..8a51aa5251 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -695,7 +695,6 @@ public: Scene3800(); void initScene3800(); void sub110BBD(); - void sub1B007(int arg1, int arg2, int arg3); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); |