diff options
author | Bertrand Augereau | 2011-11-17 15:33:25 +0100 |
---|---|---|
committer | Bertrand Augereau | 2011-11-17 17:05:52 +0100 |
commit | 21d3062d52bd5b10d30bdde412329ab4f4d0b8dd (patch) | |
tree | 6e2cf1f78d7161f35db8dc4509cd7000a805d85a /engines | |
parent | 8f6037709793308bcab1e55766ffcaaf41d0e026 (diff) | |
download | scummvm-rg350-21d3062d52bd5b10d30bdde412329ab4f4d0b8dd.tar.gz scummvm-rg350-21d3062d52bd5b10d30bdde412329ab4f4d0b8dd.tar.bz2 scummvm-rg350-21d3062d52bd5b10d30bdde412329ab4f4d0b8dd.zip |
DREAMWEB: 'loadpalfromiff' ported to C++
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 40 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 3 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 1 | ||||
-rw-r--r-- | engines/dreamweb/vgagrafx.cpp | 24 |
4 files changed, 26 insertions, 42 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 073e7c2310..11bfc07ee0 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2232,45 +2232,6 @@ bigroom: _add(data.byte(kMapysize), 8); } -void DreamGenContext::loadpalfromiff() { - STACK_CHECK; - dx = 2481; - openfile(); - cx = 2000; - ds = data.word(kMapstore); - dx = 0; - readfromfile(); - closefile(); - es = data.word(kBuffers); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768); - ds = data.word(kMapstore); - si = 0x30; - cx = 768; -palloop: - _lodsb(); - _shr(al, 1); - _shr(al, 1); - _cmp(data.byte(kBrightness), 1); - if (!flags.z()) - goto nought; - _cmp(al, 0); - if (flags.z()) - goto nought; - ah = al; - _shr(ah, 1); - _add(al, ah); - _shr(ah, 1); - _add(al, ah); - _cmp(al, 64); - if (flags.c()) - goto nought; - al = 63; -nought: - _stosb(); - if (--cx) - goto palloop; -} - void DreamGenContext::createpanel() { STACK_CHECK; di = 0; @@ -15699,7 +15660,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_reconstruct: reconstruct(); break; case addr_deleverything: deleverything(); break; case addr_showpcx: showpcx(); break; - case addr_loadpalfromiff: loadpalfromiff(); break; case addr_setmode: setmode(); break; case addr_createpanel: createpanel(); break; case addr_createpanel2: createpanel2(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f031fd6334..4f1eeac809 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -511,7 +511,6 @@ public: static const uint16 addr_createpanel2 = 0xc200; static const uint16 addr_createpanel = 0xc1fc; static const uint16 addr_setmode = 0xc1dc; - static const uint16 addr_loadpalfromiff = 0xc1d8; static const uint16 addr_showpcx = 0xc1cc; static const uint16 addr_deleverything = 0xc1c0; static const uint16 addr_reconstruct = 0xc1ac; @@ -1792,7 +1791,7 @@ public: void fadescreenups(); //void checkdest(); //void hangon(); - void loadpalfromiff(); + //void loadpalfromiff(); //void facerightway(); void startup1(); void hotelcontrol(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 8769716efa..29068332e6 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -64,6 +64,7 @@ uint8 kernchars(uint8 firstChar, uint8 secondChar, uint8 width); void oldtonames(); void namestoold(); + void loadpalfromiff(); void getroomdata(); Room *getroomdata(uint8 room); void readheader(); diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index 53db811313..11ba45f7eb 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -464,5 +464,29 @@ bool DreamGenContext::pixelcheckset(const ObjPos *pos, uint8 x, uint8 y) { return *ptr != 0; } +void DreamGenContext::loadpalfromiff() { + dx = kPalettescreen; + openfile(); + cx = 2000; + ds = data.word(kMapstore); + dx = 0; + readfromfile(); + closefile(); + + const uint8 *src = segRef(data.word(kMapstore)).ptr(0x30, 0); + uint8 *dst = mainPalette(); + for (size_t i = 0; i < 256*3; ++i) { + uint8 c = src[i] / 4; + if (data.byte(kBrightness) == 1) { + if (c) { + c = c + c / 2 + c / 4; + if (c > 63) + c = 63; + } + } + dst[i] = c; + } +} + } /*namespace dreamgen */ |