Loading

Paste #pgncfvpdb

  1. // buy menu spriteset template
  2. template spriteset_template_purchase_vehicle_transporter_car_pony_gen_5C(y) {
  3.             //[left_x,  upper_y,    width,      height,     offset_x,      offset_y]
  4.             [60,    10, 1, 1, 0, 0]
  5.             [60,    10, 1, 1, 0, 0]
  6.             [60,    10, 1, 1, 0, 0]
  7.             [60,    10, 1, 1, 0, 0]
  8.             [60,    10, 1, 1, 0, 0]
  9.             [60,    10, 1, 1, 0, 0]
  10.             // allow for buffers/couplings being 1px additional to the unit (they overlap in consists, but show in buy menu)
  11.             [224, y, 33, 16, -16, -11 ]
  12.             [60,    10, 1, 1, 0, 0]
  13. }
  14.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_empty_unflipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  15.       spriteset_template_symmetric_unreversed_8_8_unflipped(10)
  16.     }
  17.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_loading_0_unflipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  18.       spriteset_template_symmetric_unreversed_8_8_unflipped(40)
  19.     }
  20.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_loaded_0_unflipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  21.       spriteset_template_symmetric_unreversed_8_8_unflipped(70)
  22.     }
  23.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_loading_1_unflipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  24.       spriteset_template_symmetric_unreversed_8_8_unflipped(100)
  25.     }
  26.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_loaded_1_unflipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  27.       spriteset_template_symmetric_unreversed_8_8_unflipped(130)
  28.     }
  29.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_loading_2_unflipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  30.       spriteset_template_symmetric_unreversed_8_8_unflipped(160)
  31.     }
  32.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_loaded_2_unflipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  33.       spriteset_template_symmetric_unreversed_8_8_unflipped(190)
  34.     }
  35.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_empty_flipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  36.       spriteset_template_symmetric_unreversed_8_8_flipped(10)
  37.     }
  38.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_loading_0_flipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  39.       spriteset_template_symmetric_unreversed_8_8_flipped(40)
  40.     }
  41.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_loaded_0_flipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  42.       spriteset_template_symmetric_unreversed_8_8_flipped(70)
  43.     }
  44.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_loading_1_flipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  45.       spriteset_template_symmetric_unreversed_8_8_flipped(100)
  46.     }
  47.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_loaded_1_flipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  48.       spriteset_template_symmetric_unreversed_8_8_flipped(130)
  49.     }
  50.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_loading_2_flipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  51.       spriteset_template_symmetric_unreversed_8_8_flipped(160)
  52.     }
  53.     spriteset(vehicle_transporter_car_pony_gen_5C_ss_loaded_2_flipped, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  54.       spriteset_template_symmetric_unreversed_8_8_flipped(190)
  55.     }
  56.         switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_percent_loaded_0_unflipped, cargo_count*100/cargo_capacity) {
  57.                 0: return vehicle_transporter_car_pony_gen_5C_ss_empty_unflipped;
  58.                 1..99: return vehicle_transporter_car_pony_gen_5C_ss_loading_0_unflipped;
  59.             return vehicle_transporter_car_pony_gen_5C_ss_loaded_0_unflipped;
  60.         }
  61.         switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_percent_loaded_0_flipped, cargo_count*100/cargo_capacity) {
  62.                 0: return vehicle_transporter_car_pony_gen_5C_ss_empty_flipped;
  63.                 1..99: return vehicle_transporter_car_pony_gen_5C_ss_loading_0_flipped;
  64.             return vehicle_transporter_car_pony_gen_5C_ss_loaded_0_flipped;
  65.         }
  66.     // handle user flipped state
  67.     switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_flip_0, vehicle_is_flipped) {
  68.         1: return vehicle_transporter_car_pony_gen_5C_switch_graphics_percent_loaded_0_flipped;
  69.         return vehicle_transporter_car_pony_gen_5C_switch_graphics_percent_loaded_0_unflipped;
  70.     }
  71.         switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_percent_loaded_1_unflipped, cargo_count*100/cargo_capacity) {
  72.                 0: return vehicle_transporter_car_pony_gen_5C_ss_empty_unflipped;
  73.                 1..99: return vehicle_transporter_car_pony_gen_5C_ss_loading_1_unflipped;
  74.             return vehicle_transporter_car_pony_gen_5C_ss_loaded_1_unflipped;
  75.         }
  76.         switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_percent_loaded_1_flipped, cargo_count*100/cargo_capacity) {
  77.                 0: return vehicle_transporter_car_pony_gen_5C_ss_empty_flipped;
  78.                 1..99: return vehicle_transporter_car_pony_gen_5C_ss_loading_1_flipped;
  79.             return vehicle_transporter_car_pony_gen_5C_ss_loaded_1_flipped;
  80.         }
  81.     // handle user flipped state
  82.     switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_flip_1, vehicle_is_flipped) {
  83.         1: return vehicle_transporter_car_pony_gen_5C_switch_graphics_percent_loaded_1_flipped;
  84.         return vehicle_transporter_car_pony_gen_5C_switch_graphics_percent_loaded_1_unflipped;
  85.     }
  86.         switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_percent_loaded_2_unflipped, cargo_count*100/cargo_capacity) {
  87.                 0: return vehicle_transporter_car_pony_gen_5C_ss_empty_unflipped;
  88.                 1..99: return vehicle_transporter_car_pony_gen_5C_ss_loading_2_unflipped;
  89.             return vehicle_transporter_car_pony_gen_5C_ss_loaded_2_unflipped;
  90.         }
  91.         switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_percent_loaded_2_flipped, cargo_count*100/cargo_capacity) {
  92.                 0: return vehicle_transporter_car_pony_gen_5C_ss_empty_flipped;
  93.                 1..99: return vehicle_transporter_car_pony_gen_5C_ss_loading_2_flipped;
  94.             return vehicle_transporter_car_pony_gen_5C_ss_loaded_2_flipped;
  95.         }
  96.     // handle user flipped state
  97.     switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_flip_2, vehicle_is_flipped) {
  98.         1: return vehicle_transporter_car_pony_gen_5C_switch_graphics_percent_loaded_2_flipped;
  99.         return vehicle_transporter_car_pony_gen_5C_switch_graphics_percent_loaded_2_unflipped;
  100.     }
  101.         random_switch (FEAT_TRAINS, SELF,vehicle_transporter_car_pony_gen_5C_switch_graphics_ENSP, bitmask(TRIGGER_VEHICLE_NEW_LOAD)) {
  102.                 1: return vehicle_transporter_car_pony_gen_5C_switch_graphics_flip_2;
  103.         }
  104.         random_switch (FEAT_TRAINS, SELF,vehicle_transporter_car_pony_gen_5C_switch_graphics_FMSP, bitmask(TRIGGER_VEHICLE_NEW_LOAD)) {
  105.                 1: return vehicle_transporter_car_pony_gen_5C_switch_graphics_flip_1;
  106.                 1: return vehicle_transporter_car_pony_gen_5C_switch_graphics_flip_2;
  107.         }
  108.         random_switch (FEAT_TRAINS, SELF,vehicle_transporter_car_pony_gen_5C_switch_graphics_VEHI, bitmask(TRIGGER_VEHICLE_NEW_LOAD)) {
  109.                 1: return vehicle_transporter_car_pony_gen_5C_switch_graphics_flip_2;
  110.         }
  111. random_switch (FEAT_TRAINS, SELF,vehicle_transporter_car_pony_gen_5C_switch_graphics_generic_cargos, bitmask(TRIGGER_VEHICLE_NEW_LOAD)) {
  112.         1: return vehicle_transporter_car_pony_gen_5C_switch_graphics_flip_0;
  113. }
  114. switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_vehicle, cargo_type_in_veh) {
  115.             ENSP: return vehicle_transporter_car_pony_gen_5C_switch_graphics_ENSP;
  116.             FMSP: return vehicle_transporter_car_pony_gen_5C_switch_graphics_FMSP;
  117.             VEHI: return vehicle_transporter_car_pony_gen_5C_switch_graphics_VEHI;
  118.     return vehicle_transporter_car_pony_gen_5C_switch_graphics_generic_cargos;
  119. }
  120. // buy menu graphics chain
  121. spriteset(vehicle_transporter_car_pony_gen_5C_ss_purchase, "generated/graphics/vehicle_transporter_car_pony_gen_5C.png") {
  122.   spriteset_template_purchase_vehicle_transporter_car_pony_gen_5C(10)
  123. }
  124. switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_purchase, 0) {
  125.     return vehicle_transporter_car_pony_gen_5C_ss_purchase;
  126. }
  127. switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_set_layers_register_more_sprites, STORE_TEMP(CB_FLAG_MORE_SPRITES | PALETTE_USE_DEFAULT, 0x100)) {
  128.     return vehicle_transporter_car_pony_gen_5C_switch_graphics_vehicle;
  129. }
  130. switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_rear_light, position_in_consist_from_end) {
  131.     0: return ss_rear_light_32px;
  132.     return ss_rear_light_empty;
  133. }
  134. switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics_layer_rear_light, STORE_TEMP(PALETTE_USE_DEFAULT, 0x100)) {
  135.     return vehicle_transporter_car_pony_gen_5C_switch_graphics_rear_light;
  136. }
  137. switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_graphics, getbits(extra_callback_info1, 8, 8)) {
  138.     0: return vehicle_transporter_car_pony_gen_5C_switch_set_layers_register_more_sprites;
  139.     return vehicle_transporter_car_pony_gen_5C_switch_graphics_layer_rear_light;
  140. }
  141.     random_switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_colour_mapping_flipped) {
  142.         1: return base_sprite_2cc + 16 * company_colour2 + company_colour1;
  143.         1: return base_sprite_2cc + 16 * company_colour1 + company_colour2;
  144.     }
  145.     random_switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_colour_mapping_unflipped) {
  146.         1: return base_sprite_2cc + 16 * company_colour1 + company_colour2;
  147.         1: return base_sprite_2cc + 16 * company_colour2 + company_colour1;
  148.     }
  149.     // handle user flipped state
  150.     switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_colour_mapping, vehicle_is_flipped) {
  151.         1: return vehicle_transporter_car_pony_gen_5C_switch_colour_mapping_flipped;
  152.         return vehicle_transporter_car_pony_gen_5C_switch_colour_mapping_unflipped;
  153.     }
  154. // -- capacity determined according to specific labels that might need to be handled, and otherwise cargo class -- //
  155.     switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_cargo_capacity_by_cargo_0, cargo_classes & bitmask(CC_PASSENGERS, CC_MAIL, CC_ARMOURED)) {
  156.         bitmask(CC_MAIL): return 66;
  157.         bitmask(CC_ARMOURED): return 66;
  158.         return 33;
  159.     }
  160.     switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_cargo_capacity_by_cargo_1, cargo_classes & bitmask(CC_PASSENGERS, CC_MAIL, CC_ARMOURED)) {
  161.         bitmask(CC_MAIL): return 96;
  162.         bitmask(CC_ARMOURED): return 96;
  163.         return 48;
  164.     }
  165.     switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_cargo_capacity_by_cargo_2, cargo_classes & bitmask(CC_PASSENGERS, CC_MAIL, CC_ARMOURED)) {
  166.         bitmask(CC_MAIL): return 128;
  167.         bitmask(CC_ARMOURED): return 128;
  168.         return 64;
  169.     }
  170. switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_cargo_capacity, param[0]) {
  171.     0: vehicle_transporter_car_pony_gen_5C_switch_cargo_capacity_by_cargo_0;
  172.     1: vehicle_transporter_car_pony_gen_5C_switch_cargo_capacity_by_cargo_1;
  173.     2: vehicle_transporter_car_pony_gen_5C_switch_cargo_capacity_by_cargo_2;
  174. }
  175. // -- loading speed also determined by capacity, which varies by cargo -- //
  176.     switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_loading_speed_by_cargo_0, cargo_classes & bitmask(CC_PASSENGERS, CC_MAIL, CC_ARMOURED)) {
  177.         bitmask(CC_PASSENGERS): return 6;
  178.         bitmask(CC_MAIL): return 6;
  179.         bitmask(CC_ARMOURED): return 6;
  180.         return 6;
  181.     }
  182.     switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_loading_speed_by_cargo_1, cargo_classes & bitmask(CC_PASSENGERS, CC_MAIL, CC_ARMOURED)) {
  183.         bitmask(CC_PASSENGERS): return 8;
  184.         bitmask(CC_MAIL): return 8;
  185.         bitmask(CC_ARMOURED): return 8;
  186.         return 8;
  187.     }
  188.     switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_loading_speed_by_cargo_2, cargo_classes & bitmask(CC_PASSENGERS, CC_MAIL, CC_ARMOURED)) {
  189.         bitmask(CC_PASSENGERS): return 11;
  190.         bitmask(CC_MAIL): return 11;
  191.         bitmask(CC_ARMOURED): return 11;
  192.         return 11;
  193.     }
  194. switch (FEAT_TRAINS, SELF, vehicle_transporter_car_pony_gen_5C_switch_loading_speed, param[0]) {
  195.     0: vehicle_transporter_car_pony_gen_5C_switch_loading_speed_by_cargo_0;
  196.     1: vehicle_transporter_car_pony_gen_5C_switch_loading_speed_by_cargo_1;
  197.     2: vehicle_transporter_car_pony_gen_5C_switch_loading_speed_by_cargo_2;
  198. }
  199. item(FEAT_TRAINS, vehicle_transporter_car_pony_gen_5C, 3570) {
  200.     property {
  201.         name:                           string(STR_NAME_CONSIST_PARENTHESES, string(STR_NAME_SUFFIX_VEHICLE_TRANSPORTER_CAR), string(STR_NAME_SUFFIX_LARGE));
  202.         climates_available:             NO_CLIMATE; // nml constant
  203.         engine_class:                   ENGINE_CLASS_STEAM;
  204.         visual_effect_and_powered:      visual_effect_and_powered(VISUAL_EFFECT_DISABLE, 0, DISABLE_WAGON_POWER);
  205.         introduction_date:              date(1990, 11, 1);
  206.         cargo_capacity:                 48;
  207.         sprite_id:                      SPRITE_ID_NEW_TRAIN; //enable new graphics - nml constant
  208.         power:                          0hp;
  209.             speed:                          87mph;
  210.         weight:                         21ton;
  211.         tractive_effort_coefficient:    0.3;
  212.         cost_factor:                    0; // use the CB to set this, the prop is capped to max 255, cb is 32k
  213.         running_cost_base:              RUNNING_COST_DIESEL;
  214.         running_cost_factor:            0; // use the CB to set this, the prop is capped to max 255, cb is 32k
  215.         refit_cost:                     0; // btw this needs to be 0 if we want autorefit without using cb
  216.         refittable_cargo_classes:       bitmask();
  217.         non_refittable_cargo_classes:   bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support
  218.        cargo_allow_refit:              [VEHI,ENSP,FMSP];
  219.        cargo_disallow_refit:           [];
  220.        cargo_age_period:               185;
  221.            default_cargo_type:             VEHI;
  222.        misc_flags:                     bitmask(TRAIN_FLAG_2CC,TRAIN_FLAG_SPRITE_STACK,TRAIN_FLAG_FLIP,TRAIN_FLAG_AUTOREFIT); // nml constants
  223.        model_life:                     VEHICLE_NEVER_EXPIRES;
  224.        retire_early:                   -10;
  225.        reliability_decay:              20; // default value
  226.        vehicle_life:                   40;
  227.        length:                         8;
  228.        track_type:                     RAIL;
  229.    }
  230.    graphics {
  231.        default:                        vehicle_transporter_car_pony_gen_5C_switch_graphics;
  232.        purchase:                       vehicle_transporter_car_pony_gen_5C_switch_graphics_purchase;
  233.        cost_factor:                    144; // CB used as it is capped to max 32k, prop is only 255
  234.        running_cost_factor:            374; // CB used as it is capped to max 32k, prop is only 255
  235.            colour_mapping:                 vehicle_transporter_car_pony_gen_5C_switch_colour_mapping;
  236.            cargo_capacity:                 vehicle_transporter_car_pony_gen_5C_switch_cargo_capacity;
  237.            purchase_cargo_capacity:        vehicle_transporter_car_pony_gen_5C_switch_cargo_capacity;
  238.            loading_speed:                  vehicle_transporter_car_pony_gen_5C_switch_loading_speed;
  239.    }
  240. }
  241.    if (param[1]==0) {
  242.        item(FEAT_TRAINS, vehicle_transporter_car_pony_gen_5C, 3570) {
  243.            property {
  244.                climates_available:             ALL_CLIMATES;
  245.            }
  246.        }
  247.    }
  248. // -- end 3570 --

Comments