diff options
author | James Brown | 2002-04-20 04:09:02 +0000 |
---|---|---|
committer | James Brown | 2002-04-20 04:09:02 +0000 |
commit | eb773b477a669427ff84e422bbdb1c3d6b63e8ef (patch) | |
tree | fdcef5572f381d4760e150fe5558b6de703f5922 /gfx.cpp | |
parent | ed65e89a897f66eadc53ce27eb5fe6b39d16a0eb (diff) | |
download | scummvm-rg350-eb773b477a669427ff84e422bbdb1c3d6b63e8ef.tar.gz scummvm-rg350-eb773b477a669427ff84e422bbdb1c3d6b63e8ef.tar.bz2 scummvm-rg350-eb773b477a669427ff84e422bbdb1c3d6b63e8ef.zip |
Remove \M's, add IRIX support.
svn-id: r4019
Diffstat (limited to 'gfx.cpp')
-rw-r--r-- | gfx.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
@@ -2639,68 +2639,133 @@ void Scumm::drawBomp(BompDrawData * bd) CHECK_HEAP; } + 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 searchComp1; + byte searchComp2; + byte searchComp3; + + short int bestResult; + short int currentResult; + byte currentIndex; + + int i; + int j; + + palPtr = getPalettePtr(); + + for(i=colorMin;i<colorMax;i++) + _proc_special_palette[i]=i; + + curPtr = palPtr + colorMin*3; + + for(i=colorMin;i<colorMax;i++) + { + /* colorComp1=((((*curPtr++)>>2)*c)>>8)&0x7F; + colorComp2=((((*curPtr++)>>2)*d)>>8)&0x7F; + colorComp3=((((*curPtr++)>>2)*e)>>8)&0x7F;*/ + + /* 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; + + + searchPtr = palPtr; + bestResult = 0x7FFF; + currentIndex = 0; + + for(j=0;j<256;j++) + { + searchComp1 = (*searchPtr++); + searchComp2 = (*searchPtr++); + searchComp3 = (*searchPtr++); + + currentResult = abs(searchComp1-colorComp1) + abs(searchComp2-colorComp2) + abs(searchComp3-colorComp3); + + if(currentResult<bestResult) + if(currentIndex >= a && currentIndex <= b) + { + _proc_special_palette[i]=currentIndex; + bestResult=currentResult; + } + + currentIndex++; + } + + } + }
\ No newline at end of file |