Skip to content

Commit

Permalink
Cleanup: burn tabs into spaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
frosch123 committed Aug 30, 2022
1 parent 5c39c6c commit 5707c06
Show file tree
Hide file tree
Showing 13 changed files with 266 additions and 269 deletions.
2 changes: 1 addition & 1 deletion examples/industry/example_industry.nml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ grf {

/* this example assumes we're just matching to the default temperate cargos, this wouldn't be the usual case */
cargotable {
PASS, COAL, MAIL, OIL_, LVST, GOOD, GRAI, WOOD, IORE, STEL, VALU
PASS, COAL, MAIL, OIL_, LVST, GOOD, GRAI, WOOD, IORE, STEL, VALU
}

/*
Expand Down
136 changes: 68 additions & 68 deletions examples/object/example_object.nml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ grf {
/* This grf is part of NML, therefore "NML" is chosen as the first three
* characters of the GRFID. It is the second real grf defined as part of
* NML (the first is the train example), therefore the last character is
* set to 1. Successive grfs will have 2, 3, etc. there, to make sure each
* example grf has a unique GRFID.
* set to 1. Successive grfs will have 2, 3, etc. there, to make sure each
* example grf has a unique GRFID.
*/
grfid: "NML\01";
/* GRF name and description strings are defined in the lang files */
Expand All @@ -31,16 +31,16 @@ grf {
/* This is the first version, start numbering at 1. */
version: 1;
min_compatible_version: 1;
/* This NewGRF has no parameters. See the train example NewGRF for parameter
* usage
*/
/* This NewGRF has no parameters. See the train example NewGRF for parameter
* usage
*/
}

/* Using parametrized sprite layouts are only valid in OpenTTD r22723 or later.
* Earlier versions will choke on those and otherwise disable the NewGRF.
*/
if (version_openttd(1,2,0,22723) > openttd_version) {
error(FATAL, REQUIRES_OPENTTD, string(STR_VERSION_22723));
error(FATAL, REQUIRES_OPENTTD, string(STR_VERSION_22723));
}


Expand Down Expand Up @@ -75,80 +75,80 @@ template tmpl_groundsprites(x, y) {
spriteset (cc_frame, "cc_grid.png") { tmpl_groundsprites(1, 1) }

spritelayout company_land_layout {
ground {
/* normal ground sprite - always draw */
sprite: LOAD_TEMP(0) + LOAD_TEMP(1);
}
childsprite {
/* company-coloured border - always draw */
sprite: cc_frame(LOAD_TEMP(0));
always_draw: 1;
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
}
childsprite {
/* again the normal ground sprite. Thus in non-transparent view
* only the normal ground sprite is shown. In transparent view
* this acts as sprite which darkens the other two sprites via
* a translation to transparency.
*/
sprite: LOAD_TEMP(0) + LOAD_TEMP(1);
}
ground {
/* normal ground sprite - always draw */
sprite: LOAD_TEMP(0) + LOAD_TEMP(1);
}
childsprite {
/* company-coloured border - always draw */
sprite: cc_frame(LOAD_TEMP(0));
always_draw: 1;
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
}
childsprite {
/* again the normal ground sprite. Thus in non-transparent view
* only the normal ground sprite is shown. In transparent view
* this acts as sprite which darkens the other two sprites via
* a translation to transparency.
*/
sprite: LOAD_TEMP(0) + LOAD_TEMP(1);
}
}

/* A pseudo-switch which sets the temporary parameters for the sprite layout */
switch (FEAT_OBJECTS, SELF, company_land_terrain_switch, [
/* We store the offset into the spriteset due to the tile slope into the 1st temporary variable
* (= storage register 0)
*/
STORE_TEMP(slope_to_sprite_offset(tile_slope), 0),
/* We store the offset into the spriteset due to the tile slope into the 1st temporary variable
* (= storage register 0)
*/
STORE_TEMP(slope_to_sprite_offset(tile_slope), 0),

/* We store the offset to the flat groundsprite we use into the 2nd temporary variable
* (= storage register 1)
*/
STORE_TEMP(GROUNDSPRITE_NORMAL, 1),
STORE_TEMP(terrain_type == TILETYPE_DESERT ? GROUNDSPRITE_DESERT : LOAD_TEMP(1), 1),
STORE_TEMP(terrain_type == TILETYPE_SNOW ? GROUNDSPRITE_SNOW : LOAD_TEMP(1), 1),
]) {
company_land_layout;
/* We store the offset to the flat groundsprite we use into the 2nd temporary variable
* (= storage register 1)
*/
STORE_TEMP(GROUNDSPRITE_NORMAL, 1),
STORE_TEMP(terrain_type == TILETYPE_DESERT ? GROUNDSPRITE_DESERT : LOAD_TEMP(1), 1),
STORE_TEMP(terrain_type == TILETYPE_SNOW ? GROUNDSPRITE_SNOW : LOAD_TEMP(1), 1),
]) {
company_land_layout;
}

/* Pseudo switch for the purchase list branch: we want to display the flat ground tile */
switch (FEAT_OBJECTS, SELF, company_land_purchase_switch, [
STORE_TEMP(0, 0),
STORE_TEMP(GROUNDSPRITE_NORMAL, 1),
STORE_TEMP(0, 0),
STORE_TEMP(GROUNDSPRITE_NORMAL, 1),

1
]) {
company_land_layout;
1
]) {
company_land_layout;
}

/* Define the object itself */
item(FEAT_OBJECTS, company_land) {
property {
/* The class allows to sort objects into categories. This is 'infrastructure' */
class: "INFR";
/* If no other NewGRF provides this class before us, we have to name it */
classname: string(STR_NAME_OBJCLASS_INFRASTRUCTURE);
/* Name of this particular object */
name: string(STR_NAME_COMPANY_LAND);
climates_available: ALL_CLIMATES;
size: [1, 1];
build_cost_multiplier: 1;
remove_cost_multiplier: 1;
introduction_date: date(1,1,1); // available from day 1
end_of_life_date: date(10000,1,1); // available till year 10000
/* Anything can overbuild the object, removing returns the money, we don't want foundations and we want to allow bridges */
object_flags: bitmask(OBJ_FLAG_ANYTHING_REMOVE, OBJ_FLAG_REMOVE_IS_INCOME, OBJ_FLAG_NO_FOUNDATIONS, OBJ_FLAG_ALLOW_BRIDGE);
height: 0; // it's only a ground tile
num_views: 1;
}
graphics {
purchase: company_land_purchase_switch;
// Allow placement on any land tile (the default prevents building on 'steep' slopes).
// The object cannot be placed on water despite this, because OBJ_FLAG_ON_WATER isn't set.
tile_check: return CB_RESULT_LOCATION_ALLOW;
additional_text: return string(STR_NAME_COMPANY_LAND);
company_land_terrain_switch;
}
property {
/* The class allows to sort objects into categories. This is 'infrastructure' */
class: "INFR";
/* If no other NewGRF provides this class before us, we have to name it */
classname: string(STR_NAME_OBJCLASS_INFRASTRUCTURE);
/* Name of this particular object */
name: string(STR_NAME_COMPANY_LAND);
climates_available: ALL_CLIMATES;
size: [1, 1];
build_cost_multiplier: 1;
remove_cost_multiplier: 1;
introduction_date: date(1,1,1); // available from day 1
end_of_life_date: date(10000,1,1); // available till year 10000
/* Anything can overbuild the object, removing returns the money, we don't want foundations and we want to allow bridges */
object_flags: bitmask(OBJ_FLAG_ANYTHING_REMOVE, OBJ_FLAG_REMOVE_IS_INCOME, OBJ_FLAG_NO_FOUNDATIONS, OBJ_FLAG_ALLOW_BRIDGE);
height: 0; // it's only a ground tile
num_views: 1;
}
graphics {
purchase: company_land_purchase_switch;
// Allow placement on any land tile (the default prevents building on 'steep' slopes).
// The object cannot be placed on water despite this, because OBJ_FLAG_ON_WATER isn't set.
tile_check: return CB_RESULT_LOCATION_ALLOW;
additional_text: return string(STR_NAME_COMPANY_LAND);
company_land_terrain_switch;
}
}
2 changes: 1 addition & 1 deletion examples/railtype/example_railtype.nml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* graphics and snow support has been removed to keep this example within
* reasonable size. Due to the large quantity of sprites required for a
* railtype grf, the number of lines of code is still relatively high.
*
*
* All real sprites have been templated, even if the template is used only
* once. This allows adding e.g. snowed graphics fairly easily.
*
Expand Down
110 changes: 55 additions & 55 deletions examples/station/example_station.nml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ grf {
/* This grf is part of NML, therefore "NML" is chosen as the first three
* characters of the GRFID. It is the seventh real grf defined as part of
* NML (the first is the train example), therefore the last character is
* set to 6. Successive grfs will have 7, 8, etc. there, to make sure each
* example grf has a unique GRFID.
* set to 6. Successive grfs will have 7, 8, etc. there, to make sure each
* example grf has a unique GRFID.
*/
grfid: "NML\06";
/* GRF name and description strings are defined in the lang files */
Expand All @@ -29,94 +29,94 @@ grf {
/* This is the first version, start numbering at 1. */
version: 1;
min_compatible_version: 1;
/* This NewGRF has no parameters. See the train example NewGRF for parameter
* usage
*/
/* This NewGRF has no parameters. See the train example NewGRF for parameter
* usage
*/
}

/* Using parametrized sprite layouts are only valid in OpenTTD r22723 or later.
* Earlier versions will choke on those and otherwise disable the NewGRF.
*/
if (version_openttd(1,2,0,22723) > openttd_version) {
error(FATAL, REQUIRES_OPENTTD, string(STR_VERSION_22723));
error(FATAL, REQUIRES_OPENTTD, string(STR_VERSION_22723));
}

cargotable {
LVST
LVST
}

spriteset (cow_pen_empty, "cows_cargo.png") {
[ 10, 10, 64, 65, -31, -34 ]
[ 220, 10, 64, 65, -31, -34 ]
[ 10, 10, 64, 65, -31, -34 ]
[ 220, 10, 64, 65, -31, -34 ]
}

spriteset (cow_pen_half, "cows_cargo.png") {
[ 80, 10, 64, 65, -31, -34 ]
[ 290, 10, 64, 65, -31, -34 ]
[ 80, 10, 64, 65, -31, -34 ]
[ 290, 10, 64, 65, -31, -34 ]
}

spriteset (cow_pen_full, "cows_cargo.png") {
[ 150, 10, 64, 65, -31, -34 ]
[ 360, 10, 64, 65, -31, -34 ]
[ 150, 10, 64, 65, -31, -34 ]
[ 360, 10, 64, 65, -31, -34 ]
}

spritelayout cow_pen_X(a) {
ground {
sprite: 2022 + a; // prevent railtype offset
}
building {
sprite: DEFAULT(0); // first sprite in active spriteset
zextent: 36;
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
}
ground {
sprite: 2022 + a; // prevent railtype offset
}
building {
sprite: DEFAULT(0); // first sprite in active spriteset
zextent: 36;
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
}
}

spritelayout cow_pen_Y(a) {
ground {
sprite: 2022 + a; // prevent railtype offset
}
building {
sprite: DEFAULT(1); // second sprite in active spriteset
zextent: 36;
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
}
ground {
sprite: 2022 + a; // prevent railtype offset
}
building {
sprite: DEFAULT(1); // second sprite in active spriteset
zextent: 36;
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
}
}

spritegroup cow_pen_1 {
little: [cow_pen_empty, cow_pen_half];
lots: cow_pen_full;
little: [cow_pen_empty, cow_pen_half];
lots: cow_pen_full;
}

spritegroup cow_pen_2 {
little: [cow_pen_empty, cow_pen_half, cow_pen_full];
lots: cow_pen_full;
little: [cow_pen_empty, cow_pen_half, cow_pen_full];
lots: cow_pen_full;
}

random_switch(FEAT_STATIONS, TILE, random_cow_pen) {
1: cow_pen_1;
1: cow_pen_2;
1: cow_pen_1;
1: cow_pen_2;
}

/* Define the station itself */
item(FEAT_STATIONS, cow_pen) {
property {
/* The class allows to sort stations into categories. */
class: "NML_";
/* If no other NewGRF provides this class before us, we have to name it */
classname: string(STR_NAME_STATCLASS);
/* Name of this particular station */
name: string(STR_NAME_STATION);
cargo_threshold: 160;
draw_pylon_tiles: 0;
hide_wire_tiles: 0xFF;
non_traversable_tiles: 0xFF;
}
graphics {
sprite_layouts: [cow_pen_X(0), cow_pen_Y(0)];
purchase: cow_pen_half;
LVST: random_cow_pen;
cow_pen_empty;
}
property {
/* The class allows to sort stations into categories. */
class: "NML_";
/* If no other NewGRF provides this class before us, we have to name it */
classname: string(STR_NAME_STATCLASS);
/* Name of this particular station */
name: string(STR_NAME_STATION);
cargo_threshold: 160;
draw_pylon_tiles: 0;
hide_wire_tiles: 0xFF;
non_traversable_tiles: 0xFF;
}
graphics {
sprite_layouts: [cow_pen_X(0), cow_pen_Y(0)];
purchase: cow_pen_half;
LVST: random_cow_pen;
cow_pen_empty;
}
}
10 changes: 5 additions & 5 deletions examples/train/example_train.nml
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,11 @@ item(FEAT_TRAINS, icm) {
* Earlier versions will choke on those and otherwise disable the NewGRF.
*/
if (version_openttd(1,2,0,22713) < openttd_version) {
item(FEAT_TRAINS, icm) {
property {
cargo_age_period: 185; // default value
}
}
item(FEAT_TRAINS, icm) {
property {
cargo_age_period: 185; // default value
}
}
}

/* ------------------ Cargo Wagons Example ------------------ */
Expand Down
13 changes: 6 additions & 7 deletions regression/009_replace.nml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ replace (3092, "opengfx_generic_trams1.pcx") { // replace the first two bus spri

/* Sprites / code from opengfx (slightly modified) */
replacenew(ONE_WAY_ROAD, "oneway.png") {
[ 18, 8, 24, 16, -12, -8]
[ 50, 8, 24, 16, -12, -8]
[ 82, 8, 28, 16, -14, -8]
[ 114, 8, 24, 16, -10, -8]
[ 146, 8, 24, 16, -10, -8]
[ 178, 8, 28, 16, -12, -8]
[ 18, 8, 24, 16, -12, -8]
[ 50, 8, 24, 16, -12, -8]
[ 82, 8, 28, 16, -14, -8]
[ 114, 8, 24, 16, -10, -8]
[ 146, 8, 24, 16, -10, -8]
[ 178, 8, 28, 16, -12, -8]
}

Loading

0 comments on commit 5707c06

Please sign in to comment.