From cdf0665458d0f13da9e298616b7cb38538f3080e Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Mon, 6 Apr 2026 09:14:36 +0200 Subject: [PATCH] llevat soport per a colors amb nom --- config/assets.yaml | 73 +-------- data/palette/aap-64.pal | 67 ++++++++ data/palette/blk-nx64.pal | 67 ++++++++ data/palette/carnival-32.pal | 35 ---- data/palette/cpc-boy.pal | 35 ---- data/palette/cpc.pal | 31 ---- data/palette/downgraded-32.pal | 35 ---- data/palette/endesga-32.pal | 35 ---- data/palette/endesga-64.pal | 67 ++++++++ data/palette/fantasy.pal | 35 ---- data/palette/mulfok32.pal | 35 ---- data/palette/nanner-pancakes.pal | 35 ---- data/palette/pico-8-secret-palette.pal | 35 ---- data/palette/pineapple-32.pal | 35 ---- data/palette/resurrect-32.pal | 35 ---- data/palette/resurrect-64.pal | 67 ++++++++ data/palette/sheltzy32.pal | 35 ---- data/player/player.aseprite | Bin 839 -> 0 bytes data/player/player.gif | Bin 324 -> 428 bytes data/room/01.yaml | 32 ++-- data/room/02.yaml | 38 +++-- data/room/03.yaml | 57 ++++--- data/room/04.yaml | 63 -------- data/room/05.yaml | 79 --------- data/room/06.yaml | 84 ---------- data/room/07.yaml | 110 ------------- data/room/08.yaml | 66 -------- data/room/09.yaml | 75 --------- data/room/10.yaml | 48 ------ data/room/11.yaml | 83 ---------- data/room/12.yaml | 68 -------- data/room/13.yaml | 89 ---------- data/room/14.yaml | 76 --------- data/room/15.yaml | 110 ------------- data/room/16.yaml | 81 ---------- data/room/17.yaml | 76 --------- data/room/18.yaml | 153 ------------------ data/room/19.yaml | 90 ----------- data/room/20.yaml | 68 -------- data/room/21.yaml | 75 --------- data/room/22.yaml | 79 --------- data/room/23.yaml | 76 --------- data/room/24.yaml | 86 ---------- data/room/25.yaml | 100 ------------ data/room/26.yaml | 131 --------------- data/room/27.yaml | 58 ------- data/room/28.yaml | 55 ------- data/room/29.yaml | 84 ---------- data/room/30.yaml | 74 --------- data/room/31.yaml | 84 ---------- data/room/32.yaml | 60 ------- data/room/33.yaml | 86 ---------- data/room/34.yaml | 88 ---------- data/room/35.yaml | 101 ------------ data/room/36.yaml | 134 --------------- data/room/37.yaml | 92 ----------- data/room/38.yaml | 109 ------------- data/room/39.yaml | 106 ------------ data/room/40.yaml | 96 ----------- data/room/41.yaml | 106 ------------ data/room/42.yaml | 69 -------- data/room/43.yaml | 63 -------- data/room/44.yaml | 64 -------- data/room/45.yaml | 76 --------- data/room/46.yaml | 72 --------- data/room/47.yaml | 103 ------------ data/room/48.yaml | 84 ---------- data/room/49.yaml | 52 ------ data/room/50.yaml | 78 --------- data/room/51.yaml | 76 --------- data/room/52.yaml | 55 ------- data/room/53.yaml | 89 ---------- data/room/54.yaml | 81 ---------- data/room/55.yaml | 68 -------- data/room/56.yaml | 78 --------- data/room/57.yaml | 96 ----------- data/room/58.yaml | 86 ---------- data/room/59.yaml | 91 ----------- data/room/60.yaml | 88 ---------- data/tilesets/standard.gif | Bin 9299 -> 8354 bytes source/core/rendering/pixel_reveal.cpp | 4 +- source/core/rendering/screen.cpp | 4 +- .../rendering/sdl3gpu/downscale_frag_spv.h | 3 +- .../core/rendering/sdl3gpu/postfx_frag_spv.h | 3 +- .../core/rendering/sdl3gpu/postfx_vert_spv.h | 3 +- .../core/rendering/sdl3gpu/upscale_frag_spv.h | 3 +- source/core/rendering/surface.cpp | 4 +- source/core/rendering/text.cpp | 4 +- source/core/resources/resource_cache.cpp | 8 +- source/core/system/debug.cpp | 2 +- source/game/editor/editor_statusbar.cpp | 39 ++--- source/game/editor/editor_statusbar.hpp | 16 +- source/game/editor/map_editor.cpp | 122 +++++++------- source/game/editor/map_editor.hpp | 4 +- source/game/editor/mini_map.cpp | 14 +- source/game/editor/room_saver.cpp | 26 ++- source/game/editor/tile_picker.cpp | 12 +- source/game/entities/enemy.cpp | 5 +- source/game/entities/enemy.hpp | 3 +- source/game/entities/player.cpp | 12 +- source/game/gameplay/collision_map.hpp | 7 +- source/game/gameplay/room.cpp | 20 ++- source/game/gameplay/room.hpp | 31 ++-- source/game/gameplay/room_loader.cpp | 40 ++--- source/game/gameplay/scoreboard.cpp | 21 ++- source/game/gameplay/tilemap_renderer.cpp | 23 ++- source/game/gameplay/tilemap_renderer.hpp | 12 +- source/game/scenes/credits.cpp | 58 +++---- source/game/scenes/ending.cpp | 8 +- source/game/scenes/ending2.cpp | 17 +- source/game/scenes/game.cpp | 22 +-- source/game/scenes/game_over.cpp | 11 +- source/game/scenes/loading_screen.cpp | 30 ++-- source/game/scenes/loading_screen.hpp | 3 +- source/game/scenes/logo.cpp | 24 +-- source/game/scenes/title.cpp | 28 ++-- source/game/ui/console_commands.cpp | 9 +- source/game/ui/notifier.cpp | 12 +- source/utils/defines.hpp | 10 +- source/utils/utils.cpp | 71 -------- source/utils/utils.hpp | 30 ---- 121 files changed, 676 insertions(+), 5754 deletions(-) create mode 100644 data/palette/aap-64.pal create mode 100644 data/palette/blk-nx64.pal delete mode 100644 data/palette/carnival-32.pal delete mode 100644 data/palette/cpc-boy.pal delete mode 100755 data/palette/cpc.pal delete mode 100644 data/palette/downgraded-32.pal delete mode 100644 data/palette/endesga-32.pal create mode 100644 data/palette/endesga-64.pal delete mode 100644 data/palette/fantasy.pal delete mode 100644 data/palette/mulfok32.pal delete mode 100644 data/palette/nanner-pancakes.pal delete mode 100644 data/palette/pico-8-secret-palette.pal delete mode 100644 data/palette/pineapple-32.pal delete mode 100644 data/palette/resurrect-32.pal create mode 100644 data/palette/resurrect-64.pal delete mode 100644 data/palette/sheltzy32.pal delete mode 100644 data/player/player.aseprite delete mode 100644 data/room/04.yaml delete mode 100644 data/room/05.yaml delete mode 100644 data/room/06.yaml delete mode 100644 data/room/07.yaml delete mode 100644 data/room/08.yaml delete mode 100644 data/room/09.yaml delete mode 100644 data/room/10.yaml delete mode 100644 data/room/11.yaml delete mode 100644 data/room/12.yaml delete mode 100644 data/room/13.yaml delete mode 100644 data/room/14.yaml delete mode 100644 data/room/15.yaml delete mode 100644 data/room/16.yaml delete mode 100644 data/room/17.yaml delete mode 100644 data/room/18.yaml delete mode 100644 data/room/19.yaml delete mode 100644 data/room/20.yaml delete mode 100644 data/room/21.yaml delete mode 100644 data/room/22.yaml delete mode 100644 data/room/23.yaml delete mode 100644 data/room/24.yaml delete mode 100644 data/room/25.yaml delete mode 100644 data/room/26.yaml delete mode 100644 data/room/27.yaml delete mode 100644 data/room/28.yaml delete mode 100644 data/room/29.yaml delete mode 100644 data/room/30.yaml delete mode 100644 data/room/31.yaml delete mode 100644 data/room/32.yaml delete mode 100644 data/room/33.yaml delete mode 100644 data/room/34.yaml delete mode 100644 data/room/35.yaml delete mode 100644 data/room/36.yaml delete mode 100644 data/room/37.yaml delete mode 100644 data/room/38.yaml delete mode 100644 data/room/39.yaml delete mode 100644 data/room/40.yaml delete mode 100644 data/room/41.yaml delete mode 100644 data/room/42.yaml delete mode 100644 data/room/43.yaml delete mode 100644 data/room/44.yaml delete mode 100644 data/room/45.yaml delete mode 100644 data/room/46.yaml delete mode 100644 data/room/47.yaml delete mode 100644 data/room/48.yaml delete mode 100644 data/room/49.yaml delete mode 100644 data/room/50.yaml delete mode 100644 data/room/51.yaml delete mode 100644 data/room/52.yaml delete mode 100644 data/room/53.yaml delete mode 100644 data/room/54.yaml delete mode 100644 data/room/55.yaml delete mode 100644 data/room/56.yaml delete mode 100644 data/room/57.yaml delete mode 100644 data/room/58.yaml delete mode 100644 data/room/59.yaml delete mode 100644 data/room/60.yaml diff --git a/config/assets.yaml b/config/assets.yaml index 66b749c..59be9ec 100644 --- a/config/assets.yaml +++ b/config/assets.yaml @@ -20,18 +20,10 @@ assets: # PALETTES palettes: PALETTE: - - ${PREFIX}/data/palette/cpc.pal - - ${PREFIX}/data/palette/carnival-32.pal - - ${PREFIX}/data/palette/cpc-boy.pal - - ${PREFIX}/data/palette/downgraded-32.pal - - ${PREFIX}/data/palette/endesga-32.pal - - ${PREFIX}/data/palette/fantasy.pal - - ${PREFIX}/data/palette/mulfok32.pal - - ${PREFIX}/data/palette/nanner-pancakes.pal - - ${PREFIX}/data/palette/pico-8-secret-palette.pal - - ${PREFIX}/data/palette/pineapple-32.pal - - ${PREFIX}/data/palette/resurrect-32.pal - - ${PREFIX}/data/palette/sheltzy32.pal + - ${PREFIX}/data/palette/aap-64.pal + - ${PREFIX}/data/palette/blk-nx64.pal + - ${PREFIX}/data/palette/endesga-64.pal + - ${PREFIX}/data/palette/resurrect-64.pal # LOCALE locale: @@ -77,63 +69,6 @@ assets: - ${PREFIX}/data/room/01.yaml - ${PREFIX}/data/room/02.yaml - ${PREFIX}/data/room/03.yaml - - ${PREFIX}/data/room/04.yaml - - ${PREFIX}/data/room/05.yaml - - ${PREFIX}/data/room/06.yaml - - ${PREFIX}/data/room/07.yaml - - ${PREFIX}/data/room/08.yaml - - ${PREFIX}/data/room/09.yaml - - ${PREFIX}/data/room/10.yaml - - ${PREFIX}/data/room/11.yaml - - ${PREFIX}/data/room/12.yaml - - ${PREFIX}/data/room/13.yaml - - ${PREFIX}/data/room/14.yaml - - ${PREFIX}/data/room/15.yaml - - ${PREFIX}/data/room/16.yaml - - ${PREFIX}/data/room/17.yaml - - ${PREFIX}/data/room/18.yaml - - ${PREFIX}/data/room/19.yaml - - ${PREFIX}/data/room/20.yaml - - ${PREFIX}/data/room/21.yaml - - ${PREFIX}/data/room/22.yaml - - ${PREFIX}/data/room/23.yaml - - ${PREFIX}/data/room/24.yaml - - ${PREFIX}/data/room/25.yaml - - ${PREFIX}/data/room/26.yaml - - ${PREFIX}/data/room/27.yaml - - ${PREFIX}/data/room/28.yaml - - ${PREFIX}/data/room/29.yaml - - ${PREFIX}/data/room/30.yaml - - ${PREFIX}/data/room/31.yaml - - ${PREFIX}/data/room/32.yaml - - ${PREFIX}/data/room/33.yaml - - ${PREFIX}/data/room/34.yaml - - ${PREFIX}/data/room/35.yaml - - ${PREFIX}/data/room/36.yaml - - ${PREFIX}/data/room/37.yaml - - ${PREFIX}/data/room/38.yaml - - ${PREFIX}/data/room/39.yaml - - ${PREFIX}/data/room/40.yaml - - ${PREFIX}/data/room/41.yaml - - ${PREFIX}/data/room/42.yaml - - ${PREFIX}/data/room/43.yaml - - ${PREFIX}/data/room/44.yaml - - ${PREFIX}/data/room/45.yaml - - ${PREFIX}/data/room/46.yaml - - ${PREFIX}/data/room/47.yaml - - ${PREFIX}/data/room/48.yaml - - ${PREFIX}/data/room/49.yaml - - ${PREFIX}/data/room/50.yaml - - ${PREFIX}/data/room/51.yaml - - ${PREFIX}/data/room/52.yaml - - ${PREFIX}/data/room/53.yaml - - ${PREFIX}/data/room/54.yaml - - ${PREFIX}/data/room/55.yaml - - ${PREFIX}/data/room/56.yaml - - ${PREFIX}/data/room/57.yaml - - ${PREFIX}/data/room/58.yaml - - ${PREFIX}/data/room/59.yaml - - ${PREFIX}/data/room/60.yaml # TILESETS tilesets: diff --git a/data/palette/aap-64.pal b/data/palette/aap-64.pal new file mode 100644 index 0000000..a79f2d3 --- /dev/null +++ b/data/palette/aap-64.pal @@ -0,0 +1,67 @@ +JASC-PAL +0100 +64 +6 6 8 +20 16 19 +59 23 37 +115 23 45 +180 32 42 +223 62 35 +250 106 10 +249 163 27 +255 213 65 +255 252 64 +214 242 100 +156 219 67 +89 193 53 +20 160 46 +26 122 62 +36 82 59 +18 32 32 +20 52 100 +40 92 196 +36 159 222 +32 214 199 +166 252 219 +255 255 255 +254 243 192 +250 214 184 +245 160 151 +232 106 115 +188 74 155 +121 58 128 +64 51 83 +36 34 52 +34 28 26 +50 43 40 +113 65 59 +187 117 71 +219 164 99 +244 210 156 +218 224 234 +179 185 209 +139 147 175 +109 117 141 +74 84 98 +51 57 65 +66 36 51 +91 49 56 +142 82 82 +186 117 106 +233 181 163 +227 230 255 +185 191 251 +132 155 228 +88 141 190 +71 125 133 +35 103 78 +50 132 100 +93 175 141 +146 220 186 +205 247 226 +228 210 170 +199 176 139 +160 134 98 +121 103 85 +90 78 68 +66 57 52 diff --git a/data/palette/blk-nx64.pal b/data/palette/blk-nx64.pal new file mode 100644 index 0000000..e067fbf --- /dev/null +++ b/data/palette/blk-nx64.pal @@ -0,0 +1,67 @@ +JASC-PAL +0100 +64 +0 0 0 +18 23 61 +41 50 104 +70 75 140 +107 116 178 +144 158 221 +193 217 242 +255 255 255 +162 147 196 +123 106 165 +83 66 127 +60 44 104 +67 30 102 +93 47 140 +133 76 191 +180 131 239 +140 255 155 +66 188 127 +34 137 110 +20 102 91 +15 74 76 +10 42 51 +29 26 89 +50 45 137 +53 74 178 +62 131 209 +80 185 235 +140 218 255 +83 161 173 +59 118 143 +33 82 107 +22 55 85 +0 135 130 +0 170 165 +39 211 203 +120 250 230 +205 197 153 +152 143 100 +92 93 65 +53 63 35 +145 155 69 +175 211 112 +255 224 145 +255 170 110 +255 105 90 +178 60 64 +255 102 117 +221 55 69 +165 38 57 +114 28 47 +178 46 105 +229 66 134 +255 110 175 +255 165 213 +255 211 173 +204 129 122 +137 86 84 +97 57 59 +63 31 60 +114 51 82 +153 76 105 +195 114 137 +242 159 170 +255 204 208 diff --git a/data/palette/carnival-32.pal b/data/palette/carnival-32.pal deleted file mode 100644 index f308455..0000000 --- a/data/palette/carnival-32.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -77 34 53 -113 40 42 -151 86 56 -208 118 62 -235 172 77 -242 208 141 -221 172 136 -198 141 128 -175 109 119 -199 68 70 -159 56 71 -110 64 109 -167 167 88 -113 129 65 -73 101 65 -55 67 59 -42 28 49 -66 49 87 -77 82 138 -85 106 151 -92 129 163 -125 173 200 -176 214 217 -236 230 223 -207 204 202 -166 166 166 -120 120 120 -98 98 98 -74 74 74 -54 54 54 -97 140 112 -139 116 99 diff --git a/data/palette/cpc-boy.pal b/data/palette/cpc-boy.pal deleted file mode 100644 index 535c712..0000000 --- a/data/palette/cpc-boy.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -0 0 0 -27 27 101 -53 53 201 -102 30 37 -85 51 97 -127 53 201 -188 53 53 -192 70 110 -223 109 155 -27 101 27 -27 110 131 -30 121 229 -121 95 27 -128 128 128 -145 148 223 -201 127 53 -227 155 141 -248 120 248 -53 175 53 -53 183 143 -53 193 215 -127 201 53 -173 200 170 -141 225 199 -225 198 67 -228 221 154 -255 255 255 -238 234 224 -172 181 107 -118 132 72 -63 80 63 -36 49 55 diff --git a/data/palette/cpc.pal b/data/palette/cpc.pal deleted file mode 100755 index 4236eee..0000000 --- a/data/palette/cpc.pal +++ /dev/null @@ -1,31 +0,0 @@ -JASC-PAL -0100 -27 -0 0 0 -0 0 0 -0 0 128 -0 0 255 -128 0 0 -128 0 128 -128 0 255 -255 0 0 -255 0 128 -255 0 255 -0 128 0 -0 128 128 -0 128 255 -128 128 0 -128 128 128 -128 128 255 -255 128 0 -255 128 128 -255 128 255 -0 255 0 -0 255 128 -0 255 255 -128 255 0 -128 255 128 -128 255 255 -255 255 0 -255 255 128 -255 255 255 diff --git a/data/palette/downgraded-32.pal b/data/palette/downgraded-32.pal deleted file mode 100644 index cc68a77..0000000 --- a/data/palette/downgraded-32.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -123 51 76 -161 77 85 -199 115 105 -227 160 132 -242 203 155 -211 123 134 -175 93 139 -128 64 133 -91 51 116 -65 32 81 -92 72 106 -136 125 141 -184 180 178 -220 218 201 -255 255 224 -182 245 219 -137 217 217 -114 182 207 -92 139 168 -78 102 121 -70 73 105 -68 53 93 -61 0 61 -98 23 72 -148 44 75 -199 66 79 -224 107 81 -242 165 97 -252 239 141 -177 212 128 -128 184 120 -101 141 120 diff --git a/data/palette/endesga-32.pal b/data/palette/endesga-32.pal deleted file mode 100644 index 3449799..0000000 --- a/data/palette/endesga-32.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -190 74 47 -215 118 67 -234 212 170 -228 166 114 -184 111 80 -115 62 57 -62 39 49 -162 38 51 -228 59 68 -247 118 34 -254 174 52 -254 231 97 -99 199 77 -62 137 72 -38 92 66 -25 60 62 -18 78 137 -0 153 219 -44 232 245 -255 255 255 -192 203 220 -139 155 180 -90 105 136 -58 68 102 -38 43 68 -24 20 37 -255 0 68 -104 56 108 -181 80 136 -246 117 122 -232 183 150 -194 133 105 diff --git a/data/palette/endesga-64.pal b/data/palette/endesga-64.pal new file mode 100644 index 0000000..7184271 --- /dev/null +++ b/data/palette/endesga-64.pal @@ -0,0 +1,67 @@ +JASC-PAL +0100 +64 +255 0 64 +19 19 19 +27 27 27 +39 39 39 +61 61 61 +93 93 93 +133 133 133 +180 180 180 +255 255 255 +199 207 221 +146 161 185 +101 115 146 +66 76 110 +42 47 78 +26 25 50 +14 7 27 +28 18 28 +57 31 33 +93 44 40 +138 72 54 +191 111 74 +230 156 105 +246 202 159 +249 230 207 +237 171 80 +224 116 56 +198 69 36 +142 37 29 +255 80 0 +237 118 20 +255 162 20 +255 200 37 +255 235 87 +211 252 126 +153 230 95 +90 197 79 +51 152 75 +30 111 80 +19 76 76 +12 46 68 +0 57 109 +0 105 170 +0 152 220 +0 205 249 +12 241 255 +148 253 255 +253 210 237 +243 137 245 +219 63 253 +122 9 250 +48 3 217 +12 2 147 +3 25 63 +59 20 67 +98 36 97 +147 56 143 +202 82 201 +200 80 134 +246 129 135 +245 85 93 +234 50 60 +196 36 48 +137 30 43 +87 28 39 diff --git a/data/palette/fantasy.pal b/data/palette/fantasy.pal deleted file mode 100644 index 6f8e373..0000000 --- a/data/palette/fantasy.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -237 228 218 -191 184 180 -145 141 141 -99 97 103 -53 53 64 -169 73 73 -202 89 84 -229 111 75 -227 147 71 -238 181 81 -232 198 91 -189 163 81 -139 145 80 -85 125 85 -68 99 80 -62 85 76 -139 176 173 -118 159 166 -102 141 169 -92 105 159 -90 88 136 -124 109 162 -148 122 157 -188 135 165 -217 166 166 -212 194 182 -189 170 151 -134 115 91 -126 103 76 -115 91 66 -96 75 61 -77 63 56 diff --git a/data/palette/mulfok32.pal b/data/palette/mulfok32.pal deleted file mode 100644 index e7beb11..0000000 --- a/data/palette/mulfok32.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -91 166 117 -107 201 108 -171 221 100 -252 239 141 -255 184 121 -234 98 98 -204 66 94 -163 40 88 -117 23 86 -57 9 71 -97 24 81 -135 53 85 -166 85 95 -201 115 115 -242 174 153 -255 195 242 -238 143 203 -212 110 179 -135 62 132 -31 16 42 -74 48 82 -123 84 128 -166 133 159 -217 189 200 -255 255 255 -174 226 255 -141 183 255 -109 128 250 -132 101 236 -131 77 196 -125 45 160 -78 24 124 diff --git a/data/palette/nanner-pancakes.pal b/data/palette/nanner-pancakes.pal deleted file mode 100644 index 3154b8e..0000000 --- a/data/palette/nanner-pancakes.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -160 221 211 -111 176 183 -87 127 157 -74 87 134 -62 59 102 -57 41 69 -45 30 47 -69 46 63 -93 69 80 -123 98 104 -156 128 126 -195 167 156 -219 201 180 -252 236 209 -170 215 149 -100 176 130 -72 136 133 -63 91 116 -235 200 167 -211 160 132 -184 126 108 -143 82 82 -106 57 72 -197 127 121 -171 89 125 -124 61 100 -78 43 69 -122 59 79 -169 75 84 -216 114 94 -240 159 113 -247 207 145 diff --git a/data/palette/pico-8-secret-palette.pal b/data/palette/pico-8-secret-palette.pal deleted file mode 100644 index 8b4e4ed..0000000 --- a/data/palette/pico-8-secret-palette.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -0 0 0 -29 43 83 -126 37 83 -0 135 81 -171 82 54 -95 87 79 -194 195 199 -255 241 232 -255 0 77 -255 163 0 -255 236 39 -0 228 54 -41 173 255 -131 118 156 -255 119 168 -255 204 170 -41 24 20 -17 29 53 -66 33 54 -18 83 89 -116 47 41 -73 51 59 -162 136 121 -243 239 125 -190 18 80 -255 108 36 -168 231 46 -0 181 67 -6 90 181 -117 70 101 -255 110 89 -255 157 129 diff --git a/data/palette/pineapple-32.pal b/data/palette/pineapple-32.pal deleted file mode 100644 index 783ee83..0000000 --- a/data/palette/pineapple-32.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -67 0 42 -137 0 39 -217 36 60 -255 97 87 -255 183 98 -199 110 70 -115 57 46 -52 17 31 -3 7 16 -39 59 45 -69 130 57 -156 185 59 -255 216 50 -255 130 59 -209 64 31 -124 25 26 -49 12 27 -131 63 52 -235 156 110 -255 218 172 -255 255 228 -191 195 198 -109 138 141 -41 59 73 -4 21 40 -3 62 94 -28 146 167 -119 214 193 -255 224 220 -255 136 169 -192 59 148 -96 23 97 diff --git a/data/palette/resurrect-32.pal b/data/palette/resurrect-32.pal deleted file mode 100644 index 346cc18..0000000 --- a/data/palette/resurrect-32.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -255 255 255 -251 107 29 -232 59 59 -131 28 93 -195 36 84 -240 79 120 -246 129 129 -252 167 144 -227 200 150 -171 148 122 -150 108 108 -98 85 101 -62 53 70 -11 94 101 -11 138 143 -30 188 115 -145 219 105 -251 255 134 -251 185 84 -205 104 61 -158 69 57 -122 48 69 -107 62 117 -144 94 169 -168 132 243 -234 173 237 -143 211 255 -77 155 230 -77 101 180 -72 74 119 -48 225 185 -143 248 226 diff --git a/data/palette/resurrect-64.pal b/data/palette/resurrect-64.pal new file mode 100644 index 0000000..bce601b --- /dev/null +++ b/data/palette/resurrect-64.pal @@ -0,0 +1,67 @@ +JASC-PAL +0100 +64 +46 34 47 +62 53 70 +98 85 101 +150 108 108 +171 148 122 +105 79 98 +127 112 138 +155 171 178 +199 220 208 +255 255 255 +110 39 39 +179 56 49 +234 79 54 +245 125 74 +174 35 52 +232 59 59 +251 107 29 +247 150 23 +249 194 43 +122 48 69 +158 69 57 +205 104 61 +230 144 78 +251 185 84 +76 62 36 +103 102 51 +162 169 71 +213 224 75 +251 255 134 +22 90 76 +35 144 99 +30 188 115 +145 219 105 +205 223 108 +49 54 56 +55 78 74 +84 126 100 +146 169 132 +178 186 144 +11 94 101 +11 138 143 +14 175 155 +48 225 185 +143 248 226 +50 51 83 +72 74 119 +77 101 180 +77 155 230 +143 211 255 +69 41 63 +107 62 117 +144 94 169 +168 132 243 +234 173 237 +117 60 84 +162 75 111 +207 101 127 +237 128 153 +131 28 93 +195 36 84 +240 79 120 +246 129 129 +252 167 144 +253 203 176 diff --git a/data/palette/sheltzy32.pal b/data/palette/sheltzy32.pal deleted file mode 100644 index 3f0013e..0000000 --- a/data/palette/sheltzy32.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -140 255 222 -69 184 179 -131 151 64 -201 236 133 -70 198 87 -21 137 104 -44 91 109 -34 42 92 -86 106 137 -139 171 191 -204 226 225 -255 219 165 -204 172 104 -163 109 62 -104 60 52 -0 0 0 -56 0 44 -102 59 147 -139 114 222 -156 216 252 -94 150 221 -57 83 192 -128 12 83 -195 75 145 -255 148 179 -189 31 63 -236 97 74 -255 164 104 -255 246 174 -255 218 112 -244 176 60 -255 255 255 diff --git a/data/player/player.aseprite b/data/player/player.aseprite deleted file mode 100644 index 5b22555479b9c73beeaaca71783039bc7db20ee9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 839 zcmZ=~W?*=*l$C*lK>&yu85kH+fEWQ37#KlcN_=*<~#r z_5t=PhUV%(3nWnN2L=!_U|}dv%*o~h3MnWsK_vdG0BIHlWQG5MB0LPi1x1-9sS3dv zsi`GFKoM3229PHh{zEkay$TH0iaEMnhFlB=JWOvdEtO>X|Nr``wJ&5F8ICjZdAex- z6PMfmIb%ADb9eltKP$a>Z)we*`G)C89Sb8UqJDj31P2|+)DR#B*#H6v8$c0TF~|0l zAs>SR2lIhl8%|tk`TzfF)WNm_0fr5t9FsPjKKv%bDbvKodvSQ*(iiLZZMb{i)%LR( z-+cq-jY&YWknNzpFVfI#2m|tQ`@$ON3m&F`n3y*XhyK3TI?8Wom&Lk4Mq*Nj^3$_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v6m|kobgPE_OXv#*mt7~UT=QiUO zdt=L`t+9xU%T6@lxcS9ReRa`vvpq(Y{V=3Ui8;Y zt;awU<+W4UQxxa)Q#FdosYjd7e@={d|AF{zF}B~zBbQe(%D>-H*1o$lOAoDY3~ya$ zUQQXmdoCM%xy^j+nw8%6T#pt%FY@d?QLFP>-1jMMNPAf_qW-gIKy}kN;(H=v?A8mS zdTCn`-~EXAbEX?Jq`xHb*!KJN(qQR+ctq@ooBR2C!T-7GH~w0Qw zzIq{i3_F^lYyhT*B7q1#mtGigi3zq2%^lvSx2gr{Hu>Tzq znqZzpI!}sXiOvGa%fh!FV>o+3;7-M4Fx`iL`y|r^IjF^8p#xm+NbIn}qvQhF+Jmsk z0zx_v(L*>45~e1B?igLVhms`dguW=U4OzLs#|=% zYCSjw3&DtebD$ZNphobYOtNI7q7~7cRDLODFD+V;+Ko9ulbkJ+VOfrY5fGW<(WKO4`*_lt)7{`-oq5(V-?zC`bq5q^L zCkh-F75OMui6yIFVpn?vaVk+f+9Pe*0i~!(?3tsdq%z;f)1w1xc94DU0{br(gqVPD z96wP{LWpA2`A5-(^k-dv6;g8s68{2{=`r(FTVt3Ui^?i{I+WRuGm4#9`m?DC*eVN_ zbiW};By!s-cKa7jsyFJ`YuyiD@FT;x4JmjzIG}N0_Tr1jx+)`hDnmg!u`yyHptT92 z%l3mPr@kxquf!z@>-RW{$96kWs-{H~FXP=kfO@D^G?$?dS_@x9d%DT<@&w(8VTr8v zMd_DwS|vpLKw{`nRST_&r&&V%SYT}BFx5FvE{KT@ZM^E7zyT6Z4lGRWNGzEs881S` o9o=2YHbN8LlZ^Xd1BW3eCrB`)LweKoHIh@MV67Tp06_Hr0I341$^ZZW diff --git a/source/core/rendering/pixel_reveal.cpp b/source/core/rendering/pixel_reveal.cpp index bc712ca..8beec6e 100644 --- a/source/core/rendering/pixel_reveal.cpp +++ b/source/core/rendering/pixel_reveal.cpp @@ -22,7 +22,7 @@ PixelReveal::PixelReveal(int width, int height, float pixels_per_second, float s mode_(mode) { // En modo normal: empieza negro sólido (se irá revelando a transparente) // En modo inverso: empieza transparente (se irá cubriendo de negro) - const auto INITIAL_COLOR = reverse_ ? static_cast(PaletteColor::TRANSPARENT) : static_cast(PaletteColor::BLACK); + const auto INITIAL_COLOR = reverse_ ? 255 : 0; cover_surface_->clear(INITIAL_COLOR); if (mode_ == RevealMode::ORDERED) { @@ -68,7 +68,7 @@ PixelReveal::PixelReveal(int width, int height, float pixels_per_second, float s // Actualiza el estado del revelado void PixelReveal::update(float time_active) { // NOLINT(readability-make-member-function-const) // En modo normal revela (pone transparente); en modo inverso cubre (pone negro) - const auto PIXEL_COLOR = reverse_ ? static_cast(PaletteColor::BLACK) : static_cast(PaletteColor::TRANSPARENT); + const auto PIXEL_COLOR = reverse_ ? 0 : 255; for (int r = 0; r < height_; r++) { const float T_START = static_cast(r) / pixels_per_second_; diff --git a/source/core/rendering/screen.cpp b/source/core/rendering/screen.cpp index dc2acbf..3d2b24d 100644 --- a/source/core/rendering/screen.cpp +++ b/source/core/rendering/screen.cpp @@ -56,7 +56,7 @@ Screen::Screen() { game_surface_dstrect_ = {.x = Options::video.border.width, .y = Options::video.border.height, .w = Options::game.width, .h = Options::game.height}; // Define el color del borde para el modo de pantalla completa - border_color_ = static_cast(PaletteColor::BLACK); + border_color_ = 0; // Crea la textura donde se dibujan los graficos del juego game_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, Options::game.width, Options::game.height); @@ -76,7 +76,7 @@ Screen::Screen() { // Crea las surfaces (PaletteManager aplicará la paleta inicial en su constructor) game_surface_ = std::make_shared(Options::game.width, Options::game.height); - game_surface_->clear(static_cast(PaletteColor::BLACK)); + game_surface_->clear(0); border_surface_ = std::make_shared(Options::game.width + (Options::video.border.width * 2), Options::game.height + (Options::video.border.height * 2)); border_surface_->clear(border_color_); diff --git a/source/core/rendering/sdl3gpu/downscale_frag_spv.h b/source/core/rendering/sdl3gpu/downscale_frag_spv.h index 6d96082..cf0f341 100644 --- a/source/core/rendering/sdl3gpu/downscale_frag_spv.h +++ b/source/core/rendering/sdl3gpu/downscale_frag_spv.h @@ -4249,5 +4249,6 @@ static const uint8_t kdownscale_frag_spv[] = { 0x38, 0x00, 0x01, - 0x00}; + 0x00, +}; static const size_t kdownscale_frag_spv_size = 4248; diff --git a/source/core/rendering/sdl3gpu/postfx_frag_spv.h b/source/core/rendering/sdl3gpu/postfx_frag_spv.h index 8811d52..a60ea13 100644 --- a/source/core/rendering/sdl3gpu/postfx_frag_spv.h +++ b/source/core/rendering/sdl3gpu/postfx_frag_spv.h @@ -11713,5 +11713,6 @@ static const uint8_t kpostfx_frag_spv[] = { 0x38, 0x00, 0x01, - 0x00}; + 0x00, +}; static const size_t kpostfx_frag_spv_size = 11712; diff --git a/source/core/rendering/sdl3gpu/postfx_vert_spv.h b/source/core/rendering/sdl3gpu/postfx_vert_spv.h index 1be581e..b5c80f9 100644 --- a/source/core/rendering/sdl3gpu/postfx_vert_spv.h +++ b/source/core/rendering/sdl3gpu/postfx_vert_spv.h @@ -1445,5 +1445,6 @@ static const uint8_t kpostfx_vert_spv[] = { 0x38, 0x00, 0x01, - 0x00}; + 0x00, +}; static const size_t kpostfx_vert_spv_size = 1444; diff --git a/source/core/rendering/sdl3gpu/upscale_frag_spv.h b/source/core/rendering/sdl3gpu/upscale_frag_spv.h index af2b2da..46e7c30 100644 --- a/source/core/rendering/sdl3gpu/upscale_frag_spv.h +++ b/source/core/rendering/sdl3gpu/upscale_frag_spv.h @@ -629,5 +629,6 @@ static const uint8_t kupscale_frag_spv[] = { 0x38, 0x00, 0x01, - 0x00}; + 0x00, +}; static const size_t kupscale_frag_spv_size = 628; diff --git a/source/core/rendering/surface.cpp b/source/core/rendering/surface.cpp index cd3942b..2548e5f 100644 --- a/source/core/rendering/surface.cpp +++ b/source/core/rendering/surface.cpp @@ -93,10 +93,10 @@ auto readPalFile(const std::string& file_path) -> Palette { // Constructor Surface::Surface(int w, int h) : surface_data_(std::make_shared(w, h)), - transparent_color_(static_cast(PaletteColor::TRANSPARENT)) { initializeSubPalette(sub_palette_); } + transparent_color_(255) { initializeSubPalette(sub_palette_); } Surface::Surface(const std::string& file_path) - : transparent_color_(static_cast(PaletteColor::TRANSPARENT)) { + : transparent_color_(255) { SurfaceData loaded_data = loadSurface(file_path); surface_data_ = std::make_shared(std::move(loaded_data)); diff --git a/source/core/rendering/text.cpp b/source/core/rendering/text.cpp index 4a76380..82bc50b 100644 --- a/source/core/rendering/text.cpp +++ b/source/core/rendering/text.cpp @@ -176,7 +176,7 @@ auto Text::writeToSurface(const std::string& text, int zoom, int kerning) -> std auto surface = std::make_shared(width, height); auto previuos_renderer = Screen::get()->getRendererSurface(); Screen::get()->setRendererSurface(surface); - surface->clear(stringToColor("transparent")); + surface->clear(255); write(0, 0, text, kerning); Screen::get()->setRendererSurface(previuos_renderer); @@ -190,7 +190,7 @@ auto Text::writeDXToSurface(Uint8 flags, const std::string& text, int kerning, U auto surface = std::make_shared(width, height); auto previuos_renderer = Screen::get()->getRendererSurface(); Screen::get()->setRendererSurface(surface); - surface->clear(stringToColor("transparent")); + surface->clear(255); writeDX(flags, 0, 0, text, kerning, text_color, shadow_distance, shadow_color, lenght); Screen::get()->setRendererSurface(previuos_renderer); diff --git a/source/core/resources/resource_cache.cpp b/source/core/resources/resource_cache.cpp index d9f9b0c..dc42261 100644 --- a/source/core/resources/resource_cache.cpp +++ b/source/core/resources/resource_cache.cpp @@ -61,7 +61,7 @@ namespace Resource { // por lo que updateZoomFactor() se llamará correctamente en RenderInfo::init(). if (loading_mode_ == LoadingMode::EAGER) { calculateTotal(); - Screen::get()->setBorderColor(static_cast(PaletteColor::BLACK)); + Screen::get()->setBorderColor(0); std::cout << "\n** LOADING RESOURCES" << '\n'; loadSounds(); loadMusics(); @@ -499,11 +499,11 @@ namespace Resource { const float BAR_POSITION = Options::game.height - BAR_HEIGHT - Y_PADDING; Screen::get()->start(); - Screen::get()->clearSurface(static_cast(PaletteColor::BLACK)); + Screen::get()->clearSurface(0); auto surface = Screen::get()->getRendererSurface(); - const auto LOADING_TEXT_COLOR = static_cast(PaletteColor::BRIGHT_WHITE); - const auto BAR_COLOR = static_cast(PaletteColor::WHITE); + const auto LOADING_TEXT_COLOR = 15; + const auto BAR_COLOR = 14; const int TEXT_HEIGHT = loading_text_->getCharacterSize(); const int CENTER_X = Options::game.width / 2; const int CENTER_Y = Options::game.height / 2; diff --git a/source/core/system/debug.cpp b/source/core/system/debug.cpp index 344704d..fbe2251 100644 --- a/source/core/system/debug.cpp +++ b/source/core/system/debug.cpp @@ -66,7 +66,7 @@ void Debug::render() { // NOLINT(readability-make-member-function-const) y = 0; for (const auto& l : log_) { - text->writeColored(x_ + 10, y, l, static_cast(PaletteColor::WHITE)); + text->writeColored(x_ + 10, y, l, 14); y += CHAR_SIZE + 1; } } diff --git a/source/game/editor/editor_statusbar.cpp b/source/game/editor/editor_statusbar.cpp index 7cc786f..771c6af 100644 --- a/source/game/editor/editor_statusbar.cpp +++ b/source/game/editor/editor_statusbar.cpp @@ -10,14 +10,13 @@ #include "core/rendering/text.hpp" // Para Text #include "core/resources/resource_cache.hpp" // Para Resource::Cache #include "game/options.hpp" // Para Options::game -#include "utils/defines.hpp" // Para Tile::SIZE -#include "utils/utils.hpp" // Para stringToColor, toLower +#include "utils/utils.hpp" // Para toLower // Constructor EditorStatusBar::EditorStatusBar(std::string room_number) : room_number_(std::move(room_number)) { const float SURFACE_WIDTH = Options::game.width; - constexpr float SURFACE_HEIGHT = 6.0F * Tile::SIZE; // 48 pixels, igual que el scoreboard + constexpr float SURFACE_HEIGHT = 24.0F; // 3 líneas de 8px surface_ = std::make_shared(SURFACE_WIDTH, SURFACE_HEIGHT); surface_dest_ = {.x = 0, .y = Options::game.height - SURFACE_HEIGHT, .w = SURFACE_WIDTH, .h = SURFACE_HEIGHT}; @@ -48,16 +47,26 @@ void EditorStatusBar::fillTexture() { auto previous_renderer = Screen::get()->getRendererSurface(); Screen::get()->setRendererSurface(surface_); - surface_->clear(stringToColor("black")); + surface_->clear(0); auto text = Resource::Cache::get()->getText("8bithud"); - const Uint8 LABEL_COLOR = stringToColor("bright_cyan"); - const Uint8 VALUE_COLOR = stringToColor("white"); - const Uint8 DETAIL_COLOR = stringToColor("bright_yellow"); + const Uint8 LABEL_COLOR = 11; + const Uint8 VALUE_COLOR = 14; + const Uint8 DETAIL_COLOR = 13; + const Uint8 COORD_COLOR = 9; + const int RIGHT_X = static_cast(Options::game.width) - LEFT_X; - // Línea 1: Número de la habitación + // Línea 1: Room number (izq) + line4 extra (centro) + tile coords + line5 drag info (der) text->writeColored(LEFT_X, LINE1_Y, toLower(room_number_), LABEL_COLOR); + // Tile coords + drag info a la derecha + const std::string TILE_X_STR = (mouse_tile_x_ < 10 ? "0" : "") + std::to_string(mouse_tile_x_); + const std::string TILE_Y_STR = (mouse_tile_y_ < 10 ? "0" : "") + std::to_string(mouse_tile_y_); + std::string right_part = TILE_X_STR + "," + TILE_Y_STR; + if (!line5_.empty()) { right_part += " " + line5_; } + if (!line4_.empty()) { right_part = toLower(line4_) + " " + right_part; } + text->writeColored(RIGHT_X - text->length(right_part), LINE1_Y, right_part, COORD_COLOR); + // Línea 2: Propiedades de room o info de enemigo if (!line2_.empty()) { text->writeColored(LEFT_X, LINE2_Y, toLower(line2_), DETAIL_COLOR); @@ -68,20 +77,6 @@ void EditorStatusBar::fillTexture() { text->writeColored(LEFT_X, LINE3_Y, toLower(line3_), VALUE_COLOR); } - // Línea 4: Extra - if (!line4_.empty()) { - text->writeColored(LEFT_X, LINE4_Y, toLower(line4_), DETAIL_COLOR); - } - - // Línea 5: Tile coords + drag info - const std::string TILE_X_STR = (mouse_tile_x_ < 10 ? "0" : "") + std::to_string(mouse_tile_x_); - const std::string TILE_Y_STR = (mouse_tile_y_ < 10 ? "0" : "") + std::to_string(mouse_tile_y_); - std::string line5 = "tile:" + TILE_X_STR + "," + TILE_Y_STR; - if (!line5_.empty()) { - line5 += " " + line5_; - } - text->writeColored(LEFT_X, LINE5_Y, toLower(line5), stringToColor("bright_green")); - Screen::get()->setRendererSurface(previous_renderer); } diff --git a/source/game/editor/editor_statusbar.hpp b/source/game/editor/editor_statusbar.hpp index 3a51dc0..af36446 100644 --- a/source/game/editor/editor_statusbar.hpp +++ b/source/game/editor/editor_statusbar.hpp @@ -25,13 +25,11 @@ class EditorStatusBar { private: void fillTexture(); // Dibuja los elementos en la surface - // Constantes de posición (en pixels dentro de la surface de 256x48) - // Font 8bithud lowercase = 6px alto → 5 líneas con 8px de separación - static constexpr int LINE1_Y = 2; // Nombre de la habitación - static constexpr int LINE2_Y = 10; // Propiedades de room / enemy info - static constexpr int LINE3_Y = 18; // Conexiones+items / enemy detail - static constexpr int LINE4_Y = 26; // Extra - static constexpr int LINE5_Y = 34; // Tile coords + drag info + // Constantes de posición (en pixels dentro de la surface de 256x24) + // Font 8bithud lowercase = 6px alto → 3 líneas con 8px de separación + static constexpr int LINE1_Y = 1; // Room number + tile coords + extra + static constexpr int LINE2_Y = 9; // Propiedades de room / enemy info + static constexpr int LINE3_Y = 17; // Conexiones+items / enemy detail static constexpr int LEFT_X = 4; // Margen izquierdo // Objetos @@ -44,8 +42,8 @@ class EditorStatusBar { int mouse_tile_y_{0}; // Coordenada Y del ratón en tiles std::string line2_; // Contenido de la línea 2 std::string line3_; // Contenido de la línea 3 - std::string line4_; // Contenido de la línea 4 - std::string line5_; // Contenido de la línea 5 + std::string line4_; // Contenido de la línea 4 (mostrado en la línea 1 a la derecha) + std::string line5_; // Contenido de la línea 5 (mostrado en la línea 1 al centro) }; #endif // _DEBUG diff --git a/source/game/editor/map_editor.cpp b/source/game/editor/map_editor.cpp index 1f3c843..ce524f5 100644 --- a/source/game/editor/map_editor.cpp +++ b/source/game/editor/map_editor.cpp @@ -28,7 +28,7 @@ #include "game/options.hpp" // Para Options #include "game/ui/console.hpp" // Para Console #include "utils/defines.hpp" // Para Tile::SIZE, PlayArea -#include "utils/utils.hpp" // Para stringToColor +#include "utils/utils.hpp" // Singleton MapEditor* MapEditor::instance_ = nullptr; @@ -70,17 +70,17 @@ void MapEditor::loadSettings() { if (yaml.contains("grid")) { settings_.grid = yaml["grid"].get_value(); } if (yaml.contains("show_render_info")) { settings_.show_render_info = yaml["show_render_info"].get_value(); } if (yaml.contains("minimap_bg")) { - if (yaml["minimap_bg"].is_string()) { - settings_.minimap_bg = yaml["minimap_bg"].get_value(); - } else if (yaml["minimap_bg"].is_integer()) { - settings_.minimap_bg = std::to_string(yaml["minimap_bg"].get_value()); + if (yaml["minimap_bg"].is_integer()) { + settings_.minimap_bg = static_cast(yaml["minimap_bg"].get_value()); + } else if (yaml["minimap_bg"].is_string()) { + settings_.minimap_bg = static_cast(safeStoi(yaml["minimap_bg"].get_value(), 2)); } } if (yaml.contains("minimap_conn")) { - if (yaml["minimap_conn"].is_string()) { - settings_.minimap_conn = yaml["minimap_conn"].get_value(); - } else if (yaml["minimap_conn"].is_integer()) { - settings_.minimap_conn = std::to_string(yaml["minimap_conn"].get_value()); + if (yaml["minimap_conn"].is_integer()) { + settings_.minimap_conn = static_cast(yaml["minimap_conn"].get_value()); + } else if (yaml["minimap_conn"].is_string()) { + settings_.minimap_conn = static_cast(safeStoi(yaml["minimap_conn"].get_value(), 14)); } } } catch (...) { @@ -99,8 +99,8 @@ void MapEditor::saveSettings() const { file << "# Map Editor Settings\n"; file << "grid: " << (settings_.grid ? "true" : "false") << "\n"; file << "show_render_info: " << (settings_.show_render_info ? "true" : "false") << "\n"; - file << "minimap_bg: " << settings_.minimap_bg << "\n"; - file << "minimap_conn: " << settings_.minimap_conn << "\n"; + file << "minimap_bg: " << static_cast(settings_.minimap_bg) << "\n"; + file << "minimap_conn: " << static_cast(settings_.minimap_conn) << "\n"; file.close(); } @@ -121,16 +121,14 @@ auto MapEditor::showGrid(bool show) -> std::string { return show ? "Grid ON" : "Grid OFF"; } -// Parsea un color por nombre o índice numérico +// Parsea un color como índice numérico static auto parseColor(const std::string& value) -> Uint8 { - try { - return static_cast(std::stoi(value)); - } catch (...) { return stringToColor(value); } + return static_cast(safeStoi(value, 0)); } void MapEditor::toggleMiniMap() { if (!mini_map_) { - mini_map_ = std::make_unique(parseColor(settings_.minimap_bg), parseColor(settings_.minimap_conn)); + mini_map_ = std::make_unique(settings_.minimap_bg, settings_.minimap_conn); mini_map_->on_navigate = [this](const std::string& room_name) { mini_map_visible_ = false; reenter_ = true; @@ -143,7 +141,7 @@ void MapEditor::toggleMiniMap() { mini_map_visible_ = !mini_map_visible_; if (mini_map_visible_) { // Reconstruir el minimapa (pueden haber cambiado rooms, conexiones, tiles) - mini_map_ = std::make_unique(parseColor(settings_.minimap_bg), parseColor(settings_.minimap_conn)); + mini_map_ = std::make_unique(settings_.minimap_bg, settings_.minimap_conn); mini_map_->on_navigate = [this](const std::string& room_name) { mini_map_visible_ = false; reenter_ = true; @@ -157,21 +155,21 @@ void MapEditor::toggleMiniMap() { } auto MapEditor::setMiniMapBg(const std::string& color) -> std::string { - settings_.minimap_bg = toLower(color); + settings_.minimap_bg = static_cast(safeStoi(color, 2)); saveSettings(); if (mini_map_) { - mini_map_->rebuild(parseColor(settings_.minimap_bg), parseColor(settings_.minimap_conn)); + mini_map_->rebuild(settings_.minimap_bg, settings_.minimap_conn); } - return "minimap bg: " + settings_.minimap_bg; + return "minimap bg: " + std::to_string(settings_.minimap_bg); } auto MapEditor::setMiniMapConn(const std::string& color) -> std::string { - settings_.minimap_conn = toLower(color); + settings_.minimap_conn = static_cast(safeStoi(color, 14)); saveSettings(); if (mini_map_) { - mini_map_->rebuild(parseColor(settings_.minimap_bg), parseColor(settings_.minimap_conn)); + mini_map_->rebuild(settings_.minimap_bg, settings_.minimap_conn); } - return "minimap conn: " + settings_.minimap_conn; + return "minimap conn: " + std::to_string(settings_.minimap_conn); } // Entra en modo editor @@ -286,7 +284,7 @@ auto MapEditor::revert() -> std::string { // Refrescar visuales de la habitación room_->setBgColor(room_data_.bg_color); - Screen::get()->setBorderColor(stringToColor(room_data_.border_color)); + Screen::get()->setBorderColor(room_data_.border_color); // Restaurar el tilemap completo for (int i = 0; i < static_cast(room_data_.tile_map.size()); ++i) { @@ -435,7 +433,7 @@ void MapEditor::handleEvent(const SDL_Event& event) { // NOLINT(readability-fun tile_picker_.on_select = [this](int tile) { brush_tile_ = tile; }; - tile_picker_.open(room_->getTileSetFile(), current, stringToColor(room_data_.bg_color)); + tile_picker_.open(room_->getTileSetFile(), current, room_data_.bg_color); return; } @@ -692,7 +690,7 @@ void MapEditor::renderSelectionHighlight() { .y = enemy_rect.y - 1, .w = enemy_rect.w + 2, .h = enemy_rect.h + 2}; - game_surface->drawRectBorder(&border, stringToColor("bright_green")); + game_surface->drawRectBorder(&border, 9); } // Highlight del item seleccionado (persistente, color bright_green) @@ -703,13 +701,13 @@ void MapEditor::renderSelectionHighlight() { .y = item_rect.y - 1, .w = item_rect.w + 2, .h = item_rect.h + 2}; - game_surface->drawRectBorder(&border, stringToColor("bright_green")); + game_surface->drawRectBorder(&border, 9); } // Highlight del drag activo (temporal, color bright_white) if (drag_.target == DragTarget::NONE || !drag_.moved) { return; } - const Uint8 DRAG_COLOR = stringToColor("bright_white"); + const Uint8 DRAG_COLOR = 15; SDL_FRect highlight_rect{}; switch (drag_.target) { @@ -757,9 +755,9 @@ void MapEditor::renderEnemyBoundaries() { auto game_surface = Screen::get()->getRendererSurface(); if (!game_surface) { return; } - const Uint8 COLOR_BOUND1 = stringToColor("bright_cyan"); - const Uint8 COLOR_BOUND2 = stringToColor("bright_yellow"); - const Uint8 COLOR_ROUTE = stringToColor("bright_white"); + const Uint8 COLOR_BOUND1 = 11; + const Uint8 COLOR_BOUND2 = 13; + const Uint8 COLOR_ROUTE = 15; for (int i = 0; i < static_cast(room_data_.enemies.size()); ++i) { const auto& enemy = room_data_.enemies[i]; @@ -878,7 +876,7 @@ void MapEditor::updateStatusBarInfo() { // NOLINT(readability-function-cognitiv auto dot = anim.rfind('.'); if (dot != std::string::npos) { anim = anim.substr(0, dot); } - line2 = "enemy " + std::to_string(selected_enemy_) + ": " + anim + " " + e.color; + line2 = "enemy " + std::to_string(selected_enemy_) + ": " + anim + " c:" + std::to_string(e.color); line3 = "vx:" + std::to_string(static_cast(e.vx)) + " vy:" + std::to_string(static_cast(e.vy)); if (e.flip) { line3 += " flip"; } @@ -898,10 +896,10 @@ void MapEditor::updateStatusBarInfo() { // NOLINT(readability-function-cognitiv conv = "right"; } - line2 = "bg:" + room_data_.bg_color + " brd:" + room_data_.border_color + " conv:" + conv; + line2 = "bg:" + std::to_string(room_data_.bg_color) + " brd:" + std::to_string(room_data_.border_color) + " conv:" + conv; line3 = "u:" + conn(room_data_.upper_room) + " d:" + conn(room_data_.lower_room) + " l:" + conn(room_data_.left_room) + " r:" + conn(room_data_.right_room) + - " itm:" + room_data_.item_color1 + "/" + room_data_.item_color2; + " itm:" + std::to_string(room_data_.item_color1) + "/" + std::to_string(room_data_.item_color2); } // Línea 4: brush activo @@ -971,10 +969,10 @@ auto MapEditor::setEnemyProperty(const std::string& property, const std::string& } if (property == "COLOR") { - std::string color = toLower(value); + auto color = static_cast(safeStoi(value, 14)); // Intentar recrear el enemigo con el nuevo color - std::string old_color = enemy.color; + Uint8 old_color = enemy.color; enemy.color = color; try { auto* enemy_mgr = room_->getEnemyManager(); @@ -985,7 +983,7 @@ auto MapEditor::setEnemyProperty(const std::string& property, const std::string& } autosave(); - return "color: " + color; + return "color: " + std::to_string(color); } if (property == "VX") { @@ -1063,7 +1061,7 @@ auto MapEditor::addEnemy() -> std::string { new_enemy.y1 = static_cast(CENTER_Y); new_enemy.x2 = static_cast(CENTER_X + ROUTE_HALF); new_enemy.y2 = static_cast(CENTER_Y); - new_enemy.color = "white"; + new_enemy.color = 14; new_enemy.flip = true; new_enemy.frame = -1; @@ -1131,35 +1129,35 @@ auto MapEditor::setRoomProperty(const std::string& property, const std::string& std::string val = toLower(value); if (property == "BGCOLOR") { - val = colorToString(stringToColor(val)); // Normaliza a nombre canónico (acepta nombres e índices) - room_data_.bg_color = val; - room_->setBgColor(val); + auto color = static_cast(safeStoi(val, 0)); + room_data_.bg_color = color; + room_->setBgColor(color); autosave(); - return "bgcolor: " + val; + return "bgcolor: " + std::to_string(color); } if (property == "BORDER") { - val = colorToString(stringToColor(val)); - room_data_.border_color = val; - Screen::get()->setBorderColor(stringToColor(val)); + auto color = static_cast(safeStoi(val, 0)); + room_data_.border_color = color; + Screen::get()->setBorderColor(color); autosave(); - return "border: " + val; + return "border: " + std::to_string(color); } if (property == "ITEMCOLOR1") { - val = colorToString(stringToColor(val)); - room_data_.item_color1 = val; + auto color = static_cast(safeStoi(val, 0)); + room_data_.item_color1 = color; room_->setItemColors(room_data_.item_color1, room_data_.item_color2); autosave(); - return "itemcolor1: " + val; + return "itemcolor1: " + std::to_string(color); } if (property == "ITEMCOLOR2") { - val = colorToString(stringToColor(val)); - room_data_.item_color2 = val; + auto color = static_cast(safeStoi(val, 0)); + room_data_.item_color2 = color; room_->setItemColors(room_data_.item_color1, room_data_.item_color2); autosave(); - return "itemcolor2: " + val; + return "itemcolor2: " + std::to_string(color); } if (property == "CONVEYOR") { @@ -1320,11 +1318,11 @@ auto MapEditor::createNewRoom(const std::string& direction) -> std::string { // // Crear Room::Data por defecto con conexión recíproca Room::Data new_room; new_room.number = std::string(name_buf).substr(0, std::string(name_buf).find('.')); - new_room.bg_color = "black"; - new_room.border_color = "magenta"; + new_room.bg_color = 0; + new_room.border_color = 6; new_room.tile_set_file = "standard.gif"; - new_room.item_color1 = "bright_cyan"; - new_room.item_color2 = "yellow"; + new_room.item_color1 = 11; + new_room.item_color2 = 12; new_room.upper_room = "0"; new_room.lower_room = "0"; new_room.left_room = "0"; @@ -1531,9 +1529,7 @@ void MapEditor::openTilePicker(const std::string& tileset_name, int current_tile autosave(); }; // Pasar color de fondo de la habitación + color de sustitución del item - int bg = stringToColor(room_data_.bg_color); - int item_color = stringToColor(room_data_.item_color1); - tile_picker_.open(tileset_name, current_tile, bg, 1, item_color); + tile_picker_.open(tileset_name, current_tile, room_data_.bg_color, 1, room_data_.item_color1); } // Crea un nuevo item con valores por defecto, centrado en la habitación @@ -1546,8 +1542,8 @@ auto MapEditor::addItem() -> std::string { new_item.x = PlayArea::CENTER_X; new_item.y = PlayArea::CENTER_Y; new_item.counter = 0; - new_item.color1 = stringToColor(room_data_.item_color1); - new_item.color2 = stringToColor(room_data_.item_color2); + new_item.color1 = room_data_.item_color1; + new_item.color2 = room_data_.item_color2; room_data_.items.push_back(new_item); room_->getItemManager()->addItem(std::make_shared(new_item)); @@ -1600,7 +1596,7 @@ auto MapEditor::duplicateItem() -> std::string { // Elige un color de grid que contraste con el fondo // Empieza con bright_black (1), si coincide con el bg en la paleta activa, sube índices static auto pickGridColor(Uint8 bg, const std::shared_ptr& surface) -> Uint8 { - auto grid = static_cast(PaletteColor::BRIGHT_BLACK); + Uint8 grid = 1; Uint32 bg_argb = surface->getPaletteColor(bg); // Si bright_black es igual al bg, buscar el siguiente color distinto @@ -1616,7 +1612,7 @@ void MapEditor::renderGrid() const { auto game_surface = Screen::get()->getRendererSurface(); if (!game_surface) { return; } - const Uint8 COLOR = pickGridColor(stringToColor(room_data_.bg_color), game_surface); + const Uint8 COLOR = pickGridColor(room_data_.bg_color, game_surface); // Líneas verticales (cada 8 pixels) for (int x = Tile::SIZE; x < PlayArea::WIDTH; x += Tile::SIZE) { diff --git a/source/game/editor/map_editor.hpp b/source/game/editor/map_editor.hpp index 31befa6..74f9df5 100644 --- a/source/game/editor/map_editor.hpp +++ b/source/game/editor/map_editor.hpp @@ -74,8 +74,8 @@ class MapEditor { struct Settings { bool grid{false}; bool show_render_info{false}; - std::string minimap_bg{"blue"}; - std::string minimap_conn{"white"}; + Uint8 minimap_bg{2}; + Uint8 minimap_conn{14}; }; Settings settings_; void loadSettings(); diff --git a/source/game/editor/mini_map.cpp b/source/game/editor/mini_map.cpp index aaae8da..6ccebea 100644 --- a/source/game/editor/mini_map.cpp +++ b/source/game/editor/mini_map.cpp @@ -15,7 +15,7 @@ #include "core/resources/resource_cache.hpp" // Para Resource::Cache #include "game/gameplay/room.hpp" // Para Room::Data #include "utils/defines.hpp" // Para Tile::SIZE, PlayArea -#include "utils/utils.hpp" // Para stringToColor +#include "utils/utils.hpp" // Constructor: construye todo el minimapa MiniMap::MiniMap(Uint8 bg_color, Uint8 conn_color) @@ -129,6 +129,7 @@ void MiniMap::layoutRooms() { for (const auto& [neighbor_name, dx, dy] : neighbors) { if (neighbor_name == "0" || neighbor_name.empty()) { continue; } if (visited.contains(neighbor_name)) { continue; } + if (!room_map.contains(neighbor_name)) { continue; } // Room no existe en cache GridPos neighbor_pos = {.x = pos.x + dx, .y = pos.y + dy}; auto nkey = std::make_pair(neighbor_pos.x, neighbor_pos.y); @@ -169,14 +170,19 @@ void MiniMap::buildRoomSurfaces() { // Genera la mini-surface de una room: 1 pixel por tile, color predominante auto MiniMap::getRoomMiniSurface(const std::string& room_name) -> std::shared_ptr { - auto room_data = Resource::Cache::get()->getRoom(room_name); + std::shared_ptr room_data; + try { + room_data = Resource::Cache::get()->getRoom(room_name); + } catch (...) { + return nullptr; // Room no existe en cache + } if (!room_data) { return nullptr; } auto surface = std::make_shared(ROOM_W, ROOM_H); auto prev = Screen::get()->getRendererSurface(); Screen::get()->setRendererSurface(surface); - surface->clear(stringToColor(room_data->bg_color)); + surface->clear(room_data->bg_color); const auto& tile_map = room_data->tile_map; for (int y = 0; y < ROOM_H; ++y) { @@ -318,7 +324,7 @@ void MiniMap::render(const std::string& current_room) { auto cur_h = static_cast(CELL_H + 2); if (cur_x >= 0 && cur_y >= 0 && cur_x + cur_w <= PlayArea::WIDTH && cur_y + cur_h <= PlayArea::HEIGHT) { SDL_FRect highlight = {.x = cur_x, .y = cur_y, .w = cur_w, .h = cur_h}; - game_surface->drawRectBorder(&highlight, stringToColor("bright_white")); + game_surface->drawRectBorder(&highlight, 15); } } } diff --git a/source/game/editor/room_saver.cpp b/source/game/editor/room_saver.cpp index 80a51f3..ff08902 100644 --- a/source/game/editor/room_saver.cpp +++ b/source/game/editor/room_saver.cpp @@ -43,8 +43,8 @@ auto RoomSaver::buildYAML(const fkyaml::node& original_yaml, const Room::Data& r // --- Sección room --- out << "room:\n"; - out << " bgColor: " << room_data.bg_color << "\n"; - out << " border: " << room_data.border_color << "\n"; + out << " bgColor: " << static_cast(room_data.bg_color) << "\n"; + out << " border: " << static_cast(room_data.border_color) << "\n"; out << " tileSetFile: " << room_data.tile_set_file << "\n"; // Conexiones @@ -59,31 +59,29 @@ auto RoomSaver::buildYAML(const fkyaml::node& original_yaml, const Room::Data& r // Colores de items out << "\n"; out << " # Colores de los objetos\n"; - out << " itemColor1: " << (room_data.item_color1.empty() ? "yellow" : room_data.item_color1) << "\n"; - out << " itemColor2: " << (room_data.item_color2.empty() ? "magenta" : room_data.item_color2) << "\n"; + out << " itemColor1: " << static_cast(room_data.item_color1) << "\n"; + out << " itemColor2: " << static_cast(room_data.item_color2) << "\n"; // Conveyor belt out << "\n"; out << " # Dirección de la cinta transportadora: left, none, right\n"; out << " conveyorBelt: " << conveyorBeltToString(room_data.conveyor_belt_direction) << "\n"; - // --- Tilemap (16 filas × 32 columnas, formato flow) --- + // --- Tilemap (MAP_HEIGHT filas × MAP_WIDTH columnas, formato flow) --- out << "\n"; - out << "# Tilemap: 16 filas × 32 columnas (256×192 píxeles @ 8px/tile)\n"; + out << "# Tilemap: " << Map::HEIGHT << " filas x " << Map::WIDTH << " columnas @ " << Tile::SIZE << "px/tile\n"; out << "# Índices de tiles (-1 = vacío)\n"; out << "tilemap:\n"; - constexpr int MAP_WIDTH = 32; - constexpr int MAP_HEIGHT = 16; - for (int row = 0; row < MAP_HEIGHT; ++row) { + for (int row = 0; row < Map::HEIGHT; ++row) { out << " - ["; - for (int col = 0; col < MAP_WIDTH; ++col) { - int index = (row * MAP_WIDTH) + col; + for (int col = 0; col < Map::WIDTH; ++col) { + int index = (row * Map::WIDTH) + col; if (index < static_cast(room_data.tile_map.size())) { out << room_data.tile_map[index]; } else { out << -1; } - if (col < MAP_WIDTH - 1) { out << ", "; } + if (col < Map::WIDTH - 1) { out << ", "; } } out << "]\n"; } @@ -110,8 +108,8 @@ auto RoomSaver::buildYAML(const fkyaml::node& original_yaml, const Room::Data& r out << " position1: {x: " << b1_x << ", y: " << b1_y << "}\n"; out << " position2: {x: " << b2_x << ", y: " << b2_y << "}\n"; - if (!enemy.color.empty() && enemy.color != "white") { - out << " color: " << enemy.color << "\n"; + if (enemy.color != 14) { + out << " color: " << static_cast(enemy.color) << "\n"; } if (enemy.flip) { out << " flip: true\n"; } if (enemy.mirror) { out << " mirror: true\n"; } diff --git a/source/game/editor/tile_picker.cpp b/source/game/editor/tile_picker.cpp index 5d2df2e..9ff740c 100644 --- a/source/game/editor/tile_picker.cpp +++ b/source/game/editor/tile_picker.cpp @@ -8,7 +8,7 @@ #include "core/rendering/surface.hpp" // Para Surface #include "core/resources/resource_cache.hpp" // Para Resource::Cache #include "utils/defines.hpp" // Para Tile::SIZE, PlayArea -#include "utils/utils.hpp" // Para stringToColor +#include "utils/utils.hpp" // Margen del borde alrededor del tileset (en pixels) static constexpr int BORDER_PAD = 3; @@ -51,14 +51,14 @@ void TilePicker::open(const std::string& tileset_name, int current_tile, int bg_ auto prev = Screen::get()->getRendererSurface(); Screen::get()->setRendererSurface(frame_surface_); - Uint8 fill_color = (bg_color >= 0) ? static_cast(bg_color) : stringToColor("black"); + Uint8 fill_color = (bg_color >= 0) ? static_cast(bg_color) : 0; frame_surface_->clear(fill_color); // Borde doble SDL_FRect outer = {.x = 0, .y = 0, .w = static_cast(frame_w), .h = static_cast(frame_h)}; - frame_surface_->drawRectBorder(&outer, stringToColor("bright_white")); + frame_surface_->drawRectBorder(&outer, 15); SDL_FRect inner = {.x = 1, .y = 1, .w = static_cast(frame_w - 2), .h = static_cast(frame_h - 2)}; - frame_surface_->drawRectBorder(&inner, stringToColor("white")); + frame_surface_->drawRectBorder(&inner, 14); // Renderizar cada tile individualmente constexpr auto TS = static_cast(Tile::SIZE); @@ -153,7 +153,7 @@ void TilePicker::render() { float hy = tileset_screen_y + static_cast(row * out_cell); if (hy >= 0 && hy + TS <= visible_height_) { SDL_FRect highlight = {.x = hx, .y = hy, .w = TS, .h = TS}; - game_surface->drawRectBorder(&highlight, stringToColor("bright_white")); + game_surface->drawRectBorder(&highlight, 15); } } @@ -165,7 +165,7 @@ void TilePicker::render() { float cy = tileset_screen_y + static_cast(row * out_cell); if (cy >= 0 && cy + TS <= visible_height_) { SDL_FRect cur_rect = {.x = cx, .y = cy, .w = TS, .h = TS}; - game_surface->drawRectBorder(&cur_rect, stringToColor("bright_green")); + game_surface->drawRectBorder(&cur_rect, 9); } } } diff --git a/source/game/entities/enemy.cpp b/source/game/entities/enemy.cpp index cf69499..c5488af 100644 --- a/source/game/entities/enemy.cpp +++ b/source/game/entities/enemy.cpp @@ -6,12 +6,11 @@ #include "core/rendering/sprite/animated_sprite.hpp" // Para SAnimatedSprite #include "core/resources/resource_cache.hpp" // Para Resource -#include "utils/utils.hpp" // Para stringToColor +#include "utils/utils.hpp" // Constructor Enemy::Enemy(const Data& enemy) : sprite_(std::make_shared(Resource::Cache::get()->getAnimationData(enemy.animation_path))), - color_string_(enemy.color), x1_(enemy.x1), x2_(enemy.x2), y1_(enemy.y1), @@ -30,7 +29,7 @@ Enemy::Enemy(const Data& enemy) collider_ = getRect(); - color_ = stringToColor(color_string_); + color_ = enemy.color; // Coloca un frame al azar o el designado sprite_->setCurrentAnimationFrame((enemy.frame == -1) ? (rand() % sprite_->getCurrentAnimationSize()) : enemy.frame); diff --git a/source/game/entities/enemy.hpp b/source/game/entities/enemy.hpp index 8a9a5a1..6aa22a4 100644 --- a/source/game/entities/enemy.hpp +++ b/source/game/entities/enemy.hpp @@ -21,7 +21,7 @@ class Enemy { bool flip{false}; // Indica si el enemigo hace flip al terminar su ruta bool mirror{false}; // Indica si el enemigo está volteado verticalmente int frame{0}; // Frame inicial para la animación del enemigo - std::string color; // Color del enemigo + Uint8 color{14}; // Color del enemigo (default: white=14) }; explicit Enemy(const Data& enemy); // Constructor @@ -44,7 +44,6 @@ class Enemy { // Variables Uint8 color_{0}; // Color del enemigo - std::string color_string_; // Color del enemigo en formato texto int x1_{0}; // Limite izquierdo de la ruta en el eje X int x2_{0}; // Limite derecho de la ruta en el eje X int y1_{0}; // Limite superior de la ruta en el eje Y diff --git a/source/game/entities/player.cpp b/source/game/entities/player.cpp index 2dba90e..3486131 100644 --- a/source/game/entities/player.cpp +++ b/source/game/entities/player.cpp @@ -35,8 +35,8 @@ void Player::render() { sprite_->render(1, color_); #ifdef _DEBUG if (Debug::get()->isEnabled()) { - Screen::get()->getRendererSurface()->putPixel(under_right_foot_.x, under_right_foot_.y, static_cast(PaletteColor::GREEN)); - Screen::get()->getRendererSurface()->putPixel(under_left_foot_.x, under_left_foot_.y, static_cast(PaletteColor::GREEN)); + Screen::get()->getRendererSurface()->putPixel(under_right_foot_.x, under_right_foot_.y, 8); + Screen::get()->getRendererSurface()->putPixel(under_left_foot_.x, under_left_foot_.y, 8); } #endif } @@ -566,14 +566,14 @@ void Player::setColor(Uint8 color) { if (Options::game.player_color >= 0) { color_ = static_cast(Options::game.player_color); } else { - color_ = static_cast(PaletteColor::WHITE); + color_ = 14; } // Si el color coincide con el fondo de la habitación, usar fallback if (room_ != nullptr && color_ == room_->getBGColor()) { - color_ = (room_->getBGColor() != static_cast(PaletteColor::WHITE)) - ? static_cast(PaletteColor::WHITE) - : static_cast(PaletteColor::BRIGHT_BLACK); + color_ = (room_->getBGColor() != 14) + ? 14 + : 1; } } diff --git a/source/game/gameplay/collision_map.hpp b/source/game/gameplay/collision_map.hpp index b4a6466..e867409 100644 --- a/source/game/gameplay/collision_map.hpp +++ b/source/game/gameplay/collision_map.hpp @@ -4,6 +4,7 @@ #include // Para vector +#include "utils/defines.hpp" // Para Tile::SIZE, Map::WIDTH, Map::HEIGHT #include "utils/utils.hpp" // Para LineHorizontal, LineDiagonal, LineVertical /** @@ -83,9 +84,9 @@ class CollisionMap { private: // --- Constantes --- - static constexpr int TILE_SIZE = 8; // Tamaño del tile en pixels - static constexpr int MAP_WIDTH = 32; // Ancho del mapa en tiles - static constexpr int MAP_HEIGHT = 16; // Alto del mapa en tiles + static constexpr int TILE_SIZE = ::Tile::SIZE; // Tamaño del tile en pixels + static constexpr int MAP_WIDTH = ::Map::WIDTH; // Ancho del mapa en tiles + static constexpr int MAP_HEIGHT = ::Map::HEIGHT; // Alto del mapa en tiles // --- Datos de la habitación --- std::vector tile_map_; // Índices de tiles de la habitación diff --git a/source/game/gameplay/room.cpp b/source/game/gameplay/room.cpp index 62c3cf5..702c41b 100644 --- a/source/game/gameplay/room.cpp +++ b/source/game/gameplay/room.cpp @@ -14,7 +14,7 @@ #include "game/gameplay/scoreboard.hpp" // Para Scoreboard::Data #include "game/gameplay/tilemap_renderer.hpp" // Para TilemapRenderer #include "utils/defines.hpp" // Para TILE_SIZE -#include "utils/utils.hpp" // Para stringToColor +#include "utils/utils.hpp" // Constructor Room::Room(const std::string& room_path, std::shared_ptr data) @@ -35,7 +35,7 @@ Room::Room(const std::string& room_path, std::shared_ptr data) tilemap_renderer_ = std::make_unique(tile_map_, tile_set_width_, surface_, bg_color_, conveyor_belt_direction_); tilemap_renderer_->initialize(collision_map_.get()); // Inicializa (crea map_surface, pinta tiles, busca animados) - Screen::get()->setBorderColor(stringToColor(border_color_)); // Establece el color del borde + Screen::get()->setBorderColor(border_color_); // Establece el color del borde } // Destructor @@ -46,8 +46,8 @@ void Room::initializeRoom(const Data& room) { number_ = room.number; bg_color_ = room.bg_color; border_color_ = room.border_color; - item_color1_ = room.item_color1.empty() ? "yellow" : room.item_color1; - item_color2_ = room.item_color2.empty() ? "magenta" : room.item_color2; + item_color1_ = room.item_color1; + item_color2_ = room.item_color2; upper_room_ = room.upper_room; lower_room_ = room.lower_room; left_room_ = room.left_room; @@ -71,8 +71,8 @@ void Room::initializeRoom(const Data& room) { if (!ItemTracker::get()->hasBeenPicked(room.number, ITEM_POS)) { // Crear una copia local de los datos del item Item::Data item_copy = item; - item_copy.color1 = stringToColor(item_color1_); - item_copy.color2 = stringToColor(item_color2_); + item_copy.color1 = item_color1_; + item_copy.color2 = item_color2_; // Crear el objeto Item usando la copia modificada item_manager_->addItem(std::make_shared(item_copy)); @@ -142,21 +142,19 @@ void Room::setTile(int index, int tile_value) { } // Cambia color de fondo y redibuja el mapa (para editor) -void Room::setBgColor(const std::string& color) { +void Room::setBgColor(Uint8 color) { bg_color_ = color; tilemap_renderer_->setBgColor(color); tilemap_renderer_->redrawMap(collision_map_.get()); } // Cambia colores de items en vivo (para editor) -void Room::setItemColors(const std::string& color1, const std::string& color2) { +void Room::setItemColors(Uint8 color1, Uint8 color2) { item_color1_ = color1; item_color2_ = color2; - Uint8 c1 = stringToColor(color1); - Uint8 c2 = stringToColor(color2); auto* item_mgr = item_manager_.get(); for (int i = 0; i < item_mgr->getCount(); ++i) { - item_mgr->getItem(i)->setColors(c1, c2); + item_mgr->getItem(i)->setColors(color1, color2); } } #endif diff --git a/source/game/gameplay/room.hpp b/source/game/gameplay/room.hpp index a14fcd2..23123c7 100644 --- a/source/game/gameplay/room.hpp +++ b/source/game/gameplay/room.hpp @@ -9,6 +9,7 @@ #include "game/entities/enemy.hpp" // Para EnemyData #include "game/entities/item.hpp" // Para ItemData #include "game/gameplay/scoreboard.hpp" // Para Scoreboard::Data +#include "utils/defines.hpp" // Para Tile::SIZE, Map::WIDTH, Map::HEIGHT #include "utils/utils.hpp" // Para LineHorizontal, LineDiagonal, LineVertical class Sprite; // lines 12-12 class Surface; // lines 13-13 @@ -40,10 +41,10 @@ class Room { struct Data { std::string number; // Numero de la habitación - std::string bg_color; // Color de fondo de la habitación - std::string border_color; // Color del borde de la pantalla - std::string item_color1; // Color 1 para los items de la habitación - std::string item_color2; // Color 2 para los items de la habitación + Uint8 bg_color{0}; // Color de fondo de la habitación + Uint8 border_color{0}; // Color del borde de la pantalla + Uint8 item_color1{12}; // Color 1 para los items de la habitación + Uint8 item_color2{6}; // Color 2 para los items de la habitación std::string upper_room; // Identificador de la habitación que se encuentra arriba std::string lower_room; // Identificador de la habitación que se encuentra abajo std::string left_room; // Identificador de la habitación que se encuentra a la izquierda @@ -61,8 +62,8 @@ class Room { // --- Funciones --- [[nodiscard]] auto getNumber() const -> const std::string& { return number_; } // Devuelve el numero de la habitación - [[nodiscard]] auto getBGColor() const -> Uint8 { return stringToColor(bg_color_); } // Devuelve el color de la habitación - [[nodiscard]] auto getBorderColor() const -> Uint8 { return stringToColor(border_color_); } // Devuelve el color del borde + [[nodiscard]] auto getBGColor() const -> Uint8 { return bg_color_; } // Devuelve el color de la habitación + [[nodiscard]] auto getBorderColor() const -> Uint8 { return border_color_; } // Devuelve el color del borde void renderMap(); // Dibuja el mapa en pantalla void renderEnemies(); // Dibuja los enemigos en pantalla void renderItems(); // Dibuja los objetos en pantalla @@ -72,8 +73,8 @@ class Room { void resetEnemyPositions(const std::vector& enemy_data); // Resetea enemigos a posiciones iniciales auto getEnemyManager() -> EnemyManager* { return enemy_manager_.get(); } // Acceso al gestor de enemigos (para editor) auto getItemManager() -> ItemManager* { return item_manager_.get(); } // Acceso al gestor de items (para editor) - void setBgColor(const std::string& color); // Cambia color de fondo y redibuja (para editor) - void setItemColors(const std::string& color1, const std::string& color2); // Cambia colores de items (para editor) + void setBgColor(Uint8 color); // Cambia color de fondo y redibuja (para editor) + void setItemColors(Uint8 color1, Uint8 color2); // Cambia colores de items (para editor) void setTile(int index, int tile_value); // Cambia un tile y redibuja (para editor) [[nodiscard]] auto getTileSetFile() const -> const std::string& { return tile_set_file_; } [[nodiscard]] auto getTileSetWidth() const -> int { return tile_set_width_; } @@ -106,9 +107,9 @@ class Room { private: // Constantes - static constexpr int TILE_SIZE = 8; // Ancho del tile en pixels - static constexpr int MAP_WIDTH = 32; // Ancho del mapa en tiles - static constexpr int MAP_HEIGHT = 16; // Alto del mapa en tiles + static constexpr int TILE_SIZE = ::Tile::SIZE; // Ancho del tile en pixels + static constexpr int MAP_WIDTH = ::Map::WIDTH; // Ancho del mapa en tiles + static constexpr int MAP_HEIGHT = ::Map::HEIGHT; // Alto del mapa en tiles // Objetos y punteros std::unique_ptr enemy_manager_; // Gestor de enemigos de la habitación @@ -120,10 +121,10 @@ class Room { // --- Variables --- std::string number_; // Numero de la habitación - std::string bg_color_; // Color de fondo de la habitación - std::string border_color_; // Color del borde de la pantalla - std::string item_color1_; // Color 1 para los items de la habitación - std::string item_color2_; // Color 2 para los items de la habitación + Uint8 bg_color_{0}; // Color de fondo de la habitación + Uint8 border_color_{0}; // Color del borde de la pantalla + Uint8 item_color1_{12}; // Color 1 para los items de la habitación + Uint8 item_color2_{6}; // Color 2 para los items de la habitación std::string upper_room_; // Identificador de la habitación que se encuentra arriba std::string lower_room_; // Identificador de la habitación que se encuentra abajp std::string left_room_; // Identificador de la habitación que se encuentra a la izquierda diff --git a/source/game/gameplay/room_loader.cpp b/source/game/gameplay/room_loader.cpp index 0af8183..223f963 100644 --- a/source/game/gameplay/room_loader.cpp +++ b/source/game/gameplay/room_loader.cpp @@ -6,7 +6,7 @@ #include "core/resources/resource_helper.hpp" // Para Resource::Helper #include "external/fkyaml_node.hpp" // Para fkyaml::node #include "utils/defines.hpp" // Para Tile::SIZE -#include "utils/utils.hpp" // Para stringToColor +#include "utils/utils.hpp" // Convierte room connection de YAML a formato interno auto RoomLoader::convertRoomConnection(const std::string& value) -> std::string { // NOLINT(readability-convert-member-functions-to-static) @@ -20,11 +20,11 @@ auto RoomLoader::convertRoomConnection(const std::string& value) -> std::string return value + ".yaml"; } -// Lee un nodo de color tolerando tanto string ("red", "bright_blue") como entero (índice de paleta) -static auto readColorNode(const fkyaml::node& node) -> std::string { - if (node.is_string()) { return node.get_value(); } - if (node.is_integer()) { return std::to_string(node.get_value()); } - return "black"; +// Lee un nodo de color como Uint8 (acepta entero directo o string numérico) +static auto readColorNode(const fkyaml::node& node) -> Uint8 { + if (node.is_integer()) { return static_cast(node.get_value()); } + if (node.is_string()) { return static_cast(safeStoi(node.get_value(), 0)); } + return 0; } // Convierte string de autoSurface a int @@ -47,7 +47,7 @@ auto RoomLoader::convertAutoSurface(const fkyaml::node& node) -> int { // NOLIN // Convierte un tilemap 2D a vector 1D flat auto RoomLoader::flattenTilemap(const std::vector>& tilemap_2d) -> std::vector { // NOLINT(readability-convert-member-functions-to-static, readability-named-parameter) std::vector tilemap_flat; - tilemap_flat.reserve(512); // 16 rows × 32 cols + tilemap_flat.reserve(Map::WIDTH * Map::HEIGHT); for (const auto& row : tilemap_2d) { for (int tile : row) { @@ -86,13 +86,13 @@ void RoomLoader::parseRoomConfig(const fkyaml::node& yaml, Room::Data& room, con } // Item colors - room.item_color1 = room_node.contains("itemColor1") - ? readColorNode(room_node["itemColor1"]) - : "yellow"; + if (room_node.contains("itemColor1")) { + room.item_color1 = readColorNode(room_node["itemColor1"]); + } - room.item_color2 = room_node.contains("itemColor2") - ? readColorNode(room_node["itemColor2"]) - : "magenta"; + if (room_node.contains("itemColor2")) { + room.item_color2 = readColorNode(room_node["itemColor2"]); + } // Dirección de la cinta transportadora (left/none/right) room.conveyor_belt_direction = room_node.contains("conveyorBelt") @@ -130,11 +130,11 @@ void RoomLoader::parseTilemap(const fkyaml::node& yaml, Room::Data& room, const // Read 2D array std::vector> tilemap_2d; - tilemap_2d.reserve(16); + tilemap_2d.reserve(Map::HEIGHT); for (const auto& row_node : tilemap_node) { std::vector row; - row.reserve(32); + row.reserve(Map::WIDTH); for (const auto& tile_node : row_node) { row.push_back(tile_node.get_value()); @@ -225,9 +225,9 @@ auto RoomLoader::parseEnemyData(const fkyaml::node& enemy_node) -> Enemy::Data { } // Color - enemy.color = enemy_node.contains("color") - ? enemy_node["color"].get_value_or("white") - : "white"; + if (enemy_node.contains("color")) { + enemy.color = readColorNode(enemy_node["color"]); + } // Optional fields enemy.flip = enemy_node.contains("flip") @@ -293,8 +293,8 @@ auto RoomLoader::parseItemData(const fkyaml::node& item_node, const Room::Data& : 0; // Colors (assigned from room defaults) - item.color1 = stringToColor(room.item_color1); - item.color2 = stringToColor(room.item_color2); + item.color1 = room.item_color1; + item.color2 = room.item_color2; return item; } diff --git a/source/game/gameplay/scoreboard.cpp b/source/game/gameplay/scoreboard.cpp index 47bdd0d..f60b2a7 100644 --- a/source/game/gameplay/scoreboard.cpp +++ b/source/game/gameplay/scoreboard.cpp @@ -13,7 +13,7 @@ #include "game/entities/player.hpp" // Para Player::skinToAnimationPath #include "game/options.hpp" // Para Options, options, Cheat, OptionsGame #include "utils/defines.hpp" // Para BLOCK -#include "utils/utils.hpp" // Para stringToColor +#include "utils/utils.hpp" // Constructor Scoreboard::Scoreboard(std::shared_ptr data) @@ -32,13 +32,10 @@ Scoreboard::Scoreboard(std::shared_ptr data) surface_dest_ = {.x = 0, .y = Options::game.height - SURFACE_HEIGHT, .w = SURFACE_WIDTH, .h = SURFACE_HEIGHT}; // Inicializa el color de items - items_color_ = stringToColor("white"); + items_color_ = 14; // Inicializa el vector de colores - const std::vector COLORS = {"blue", "magenta", "green", "cyan", "yellow", "white", "bright_blue", "bright_magenta", "bright_green", "bright_cyan", "bright_yellow", "bright_white"}; - for (const auto& color : COLORS) { - color_.push_back(stringToColor(color)); - } + color_ = {2, 6, 8, 10, 12, 14, 3, 7, 9, 11, 13, 15}; } // Pinta el objeto en pantalla @@ -118,9 +115,9 @@ void Scoreboard::updateItemsColor(float delta_time) { // Alternar color cada ITEMS_COLOR_BLINK_DURATION if (items_color_timer_ < ITEMS_COLOR_BLINK_DURATION) { - items_color_ = stringToColor("white"); + items_color_ = 14; } else { - items_color_ = stringToColor("magenta"); + items_color_ = 6; } } @@ -136,7 +133,7 @@ void Scoreboard::fillTexture() { Screen::get()->setRendererSurface(surface_); // Limpia la textura - surface_->clear(stringToColor("black")); + surface_->clear(0); // Dibuja las vidas const int WALK_FRAMES = player_sprite_->getCurrentAnimationSize(); @@ -164,11 +161,11 @@ void Scoreboard::fillTexture() { text->writeColored(ITEMS_LABEL_X, LINE1_Y, Locale::get()->get("scoreboard.items"), data_->color); // NOLINT(readability-static-accessed-through-instance) text->writeColored(ITEMS_VALUE_X, LINE1_Y, ITEMS_TEXT, items_color_); text->writeColored(TIME_LABEL_X, LINE1_Y, Locale::get()->get("scoreboard.time"), data_->color); // NOLINT(readability-static-accessed-through-instance) - text->writeColored(TIME_VALUE_X, LINE1_Y, TIME_TEXT, stringToColor("white")); + text->writeColored(TIME_VALUE_X, LINE1_Y, TIME_TEXT, 14); const std::string ROOMS_TEXT = std::to_string(data_->rooms / 100) + std::to_string((data_->rooms % 100) / 10) + std::to_string(data_->rooms % 10); - text->writeColored(ROOMS_LABEL_X, LINE2_Y, Locale::get()->get("scoreboard.rooms"), stringToColor("white")); // NOLINT(readability-static-accessed-through-instance) - text->writeColored(ROOMS_VALUE_X, LINE2_Y, ROOMS_TEXT, stringToColor("white")); + text->writeColored(ROOMS_LABEL_X, LINE2_Y, Locale::get()->get("scoreboard.rooms"), 14); // NOLINT(readability-static-accessed-through-instance) + text->writeColored(ROOMS_VALUE_X, LINE2_Y, ROOMS_TEXT, 14); // Indicadores de trucos activos (fuente 8bithud) auto cheat_text = Resource::Cache::get()->getText("8bithud"); diff --git a/source/game/gameplay/tilemap_renderer.cpp b/source/game/gameplay/tilemap_renderer.cpp index 1b21658..7a284fb 100644 --- a/source/game/gameplay/tilemap_renderer.cpp +++ b/source/game/gameplay/tilemap_renderer.cpp @@ -10,11 +10,11 @@ #include "utils/utils.hpp" // Constructor -TilemapRenderer::TilemapRenderer(std::vector tile_map, int tile_set_width, std::shared_ptr tileset_surface, std::string bg_color, int conveyor_belt_direction) +TilemapRenderer::TilemapRenderer(std::vector tile_map, int tile_set_width, std::shared_ptr tileset_surface, Uint8 bg_color, int conveyor_belt_direction) : tile_map_(std::move(tile_map)), tile_set_width_(tile_set_width), tileset_surface_(std::move(tileset_surface)), - bg_color_(std::move(bg_color)), + bg_color_(bg_color), conveyor_belt_direction_(conveyor_belt_direction) { // Crear la surface del mapa map_surface_ = std::make_shared(PlayArea::WIDTH, PlayArea::HEIGHT); @@ -62,37 +62,37 @@ static void renderDebugCollisionSurfaces(const CollisionMap* collision_map) { // BottomSurfaces for (auto l : collision_map->getBottomFloors()) { - surface->drawLine(l.x1, l.y, l.x2, l.y, static_cast(PaletteColor::BLUE)); + surface->drawLine(l.x1, l.y, l.x2, l.y, 2); } // TopSurfaces for (auto l : collision_map->getTopFloors()) { - surface->drawLine(l.x1, l.y, l.x2, l.y, static_cast(PaletteColor::RED)); + surface->drawLine(l.x1, l.y, l.x2, l.y, 4); } // LeftSurfaces for (auto l : collision_map->getLeftWalls()) { - surface->drawLine(l.x, l.y1, l.x, l.y2, static_cast(PaletteColor::GREEN)); + surface->drawLine(l.x, l.y1, l.x, l.y2, 8); } // RightSurfaces for (auto l : collision_map->getRightWalls()) { - surface->drawLine(l.x, l.y1, l.x, l.y2, static_cast(PaletteColor::MAGENTA)); + surface->drawLine(l.x, l.y1, l.x, l.y2, 6); } // LeftSlopes for (auto l : collision_map->getLeftSlopes()) { - surface->drawLine(l.x1, l.y1, l.x2, l.y2, static_cast(PaletteColor::CYAN)); + surface->drawLine(l.x1, l.y1, l.x2, l.y2, 10); } // RightSlopes for (auto l : collision_map->getRightSlopes()) { - surface->drawLine(l.x1, l.y1, l.x2, l.y2, static_cast(PaletteColor::YELLOW)); + surface->drawLine(l.x1, l.y1, l.x2, l.y2, 12); } // AutoSurfaces (Conveyor Belts) for (auto l : collision_map->getConveyorBeltFloors()) { - surface->drawLine(l.x1, l.y, l.x2, l.y, static_cast(PaletteColor::WHITE)); + surface->drawLine(l.x1, l.y, l.x2, l.y, 14); } } @@ -115,7 +115,7 @@ void TilemapRenderer::setTile(int index, int tile_value) { // Borrar la celda con el color de fondo SDL_FRect cell = {.x = static_cast(col * TILE_SIZE), .y = static_cast(row * TILE_SIZE), .w = static_cast(TILE_SIZE), .h = static_cast(TILE_SIZE)}; - map_surface_->fillRect(&cell, stringToColor(bg_color_)); + map_surface_->fillRect(&cell, bg_color_); // Dibujar el nuevo tile (si no es vacío ni animado) if (tile_value > -1) { @@ -135,10 +135,9 @@ void TilemapRenderer::setTile(int index, int tile_value) { // Pinta el mapa estático y debug lines void TilemapRenderer::fillMapTexture(const CollisionMap* collision_map) { // NOLINT(readability-convert-member-functions-to-static) - const Uint8 COLOR = stringToColor(bg_color_); auto previous_renderer = Screen::get()->getRendererSurface(); Screen::get()->setRendererSurface(map_surface_); - map_surface_->clear(COLOR); + map_surface_->clear(bg_color_); // Los tileSetFiles son de 20x20 tiles. El primer tile es el 0. Cuentan hacia la derecha y hacia abajo diff --git a/source/game/gameplay/tilemap_renderer.hpp b/source/game/gameplay/tilemap_renderer.hpp index 2f88a7d..d762162 100644 --- a/source/game/gameplay/tilemap_renderer.hpp +++ b/source/game/gameplay/tilemap_renderer.hpp @@ -31,7 +31,7 @@ class TilemapRenderer { * @param bg_color Color de fondo de la habitación (como string) * @param conveyor_belt_direction Dirección de las cintas transportadoras (-1, 0, +1) */ - TilemapRenderer(std::vector tile_map, int tile_set_width, std::shared_ptr tileset_surface, std::string bg_color, int conveyor_belt_direction); + TilemapRenderer(std::vector tile_map, int tile_set_width, std::shared_ptr tileset_surface, Uint8 bg_color, int conveyor_belt_direction); ~TilemapRenderer() = default; // Prohibir copia y movimiento @@ -69,7 +69,7 @@ class TilemapRenderer { * Llamado cuando se activa/desactiva el modo debug para actualizar la visualización */ void redrawMap(const CollisionMap* collision_map); - void setBgColor(const std::string& color) { bg_color_ = color; } + void setBgColor(Uint8 color) { bg_color_ = color; } void setTile(int index, int tile_value); // Cambia un tile y repinta esa celda #endif @@ -92,9 +92,9 @@ class TilemapRenderer { }; // === Constantes === - static constexpr int TILE_SIZE = Tile::SIZE; // Ancho del tile en pixels - static constexpr int MAP_WIDTH = PlayArea::WIDTH / Tile::SIZE; // Ancho del mapa en tiles - static constexpr int MAP_HEIGHT = PlayArea::HEIGHT / Tile::SIZE; // Alto del mapa en tiles + static constexpr int TILE_SIZE = Tile::SIZE; // Ancho del tile en pixels + static constexpr int MAP_WIDTH = Map::WIDTH; // Ancho del mapa en tiles + static constexpr int MAP_HEIGHT = Map::HEIGHT; // Alto del mapa en tiles static constexpr int PLAY_AREA_WIDTH = PlayArea::WIDTH; // Ancho del área de juego en pixels static constexpr int PLAY_AREA_HEIGHT = PlayArea::HEIGHT; // Alto del área de juego en pixels static constexpr float CONVEYOR_FRAME_DURATION = 0.05F; // Duración de cada frame (3 frames @ 60fps) @@ -103,7 +103,7 @@ class TilemapRenderer { std::vector tile_map_; // Índices de tiles de la habitación int tile_set_width_; // Ancho del tileset en tiles std::shared_ptr tileset_surface_; // Gráficos del tileset - std::string bg_color_; // Color de fondo + Uint8 bg_color_{0}; // Color de fondo int conveyor_belt_direction_; // Dirección de conveyor belts // === Renderizado === diff --git a/source/game/scenes/credits.cpp b/source/game/scenes/credits.cpp index aa38521..3f628f8 100644 --- a/source/game/scenes/credits.cpp +++ b/source/game/scenes/credits.cpp @@ -32,7 +32,7 @@ Credits::Credits() SceneManager::options = SceneManager::Options::NONE; shining_sprite_->setPos({.x = 194, .y = 174, .w = 8, .h = 8}); - Screen::get()->setBorderColor(static_cast(PaletteColor::BLACK)); // Cambia el color del borde + Screen::get()->setBorderColor(0); // Cambia el color del borde fillTexture(); // Escribe el texto en la textura Audio::get()->playMusic("574071_EA_DTV.ogg"); // Inicia la musica } @@ -56,33 +56,33 @@ void Credits::iniTexts() { // NOLINT(readability-convert-member-functions-to-st auto* loc = Locale::get(); texts_.clear(); - texts_.push_back({.label = "", .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = loc->get("credits.instructions"), .color = static_cast(PaletteColor::YELLOW)}); - texts_.push_back({.label = "", .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = loc->get("credits.l0"), .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = loc->get("credits.l1"), .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = loc->get("credits.l2"), .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = "", .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = "", .color = static_cast(PaletteColor::WHITE)}); + texts_.push_back({.label = "", .color = 14}); + texts_.push_back({.label = loc->get("credits.instructions"), .color = 12}); + texts_.push_back({.label = "", .color = 14}); + texts_.push_back({.label = loc->get("credits.l0"), .color = 14}); + texts_.push_back({.label = loc->get("credits.l1"), .color = 14}); + texts_.push_back({.label = loc->get("credits.l2"), .color = 14}); + texts_.push_back({.label = "", .color = 14}); + texts_.push_back({.label = "", .color = 14}); - texts_.push_back({.label = loc->get("credits.keys"), .color = static_cast(PaletteColor::YELLOW)}); - texts_.push_back({.label = "", .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = loc->get("credits.keys_move"), .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = loc->get("credits.f8"), .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = loc->get("credits.f11"), .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = loc->get("credits.f1f2"), .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = loc->get("credits.f3"), .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = loc->get("credits.f9"), .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = "", .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = "", .color = static_cast(PaletteColor::WHITE)}); + texts_.push_back({.label = loc->get("credits.keys"), .color = 12}); + texts_.push_back({.label = "", .color = 14}); + texts_.push_back({.label = loc->get("credits.keys_move"), .color = 14}); + texts_.push_back({.label = loc->get("credits.f8"), .color = 14}); + texts_.push_back({.label = loc->get("credits.f11"), .color = 14}); + texts_.push_back({.label = loc->get("credits.f1f2"), .color = 14}); + texts_.push_back({.label = loc->get("credits.f3"), .color = 14}); + texts_.push_back({.label = loc->get("credits.f9"), .color = 14}); + texts_.push_back({.label = "", .color = 14}); + texts_.push_back({.label = "", .color = 14}); - texts_.push_back({.label = loc->get("credits.author"), .color = static_cast(PaletteColor::YELLOW)}); - texts_.push_back({.label = loc->get("credits.date"), .color = static_cast(PaletteColor::YELLOW)}); - texts_.push_back({.label = "", .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = "", .color = static_cast(PaletteColor::WHITE)}); + texts_.push_back({.label = loc->get("credits.author"), .color = 12}); + texts_.push_back({.label = loc->get("credits.date"), .color = 12}); + texts_.push_back({.label = "", .color = 14}); + texts_.push_back({.label = "", .color = 14}); - texts_.push_back({.label = loc->get("credits.love"), .color = static_cast(PaletteColor::WHITE)}); - texts_.push_back({.label = "", .color = static_cast(PaletteColor::WHITE)}); + texts_.push_back({.label = loc->get("credits.love"), .color = 14}); + texts_.push_back({.label = "", .color = 14}); } // Escribe el texto en la textura @@ -93,7 +93,7 @@ void Credits::fillTexture() { // Rellena la textura de texto auto previuos_renderer = Screen::get()->getRendererSurface(); Screen::get()->setRendererSurface(text_surface_); - text_surface_->clear(static_cast(PaletteColor::BLACK)); + text_surface_->clear(0); auto text = Resource::Cache::get()->getText("smb2"); @@ -109,7 +109,7 @@ void Credits::fillTexture() { // Escribe el corazón const int TEXT_LENGHT = text->length(texts_[22].label, 1) - text->length(" ", 1); // Se resta el ultimo caracter que es un espacio const int POS_X = ((PlayArea::WIDTH - TEXT_LENGHT) / 2) + TEXT_LENGHT; - text->writeColored(POS_X, 176, "ä", static_cast(PaletteColor::BRIGHT_RED)); + text->writeColored(POS_X, 176, "ä", 5); Screen::get()->setRendererSurface(previuos_renderer); // Recoloca el sprite del brillo @@ -219,7 +219,7 @@ void Credits::render() { Screen::get()->start(); // Limpia la pantalla - Screen::get()->clearSurface(static_cast(PaletteColor::BLACK)); + Screen::get()->clearSurface(0); if (state_ != State::EXITING) { // Dibuja la textura con el texto en pantalla @@ -230,7 +230,7 @@ void Credits::render() { // Dibuja el sprite con el brillo if (reveal_time_ > SHINE_START_TIME) { - shining_sprite_->render(1, static_cast(PaletteColor::BRIGHT_WHITE)); + shining_sprite_->render(1, 15); } } diff --git a/source/game/scenes/ending.cpp b/source/game/scenes/ending.cpp index 9591908..aac5e2a 100644 --- a/source/game/scenes/ending.cpp +++ b/source/game/scenes/ending.cpp @@ -31,7 +31,7 @@ Ending::Ending() iniPics(); // Inicializa las imagenes iniScenes(); // Inicializa las escenas - Screen::get()->setBorderColor(static_cast(PaletteColor::BLACK)); // Cambia el color del borde + Screen::get()->setBorderColor(0); // Cambia el color del borde } // Actualiza el objeto @@ -55,7 +55,7 @@ void Ending::render() { Screen::get()->start(); // Limpia la pantalla - Screen::get()->clearSurface(static_cast(PaletteColor::BLACK)); + Screen::get()->clearSurface(0); // Skip rendering durante WARMING_UP if (state_ != State::WARMING_UP) { @@ -212,8 +212,8 @@ void Ending::iniTexts() { // NOLINT(readability-convert-member-functions-to-sta const float WIDTH = text->length(txt.caption, 1) + 2 + 2; const float HEIGHT = text->getCharacterSize() + 2 + 2; - auto text_color = static_cast(PaletteColor::WHITE); - auto shadow_color = static_cast(PaletteColor::BLACK); + auto text_color = 14; + auto shadow_color = 0; EndingSurface st; diff --git a/source/game/scenes/ending2.cpp b/source/game/scenes/ending2.cpp index d6c34cc..1327668 100644 --- a/source/game/scenes/ending2.cpp +++ b/source/game/scenes/ending2.cpp @@ -19,7 +19,7 @@ #include "game/scene_manager.hpp" // Para SceneManager #include "utils/defines.hpp" // Para GameCanvas::CENTER_X, GameCanvas::CENTER_Y #include "utils/delta_timer.hpp" // Para DeltaTimer -#include "utils/utils.hpp" // Para PaletteColor, stringToColor +#include "utils/utils.hpp" // Constructor Ending2::Ending2() @@ -30,12 +30,9 @@ Ending2::Ending2() SceneManager::options = SceneManager::Options::NONE; // Inicializa el vector de colores - const std::vector COLORS = {"white", "yellow", "cyan", "green", "magenta", "red", "blue", "black"}; - for (const auto& color : COLORS) { - colors_.push_back(stringToColor(color)); - } + colors_ = {14, 12, 10, 8, 6, 4, 2, 0}; - Screen::get()->setBorderColor(static_cast(PaletteColor::BLACK)); // Cambia el color del borde + Screen::get()->setBorderColor(0); // Cambia el color del borde iniSpriteList(); // Inicializa la lista de sprites loadSprites(); // Carga todos los sprites desde una lista placeSprites(); // Coloca los sprites en su sito @@ -80,7 +77,7 @@ void Ending2::render() { Screen::get()->start(); // Limpia la pantalla - Screen::get()->clearSurface(static_cast(PaletteColor::BLACK)); + Screen::get()->clearSurface(0); // Dibuja los sprites renderSprites(); @@ -269,14 +266,14 @@ void Ending2::loadSprites() { for (const auto& file : sprite_list_) { const auto& animation_data = Resource::Cache::get()->getAnimationData(file + ".yaml"); sprites_.emplace_back(std::make_shared(animation_data)); - sprites_.back()->setColorReplace(1, static_cast(PaletteColor::RED)); + sprites_.back()->setColorReplace(1, 4); sprites_.back()->setProgress(1.0F); // comença invisible sprite_max_width_ = std::max(sprites_.back()->getWidth(), sprite_max_width_); sprite_max_height_ = std::max(sprites_.back()->getHeight(), sprite_max_height_); } // El último sprite (player) va en blanco, no en rojo - sprites_.back()->setColorReplace(1, static_cast(PaletteColor::WHITE)); + sprites_.back()->setColorReplace(1, 14); } // Actualiza los sprites @@ -428,7 +425,7 @@ void Ending2::createSpriteTexts() { // NOLINT(readability-convert-member-functi // Crea el sprite SDL_FRect pos = {.x = X, .y = Y, .w = W, .h = H}; sprite_texts_.emplace_back(std::make_shared(surface, pos)); - sprite_texts_.back()->setColorReplace(1, static_cast(PaletteColor::WHITE)); + sprite_texts_.back()->setColorReplace(1, 14); sprite_texts_.back()->setProgress(1.0F); // comença invisible sprite_texts_.back()->setVelY(SPRITE_DESP_SPEED); Screen::get()->setRendererSurface(previuos_renderer); diff --git a/source/game/scenes/game.cpp b/source/game/scenes/game.cpp index cd81858..8221967 100644 --- a/source/game/scenes/game.cpp +++ b/source/game/scenes/game.cpp @@ -28,7 +28,7 @@ #include "game/ui/console.hpp" // Para Console #include "game/ui/notifier.hpp" // Para Notifier, NotificationText, CHEEVO_NO... #include "utils/defines.hpp" // Para Tile::SIZE, PlayArea::HEIGHT, RoomBorder::BOTTOM -#include "utils/utils.hpp" // Para PaletteColor, stringToColor +#include "utils/utils.hpp" #ifdef _DEBUG #include "core/system/debug.hpp" // Para Debug @@ -489,7 +489,7 @@ void Game::renderPlaying() { // Renderiza el juego en estado BLACK_SCREEN (pantalla negra) void Game::renderBlackScreen() { Screen::get()->start(); - auto const COLOR = static_cast(PaletteColor::BLACK); + auto const COLOR = 0; Screen::get()->clearSurface(COLOR); Screen::get()->setBorderColor(COLOR); Screen::get()->render(); @@ -498,7 +498,7 @@ void Game::renderBlackScreen() { // Renderiza el juego en estado GAME_OVER (pantalla negra) void Game::renderGameOver() { Screen::get()->start(); - Screen::get()->clearSurface(static_cast(PaletteColor::BLACK)); + Screen::get()->clearSurface(0); Screen::get()->render(); } @@ -511,7 +511,7 @@ void Game::renderFadeToEnding() { Screen::get()->setRendererSurface(game_backbuffer_surface_); // 3. Renderizar todo a backbuffer - game_backbuffer_surface_->clear(static_cast(PaletteColor::BLACK)); + game_backbuffer_surface_->clear(0); room_->renderMap(); room_->renderEnemies(); room_->renderItems(); @@ -530,7 +530,7 @@ void Game::renderFadeToEnding() { // Renderiza el juego en estado POST_FADE_ENDING (pantalla negra) void Game::renderPostFadeEnding() { Screen::get()->start(); - Screen::get()->clearSurface(static_cast(PaletteColor::BLACK)); + Screen::get()->clearSurface(0); Screen::get()->render(); } @@ -550,18 +550,18 @@ void Game::renderDebugInfo() { // Borra el marcador SDL_FRect rect = {.x = 0, .y = 18 * Tile::SIZE, .w = PlayArea::WIDTH, .h = GameCanvas::HEIGHT - PlayArea::HEIGHT}; - surface->fillRect(&rect, static_cast(PaletteColor::BLACK)); + surface->fillRect(&rect, 0); // Pinta la rejilla /*for (int i = 0; i < PlayArea::BOTTOM; i += 8) { // Lineas horizontales - surface->drawLine(0, i, PlayArea::RIGHT, i, static_cast(PaletteColor::BRIGHT_BLACK)); + surface->drawLine(0, i, PlayArea::RIGHT, i, 1); } for (int i = 0; i < PlayArea::RIGHT; i += 8) { // Lineas verticales - surface->drawLine(i, 0, i, PlayArea::BOTTOM - 1, static_cast(PaletteColor::BRIGHT_BLACK)); + surface->drawLine(i, 0, i, PlayArea::BOTTOM - 1, 1); }*/ // Pinta el texto @@ -815,11 +815,11 @@ void Game::setScoreBoardColor() { // NOLINT(readability-convert-member-function // Obtiene el color del borde const Uint8 BORDER_COLOR = room_->getBorderColor(); - const bool IS_BLACK = BORDER_COLOR == static_cast(PaletteColor::BLACK); - const bool IS_BRIGHT_BLACK = BORDER_COLOR == static_cast(PaletteColor::BRIGHT_BLACK); + const bool IS_BLACK = BORDER_COLOR == 0; + const bool IS_BRIGHT_BLACK = BORDER_COLOR == 1; // Si el color del borde es negro o negro brillante cambia el texto del marcador a blanco - scoreboard_data_->color = IS_BLACK || IS_BRIGHT_BLACK ? static_cast(PaletteColor::WHITE) : BORDER_COLOR; + scoreboard_data_->color = IS_BLACK || IS_BRIGHT_BLACK ? 14 : BORDER_COLOR; } // Comprueba si ha finalizado el juego diff --git a/source/game/scenes/game_over.cpp b/source/game/scenes/game_over.cpp index 99f3835..18e72c1 100644 --- a/source/game/scenes/game_over.cpp +++ b/source/game/scenes/game_over.cpp @@ -18,7 +18,7 @@ #include "game/scene_manager.hpp" // Para SceneManager #include "utils/defines.hpp" // Para GameCanvas::CENTER_X #include "utils/delta_timer.hpp" // Para DeltaTimer -#include "utils/utils.hpp" // Para PaletteColor, stringToColor +#include "utils/utils.hpp" // Constructor GameOver::GameOver() @@ -34,13 +34,10 @@ GameOver::GameOver() tv_sprite_->setPosX(GameCanvas::CENTER_X - tv_sprite_->getWidth() - TV_X_OFFSET); tv_sprite_->setPosY(TEXT_Y + SPRITE_Y_OFFSET); - Screen::get()->setBorderColor(static_cast(PaletteColor::BLACK)); + Screen::get()->setBorderColor(0); // Inicializa el vector de colores (de brillante a oscuro para fade) - const std::vector COLORS = {"white", "yellow", "cyan", "green", "magenta", "red", "blue", "black"}; - for (const auto& color : COLORS) { - colors_.push_back(stringToColor(color)); - } + colors_ = {14, 12, 10, 8, 6, 4, 2, 0}; color_ = colors_.back(); // Empieza en black } @@ -64,7 +61,7 @@ void GameOver::update() { // Dibuja el final en pantalla void GameOver::render() { Screen::get()->start(); - Screen::get()->clearSurface(static_cast(PaletteColor::BLACK)); + Screen::get()->clearSurface(0); auto text = Resource::Cache::get()->getText("smb2"); diff --git a/source/game/scenes/loading_screen.cpp b/source/game/scenes/loading_screen.cpp index 394b4a4..b5b754a 100644 --- a/source/game/scenes/loading_screen.cpp +++ b/source/game/scenes/loading_screen.cpp @@ -16,7 +16,7 @@ #include "game/options.hpp" // Para Options, options, SectionState, Options... #include "game/scene_manager.hpp" // Para SceneManager #include "utils/defines.hpp" // Para GAME_SPEED -#include "utils/utils.hpp" // Para stringToColor, PaletteColor +#include "utils/utils.hpp" // Constructor LoadingScreen::LoadingScreen() @@ -28,7 +28,7 @@ LoadingScreen::LoadingScreen() screen_surface_(std::make_shared(Options::game.width, Options::game.height)), delta_timer_(std::make_unique()) { // Configura la superficie donde se van a pintar los sprites - screen_surface_->clear(static_cast(PaletteColor::WHITE)); + screen_surface_->clear(14); // Inicializa variables SceneManager::current = SceneManager::Scene::LOADING_SCREEN; @@ -39,7 +39,7 @@ LoadingScreen::LoadingScreen() initLineIndexArray(); // Cambia el color del borde - Screen::get()->setBorderColor(stringToColor("white")); + Screen::get()->setBorderColor(14); transitionToState(State::SILENT1); } @@ -279,10 +279,10 @@ void LoadingScreen::renderDataBorder() { auto border = Screen::get()->getBorderSurface(); // Pinta el borde de color azul - border->clear(static_cast(PaletteColor::BLUE)); + border->clear(2); // Añade lineas amarillas - const auto COLOR = static_cast(PaletteColor::YELLOW); + const auto COLOR = 12; const int WIDTH = Options::game.width + (Options::video.border.width * 2); const int HEIGHT = Options::game.height + (Options::video.border.height * 2); bool draw_enabled = rand() % 2 == 0; @@ -306,10 +306,10 @@ void LoadingScreen::renderHeaderBorder() const { auto border = Screen::get()->getBorderSurface(); // Pinta el borde de color azul o rojo - border->clear(carrier_.toggle ? static_cast(PaletteColor::CYAN) : static_cast(PaletteColor::RED)); + border->clear(carrier_.toggle ? 10 : 4); // Añade lineas rojas o azules - const auto COLOR = carrier_.toggle ? static_cast(PaletteColor::RED) : static_cast(PaletteColor::CYAN); + const auto COLOR = carrier_.toggle ? 4 : 10; const int WIDTH = Options::game.width + (Options::video.border.width * 2); const int HEIGHT = Options::game.height + (Options::video.border.height * 2); @@ -335,12 +335,12 @@ void LoadingScreen::renderHeaderBorder() const { } // Dibuja el borde de color -void LoadingScreen::renderColoredBorder(PaletteColor color) { +void LoadingScreen::renderColoredBorder(Uint8 color) { // Obtiene la Surface del borde auto border = Screen::get()->getBorderSurface(); - // Pinta el borde de color azul - border->clear(static_cast(color)); + // Pinta el borde del color indicado + border->clear(color); } // Actualiza las variables @@ -391,7 +391,7 @@ void LoadingScreen::render() { // Prepara para empezar a dibujar en la textura de juego Screen::get()->start(); - Screen::get()->clearSurface(stringToColor("white")); + Screen::get()->clearSurface(14); // Copia la surface a la surface de Screen screen_surface_->render(0, 0); @@ -430,16 +430,16 @@ void LoadingScreen::renderBorder() { renderHeaderBorder(); break; case Border::WHITE: - renderColoredBorder(PaletteColor::WHITE); + renderColoredBorder(14); break; case Border::BLACK: - renderColoredBorder(PaletteColor::BLACK); + renderColoredBorder(0); break; case Border::RED: - renderColoredBorder(PaletteColor::RED); + renderColoredBorder(4); break; case Border::CYAN: - renderColoredBorder(PaletteColor::CYAN); + renderColoredBorder(10); break; case Border::NONE: // No renderizar borde diff --git a/source/game/scenes/loading_screen.hpp b/source/game/scenes/loading_screen.hpp index 1cf2275..71daf8a 100644 --- a/source/game/scenes/loading_screen.hpp +++ b/source/game/scenes/loading_screen.hpp @@ -6,7 +6,6 @@ #include // Para shared_ptr #include "utils/delta_timer.hpp" // Para DeltaTimer -#include "utils/utils.hpp" // Para PaletteColor class Sprite; // Forward declaration class Surface; // Forward declaration @@ -90,7 +89,7 @@ class LoadingScreen { void renderBorder(); // Pinta el borde static void renderDataBorder(); // Dibuja el efecto de carga amarillo y azul en el borde void renderHeaderBorder() const; // Dibuja el efecto de carga rojo y azul en el borde - static void renderColoredBorder(PaletteColor color); // Dibuja el borde de color + static void renderColoredBorder(Uint8 color); // Dibuja el borde de color void initLineIndexArray(); // Inicializa el array de índices de líneas void printProgramName(); // Escribe el nombre del programa void updateCarrier(float delta_time); // Actualiza la portadora diff --git a/source/game/scenes/logo.cpp b/source/game/scenes/logo.cpp index e64fb47..795d3ff 100644 --- a/source/game/scenes/logo.cpp +++ b/source/game/scenes/logo.cpp @@ -28,8 +28,8 @@ Logo::Logo() delta_timer_(std::make_unique()) { // Configura variables since_1998_sprite_->setClip(0, 0, since_1998_surface_->getWidth(), since_1998_surface_->getHeight()); - since_1998_color_ = static_cast(PaletteColor::BLACK); - jailgames_color_ = static_cast(PaletteColor::BRIGHT_WHITE); + since_1998_color_ = 0; + jailgames_color_ = 15; // Inicializa variables SceneManager::current = SceneManager::Scene::LOGO; @@ -51,7 +51,7 @@ Logo::Logo() easing_function_ = EASING_OPTIONS[dist(gen)]; // Cambia el color del borde - Screen::get()->setBorderColor(static_cast(PaletteColor::BLACK)); + Screen::get()->setBorderColor(0); } // Comprueba el manejador de eventos @@ -216,7 +216,7 @@ void Logo::update() { void Logo::render() { // NOLINT(readability-convert-member-functions-to-static) // Prepara para empezar a dibujar en la textura de juego Screen::get()->start(); - Screen::get()->clearSurface(static_cast(PaletteColor::BLACK)); + Screen::get()->clearSurface(0); // Dibuja los objetos for (const auto& sprite : jailgames_sprite_) { @@ -257,14 +257,14 @@ void Logo::endSection() { void Logo::initColors() { // NOLINT(readability-convert-member-functions-to-static) // Inicializa el vector de colores const std::vector COLORS = { - static_cast(PaletteColor::BLACK), - static_cast(PaletteColor::BLUE), - static_cast(PaletteColor::RED), - static_cast(PaletteColor::MAGENTA), - static_cast(PaletteColor::GREEN), - static_cast(PaletteColor::CYAN), - static_cast(PaletteColor::YELLOW), - static_cast(PaletteColor::BRIGHT_WHITE)}; + 0, + 2, + 4, + 6, + 8, + 10, + 12, + 15}; for (const auto& color : COLORS) { color_.push_back(color); } diff --git a/source/game/scenes/title.cpp b/source/game/scenes/title.cpp index 9a5097a..444ed34 100644 --- a/source/game/scenes/title.cpp +++ b/source/game/scenes/title.cpp @@ -20,7 +20,7 @@ #include "game/scene_manager.hpp" // Para SceneManager #include "game/ui/console.hpp" // Para Console #include "utils/defines.hpp" // Para PlayArea::CENTER_X, GameCanvas::WIDTH -#include "utils/utils.hpp" // Para stringToColor, PaletteColor, playMusic +#include "utils/utils.hpp" // Constructor Title::Title() @@ -46,7 +46,7 @@ Title::Title() // Acciones iniciales initMarquee(); // Inicializa la marquesina createCheevosTexture(); // Crea y rellena la textura para mostrar los logros - Screen::get()->setBorderColor(static_cast(PaletteColor::BLACK)); // Cambia el color del borde + Screen::get()->setBorderColor(0); // Cambia el color del borde Audio::get()->playMusic("574071_EA_DTV.ogg"); // Inicia la musica } @@ -233,7 +233,7 @@ void Title::renderMarquee() const { if (letter.enabled && letter.clip.w > 0.0F) { sprite->setClip(letter.clip); sprite->setX(letter.x); - sprite->render(1, static_cast(PaletteColor::MAGENTA)); + sprite->render(1, 6); } } } @@ -425,7 +425,7 @@ void Title::render() { // Prepara para empezar a dibujar en la textura de juego Screen::get()->start(); - Screen::get()->clearSurface(static_cast(PaletteColor::BLACK)); + Screen::get()->clearSurface(0); // Dibuja en pantalla la surface con la composicion title_surface_->render(); @@ -463,17 +463,17 @@ void Title::createCheevosTexture() { // NOLINT(readability-convert-member-funct Screen::get()->setRendererSurface(cheevos_surface_); // Rellena la textura con color sólido - const auto CHEEVOS_BG_COLOR = static_cast(PaletteColor::BLACK); + const auto CHEEVOS_BG_COLOR = 0; cheevos_surface_->clear(CHEEVOS_BG_COLOR); // Escribe la lista de logros en la textura const std::string CHEEVOS_OWNER = Locale::get()->get("title.projects"); // NOLINT(readability-static-accessed-through-instance) const std::string CHEEVOS_LIST_CAPTION = CHEEVOS_OWNER + " (" + std::to_string(Cheevos::get()->getTotalUnlockedAchievements()) + " / " + std::to_string(Cheevos::get()->size()) + ")"; int pos = 2; - TEXT->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, cheevos_surface_->getWidth() / 2, pos, CHEEVOS_LIST_CAPTION, 1, stringToColor("bright_green")); + TEXT->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, cheevos_surface_->getWidth() / 2, pos, CHEEVOS_LIST_CAPTION, 1, 9); pos += TEXT->getCharacterSize(); - const Uint8 CHEEVO_LOCKED_COLOR = stringToColor("white"); - const Uint8 CHEEVO_UNLOCKED_COLOR = stringToColor("bright_green"); + const Uint8 CHEEVO_LOCKED_COLOR = 14; + const Uint8 CHEEVO_UNLOCKED_COLOR = 9; constexpr int LINE_X1 = (CHEEVOS_TEXTURE_WIDTH / 7) * 3; constexpr int LINE_X2 = LINE_X1 + ((CHEEVOS_TEXTURE_WIDTH / 7) * 1); @@ -526,7 +526,7 @@ void Title::renderMainMenu() { constexpr int MENU_ZONE_HEIGHT = 102; // Menú principal normal con 4 opciones centradas verticalmente en la zona - const Uint8 COLOR = stringToColor("green"); + const Uint8 COLOR = 8; const int TEXT_SIZE = menu_text_->getCharacterSize(); const int MENU_CENTER_Y = MENU_ZONE_Y + (MENU_ZONE_HEIGHT / 2); const int SPACING = 2 * TEXT_SIZE; // Espaciado entre opciones @@ -554,7 +554,7 @@ void Title::fillTitleSurface() { Screen::get()->setRendererSurface(title_surface_); // Rellena la textura de color - title_surface_->clear(static_cast(PaletteColor::BLACK)); + title_surface_->clear(0); switch (state_) { case State::MAIN_MENU: @@ -676,8 +676,8 @@ void Title::renderKeyboardRemap() const { constexpr int MENU_ZONE_Y = 73; constexpr int MENU_ZONE_HEIGHT = 102; - const Uint8 COLOR = stringToColor("green"); - const Uint8 ERROR_COLOR = stringToColor("red"); + const Uint8 COLOR = 8; + const Uint8 ERROR_COLOR = 4; const int TEXT_SIZE = menu_text_->getCharacterSize(); const int MENU_CENTER_Y = MENU_ZONE_Y + (MENU_ZONE_HEIGHT / 2); @@ -724,8 +724,8 @@ void Title::renderJoystickRemap() const { constexpr int MENU_ZONE_Y = 73; constexpr int MENU_ZONE_HEIGHT = 102; - const Uint8 COLOR = stringToColor("green"); - const Uint8 ERROR_COLOR = stringToColor("red"); + const Uint8 COLOR = 8; + const Uint8 ERROR_COLOR = 4; const int TEXT_SIZE = menu_text_->getCharacterSize(); const int MENU_CENTER_Y = MENU_ZONE_Y + (MENU_ZONE_HEIGHT / 2); diff --git a/source/game/ui/console_commands.cpp b/source/game/ui/console_commands.cpp index aabca51..38feff2 100644 --- a/source/game/ui/console_commands.cpp +++ b/source/game/ui/console_commands.cpp @@ -1024,9 +1024,14 @@ void CommandRegistry::registerHandlers() { // NOLINT(readability-function-cogni }; #ifdef _DEBUG - // Colores de la paleta (compartido por SET COLOR, BGCOLOR, BORDER, ITEMCOLOR1, ITEMCOLOR2) + // Colores de la paleta como índices numéricos (compartido por SET COLOR, BGCOLOR, BORDER, ITEMCOLOR1, ITEMCOLOR2) auto color_provider = []() -> std::vector { - return {"BLACK", "BRIGHT_BLACK", "BLUE", "BRIGHT_BLUE", "RED", "BRIGHT_RED", "MAGENTA", "BRIGHT_MAGENTA", "GREEN", "BRIGHT_GREEN", "CYAN", "BRIGHT_CYAN", "YELLOW", "BRIGHT_YELLOW", "WHITE", "BRIGHT_WHITE"}; + std::vector result; + result.reserve(64); + for (int i = 0; i < 64; ++i) { + result.push_back(std::to_string(i)); + } + return result; }; dynamic_providers_["SET COLOR"] = color_provider; dynamic_providers_["SET BGCOLOR"] = color_provider; diff --git a/source/game/ui/notifier.cpp b/source/game/ui/notifier.cpp index 561d934..df36a9d 100644 --- a/source/game/ui/notifier.cpp +++ b/source/game/ui/notifier.cpp @@ -23,9 +23,9 @@ Notifier* Notifier::notifier = nullptr; // Definición de estilos predefinidos const Notifier::Style Notifier::Style::DEFAULT = { - .bg_color = static_cast(PaletteColor::BLUE), - .border_color = static_cast(PaletteColor::CYAN), - .text_color = static_cast(PaletteColor::CYAN), + .bg_color = 2, + .border_color = 10, + .text_color = 10, .shape = Notifier::Shape::SQUARED, .text_align = Notifier::TextAlign::CENTER, .duration = 2.0F, @@ -33,9 +33,9 @@ const Notifier::Style Notifier::Style::DEFAULT = { .play_sound = false}; const Notifier::Style Notifier::Style::CHEEVO = { - .bg_color = static_cast(PaletteColor::MAGENTA), - .border_color = static_cast(PaletteColor::BRIGHT_MAGENTA), - .text_color = static_cast(PaletteColor::WHITE), + .bg_color = 6, + .border_color = 7, + .text_color = 14, .shape = Notifier::Shape::SQUARED, .text_align = Notifier::TextAlign::CENTER, .duration = 4.0F, diff --git a/source/utils/defines.hpp b/source/utils/defines.hpp index e4b3dc6..c7449bf 100644 --- a/source/utils/defines.hpp +++ b/source/utils/defines.hpp @@ -15,11 +15,17 @@ namespace Tile { constexpr int HALF_SIZE = SIZE / 2; } // namespace Tile +// Dimensiones del mapa en tiles +namespace Map { + constexpr int WIDTH = 32; // Ancho del mapa en tiles + constexpr int HEIGHT = 21; // Alto del mapa en tiles (pantalla menos 3 tiles de statusbar) +} // namespace Map + namespace PlayArea { constexpr int TOP = (0 * Tile::SIZE); - constexpr int BOTTOM = (16 * Tile::SIZE); + constexpr int BOTTOM = (Map::HEIGHT * Tile::SIZE); constexpr int LEFT = (0 * Tile::SIZE); - constexpr int RIGHT = (32 * Tile::SIZE); + constexpr int RIGHT = (Map::WIDTH * Tile::SIZE); constexpr int WIDTH = RIGHT - LEFT; constexpr int HEIGHT = BOTTOM - TOP; constexpr int CENTER_X = LEFT + (WIDTH / 2); diff --git a/source/utils/utils.cpp b/source/utils/utils.cpp index 0847d16..26578c5 100644 --- a/source/utils/utils.cpp +++ b/source/utils/utils.cpp @@ -333,77 +333,6 @@ auto checkCollision(const SDL_FPoint& point, const LineDiagonal& l) -> bool { return true; } -// Convierte una cadena a un indice de la paleta -auto stringToColor(const std::string& str) -> Uint8 { - // Mapas de colores para cada paleta - static const std::unordered_map PALETTE_MAP = { - {"black", 0}, - {"bright_black", 1}, - - {"blue", 2}, - {"bright_blue", 3}, - - {"red", 4}, - {"bright_red", 5}, - - {"magenta", 6}, - {"bright_magenta", 7}, - - {"green", 8}, - {"bright_green", 9}, - - {"cyan", 10}, - {"bright_cyan", 11}, - - {"yellow", 12}, - {"bright_yellow", 13}, - - {"white", 14}, - {"bright_white", 15}, - - // Índices extendidos (paletas de 32 colores): nombres genéricos COLOR_N - {"color_16", 16}, {"color_17", 17}, {"color_18", 18}, {"color_19", 19}, - {"color_20", 20}, {"color_21", 21}, {"color_22", 22}, {"color_23", 23}, - {"color_24", 24}, {"color_25", 25}, {"color_26", 26}, {"color_27", 27}, - {"color_28", 28}, {"color_29", 29}, {"color_30", 30}, {"color_31", 31}, - - {"transparent", 255}}; - - // Busca el color en el mapa - auto it = PALETTE_MAP.find(str); - if (it != PALETTE_MAP.end()) { - return it->second; - } - - // Fallback: si el string es numérico (p.ej. "4"), lo tratamos como índice de paleta - if (!str.empty() && std::ranges::all_of(str, [](char c) { return std::isdigit(static_cast(c)) != 0; })) { - const int IDX = safeStoi(str, 0); - if (IDX >= 0 && IDX <= 255) { - return static_cast(IDX); - } - } - - // Si no se encuentra el color, devolvemos negro por defecto - return 0; -} - -// Inverso de stringToColor: devuelve el nombre canónico para un índice de paleta (o el propio número si no hay) -auto colorToString(Uint8 index) -> std::string { - static const std::array NAMES = { - "black", "bright_black", - "blue", "bright_blue", - "red", "bright_red", - "magenta", "bright_magenta", - "green", "bright_green", - "cyan", "bright_cyan", - "yellow", "bright_yellow", - "white", "bright_white"}; - if (index < NAMES.size()) { return NAMES[index]; } - if (index < 32) { return "color_" + std::to_string(index); } - if (index == 255) { return "transparent"; } - return std::to_string(index); -} - // Convierte una cadena a un entero de forma segura auto safeStoi(const std::string& value, int default_value) -> int { try { diff --git a/source/utils/utils.hpp b/source/utils/utils.hpp index 5b684d7..d17a556 100644 --- a/source/utils/utils.hpp +++ b/source/utils/utils.hpp @@ -5,34 +5,6 @@ #include // Para string #include // Para vector -enum class PaletteColor : Uint8 { - BLACK = 0, - BRIGHT_BLACK = 1, - - BLUE = 2, - BRIGHT_BLUE = 3, - - RED = 4, - BRIGHT_RED = 5, - - MAGENTA = 6, - BRIGHT_MAGENTA = 7, - - GREEN = 8, - BRIGHT_GREEN = 9, - - CYAN = 10, - BRIGHT_CYAN = 11, - - YELLOW = 12, - BRIGHT_YELLOW = 13, - - WHITE = 14, - BRIGHT_WHITE = 15, - - TRANSPARENT = 255, -}; - // Estructura para definir un circulo struct Circle { int x{0}; @@ -92,8 +64,6 @@ auto toSDLRect(const SDL_FRect& frect) -> SDL_Rect; // Convierte SDL_FRect auto toSDLPoint(const SDL_FPoint& fpoint) -> SDL_Point; // Convierte SDL_FPoint a SDL_Point // CONVERSIONES DE STRING -auto stringToColor(const std::string& str) -> Uint8; // String a índice de paleta (acepta nombres o números) -auto colorToString(Uint8 index) -> std::string; // Índice de paleta a nombre canónico auto safeStoi(const std::string& value, int default_value = 0) -> int; // String a int seguro (sin excepciones) auto stringToBool(const std::string& str) -> bool; // String a bool (true/1/yes/on) auto boolToString(bool value) -> std::string; // Bool a string (1/0)