94 lines
2.7 KiB
Python
94 lines
2.7 KiB
Python
import math
|
|
|
|
NUM_ANGLES = 512
|
|
FP_SHIFT = 16
|
|
FP_ONE = 1 << FP_SHIFT
|
|
|
|
def float_to_fp(val: float) -> int:
|
|
i = int(round(val * FP_ONE))
|
|
if i < 0:
|
|
i = (1 << 32) + i
|
|
return i & 0xFFFFFFFF
|
|
|
|
sin_table = []
|
|
cos_table = []
|
|
for i in range(NUM_ANGLES):
|
|
rad = (i * 2.0 * math.pi) / NUM_ANGLES
|
|
sin_table.append(float_to_fp(math.sin(rad)))
|
|
cos_table.append(float_to_fp(math.cos(rad)))
|
|
|
|
# Grand Luxury Open Casino Hall (32x32)
|
|
# 0 = Open floor (carpet)
|
|
# 1 = Red Velvet Wall with Gold Trim
|
|
# 2 = Neon Strip Club Wall
|
|
# 3 = Mahogany Wood Bar Wall
|
|
# 4 = Hell Tower Demon Wall
|
|
MAP_W = 32
|
|
MAP_H = 32
|
|
|
|
grid = [[0 for _ in range(MAP_W)] for _ in range(MAP_H)]
|
|
|
|
# Outer perimeter: Velvet Wall (1)
|
|
for x in range(MAP_W):
|
|
grid[0][x] = 1
|
|
grid[MAP_H - 1][x] = 1
|
|
for y in range(MAP_H):
|
|
grid[y][0] = 1
|
|
grid[y][MAP_W - 1] = 1
|
|
|
|
# North side: VIP Strip Club Stage backdrop (Neon Wall 2)
|
|
for x in range(10, 22):
|
|
grid[1][x] = 2
|
|
|
|
# Decorative stage wing pillars
|
|
grid[2][9] = 2
|
|
grid[3][9] = 2
|
|
grid[2][22] = 2
|
|
grid[3][22] = 2
|
|
|
|
# East side: Bar & Shop back counter (Wood Wall 3)
|
|
for y in range(13, 20):
|
|
grid[y][30] = 3
|
|
for y in range(14, 19):
|
|
grid[y][29] = 3
|
|
|
|
# South side: Secret Hell Tower entrance (Demon Wall 4)
|
|
for x in range(13, 19):
|
|
grid[30][x] = 4
|
|
|
|
# Elegant decorative casino columns (spacing out the grand hall without blocking views)
|
|
grid[8][8] = 1
|
|
grid[8][23] = 1
|
|
grid[23][8] = 1
|
|
grid[23][23] = 1
|
|
|
|
from pathlib import Path
|
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
with open(REPO_ROOT / "casino3d_data.inc", "w", encoding="cp1251") as f:
|
|
f.write("; --- CASINO 3D ENGINE DATA (Generated: Grand Open Hall) ---\n\n")
|
|
f.write("NUM_ANGLES equ 512\n")
|
|
f.write("MAP_WIDTH equ 32\n")
|
|
f.write("MAP_HEIGHT equ 32\n\n")
|
|
|
|
# Cosine table
|
|
f.write(".data\nALIGN 4\ntableCos dd ")
|
|
for idx, v in enumerate(cos_table):
|
|
comma = "," if (idx + 1) % 8 != 0 and idx != NUM_ANGLES - 1 else "\n"
|
|
prefix = " dd " if (idx + 1) % 8 == 1 and idx != 0 else ""
|
|
f.write(f"{prefix}0{v:08X}h{comma}")
|
|
f.write("\nALIGN 4\ntableSin dd ")
|
|
for idx, v in enumerate(sin_table):
|
|
comma = "," if (idx + 1) % 8 != 0 and idx != NUM_ANGLES - 1 else "\n"
|
|
prefix = " dd " if (idx + 1) % 8 == 1 and idx != 0 else ""
|
|
f.write(f"{prefix}0{v:08X}h{comma}")
|
|
f.write("\nALIGN 4\ncasinoMap db ")
|
|
flat_map = []
|
|
for row in grid:
|
|
flat_map.extend(row)
|
|
for idx, b in enumerate(flat_map):
|
|
comma = "," if (idx + 1) % 32 != 0 and idx != len(flat_map) - 1 else "\n"
|
|
prefix = " db " if (idx + 1) % 32 == 1 and idx != 0 else ""
|
|
f.write(f"{prefix}{b}{comma}")
|
|
f.write("\n")
|
|
|
|
print("Generated grand open hall casino3d_data.inc successfully!")
|