You will notice that the ids are not correlative because I only take the parts corresponding to the TGV Sud Est Orange. (actually in the complete code I have all the locomotives first and then the cars)
I am going to post the code in several posts since the forum does not allow me in just one.
Code: Select all
//================================================================================================================================================================
//====== ========
//====== TGV Sud Est Orange Locomotive ========
//====== ========
//================================================================================================================================================================
//Front Part Template 1 of 3
template template_realtrains1_frontpart(x) {
//[left_x, upper_y, width, height, offset_x, offset_y]
[0, 320*x, 400, 320, -196, -102]
[400, 320*x, 400, 320, -251, -126]
[800, 320*x, 400, 320, -280, -151]
[1200, 320*x, 400, 320, -219, -165]
[1600, 320*x, 400, 320, -196, -174]
[2000, 320*x, 400, 320, -179, -162]
[2400, 320*x, 400, 320, -120, -151]
[2800, 320*x, 400, 320, -147, -129]
}
spriteset(spriteset_realtrains1_frontpart_0, "gfx/PLACEHOLDER.png") {
template_PLACEHOLDER()
}
alternative_sprites(spriteset_realtrains1_frontpart_0, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/tgv_locomotives.png") {
template_realtrains1_frontpart(0)
}
spritegroup sgroup_realtrains1_frontpart_0 {
loaded: [spriteset_realtrains1_frontpart_0];
loading: [spriteset_realtrains1_frontpart_0];
}
switch(FEAT_TRAINS, SELF, item_realtrains1_frontpart_0_height_switch, ((var[0x62, 24, 0x000000FF, -1 - (-1)] - var[0x62, 24, 0x000000FF, -0 - (-1)]) & 0xFF) << 8 | ((var[0x62, 24, 0x000000FF, -0 - (-1)] - var[0x62, 24, 0x000000FF, 1 - (-1)]) & 0xFF)) {
0 : sgroup_realtrains1_frontpart_0;
spriteset_invisible;
}
switch(FEAT_TRAINS, SELF, item_realtrains1_frontpart_0_direction_switch, ((var[0x62, 0, 0x0000000F, -1 - (-1)] - var[0x62, 0, 0x0000000F, -0 - (-1)]) & 0xF) << 8 | ((var[0x62, 0, 0x0000000F, -0 - (-1)] - var[0x62, 0, 0x0000000F, 1 - (-1)]) & 0xF)) {
0x00000000: item_realtrains1_frontpart_0_height_switch;
spriteset_invisible;
}
switch (FEAT_TRAINS, SELF, switch_realtrains1_frontpart_0, cargo_type_in_veh){
PASS: item_realtrains1_frontpart_0_direction_switch;
item_realtrains1_frontpart_0_direction_switch;
}
// ------------------------------ Back Part ----------------------------------
template template_realtrains1_backpart(x) {
//[left_x, upper_y, width, height, offset_x, offset_y]
[0, 320*x, 400, 320, -196, -198]
[400, 320*x, 400, 320, -155, -174]
[800, 320*x, 400, 320, -88, -151]
[1200, 320*x, 400, 320, -124, -117]
[1600, 320*x, 400, 320, -196, -78]
[2000, 320*x, 400, 320, -275, -114]
[2400, 320*x, 400, 320, -312, -151]
[2800, 320*x, 400, 320, -243, -177]
}
spriteset(spriteset_realtrains1_backpart_0, "gfx/PLACEHOLDER.png") {
template_PLACEHOLDER()
}
alternative_sprites(spriteset_realtrains1_backpart_0, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/tgv_locomotives.png") {
template_realtrains1_backpart(0)
}
spritegroup sgroup_realtrains1_backpart_0 {
loaded: [spriteset_realtrains1_backpart_0];
loading: [spriteset_realtrains1_backpart_0];
}
switch(FEAT_TRAINS, SELF, item_realtrains1_backpart_0_height_switch, ((var[0x62, 24, 0x000000FF, -1 - (1)] - var[0x62, 24, 0x000000FF, -0 - (1)]) & 0xFF) << 8 | ((var[0x62, 24, 0x000000FF, -0 - (1)] - var[0x62, 24, 0x000000FF, 1 - (1)]) & 0xFF)) {
0 : sgroup_realtrains1_backpart_0;
spriteset_invisible;
}
switch(FEAT_TRAINS, SELF, item_realtrains1_backpart_0_direction_switch, ((var[0x62, 0, 0x0000000F, -1 - (1)] - var[0x62, 0, 0x0000000F, -0 - (1)]) & 0xF) << 8 | ((var[0x62, 0, 0x0000000F, -0 - (1)] - var[0x62, 0, 0x0000000F, 1 - (1)]) & 0xF)) {
0x00000000: item_realtrains1_backpart_0_height_switch;
spriteset_invisible;
}
switch (FEAT_TRAINS, SELF, switch_realtrains1_backpart_0, cargo_type_in_veh){
PASS: item_realtrains1_backpart_0_direction_switch;
item_realtrains1_backpart_0_direction_switch;
}
item (FEAT_TRAINS, item_realtrains1_backpart) {
property {
name: string(STR_NAME_INVISIBLE);
sprite_id: SPRITE_ID_NEW_TRAIN;
climates_available: NO_CLIMATE; //Climas
introduction_date: date(1700, 1, 1); //Fecha Creacion
model_life: VEHICLE_NEVER_EXPIRES; //Vida del vehiculo
vehicle_life: 200; //Vida util antes del reemplazo
reliability_decay: 0; //Confiabilidad según la edad, 0: la confiabilidad no disminuye con la edad
refittable_cargo_classes: bitmask(CC_PASSENGERS); //Ver tabla de cargas
non_refittable_cargo_classes: bitmask();
cost_factor: 0; //Precio de compra
running_cost_base: RUNNING_COST_NONE; //Costo de funcionamiento base
running_cost_factor: 0; //Aumenta costo de funcionamiento segun antiguedad
refit_cost: 0;
loading_speed: 100;
speed: 300 km/h;
length: 5;
track_type: RAIL; //Segun rail type table
power: 0; //vagon=0
dual_headed: 0; //1= doble cabina
weight: 385 ton; //Peso del vagon vacio
cargo_capacity: 1;
ai_special_flag: AI_FLAG_PASSENGER;
ai_engine_rank: 3; //Que tan bueno es
extra_power_per_wagon: 0 kW;
tractive_effort_coefficient: 1; //coeficiente de fricción de adhesión - no cambiar
air_drag_coefficient: 0; //resistencia del aire - cálculo 8/velocidad máxima
visual_effect_and_powered: VISUAL_EFFECT_DISABLE;
extra_weight_per_wagon: 0 ton;
bitmask_vehicle_info: 0;
}
graphics {
default: switch_realtrains1_backpart_0; // default graphic
cargo_capacity: return 0;
}
}
// ------------------------------ Middle Part ----------------------------------
template template_realtrains1_middlepart(x) {
//[left_x, upper_y, width, height, offset_x, offset_y]
[0, 320*x, 400, 320, -196, -142]
[400, 320*x, 400, 320, -211, -146]
[800, 320*x, 400, 320, -200, -151]
[1200, 320*x, 400, 320, -179, -145]
[1600, 320*x, 400, 320, -196, -134]
[2000, 320*x, 400, 320, -219, -142]
[2400, 320*x, 400, 320, -200, -151]
[2800, 320*x, 400, 320, -187, -149]
}
template template_realtrains1_middlepart_cut(x) {
//[left_x, upper_y, width, height, offset_x, offset_y]
[0, 320*x, 400, 320, -196, -142]
[400, 320*x, 400, 320, -211, -146]
[800, 320*x, 400, 320, -200, -151]
[1200, 320*x, 400, 320, -179, -145]
[1600, 320*x, 400, 320, -196, -134]
[2000, 320*x, 400, 320, -219, -142]
[2400, 320*x, 400, 320, -200, -151]
[2800, 320*x, 400, 320, -187, -149]
}
spriteset(spriteset_realtrains1_middlepart_0, "gfx/PLACEHOLDER.png") {
template_PLACEHOLDER()
}
alternative_sprites(spriteset_realtrains1_middlepart_0, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/tgv_locomotives.png") {
template_realtrains1_middlepart(0)
}
//Cut
spriteset(spriteset_realtrains1_middlepart_0_cut, "gfx/PLACEHOLDER.png") {
template_PLACEHOLDER()
}
alternative_sprites(spriteset_realtrains1_middlepart_0_cut, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/tgv_locomotives.png") {
template_realtrains1_middlepart_cut(0)
}
spritegroup sgroup_realtrains1_middlepart_0 {
loaded: [spriteset_realtrains1_middlepart_0];
loading: [spriteset_realtrains1_middlepart_0];
}
spritegroup sgroup_realtrains1_middlepart_0_cut {
loaded: [spriteset_realtrains1_middlepart_0_cut];
loading: [spriteset_realtrains1_middlepart_0_cut];
}
switch(FEAT_TRAINS, SELF, item_realtrains1_middlepart_0_height_switch, ((var[0x62, 24, 0x000000FF, -1 - (0)] - var[0x62, 24, 0x000000FF, -0 - (0)]) & 0xFF) << 8 | ((var[0x62, 24, 0x000000FF, -0 - (0)] - var[0x62, 24, 0x000000FF, 1 - (0)]) & 0xFF)) {
0 : sgroup_realtrains1_middlepart_0_cut;
sgroup_realtrains1_middlepart_0;
}
switch(FEAT_TRAINS, SELF, item_realtrains1_middlepart_0_direction_switch, ((var[0x62, 0, 0x0000000F, -1 - (0)] - var[0x62, 0, 0x0000000F, -0 - (0)]) & 0xF) << 8 | ((var[0x62, 0, 0x0000000F, -0 - (0)] - var[0x62, 0, 0x0000000F, 1 - (0)]) & 0xF)) {
0x00000000: item_realtrains1_middlepart_0_height_switch;
sgroup_realtrains1_middlepart_0;
}
switch (FEAT_TRAINS, SELF, switch_realtrains1_middlepart_0, cargo_type_in_veh){
PASS: item_realtrains1_middlepart_0_direction_switch;
item_realtrains1_middlepart_0_direction_switch;
}
item (FEAT_TRAINS, item_realtrains1_middlepart) {
property {
name: string(STR_NAME_INVISIBLE);
sprite_id: SPRITE_ID_NEW_TRAIN;
climates_available: NO_CLIMATE;
introduction_date: date(1700, 1, 1);
model_life: VEHICLE_NEVER_EXPIRES;
vehicle_life: 200;
reliability_decay: 0;
refittable_cargo_classes: bitmask(CC_PASSENGERS);
non_refittable_cargo_classes: bitmask();
cost_factor: 0;
running_cost_base: RUNNING_COST_NONE;
running_cost_factor: 0;
refit_cost: 0;
loading_speed: 100;
speed: 300 km/h;
length: 7;
track_type: RAIL;
power: 0 kW;
dual_headed: 0;
weight: 0 ton;
cargo_capacity: 1;
ai_special_flag: AI_FLAG_PASSENGER;
ai_engine_rank: 3;
extra_power_per_wagon: 0 kW;
tractive_effort_coefficient: 1;
air_drag_coefficient: 0;
visual_effect_and_powered: visual_effect_and_powered(VISUAL_EFFECT_ELECTRIC, -6, DISABLE_WAGON_POWER);
extra_weight_per_wagon: 0 ton;
bitmask_vehicle_info: 0;
}
graphics {
default: switch_realtrains1_middlepart_0; // default graphic
cargo_capacity: return 0;
}
}
// TGV Sud Est Orange Locomotive (final item)
//-----Purchase-----
spriteset(spriteset_realtrains1_purchase, "gfx/PLACEHOLDER.png") {[0,0,1,1,0,0]}
alternative_sprites(spriteset_realtrains1_purchase, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/tgv_locomotives.png") {[2400,0,400,320,-200,-164]}
switch (FEAT_TRAINS, SELF, switch_articulated_realtrains1, extra_callback_info1) {
1: return item_realtrains1_middlepart;
2: return item_realtrains1_backpart;
return CB_RESULT_NO_MORE_ARTICULATED_PARTS; //stop adding vehicle parts
}
item(FEAT_TRAINS, item_realtrains1) {
property {
name: string(STR_NAME_realtrains1);
sprite_id: SPRITE_ID_NEW_TRAIN;
climates_available: ALL_CLIMATES;
introduction_date: date(1978, 1, 1);
model_life: VEHICLE_NEVER_EXPIRES;
vehicle_life: 30;
reliability_decay: 0;
refittable_cargo_classes: bitmask(CC_PASSENGERS);
non_refittable_cargo_classes: bitmask();
cost_factor: 49;
running_cost_base: RUNNING_COST_ELECTRIC;
running_cost_factor: 47;
refit_cost: 10;
loading_speed: 18;
speed: 300 km/h;
length: 5;
track_type: RAIL;
power: 6450 kW;
cargo_capacity: 98;
dual_headed: 0;
weight: 385 ton;
ai_special_flag: AI_FLAG_PASSENGER;
ai_engine_rank: 2;
engine_class: ENGINE_CLASS_ELECTRIC;
extra_power_per_wagon: 0 kW;
tractive_effort_coefficient: 1;
air_drag_coefficient: 0;
visual_effect_and_powered: VISUAL_EFFECT_DISABLE;
extra_weight_per_wagon: 0 ton;
bitmask_vehicle_info: 0;
}
graphics {
default: switch_realtrains1_frontpart_0;
articulated_part: switch_articulated_realtrains1;
purchase: spriteset_realtrains1_purchase;
additional_text: return string(STR_DESC_realtrains1);
sound_effect: locomotive_sound_switch;
}
}