diff options
author | darkvater <darkvater@openttd.org> | 2004-11-12 18:47:19 +0000 |
---|---|---|
committer | darkvater <darkvater@openttd.org> | 2004-11-12 18:47:19 +0000 |
commit | 16f8a7b2d2e51b5f1ee1203f56dfef5d2e912941 (patch) | |
tree | 95c8706f94d7cda5ca73dc010db3710ef3b131ab /grfspecial.c | |
parent | a2869639b2a4d9a2362488c8d7ecb0ecdc209b71 (diff) | |
download | openttd-16f8a7b2d2e51b5f1ee1203f56dfef5d2e912941.tar.xz |
(svn r549) -newgrf: Support for action 0xd (change a parameter (sorta variable for the GRF scripts)). Based on patch by octo, heavy changes by pasky.
Diffstat (limited to 'grfspecial.c')
-rw-r--r-- | grfspecial.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/grfspecial.c b/grfspecial.c index 23be73481..1f00d052e 100644 --- a/grfspecial.c +++ b/grfspecial.c @@ -17,6 +17,8 @@ * served as subject to the initial testing of this codec. */ extern int _skip_sprites; +extern int _replace_sprites_count[16]; +extern int _replace_sprites_offset[16]; static const char *_cur_grffile; static int _cur_spriteid; @@ -927,7 +929,6 @@ static void SkipIf(byte *buf, int len) numsprites = grf_load_byte(&buf); grfmsg(GMS_NOTICE, "Skipping %d sprites, test was true.", numsprites); - _skip_sprites = numsprites; if (_skip_sprites == 0) { /* Zero means there are no sprites to skip, so @@ -969,7 +970,30 @@ static void SpriteReplace(byte *buf, int len) * Each set: * B num-sprites How many sprites are in this set * W first-sprite First sprite number to replace */ - /* TODO */ + uint8 num_sets; + int i; + + buf++; /* skip action byte */ + num_sets = grf_load_byte(&buf); + + if (num_sets > 16) { + grfmsg(GMS_ERROR, "SpriteReplace: Too many sets (%d), taking only the first 16!", num_sets); + } + + for (i = 0; i < 16; i++) { + if (i < num_sets) { + uint8 num_sprites = grf_load_byte(&buf); + uint16 first_sprite = grf_load_word(&buf); + + _replace_sprites_count[i] = num_sprites; + _replace_sprites_offset[i] = first_sprite; + grfmsg(GMS_NOTICE, "SpriteReplace: [Set %d] Changing %d sprites, beginning with %d", + i, num_sprites, first_sprite); + } else { + _replace_sprites_count[i] = 0; + _replace_sprites_offset[i] = 0; + } + } } static void GRFError(byte *buf, int len) |