Mercurial > hg > openttd
changeset 2895:ed5ede8a9721 draft
(svn r3449) - NewGRF Fix: When changing the sprite ID of a vehicle, if it is not FD (custom graphics), the value needs to changed from a 16bit array offset to an array index. (fixes tropicstw.grf)
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Fri, 27 Jan 2006 07:13:58 +0000 |
parents | dbb8b26c7c8d |
children | b48bd60b231d |
files | newgrf.c |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/newgrf.c +++ b/newgrf.c @@ -272,6 +272,11 @@ FOR_EACH_OBJECT { uint8 spriteid = grf_load_byte(&buf); + /* TTD sprite IDs point to a location in a 16bit array, but we use it + * as an array index, so we need it to be half the original value. */ + if (spriteid < 0xFD) + spriteid >>= 1; + rvi[i].image_index = spriteid; } } break; @@ -481,6 +486,9 @@ if (spriteid == 0xFF) spriteid = 0xFD; // cars have different custom id in the GRF file + if (spriteid < 0xFD) + spriteid >>= 1; + rvi[i].image_index = spriteid; } } break; @@ -582,6 +590,9 @@ if (spriteid == 0xFF) spriteid = 0xFD; // ships have different custom id in the GRF file + if (spriteid < 0xFD) + spriteid >>= 1; + svi[i].image_index = spriteid; } } break; @@ -699,6 +710,9 @@ if (spriteid == 0xFF) spriteid = 0xFD; // ships have different custom id in the GRF file + if (spriteid < 0xFD) + spriteid >>= 1; + avi[i].image_index = spriteid; } } break;