927 for (uint t = 0; t < statspec->tiles; t++) { |
927 for (uint t = 0; t < statspec->tiles; t++) { |
928 DrawTileSprites *dts = &statspec->renderdata[t]; |
928 DrawTileSprites *dts = &statspec->renderdata[t]; |
929 uint seq_count = 0; |
929 uint seq_count = 0; |
930 |
930 |
931 dts->seq = NULL; |
931 dts->seq = NULL; |
932 dts->ground_sprite = grf_load_word(&buf); |
932 dts->ground.sprite = grf_load_word(&buf); |
933 dts->ground_pal = grf_load_word(&buf); |
933 dts->ground.pal = grf_load_word(&buf); |
934 if (dts->ground_sprite == 0) continue; |
934 if (dts->ground.sprite == 0) continue; |
935 if (HasBit(dts->ground_pal, 15)) { |
935 if (HasBit(dts->ground.pal, 15)) { |
936 ClrBit(dts->ground_pal, 15); |
936 ClrBit(dts->ground.pal, 15); |
937 SetBit(dts->ground_sprite, SPRITE_MODIFIER_USE_OFFSET); |
937 SetBit(dts->ground.sprite, SPRITE_MODIFIER_USE_OFFSET); |
938 } |
938 } |
939 if (HasBit(dts->ground_pal, 14)) { |
939 if (HasBit(dts->ground.pal, 14)) { |
940 ClrBit(dts->ground_pal, 14); |
940 ClrBit(dts->ground.pal, 14); |
941 SetBit(dts->ground_sprite, SPRITE_MODIFIER_OPAQUE); |
941 SetBit(dts->ground.sprite, SPRITE_MODIFIER_OPAQUE); |
942 } |
942 } |
943 if (HasBit(dts->ground_sprite, 15)) { |
943 if (HasBit(dts->ground.sprite, 15)) { |
944 ClrBit(dts->ground_sprite, 15); |
944 ClrBit(dts->ground.sprite, 15); |
945 SetBit(dts->ground_sprite, PALETTE_MODIFIER_COLOR); |
945 SetBit(dts->ground.sprite, PALETTE_MODIFIER_COLOR); |
946 } |
946 } |
947 if (HasBit(dts->ground_sprite, 14)) { |
947 if (HasBit(dts->ground.sprite, 14)) { |
948 ClrBit(dts->ground_sprite, 14); |
948 ClrBit(dts->ground.sprite, 14); |
949 SetBit(dts->ground_sprite, PALETTE_MODIFIER_TRANSPARENT); |
949 SetBit(dts->ground.sprite, PALETTE_MODIFIER_TRANSPARENT); |
950 } |
950 } |
951 |
951 |
952 while (buf < *bufp + len) { |
952 while (buf < *bufp + len) { |
953 DrawTileSeqStruct *dtss; |
953 DrawTileSeqStruct *dtss; |
954 |
954 |
2650 group->type = SGT_TILELAYOUT; |
2650 group->type = SGT_TILELAYOUT; |
2651 group->g.layout.num_sprites = sprites; |
2651 group->g.layout.num_sprites = sprites; |
2652 group->g.layout.dts = CallocT<DrawTileSprites>(1); |
2652 group->g.layout.dts = CallocT<DrawTileSprites>(1); |
2653 |
2653 |
2654 /* Groundsprite */ |
2654 /* Groundsprite */ |
2655 group->g.layout.dts->ground_sprite = grf_load_word(&buf); |
2655 group->g.layout.dts->ground.sprite = grf_load_word(&buf); |
2656 group->g.layout.dts->ground_pal = grf_load_word(&buf); |
2656 group->g.layout.dts->ground.pal = grf_load_word(&buf); |
2657 /* Remap transparent/colour modifier bits */ |
2657 /* Remap transparent/colour modifier bits */ |
2658 if (HasBit(group->g.layout.dts->ground_sprite, 14)) { |
2658 if (HasBit(group->g.layout.dts->ground.sprite, 14)) { |
2659 ClrBit(group->g.layout.dts->ground_sprite, 14); |
2659 ClrBit(group->g.layout.dts->ground.sprite, 14); |
2660 SetBit(group->g.layout.dts->ground_sprite, PALETTE_MODIFIER_TRANSPARENT); |
2660 SetBit(group->g.layout.dts->ground.sprite, PALETTE_MODIFIER_TRANSPARENT); |
2661 } |
2661 } |
2662 if (HasBit(group->g.layout.dts->ground_sprite, 15)) { |
2662 if (HasBit(group->g.layout.dts->ground.sprite, 15)) { |
2663 ClrBit(group->g.layout.dts->ground_sprite, 15); |
2663 ClrBit(group->g.layout.dts->ground.sprite, 15); |
2664 SetBit(group->g.layout.dts->ground_sprite, PALETTE_MODIFIER_COLOR); |
2664 SetBit(group->g.layout.dts->ground.sprite, PALETTE_MODIFIER_COLOR); |
2665 } |
2665 } |
2666 if (HasBit(group->g.layout.dts->ground_pal, 14)) { |
2666 if (HasBit(group->g.layout.dts->ground.pal, 14)) { |
2667 ClrBit(group->g.layout.dts->ground_pal, 14); |
2667 ClrBit(group->g.layout.dts->ground.pal, 14); |
2668 SetBit(group->g.layout.dts->ground_sprite, SPRITE_MODIFIER_OPAQUE); |
2668 SetBit(group->g.layout.dts->ground.sprite, SPRITE_MODIFIER_OPAQUE); |
2669 } |
2669 } |
2670 if (HasBit(group->g.layout.dts->ground_pal, 15)) { |
2670 if (HasBit(group->g.layout.dts->ground.pal, 15)) { |
2671 /* Bit 31 set means this is a custom sprite, so rewrite it to the |
2671 /* Bit 31 set means this is a custom sprite, so rewrite it to the |
2672 * last spriteset defined. */ |
2672 * last spriteset defined. */ |
2673 SpriteID sprite = _cur_grffile->spriteset_start + GB(group->g.layout.dts->ground_sprite, 0, 14) * sprites; |
2673 SpriteID sprite = _cur_grffile->spriteset_start + GB(group->g.layout.dts->ground.sprite, 0, 14) * sprites; |
2674 SB(group->g.layout.dts->ground_sprite, 0, SPRITE_WIDTH, sprite); |
2674 SB(group->g.layout.dts->ground.sprite, 0, SPRITE_WIDTH, sprite); |
2675 ClrBit(group->g.layout.dts->ground_pal, 15); |
2675 ClrBit(group->g.layout.dts->ground.pal, 15); |
2676 } |
2676 } |
2677 |
2677 |
2678 group->g.layout.dts->seq = CallocT<DrawTileSeqStruct>(num_sprites + 1); |
2678 group->g.layout.dts->seq = CallocT<DrawTileSeqStruct>(num_sprites + 1); |
2679 |
2679 |
2680 for (i = 0; i < num_sprites; i++) { |
2680 for (i = 0; i < num_sprites; i++) { |