summaryrefslogtreecommitdiff
path: root/gfx.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-02-10 12:14:38 +0000
committertron <tron@openttd.org>2005-02-10 12:14:38 +0000
commit94c75f33bb896b32866fd062242067d773b0f7b1 (patch)
treeb487a5d141332ab7f42372d6735d5951cc75524e /gfx.c
parent2a151d93546db1d867a7cc0691a5c0e5973a4b98 (diff)
downloadopenttd-94c75f33bb896b32866fd062242067d773b0f7b1.tar.xz
(svn r1854) Split GetSpritePtr() into GetSprite() for regular sprites (returning a Sprite*) and GetNonSprite() for "sprites" of type 0xFF (returning byte*)
Diffstat (limited to 'gfx.c')
-rw-r--r--gfx.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/gfx.c b/gfx.c
index a4c2d21f6..48614f97f 100644
--- a/gfx.c
+++ b/gfx.c
@@ -144,7 +144,7 @@ void GfxFillRect(int left, int top, int right, int bottom, int color) {
} while (--bottom);
} else {
/* use colortable mode */
- ctab = GetSpritePtr(color & 0x3FFF) + 1;
+ ctab = GetNonSprite(color & 0x3FFF) + 1;
do {
int i;
for(i=0; i!=right;i++)
@@ -528,7 +528,7 @@ skip_cont:;
if (c >= ASCII_LETTERSTART) {
if (x >= dpi->left + dpi->width) goto skip_char;
if (x + 26 >= dpi->left) {
- GfxMainBlitter(GetSpritePtr(base + 2 + c - ASCII_LETTERSTART), x, y, 1);
+ GfxMainBlitter(GetSprite(base + 2 + c - ASCII_LETTERSTART), x, y, 1);
}
x += _stringwidth_table[base + c - ' '];
} else if (c == ASCII_NL) { // newline = {}
@@ -560,13 +560,13 @@ skip_cont:;
void DrawSprite(uint32 img, int x, int y) {
if (img & 0x8000) {
- _color_remap_ptr = GetSpritePtr(img >> 16) + 1;
- GfxMainBlitter(GetSpritePtr(img & 0x3FFF), x, y, 1);
+ _color_remap_ptr = GetNonSprite(img >> 16) + 1;
+ GfxMainBlitter(GetSprite(img & 0x3FFF), x, y, 1);
} else if (img & 0x4000) {
- _color_remap_ptr = GetSpritePtr(img >> 16) + 1;
- GfxMainBlitter(GetSpritePtr(img & 0x3FFF), x, y, 2);
+ _color_remap_ptr = GetNonSprite(img >> 16) + 1;
+ GfxMainBlitter(GetSprite(img & 0x3FFF), x, y, 2);
} else {
- GfxMainBlitter(GetSpritePtr(img & 0x3FFF), x, y, 0);
+ GfxMainBlitter(GetSprite(img & 0x3FFF), x, y, 0);
}
}
@@ -1628,15 +1628,15 @@ void LoadStringWidthTable(void)
// 2 equals space.
for(i=2; i != 0xE2; i++) {
- *b++ = (byte)((i < 93 || i >= 129 || i == 98) ? GetSpritePtr(i)[2] : 0);
+ *b++ = (byte)((i < 93 || i >= 129 || i == 98) ? TO_LE16(GetSprite(i)->width) : 0);
}
for(i=0xE2; i != 0x1C2; i++) {
- *b++ = (byte)((i < 317 || i >= 353) ? GetSpritePtr(i)[2]+1 : 0);
+ *b++ = (byte)((i < 317 || i >= 353) ? TO_LE16(GetSprite(i)->width) + 1 : 0);
}
for(i=0x1C2; i != 0x2A2; i++) {
- *b++ = (byte)((i < 541 || i >= 577) ? GetSpritePtr(i)[2]+1 : 0);
+ *b++ = (byte)((i < 541 || i >= 577) ? TO_LE16(GetSprite(i)->width) + 1 : 0);
}
}
@@ -1911,7 +1911,7 @@ static void SetCursorSprite(uint cursor)
if (cv->sprite == cursor)
return;
- p = GetSpritePtr(cursor & 0x3FFF);
+ p = GetSprite(cursor & 0x3FFF);
cv->sprite = cursor;
cv->size.y = p->height;
cv->size.x = TO_LE16(p->width);