Ticket #8210: loom-palette-hack2.diff
File loom-palette-hack2.diff, 8.9 KB (added by , 22 years ago) |
---|
-
scummvm/scumm/actor.cpp
diff -ur ScummVM/scummvm/scumm/actor.cpp ScummVM+test/scummvm/scumm/actor.cpp
old new 979 979 cr._zbuf = (byte)_vm->gdi._numZBuffer; 980 980 981 981 cr._shadow_mode = shadow_mode; 982 cr._shadow_table = _vm->_shadowPalette; 982 if (_vm->_features & GF_SMALL_HEADER) 983 cr._shadow_table = NULL; 984 else 985 cr._shadow_table = _vm->_shadowPalette; 983 986 984 987 cr.setCostume(costume); 985 988 cr.setPalette(palette); -
scummvm/scumm/costume.cpp
diff -ur ScummVM/scummvm/scumm/costume.cpp ScummVM+test/scummvm/scumm/costume.cpp
old new 385 385 do { 386 386 if (color && y < scrheight) { 387 387 pcolor = _palette[color]; 388 if (pcolor == 13 ) {388 if (pcolor == 13 && _shadow_table) 389 389 pcolor = _shadow_table[*dst]; 390 }391 390 *dst = pcolor; 392 391 } 393 392 … … 434 433 do { 435 434 if (color && y < scrheight && !(*mask & maskbit)) { 436 435 pcolor = _palette[color]; 437 if (pcolor == 13 )436 if (pcolor == 13 && _shadow_table) 438 437 pcolor = _shadow_table[*dst]; 439 438 *dst = pcolor; 440 439 } … … 496 495 do { 497 496 if (color && y < scrheight && !((*mask | mask[_imgbufoffs]) & maskbit)) { 498 497 pcolor = _palette[color]; 499 if (pcolor == 13 )498 if (pcolor == 13 && _shadow_table) 500 499 pcolor = _shadow_table[*dst]; 501 500 *dst = pcolor; 502 501 } … … 559 558 if (cost_scaleTable[_scaleIndexY++] < _scaleY) { 560 559 if (color && y < _outheight && !((*mask | mask[_imgbufoffs]) & maskbit)) { 561 560 pcolor = _palette[color]; 562 if (pcolor == 13 )561 if (pcolor == 13 && _shadow_table) 563 562 pcolor = _shadow_table[*dst]; 564 563 *dst = pcolor; 565 564 } … … 620 619 if (cost_scaleTable[_scaleIndexY++] < _scaleY) { 621 620 if (color && y < _outheight && !(*mask & maskbit)) { 622 621 pcolor = _palette[color]; 623 if (pcolor == 13 )622 if (pcolor == 13 && _shadow_table) 624 623 pcolor = _shadow_table[*dst]; 625 624 *dst = pcolor; 626 625 } … … 681 680 if (cost_scaleTable[_scaleIndexY++] < _scaleY) { 682 681 if (color && y < _outheight) { 683 682 pcolor = _palette[color]; 684 if (pcolor == 13 )683 if (pcolor == 13 && _shadow_table) 685 684 pcolor = _shadow_table[*dst]; 686 685 *dst = pcolor; 687 686 } … … 737 736 do { 738 737 if (color && x >= 0 && x < _vm->_realWidth) { 739 738 pcolor = _palette[color]; 740 /* if (pcolor == 13) { 741 pcolor = _shadow_table[*dst]; 742 }*/ 739 /* if (pcolor == 13 && _shadow_table) 740 pcolor = _shadow_table[*dst];*/ 743 741 *dst = pcolor; 744 742 } 745 743 … … 786 784 do { 787 785 if (color && x >=0 && x < _vm->_realWidth && !(*mask & maskbit)) { 788 786 pcolor = _palette[color]; 789 /* if (pcolor == 13 )787 /* if (pcolor == 13 && _shadow_table) 790 788 pcolor = _shadow_table[*dst];*/ 791 789 *dst = pcolor; 792 790 } … … 851 849 do { 852 850 if (color && x >= 0 && x < _vm->_realWidth && !((*mask | mask[_imgbufoffs]) & maskbit)) { 853 851 pcolor = _palette[color]; 854 /* if (pcolor == 13 )852 /* if (pcolor == 13 && _shadow_table) 855 853 pcolor = _shadow_table[*dst];*/ 856 854 *dst = pcolor; 857 855 } … … 914 912 if (cost_scaleTable[_scaleIndexY] < _scaleY) { 915 913 if (color && _xpos >= 0 && _xpos < _vm->_realWidth && !((*mask | mask[_imgbufoffs]) & maskbit)) { 916 914 pcolor = _palette[color]; 917 /* if (pcolor == 13 )915 /* if (pcolor == 13 && _shadow_table) 918 916 pcolor = _shadow_table[*dst];*/ 919 917 *dst = pcolor; 920 918 } … … 978 976 if (cost_scaleTable[_scaleIndexY] < _scaleY) { 979 977 if (color && _xpos >= 0 && _xpos < _vm->_realWidth && !(*mask & maskbit)) { 980 978 pcolor = _palette[color]; 981 /* if (pcolor == 13 )979 /* if (pcolor == 13 && _shadow_table) 982 980 pcolor = _shadow_table[*dst];*/ 983 981 *dst = pcolor; 984 982 } … … 1046 1044 if (cost_scaleTable[_scaleIndexY] < _scaleY) { 1047 1045 if (color && _xpos >= 0 && _xpos < _vm->_realWidth) { 1048 1046 pcolor = _palette[color]; 1049 /* if (pcolor == 13 )1047 /* if (pcolor == 13 && _shadow_table) 1050 1048 pcolor = _shadow_table[*dst];*/ 1051 1049 *dst = pcolor; 1052 1050 } -
scummvm/scumm/gfx.cpp
diff -ur ScummVM/scummvm/scumm/gfx.cpp ScummVM+test/scummvm/scumm/gfx.cpp
old new 1085 1085 } 1086 1086 const register byte colors[2] = { color >> 4, color & 0xf }; 1087 1087 for(z = 0; z < run; z++) { 1088 1089 *(dst + y * _vm->_realWidth + x) = _vm->_shadowPalette[ colors[z&1] ]; 1088 *(dst + y * _vm->_realWidth + x) = colors[z&1]; 1090 1089 1091 1090 y++; 1092 1091 if(y >= height) { … … 1116 1115 } 1117 1116 1118 1117 for(z = 0; z < run; z++) { 1119 *(dst + y * _vm->_realWidth + x) = _vm->_shadowPalette[color & 0xf];1118 *(dst + y * _vm->_realWidth + x) = color & 0xf; 1120 1119 1121 1120 y++; 1122 1121 if(y >= height) { … … 1222 1221 if (run == 0) { 1223 1222 run = *src++; 1224 1223 } 1225 color = _vm->_shadowPalette[data & 0x0f];1224 color = data & 0x0f; 1226 1225 } 1227 1226 if (!dither) { 1228 1227 *ptr_dither_table = color; … … 1247 1246 if (run == 0) { 1248 1247 run = *src++; 1249 1248 } 1250 color = _vm->_shadowPalette[data & 0x0f];1249 color = data & 0x0f; 1251 1250 } 1252 1251 if (!dither) { 1253 1252 *ptr_dither_table = color; … … 2665 2664 #pragma mark --- Palette --- 2666 2665 #pragma mark - 2667 2666 2667 void Scumm::setupEGAPalette() { 2668 setPalColor( 0, 0, 0, 0); 2669 setPalColor( 1, 0, 0, 168); 2670 setPalColor( 2, 0, 168, 0); 2671 setPalColor( 3, 0, 168, 168); 2672 setPalColor( 4, 168, 0, 0); 2673 setPalColor( 5, 168, 0, 168); 2674 setPalColor( 6, 168, 84, 0); 2675 setPalColor( 7, 168, 168, 168); 2676 setPalColor( 8, 84, 84, 84); 2677 setPalColor( 9, 84, 84, 168); 2678 setPalColor(10, 0, 252, 0); 2679 setPalColor(11, 0, 252, 252); 2680 setPalColor(12, 252, 84, 84); 2681 setPalColor(13, 252, 0, 252); 2682 setPalColor(14, 252, 252, 0); 2683 setPalColor(15, 252, 252, 252); 2684 } 2685 2668 2686 void Scumm::setPaletteFromPtr(byte *ptr) { 2669 2687 int i; 2670 2688 byte *dest, r, g, b; -
scummvm/scumm/saveload.cpp
diff -ur ScummVM/scummvm/scumm/saveload.cpp ScummVM+test/scummvm/scumm/saveload.cpp
old new 174 174 initScreens(0, sb, _realWidth, sh); 175 175 176 176 _completeScreenRedraw = true; 177 178 if (!(_features & GF_16COLOR)) 177 178 if (_features & GF_16COLOR) { 179 // HACK: There was a time when ScummVM didn't store the 180 // palette in _currentPalette for 16-color games. To avoid 181 // breaking savegame compatibility, always set up the default 182 // palette after loading a game. 183 setupEGAPalette(); 184 setDirtyColors(0, 15); 185 } else 179 186 setDirtyColors(0, 255); 180 187 181 188 _lastCodePtr = NULL; -
scummvm/scumm/script_v5.cpp
diff -ur ScummVM/scummvm/scumm/script_v5.cpp ScummVM+test/scummvm/scumm/script_v5.cpp
old new 1679 1679 // printf("copyPalColor(%d, %d)\n", a, b); 1680 1680 // copyPalColor(a, b); 1681 1681 _shadowPalette[b] = a; 1682 if (!(_features & GF_16COLOR)) 1683 setDirtyColors(b, b); 1682 setDirtyColors(b, b); 1684 1683 } else { 1685 1684 error("room-color is no longer a valid command"); 1686 1685 } … … 1701 1700 } 1702 1701 checkRange(256, 0, a, "o5_roomOps: 2: Illegal room color slot (%d)"); 1703 1702 _shadowPalette[b] = a; 1704 if (!(_features & GF_16COLOR)) 1705 setDirtyColors(b, b); 1703 setDirtyColors(b, b); 1706 1704 } else { 1707 1705 a = getVarOrDirectWord(0x80); 1708 1706 b = getVarOrDirectWord(0x40); -
scummvm/scumm/scumm.h
diff -ur ScummVM/scummvm/scumm/scumm.h ScummVM+test/scummvm/scumm/scumm.h
old new 806 806 void clampCameraPos(ScummPoint *pt); 807 807 808 808 byte *getPalettePtr(); 809 void setupEGAPalette(); 809 810 void setPalette(int pal); 810 811 void setPaletteFromPtr(byte *ptr); 811 812 void setPaletteFromRes(); -
scummvm/scumm/scummvm.cpp
diff -ur ScummVM/scummvm/scumm/scummvm.cpp ScummVM+test/scummvm/scumm/scummvm.cpp
old new 544 544 } 545 545 546 546 if (_features & GF_16COLOR) { 547 byte pal16[16 * 4] = { 548 0, 0, 0, 0, 0, 0, 168, 0, 0, 168, 0, 0, 0, 168, 168, 0, 549 168, 0, 0, 0, 168, 0, 168, 0, 168, 84, 0, 0, 168, 168, 168, 0, 550 84, 84, 84, 0, 84, 84, 168, 0, 0, 252, 0, 0, 0, 252, 252, 0, 551 252, 84, 84, 0, 252, 0, 252, 0, 252, 252, 0, 0, 252, 252, 252, 0 552 }; 553 _system->set_palette(pal16, 0, 16); 547 for (i = 0; i < 16; i++) 548 _shadowPalette[i] = i; 549 setupEGAPalette(); 554 550 } 555 551 556 552 if (_features & GF_AFTER_V3) … … 981 977 } 982 978 983 979 if (!(_features & GF_AFTER_V7)) { 984 for (i = 0; i < 0x100; i++)980 for (i = 0; i < 256; i++) 985 981 _shadowPalette[i] = i; 982 if (_features & GF_SMALL_HEADER) 983 setDirtyColors(0, 255); 986 984 } 987 985 988 986 clearDrawObjectQueue();