diff options
author | Bertrand Augereau | 2011-11-16 17:30:38 +0100 |
---|---|---|
committer | Bertrand Augereau | 2011-11-16 17:50:51 +0100 |
commit | 1ef77a580fe382f002dad6d0ae38ab43e4d2540b (patch) | |
tree | 60de051906b650cd4c173ea3e612ba1faf341539 /engines | |
parent | 82cc00923bb302cfe334c05646c07f385bce66fc (diff) | |
download | scummvm-rg350-1ef77a580fe382f002dad6d0ae38ab43e4d2540b.tar.gz scummvm-rg350-1ef77a580fe382f002dad6d0ae38ab43e4d2540b.tar.bz2 scummvm-rg350-1ef77a580fe382f002dad6d0ae38ab43e4d2540b.zip |
DREAMWEB: 'fadecalculation' 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 | 2 | ||||
-rw-r--r-- | engines/dreamweb/vgafades.cpp | 23 |
4 files changed, 25 insertions, 43 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 4560c15055..6c605e6295 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2843,45 +2843,6 @@ endearly2: cx = pop(); } -void DreamGenContext::fadecalculation() { - STACK_CHECK; - _cmp(data.byte(kFadecount), 0); - if (flags.z()) - goto nomorefading; - bl = data.byte(kFadecount); - es = data.word(kBuffers); - si = (0+(228*13)+32+60+(32*32)+(11*10*3)); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768); - cx = 768; -fadecolloop: - al = es.byte(si); - ah = es.byte(di); - _cmp(al, ah); - if (flags.z()) - goto gotthere; - if (flags.c()) - goto lesscolour; - _dec(es.byte(si)); - goto gotthere; -lesscolour: - _cmp(bl, ah); - if (flags.z()) - goto withit; - if (!flags.c()) - goto gotthere; -withit: - _inc(es.byte(si)); -gotthere: - _inc(si); - _inc(di); - if (--cx) - goto fadecolloop; - _dec(data.byte(kFadecount)); - return; -nomorefading: - data.byte(kFadedirection) = 0; -} - void DreamGenContext::greyscalesum() { STACK_CHECK; es = data.word(kBuffers); @@ -16189,7 +16150,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_showgun: showgun(); break; case addr_rollendcredits2: rollendcredits2(); break; case addr_rollem: rollem(); break; - case addr_fadecalculation: fadecalculation(); break; case addr_greyscalesum: greyscalesum(); break; case addr_showgroup: showgroup(); break; case addr_allpalette: allpalette(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index e6c105f466..564b52ed57 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -502,7 +502,6 @@ public: static const uint16 addr_allpalette = 0xc2a4; static const uint16 addr_showgroup = 0xc290; static const uint16 addr_greyscalesum = 0xc28c; - static const uint16 addr_fadecalculation = 0xc288; static const uint16 addr_rollem = 0xc284; static const uint16 addr_rollendcredits2 = 0xc280; static const uint16 addr_showgun = 0xc27c; @@ -1857,7 +1856,7 @@ public: void usechurchhole(); void searchforfiles(); void monkspeaking(); - void fadecalculation(); + //void fadecalculation(); //void waitframes(); void clearrest(); //void getreelframeax(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 4cdd11da8a..2fcb914e0f 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -263,5 +263,5 @@ void endpaltostart(); void startpaltoend(); void paltoendpal(); - + void fadecalculation(); diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index 79a7cce389..abb1a9b1a6 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -56,5 +56,28 @@ void DreamGenContext::paltoendpal() { memcpy(endPalette(), mainPalette(), 256*3); } +void DreamGenContext::fadecalculation() { + if (data.byte(kFadecount) == 0) { + data.byte(kFadedirection) = 0; + return; + } + + uint8 *startPal = startPalette(); + const uint8 *endPal = endPalette(); + for (size_t i = 0; i < 256 * 3; ++i, ++si, ++di) { + uint8 s = startPal[i]; + uint8 e = endPal[i]; + if (s == e) + continue; + else if (s > e) + --startPal[i]; + else { + if (data.byte(kFadecount) <= e) + ++startPal[i]; + } + } + --data.byte(kFadecount); +} + } /*namespace dreamgen */ |