soul-symphony-ling
↓ 0 downloadsSoul Symphony — Ling Edition. A spiritual 3D adventure in the soul realm: collect the letters of the world-song, clear the monster lattice, and duel in the arcade arena. Wind Waker-style toon renderer with volumetric light pools, SSAO, bloom and oil-slick tilt-shift — all ling-lang vectors.
Keywords game, 3d, toon, music, soul-symphony
lingfu install soul-symphony-lingCode / Files (1947)
game/dialogue_font.ling
# dialogue_font.ling — native-script dialogue subtitle rendering.
#
# Six baked glyphsets (font/dialogue/*.ling, generated by tools/phrasebake
# --glyphset), one per selectable language, each a self-contained
# วาดDialogue<Lang>(i, ox,oy,oz, rx,ry,rz, ux,uy,uz, s) function baking cluster
# index i (a grapheme cluster: base char + any combining marks, so Thai tone
# marks/vowel signs stack correctly) plus a Dialogue<Lang>_ADV[i] advance-width
# table (em units — NOT a fixed per-char advance, since real scripts have
# wildly variable cluster widths).
#
# Dialogue TEXT is static game content (not player-typed), so instead of
# implementing Unicode grapheme segmentation at runtime in ling, each line's
# cluster sequence is precomputed once in Python (tools/voiceover/bake_dialogue_glyphs.py)
# and embedded directly as an index array in each scene file — see
# <prefix>_บทพูดกลิฟ(ภาษา) alongside the existing <prefix>_บทพูด(ภาษา) (plain-
# text; kept as a fallback data source, no longer used for on-screen display
# now that all six languages have real glyphs, but still handy for logging).
ใช้ "../font/dialogue/Thai"
ใช้ "../font/dialogue/Korean"
ใช้ "../font/dialogue/Japanese"
ใช้ "../font/dialogue/Chinese"
ใช้ "../font/dialogue/English"
ใช้ "../font/dialogue/Daemon"
# ── อบกลิฟลงแคชเมช ครั้งเดียวตอนบูต (เล่นซ้ำแบบเนทีฟทุกเฟรมผ่าน วาดอบเมช) ──
ฟังก์ชัน อบกลิฟบทพูด(ภาษา, n) {
bind cache = []
bind i = 0
ขณะที่ i < n {
เริ่มอบเมช()
ถ้า ภาษา == 0 { วาดDialogueDaemon(i, 0.0,0.0,0.0, 1.0,0.0,0.0, 0.0,1.0,0.0, 1.0) }
มิฉะนั้น { ถ้า ภาษา == 1 { วาดDialogueEnglish(i, 0.0,0.0,0.0, 1.0,0.0,0.0, 0.0,1.0,0.0, 1.0) }
มิฉะนั้น { ถ้า ภาษา == 2 { วาดDialogueThai(i, 0.0,0.0,0.0, 1.0,0.0,0.0, 0.0,1.0,0.0, 1.0) }
มิฉะนั้น { ถ้า ภาษา == 3 { วาดDialogueKorean(i, 0.0,0.0,0.0, 1.0,0.0,0.0, 0.0,1.0,0.0, 1.0) }
มิฉะนั้น { ถ้า ภาษา == 4 { วาดDialogueJapanese(i, 0.0,0.0,0.0, 1.0,0.0,0.0, 0.0,1.0,0.0, 1.0) }
มิฉะนั้น { วาดDialogueChinese(i, 0.0,0.0,0.0, 1.0,0.0,0.0, 0.0,1.0,0.0, 1.0) }
} } } }
bind cache = list_push(cache, จบอบเมช())
bind i = i + 1
}
คืน cache
}
bind _กลิฟบทพูดDaemon = อบกลิฟบทพูด(0, 31)
bind _กลิฟบทพูดEnglish = อบกลิฟบทพูด(1, 39)
bind _กลิฟบทพูดThai = อบกลิฟบทพูด(2, 158)
bind _กลิฟบทพูดKorean = อบกลิฟบทพูด(3, 538)
bind _กลิฟบทพูดJapanese = อบกลิฟบทพูด(4, 627)
bind _กลิฟบทพูดChinese = อบกลิฟบทพูด(5, 853)
ฟังก์ชัน วาดกลิฟบทพูด(ภาษา, i, x, y, z, s) {
boot_text_style()
ถ้า ภาษา == 0 { วาดอบเมช(list_get(_กลิฟบทพูดDaemon, i), x,y,z, 1,0,0, 0,0.0-1.0,0, s) }
มิฉะนั้น { ถ้า ภาษา == 1 { วาดอบเมช(list_get(_กลิฟบทพูดEnglish, i), x,y,z, 1,0,0, 0,0.0-1.0,0, s) }
มิฉะนั้น { ถ้า ภาษา == 2 { วาดอบเมช(list_get(_กลิฟบทพูดThai, i), x,y,z, 1,0,0, 0,0.0-1.0,0, s) }
มิฉะนั้น { ถ้า ภาษา == 3 { วาดอบเมช(list_get(_กลิฟบทพูดKorean, i), x,y,z, 1,0,0, 0,0.0-1.0,0, s) }
มิฉะนั้น { ถ้า ภาษา == 4 { วาดอบเมช(list_get(_กลิฟบทพูดJapanese, i), x,y,z, 1,0,0, 0,0.0-1.0,0, s) }
มิฉะนั้น { วาดอบเมช(list_get(_กลิฟบทพูดChinese, i), x,y,z, 1,0,0, 0,0.0-1.0,0, s) }
} } } }
ตั้งแฟลตเชด(0)
}
ฟังก์ชัน ความกว้างกลิฟบทพูด(ภาษา, i) {
ถ้า ภาษา == 0 { คืน list_get(DialogueDaemon_ADV, i) }
ถ้า ภาษา == 1 { คืน list_get(DialogueEnglish_ADV, i) }
ถ้า ภาษา == 2 { คืน list_get(DialogueThai_ADV, i) }
ถ้า ภาษา == 3 { คืน list_get(DialogueKorean_ADV, i) }
ถ้า ภาษา == 4 { คืน list_get(DialogueJapanese_ADV, i) }
คืน list_get(DialogueChinese_ADV, i)
}
bind DIALOGUE_SPACE_ADV = 0.28
ฟังก์ชัน ความกว้างรวมบทพูดบาก(indices, ภาษา) {
bind n = ความยาว(indices)
bind totalw = 0.0
bind wi = 0
ขณะที่ wi < n {
bind gi = list_get(indices, wi)
ถ้า gi < 0 { bind totalw = totalw + DIALOGUE_SPACE_ADV }
มิฉะนั้น { bind totalw = totalw + ความกว้างกลิฟบทพูด(ภาษา, gi) }
bind wi = wi + 1
}
คืน totalw
}
# ── ขอบดำ 8 ทิศ (เรียกก่อน วาดสตริงบทพูดบาก เสมอ ที่ตำแหน่ง/สเกลเดียวกัน) ──
ฟังก์ชัน วาดสตริงบทพูดบากขอบ(indices, ภาษา, ox, oy, oz, scale) {
bind n = ความยาว(indices)
bind totalw = ความกว้างรวมบทพูดบาก(indices, ภาษา)
bind startx = ox - totalw * scale * 0.5
สีดินสอ(0, 0, 0)
bind di = 0
ขณะที่ di < 8 {
bind dang = di * 0.7854
bind ddx = โคไซน์(dang) * 0.015; bind ddy = ไซน์(dang) * 0.015
bind cx = startx + ddx
bind oi = 0
ขณะที่ oi < n {
bind gi = list_get(indices, oi)
ถ้า gi < 0 { bind cx = cx + DIALOGUE_SPACE_ADV * scale }
มิฉะนั้น {
วาดกลิฟบทพูด(ภาษา, gi, cx, oy + ddy, oz + 0.02, scale)
bind cx = cx + ความกว้างกลิฟบทพูด(ภาษา, gi) * scale
}
bind oi = oi + 1
}
bind di = di + 1
}
}
# ── พื้นผิวสีจริง (เรียกหลัง สีดินสอ(...) ตั้งสีจริงแล้ว — เหมือน วาดสตริง เดิม) ──
ฟังก์ชัน วาดสตริงบทพูดบาก(indices, ภาษา, ox, oy, oz, scale) {
bind n = ความยาว(indices)
bind totalw = ความกว้างรวมบทพูดบาก(indices, ภาษา)
bind startx = ox - totalw * scale * 0.5
bind cx = startx
bind mi = 0
ขณะที่ mi < n {
bind gi = list_get(indices, mi)
ถ้า gi < 0 { bind cx = cx + DIALOGUE_SPACE_ADV * scale }
มิฉะนั้น {
วาดกลิฟบทพูด(ภาษา, gi, cx, oy, oz, scale)
bind cx = cx + ความกว้างกลิฟบทพูด(ภาษา, gi) * scale
}
bind mi = mi + 1
}
}
# ── พื้นผิวสีจริง + ช่วงไฮไลท์สีผู้ถูกกล่าวถึง (hiStart<=idx<hiEnd → hr,hg,hb แทน lr,lg,lb) ──
# hiStart == -1 ปิดไฮไลท์ทั้งบรรทัด (สีเดียวตลอดเหมือน วาดสตริงบทพูดบาก เดิม)
ฟังก์ชัน วาดสตริงบทพูดบากสี(indices, ภาษา, ox, oy, oz, scale, lr, lg, lb, hiStart, hiEnd, hr, hg, hb) {
bind n = ความยาว(indices)
bind totalw = ความกว้างรวมบทพูดบาก(indices, ภาษา)
bind startx = ox - totalw * scale * 0.5
bind cx = startx
bind sidx = 0
ขณะที่ sidx < n {
bind gi = list_get(indices, sidx)
ถ้า gi < 0 { bind cx = cx + DIALOGUE_SPACE_ADV * scale }
มิฉะนั้น {
ถ้า hiStart >= 0 {
ถ้า sidx >= hiStart { ถ้า sidx < hiEnd { สีดินสอ(hr, hg, hb) } มิฉะนั้น { สีดินสอ(lr, lg, lb) } }
มิฉะนั้น { สีดินสอ(lr, lg, lb) }
}
มิฉะนั้น { สีดินสอ(lr, lg, lb) }
วาดกลิฟบทพูด(ภาษา, gi, cx, oy, oz, scale)
bind cx = cx + ความกว้างกลิฟบทพูด(ภาษา, gi) * scale
}
bind sidx = sidx + 1
}
}