Loading

Paste #pmvv7kwdo

  1. // add the units to articulated consist
  2. switch (FEAT_TRAINS, SELF, peasweep_articulated_cb_switch, extra_callback_info1) {
  3.         0: return peasweep;
  4.         1: return peasweep_1;
  5.   return CB_RESULT_NO_MORE_ARTICULATED_PARTS;
  6. }
  7. // default spriteset templates
  8.         template spriteset_template_asymmetric_unreversed_peasweep_unflipped(y) {
  9.                 //[left_x, upper_y, width, height, offset_x, offset_y]
  10.                 [60, y, 8, 29, -3, -16 ]
  11.                 [73, y, 26, 24, -10, -18 ]
  12.                 [104, y, 33, 16, -8, -12 ]
  13.                 [143, y, 26, 24, -4, -16 ]
  14.                 [180, y, 8, 29, -3, -14 ]
  15.                 [193, y, 26, 24, -14, -16 ]
  16.                 [224, y, 33, 16, -16, -12 ]
  17.                 [263, y, 26, 24, -8, -19 ]
  18.         }
  19.         template spriteset_template_asymmetric_reversed_peasweep_unflipped(y) {
  20.                 //[left_x, upper_y, width, height, offset_x, offset_y]
  21.                 [180, y, 8, 29, -3, -16 ]
  22.                 [193, y, 26, 24, -10, -18 ]
  23.                 [224, y, 33, 16, -8, -12 ]
  24.                 [263, y, 26, 24, -4, -16 ]
  25.                 [60, y, 8, 29, -3, -14 ]
  26.                 [73, y, 26, 24, -14, -16 ]
  27.                 [104, y, 33, 16, -16, -12 ]
  28.                 [143, y, 26, 24, -8, -19 ]
  29.         }
  30.         template spriteset_template_asymmetric_unreversed_peasweep_flipped(y) {
  31.                 //[left_x, upper_y, width, height, offset_x, offset_y]
  32.                 [60, y, 8, 29, -3, -14 ]
  33.                 [73, y, 26, 24, -14, -16 ]
  34.                 [104, y, 33, 16, -16, -12 ]
  35.                 [143, y, 26, 24, -8, -19 ]
  36.                 [180, y, 8, 29, -3, -16 ]
  37.                 [193, y, 26, 24, -10, -18 ]
  38.                 [224, y, 33, 16, -8, -12 ]
  39.                 [263, y, 26, 24, -4, -16 ]
  40.         }
  41.         template spriteset_template_asymmetric_reversed_peasweep_flipped(y) {
  42.                 //[left_x, upper_y, width, height, offset_x, offset_y]
  43.                 [180, y, 8, 29, -3, -14 ]
  44.                 [193, y, 26, 24, -14, -16 ]
  45.                 [224, y, 33, 16, -16, -12 ]
  46.                 [263, y, 26, 24, -8, -19 ]
  47.                 [60, y, 8, 29, -3, -16 ]
  48.                 [73, y, 26, 24, -10, -18 ]
  49.                 [104, y, 33, 16, -8, -12 ]
  50.                 [143, y, 26, 24, -4, -16 ]
  51.         }
  52. // buy menu spriteset template
  53. template spriteset_template_purchase_peasweep(y) {
  54.     //[left_x,  upper_y,    width,      height,     offset_x,      offset_y]
  55.     [60,    10, 1, 1, 0, 0]
  56.     [60,    10, 1, 1, 0, 0]
  57.     [107,   10, 1, 1, 0, 0]
  58.     [60,    10, 1, 1, 0, 0]
  59.     [60,    10, 1, 1, 0, 0]
  60.     [60,    10, 1, 1, 0, 0]
  61.     // allow for buffers/couplings being 1px additional to the unit (they overlap in consists, but show in buy menu)
  62.     [360, y, 49, 16, -24, -11 ]
  63.     [60,    10, 1, 1, 0, 0]
  64. }
  65. // default graphics chain
  66.         spriteset(peasweep_ss_unreversed_unflipped, "generated/graphics/peasweep.png") {
  67.           spriteset_template_asymmetric_unreversed_peasweep_unflipped(10 + 0)
  68.         }
  69.             spriteset(peasweep_ss_pantographs_down_unreversed_unflipped, "generated/graphics/peasweep_pantographs.png") {
  70.               spriteset_template_asymmetric_unreversed_peasweep_unflipped(10 + 0)
  71.             }
  72.             spriteset(peasweep_ss_pantographs_up_unreversed_unflipped, "generated/graphics/peasweep_pantographs.png") {
  73.               spriteset_template_asymmetric_unreversed_peasweep_unflipped(40 + 0)
  74.             }
  75.             switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_pantographs_unreversed_unflipped, current_railtype) {
  76.                 ELRL: return peasweep_ss_pantographs_up_unreversed_unflipped;
  77.                 return peasweep_ss_pantographs_down_unreversed_unflipped;
  78.             }
  79.         switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_vehicle_layers_unreversed_unflipped, getbits(extra_callback_info1, 8, 8)) {
  80.             0: return peasweep_ss_unreversed_unflipped;
  81.                 1: return peasweep_switch_graphics_pantographs_unreversed_unflipped;
  82.         }
  83.         spriteset(peasweep_ss_unreversed_flipped, "generated/graphics/peasweep.png") {
  84.           spriteset_template_asymmetric_unreversed_peasweep_flipped(10 + 0)
  85.         }
  86.             spriteset(peasweep_ss_pantographs_down_unreversed_flipped, "generated/graphics/peasweep_pantographs.png") {
  87.               spriteset_template_asymmetric_unreversed_peasweep_flipped(10 + 0)
  88.             }
  89.             spriteset(peasweep_ss_pantographs_up_unreversed_flipped, "generated/graphics/peasweep_pantographs.png") {
  90.               spriteset_template_asymmetric_unreversed_peasweep_flipped(40 + 0)
  91.             }
  92.             switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_pantographs_unreversed_flipped, current_railtype) {
  93.                 ELRL: return peasweep_ss_pantographs_up_unreversed_flipped;
  94.                 return peasweep_ss_pantographs_down_unreversed_flipped;
  95.             }
  96.         switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_vehicle_layers_unreversed_flipped, getbits(extra_callback_info1, 8, 8)) {
  97.             0: return peasweep_ss_unreversed_flipped;
  98.                 1: return peasweep_switch_graphics_pantographs_unreversed_flipped;
  99.         }
  100.     // handle user flipped state
  101.     switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_unreversed, vehicle_is_flipped) {
  102.         1: return peasweep_switch_graphics_vehicle_layers_unreversed_flipped;
  103.         return peasweep_switch_graphics_vehicle_layers_unreversed_unflipped;
  104.     }
  105. random_switch (FEAT_TRAINS, FORWARD_SELF(0), peasweep_switch_graphics_vehicle) {
  106.         1: return peasweep_switch_graphics_unreversed;
  107. }
  108. // buy menu graphics chain
  109. spriteset(peasweep_ss_purchase, "generated/graphics/peasweep.png") {
  110.   spriteset_template_purchase_peasweep(10)
  111. }
  112. switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_purchase, 0) {
  113.     return peasweep_ss_purchase;
  114. }
  115. switch (FEAT_TRAINS, SELF, peasweep_switch_set_layers_register_more_sprites, STORE_TEMP(CB_FLAG_MORE_SPRITES | PALETTE_USE_DEFAULT, 0x100)) {
  116.     return peasweep_switch_graphics_vehicle;
  117. }
  118. switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_rear_light, position_in_consist_from_end) {
  119.     0: return ss_rear_light_24px;
  120.     return ss_rear_light_empty;
  121. }
  122. switch (FEAT_TRAINS, SELF, peasweep_switch_graphics_layer_rear_light, STORE_TEMP(PALETTE_USE_DEFAULT, 0x100)) {
  123.     return peasweep_switch_graphics_rear_light;
  124. }
  125. switch (FEAT_TRAINS, SELF, peasweep_switch_graphics, getbits(extra_callback_info1, 8, 8)) {
  126.     0: return peasweep_switch_set_layers_register_more_sprites;
  127.         1: return peasweep_switch_set_layers_register_more_sprites;
  128.     return peasweep_switch_graphics_layer_rear_light;
  129. }
  130.     // -- smoke etc -- //
  131.     switch (FEAT_TRAINS, SELF, peasweep_switch_visual_effect_and_powered_by_variant_unreversed, current_railtype) {
  132.         return visual_effect_and_powered(VISUAL_EFFECT_ELECTRIC, 0, DISABLE_WAGON_POWER);
  133.     }
  134. item(FEAT_TRAINS, peasweep, 1750) {
  135.     property {
  136.         name:                           string(STR_NAME_CONSIST_PARENTHESES, string(STR_NAME_peasweep), string(STR_NAME_SUFFIX_ELECTRIC));
  137.         climates_available:             NO_CLIMATE; // nml constant
  138.         engine_class:                   ENGINE_CLASS_ELECTRIC;
  139.         visual_effect_and_powered:      visual_effect_and_powered(VISUAL_EFFECT_DISABLE, 0, DISABLE_WAGON_POWER);
  140.         introduction_date:              date(1947,01,01); // consist just supplies intro year - openttd randomises intro dates a bit anyway
  141.         cargo_capacity:                 0;
  142.         sprite_id:                      SPRITE_ID_NEW_TRAIN; //enable new graphics - nml constant
  143.         power:                          3600hp;
  144.             speed:                          75mph;
  145.         weight:                         150ton;
  146.         tractive_effort_coefficient:    0.3;
  147.         cost_factor:                    0; // use the CB to set this, the prop is capped to max 255, cb is 32k
  148.         running_cost_base:              RUNNING_COST_ELECTRIC;
  149.         running_cost_factor:            0; // use the CB to set this, the prop is capped to max 255, cb is 32k
  150.         refit_cost:                     0; // btw this needs to be 0 if we want autorefit without using cb
  151.         refittable_cargo_classes:       bitmask();
  152.         non_refittable_cargo_classes:   bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support
  153.         cargo_allow_refit:              [];
  154.         cargo_disallow_refit:           [];
  155.         cargo_age_period:               185;
  156.         misc_flags:                     bitmask(TRAIN_FLAG_2CC,TRAIN_FLAG_SPRITE_STACK,TRAIN_FLAG_AUTOREFIT); // nml constants
  157.         dual_headed:                    0;
  158.         model_life:                     48;
  159.         retire_early:                   -10;
  160.         reliability_decay:              20; // default value
  161.         vehicle_life:                   40;
  162.         length:                         6;
  163.         track_type:                     ELRL;
  164.     }
  165.     graphics {
  166.         default:                        peasweep_switch_graphics;
  167.         purchase:                       peasweep_switch_graphics_purchase;
  168.         cost_factor:                    121; // CB used as it is capped to max 32k, prop is only 255
  169.         running_cost_factor:            87; // CB used as it is capped to max 32k, prop is only 255
  170.             visual_effect_and_powered:      peasweep_switch_visual_effect_and_powered_by_variant_unreversed;
  171.             articulated_part: peasweep_articulated_cb_switch;
  172.     }
  173. }
  174.     if (param[1]==0) {
  175.         item(FEAT_TRAINS, peasweep, 1750) {
  176.             property {
  177.                 climates_available:             ALL_CLIMATES;
  178.             }
  179.         }
  180.     }
  181. // -- end 1750 --
  182. // default spriteset templates
  183.         template spriteset_template_asymmetric_unreversed_peasweep_1_unflipped(y) {
  184.                 //[left_x, upper_y, width, height, offset_x, offset_y]
  185.                 [60, y, 8, 29, -3, -16 ]
  186.                 [73, y, 26, 24, -10, -18 ]
  187.                 [104, y, 33, 16, -8, -12 ]
  188.                 [143, y, 26, 24, -4, -16 ]
  189.                 [180, y, 8, 29, -3, -14 ]
  190.                 [193, y, 26, 24, -14, -16 ]
  191.                 [224, y, 33, 16, -16, -12 ]
  192.                 [263, y, 26, 24, -8, -19 ]
  193.         }
  194.         template spriteset_template_asymmetric_reversed_peasweep_1_unflipped(y) {
  195.                 //[left_x, upper_y, width, height, offset_x, offset_y]
  196.                 [180, y, 8, 29, -3, -16 ]
  197.                 [193, y, 26, 24, -10, -18 ]
  198.                 [224, y, 33, 16, -8, -12 ]
  199.                 [263, y, 26, 24, -4, -16 ]
  200.                 [60, y, 8, 29, -3, -14 ]
  201.                 [73, y, 26, 24, -14, -16 ]
  202.                 [104, y, 33, 16, -16, -12 ]
  203.                 [143, y, 26, 24, -8, -19 ]
  204.         }
  205.         template spriteset_template_asymmetric_unreversed_peasweep_1_flipped(y) {
  206.                 //[left_x, upper_y, width, height, offset_x, offset_y]
  207.                 [60, y, 8, 29, -3, -14 ]
  208.                 [73, y, 26, 24, -14, -16 ]
  209.                 [104, y, 33, 16, -16, -12 ]
  210.                 [143, y, 26, 24, -8, -19 ]
  211.                 [180, y, 8, 29, -3, -16 ]
  212.                 [193, y, 26, 24, -10, -18 ]
  213.                 [224, y, 33, 16, -8, -12 ]
  214.                 [263, y, 26, 24, -4, -16 ]
  215.         }
  216.         template spriteset_template_asymmetric_reversed_peasweep_1_flipped(y) {
  217.                 //[left_x, upper_y, width, height, offset_x, offset_y]
  218.                 [180, y, 8, 29, -3, -14 ]
  219.                 [193, y, 26, 24, -14, -16 ]
  220.                 [224, y, 33, 16, -16, -12 ]
  221.                 [263, y, 26, 24, -8, -19 ]
  222.                 [60, y, 8, 29, -3, -16 ]
  223.                 [73, y, 26, 24, -10, -18 ]
  224.                 [104, y, 33, 16, -8, -12 ]
  225.                 [143, y, 26, 24, -4, -16 ]
  226.         }
  227. // buy menu spriteset template
  228. template spriteset_template_purchase_peasweep_1(y) {
  229.     //[left_x,  upper_y,    width,      height,     offset_x,      offset_y]
  230.     [60,    10, 1, 1, 0, 0]
  231.     [60,    10, 1, 1, 0, 0]
  232.     [107,   10, 1, 1, 0, 0]
  233.     [60,    10, 1, 1, 0, 0]
  234.     [60,    10, 1, 1, 0, 0]
  235.     [60,    10, 1, 1, 0, 0]
  236.     // allow for buffers/couplings being 1px additional to the unit (they overlap in consists, but show in buy menu)
  237.     [360, y, 49, 16, -24, -11 ]
  238.     [60,    10, 1, 1, 0, 0]
  239. }
  240. // default graphics chain
  241.         spriteset(peasweep_1_ss_unreversed_unflipped, "generated/graphics/peasweep.png") {
  242.           spriteset_template_asymmetric_unreversed_peasweep_1_unflipped(10 + 0)
  243.         }
  244.             spriteset(peasweep_1_ss_pantographs_down_unreversed_unflipped, "generated/graphics/peasweep_pantographs.png") {
  245.               spriteset_template_asymmetric_unreversed_peasweep_1_unflipped(10 + 0)
  246.             }
  247.             spriteset(peasweep_1_ss_pantographs_up_unreversed_unflipped, "generated/graphics/peasweep_pantographs.png") {
  248.               spriteset_template_asymmetric_unreversed_peasweep_1_unflipped(40 + 0)
  249.             }
  250.             switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_pantographs_unreversed_unflipped, current_railtype) {
  251.                 ELRL: return peasweep_1_ss_pantographs_up_unreversed_unflipped;
  252.                 return peasweep_1_ss_pantographs_down_unreversed_unflipped;
  253.             }
  254.         switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_vehicle_layers_unreversed_unflipped, getbits(extra_callback_info1, 8, 8)) {
  255.             0: return peasweep_1_ss_unreversed_unflipped;
  256.                 1: return peasweep_1_switch_graphics_pantographs_unreversed_unflipped;
  257.         }
  258.         spriteset(peasweep_1_ss_unreversed_flipped, "generated/graphics/peasweep.png") {
  259.           spriteset_template_asymmetric_unreversed_peasweep_1_flipped(10 + 0)
  260.         }
  261.             spriteset(peasweep_1_ss_pantographs_down_unreversed_flipped, "generated/graphics/peasweep_pantographs.png") {
  262.               spriteset_template_asymmetric_unreversed_peasweep_1_flipped(10 + 0)
  263.             }
  264.             spriteset(peasweep_1_ss_pantographs_up_unreversed_flipped, "generated/graphics/peasweep_pantographs.png") {
  265.               spriteset_template_asymmetric_unreversed_peasweep_1_flipped(40 + 0)
  266.             }
  267.             switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_pantographs_unreversed_flipped, current_railtype) {
  268.                 ELRL: return peasweep_1_ss_pantographs_up_unreversed_flipped;
  269.                 return peasweep_1_ss_pantographs_down_unreversed_flipped;
  270.             }
  271.         switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_vehicle_layers_unreversed_flipped, getbits(extra_callback_info1, 8, 8)) {
  272.             0: return peasweep_1_ss_unreversed_flipped;
  273.                 1: return peasweep_1_switch_graphics_pantographs_unreversed_flipped;
  274.         }
  275.     // handle user flipped state
  276.     switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_unreversed, vehicle_is_flipped) {
  277.         1: return peasweep_1_switch_graphics_vehicle_layers_unreversed_flipped;
  278.         return peasweep_1_switch_graphics_vehicle_layers_unreversed_unflipped;
  279.     }
  280. random_switch (FEAT_TRAINS, FORWARD_SELF(1), peasweep_1_switch_graphics_vehicle) {
  281.         1: return peasweep_1_switch_graphics_unreversed;
  282. }
  283. // buy menu graphics chain
  284. spriteset(peasweep_1_ss_purchase, "generated/graphics/peasweep.png") {
  285.   spriteset_template_purchase_peasweep_1(10)
  286. }
  287. switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_purchase, 0) {
  288.     return peasweep_1_ss_purchase;
  289. }
  290. switch (FEAT_TRAINS, SELF, peasweep_1_switch_set_layers_register_more_sprites, STORE_TEMP(CB_FLAG_MORE_SPRITES | PALETTE_USE_DEFAULT, 0x100)) {
  291.     return peasweep_1_switch_graphics_vehicle;
  292. }
  293. switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_rear_light, position_in_consist_from_end) {
  294.     0: return ss_rear_light_24px;
  295.     return ss_rear_light_empty;
  296. }
  297. switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics_layer_rear_light, STORE_TEMP(PALETTE_USE_DEFAULT, 0x100)) {
  298.     return peasweep_1_switch_graphics_rear_light;
  299. }
  300. switch (FEAT_TRAINS, SELF, peasweep_1_switch_graphics, getbits(extra_callback_info1, 8, 8)) {
  301.     0: return peasweep_1_switch_set_layers_register_more_sprites;
  302.         1: return peasweep_1_switch_set_layers_register_more_sprites;
  303.     return peasweep_1_switch_graphics_layer_rear_light;
  304. }
  305.     // -- smoke etc -- //
  306.     switch (FEAT_TRAINS, SELF, peasweep_1_switch_visual_effect_and_powered_by_variant_unreversed, current_railtype) {
  307.         return visual_effect_and_powered(VISUAL_EFFECT_ELECTRIC, 0, DISABLE_WAGON_POWER);
  308.     }
  309. item(FEAT_TRAINS, peasweep_1, 1751) {
  310.     property {
  311.         name:                           string(STR_NAME_CONSIST_PARENTHESES, string(STR_NAME_peasweep), string(STR_NAME_SUFFIX_ELECTRIC));
  312.         climates_available:             NO_CLIMATE; // nml constant
  313.         engine_class:                   ENGINE_CLASS_ELECTRIC;
  314.         visual_effect_and_powered:      visual_effect_and_powered(VISUAL_EFFECT_DISABLE, 0, DISABLE_WAGON_POWER);
  315.         introduction_date:              date(1947,01,01); // consist just supplies intro year - openttd randomises intro dates a bit anyway
  316.         cargo_capacity:                 0;
  317.         sprite_id:                      SPRITE_ID_NEW_TRAIN; //enable new graphics - nml constant
  318.         power:                          3600hp;
  319.             speed:                          75mph;
  320.         weight:                         150ton;
  321.         tractive_effort_coefficient:    0.3;
  322.         cost_factor:                    0; // use the CB to set this, the prop is capped to max 255, cb is 32k
  323.         running_cost_base:              RUNNING_COST_ELECTRIC;
  324.         running_cost_factor:            0; // use the CB to set this, the prop is capped to max 255, cb is 32k
  325.         refit_cost:                     0; // btw this needs to be 0 if we want autorefit without using cb
  326.         refittable_cargo_classes:       bitmask();
  327.         non_refittable_cargo_classes:   bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support
  328.         cargo_allow_refit:              [];
  329.         cargo_disallow_refit:           [];
  330.         cargo_age_period:               185;
  331.         misc_flags:                     bitmask(TRAIN_FLAG_2CC,TRAIN_FLAG_SPRITE_STACK,TRAIN_FLAG_AUTOREFIT); // nml constants
  332.         dual_headed:                    0;
  333.         model_life:                     48;
  334.         retire_early:                   -10;
  335.         reliability_decay:              20; // default value
  336.         vehicle_life:                   40;
  337.         length:                         6;
  338.         track_type:                     ELRL;
  339.     }
  340.     graphics {
  341.         default:                        peasweep_1_switch_graphics;
  342.         purchase:                       peasweep_1_switch_graphics_purchase;
  343.         cost_factor:                    121; // CB used as it is capped to max 32k, prop is only 255
  344.         running_cost_factor:            87; // CB used as it is capped to max 32k, prop is only 255
  345.             visual_effect_and_powered:      peasweep_1_switch_visual_effect_and_powered_by_variant_unreversed;
  346.     }
  347. }
  348. // -- end 1751 --

Comments