Skip to content

Instantly share code, notes, and snippets.

@andythenorth
Created August 18, 2023 14:16
Show Gist options
  • Save andythenorth/4ac90c000a78115300a865636510b03e to your computer and use it in GitHub Desktop.
Save andythenorth/4ac90c000a78115300a865636510b03e to your computer and use it in GitHub Desktop.
// STANDARD GRAPHICS
// -----------------
template spriteset_template_empty_reefer_gen_3C(y) {
//[left_x, upper_y, width, height, offset_x, offset_y]
[20, y, 28, 89, -14, -59, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[60, y, 113, 66, -55, -32, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[190, y, 128, 48, -40, -37, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[330, y, 113, 66, -3, -32, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[460, y, 28, 89, -14, -59, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[500, y, 113, 66, -55, -32, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[630, y, 128, 48, -40, -37, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[770, y, 113, 66, -3, -32, ANIM]
}
template spriteset_template_part_load_reefer_gen_3C(y) {
//[left_x, upper_y, width, height, offset_x, offset_y]
[20, y, 28, 89, -14, -58, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[60, y, 113, 66, -55, -31, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[190, y, 128, 48, -40, -36, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[330, y, 113, 66, -3, -31, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[460, y, 28, 89, -14, -58, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[500, y, 113, 66, -55, -31, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[630, y, 128, 48, -40, -36, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[770, y, 113, 66, -3, -31, ANIM]
}
template spriteset_template_full_load_reefer_gen_3C(y) {
//[left_x, upper_y, width, height, offset_x, offset_y]
[20, y, 28, 89, -14, -57, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[60, y, 113, 66, -55, -30, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[190, y, 128, 48, -40, -35, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[330, y, 113, 66, -3, -30, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[460, y, 28, 89, -14, -57, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[500, y, 113, 66, -55, -30, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[630, y, 128, 48, -40, -35, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[770, y, 113, 66, -3, -30, ANIM]
}
// PURCHASE MENU
// -------------
template spriteset_template_purchase_reefer_gen_3C() {
//[left_x, upper_y, width, height, offset_x, offset_y]
[]
[]
[]
[]
[]
[]
[970, 26, 20 + 80, 32, -40, -17, ANIM | NOCROP]
[]
}
// DEPOT VIEW
// ----------
// WAKES
// -----
template spriteset_template_wake_reefer_gen_3C(y) {
//[left_x, upper_y, width, height, offset_x, offset_y]
[20, y, 28, 89, -14, -58, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[60, y, 113, 66, -55, -31, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[190, y, 128, 48, -40, -36, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[330, y, 113, 66, -3, -31, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[460, y, 28, 89, -14, -58, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[500, y, 113, 66, -55, -31, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[630, y, 128, 48, -40, -36, ANIM]
//[left_x, upper_y, width, height, offset_x, offset_y]
[770, y, 113, 66, -3, -31, ANIM]
}
spriteset(reefer_gen_3C_ss_empty_0, "generated/graphics/reefer_gen_3C.png") {
spriteset_template_empty_reefer_gen_3C((0 * 300) + 10)
}
spriteset(reefer_gen_3C_ss_part_load_0, "generated/graphics/reefer_gen_3C.png") {
spriteset_template_part_load_reefer_gen_3C((0 * 300) + 110)
}
spriteset(reefer_gen_3C_ss_full_load_0, "generated/graphics/reefer_gen_3C.png") {
spriteset_template_full_load_reefer_gen_3C((0 * 300) + 210)
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics_load_amount_0, cargo_count*100/cargo_capacity) {
0: return reefer_gen_3C_ss_empty_0;
1..99: return reefer_gen_3C_ss_part_load_0;
return reefer_gen_3C_ss_full_load_0;
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics_palette_cabbage_0, vehicle_type_id) {
600: return switch_colour_mapping(1, 1, 0, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0);
601: return switch_colour_mapping(1, 1, 0, 21, 21, 0, 0, 0, 0, 0, 0, 0, 0);
602: return switch_colour_mapping(1, 1, 0, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0);
603: return switch_colour_mapping(1, 1, 0, 101, 101, 0, 0, 0, 0, 0, 0, 0, 0);
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics_setup_spritelayer_0, STORE_TEMP(
CB_FLAG_MORE_SPRITES | LOAD_TEMP(0x50), 0x100
)) {
return reefer_gen_3C_switch_graphics_load_amount_0;
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics_layer_0, STORE_TEMP(reefer_gen_3C_switch_graphics_palette_cabbage_0(), 0x50)) {
return reefer_gen_3C_switch_graphics_setup_spritelayer_0;
}
spriteset(reefer_gen_3C_ss_empty_1, "generated/graphics/reefer_gen_3C.png") {
spriteset_template_empty_reefer_gen_3C((1 * 300) + 10)
}
spriteset(reefer_gen_3C_ss_part_load_1, "generated/graphics/reefer_gen_3C.png") {
spriteset_template_part_load_reefer_gen_3C((1 * 300) + 110)
}
spriteset(reefer_gen_3C_ss_full_load_1, "generated/graphics/reefer_gen_3C.png") {
spriteset_template_full_load_reefer_gen_3C((1 * 300) + 210)
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics_load_amount_1, cargo_count*100/cargo_capacity) {
0: return reefer_gen_3C_ss_empty_1;
1..99: return reefer_gen_3C_ss_part_load_1;
return reefer_gen_3C_ss_full_load_1;
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics_palette_cabbage_1, vehicle_type_id) {
600: return switch_colour_mapping(1, 1, 0, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0);
601: return switch_colour_mapping(1, 1, 0, 21, 21, 0, 0, 0, 0, 0, 0, 0, 0);
602: return switch_colour_mapping(1, 1, 0, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0);
603: return switch_colour_mapping(1, 1, 0, 101, 101, 0, 0, 0, 0, 0, 0, 0, 0);
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics_setup_spritelayer_1, STORE_TEMP(
CB_FLAG_MORE_SPRITES | LOAD_TEMP(0x50), 0x100
)) {
return reefer_gen_3C_switch_graphics_load_amount_1;
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics_layer_1, STORE_TEMP(reefer_gen_3C_switch_graphics_palette_cabbage_1(), 0x50)) {
return reefer_gen_3C_switch_graphics_setup_spritelayer_1;
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics_ship, getbits(extra_callback_info1, 8, 8)) {
0: reefer_gen_3C_switch_graphics_layer_0;
1: reefer_gen_3C_switch_graphics_layer_1;
}
spriteset(reefer_gen_3C_ss_wake, "src/graphics/hulls/ship_house_forward_80px_gen_3.png") {
spriteset_template_wake_reefer_gen_3C(310)
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics_wake_not_moving, STORE_TEMP(PALETTE_USE_DEFAULT, 0x100)) {
return ss_global_empty;
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics_wake_moving, STORE_TEMP(PALETTE_USE_DEFAULT, 0x100)) {
return reefer_gen_3C_ss_wake;
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics_wake, current_speed) {
0: return reefer_gen_3C_switch_graphics_wake_not_moving;
return reefer_gen_3C_switch_graphics_wake_moving;
}
switch (FEAT_SHIPS, SELF, reefer_gen_3C_switch_graphics, getbits(extra_callback_info1, 8, 8)) {
0: return reefer_gen_3C_switch_graphics_ship;
1: return reefer_gen_3C_switch_graphics_ship;
return reefer_gen_3C_switch_graphics_wake;
}
item(FEAT_SHIPS, reefer_gen_3C, 600) {
property {
name: string(STR_NAME_REEFER_GEN_3C, string(STR_NAME_REEFER));
climates_available: NO_CLIMATE; // nml constant
sound_effect: SOUND_DEPARTURE_CARGO_SHIP;
effect_spawn_model: EFFECT_SPAWN_MODEL_STEAM;
introduction_date: date(1860,01,01); // ship just supplies intro year - openttd randomises intro dates a bit anyway
cargo_capacity: 240;
sprite_id: SPRITE_ID_NEW_SHIP; //enable new graphics - nml constant
// speed is not set, handled by cb
cost_factor: 24.0;
running_cost_factor: 48;
refit_cost: 0; // leave at 0 for refitting without defining cb
is_refittable: 1;
refittable_cargo_classes: bitmask(CC_REFRIGERATED);
non_refittable_cargo_classes: bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support
cargo_allow_refit: [];
cargo_disallow_refit: [];
default_cargo_type: FOOD;
loading_speed: 10;
cargo_age_period: 740;
misc_flags: bitmask(SHIP_FLAG_2CC, SHIP_FLAG_AUTOREFIT, SHIP_FLAG_SPRITE_STACK); // nml constants
model_life: VEHICLE_NEVER_EXPIRES;
retire_early: 96; // magic from Eddi
reliability_decay: 20; // default value
vehicle_life: 100;
}
graphics {
speed: reefer_gen_3C_switch_speed;
cargo_capacity: reefer_gen_3C_switch_cargo_capacity;
purchase_cargo_capacity: 240;
purchase_colour_mapping: switch_colour_mapping(1, 1, 1, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0);
additional_text: string(STR_SPRITES_COMPLETE);
cargo_subtype_text: reefer_gen_3C_switch_cargo_subtype_text;
default: reefer_gen_3C_switch_graphics;
purchase: reefer_gen_3C_sg_purchase;
create_effect: reefer_gen_3C_create_visual_effect;
}
}
if (param[2]==0) {
item(FEAT_SHIPS, reefer_gen_3C, 600) {
property {
climates_available: ALL_CLIMATES;
}
}
}
item(FEAT_SHIPS, reefer_gen_3C601, 601) {
property {
name: string(STR_NAME_REEFER_GEN_3C, string(STR_NAME_REEFER));
climates_available: NO_CLIMATE; // nml constant
sound_effect: SOUND_DEPARTURE_CARGO_SHIP;
effect_spawn_model: EFFECT_SPAWN_MODEL_STEAM;
introduction_date: date(1860,01,01); // ship just supplies intro year - openttd randomises intro dates a bit anyway
cargo_capacity: 240;
sprite_id: SPRITE_ID_NEW_SHIP; //enable new graphics - nml constant
// speed is not set, handled by cb
cost_factor: 24.0;
running_cost_factor: 48;
refit_cost: 0; // leave at 0 for refitting without defining cb
is_refittable: 1;
refittable_cargo_classes: bitmask(CC_REFRIGERATED);
non_refittable_cargo_classes: bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support
cargo_allow_refit: [];
cargo_disallow_refit: [];
default_cargo_type: FOOD;
loading_speed: 10;
cargo_age_period: 740;
misc_flags: bitmask(SHIP_FLAG_2CC, SHIP_FLAG_AUTOREFIT, SHIP_FLAG_SPRITE_STACK); // nml constants
model_life: VEHICLE_NEVER_EXPIRES;
retire_early: 96; // magic from Eddi
reliability_decay: 20; // default value
vehicle_life: 100;
variant_group: 600;
}
graphics {
speed: reefer_gen_3C_switch_speed;
cargo_capacity: reefer_gen_3C_switch_cargo_capacity;
purchase_cargo_capacity: 240;
purchase_colour_mapping: switch_colour_mapping(1, 1, 1, 21, 21, 0, 0, 0, 0, 0, 0, 0, 0);
additional_text: string(STR_SPRITES_COMPLETE);
cargo_subtype_text: reefer_gen_3C_switch_cargo_subtype_text;
default: reefer_gen_3C_switch_graphics;
purchase: reefer_gen_3C_sg_purchase;
create_effect: reefer_gen_3C_create_visual_effect;
}
}
if (param[2]==0) {
item(FEAT_SHIPS, reefer_gen_3C601, 601) {
property {
climates_available: ALL_CLIMATES;
}
}
}
item(FEAT_SHIPS, reefer_gen_3C602, 602) {
property {
name: string(STR_NAME_REEFER_GEN_3C, string(STR_NAME_REEFER));
climates_available: NO_CLIMATE; // nml constant
sound_effect: SOUND_DEPARTURE_CARGO_SHIP;
effect_spawn_model: EFFECT_SPAWN_MODEL_STEAM;
introduction_date: date(1860,01,01); // ship just supplies intro year - openttd randomises intro dates a bit anyway
cargo_capacity: 240;
sprite_id: SPRITE_ID_NEW_SHIP; //enable new graphics - nml constant
// speed is not set, handled by cb
cost_factor: 24.0;
running_cost_factor: 48;
refit_cost: 0; // leave at 0 for refitting without defining cb
is_refittable: 1;
refittable_cargo_classes: bitmask(CC_REFRIGERATED);
non_refittable_cargo_classes: bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support
cargo_allow_refit: [];
cargo_disallow_refit: [];
default_cargo_type: FOOD;
loading_speed: 10;
cargo_age_period: 740;
misc_flags: bitmask(SHIP_FLAG_2CC, SHIP_FLAG_AUTOREFIT, SHIP_FLAG_SPRITE_STACK); // nml constants
model_life: VEHICLE_NEVER_EXPIRES;
retire_early: 96; // magic from Eddi
reliability_decay: 20; // default value
vehicle_life: 100;
variant_group: 600;
}
graphics {
speed: reefer_gen_3C_switch_speed;
cargo_capacity: reefer_gen_3C_switch_cargo_capacity;
purchase_cargo_capacity: 240;
purchase_colour_mapping: switch_colour_mapping(1, 1, 1, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0);
additional_text: string(STR_SPRITES_COMPLETE);
cargo_subtype_text: reefer_gen_3C_switch_cargo_subtype_text;
default: reefer_gen_3C_switch_graphics;
purchase: reefer_gen_3C_sg_purchase;
create_effect: reefer_gen_3C_create_visual_effect;
}
}
if (param[2]==0) {
item(FEAT_SHIPS, reefer_gen_3C602, 602) {
property {
climates_available: ALL_CLIMATES;
}
}
}
item(FEAT_SHIPS, reefer_gen_3C603, 603) {
property {
name: string(STR_NAME_REEFER_GEN_3C, string(STR_NAME_REEFER));
climates_available: NO_CLIMATE; // nml constant
sound_effect: SOUND_DEPARTURE_CARGO_SHIP;
effect_spawn_model: EFFECT_SPAWN_MODEL_STEAM;
introduction_date: date(1860,01,01); // ship just supplies intro year - openttd randomises intro dates a bit anyway
cargo_capacity: 240;
sprite_id: SPRITE_ID_NEW_SHIP; //enable new graphics - nml constant
// speed is not set, handled by cb
cost_factor: 24.0;
running_cost_factor: 48;
refit_cost: 0; // leave at 0 for refitting without defining cb
is_refittable: 1;
refittable_cargo_classes: bitmask(CC_REFRIGERATED);
non_refittable_cargo_classes: bitmask(); // don't set non-refittable classes, increases likelihood of breaking cargo support
cargo_allow_refit: [];
cargo_disallow_refit: [];
default_cargo_type: FOOD;
loading_speed: 10;
cargo_age_period: 740;
misc_flags: bitmask(SHIP_FLAG_2CC, SHIP_FLAG_AUTOREFIT, SHIP_FLAG_SPRITE_STACK); // nml constants
model_life: VEHICLE_NEVER_EXPIRES;
retire_early: 96; // magic from Eddi
reliability_decay: 20; // default value
vehicle_life: 100;
variant_group: 600;
}
graphics {
speed: reefer_gen_3C_switch_speed;
cargo_capacity: reefer_gen_3C_switch_cargo_capacity;
purchase_cargo_capacity: 240;
purchase_colour_mapping: switch_colour_mapping(1, 1, 1, 101, 101, 0, 0, 0, 0, 0, 0, 0, 0);
additional_text: string(STR_SPRITES_COMPLETE);
cargo_subtype_text: reefer_gen_3C_switch_cargo_subtype_text;
default: reefer_gen_3C_switch_graphics;
purchase: reefer_gen_3C_sg_purchase;
create_effect: reefer_gen_3C_create_visual_effect;
}
}
if (param[2]==0) {
item(FEAT_SHIPS, reefer_gen_3C603, 603) {
property {
climates_available: ALL_CLIMATES;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment