From 59cb6fb6c1212ede6c49ea25a77ecf986ef92f07 Mon Sep 17 00:00:00 2001 From: Sven Balzer <4653051+Kyuusokuna@users.noreply.github.com> Date: Fri, 1 May 2026 18:31:16 +0200 Subject: [PATCH] replace the name ground with dirt append TILEKIND_ to every argument of TILE_CORNER_INFO for better readability --- assets/tiles/{ground_1.png => dirt_1.png} | Bin assets/tiles/{ground_2.png => dirt_2.png} | Bin assets/tiles/{ground_3.png => dirt_3.png} | Bin .../{grass_ground_1.png => grass_dirt_1.png} | Bin .../{grass_ground_2.png => grass_dirt_2.png} | Bin .../{grass_ground_3.png => grass_dirt_3.png} | Bin ...rner.png => grass_dirt_inner_corner_1.png} | Bin ...er_2.png => grass_dirt_inner_corner_2.png} | Bin ...er_3.png => grass_dirt_inner_corner_3.png} | Bin ...rner.png => grass_dirt_outer_corner_1.png} | Bin ...er_2.png => grass_dirt_outer_corner_2.png} | Bin ...o_corner.png => grass_dirt_two_corner.png} | Bin src/main.cpp | 56 +++++++++--------- 13 files changed, 28 insertions(+), 28 deletions(-) rename assets/tiles/{ground_1.png => dirt_1.png} (100%) rename assets/tiles/{ground_2.png => dirt_2.png} (100%) rename assets/tiles/{ground_3.png => dirt_3.png} (100%) rename assets/tiles/{grass_ground_1.png => grass_dirt_1.png} (100%) rename assets/tiles/{grass_ground_2.png => grass_dirt_2.png} (100%) rename assets/tiles/{grass_ground_3.png => grass_dirt_3.png} (100%) rename assets/tiles/{grass_ground_inner_corner.png => grass_dirt_inner_corner_1.png} (100%) rename assets/tiles/{grass_ground_inner_corner_2.png => grass_dirt_inner_corner_2.png} (100%) rename assets/tiles/{grass_ground_inner_corner_3.png => grass_dirt_inner_corner_3.png} (100%) rename assets/tiles/{grass_ground_outer_corner.png => grass_dirt_outer_corner_1.png} (100%) rename assets/tiles/{grass_ground_outer_corner_2.png => grass_dirt_outer_corner_2.png} (100%) rename assets/tiles/{grass_ground_two_corner.png => grass_dirt_two_corner.png} (100%) diff --git a/assets/tiles/ground_1.png b/assets/tiles/dirt_1.png similarity index 100% rename from assets/tiles/ground_1.png rename to assets/tiles/dirt_1.png diff --git a/assets/tiles/ground_2.png b/assets/tiles/dirt_2.png similarity index 100% rename from assets/tiles/ground_2.png rename to assets/tiles/dirt_2.png diff --git a/assets/tiles/ground_3.png b/assets/tiles/dirt_3.png similarity index 100% rename from assets/tiles/ground_3.png rename to assets/tiles/dirt_3.png diff --git a/assets/tiles/grass_ground_1.png b/assets/tiles/grass_dirt_1.png similarity index 100% rename from assets/tiles/grass_ground_1.png rename to assets/tiles/grass_dirt_1.png diff --git a/assets/tiles/grass_ground_2.png b/assets/tiles/grass_dirt_2.png similarity index 100% rename from assets/tiles/grass_ground_2.png rename to assets/tiles/grass_dirt_2.png diff --git a/assets/tiles/grass_ground_3.png b/assets/tiles/grass_dirt_3.png similarity index 100% rename from assets/tiles/grass_ground_3.png rename to assets/tiles/grass_dirt_3.png diff --git a/assets/tiles/grass_ground_inner_corner.png b/assets/tiles/grass_dirt_inner_corner_1.png similarity index 100% rename from assets/tiles/grass_ground_inner_corner.png rename to assets/tiles/grass_dirt_inner_corner_1.png diff --git a/assets/tiles/grass_ground_inner_corner_2.png b/assets/tiles/grass_dirt_inner_corner_2.png similarity index 100% rename from assets/tiles/grass_ground_inner_corner_2.png rename to assets/tiles/grass_dirt_inner_corner_2.png diff --git a/assets/tiles/grass_ground_inner_corner_3.png b/assets/tiles/grass_dirt_inner_corner_3.png similarity index 100% rename from assets/tiles/grass_ground_inner_corner_3.png rename to assets/tiles/grass_dirt_inner_corner_3.png diff --git a/assets/tiles/grass_ground_outer_corner.png b/assets/tiles/grass_dirt_outer_corner_1.png similarity index 100% rename from assets/tiles/grass_ground_outer_corner.png rename to assets/tiles/grass_dirt_outer_corner_1.png diff --git a/assets/tiles/grass_ground_outer_corner_2.png b/assets/tiles/grass_dirt_outer_corner_2.png similarity index 100% rename from assets/tiles/grass_ground_outer_corner_2.png rename to assets/tiles/grass_dirt_outer_corner_2.png diff --git a/assets/tiles/grass_ground_two_corner.png b/assets/tiles/grass_dirt_two_corner.png similarity index 100% rename from assets/tiles/grass_ground_two_corner.png rename to assets/tiles/grass_dirt_two_corner.png diff --git a/src/main.cpp b/src/main.cpp index 49cc522..1961d7a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -286,14 +286,14 @@ struct PerFrame { static PerFrame per_frame = {}; typedef enum : Uint8 { - TILEKIND_ERROR = 0, - TILEKIND_NONE = 1, - TILEKIND_GRASS = 2, - TILEKIND_GROUND = 3, - TILEKIND_WATER = 4, + TILEKIND_ERROR = 0, + TILEKIND_NONE = 1, + TILEKIND_GRASS = 2, + TILEKIND_DIRT = 3, + TILEKIND_WATER = 4, } TileKind; -#define TILE_CORNER_INFO(top_left, top_right, bottom_right, bottom_left) (((top_left) << 24) | ((top_right) << 16) | ((bottom_right) << 8) | bottom_left) +#define TILE_CORNER_INFO(top_left, top_right, bottom_right, bottom_left) (((TILEKIND_##top_left) << 24) | ((TILEKIND_##top_right) << 16) | ((TILEKIND_##bottom_right) << 8) | (TILEKIND_##bottom_left)) typedef struct { Uint16 type; @@ -303,26 +303,26 @@ typedef struct { } TileInfo; static TileInfo tile_infos[] = { - { 0x0001, "tiles/error.png", TILE_CORNER_INFO(TILEKIND_ERROR, TILEKIND_ERROR, TILEKIND_ERROR, TILEKIND_ERROR ) }, - { 0x0000, "tiles/empty.png", TILE_CORNER_INFO(TILEKIND_NONE, TILEKIND_NONE, TILEKIND_NONE, TILEKIND_NONE ) }, - { 0x0102, "tiles/grass_3.png", TILE_CORNER_INFO(TILEKIND_GRASS, TILEKIND_GRASS, TILEKIND_GRASS, TILEKIND_GRASS ) }, - { 0x0100, "tiles/grass_1.png", TILE_CORNER_INFO(TILEKIND_GRASS, TILEKIND_GRASS, TILEKIND_GRASS, TILEKIND_GRASS ) }, - { 0x0101, "tiles/grass_2.png", TILE_CORNER_INFO(TILEKIND_GRASS, TILEKIND_GRASS, TILEKIND_GRASS, TILEKIND_GRASS ) }, - { 0x0103, "tiles/grass_4.png", TILE_CORNER_INFO(TILEKIND_GRASS, TILEKIND_GRASS, TILEKIND_GRASS, TILEKIND_GRASS ) }, - { 0x0202, "tiles/ground_3.png", TILE_CORNER_INFO(TILEKIND_GROUND, TILEKIND_GROUND, TILEKIND_GROUND, TILEKIND_GROUND ) }, - { 0x0200, "tiles/ground_1.png", TILE_CORNER_INFO(TILEKIND_GROUND, TILEKIND_GROUND, TILEKIND_GROUND, TILEKIND_GROUND ) }, - { 0x0201, "tiles/ground_2.png", TILE_CORNER_INFO(TILEKIND_GROUND, TILEKIND_GROUND, TILEKIND_GROUND, TILEKIND_GROUND ) }, - { 0x0300, "tiles/water_1.png", TILE_CORNER_INFO(TILEKIND_WATER, TILEKIND_WATER, TILEKIND_WATER, TILEKIND_WATER ) }, - { 0x0301, "tiles/water_2.png", TILE_CORNER_INFO(TILEKIND_WATER, TILEKIND_WATER, TILEKIND_WATER, TILEKIND_WATER ) }, - { 0x0400, "tiles/grass_ground_1.png", TILE_CORNER_INFO(TILEKIND_GROUND, TILEKIND_GROUND, TILEKIND_GRASS, TILEKIND_GRASS ) }, - { 0x0401, "tiles/grass_ground_2.png", TILE_CORNER_INFO(TILEKIND_GROUND, TILEKIND_GROUND, TILEKIND_GRASS, TILEKIND_GRASS ) }, - { 0x0402, "tiles/grass_ground_3.png", TILE_CORNER_INFO(TILEKIND_GROUND, TILEKIND_GROUND, TILEKIND_GRASS, TILEKIND_GRASS ) }, - { 0x0410, "tiles/grass_ground_outer_corner.png", TILE_CORNER_INFO(TILEKIND_GROUND, TILEKIND_GROUND, TILEKIND_GRASS, TILEKIND_GROUND ) }, - { 0x0411, "tiles/grass_ground_outer_corner_2.png", TILE_CORNER_INFO(TILEKIND_GROUND, TILEKIND_GROUND, TILEKIND_GRASS, TILEKIND_GROUND ) }, - { 0x0420, "tiles/grass_ground_inner_corner.png", TILE_CORNER_INFO(TILEKIND_GRASS, TILEKIND_GROUND, TILEKIND_GRASS, TILEKIND_GRASS ) }, - { 0x0421, "tiles/grass_ground_inner_corner_2.png", TILE_CORNER_INFO(TILEKIND_GRASS, TILEKIND_GROUND, TILEKIND_GRASS, TILEKIND_GRASS ) }, - { 0x0422, "tiles/grass_ground_inner_corner_3.png", TILE_CORNER_INFO(TILEKIND_GRASS, TILEKIND_GROUND, TILEKIND_GRASS, TILEKIND_GRASS ) }, - { 0x0423, "tiles/grass_ground_two_corner.png", TILE_CORNER_INFO(TILEKIND_GRASS, TILEKIND_GROUND, TILEKIND_GRASS, TILEKIND_GROUND ) }, + { 0x0001, "tiles/error.png", TILE_CORNER_INFO(ERROR, ERROR, ERROR, ERROR) }, + { 0x0000, "tiles/empty.png", TILE_CORNER_INFO(NONE, NONE, NONE, NONE ) }, + { 0x0102, "tiles/grass_3.png", TILE_CORNER_INFO(GRASS, GRASS, GRASS, GRASS) }, + { 0x0100, "tiles/grass_1.png", TILE_CORNER_INFO(GRASS, GRASS, GRASS, GRASS) }, + { 0x0101, "tiles/grass_2.png", TILE_CORNER_INFO(GRASS, GRASS, GRASS, GRASS) }, + { 0x0103, "tiles/grass_4.png", TILE_CORNER_INFO(GRASS, GRASS, GRASS, GRASS) }, + { 0x0202, "tiles/dirt_3.png", TILE_CORNER_INFO(DIRT, DIRT, DIRT, DIRT ) }, + { 0x0200, "tiles/dirt_1.png", TILE_CORNER_INFO(DIRT, DIRT, DIRT, DIRT ) }, + { 0x0201, "tiles/dirt_2.png", TILE_CORNER_INFO(DIRT, DIRT, DIRT, DIRT ) }, + { 0x0300, "tiles/water_1.png", TILE_CORNER_INFO(WATER, WATER, WATER, WATER) }, + { 0x0301, "tiles/water_2.png", TILE_CORNER_INFO(WATER, WATER, WATER, WATER) }, + { 0x0400, "tiles/grass_dirt_1.png", TILE_CORNER_INFO(DIRT, DIRT, GRASS, GRASS) }, + { 0x0401, "tiles/grass_dirt_2.png", TILE_CORNER_INFO(DIRT, DIRT, GRASS, GRASS) }, + { 0x0402, "tiles/grass_dirt_3.png", TILE_CORNER_INFO(DIRT, DIRT, GRASS, GRASS) }, + { 0x0410, "tiles/grass_dirt_outer_corner_1.png", TILE_CORNER_INFO(DIRT, DIRT, GRASS, DIRT ) }, + { 0x0411, "tiles/grass_dirt_outer_corner_2.png", TILE_CORNER_INFO(DIRT, DIRT, GRASS, DIRT ) }, + { 0x0420, "tiles/grass_dirt_inner_corner_1.png", TILE_CORNER_INFO(GRASS, DIRT, GRASS, GRASS) }, + { 0x0421, "tiles/grass_dirt_inner_corner_2.png", TILE_CORNER_INFO(GRASS, DIRT, GRASS, GRASS) }, + { 0x0422, "tiles/grass_dirt_inner_corner_3.png", TILE_CORNER_INFO(GRASS, DIRT, GRASS, GRASS) }, + { 0x0423, "tiles/grass_dirt_two_corner.png", TILE_CORNER_INFO(GRASS, DIRT, GRASS, DIRT ) }, }; static vec4 tile_uvs[SDL_arraysize(tile_infos)]; @@ -1971,8 +1971,8 @@ static void update_state_editor() { selected_tile = -1; } - if (ImGui::Selectable("Ground", selected_tile_kind == TILEKIND_GROUND)) { - selected_tile_kind = TILEKIND_GROUND; + if (ImGui::Selectable("Dirt", selected_tile_kind == TILEKIND_DIRT)) { + selected_tile_kind = TILEKIND_DIRT; selected_tile = -1; }