- Fix Little-Endian DIB color inversion (0000FFFFh/0000D7FFh -> 00FFFF00h/00FFD700h) restoring luxurious Gold, Emerald Felt, and Crimson Red palettes across the entire game
- Extract authentic IBM VGA 8x8 font from app866.fon fixing Cyrillic glyph distortion ('М', 'Л', 'П', 'Д')
- Implement native in-engine 2.5D Dead by Daylight Skill Check (MODE_SKILL) eliminating external console popups
- Fix audio mappings to dedicated minigame sounds with zero gunshots outside Russian roulette
- Update visual rasterization test suite and verified 640x480 preview renders
45 lines
1.6 KiB
Python
45 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Generate 100% authentic, pixel-perfect 8x8 IBM VGA bitmap font for CP1251 in font8x8.inc.
|
|
Extracts official IBM VGA 8x8 font resources directly from C:\\Windows\\Fonts\\app866.fon,
|
|
mapping CP1251 characters to the corresponding CP866 Cyrillic glyphs.
|
|
"""
|
|
import struct
|
|
from pathlib import Path
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
FONT_INC = REPO_ROOT / 'font8x8.inc'
|
|
|
|
# Load authentic 8x8 font from app866.fon (Resource at offset 8784: 8x8, 256 glyphs)
|
|
with open('C:/Windows/Fonts/app866.fon', 'rb') as f:
|
|
fon_data = f.read()
|
|
|
|
font_res = fon_data[8784:8784+3211]
|
|
raw_glyphs = {}
|
|
for ch in range(256):
|
|
entry_off = 0x76 + ch * 4
|
|
w, off = struct.unpack('<HH', font_res[entry_off:entry_off+4])
|
|
raw_glyphs[ch] = list(font_res[off:off+8])
|
|
|
|
# Build complete 256-glyph CP1251 table
|
|
cp1251_font = []
|
|
for b in range(256):
|
|
if b < 128:
|
|
cp1251_font.append(raw_glyphs[b])
|
|
else:
|
|
try:
|
|
char = bytes([b]).decode('cp1251')
|
|
b866 = char.encode('cp866')[0]
|
|
cp1251_font.append(raw_glyphs[b866])
|
|
except Exception:
|
|
cp1251_font.append(raw_glyphs[ord('?')])
|
|
|
|
# Write font8x8.inc in CP1251 encoding
|
|
with open(FONT_INC, 'w', encoding='cp1251') as f:
|
|
f.write("; --- 8x8 BITMAP FONT FOR CP1251 (Authentic IBM VGA CP866/1251) ---\n")
|
|
f.write(".data\nALIGN 4\nfont8x8 label byte\n")
|
|
for idx, glyph in enumerate(cp1251_font):
|
|
b_str = ", ".join(f"0{b:02X}h" for b in glyph)
|
|
f.write(f"db {b_str} ; char 0x{idx:02X}\n")
|
|
|
|
print(f"[SUCCESS] Generated authentic, pixel-perfect font8x8.inc ({len(cp1251_font)} glyphs)")
|