Skip to content

Commit

Permalink
GENIUS PUSHPULL BECAUSE I AM A GENIUS (No I will not use a profession…
Browse files Browse the repository at this point in the history
…al commit message, I'm too chuffed with this)
  • Loading branch information
audigex committed Mar 29, 2024
1 parent 42cbcc7 commit deb84bb
Show file tree
Hide file tree
Showing 10 changed files with 227 additions and 38 deletions.
16 changes: 16 additions & 0 deletions docs/Push Pull.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Push-pull combinations in the format
Trailer: Power units

? indicates assumed combinations. 33 is 7 length, everything else is 8 length

TPO PCV: 47, 57?

Mk2 DBSO: 47, 57?, 37

Mk3 DVT: 86, 87, 90, 67, 68, 47, 57?, 69?

Mk4 DVT: 67, 89, 90, 91

Mk5 DVT: 68

438 TC: 33, 73, 71 (& 74 converted from 71), 4-REP (432). Maybe 47 (unconfirmed if push-pull or just hauled for a railtour)
Binary file modified docs/SpriteIDs.xlsx
Binary file not shown.
Binary file modified gfx/BR91.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions lang/english.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1070,8 +1070,8 @@ str_BRMK4TSOD_liveries :Intercity Swallow, National Express, GNER, East Coast,
STR_NAME_BRMK4RFM :BR Mark 4 Coach (Trailer Restaurant First)
str_BRMK4RFM_liveries :Intercity Swallow, National Express, GNER, East Coast, Virgin East Coast

STR_NAME_BRMK4DVT :BR Mark 4 Driving Van Trailer
str_BRMK4DVT_liveries :Intercity Swallow, National Express, GNER, East Coast, Virgin East Coast
STR_NAME_BRMk4DVT :BR Mark 4 Driving Van Trailer
str_BRMk4DVT_liveries :Intercity Swallow, National Express, GNER, East Coast, Virgin East Coast

STR_NAME_BRMk5Sleeper :BR Mark 5 Sleeper Coach
str_BRMk5Sleeper_liveries :Caledonian Sleaper
Expand Down
44 changes: 44 additions & 0 deletions src/trains/_spriteset/PushPull.pnml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*

Switches in this file are mirrors of their respective DVT or locomotive for pushpull operations
Changes to the locomotive should be mirrored here or strange things might happen
It is recommended to always include a default...

*/

// Mirror of Mk4DVT
switch(FEAT_TRAINS, PARENT, sw_PUSHPULL_LocomotiveAsMk4DVT, [STORE_TEMP(num_vehs_in_consist - 1, 0x10F), var[0x61, 0, 0x0000FFFF, 0xF2]]){
0: spriteset_BR91_IntercitySwallow;
1: spriteset_BR91_NatEx;
2: spriteset_BR91_GNER;
3: spriteset_BR91_EastCoast;
4: spriteset_BR91_VirginEC;
5: spriteset_BR91_LNER;
spriteset_BR91_IntercitySwallow;
}

// Mirror of BR89
switch(FEAT_TRAINS, PARENT, sw_PUSHPULL_DVTasBR89, [STORE_TEMP(0 - position_in_articulated_veh, 0x10F), var[0x61, 0, 0x0000FFFF, 0xF2]]){
0: spriteset_BR89_IntercitySwallow;
1: spriteset_BR89_GNER;
2: spriteset_BR89_Intercity;
spriteset_BR89_IntercitySwallow;
}

// Mirror of BR90
switch(FEAT_TRAINS, PARENT, sw_PUSHPULL_DVTasBR90, [STORE_TEMP(0 - position_in_articulated_veh, 0x10F), var[0x61, 0, 0x0000FFFF, 0xF2]]){
0: spriteset_BR90_IntercitySwallow;
1: spriteset_BR90_FLGrey;
2: spriteset_BR90_EWS;
3: spriteset_BR90_DB;
4: spriteset_BR90_FLGreen;
5: spriteset_BR90_FLPowerhaul;
6: spriteset_BR90_ONE;
7: spriteset_BR90_GreaterAnglia;
8: spriteset_BR90_GreaterAnglia2;
9: spriteset_BR90_Virgin;
10: spriteset_BR90_REX;
11: spriteset_BR90_FirstScotrail;
12: spriteset_BR90_GNER;
return CB_RESULT_NO_TEXT;
}
66 changes: 54 additions & 12 deletions src/trains/_spriteset/Rolling Stock_Sprites/Mk4DVT.pnml
Original file line number Diff line number Diff line change
@@ -1,41 +1,83 @@
spriteset(spriteset_BRMK4DVT_IntercitySwallow, "gfx/BR91.png") {
spriteset(spriteset_BRMk4DVT_purchase, "gfx/BR91.png") {
template_purchase(256, 0)
}

spriteset(spriteset_BRMk4DVT_IntercitySwallow, "gfx/BR91.png") {
template_train32px(0, 113)
}
spriteset(spriteset_BRMK4DVT_IntercitySwallowr, "gfx/BR91.png") {
spriteset(spriteset_BRMk4DVT_IntercitySwallowr, "gfx/BR91.png") {
template_train32px(172, 113)
}

spriteset(spriteset_BRMK4DVT_NatEx, "gfx/BR91.png") {
spriteset(spriteset_BRMk4DVT_NatEx, "gfx/BR91.png") {
template_train32px(0, 238)
}
spriteset(spriteset_BRMK4DVT_NatExr, "gfx/BR91.png") {
spriteset(spriteset_BRMk4DVT_NatExr, "gfx/BR91.png") {
template_train32px(172, 238)
}

spriteset(spriteset_BRMK4DVT_GNER, "gfx/BR91.png") {
spriteset(spriteset_BRMk4DVT_GNER, "gfx/BR91.png") {
template_train32px(0, 363)
}
spriteset(spriteset_BRMK4DVT_GNERr, "gfx/BR91.png") {
spriteset(spriteset_BRMk4DVT_GNERr, "gfx/BR91.png") {
template_train32px(172, 363)
}

spriteset(spriteset_BRMK4DVT_EastCoast, "gfx/BR91.png") {
spriteset(spriteset_BRMk4DVT_EastCoast, "gfx/BR91.png") {
template_train32px(0, 488)
}
spriteset(spriteset_BRMK4DVT_EastCoastr, "gfx/BR91.png") {
spriteset(spriteset_BRMk4DVT_EastCoastr, "gfx/BR91.png") {
template_train32px(172, 488)
}

spriteset(spriteset_BRMK4DVT_VirginEC, "gfx/BR91.png") {
spriteset(spriteset_BRMk4DVT_VirginEC, "gfx/BR91.png") {
template_train32px(0, 613)
}
spriteset(spriteset_BRMK4DVT_VirginECr, "gfx/BR91.png") {
spriteset(spriteset_BRMk4DVT_VirginECr, "gfx/BR91.png") {
template_train32px(172, 613)
}

spriteset(spriteset_BRMK4DVT_LNER, "gfx/BR91.png") {
spriteset(spriteset_BRMk4DVT_LNER, "gfx/BR91.png") {
template_train32px(0, 738)
}
spriteset(spriteset_BRMK4DVT_LNERr, "gfx/BR91.png") {
spriteset(spriteset_BRMk4DVT_LNERr, "gfx/BR91.png") {
template_train32px(172, 738)
}

switch(FEAT_TRAINS,SELF,sw_BRMk4DVT_cargo_subtype_text,cargo_subtype){
0: return string(str_IntercitySwallow);
1: return string(str_NatEx);
2: return string(str_GNER);
3: return string(str_EastCoast);
4: return string(str_VirginECLNER);
5: return string(str_LNER);
return CB_RESULT_NO_TEXT;
}

// Show own graphics when facing forward
// WARNING: If editing this, also edit PushPull.pnml in the Spritesets folder
switch(FEAT_TRAINS,SELF, sw_BRMk4DVT,cargo_subtype){
0: spriteset_BRMk4DVT_IntercitySwallow;
1: spriteset_BRMk4DVT_NatEx;
2: spriteset_BRMk4DVT_GNER;
3: spriteset_BRMk4DVT_EastCoast;
4: spriteset_BRMk4DVT_VirginEC;
5: spriteset_BRMk4DVT_LNER;
}

// If the front of this consist is a compatible locomotive, call that locomotive's remote sprite call switch
switch(FEAT_TRAINS, PARENT, sw_BRMk4DVT_PushPUll, [STORE_TEMP(0 - position_in_articulated_veh, 0x10F), var[0x61, 0, 0x0000FFFF, 0xC6]]) {
418: sw_PUSHPULL_DVTasBR89; // Class 89
543: sw_PUSHPULL_DVTasBR90; // Class 90
sw_BRMk4DVT; // No compatible locomotive found, show normal sprites
}

switch(FEAT_TRAINS,PARENT,sw_Mk4DVT_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
}

switch(FEAT_TRAINS,PARENT,sw_BRMk4DVT_Sprites ,vehicle_is_reversed){
0: sw_BRMk4DVT; // We're heading foward, show normal sprites
1: sw_Mk4DVT_CheckPosition; // Attempt push pull (skipping check position for now for testing)
}
25 changes: 21 additions & 4 deletions src/trains/electric/BR89.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ spriteset(spriteset_BR89_Intercity, "gfx/BR89.png") {
template_train32px(0, 63)
}


switch(FEAT_TRAINS,SELF, sw_BR89, cargo_subtype){
// 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_BR89, cargo_subtype){
0: spriteset_BR89_IntercitySwallow;
1: spriteset_BR89_GNER;
2: spriteset_BR89_Intercity;
Expand All @@ -29,6 +30,22 @@ switch(FEAT_TRAINS,SELF,sw_BR89_cargo_subtype_text,cargo_subtype){
return CB_RESULT_NO_TEXT;
}

// If the rear of this consist is a compatible Driving Trailer, call that vehicles's remote sprite call switch
switch(FEAT_TRAINS, PARENT, sw_BR89_PushPUll, [STORE_TEMP(num_vehs_in_consist - 1, 0x10F), var[0x61, 0, 0x0000FFFF, 0xC6]]) {
585: sw_PUSHPULL_LocomotiveAsMk4DVT; // Mk4 DVT
sw_BR89; // No compatible locomotive found, show normal sprites
}

switch(FEAT_TRAINS,PARENT,sw_BR89_CheckPosition, position_in_consist){
0: sw_BR89_PushPUll; // Attempt push pull
sw_BR89; // We aren't at the front of the consist, show normal sprites
}

switch(FEAT_TRAINS,PARENT,sw_BR89_Sprites ,vehicle_is_reversed){
0: sw_BR89; // We're heading foward, show normal sprites
1: sw_BR89_CheckPosition; // Attempt push pull
}

item (FEAT_TRAINS, item_BR89, 418) {
property {
name: string(STR_NAME_BR89);
Expand Down Expand Up @@ -68,10 +85,10 @@ item (FEAT_TRAINS, item_BR89, 418) {
can_attach_wagon: CB_RESULT_ATTACH_ALLOW;
cargo_capacity: return 0;
cargo_subtype_text: sw_BR89_cargo_subtype_text;
default: sw_BR89;
default: sw_BR89_Sprites;
purchase: spriteset_BR89_Purchase;
colour_mapping: return PALETTE_CC_FIRST;
cost_factor: return(GetAdjustedCost(38));
running_cost_factor: return(GetAdjustedCost(37));
}
}
}
18 changes: 17 additions & 1 deletion src/trains/electric/BR90.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ switch(FEAT_TRAINS,SELF,sw_BR90_cargo_subtype_text,cargo_subtype){
return CB_RESULT_NO_TEXT;
}

// If the rear of this consist is a compatible Driving Trailer, call that vehicles's remote sprite call switch
switch(FEAT_TRAINS, PARENT, sw_BR90_PushPUll, [STORE_TEMP(num_vehs_in_consist - 1, 0x10F), var[0x61, 0, 0x0000FFFF, 0xC6]]) {
585: sw_PUSHPULL_LocomotiveAsMk4DVT; // Mk4 DVT
sw_BR90; // No compatible locomotive found, show normal sprites
}

switch(FEAT_TRAINS,PARENT,sw_BR90_CheckPosition, position_in_consist){
0: sw_BR90_PushPUll; // Attempt push pull
sw_BR90; // We aren't at the front of the consist, show normal sprites
}

switch(FEAT_TRAINS,PARENT,sw_BR90_Sprites ,vehicle_is_reversed){
0: sw_BR90; // We're heading foward, show normal sprites
1: sw_BR90_CheckPosition; // Attempt push pull
}

item (FEAT_TRAINS, item_BR90, 543) {
property {
name: string(STR_NAME_BR90);
Expand Down Expand Up @@ -127,7 +143,7 @@ item (FEAT_TRAINS, item_BR90, 543) {
can_attach_wagon: CB_RESULT_ATTACH_ALLOW;
cargo_capacity: return 0;
cargo_subtype_text: sw_BR90_cargo_subtype_text;
default: sw_BR90;
default: sw_BR90_Sprites;
purchase: spriteset_BR90_Purchase;
colour_mapping: return PALETTE_CC_FIRST;
cost_factor: return(GetAdjustedCost(38));
Expand Down
38 changes: 19 additions & 19 deletions src/trains/electric/BR91.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ switch(FEAT_TRAINS,SELF, sw_BR91,cargo_subtype){
}

switch(FEAT_TRAINS,SELF, sw_BR91_reversed,cargo_subtype){
0: spriteset_BRMK4DVT_IntercitySwallowr;
1: spriteset_BRMK4DVT_NatExr;
2: spriteset_BRMK4DVT_GNERr;
3: spriteset_BRMK4DVT_EastCoastr;
4: spriteset_BRMK4DVT_VirginECr;
5: spriteset_BRMK4DVT_LNERr;
0: spriteset_BRMk4DVT_IntercitySwallowr;
1: spriteset_BRMk4DVT_NatExr;
2: spriteset_BRMk4DVT_GNERr;
3: spriteset_BRMk4DVT_EastCoastr;
4: spriteset_BRMk4DVT_VirginECr;
5: spriteset_BRMk4DVT_LNERr;
}

switch (FEAT_TRAINS, SELF, switch_articulated_BR91, extra_callback_info1) {
Expand All @@ -22,7 +22,7 @@ switch (FEAT_TRAINS, SELF, switch_articulated_BR91, extra_callback_info1) {
5: return item_91_BRMK4TSOD;
6: return item_91_BRMK4RFM;
7..9: return item_91_BRMK4FO;
10: return item_91_BRMK4DVT;
10: return item_91_BRMk4DVT;
return CB_RESULT_NO_MORE_ARTICULATED_PARTS; //stop adding vehicle parts
}

Expand Down Expand Up @@ -141,16 +141,16 @@ switch(FEAT_TRAINS,SELF, sw_91_BRMK4TSOD,cargo_subtype){
5: spriteset_BRMK4TSOD_LNER;
}

switch(FEAT_TRAINS,SELF, sw_91_BRMK4DVT,cargo_subtype){
0: spriteset_BRMK4DVT_IntercitySwallow;
1: spriteset_BRMK4DVT_NatEx;
2: spriteset_BRMK4DVT_GNER;
3: spriteset_BRMK4DVT_EastCoast;
4: spriteset_BRMK4DVT_VirginEC;
5: spriteset_BRMK4DVT_LNER;
switch(FEAT_TRAINS,SELF, sw_91_BRMk4DVT,cargo_subtype){
0: spriteset_BRMk4DVT_IntercitySwallow;
1: spriteset_BRMk4DVT_NatEx;
2: spriteset_BRMk4DVT_GNER;
3: spriteset_BRMk4DVT_EastCoast;
4: spriteset_BRMk4DVT_VirginEC;
5: spriteset_BRMk4DVT_LNER;
}

switch(FEAT_TRAINS,SELF, sw_91_BRMK4DVT_reversed,cargo_subtype){
switch(FEAT_TRAINS,SELF, sw_91_BRMk4DVT_reversed,cargo_subtype){
0: spriteset_BR91_IntercitySwallowr;
1: spriteset_BR91_NatExr;
2: spriteset_BR91_GNERr;
Expand All @@ -160,13 +160,13 @@ switch(FEAT_TRAINS,SELF, sw_91_BRMK4DVT_reversed,cargo_subtype){
}

switch(FEAT_TRAINS,PARENT,sw_91_rear,vehicle_is_reversed){
0: sw_91_BRMK4DVT;
1: sw_91_BRMK4DVT_reversed;
0: sw_91_BRMk4DVT;
1: sw_91_BRMk4DVT_reversed;
}

item (FEAT_TRAINS, item_91_BRMK4DVT, 113) {
item (FEAT_TRAINS, item_91_BRMk4DVT, 113) {
property {
name: string(STR_NAME_BRMK4DVT);
name: string(STR_NAME_BRMk4DVT);
climates_available: NO_CLIMATE;
introduction_date: date(1989,4,21);
model_life: 12;
Expand Down
54 changes: 54 additions & 0 deletions src/trains/rollingstock/Mk4DVT.pnml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
item (FEAT_TRAINS, item_BRMk4DVT, 585) {
property {
name: string(STR_NAME_BRMk4DVT);
climates_available: ALL_CLIMATES;
refittable_cargo_classes: CC_PASSENGERS;
introduction_date: date(1989,1,1);
cargo_allow_refit: [MAIL];
loading_speed: 14;
cost_factor: 30;
running_cost_factor: 12;
sprite_id: SPRITE_ID_NEW_TRAIN;
refit_cost: 0;
track_type: RAIL;
speed: 140 mph;
power: 0;
running_cost_base: RUNNING_COST_STEAM;
dual_headed: 0;
default_cargo_type: MAIL;
cargo_capacity: 1;
weight: 43 ton;
tractive_effort_coefficient: 0;
air_drag_coefficient: 0;
length: 8;
effect_spawn_model_and_powered: EFFECT_SPAWN_MODEL_NONE;
extra_weight_per_wagon: 0;
bitmask_vehicle_info: 0;
cargo_age_period: 185;
}
graphics {
can_attach_wagon: CB_RESULT_ATTACH_ALLOW;
default: sw_BRMk4DVT_Sprites;
colour_mapping: return PALETTE_CC_FIRST;
cargo_subtype_text: sw_BR91_cargo_subtype_text;
purchase: spriteset_BRMk4DVT_purchase;
speed: 160;
cargo_capacity: return(0);
cost_factor: return(GetAdjustedCost(52));
running_cost_factor: return(GetAdjustedCost(17));
}
}


/* switch(FEAT_TRAINS, SELF, test, [STORE_TEMP(0 - pos_in_articulated_veh, 0x10F), var[0x61, 0, 0x0000FFFF, 0xC6]]) {
1: do something if other train's ID is 1
}

0xC6 vehicle ID
0xF2 cargo_subtype

[STORE_TEMP(position_in_consist_from_end , 0x10F),

TEMP[0x10F] var(0x61, param=0xF2, shift=0, and=0xFF)

*/

0 comments on commit deb84bb

Please sign in to comment.