From 25eafd60f2d9a3f12eaa7839d7f50e318db55895 Mon Sep 17 00:00:00 2001 From: Vincent Hamm Date: Sun, 21 Apr 2002 13:13:26 +0000 Subject: Completly fixed all the semi-transprency in Sam&Max svn-id: r4034 --- gfx.cpp | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'gfx.cpp') diff --git a/gfx.cpp b/gfx.cpp index 92b92449da..45dab3fea3 100644 --- a/gfx.cpp +++ b/gfx.cpp @@ -2640,19 +2640,25 @@ CHECK_HEAP; } +/* Yazoo: This function create the specialPalette used for semi-transparency in SamnMax */ + void Scumm::createSpecialPalette(int16 a, int16 b, int16 c, int16 d, int16 e, int16 colorMin, int16 colorMax) { byte *palPtr; byte *curPtr; byte *searchPtr; - byte colorComp1; - byte colorComp2; - byte colorComp3; + byte readComp1; + byte readComp2; + byte readComp3; + + int colorComp1; + int colorComp2; + int colorComp3; - byte searchComp1; - byte searchComp2; - byte searchComp3; + int searchComp1; + int searchComp2; + int searchComp3; short int bestResult; short int currentResult; @@ -2664,28 +2670,27 @@ void Scumm::createSpecialPalette(int16 a, int16 b, int16 c, int16 d, int16 e, in palPtr = getPalettePtr(); - for(i=colorMin;i>2)*c)>>8)&0x7F; - //colorComp2=((((*curPtr++)>>2)*d)>>8)&0x7F; - //colorComp3=((((*curPtr++)>>2)*e)>>8)&0x7F; + readComp1=*(curPtr++); + readComp2=*(curPtr++); + readComp3=*(curPtr++); - /* Yazoo: I can't get the right formula, so I made one that just work fine with SamnMax flashlight */ - colorComp1=(*curPtr++)+10; - colorComp2=(*curPtr++)+10; - colorComp3=(*curPtr++)+10; + colorComp1=((readComp1)*c)>>8; + colorComp2=((readComp2)*d)>>8; + colorComp3=((readComp3)*e)>>8; searchPtr = palPtr; - bestResult = 0x7FFF; + bestResult = 32000; currentIndex = 0; - for(j=0;j<256;j++) + for(j=a;j= a && currentIndex <= b) - { - _proc_special_palette[i]=currentIndex; - bestResult=currentResult; - } + { + _proc_special_palette[i]=currentIndex; + bestResult=currentResult; + } currentIndex++; } -- cgit v1.2.3