Skip to content

Commit

Permalink
Most changes for RMTPO and BR47 to work in push pull (length needs ch…
Browse files Browse the repository at this point in the history
…anging to 8)
  • Loading branch information
audigex committed Mar 30, 2024
1 parent 7ab14e2 commit 5fd0cd8
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 119 deletions.
Binary file modified gfx/freight/RM_TPO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 97 additions & 0 deletions src/trains/_spriteset/Diesel_Sprites/47.pnml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
spriteset(spriteset_BR47_Purchase, "gfx/BR47_BR57.png") {
template_purchase(0, 0)
}

spriteset(spriteset_BR47_BRGreen, "gfx/BR47_BR57.png") {
template_train32px(0, 463)
}

spriteset(spriteset_BR47_BRBlue, "gfx/BR47_BR57.png") {
template_train32px(0, 13)
}

spriteset(spriteset_BR47_Porterbrook, "gfx/BR47_BR57.png") {
template_train32px(0, 38)
}

spriteset(spriteset_BR47_EWS, "gfx/BR47_BR57.png") {
template_train32px(0, 63)
}

spriteset(spriteset_BR47_BRLLogo, "gfx/BR47_BR57.png") {
template_train32px(0, 113)
}

spriteset(spriteset_BR47_BRLLogoAlt, "gfx/BR47_BR57.png") {
template_train32px(0, 88)
}

spriteset(spriteset_BR47_Anglia, "gfx/BR47_BR57.png") {
template_train32px(0, 138)
}

spriteset(spriteset_BR47_Intercity, "gfx/BR47_BR57.png") {
template_train32px(0, 163)
}

spriteset(spriteset_BR47_WCRC, "gfx/BR47_BR57.png") {
template_train32px(0, 238)
}

spriteset(spriteset_BR47_GWR, "gfx/BR47_BR57.png") {
template_train32px(0, 313)
}

spriteset(spriteset_BR47_Virgin, "gfx/BR47_BR57.png") {
template_train32px(0, 513)
}

spriteset(spriteset_BR47_Colas, "gfx/BR47_BR57.png") {
template_train32px(0, 538)
}

spriteset(spriteset_BR47_One, "gfx/BR47_BR57.png") {
template_train32px(0, 263)
}

spriteset(spriteset_BR47_Freightliner, "gfx/BR47_BR57.png") {
template_train32px(0, 213)
}

// This switch called when displaying as this locomotive
// WARNING: If editing this, also edit PushPull.pnml in the Spritesets folder
switch(FEAT_TRAINS,SELF, sw_BR47,cargo_subtype){
0: spriteset_BR47_BRGreen;
1: spriteset_BR47_BRBlue;
2: spriteset_BR47_Porterbrook;
3: spriteset_BR47_EWS;
4: spriteset_BR47_BRLLogo;
5: spriteset_BR47_BRLLogoAlt;
6: spriteset_BR47_Anglia;
7: spriteset_BR47_Intercity;
8: spriteset_BR47_WCRC;
9: spriteset_BR47_GWR;
10: spriteset_BR47_Virgin;
11: spriteset_BR47_Colas;
12: spriteset_BR47_One;
13: spriteset_BR47_Freightliner;
return CB_RESULT_NO_TEXT;
}

switch(FEAT_TRAINS,SELF,sw_BR47_cargo_subtype_text,cargo_subtype){
0: return string(str_BRGreen);
1: return string(str_BRBlue);
2: return string(str_Purple);
3: return string(str_EWSCentre);
4: return string(str_BRLLogo);
5: return string(str_BRLLogoAlt);
6: return string(str_Anglia);
7: return string(str_Intercity);
8: return string(str_WCRC);
9: return string(str_GWRGreen);
10: return string(str_Virgin);
11: return string(str_ColasRail);
12: return string(str_One);
13: return string(str_Freightliner);
return CB_RESULT_NO_TEXT;
}
24 changes: 24 additions & 0 deletions src/trains/_spriteset/PushPull.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@ switch(FEAT_TRAINS, PARENT, sw_PUSHPULL_LocomotiveAsMk4DVT, [STORE_TEMP(num_vehs
spriteset_BR91_IntercitySwallowr;
}

// Not a mirror for once, as RMTPO PCV only has one livery
switch(FEAT_TRAINS, PARENT, sw_PUSHPULL_LocomotiveAsRMTPO, [STORE_TEMP(num_vehs_in_consist - 1, 0x10F), var[0x61, 0, 0x0000FFFF, 0xF2]]){
spriteset_RMTPO_PCVr;
}

// Mirror of BR47
switch(FEAT_TRAINS, PARENT, sw_PUSHPULL_DMSOasBR47,cargo_subtype){
0: spriteset_BR47_BRGreen;
1: spriteset_BR47_BRBlue;
2: spriteset_BR47_Porterbrook;
3: spriteset_BR47_EWS;
4: spriteset_BR47_BRLLogo;
5: spriteset_BR47_BRLLogoAlt;
6: spriteset_BR47_Anglia;
7: spriteset_BR47_Intercity;
8: spriteset_BR47_WCRC;
9: spriteset_BR47_GWR;
10: spriteset_BR47_Virgin;
11: spriteset_BR47_Colas;
12: spriteset_BR47_One;
13: spriteset_BR47_Freightliner;
return CB_RESULT_NO_TEXT;
}

// Mirror of BR67
switch(FEAT_TRAINS, PARENT, sw_PUSHPULL_DVTasBR67,cargo_subtype){
0: spriteset_BR67_EWS;
Expand Down
2 changes: 1 addition & 1 deletion src/trains/_spriteset/Rolling Stock_Sprites/Mk4DVT.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ switch(FEAT_TRAINS, PARENT, sw_BRMk4DVT_PushPUll, [STORE_TEMP(0 - position_in_ar
sw_BRMk4DVT; // No compatible locomotive found, show normal sprites
}

switch(FEAT_TRAINS,PARENT,sw_BRMk4DVT_CheckPosition, position_in_articulated_veh_from_end){
switch(FEAT_TRAINS, SELF,sw_BRMk4DVT_CheckPosition, position_in_articulated_veh_from_end){
0: sw_BRMk4DVT_PushPUll; // Attempt push pull
sw_BRMk4DVT; // We aren't at the back of theconsist, show normal sprites
}
Expand Down
34 changes: 34 additions & 0 deletions src/trains/_spriteset/Rolling Stock_Sprites/RM_TPO.pnml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
spriteset(spriteset_RMTPO_Purchase, "gfx/freight/RM_TPO.png") {
template_purchase(0, 0)
}

spriteset(spriteset_RMTPO_NoDoors, "gfx/freight/RM_TPO.png") {
template_train28px(0, 13)
}
spriteset(spriteset_RMTPO_2Door, "gfx/freight/RM_TPO.png") {
template_train28px(0, 36)
}
spriteset(spriteset_RMTPO_3Door, "gfx/freight/RM_TPO.png") {
template_train28px(0, 59)
}

spriteset(spriteset_RMTPO_PCV, "gfx/freight/RM_TPO.png") {
template_train28px(0, 82)
}

spriteset(spriteset_RMTPO_PCVr, "gfx/freight/RM_TPO.png") {
template_train28px(0, 105)
}

random_switch(FEAT_TRAINS, SELF, sw_RMTPO_Random)
{
1: spriteset_RMTPO_NoDoors;
1: spriteset_RMTPO_2Door;
1: spriteset_RMTPO_3Door;
}

switch(FEAT_TRAINS, SELF, sw_RMTPO, position_in_consist_from_end)
{
0: spriteset_RMTPO_PCV;
sw_RMTPO_Random;
}
102 changes: 11 additions & 91 deletions src/trains/diesel/BR047.pnml
Original file line number Diff line number Diff line change
@@ -1,97 +1,17 @@
spriteset(spriteset_BR47_Purchase, "gfx/BR47_BR57.png") {
template_purchase(0, 0)
// If the rear of this consist is a compatible Driving Trailer, call that vehicles's remote sprite call switch
switch(FEAT_TRAINS, PARENT, sw_BR47_PushPUll, [STORE_TEMP(num_vehs_in_consist - 1, 0x10F), var[0x61, 0, 0x0000FFFF, 0xC6]]) {
//483: sw_PUSHPULL_LocomotiveAsRMTPO; // Royal Mail TPO, uncommen this line when RMTPO has been changed to length 8
sw_BR47; // No compatible locomotive found, show normal sprites
}

spriteset(spriteset_BR47_BRGreen, "gfx/BR47_BR57.png") {
template_train32px(0, 463)
switch(FEAT_TRAINS, SELF,sw_BR47_CheckPosition, position_in_consist){
0: sw_BR47_PushPUll; // Attempt push pull
sw_BR47; // We aren't at the front of the consist, show normal sprites
}

spriteset(spriteset_BR47_BRBlue, "gfx/BR47_BR57.png") {
template_train32px(0, 13)
}

spriteset(spriteset_BR47_Porterbrook, "gfx/BR47_BR57.png") {
template_train32px(0, 38)
}

spriteset(spriteset_BR47_EWS, "gfx/BR47_BR57.png") {
template_train32px(0, 63)
}

spriteset(spriteset_BR47_BRLLogo, "gfx/BR47_BR57.png") {
template_train32px(0, 113)
}

spriteset(spriteset_BR47_BRLLogoAlt, "gfx/BR47_BR57.png") {
template_train32px(0, 88)
}

spriteset(spriteset_BR47_Anglia, "gfx/BR47_BR57.png") {
template_train32px(0, 138)
}

spriteset(spriteset_BR47_Intercity, "gfx/BR47_BR57.png") {
template_train32px(0, 163)
}

spriteset(spriteset_BR47_WCRC, "gfx/BR47_BR57.png") {
template_train32px(0, 238)
}

spriteset(spriteset_BR47_GWR, "gfx/BR47_BR57.png") {
template_train32px(0, 313)
}

spriteset(spriteset_BR47_Virgin, "gfx/BR47_BR57.png") {
template_train32px(0, 513)
}

spriteset(spriteset_BR47_Colas, "gfx/BR47_BR57.png") {
template_train32px(0, 538)
}

spriteset(spriteset_BR47_One, "gfx/BR47_BR57.png") {
template_train32px(0, 263)
}

spriteset(spriteset_BR47_Freightliner, "gfx/BR47_BR57.png") {
template_train32px(0, 213)
}

switch(FEAT_TRAINS,SELF, sw_BR47,cargo_subtype){
0: spriteset_BR47_BRGreen;
1: spriteset_BR47_BRBlue;
2: spriteset_BR47_Porterbrook;
3: spriteset_BR47_EWS;
4: spriteset_BR47_BRLLogo;
5: spriteset_BR47_BRLLogoAlt;
6: spriteset_BR47_Anglia;
7: spriteset_BR47_Intercity;
8: spriteset_BR47_WCRC;
9: spriteset_BR47_GWR;
10: spriteset_BR47_Virgin;
11: spriteset_BR47_Colas;
12: spriteset_BR47_One;
13: spriteset_BR47_Freightliner;
return CB_RESULT_NO_TEXT;
}

switch(FEAT_TRAINS,SELF,sw_BR47_cargo_subtype_text,cargo_subtype){
0: return string(str_BRGreen);
1: return string(str_BRBlue);
2: return string(str_Purple);
3: return string(str_EWSCentre);
4: return string(str_BRLLogo);
5: return string(str_BRLLogoAlt);
6: return string(str_Anglia);
7: return string(str_Intercity);
8: return string(str_WCRC);
9: return string(str_GWRGreen);
10: return string(str_Virgin);
11: return string(str_ColasRail);
12: return string(str_One);
13: return string(str_Freightliner);
return CB_RESULT_NO_TEXT;
switch(FEAT_TRAINS,PARENT,sw_BR47_Sprites ,vehicle_is_reversed){
0: sw_BR47; // We're heading foward, show normal sprites
1: sw_BR47_CheckPosition; // Attempt push pull
}

item (FEAT_TRAINS, item_BR47, 440) {
Expand Down Expand Up @@ -133,7 +53,7 @@ item (FEAT_TRAINS, item_BR47, 440) {
can_attach_wagon: CB_RESULT_ATTACH_ALLOW;
cargo_capacity: return 0;
cargo_subtype_text: sw_BR47_cargo_subtype_text;
default: sw_BR47;
default: sw_BR47_Sprites;
purchase: spriteset_BR47_Purchase;
colour_mapping: return PALETTE_CC_FIRST;
create_effect: diesel_create_visual_effect;
Expand Down
38 changes: 11 additions & 27 deletions src/trains/rollingstock/RM_TPO.pnml
Original file line number Diff line number Diff line change
@@ -1,35 +1,19 @@
spriteset(spriteset_RMTPO_Purchase, "gfx/freight/RM_TPO.png") {
template_purchase(0, 0)
// If the front of this consist is a compatible locomotive, call that locomotive's remote sprite call switch
switch(FEAT_TRAINS, PARENT, sw_RMTPO_PushPUll, [STORE_TEMP(0 - position_in_articulated_veh, 0x10F), var[0x61, 0, 0x0000FFFF, 0xC6]]) {
440: sw_PUSHPULL_DMSOasBR47; // Class 47
sw_RMTPO; // No compatible locomotive found, show normal sprites
}

spriteset(spriteset_RMTPO_NoDoors, "gfx/freight/RM_TPO.png") {
template_train28px(0, 13)
}
spriteset(spriteset_RMTPO_2Door, "gfx/freight/RM_TPO.png") {
template_train28px(0, 36)
}
spriteset(spriteset_RMTPO_3Door, "gfx/freight/RM_TPO.png") {
template_train28px(0, 59)
}

spriteset(spriteset_RMTPO_PCV, "gfx/freight/RM_TPO.png") {
template_train28px(0, 82)
switch(FEAT_TRAINS, PARENT, sw_RMTPO_CheckDirection,vehicle_is_reversed){
0: sw_RMTPO; // We're heading foward, show normal sprites
1: sw_RMTPO_PushPUll; // Attempt push pull (skipping check position for now for testing)
}

random_switch(FEAT_TRAINS, SELF, sw_RMTPO_Random)
{
1: spriteset_RMTPO_NoDoors;
1: spriteset_RMTPO_2Door;
1: spriteset_RMTPO_3Door;
switch(FEAT_TRAINS, SELF, sw_RMTPO_Sprites, position_in_consist_from_end){
0: sw_RMTPO_CheckDirection; // Attempt push pull
sw_RMTPO_Random; // We aren't at the back of theconsist, show normal sprites
}

switch(FEAT_TRAINS, SELF, sw_RMTPO, position_in_consist_from_end)
{
0: spriteset_RMTPO_PCV;
sw_RMTPO_Random;
}


item (FEAT_TRAINS, item_RMTPO, 483) {
property {
name: string(STR_NAME_RMTPO);
Expand All @@ -54,7 +38,7 @@ item (FEAT_TRAINS, item_RMTPO, 483) {
graphics {
additional_text: return(string(str_purchase_coach,string(str_RMTPO_liveries)));
can_attach_wagon: CB_RESULT_ATTACH_ALLOW;
default: sw_RMTPO;
default: sw_RMTPO; // Switch to sw_RMTPO_Sprites when length changed to 8 for push pull
purchase: spriteset_RMTPO_Purchase;
colour_mapping: return PALETTE_CC_FIRST;
cargo_capacity: return(50);
Expand Down

0 comments on commit 5fd0cd8

Please sign in to comment.