Skip to content

Commit fc22007

Browse files
committed
2 parents 7eaf666 + 83685b3 commit fc22007

3 files changed

Lines changed: 53 additions & 30 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 dhcold
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,28 @@ pyinstaller --onefile --windowed --name turnt-o-mapper main.py
7272
## Usage
7373

7474
### Generate tab
75+
7576
<img width="1887" height="1129" alt="image" src="https://github.com/user-attachments/assets/abc8e11b-a877-4fe6-898f-c72eef3f2347" />
77+
7678
- Set **Number of rooms** (2–100) and choose a **Layout style**
7779
- Adjust **Room size** (min/max width, depth, height)
7880
- Set **Corridor width** (25–100%)
7981
- Optionally enable **Physics model** for acceleration-based level design
8082
- Click **⚡ Generate** — preview updates instantly
8183

8284
### DBT Import tab
85+
8386
<img width="1886" height="1179" alt="image" src="https://github.com/user-attachments/assets/cb473cb1-2b10-45b9-9ec1-d3b3005cea75" />
87+
8488
- Select a Diabotical `.rbe` map file
8589
- Configure X/Y/Z scale (Quake units per DBT block)
8690
- Click **Import** to get a `.map`
8791
- **Save** map file
8892

8993
### Textures tab
94+
95+
<img width="1887" height="1176" alt="image" src="https://github.com/user-attachments/assets/5372221e-d0da-403b-96c9-3a559c08fb73" />
96+
9097
- Assign textures to **Floor**, **Wall**, and **Ceiling** categories using the F/W/C checkboxes
9198
- Set the **Texture folder** path in Settings to see live thumbnails
9299
- The generator picks one unified texture set per map from the enabled pool

turnt_o_mapper/dbt_import.py

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,6 @@ def rbe_entities_to_map(entities, sx, sy, sz, opaque_tex="turnt/turnt_concrete")
542542
# All coords in DBT world-units (1 block = 40 X/Z, 20 Y).
543543
# box / box_corner: 100u per axis at scale 1.
544544
# diagonal: 40u per axis at scale 1.
545-
ang = e.get("yrot", 0.0) % (2 * math.pi)
546-
547545
if prop_shape in ("box", "box_corner"):
548546
BASE = 100.0
549547
fx = max(MIN_HALF, abs(e.get("xscale", 1.0)) * BASE * EFX)
@@ -630,36 +628,33 @@ def _rotated_box(ox, oy, oz, hx, hy, hz, tex, label):
630628
prop_tex, f"prop_box_corner {nm}"))
631629

632630
# ── diagonal: 5-face wedge, anchor at corner ─────────────
631+
# Local-space wedge (before rotation):
632+
# Base triangle in XY at Z=0, extruded to Z=fz.
633+
# Vertices: A(0,0,0) B(fx,0,0) C(0,fy,0) + top copies.
634+
# The sloped face goes from edge AB(z=0) to C(z=fz).
633635
elif prop_shape == "diagonal":
634-
z0, z1 = qz, qz + fz
635-
if ang < math.pi / 4 or ang >= 7 * math.pi / 4:
636-
x0, x1 = qx, qx + fx
637-
y0, y1 = qy, qy + fy
638-
f_w1 = face((x0, y0, z0), (x0, y1, z0), (x0, y0, z1), prop_tex)
639-
f_w2 = face((x1, y1, z1), (x0, y1, z1), (x1, y1, z0), prop_tex)
640-
f_dia = face((x0, y0, z1), (x1, y1, z1 + 1), (x1, y1, z1), prop_tex)
641-
elif ang < 3 * math.pi / 4:
642-
x0, x1 = qx, qx + fx
643-
y0, y1 = qy - fy, qy
644-
f_w1 = face((x1, y1, z1), (x1, y1, z0), (x1, y0, z1), prop_tex)
645-
f_w2 = face((x1, y1, z1), (x0, y1, z1), (x1, y1, z0), prop_tex)
646-
f_dia = face((x0, y1, z1), (x1, y0, z1 + 1), (x1, y0, z1), prop_tex)
647-
elif ang < 5 * math.pi / 4:
648-
x0, x1 = qx - fx, qx
649-
y0, y1 = qy - fy, qy
650-
f_w1 = face((x1, y1, z1), (x1, y1, z0), (x1, y0, z1), prop_tex)
651-
f_w2 = face((x0, y0, z0), (x0, y0, z1), (x1, y0, z0), prop_tex)
652-
f_dia = face((x1, y1, z1), (x0, y0, z1 + 1), (x0, y0, z1), prop_tex)
653-
else:
654-
x0, x1 = qx - fx, qx
655-
y0, y1 = qy, qy + fy
656-
f_w1 = face((x0, y0, z0), (x0, y1, z0), (x0, y0, z1), prop_tex)
657-
f_w2 = face((x0, y0, z0), (x0, y0, z1), (x1, y0, z0), prop_tex)
658-
f_dia = face((x0, y1, z1), (x1, y0, z1), (x1, y0, z1 + 1), prop_tex)
659-
f_bot = face((x0, y0, z0), (x1, y0, z0), (x0, y1, z0), prop_tex)
660-
f_top = face((x1, y1, z1), (x1, y0, z1), (x0, y0, z1), prop_tex)
636+
# 6 local-space vertices of the wedge (anchor at corner)
637+
local_verts = [
638+
(0, 0, 0), # 0: base-A
639+
(fx, 0, 0), # 1: base-B
640+
(0, fy, 0), # 2: base-C
641+
(0, 0, fz), # 3: top-A
642+
(fx, 0, fz), # 4: top-B
643+
(0, fy, fz), # 5: top-C
644+
]
645+
# Rotate all vertices and offset to world position
646+
c = []
647+
for lx_, ly_, lz_ in local_verts:
648+
dx, dy, dz = _rot3d(lx_, ly_, lz_)
649+
c.append((qx + dx, qy + dy, qz + dz))
650+
# 5 faces (triangulated quads where needed)
651+
f_bot = face(c[0], c[1], c[2], prop_tex) # bottom tri
652+
f_top = face(c[5], c[4], c[3], prop_tex) # top tri
653+
f_back = face(c[0], c[3], c[1], prop_tex) # quad: A-D-E-B (Y=0 side)
654+
f_left = face(c[0], c[2], c[3], prop_tex) # quad: A-C-F-D (X=0 side)
655+
f_dia = face(c[1], c[4], c[2], prop_tex) # slope: B-E-F-C
661656
brushes.append(write_brush(
662-
[f_bot, f_top, f_w1, f_w2, f_dia], f"diag_prop {nm}"))
657+
[f_bot, f_top, f_back, f_left, f_dia], f"diag_prop {nm}"))
663658

664659
# ── cylinder ─────────────────────────────────────────────
665660
elif prop_shape == "cylinder":

0 commit comments

Comments
 (0)