(svn r2736) -Codechange: De-mystified GfxDrawFillRect a bit, and used enums from table/sprites.h. You can now change the number of bits used for sprites and switches in the SpriteSetup enum and the rest should work automagically. Can be used to increase the number of active sprites to 2^19 in case there are no colortables (recolor sprites) in any newgrf. We should possibly move the the colortables to an own list, but how to detect them in a newgrf.

This commit is contained in:
celestar
2005-07-28 09:17:32 +00:00
parent 41795423cf
commit fcd012e7ec
7 changed files with 28 additions and 17 deletions

8
gfx.c
View File

@@ -139,15 +139,15 @@ void GfxFillRect(int left, int top, int right, int bottom, int color)
dst = dpi->dst_ptr + top * dpi->pitch + left;
if (!(color & 0x8000)) {
if (!(color & 0x4000)) {
if (!(color & PALETTE_MODIFIER_GREYOUT)) {
if (!(color & USE_COLORTABLE)) {
do {
memset(dst, color, right);
dst += dpi->pitch;
} while (--bottom);
} else {
/* use colortable mode */
const byte* ctab = GetNonSprite(color & 0x3FFF) + 1;
const byte* ctab = GetNonSprite(color & COLORTABLE_MASK) + 1;
do {
int i;
@@ -567,7 +567,7 @@ void DrawFrameRect(int left, int top, int right, int bottom, int ctab, int flags
}
} else if (flags & 0x1) {
// transparency
GfxFillRect(left, top, right, bottom, 0x4322);
GfxFillRect(left, top, right, bottom, 0x322 | USE_COLORTABLE);
} else {
GfxFillRect(left, top, right, bottom, color_interior);
}