Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/building/connectable.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ static const building_type connectable_buildings[] = {
BUILDING_HEDGE_GATE_DARK,
BUILDING_HEDGE_GATE_LIGHT,
BUILDING_PALISADE_GATE,
BUILDING_NATIVE_PALISADE,
};

static const int MAX_CONNECTABLE_BUILDINGS = sizeof(connectable_buildings) / sizeof(building_type);
Expand Down Expand Up @@ -402,12 +403,13 @@ int building_connectable_get_garden_gate_offset(int grid_offset)

static int is_palisade_wall_or_gate(building_type type)
{
return type == BUILDING_PALISADE || type == BUILDING_PALISADE_GATE;
return type == BUILDING_PALISADE || type == BUILDING_PALISADE_GATE ||
type == BUILDING_NATIVE_PALISADE;
}

static int is_palisade_wall(building_type type)
{
return type == BUILDING_PALISADE;
return type == BUILDING_PALISADE || type == BUILDING_NATIVE_PALISADE;
}

int building_connectable_get_palisade_offset(int grid_offset)
Expand Down Expand Up @@ -487,6 +489,7 @@ int building_connectable_num_variants(building_type type)
case BUILDING_ROOFED_GARDEN_WALL:
case BUILDING_PANELLED_GARDEN_WALL:
case BUILDING_PALISADE:
case BUILDING_NATIVE_PALISADE:
return BUILDING_CONNECTABLE_ROTATION_LIMIT_HEDGES;
default:
return BUILDING_CONNECTABLE_ROTATION_LIMIT_PATHS;
Expand Down
7 changes: 6 additions & 1 deletion src/building/figure.c
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,12 @@ static void update_native_crop_progress(building *b)
if (b->data.industry.progress >= 5) {
b->data.industry.progress = 0;
}
map_image_set(b->grid_offset, image_group(GROUP_BUILDING_FARM_CROPS) + b->data.industry.progress);
int variant = b->subtype.orientation;
if (variant < 0 || variant > 5) {
variant = 0;
}
map_image_set(b->grid_offset,
image_group(GROUP_BUILDING_FARM_CROPS) + variant * 5 + b->data.industry.progress);
}

void building_figure_generate(void)
Expand Down
45 changes: 45 additions & 0 deletions src/building/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,53 @@ int building_image_get(const building *b)
default:
return assets_get_image_id("Terrain_Maps", "Native_Hut_Central_01") + (random_byte() & 1);
}
case BUILDING_NATIVE_HUT_ALT_2:
switch (scenario_property_climate()) {
case CLIMATE_NORTHERN:
return assets_get_image_id("Terrain_Maps", "Hellenised_Hut_Northern_01") + (random_byte() % 3);
case CLIMATE_DESERT:
return assets_get_image_id("Terrain_Maps", "Hellenised_Hut_Southern_01") + (random_byte() % 3);
default:
return assets_get_image_id("Terrain_Maps", "Hellenised_Hut_Central_01") + (random_byte() % 3);
}
case BUILDING_NATIVE_MEETING:
return image_group(GROUP_BUILDING_NATIVE) + 2;
case BUILDING_NATIVE_MEETING_ALT:
switch (scenario_property_climate()) {
case CLIMATE_NORTHERN:
return assets_get_image_id("Terrain_Maps", "Native_Meeting_Hut_Northern_01");
case CLIMATE_DESERT:
return assets_get_image_id("Terrain_Maps", "Native_Meeting_Hut_Southern_01");
default:
return assets_get_image_id("Terrain_Maps", "Native_Meeting_Hut_Central_01");
}
case BUILDING_NATIVE_MEETING_ALT_2:
switch (scenario_property_climate()) {
case CLIMATE_NORTHERN:
return assets_get_image_id("Terrain_Maps", "Hellenised_Meeting_Hut_Northern_01");
case CLIMATE_DESERT:
return assets_get_image_id("Terrain_Maps", "Hellenised_Meeting_Hut_Southern_01");
default:
return assets_get_image_id("Terrain_Maps", "Hellenised_Meeting_Hut_Central_01");
}
case BUILDING_NATIVE_WELL:
switch (scenario_property_climate()) {
case CLIMATE_NORTHERN:
return assets_get_image_id("Terrain_Maps", "Native_Well_Northern");
case CLIMATE_DESERT:
return assets_get_image_id("Terrain_Maps", "Native_Well_Southern");
default:
return assets_get_image_id("Terrain_Maps", "Native_Well_Central");
}
case BUILDING_NATIVE_PALISADE:
switch (scenario_property_climate()) {
case CLIMATE_NORTHERN:
return assets_get_image_id("Military", "Pal Wall N 01") + building_connectable_get_palisade_offset(b->grid_offset);
case CLIMATE_DESERT:
return assets_get_image_id("Military", "Pal Wall S 01") + building_connectable_get_palisade_offset(b->grid_offset);
default:
return assets_get_image_id("Military", "Pal Wall C 01") + building_connectable_get_palisade_offset(b->grid_offset);
}
case BUILDING_NATIVE_CROPS:
return image_group(GROUP_BUILDING_FARM_CROPS);
case BUILDING_GRAND_TEMPLE_CERES:
Expand Down
49 changes: 49 additions & 0 deletions src/building/properties.c
Original file line number Diff line number Diff line change
Expand Up @@ -2212,6 +2212,55 @@ static building_properties properties[BUILDING_TYPE_MAX] = {
.building_model_data = {.cost = 200, .desirability_value = -2, .desirability_step = 1,
.desirability_step_size = 1, .desirability_range = 3, .laborers = 12}
},
[BUILDING_NATIVE_WELL] = {
.size = 1,
.fire_proof = 1,
.custom_asset.group = "Terrain_Maps",
.custom_asset.id = "Native_Well_Central",
.event_data.attr = "native_well",
.building_model_data = {.cost = 0, .desirability_value = 0, .desirability_step = 0,
.desirability_step_size = 0, .desirability_range = 0, .laborers = 0}
},
[BUILDING_NATIVE_MEETING_ALT] = {
.size = 2,
.sound_id = SOUND_CITY_NATIVE_HUT,
.fire_proof = 1,
.custom_asset.group = "Terrain_Maps",
.custom_asset.id = "Native_Meeting_Hut_Central_01",
.event_data.attr = "native_meeting_alt",
.building_model_data = {.cost = 50, .desirability_value = 0, .desirability_step = 0,
.desirability_step_size = 0, .desirability_range = 0, .laborers = 0}
},
[BUILDING_NATIVE_HUT_ALT_2] = {
.size = 1,
.sound_id = SOUND_CITY_NATIVE_HUT,
.fire_proof = 1,
.custom_asset.group = "Terrain_Maps",
.custom_asset.id = "Hellenised_Hut_Central_01",
.event_data.attr = "native_hut_alt_2",
.building_model_data = {.cost = 50, .desirability_value = 0, .desirability_step = 0,
.desirability_step_size = 0, .desirability_range = 0, .laborers = 0}
},
[BUILDING_NATIVE_MEETING_ALT_2] = {
.size = 2,
.sound_id = SOUND_CITY_NATIVE_HUT,
.fire_proof = 1,
.custom_asset.group = "Terrain_Maps",
.custom_asset.id = "Hellenised_Meeting_Hut_Central_01",
.event_data.attr = "native_meeting_alt_2",
.building_model_data = {.cost = 50, .desirability_value = 0, .desirability_step = 0,
.desirability_step_size = 0, .desirability_range = 0, .laborers = 0}
},
[BUILDING_NATIVE_PALISADE] = {
.size = 1,
.fire_proof = 1,
.draw_desirability_range = 1,
.custom_asset.group = "Military",
.custom_asset.id = "Pal Wall C 01",
.event_data.attr = "native_palisade",
.building_model_data = {.cost = 0, .desirability_value = 0, .desirability_step = 0,
.desirability_step_size = 0, .desirability_range = 0, .laborers = 0}
},
};

void building_properties_init(void)
Expand Down
7 changes: 6 additions & 1 deletion src/building/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,13 @@ typedef enum {
BUILDING_NATIVE_DECORATION = 209,
BUILDING_REPAIR_LAND = 210, // tool, not an actual building
BUILDING_HIGHWAY_STATION = 211,
BUILDING_NATIVE_WELL = 212,
BUILDING_NATIVE_MEETING_ALT = 213,
BUILDING_NATIVE_HUT_ALT_2 = 214,
BUILDING_NATIVE_MEETING_ALT_2 = 215,
BUILDING_NATIVE_PALISADE = 216,
// helper constants
BUILDING_TYPE_MAX = 212
BUILDING_TYPE_MAX = 217
} building_type;

/**
Expand Down
49 changes: 47 additions & 2 deletions src/core/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "assets/assets.h"
#include "building/building.h"
#include "building/connectable.h"
#include "building/image.h"
#include "core/buffer.h"
#include "core/file.h"
Expand Down Expand Up @@ -653,14 +654,58 @@ static void update_native_images(int old_climate, int new_climate)
for (building *b = building_first_of_type(BUILDING_NATIVE_HUT_ALT); b; b = b->next_of_type) {
map_image_set(b->grid_offset, alt_native_hut_new_image_id + map_image_at(b->grid_offset) - alt_native_hut_old_image_id);
}
building_type native_buildings[] = { BUILDING_NATIVE_DECORATION, BUILDING_NATIVE_MONUMENT, BUILDING_NATIVE_WATCHTOWER };
for (int i = 0; i < sizeof(native_buildings) / sizeof(native_buildings[0]); i++) {

// Hellenised Hut alt 2: 3 variants per climate, preserve variant index across climate change.
int hut_alt_2_old_image_id;
int hut_alt_2_new_image_id;
switch (old_climate) {
case CLIMATE_NORTHERN:
hut_alt_2_old_image_id = assets_get_image_id("Terrain_Maps", "Hellenised_Hut_Northern_01"); break;
case CLIMATE_DESERT:
hut_alt_2_old_image_id = assets_get_image_id("Terrain_Maps", "Hellenised_Hut_Southern_01"); break;
default:
hut_alt_2_old_image_id = assets_get_image_id("Terrain_Maps", "Hellenised_Hut_Central_01");
}
switch (new_climate) {
case CLIMATE_NORTHERN:
hut_alt_2_new_image_id = assets_get_image_id("Terrain_Maps", "Hellenised_Hut_Northern_01"); break;
case CLIMATE_DESERT:
hut_alt_2_new_image_id = assets_get_image_id("Terrain_Maps", "Hellenised_Hut_Southern_01"); break;
default:
hut_alt_2_new_image_id = assets_get_image_id("Terrain_Maps", "Hellenised_Hut_Central_01");
}
for (building *b = building_first_of_type(BUILDING_NATIVE_HUT_ALT_2); b; b = b->next_of_type) {
map_image_set(b->grid_offset, hut_alt_2_new_image_id + map_image_at(b->grid_offset) - hut_alt_2_old_image_id);
}

building_type native_buildings[] = {
BUILDING_NATIVE_DECORATION, BUILDING_NATIVE_MONUMENT, BUILDING_NATIVE_WATCHTOWER,
BUILDING_NATIVE_WELL,
};
for (int i = 0; i < (int) (sizeof(native_buildings) / sizeof(native_buildings[0])); i++) {
building_type type = native_buildings[i];
int image_id = building_image_get_for_type(type);
for (building *b = building_first_of_type(type); b; b = b->next_of_type) {
map_building_tiles_add(b->id, b->x, b->y, b->size, image_id, TERRAIN_BUILDING);
}
}

building_type meeting_buildings[] = {
BUILDING_NATIVE_MEETING_ALT, BUILDING_NATIVE_MEETING_ALT_2,
};
for (int i = 0; i < (int) (sizeof(meeting_buildings) / sizeof(meeting_buildings[0])); i++) {
building_type type = meeting_buildings[i];
int image_id = building_image_get_for_type(type);
for (building *b = building_first_of_type(type); b; b = b->next_of_type) {
map_building_tiles_add(b->id, b->x, b->y, b->size, image_id, TERRAIN_BUILDING);
}
}

// Palisade: re-set image based on new climate, then refresh connectivity offsets
for (building *b = building_first_of_type(BUILDING_NATIVE_PALISADE); b; b = b->next_of_type) {
map_image_set(b->grid_offset, building_image_get(b));
}
building_connectable_update_connections();
}

static void fix_animation_offsets(void)
Expand Down
24 changes: 24 additions & 0 deletions src/core/lang.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,30 @@ const uint8_t *lang_get_string(int group, int index)
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_MONUMENT);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_WATCHTOWER:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_WATCHTOWER);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_WELL:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_WELL);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_MEETING_ALT:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_MEETING_ALT);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_HUT_ALT_2:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_HUT_ALT_2);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_MEETING_ALT_2:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_MEETING_ALT_2);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_PALISADE:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_PALISADE);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELDS:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELDS);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELD_WHEAT:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELD_WHEAT);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELD_VEGETABLES:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELD_VEGETABLES);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELD_FRUIT:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELD_FRUIT);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELD_OLIVE:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELD_OLIVE);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELD_VINES:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELD_VINES);
case TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELD_PIG:
return translation_for(TR_EDITOR_SCENARIO_BUILDING_NATIVE_FIELD_PIG);
case TR_EDITOR_TOOL_EARTHQUAKE_POINT:
return translation_for(TR_EDITOR_TOOL_EARTHQUAKE_POINT);
case TR_EDITOR_TOOL_EARTHQUAKE_CUSTOM:
Expand Down
Loading
Loading