diff --git a/nml/actions/action1.py b/nml/actions/action1.py index 294d7f1d..46e09b4d 100644 --- a/nml/actions/action1.py +++ b/nml/actions/action1.py @@ -13,14 +13,7 @@ with NML; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.""" -from nml import generic -from nml.actions import base_action, real_sprite - -""" -Maximum number of sprites per block. -This can be increased by switching to extended Action1. -""" -max_sprite_block_size = 0xFF +from nml.actions import base_action, real_sprite, action2 class Action1(base_action.BaseAction): @@ -30,6 +23,9 @@ class Action1(base_action.BaseAction): @ivar feature: Feature of this action1 @type feature: C{int} + @ivar first_set: Number of the first sprite set in this action 1. + @type first_set: C{int} + @ivar num_sets: Number of (sprite) sets that follow this action 1. @type num_sets: C{int} @@ -37,20 +33,33 @@ class Action1(base_action.BaseAction): @type num_ent: C{int} """ - def __init__(self, feature, num_sets, num_ent): + def __init__(self, feature, first_set, num_sets, num_ent): self.feature = feature + self.first_set = first_set self.num_sets = num_sets self.num_ent = num_ent def write(self, file): - # * 01 - file.start_sprite(6) - file.print_bytex(1) - file.print_bytex(self.feature) - file.print_byte(self.num_sets) - file.print_varx(self.num_ent, 3) - file.newline() - file.end_sprite() + if self.first_set == 0 and self.num_sets < 256: + # * 01 + file.start_sprite(6) + file.print_bytex(1) + file.print_bytex(self.feature) + file.print_byte(self.num_sets) + file.print_varx(self.num_ent, 3) + file.newline() + file.end_sprite() + else: + # * 01 00 + file.start_sprite(12) + file.print_bytex(1) + file.print_bytex(self.feature) + file.print_bytex(0) + file.print_varx(self.first_set, 3) + file.print_varx(self.num_sets, 3) + file.print_varx(self.num_ent, 3) + file.newline() + file.end_sprite() class SpritesetCollection(base_action.BaseAction): @@ -61,6 +70,9 @@ class SpritesetCollection(base_action.BaseAction): @ivar feature: The feature number the action1 will get. @type feature: C{int} + @ivar first_set: Number of the first sprite set in this action 1. + @type first_set: C{int} + @ivar num_sprites_per_spriteset: The number of sprites in each spriteset. @type num_sprites_per_spriteset: C{int} @@ -71,10 +83,12 @@ class SpritesetCollection(base_action.BaseAction): @type spritesets: C{dict} mapping L{SpriteSet} to C{int}. """ - def __init__(self, feature, num_sprites_per_spriteset): + def __init__(self, feature, first_set, num_sprites_per_spriteset): self.feature = feature + self.first_set = first_set self.num_sprites_per_spriteset = num_sprites_per_spriteset self.spritesets = {} + self.max_id = 0x3FFF if feature in action2.features_sprite_layout else 0xFFFF def skip_action7(self): return False @@ -85,41 +99,33 @@ def skip_action9(self): def skip_needed(self): return False - def can_add(self, spritesets, feature): + def can_add(self, spriteset): """ Test whether the given list of spritesets can be added to this collection. - @param spritesets: The list of spritesets to test for addition. - @type spritesets: C{list} of L{SpriteSet} - - @param feature: The feature of the given spritesets. - @type feature: C{int} + @param spriteset: The spriteset to test for addition. + @type spriteset: L{SpriteSet} - @return: True iff the given spritesets can be added to this collection. + @return: True iff the given spriteset can be added to this collection. @rtype: C{bool} """ - assert len(spritesets) <= max_sprite_block_size - if feature != self.feature: + assert self.first_set + 1 <= self.max_id + if len(real_sprite.parse_sprite_data(spriteset)) != self.num_sprites_per_spriteset: return False - for spriteset in spritesets: - if len(real_sprite.parse_sprite_data(spriteset)) != self.num_sprites_per_spriteset: - return False - num_new_sets = sum(1 for x in spritesets if x not in self.spritesets) - return len(self.spritesets) + num_new_sets <= max_sprite_block_size + return self.first_set + len(self.spritesets) + (1 if spriteset not in self.spritesets else 0) <= self.max_id - def add(self, spritesets): + def add(self, spriteset): """ - Add a list of spritesets to this collection. + Add a spriteset to this collection. - @param spritesets: The list of spritesets to add. - @type spritesets: C{list} of L{SpriteSet} + @param spriteset: The spriteset to add. + @type spriteset: L{SpriteSet} - @pre: can_add(spritesets, self.feature). + @pre: can_add(spriteset). """ - assert self.can_add(spritesets, self.feature) - for spriteset in spritesets: - if spriteset not in self.spritesets: - self.spritesets[spriteset] = len(self.spritesets) + assert self.can_add(spriteset) + if spriteset not in self.spritesets: + self.spritesets[spriteset] = len(self.spritesets) def get_index(self, spriteset): """ @@ -132,7 +138,7 @@ def get_index(self, spriteset): collection via #add. """ assert spriteset in self.spritesets - return self.spritesets[spriteset] + return self.first_set + self.spritesets[spriteset] def get_action_list(self): """ @@ -142,7 +148,7 @@ def get_action_list(self): @return: A list of actions needed to represet this collection in a GRF. @rtype: C{list} of L{BaseAction} """ - actions = [Action1(self.feature, len(self.spritesets), self.num_sprites_per_spriteset)] + actions = [Action1(self.feature, self.first_set, len(self.spritesets), self.num_sprites_per_spriteset)] for idx in range(len(self.spritesets)): for spriteset, spriteset_offset in self.spritesets.items(): if idx == spriteset_offset: @@ -151,35 +157,13 @@ def get_action_list(self): return actions -""" -Statistics about spritesets. -The 1st field of type C{int} contains the largest block of consecutive spritesets. -The 2nd field of type L{Position} contains a positional reference to the largest block of consecutive spritesets. -""" -spriteset_stats = (0, None) - - -def print_stats(): - """ - Print statistics about used ids. - """ - if spriteset_stats[0] > 0: - # NML uses as many concurrent spritesets as possible to prevent sprite duplication. - # So, instead of the actual amount, we rather print the biggest unsplittable block, since that is what matters. - generic.print_info( - "Concurrent spritesets: {}/{} ({})".format( - spriteset_stats[0], max_sprite_block_size, str(spriteset_stats[1]) - ) - ) - - """ The collection which was previoulsy used. add_to_action1 will try to reuse this collection as long as possible to reduce the duplication of sprites. As soon as a spriteset with a different feature or amount of sprites is added a new collection will be created. """ -last_spriteset_collection = None +spriteset_collections = {} def add_to_action1(spritesets, feature, pos): @@ -202,29 +186,36 @@ def add_to_action1(spritesets, feature, pos): if not spritesets: return [] - setsize = len(real_sprite.parse_sprite_data(spritesets[0])) - for spriteset in spritesets: - if setsize != len(real_sprite.parse_sprite_data(spriteset)): - raise generic.ScriptError( - "Using spritesets with different sizes in a single sprite group / layout is not possible", pos - ) - - global spriteset_stats - if spriteset_stats[0] < len(spritesets): - spriteset_stats = (len(spritesets), pos) - - global last_spriteset_collection actions = [] - if last_spriteset_collection is None or not last_spriteset_collection.can_add(spritesets, feature): - last_spriteset_collection = SpritesetCollection(feature, len(real_sprite.parse_sprite_data(spritesets[0]))) - actions.append(last_spriteset_collection) - last_spriteset_collection.add(spritesets) + global spriteset_collections + if feature not in spriteset_collections: + spriteset_collections[feature] = [ + SpritesetCollection(feature, 0, len(real_sprite.parse_sprite_data(spritesets[0]))) + ] + actions.append(spriteset_collections[feature][-1]) + + current_collection = spriteset_collections[feature][-1] + for spriteset in spritesets: + for spriteset_collection in spriteset_collections[feature]: + if spriteset in spriteset_collection.spritesets: + continue + if not current_collection.can_add(spriteset): + spriteset_collections[feature].append( + SpritesetCollection( + feature, + current_collection.first_set + len(current_collection.spritesets), + len(real_sprite.parse_sprite_data(spriteset)), + ) + ) + current_collection = spriteset_collections[feature][-1] + actions.append(current_collection) + current_collection.add(spriteset) return actions -def get_action1_index(spriteset): +def get_action1_index(spriteset, feature): """ Get the index of a spriteset in the action1. The given spriteset must have been added in the last call to #add_to_action1. Any new calls to @@ -234,11 +225,17 @@ def get_action1_index(spriteset): @param spriteset: The spriteset to get the index of. @type spriteset: L{SpriteSet}. + @param feature: Feature of the spriteset. + @type feature: C{int} + @return: The index in the action1 of the given spriteset. @rtype: C{int} """ - assert last_spriteset_collection is not None - return last_spriteset_collection.get_index(spriteset) + assert feature in spriteset_collections + for spriteset_collection in spriteset_collections[feature]: + if spriteset in spriteset_collection.spritesets: + return spriteset_collection.get_index(spriteset) + assert False def make_cb_failure_action1(feature): @@ -253,10 +250,8 @@ def make_cb_failure_action1(feature): @return: List of actions to append (if any) and action1 index to use @rtype: C{tuple} of (C{list} of L{BaseAction}, C{int}) """ - global last_spriteset_collection - if last_spriteset_collection is not None and last_spriteset_collection.feature == feature: + if feature in spriteset_collections: actions = [] else: - last_spriteset_collection = None - actions = [Action1(feature, 1, 0)] + actions = [Action1(feature, 0, 1, 0)] return (actions, 0) # Index is currently always 0, but will change with ext. A1 diff --git a/nml/actions/action2layout.py b/nml/actions/action2layout.py index 33ec49f6..91518397 100644 --- a/nml/actions/action2layout.py +++ b/nml/actions/action2layout.py @@ -272,7 +272,7 @@ def resolve_spritegroup_ref(self, sg_ref): """ spriteset = action2.resolve_spritegroup(sg_ref.name) offset = self._validate_offset(sg_ref.param_list, spriteset, sg_ref.pos) - num = action1.get_action1_index(spriteset) + num = action1.get_action1_index(spriteset, self.feature) generic.check_range(num, 0, (1 << 14) - 1, "sprite", sg_ref.pos) return expression.ConstantNumeric(num), offset @@ -662,7 +662,7 @@ def append_mapping(self, mapping, feature, actions, default, custom_spritesets): feature, spriteset.name.value + " - feature {:02X}".format(feature), None, - action1.get_action1_index(spriteset), + action1.get_action1_index(spriteset, feature), ) actions.append(real_action2) spriteset.set_action2(real_action2, feature) diff --git a/nml/actions/action2real.py b/nml/actions/action2real.py index c1c8768e..52e2fe37 100644 --- a/nml/actions/action2real.py +++ b/nml/actions/action2real.py @@ -83,7 +83,7 @@ def get_real_action2s(spritegroup, feature): raise generic.ScriptError("Expected at least one sprite set, encountered 0.", view.pos) for set_ref in view.spriteset_list: spriteset = action2.resolve_spritegroup(set_ref.name) - action1_index = action1.get_action1_index(spriteset) + action1_index = action1.get_action1_index(spriteset, feature) if view.name.value == "loading": loading_list.append(action1_index) else: @@ -152,7 +152,7 @@ def create_spriteset_actions(spritegroup): feature, spriteset.name.value + " - feature {:02X}".format(feature), spritegroup.pos, - action1.get_action1_index(spriteset), + action1.get_action1_index(spriteset, feature), ) action_list.append(real_action2) spriteset.set_action2(real_action2, feature) diff --git a/nml/main.py b/nml/main.py index 8124eef6..393d46cf 100644 --- a/nml/main.py +++ b/nml/main.py @@ -598,7 +598,6 @@ def nml( action0.print_stats() actionF.print_stats() action7.print_stats() - action1.print_stats() action2.print_stats() action6.print_stats() grf.print_stats() diff --git a/regression/030_house.nml b/regression/030_house.nml index ea65250d..b5d1fb9b 100644 --- a/regression/030_house.nml +++ b/regression/030_house.nml @@ -36,9 +36,6 @@ spriteset(brewery_spriteset_ground) { tmpl_ground_tile( 10, 10, "groundtiles.png") //bare tmpl_ground_tile(150, 10, "groundtiles.png") //stones tmpl_ground_tile(220, 10, "groundtiles.png") //snowed - [] /* pad with empty sprites, as all spritesets have to have the same no. of sprites (=6) */ - [] - [] } spriteset(brewery_spriteset_building) { diff --git a/regression/expected/030_house.grf b/regression/expected/030_house.grf index 85e0bf88..4567b02b 100644 Binary files a/regression/expected/030_house.grf and b/regression/expected/030_house.grf differ diff --git a/regression/expected/030_house.nfo b/regression/expected/030_house.nfo index 0f89e0b7..7ea103cd 100644 --- a/regression/expected/030_house.nfo +++ b/regression/expected/030_house.nfo @@ -5,7 +5,7 @@ // Escapes: D= = DR D+ = DF D- = DC Du* = DM D* = DnF Du<< = DnC D<< = DO D& D| Du/ D/ Du% D% // Format: spritenum imagefile depth xpos ypos xsize ysize xrel yrel zoom flags -0 * 4 \d59 +0 * 4 \d57 1 * 54 14 "C" "INFO" "B" "VRSN" \w4 \dx00000000 @@ -21,32 +21,31 @@ 4 * 24 00 08 \b1 04 FF \wx0000 09 "PASS" "MAIL" "GRAI" "WHEA" -5 * 6 01 07 \b2 FF \wx0006 +5 * 6 01 07 \b1 FF \wx0003 6 groundtiles.png 8bpp 10 10 64 31 -31 0 normal 7 groundtiles.png 8bpp 150 10 64 31 -31 0 normal 8 groundtiles.png 8bpp 220 10 64 31 -31 0 normal -9 * 1 00 -10 * 1 00 -11 * 1 00 -12 brewery.png 8bpp 10 60 64 91 -31 -60 normal nocrop -13 brewery.png 8bpp 80 60 64 91 -31 -60 normal nocrop -14 brewery.png 8bpp 150 60 64 91 -31 -60 normal nocrop -15 brewery_snow.png 8bpp 10 60 64 91 -31 -60 normal nocrop -16 brewery_snow.png 8bpp 80 60 64 91 -31 -60 normal nocrop -17 brewery_snow.png 8bpp 150 60 64 91 -31 -60 normal nocrop +9 * 12 01 07 00 FF \wx0001 FF \wx0001 FF \wx0006 + +10 brewery.png 8bpp 10 60 64 91 -31 -60 normal nocrop +11 brewery.png 8bpp 80 60 64 91 -31 -60 normal nocrop +12 brewery.png 8bpp 150 60 64 91 -31 -60 normal nocrop +13 brewery_snow.png 8bpp 10 60 64 91 -31 -60 normal nocrop +14 brewery_snow.png 8bpp 80 60 64 91 -31 -60 normal nocrop +15 brewery_snow.png 8bpp 150 60 64 91 -31 -60 normal nocrop // Name: brewery_sprite_layout - feature 07 // building_sprite : register 8B // with_smoke : register 8C -18 * 49 02 07 FF \b67 \dx00000F8D \wx0000 +16 * 49 02 07 FF \b67 \dx00000F8D \wx0000 \dxC0000000 \wx0002 \b0 \b0 80 83 \dx80008001 \wx0003 \b0 \b0 \b0 \b16 \b16 \b48 86 84 \dx00000000 \wx0023 \b8 \b0 \b0 \b11 \b16 \b7 8A 87 88 // Name: brewery_sprite_layout@registers - feature 07 -19 * 362 02 07 FF 89 +17 * 362 02 07 FF 89 43 20 \dx000000FF \2cmp 1A 20 \dx00000004 \2& 1A 20 \dx00000001 @@ -98,7 +97,7 @@ \wx00FF // // Name: @return_action_0 -20 * 44 02 07 FE 89 +18 * 44 02 07 FE 89 1A 20 \dx00000002 \2sto 1A 20 \dx0000008B \2r 1A 20 \dx00000000 @@ -108,7 +107,7 @@ \wx00FF // brewery_sprite_layout // Name: @return_action_1 -21 * 44 02 07 FD 89 +19 * 44 02 07 FD 89 1A 20 \dx00000001 \2sto 1A 20 \dx0000008B \2r 1A 20 \dx00000000 @@ -118,7 +117,7 @@ \wx00FF // brewery_sprite_layout // Name: @return_action_2 -22 * 44 02 07 FC 89 +20 * 44 02 07 FC 89 1A 20 \dxFFFFFFFF \2sto 1A 20 \dx0000008B \2r 1A 20 \dx00000000 @@ -128,7 +127,7 @@ \wx00FF // brewery_sprite_layout // Name: @return_action_3 -23 * 44 02 07 FB 89 +21 * 44 02 07 FB 89 1A 20 \dx00000000 \2sto 1A 20 \dx0000008B \2r 1A 20 \dx00000001 @@ -138,7 +137,7 @@ \wx00FF // brewery_sprite_layout // Name: brewery_layout_1 -24 * 44 02 07 FB 89 +22 * 44 02 07 FB 89 7D FF 10 \dx000000FF \b3 \wx00FE \dx00000000 \dx00000000 // 0 .. 0: @return_action_0; @@ -147,7 +146,7 @@ \wx00FB // default: @return_action_3; // Name: @return_action_0 -25 * 44 02 07 FC 89 +23 * 44 02 07 FC 89 1A 20 \dxFFFFFFFF \2sto 1A 20 \dx0000008B \2r 1A 20 \dx00000000 @@ -157,7 +156,7 @@ \wx00FF // brewery_sprite_layout // Name: @return_action_1 -26 * 44 02 07 FD 89 +24 * 44 02 07 FD 89 1A 20 \dx00000000 \2sto 1A 20 \dx0000008B \2r 1A 20 \dx00000001 @@ -167,7 +166,7 @@ \wx00FF // brewery_sprite_layout // Name: @return_action_2 -27 * 44 02 07 FE 89 +25 * 44 02 07 FE 89 1A 20 \dx00000002 \2sto 1A 20 \dx0000008B \2r 1A 20 \dx00000000 @@ -177,7 +176,7 @@ \wx00FF // brewery_sprite_layout // Name: @return_action_3 -28 * 44 02 07 FF 89 +26 * 44 02 07 FF 89 1A 20 \dx00000001 \2sto 1A 20 \dx0000008B \2r 1A 20 \dx00000000 @@ -187,7 +186,7 @@ \wx00FF // brewery_sprite_layout // Name: brewery_layout_2 -29 * 44 02 07 FF 89 +27 * 44 02 07 FF 89 7D FF 10 \dx000000FF \b3 \wx00FC \dx00000000 \dx00000000 // 0 .. 0: @return_action_0; @@ -196,21 +195,21 @@ \wx00FF // default: @return_action_3; // Name: brewery_choose_layout -30 * 23 02 07 FF 89 +28 * 23 02 07 FF 89 5F 08 \dx00000001 \b1 \wx00FB \dx00000000 \dx00000000 // 0 .. 0: brewery_layout_1; \wx00FF // default: brewery_layout_2; // Name: brewery_next_frame -31 * 23 02 07 FB 89 +29 * 23 02 07 FB 89 46 00 \dx000000FF \b1 \wx80FF \dx00000000 \dx00000000 // 0 .. 0: return 255; \wx80FE // default: return 254; // Name: @return_action_0 -32 * 41 02 07 FE 89 +30 * 41 02 07 FE 89 46 20 \dx000000FF \2cmp 1A 20 \dx00000000 \2& 1A 20 \dx00000001 @@ -220,7 +219,7 @@ \wx8000 // Return computed value // Name: brewery_cargo_accepted -33 * 59 02 07 FE 89 +31 * 59 02 07 FE 89 5F 28 \dx00000001 \2u< 1A 20 \dx00000001 \2* 1A 20 \dxFFFFFFFF // expr1 - expr2 @@ -232,34 +231,34 @@ \wx80FD // default: return 253; // Name: brewery_check_location -34 * 23 02 07 FD 89 +32 * 23 02 07 FD 89 44 00 \dx000000FF \b1 \wx8001 \dx00000000 \dx00000000 // 0 .. 0: return 1; \wx8000 // default: return 0; // param[126] = 0 -35 * 9 0D 7E \D= FF 00 \dx00000000 +33 * 9 0D 7E \D= FF 00 \dx00000000 -36 * 9 09 00 04 \7c \dx49415247 01 +34 * 9 09 00 04 \7c \dx49415247 01 // param[126] = 1 -37 * 9 0D 7E \D= FF 00 \dx00000001 +35 * 9 0D 7E \D= FF 00 \dx00000001 // param[125] = 0 -38 * 9 0D 7D \D= FF 00 \dx00000000 +36 * 9 0D 7D \D= FF 00 \dx00000000 -39 * 9 09 00 04 \7c \dx41454857 01 +37 * 9 09 00 04 \7c \dx41454857 01 // param[125] = 1 -40 * 9 0D 7D \D= FF 00 \dx00000001 +38 * 9 0D 7D \D= FF 00 \dx00000001 // param[127] = (param[126] | param[125]) -41 * 5 0D 7F \D| 7E 7D +39 * 5 0D 7F \D| 7E 7D -42 * 9 07 7F 04 \7= \dx00000000 02 +40 * 9 07 7F 04 \7= \dx00000000 02 -43 * 183 00 07 \b20 04 FF \wx0000 +41 * 183 00 07 \b20 04 FF \wx0000 08 28 29 2A 2B 12 \wxDC00 \wxDC00 \wxDC00 \wxDC00 09 30 20 20 20 @@ -295,11 +294,11 @@ \b2 02 03 -44 * 9 00 07 \b1 01 FF \wx0000 +42 * 9 00 07 \b1 01 FF \wx0000 14 03 // Name: @action3_0 -45 * 57 02 07 FD 89 +43 * 57 02 07 FD 89 1A 20 \dx00000000 \2sto 1A 20 \dx000000FF \2r 0C 00 \dx0000FFFF @@ -309,16 +308,16 @@ \wx00FE \dx00000148 \dx00000148 // brewery_cargo_accepted; \wx00FF // brewery_choose_layout; -46 * 9 07 7F 04 \7= \dx00000000 02 +44 * 9 07 7F 04 \7= \dx00000000 02 -47 * 7 03 07 01 00 \b0 +45 * 7 03 07 01 00 \b0 \wx00FD // @action3_0; -48 * 9 00 07 \b1 01 FF \wx0001 +46 * 9 00 07 \b1 01 FF \wx0001 14 02 // Name: @action3_1 -49 * 47 02 07 FD 89 +47 * 47 02 07 FD 89 1A 20 \dx00010100 \2sto 1A 20 \dx000000FF \2r 0C 00 \dx0000FFFF @@ -327,16 +326,16 @@ \wx00FE \dx00000148 \dx00000148 // brewery_cargo_accepted; \wx00FF // brewery_choose_layout; -50 * 9 07 7F 04 \7= \dx00000000 02 +48 * 9 07 7F 04 \7= \dx00000000 02 -51 * 7 03 07 01 01 \b0 +49 * 7 03 07 01 01 \b0 \wx00FD // @action3_1; -52 * 9 00 07 \b1 01 FF \wx0002 +50 * 9 00 07 \b1 01 FF \wx0002 14 02 // Name: @action3_2 -53 * 47 02 07 FD 89 +51 * 47 02 07 FD 89 1A 20 \dx00020001 \2sto 1A 20 \dx000000FF \2r 0C 00 \dx0000FFFF @@ -345,16 +344,16 @@ \wx00FE \dx00000148 \dx00000148 // brewery_cargo_accepted; \wx00FF // brewery_choose_layout; -54 * 9 07 7F 04 \7= \dx00000000 02 +52 * 9 07 7F 04 \7= \dx00000000 02 -55 * 7 03 07 01 02 \b0 +53 * 7 03 07 01 02 \b0 \wx00FD // @action3_2; -56 * 9 00 07 \b1 01 FF \wx0003 +54 * 9 00 07 \b1 01 FF \wx0003 14 02 // Name: @action3_3 -57 * 47 02 07 FF 89 +55 * 47 02 07 FF 89 1A 20 \dx00030101 \2sto 1A 20 \dx000000FF \2r 0C 00 \dx0000FFFF @@ -363,8 +362,8 @@ \wx00FE \dx00000148 \dx00000148 // brewery_cargo_accepted; \wx00FF // brewery_choose_layout; -58 * 9 07 7F 04 \7= \dx00000000 01 +56 * 9 07 7F 04 \7= \dx00000000 01 -59 * 7 03 07 01 03 \b0 +57 * 7 03 07 01 03 \b0 \wx00FF // @action3_3; diff --git a/regression/expected/example_railtype.grf b/regression/expected/example_railtype.grf index cc5dfa83..99139dd2 100644 Binary files a/regression/expected/example_railtype.grf and b/regression/expected/example_railtype.grf differ diff --git a/regression/expected/example_railtype.nfo b/regression/expected/example_railtype.nfo index ad7c7475..7f1d21fb 100644 --- a/regression/expected/example_railtype.nfo +++ b/regression/expected/example_railtype.nfo @@ -144,7 +144,7 @@ \w4 -71 * 6 01 10 \b1 FF \wx0010 +71 * 12 01 10 00 FF \wx0005 FF \wx0001 FF \wx0010 72 gfx/rails_overlays.png 8bpp 75 0 64 31 -31 0 normal 73 gfx/rails_overlays.png 8bpp 0 0 64 31 -31 0 normal @@ -165,10 +165,10 @@ // Name: track_underlays - feature 10 88 * 7 02 10 FF \b1 \b0 -\w0 +\w5 -89 * 6 01 10 \b1 FF \wx0004 +89 * 12 01 10 00 FF \wx0006 FF \wx0001 FF \wx0004 90 gfx/tunnel_track.png 8bpp 75 0 64 31 -31 0 normal 91 gfx/tunnel_track.png 8bpp 0 0 64 31 -31 0 normal @@ -177,10 +177,10 @@ // Name: tunnel_overlays - feature 10 94 * 7 02 10 FC \b1 \b0 -\w0 +\w6 -95 * 6 01 10 \b1 FF \wx0006 +95 * 12 01 10 00 FF \wx0007 FF \wx0001 FF \wx0006 96 gfx/depot_normal.png 8bpp 200 10 16 8 17 7 normal 97 gfx/depot_normal.png 8bpp 118 8 64 47 -9 -31 normal @@ -191,10 +191,10 @@ // Name: depot_normal_rail - feature 10 102 * 7 02 10 FB \b1 \b0 -\w0 +\w7 -103 * 6 01 10 \b1 FF \wx000A +103 * 12 01 10 00 FF \wx0008 FF \wx0001 FF \wx000A 104 gfx/rails_overlays.png 8bpp 75 0 64 31 -31 0 normal 105 gfx/rails_overlays.png 8bpp 0 0 64 31 -31 0 normal @@ -209,10 +209,10 @@ // Name: bridge_underlay - feature 10 114 * 7 02 10 FA \b1 \b0 -\w0 +\w8 -115 * 6 01 10 \b1 FF \wx0008 +115 * 12 01 10 00 FF \wx0009 FF \wx0001 FF \wx0008 116 gfx/fences.png 8bpp 0 0 32 20 -30 -4 normal 117 gfx/fences.png 8bpp 48 0 32 20 0 -3 normal @@ -225,10 +225,10 @@ // Name: fencesCC - feature 10 124 * 7 02 10 F9 \b1 \b0 -\w0 +\w9 -125 * 6 01 10 \b1 FF \wx0010 +125 * 12 01 10 00 FF \wx000A FF \wx0001 FF \wx0010 126 gfx/gui_rail.png 8bpp 0 0 20 20 0 0 normal 127 gfx/gui_rail.png 8bpp 25 0 20 20 0 0 normal @@ -249,7 +249,7 @@ // Name: gui_normal - feature 10 142 * 7 02 10 F8 \b1 \b0 -\w0 +\w10 143 * 31 03 10 01 00 \b8 @@ -268,7 +268,7 @@ 0E \b17 "RAIL" "ELRL" "_040" "_080" "RLOW" "RMED" "RHIG" "E040" "E080" "ELOW" "EMED" "EHIG" "HSTR" "DBNN" "DBNE" "DBHN" "DBHE" 0F \b9 "ELRL" "E040" "E080" "ELOW" "EMED" "EHIG" "HSTR" "DBNE" "DBHE" -145 * 6 01 10 \b1 FF \wx0006 +145 * 12 01 10 00 FF \wx000B FF \wx0001 FF \wx0006 146 gfx/depot_electric.png 8bpp 200 10 16 8 17 7 normal 147 gfx/depot_electric.png 8bpp 118 8 64 47 -9 -31 normal @@ -279,10 +279,10 @@ // Name: depot_electric_rail - feature 10 152 * 7 02 10 FB \b1 \b0 -\w0 +\w11 -153 * 6 01 10 \b1 FF \wx0010 +153 * 12 01 10 00 FF \wx000C FF \wx0001 FF \wx0010 154 gfx/gui_erail.png 8bpp 0 0 20 20 0 0 normal 155 gfx/gui_erail.png 8bpp 25 0 20 20 0 0 normal @@ -303,7 +303,7 @@ // Name: gui_electric - feature 10 170 * 7 02 10 F8 \b1 \b0 -\w0 +\w12 171 * 31 03 10 01 01 \b8 diff --git a/regression/expected/example_roadtype_and_tramtype.grf b/regression/expected/example_roadtype_and_tramtype.grf index 0456aa6a..853d7800 100644 Binary files a/regression/expected/example_roadtype_and_tramtype.grf and b/regression/expected/example_roadtype_and_tramtype.grf differ diff --git a/regression/expected/example_roadtype_and_tramtype.nfo b/regression/expected/example_roadtype_and_tramtype.nfo index 14bbc84a..c4ab8d80 100644 --- a/regression/expected/example_roadtype_and_tramtype.nfo +++ b/regression/expected/example_roadtype_and_tramtype.nfo @@ -84,7 +84,7 @@ \w1 -47 * 6 01 12 \b1 FF \wx0006 +47 * 12 01 12 00 FF \wx0002 FF \wx0001 FF \wx0006 48 gfx/depot_normal.png 8bpp 200 10 16 8 17 11 normal 49 gfx/depot_normal.png 8bpp 118 8 64 47 -1 -31 normal @@ -95,10 +95,10 @@ // Name: depot_normal_road - feature 12 54 * 7 02 12 FD \b1 \b0 -\w0 +\w2 -55 * 6 01 12 \b1 FF \wx000B +55 * 12 01 12 00 FF \wx0003 FF \wx0001 FF \wx000B 56 gfx/roads_red.png 8bpp 0 0 64 31 -31 0 normal 57 gfx/roads_red.png 8bpp 75 0 64 31 -31 0 normal @@ -114,10 +114,10 @@ // Name: bridge_underlay - feature 12 67 * 7 02 12 FC \b1 \b0 -\w0 +\w3 -68 * 6 01 12 \b1 FF \wx0004 +68 * 12 01 12 00 FF \wx0004 FF \wx0001 FF \wx0004 69 gfx/roads_red.png 8bpp 0 120 64 31 -31 0 normal 70 gfx/roads_red.png 8bpp 75 120 64 31 -31 0 normal @@ -126,10 +126,10 @@ // Name: roadstop_underlay_red - feature 12 73 * 7 02 12 FB \b1 \b0 -\w0 +\w4 -74 * 6 01 12 \b1 FF \wx0012 +74 * 12 01 12 00 FF \wx0005 FF \wx0001 FF \wx0012 75 gfx/direction_markings.png 8bpp 34 8 24 16 -10 -9 normal 76 gfx/direction_markings.png 8bpp 66 8 24 16 -13 -7 normal @@ -152,7 +152,7 @@ // Name: st_direction_markings - feature 12 93 * 7 02 12 FA \b1 \b0 -\w0 +\w5 94 * 25 03 12 01 05 \b6 @@ -176,7 +176,7 @@ 10 00 1A 63 -96 * 6 01 12 \b1 FF \wx0013 +96 * 12 01 12 00 FF \wx0006 FF \wx0001 FF \wx0013 97 gfx/roads_blue.png 8bpp 0 0 64 31 -31 0 normal 98 gfx/roads_blue.png 8bpp 75 0 64 31 -31 0 normal @@ -200,10 +200,10 @@ // Name: road_overlays_blue - feature 12 116 * 7 02 12 FB \b1 \b0 -\w0 +\w6 -117 * 6 01 12 \b1 FF \wx0004 +117 * 12 01 12 00 FF \wx0007 FF \wx0001 FF \wx0004 118 gfx/roads_blue.png 8bpp 0 120 64 31 -31 0 normal 119 gfx/roads_blue.png 8bpp 75 120 64 31 -31 0 normal @@ -212,7 +212,7 @@ // Name: roadstop_underlay_blue - feature 12 122 * 7 02 12 FF \b1 \b0 -\w0 +\w7 123 * 25 03 12 01 06 \b6 @@ -236,7 +236,7 @@ 10 00 1A 64 -125 * 6 01 12 \b1 FF \wx0013 +125 * 12 01 12 00 FF \wx0008 FF \wx0001 FF \wx0013 126 gfx/roads_yellow.png 8bpp 0 0 64 31 -31 0 normal 127 gfx/roads_yellow.png 8bpp 75 0 64 31 -31 0 normal @@ -260,10 +260,10 @@ // Name: road_overlays_yellow - feature 12 145 * 7 02 12 FF \b1 \b0 -\w0 +\w8 -146 * 6 01 12 \b1 FF \wx0004 +146 * 12 01 12 00 FF \wx0009 FF \wx0001 FF \wx0004 147 gfx/roads_yellow.png 8bpp 0 120 64 31 -31 0 normal 148 gfx/roads_yellow.png 8bpp 75 120 64 31 -31 0 normal @@ -272,7 +272,7 @@ // Name: roadstop_underlay_yellow - feature 12 151 * 7 02 12 FB \b1 \b0 -\w0 +\w9 152 * 25 03 12 01 07 \b6 @@ -347,7 +347,7 @@ \w1 -195 * 6 01 13 \b1 FF \wx0006 +195 * 12 01 13 00 FF \wx0002 FF \wx0001 FF \wx0006 196 gfx/depot_normal.png 8bpp 200 10 16 8 17 11 normal 197 gfx/depot_normal.png 8bpp 118 8 64 47 -1 -31 normal @@ -358,10 +358,10 @@ // Name: depot_normal_road - feature 13 202 * 7 02 13 FD \b1 \b0 -\w0 +\w2 -203 * 6 01 13 \b1 FF \wx000B +203 * 12 01 13 00 FF \wx0003 FF \wx0001 FF \wx000B 204 gfx/roads_red.png 8bpp 0 0 64 31 -31 0 normal 205 gfx/roads_red.png 8bpp 75 0 64 31 -31 0 normal @@ -377,7 +377,7 @@ // Name: bridge_underlay - feature 13 215 * 7 02 13 FC \b1 \b0 -\w0 +\w3 216 * 19 03 13 01 09 \b4 diff --git a/regression/expected/example_train.grf b/regression/expected/example_train.grf index 00b39524..d94558e7 100644 Binary files a/regression/expected/example_train.grf and b/regression/expected/example_train.grf differ diff --git a/regression/expected/example_train.nfo b/regression/expected/example_train.nfo index a9f22c1c..5c36b02a 100644 --- a/regression/expected/example_train.nfo +++ b/regression/expected/example_train.nfo @@ -116,16 +116,16 @@ \wx00FF \dx00000000 \dx00000000 // 0 .. 0: set_icm_rear_lighted; \wx00FD // default: set_icm_rear; -45 * 6 01 00 \b1 FF \wx0001 +45 * 12 01 00 00 FF \wx0004 FF \wx0001 FF \wx0001 46 icm.png 8bpp 1 193 1 1 0 0 normal // Name: set_icm_invisible - feature 00 47 * 9 02 00 FF \b1 \b1 -\w0 -\w0 +\w4 +\w4 -48 * 6 01 00 \b1 FF \wx0004 +48 * 12 01 00 00 FF \wx0005 FF \wx0001 FF \wx0004 49 icm.png 8bpp 1 129 8 24 -3 -12 normal 50 icm.png 8bpp 10 129 22 20 -14 -12 normal @@ -134,8 +134,8 @@ // Name: set_icm_middle - feature 00 53 * 9 02 00 FC \b1 \b1 -\w0 -\w0 +\w5 +\w5 // Name: sw_icm_graphics_middle 54 * 81 02 00 FC 89 @@ -338,14 +338,14 @@ F2 00 \dx000000FF 83 * 35 04 00 1F 01 FF \wx0074 "ICM 'Koploper' (Electrisch)" 00 -84 * 6 01 00 \b1 FF \wx0001 +84 * 12 01 00 00 FF \wx0006 FF \wx0001 FF \wx0001 85 icm.png 8bpp 1 161 53 14 -25 -10 normal // Name: set_icm_purchase - feature 00 86 * 9 02 00 F4 \b1 \b1 -\w0 -\w0 +\w6 +\w6 87 * 9 00 00 \b1 01 FF \wx0074 1E 79 @@ -466,7 +466,7 @@ FF \wx00FD // @action3_4; 103 * 10 00 00 \b1 01 FF \wx0074 2B \wx00B9 -104 * 6 01 00 \b2 FF \wx0004 +104 * 12 01 00 00 FF \wx0007 FF \wx0002 FF \wx0004 105 cargo_wagons.png 8bpp 1 1 8 24 -3 -12 normal 106 cargo_wagons.png 8bpp 10 1 22 20 -14 -12 normal @@ -480,8 +480,8 @@ FF \wx00FD // @action3_4; // Name: set_cargo_wagon - feature 00 113 * 9 02 00 F1 \b1 \b1 -\w0 -\w0 +\w7 +\w7 // Name: cargo_wagon_switch_vehicle 114 * 30 02 00 F1 89 @@ -493,8 +493,8 @@ FF \wx00FD // @action3_4; // Name: set_cargo_wagon_load - feature 00 115 * 9 02 00 FD \b1 \b1 -\w1 -\w1 +\w8 +\w8 // Name: cargo_wagon_switch_load 116 * 30 02 00 FD 89