145 } |
145 } |
146 } |
146 } |
147 } |
147 } |
148 } |
148 } |
149 |
149 |
150 static void ReadSprite(SpriteID id, byte *dest) |
150 static void ReadSprite(SpriteID id, void *buffer) |
151 { |
151 { |
152 uint num = _sprite_size[id]; |
152 uint num = _sprite_size[id]; |
153 byte type; |
153 byte type; |
|
154 byte* dest; |
154 |
155 |
155 FioSeekToFile(_sprite_file_pos[id]); |
156 FioSeekToFile(_sprite_file_pos[id]); |
156 |
157 |
157 type = FioReadByte(); |
158 type = FioReadByte(); |
158 /* We've decoded special sprites when reading headers. */ |
159 /* We've decoded special sprites when reading headers. */ |
159 if (type != 0xFF) { |
160 if (type != 0xFF) { |
160 /* read sprite hdr */ |
161 /* read sprite hdr */ |
161 Sprite* sprite = dest; |
162 Sprite* sprite = buffer; |
162 sprite->info = type; |
163 sprite->info = type; |
163 sprite->height = FioReadByte(); |
164 sprite->height = FioReadByte(); |
164 if (id == 142) sprite->height = 10; // Compensate for a TTD bug |
165 if (id == 142) sprite->height = 10; // Compensate for a TTD bug |
165 sprite->width = FioReadWord(); |
166 sprite->width = FioReadWord(); |
166 sprite->x_offs = FioReadWord(); |
167 sprite->x_offs = FioReadWord(); |
167 sprite->y_offs = FioReadWord(); |
168 sprite->y_offs = FioReadWord(); |
168 dest = sprite->data; |
169 dest = sprite->data; |
169 num -= 8; |
170 num -= 8; |
|
171 } else { |
|
172 dest = buffer; |
170 } |
173 } |
171 |
174 |
172 if (type & 2) { |
175 if (type & 2) { |
173 for (; num > 0; --num) |
176 for (; num > 0; --num) |
174 *dest++ = FioReadByte(); |
177 *dest++ = FioReadByte(); |