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.
This commit is contained in:
NyakoFox authored and Ethan Lee committed 2026-11-13 15:58:50 -05:00
1 parent 7d163c0f93
commit 135763066e
2 files changed
+52 -4

No files matched your search

+26 -3
View File
@@ -1131,12 +1131,35 @@ static void draw_entities(void)
break; break;
case 22: // Damage Boxes 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_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)); graphics.draw_rect(x, y, 8, 8, graphics.getRGB(255, 255, 255));
break; break;
} }
+26 -1
View File
@@ -1966,8 +1966,33 @@ void mapclass::loadlevel(int rx, int ry)
obj.createblock(BLOCK, ex, ey, ent.p1 * 8, ent.p2 * 8); obj.createblock(BLOCK, ex, ey, ent.p1 * 8, ent.p2 * 8);
break; break;
case 22: // Damage Box 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; break;
}
case 23: // Directional Box case 23: // Directional Box
obj.createblock(DIRECTIONAL, ex, ey, ent.p1 * 8, ent.p2 * 8, ent.p3); obj.createblock(DIRECTIONAL, ex, ey, ent.p1 * 8, ent.p2 * 8, ent.p3);
break; break;