mirror of
https://github.com/Such-Software/wownerogue.git
synced 2026-10-20 15:48:33 +02:00
feat(iso): furniture props in isometric mode (bar/kegs, tables, chairs, barrels)
The iso renderer only drew floor+wall (bar/table hardcoded). Generalize the floor-base + prop compositing to all furniture kinds (bar/table/chair/keg/shelf/ barrel/crate) and map them to the iso-dungeon tiles: stacked barrels = the bar + kegs, chest = tables/crates/shelves, chair = chairs. Half walls kept (full walls would occlude the front row). Same coherent iso-dungeon art set. Client-only.
This commit is contained in:
@@ -256,10 +256,20 @@
|
||||
avatar: 'char-villager',
|
||||
tile: { w: 84, h: 42, imageW: 92, imageH: 184 },
|
||||
tiles: {
|
||||
floor: 'assets/kenney/iso-dungeon/tiles/planks_S.png',
|
||||
wall: 'assets/kenney/iso-dungeon/tiles/stoneWallHalf_S.png',
|
||||
bar: 'assets/kenney/iso-dungeon/tiles/barrelsStacked_S.png',
|
||||
table: 'assets/kenney/iso-dungeon/tiles/chestClosed_S.png',
|
||||
floor: 'assets/kenney/iso-dungeon/tiles/planks_S.png',
|
||||
floor2: 'assets/kenney/iso-dungeon/tiles/stone_S.png',
|
||||
wall: 'assets/kenney/iso-dungeon/tiles/stoneWallHalf_S.png', // half walls keep the interior visible
|
||||
window: 'assets/kenney/iso-dungeon/tiles/stoneWallHalf_S.png', // no iso window art — reuse the half wall
|
||||
rug: 'assets/kenney/iso-dungeon/tiles/planks_S.png',
|
||||
door: 'assets/kenney/iso-dungeon/tiles/planks_S.png',
|
||||
// Furniture props (drawn over a floor base):
|
||||
bar: 'assets/kenney/iso-dungeon/tiles/barrelsStacked_S.png', // stacked kegs = the bar
|
||||
keg: 'assets/kenney/iso-dungeon/tiles/barrelsStacked_S.png',
|
||||
barrel: 'assets/kenney/iso-dungeon/tiles/barrelsStacked_S.png',
|
||||
shelf: 'assets/kenney/iso-dungeon/tiles/chestClosed_S.png',
|
||||
table: 'assets/kenney/iso-dungeon/tiles/chestClosed_S.png',
|
||||
crate: 'assets/kenney/iso-dungeon/tiles/chestClosed_S.png',
|
||||
chair: 'assets/kenney/iso-dungeon/tiles/chair_S.png',
|
||||
fallback: 'assets/kenney/iso-dungeon/tiles/planks_S.png'
|
||||
},
|
||||
// The Kenney files named Male_0..Male_7 are directional renders of the same body,
|
||||
|
||||
@@ -181,13 +181,16 @@
|
||||
ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
||||
ctx.imageSmoothingEnabled = true;
|
||||
|
||||
// Furniture kinds draw a floor tile as the base + the prop sprite on top (same idea as the
|
||||
// tiled renderer's `over` compositing). Everything else is a plain ground/wall tile.
|
||||
var PROP = { bar: 1, table: 1, chair: 1, keg: 1, shelf: 1, barrel: 1, crate: 1 };
|
||||
var items = [], x, y, kind, p;
|
||||
for (y = 0; y < scene.rows; y++) {
|
||||
for (x = 0; x < scene.cols; x++) {
|
||||
kind = scene.grid[y][x];
|
||||
p = this._project(x, y, originX, originY);
|
||||
items.push({ type: 'tile', kind: kind, x: x, y: y, sx: p.x, sy: p.y, depth: x + y });
|
||||
if (kind === 'bar' || kind === 'table') {
|
||||
if (PROP[kind]) {
|
||||
items.push({ type: 'prop', kind: kind, x: x, y: y, sx: p.x, sy: p.y, depth: x + y + 0.25 });
|
||||
}
|
||||
}
|
||||
@@ -203,7 +206,7 @@
|
||||
for (i = 0; i < items.length; i++) {
|
||||
var it = items[i];
|
||||
if (it.type === 'tile') {
|
||||
var tileKind = (it.kind === 'bar' || it.kind === 'table') ? 'floor' : it.kind;
|
||||
var tileKind = PROP[it.kind] ? 'floor' : it.kind;
|
||||
var rec = this._load(this._tileUrl(tileKind));
|
||||
if (rec && rec.ready) this._drawImage(rec.img, it.sx, it.sy + this.tileH, this.imageW, this.imageH);
|
||||
} else if (it.type === 'prop') {
|
||||
|
||||
Reference in New Issue
Block a user