[Parity][hud][S2][H][R] 位图字体的颜色和着色算法都不是原版的;另外默认加阴影,最小字宽被设成 4 #642

Closed
opened 2026-10-02 11:42:50 +00:00 by troytt · 0 comments
Owner

1.13c 客户端保真度审计立项(基准快照:7bd1090 / main @ 77a20c7)

证据标记说明:V-data = 1.13c MPQ 数据表 (.txt / animdata.d2 / .tbl / pal.pl2);V-src = D2MOO 逆向源码;V-bin = 1.13c DLL 反汇编;K = 1.13c 公认行为。

来源审计项:hud#8 — [S2][H][R] 8. 位图字体的颜色和着色算法都不是原版的;另外默认加阴影,最小字宽被设成 4

  • 位置:src/client/ui/font.ts:27-55(D2_COLOR_HEX / CODE_CHAR_TO_COLOR)、:115-140(parseColoredText)、:260-314(getTintedAtlas)、:379 与 :433-445(默认阴影)、:328 / :405 / :430(Math.max(4, width))、:330(pxSize * 0.58)
  • 代码:gold: '#c8a15a'、white: '#e8e4dc';else if (maxC < 110) {…} const lum = Math.min(1, (maxC - 60) / 144);const shadow = options.shadow ?? true
  • 原版:
    • pal.pl2(act1)的文字颜色(V-data,用 decodePl2 解出):c0 #ffffff(web #e8e4dc)、c4 #c7b377(web #c8a15a)、c6 #000000(web #080808)、c7 #d0c27d(web #d8c898)、c8 #ffa800(web #ff9c18)、c; #ae00ff(web #b040ff);c2 #00ff00、c3 #6969ff 只有细微差别;c< #00c800 在 web 中缺失;c1、c5、c9、c: 一致。
    • 绘制流程:sub_6F8AA9E0 逐字调用 TEXTURE_CelDrawColor(…, DRAWMODE_NORMAL, nPaletteShift),每字前进 nWidth,没有阴影 pass。色码解析规则:ÿc 后面跟任意字符,idx = ch - '0',>= 13 时归 0(V-src D2WinFont.cpp:760-842)。也就是说,原版是按 pl2 文字调色表做调色板索引重映射,而不是按亮度阈值染色。
  • 影响:所有 HUD 和面板上的位图文字颜色都有偏差(金色、白色、暗金色最明显);每个字形都多了一层 +1,+1 的黑影;窄字形(font6 的标点、'、|、i、l 等 tbl 宽度只有 2~3)被撑到 4px,导致文本测宽、居中、换行都不准;不认识的色码(包括 ÿc<)会原样显示成文字。
  • 建议:用 pal.pl2 的 13 色文字表和 shift 表做索引重映射;默认不画阴影;字宽严格使用字体 tbl 的 nWidth;色码按原版规则解析。
  • 已有 issue:—
> **1.13c 客户端保真度审计立项**(基准快照:`7bd1090` / `main @ 77a20c7`) > 证据标记说明:`V-data` = 1.13c MPQ 数据表 (`.txt` / `animdata.d2` / `.tbl` / `pal.pl2`);`V-src` = D2MOO 逆向源码;`V-bin` = 1.13c DLL 反汇编;`K` = 1.13c 公认行为。 ### 来源审计项:`hud#8` — [S2][H][R] 8. 位图字体的颜色和着色算法都不是原版的;另外默认加阴影,最小字宽被设成 4 - 位置:`src/client/ui/font.ts:27-55`(`D2_COLOR_HEX` / `CODE_CHAR_TO_COLOR`)、`:115-140`(`parseColoredText`)、`:260-314`(`getTintedAtlas`)、`:379` 与 `:433-445`(默认阴影)、`:328` / `:405` / `:430`(`Math.max(4, width)`)、`:330`(`pxSize * 0.58`) - 代码:`gold: '#c8a15a'`、`white: '#e8e4dc'`;`else if (maxC < 110) {…} const lum = Math.min(1, (maxC - 60) / 144)`;`const shadow = options.shadow ?? true` - 原版: - pal.pl2(act1)的文字颜色(V-data,用 `decodePl2` 解出):c0 #ffffff(web #e8e4dc)、c4 #c7b377(web #c8a15a)、c6 #000000(web #080808)、c7 #d0c27d(web #d8c898)、c8 #ffa800(web #ff9c18)、c; #ae00ff(web #b040ff);c2 #00ff00、c3 #6969ff 只有细微差别;c< #00c800 在 web 中缺失;c1、c5、c9、c: 一致。 - 绘制流程:`sub_6F8AA9E0` 逐字调用 `TEXTURE_CelDrawColor(…, DRAWMODE_NORMAL, nPaletteShift)`,每字前进 `nWidth`,没有阴影 pass。色码解析规则:`ÿc` 后面跟任意字符,`idx = ch - '0'`,`>= 13` 时归 0(V-src `D2WinFont.cpp:760-842`)。也就是说,原版是按 pl2 文字调色表做调色板索引重映射,而不是按亮度阈值染色。 - 影响:所有 HUD 和面板上的位图文字颜色都有偏差(金色、白色、暗金色最明显);每个字形都多了一层 +1,+1 的黑影;窄字形(font6 的标点、`'`、`|`、`i`、`l` 等 tbl 宽度只有 2~3)被撑到 4px,导致文本测宽、居中、换行都不准;不认识的色码(包括 `ÿc<`)会原样显示成文字。 - 建议:用 pal.pl2 的 13 色文字表和 shift 表做索引重映射;默认不画阴影;字宽严格使用字体 tbl 的 `nWidth`;色码按原版规则解析。 - 已有 issue:—
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: troytt/diablo2-web#642
No description provided.