From 135763066e12a6dbf40227b5414f07d84a01a6fe Mon Sep 17 00:00:00 2001 From: NyakoFox Date: Tue, 10 Nov 2026 23:02:42 -0400 Subject: [PATCH] Add different size modes to damage blocks This commit adds some `p3` values to damage blocks: - `1` simulates "top spikes", which have a flatter top. - `2` simulates "bottom spikes", which have a flatter bottom. - `3` simulates "side spikes", which do both. These match the damage blocks that get spawned by spike entities. If we add editor tools, that means it'll be possible to simulate new spikes without having to use a script to place them. --- desktop_version/src/Editor.cpp | 29 ++++++++++++++++++++++++++--- desktop_version/src/Map.cpp | 27 ++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp index 629d69c0..7350e39a 100644 --- a/desktop_version/src/Editor.cpp +++ b/desktop_version/src/Editor.cpp @@ -1131,12 +1131,35 @@ static void draw_entities(void) break; case 22: // Damage Boxes { + int draw_y = y; + int height = entity->p2 * 8; + + switch (entity->p3) + { + default: + break; + case 1: + // Top Spikes + draw_y += 4; + height -= 4; + break; + case 2: + // Bottom Spikes + height -= 4; + break; + case 3: + // Side Spikes + draw_y += 3; + height -= 6; + break; + } + int skull_x = x + (entity->p1 - 1) * 4; - int skull_y = y + (entity->p2 - 1) * 4; + int skull_y = draw_y + (height - 8) / 2; - font::print(PR_FONT_8X8 | PR_BOR, skull_x, skull_y, "\xE2\x98\xA0", 255, 192, 192); + font::print(PR_FONT_8X8 | PR_BOR, skull_x, skull_y, "\xE2\x98\xA0", 255, 255, 255); - graphics.draw_rect(x, y, entity->p1 * 8, entity->p2 * 8, graphics.getRGB(255, 164, 164)); + graphics.draw_rect(x, draw_y, entity->p1 * 8, height, graphics.getRGB(255, 164, 164)); graphics.draw_rect(x, y, 8, 8, graphics.getRGB(255, 255, 255)); break; } diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 67878f00..4bda0cfd 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -1966,8 +1966,33 @@ void mapclass::loadlevel(int rx, int ry) obj.createblock(BLOCK, ex, ey, ent.p1 * 8, ent.p2 * 8); break; case 22: // Damage Box - obj.createblock(DAMAGE, ex, ey, ent.p1 * 8, ent.p2 * 8); + { + int y = ey; + int height = ent.p2 * 8; + + switch (ent.p3) + { + default: + break; + case 1: + // Top Spikes + y += 4; + height -= 4; + break; + case 2: + // Bottom Spikes + height -= 4; + break; + case 3: + // Side Spikes + y += 3; + height -= 6; + break; + } + + obj.createblock(DAMAGE, ex, y, ent.p1 * 8, height); break; + } case 23: // Directional Box obj.createblock(DIRECTIONAL, ex, ey, ent.p1 * 8, ent.p2 * 8, ent.p3); break;