Skip to content

Commit

Permalink
Add: Regression test for 32bpp-only spriteset().
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterN committed Dec 18, 2023
1 parent 6ed399f commit a35551c
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 0 deletions.
63 changes: 63 additions & 0 deletions regression/041_articulated_tram_32bpp.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
A simple articulated tram, graphics from OpenGFX+rv
Code is modified in some places for testing reasons.
*/

grf {
grfid: "NML\41";
name: string(STR_REGRESSION_NAME);
desc: string(STR_REGRESSION_DESC);
version: 0;
min_compatible_version: 0;
}

template tmpl_tram(x, y) {
[ x, y, 8, 18, -3, -10]
[ 16 + x, y, 20, 18, -14, -5]
[ 48 + x, y, 28, 15, -14, -8]
[ 96 + x, y, 20, 18, -6, -7]
[128 + x, y, 8, 18, -3, -10]
[144 + x, y, 20, 18, -14, -9]
[176 + x, y, 28, 15, -14, -8]
[224 + x, y, 20, 18, -6, -7]
}
spriteset(foster_express_set, ZOOM_LEVEL_NORMAL, BIT_DEPTH_32BPP, "tram_foster_express.32.png") {
tmpl_tram(48,1)
}

switch(FEAT_ROADVEHS, SELF, foster_express_articulated_parts, extra_callback_info1) {
1..3: return foster_express_tram;
return 0xFF;
}


item(FEAT_ROADVEHS, foster_express_tram, 88) {
property {
name: string(STR_NAME_FOSTER_TURBO_TRAM);
climates_available: ALL_CLIMATES;
model_life: 40; // years
vehicle_life: 30; // years
introduction_date: date(1965,1,1);
reliability_decay: 1;
running_cost_base: RUNNING_COST_ROADVEH; // Default road vehicle running cost base
running_cost_factor: 135;
cost_factor: 143;
speed: 317 mph;
power: 220 hp;
weight: 22 ton;
sprite_id: SPRITE_ID_NEW_ROADVEH; // We have our own sprites
loading_speed: 16; // loading speed
tractive_effort_coefficient: 0.3;
air_drag_coefficient: 0.5;
cargo_capacity: 45; // passengers
refittable_cargo_classes: bitmask(CC_PASSENGERS); // Allow passengers (and tourists)
non_refittable_cargo_classes: NO_CARGO_CLASS; // Disallow other cargos
cargo_allow_refit: [];
default_cargo_type: DEFAULT_CARGO_FIRST_REFITTABLE;
misc_flags: bitmask(ROADVEH_FLAG_TRAM); // This is a tram
}
graphics {
articulated_part: foster_express_articulated_parts;
foster_express_set;
}
}
Binary file not shown.
83 changes: 83 additions & 0 deletions regression/expected/041_articulated_tram_32bpp.nfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Automatically generated by GRFCODEC. Do not modify!
// (Info version 32)
// Escapes: 2+ 2- 2< 2> 2u< 2u> 2/ 2% 2u/ 2u% 2* 2& 2| 2^ 2sto = 2s 2rst = 2r 2psto 2ror = 2rot 2cmp 2ucmp 2<< 2u>> 2>>
// Escapes: 71 70 7= 7! 7< 7> 7G 7g 7gG 7GG 7gg 7c 7C
// 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 \d18

1 * 54 14 "C" "INFO"
"B" "VRSN" \w4 \dx00000000
"B" "MINV" \w4 \dx00000000
"B" "NPAR" \w1 00
"B" "PALS" \w1 "A"
"B" "BLTR" \w1 "3"
00
00
2 * 52 08 08 "NML\41" "NML regression test" 00 "A test newgrf testing NML" 00
// Name: foster_express_articulated_parts
3 * 23 02 01 FF 89
10 00 \dxFFFFFFFF
\b1
\wx8058 \dx00000001 \dx00000003 // 1 .. 3: return 88;
\wx80FF // default: return 255;

4 * 74 00 01 \b25 01 FF \wx0058
06 0F
04 28
03 1E
1F \dx000AF386
02 01
0A \dx00004C48
09 87
11 8F
08 FF
15 FE
13 16
14 58
0E FF
07 10
18 4D
19 80
0F 2D
1D \wx0001
16 \dx00000000
1E \wx0000
16 \dx00000000
24 \b0
16 \dx00000000
10 FF
1C 01

5 * 25 04 01 7F 01 FF \wx0058 "Foster Turbo Tram" 00

6 * 6 01 01 \b1 FF \wx0008

7 tram_foster_express.32.png 32bpp 48 1 8 18 -3 -10 normal
8 tram_foster_express.32.png 32bpp 64 1 20 18 -14 -5 normal
9 tram_foster_express.32.png 32bpp 96 1 28 15 -14 -8 normal
10 tram_foster_express.32.png 32bpp 144 1 20 18 -6 -7 normal
11 tram_foster_express.32.png 32bpp 176 1 8 18 -3 -10 normal
12 tram_foster_express.32.png 32bpp 192 1 20 18 -14 -9 normal
13 tram_foster_express.32.png 32bpp 224 1 28 15 -14 -8 normal
14 tram_foster_express.32.png 32bpp 272 1 20 18 -6 -7 normal

// Name: foster_express_set - feature 01
15 * 9 02 01 FE \b1 \b1
\w0
\w0

16 * 9 00 01 \b1 01 FF \wx0058
17 10

// Name: @action3_0
17 * 23 02 01 FE 89
0C 00 \dx0000FFFF
\b1
\wx00FF \dx00000016 \dx00000016 // foster_express_articulated_parts;
\wx00FE // foster_express_set;

18 * 9 03 01 01 FF \wx0058 \b0
\wx00FE // @action3_0;

Binary file added regression/tram_foster_express.32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a35551c

Please sign in to comment.