// сокращение для отключения визуальных эффектов тяги и тяги вагонов #define disable_visual_effect_and_powered() visual_effect_and_powered(VISUAL_EFFECT_DISABLE, 0, DISABLE_WAGON_POWER) #define disable_create_effect() 0 // визуальные эффекты для электротяги #define electric_visual_effect_and_powered(offset) visual_effect_and_powered(VISUAL_EFFECT_ELECTRIC, offset, DISABLE_WAGON_POWER) #define electric_create_effect(offset) STORE_TEMP(create_effect(EFFECT_SPRITE_ELECTRIC, offset, 0, 0), 0x100) // визуальные эффекты для дизельной тяги #define diesel_visual_effect_and_powered(offset) visual_effect_and_powered(VISUAL_EFFECT_DIESEL, offset, DISABLE_WAGON_POWER) #define diesel_create_effect(offset) STORE_TEMP(create_effect(EFFECT_SPRITE_DIESEL, offset, 0, 0), 0x100) // визуальные эффекты для паровой тяги #define steam_visual_effect_and_powered(offset) visual_effect_and_powered(VISUAL_EFFECT_STEAM, offset, DISABLE_WAGON_POWER) #define steam_create_effect(offset) STORE_TEMP(create_effect(EFFECT_SPRITE_STEAM, offset, 0, 0), 0x100) // Шаблон расчёта ориентации ЭМВПС #define EMU_direction_calculation_template(name, name2) \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template1, \ STORE_TEMP(LOAD_TEMP(5) + LOAD_TEMP(6), 5)) \ { name##name2##_direction_max; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back12, \ [ set_offset_to(24), \ STORE_TEMP((LOAD_TEMP(7) == name##_m) + (2 * LOAD_TEMP(5)), 5), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { name##name2##_direction_template1; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back11, \ [ set_offset_to(22), \ STORE_TEMP((LOAD_TEMP(7) == name##_m) + (2 * LOAD_TEMP(5)), 5), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { 1: name##name2##_direction_template1; \ name##name2##_direction_template_back12; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back10, \ [ set_offset_to(20), \ STORE_TEMP((LOAD_TEMP(7) == name##_m) + (2 * LOAD_TEMP(5)), 5), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { 1: name##name2##_direction_template1; \ name##name2##_direction_template_back11; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back9, \ [ set_offset_to(18), \ STORE_TEMP((LOAD_TEMP(7) == name##_m) + (2 * LOAD_TEMP(5)), 5), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { 1: name##name2##_direction_template1; \ name##name2##_direction_template_back10; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back8, \ [ set_offset_to(16), \ STORE_TEMP((LOAD_TEMP(7) == name##_m) + (2 * LOAD_TEMP(5)), 5), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { 1: name##name2##_direction_template1; \ name##name2##_direction_template_back9; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back7, \ [ set_offset_to(14), \ STORE_TEMP((LOAD_TEMP(7) == name##_m) + (2 * LOAD_TEMP(5)), 5), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { 1: name##name2##_direction_template1; \ name##name2##_direction_template_back8; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back6, \ [ set_offset_to(12), \ STORE_TEMP((LOAD_TEMP(7) == name##_m) + (2 * LOAD_TEMP(5)), 5), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { 1: name##name2##_direction_template1; \ name##name2##_direction_template_back7; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back5, \ [ set_offset_to(10), \ STORE_TEMP((LOAD_TEMP(7) == name##_m) + (2 * LOAD_TEMP(5)), 5), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { 1: name##name2##_direction_template1; \ name##name2##_direction_template_back6; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back4, \ [ set_offset_to(8), \ STORE_TEMP((LOAD_TEMP(7) == name##_m) + (2 * LOAD_TEMP(5)), 5), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { 1: name##name2##_direction_template1; \ name##name2##_direction_template_back5; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back3, \ [ set_offset_to(6), \ STORE_TEMP((LOAD_TEMP(7) == name##_m) + (2 * LOAD_TEMP(5)), 5), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { 1: name##name2##_direction_template1; \ name##name2##_direction_template_back4; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back2, \ [ set_offset_to(4), \ STORE_TEMP((LOAD_TEMP(7) == name##_m) + (2 * LOAD_TEMP(5)), 5), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { 1: name##name2##_direction_template1; \ name##name2##_direction_template_back3; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back1, \ [ set_offset_to(2), \ STORE_TEMP((LOAD_TEMP(7) == name##_m) + (2 * LOAD_TEMP(5)), 5), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { 1: name##name2##_direction_template1; \ name##name2##_direction_template_back2; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template_back0, \ [ set_offset_to(0), \ STORE_TEMP(prev_vehicle_type_id(), 7) == name##_h ]) \ { 1: name##name2##_direction_template1; \ name##name2##_direction_template_back1; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template12, \ [ set_offset_to(-24), \ STORE_TEMP(2048 * (prev_vehicle_type_id() == name##_m) + LOAD_TEMP(5), 5), \ STORE_TEMP(12 * 4096 * (prev_vehicle_type_id() == name##_h), 6) ]) \ { name##name2##_direction_template_back0; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template11, \ [ set_offset_to(-22), \ STORE_TEMP(1024 * (prev_vehicle_type_id() == name##_m) + LOAD_TEMP(5), 5), \ STORE_TEMP(11 * 4096 * (prev_vehicle_type_id() == name##_h), 6) >= 4096 ]) \ { 1: name##name2##_direction_template_back0; \ name##name2##_direction_template12; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template10, \ [ set_offset_to(-20), \ STORE_TEMP(512 * (prev_vehicle_type_id() == name##_m) + LOAD_TEMP(5), 5), \ STORE_TEMP(10 * 4096 * (prev_vehicle_type_id() == name##_h), 6) >= 4096 ]) \ { 1: name##name2##_direction_template_back0; \ name##name2##_direction_template11; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template9, \ [ set_offset_to(-18), \ STORE_TEMP(256 * (prev_vehicle_type_id() == name##_m) + LOAD_TEMP(5), 5), \ STORE_TEMP(9 * 4096 * (prev_vehicle_type_id() == name##_h), 6) >= 4096 ]) \ { 1: name##name2##_direction_template_back0; \ name##name2##_direction_template10; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template8, \ [ set_offset_to(-16), \ STORE_TEMP(128 * (prev_vehicle_type_id() == name##_m) + LOAD_TEMP(5), 5), \ STORE_TEMP(8 * 4096 * (prev_vehicle_type_id() == name##_h), 6) >= 4096 ]) \ { 1: name##name2##_direction_template_back0; \ name##name2##_direction_template9; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template7, \ [ set_offset_to(-14), \ STORE_TEMP(64 * (prev_vehicle_type_id() == name##_m) + LOAD_TEMP(5), 5), \ STORE_TEMP(7 * 4096 * (prev_vehicle_type_id() == name##_h), 6) >= 4096 ]) \ { 1: name##name2##_direction_template_back0; \ name##name2##_direction_template8; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template6, \ [ set_offset_to(-12), \ STORE_TEMP(32 * (prev_vehicle_type_id() == name##_m) + LOAD_TEMP(5), 5), \ STORE_TEMP(6 * 4096 * (prev_vehicle_type_id() == name##_h), 6) >= 4096 ]) \ { 1: name##name2##_direction_template_back0; \ name##name2##_direction_template7; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template5, \ [ set_offset_to(-10), \ STORE_TEMP(16 * (prev_vehicle_type_id() == name##_m) + LOAD_TEMP(5), 5), \ STORE_TEMP(5 * 4096 * (prev_vehicle_type_id() == name##_h), 6) >= 4096 ]) \ { 1: name##name2##_direction_template_back0; \ name##name2##_direction_template6; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template4, \ [ set_offset_to(-8), \ STORE_TEMP(8 * (prev_vehicle_type_id() == name##_m) + LOAD_TEMP(5), 5), \ STORE_TEMP(4 * 4096 * (prev_vehicle_type_id() == name##_h), 6) >= 4096 ]) \ { 1: name##name2##_direction_template_back0; \ name##name2##_direction_template5; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template3, \ [ set_offset_to(-6), \ STORE_TEMP(4 * (prev_vehicle_type_id() == name##_m) + LOAD_TEMP(5), 5), \ STORE_TEMP(3 * 4096 * (prev_vehicle_type_id() == name##_h), 6) >= 4096 ]) \ { 1: name##name2##_direction_template_back0; \ name##name2##_direction_template4; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template2, \ [ set_offset_to(-4), \ STORE_TEMP(2 * (prev_vehicle_type_id() == name##_m) + LOAD_TEMP(5), 5), \ STORE_TEMP(2 * 4096 * (prev_vehicle_type_id() == name##_h), 6) >= 4096 ]) \ { 1: name##name2##_direction_template_back0; \ name##name2##_direction_template3; } \ switch (FEAT_TRAINS, SELF, name##name2##_direction_template, \ [ set_offset_to(-2), \ STORE_TEMP(1 * (prev_vehicle_type_id() == name##_m), 5), \ STORE_TEMP(1 * 4096 * (prev_vehicle_type_id() == name##_h), 6) >= 4096 ]) \ { 1: name##name2##_direction_template_back0; \ name##name2##_direction_template2; } \ #define EMU_46789101112_m_create_effect_template(name, left, right) \ switch (FEAT_TRAINS, SELF, name##_m_create_effect_left, electric_create_effect(left)) { return 1; } \ switch (FEAT_TRAINS, SELF, name##_m_create_effect_right, electric_create_effect(right)) { return 1; } \ switch (FEAT_TRAINS, SELF, name##_m_create_effect_direction_max, LOAD_TEMP(5)) \ { 0x1003: name##_m_create_effect_left; /* Г-(М)-М-Г */ \ 0x2003: name##_m_create_effect_right; /* Г-М-(М)-Г */ \ 0x100B: name##_m_create_effect_left; /* Г-(М)-П-М-М-Г */ \ 0x300B: name##_m_create_effect_left; /* Г-М-П-(М)-М-Г */ \ 0x400B: name##_m_create_effect_right; /* Г-М-П-М-(М)-Г */ \ 0x100D: name##_m_create_effect_left; /* Г-(М)-М-П-М-Г */ \ 0x200D: name##_m_create_effect_right; /* Г-М-(М)-П-М-Г */ \ 0x400D: name##_m_create_effect_right; /* Г-М-М-П-(М)-Г */ \ 0x1013: name##_m_create_effect_left; /* Г-(М)-П-П-М-М-Г */ \ 0x4013: name##_m_create_effect_left; /* Г-М-П-П-(М)-М-Г */ \ 0x5013: name##_m_create_effect_right; /* Г-М-П-П-М-(М)-Г */ \ 0x1019: name##_m_create_effect_left; /* Г-(М)-М-П-П-М-Г */ \ 0x2019: name##_m_create_effect_right; /* Г-М-(М)-П-П-М-Г */ \ 0x5019: name##_m_create_effect_right; /* Г-М-М-П-П-(М)-Г */ \ 0x102D: name##_m_create_effect_left; /* Г-(М)-П-М-М-П-М-Г */ \ 0x302D: name##_m_create_effect_left; /* Г-М-П-(М)-М-П-М-Г */ \ 0x402D: name##_m_create_effect_right; /* Г-М-П-М-(М)-П-М-Г */ \ 0x602D: name##_m_create_effect_right; /* Г-М-П-М-М-П-(М)-Г */ \ 0x104D: name##_m_create_effect_left; /* Г-(М)-П-П-М-М-П-М-Г */ \ 0x404D: name##_m_create_effect_left; /* Г-М-П-П-(М)-М-П-М-Г */ \ 0x504D: name##_m_create_effect_right; /* Г-М-П-П-М-(М)-П-М-Г */ \ 0x704D: name##_m_create_effect_right; /* Г-М-П-П-М-М-П-(М)-Г */ \ 0x1059: name##_m_create_effect_left; /* Г-(М)-П-М-М-П-П-М-Г */ \ 0x3059: name##_m_create_effect_left; /* Г-М-П-(М)-М-П-П-М-Г */ \ 0x4059: name##_m_create_effect_right; /* Г-М-П-М-(М)-П-П-М-Г */ \ 0x7059: name##_m_create_effect_right; /* Г-М-П-М-М-П-П-(М)-Г */ \ 0x10AD: name##_m_create_effect_left; /* Г-(М)-П-М-П-М-М-П-М-Г */ \ 0x30AD: name##_m_create_effect_left; /* Г-М-П-(М)-П-М-М-П-М-Г */ \ 0x50AD: name##_m_create_effect_left; /* Г-М-П-М-П-(М)-М-П-М-Г */ \ 0x60AD: name##_m_create_effect_right; /* Г-М-П-М-П-М-(М)-П-М-Г */ \ 0x80AD: name##_m_create_effect_right; /* Г-М-П-М-П-М-М-П-(М)-Г */ \ 0x10B5: name##_m_create_effect_left; /* Г-(М)-П-М-М-П-М-П-М-Г */ \ 0x30B5: name##_m_create_effect_left; /* Г-М-П-(М)-М-П-М-П-М-Г */ \ 0x40B5: name##_m_create_effect_right; /* Г-М-П-М-(М)-П-М-П-М-Г */ \ 0x60B5: name##_m_create_effect_right; /* Г-М-П-М-М-П-(М)-П-М-Г */ \ 0x80B5: name##_m_create_effect_right; /* Г-М-П-М-М-П-М-П-(М)-Г */ \ 0x1135: name##_m_create_effect_left; /* Г-(М)-П-П-М-М-П-М-П-М-Г */ \ 0x4135: name##_m_create_effect_left; /* Г-М-П-П-(М)-М-П-М-П-М-Г */ \ 0x5135: name##_m_create_effect_right; /* Г-М-П-П-М-(М)-П-М-П-М-Г */ \ 0x7135: name##_m_create_effect_right; /* Г-М-П-П-М-М-П-(М)-П-М-Г */ \ 0x9135: name##_m_create_effect_right; /* Г-М-П-П-М-М-П-М-П-(М)-Г */ \ 0x1159: name##_m_create_effect_left; /* Г-(М)-П-М-П-М-М-П-П-М-Г */ \ 0x3159: name##_m_create_effect_left; /* Г-М-П-(М)-П-М-М-П-П-М-Г */ \ 0x5159: name##_m_create_effect_left; /* Г-М-П-М-П-(М)-М-П-П-М-Г */ \ 0x6159: name##_m_create_effect_right; /* Г-М-П-М-П-М-(М)-П-П-М-Г */ \ 0x9159: name##_m_create_effect_right; /* Г-М-П-М-П-М-М-П-П-(М)-Г */ \ 0x12B5: name##_m_create_effect_left; /* Г-(М)-П-М-П-М-М-П-М-П-М-Г */ \ 0x32B5: name##_m_create_effect_left; /* Г-М-П-(М)-П-М-М-П-М-П-М-Г */ \ 0x52B5: name##_m_create_effect_left; /* Г-М-П-М-П-(М)-М-П-М-П-М-Г */ \ 0x62B5: name##_m_create_effect_right; /* Г-М-П-М-П-М-(М)-П-М-П-М-Г */ \ 0x82B5: name##_m_create_effect_right; /* Г-М-П-М-П-М-М-П-(М)-П-М-Г */ \ 0xA2B5: name##_m_create_effect_right; /* Г-М-П-М-П-М-М-П-М-П-(М)-Г */ \ return electric_visual_effect_and_powered(left+right); } \ ... EMU_46789101112_m_create_effect_template(er1, -1, 5) EMU_direction_calculation_template(er1, _m_create_effect) switch (FEAT_TRAINS, PARENT, er1_m_create_effect, vehicle_type_id == er1_h) { 1: er1_m_create_effect_direction_template; return disable_create_effect(); } // Даём тягу, только если локомотив - er1_h switch (FEAT_TRAINS, PARENT, er1_m_power, vehicle_type_id == er1_h) { 1: return get_power_in_cb(853); return 0; } ... item (FEAT_TRAINS, er1_m) { property { name: string(STR_ER1_M_NAME); climates_available: get_climates_available(); introduction_date: date(get_car_year(1957), 1, 1); model_life: get_model_life(1957,1962); retire_early: get_retire_early(1957,1962); vehicle_life: 30; reliability_decay: 20; cargo_allow_refit: [PASS]; default_cargo_type: PASS; loading_speed: 12; cost_factor: get_emu_cost_factor(); running_cost_factor: get_emu_running_cost_factor(); sprite_id: SPRITE_ID_NEW_TRAIN; misc_flags: bitmask(TRAIN_FLAG_TILT, TRAIN_FLAG_MU); refit_cost: 0; track_type: get_dc_track_type(); ai_special_flag: AI_FLAG_PASSENGER; power: 853 hpM; running_cost_base: RUNNING_COST_ELECTRIC; cargo_capacity: 110; weight: 52.5 ton; engine_class: ENGINE_CLASS_ELECTRIC; tractive_effort_coefficient: get_tec(35.0, 52.5); length: 8; effect_spawn_model_and_powered: EFFECT_SPAWN_MODEL_ELECTRIC; } graphics { default: er1_m_sprites; purchase: er1_m_purchase_sprites; articulated_part: articulated_part_dummy4; can_attach_wagon: er1_can_attach_wagon; start_stop: er1_m_start_stop; speed: speed_after30_130to100; purchase_speed: return 130; additional_text: return string(STR_ER1_M_PURCHASE_HINT, string(STR_SECTIONS_EMU_4_6_8_10)); cargo_subtype_text: er1_cargo_subtype_text; power: er1_m_power; cargo_capacity: er1_m_cargo_capacity; // visual_effect_and_powered: electric_visual_effect_and_powered(0); create_effect: er1_m_create_effect; } }