#248
Fix macOS death-screen lockup caused by stale ground movement
Summary
Fixes #247. macOS 鼠标移动中死亡时,已消费的点地移动任务仍留在 g_go。死亡弹窗打开后,w_ground_step 继续发跑步令,使客户端角色保持跑动姿势,死亡确认无法复活。
w_mouse_cancel_pending (world input inactive)
discard queued mouse tap / walk
+ cancel the already-started W_GROUND route只取消 Mac 点地移动路线;共享的非地面目标走近/触屏路径不变。取消后重新进入可操作状态不会恢复旧路线。
Evidence
- Before: 在
6a3f1ee上用隔离存档运行原生 macOS App:野外死亡时鼠标仍按住走路,角色 HP=0 却保持跑动姿势;42/46 秒送入 PLUS,死亡弹窗始终不关闭。 After: 同一场景使用本补丁:角色完成死亡动画;42 秒 PLUS 后出现ClosePanel YouDiedModal,HUD 返回区域 1、生命44/44。 - Before: 新增路线取消回归断言在旧实现上失败 2 项。
After:
make -C dm/host/tests build/t_interaction_diag && dm/host/tests/build/t_interaction_diag:22 checks, 0 failures。另在dm/host/tests执行build/t_touch_mac:39 项,失败 0。原生宿主编译及 App 签名验证通过。 - 安装后的 App 再测区域 13:鼠标移动中死亡,点击「继续」后成功回城,HP 44/44。
- 对照:未移动时,区域 2 和 13 的死亡/继续在旧版均正常,排除了简单的确认键映射问题。
复现场景使用已有测试入口(每次都复制自己的测试存档到独立 DM_APP_SUPPORT;不要使用真实存档目录):
DM_TEST_GOTO_LEVEL=150:2
DM_TEST_KILL=450
DM_KEYS=A@8,A@12,PLUS@42,PLUS@46
DM_TEST_QUIT_AT=58
DM_TEST_LIVE=<file with the following two lines>
23 down 2550,660
40 up 2550,660在 Mac App 上启动;选角进局时间/出生点因测试存档而异,需确保鼠标移动覆盖第 450 个服务端 tick。判据是死亡弹窗打开后,确认能否关闭弹窗且 HUD 回到城镇并满血,不能只判断进程仍在运行。没有提交游戏资源、存档或私人日志。
Merge Danger
Door: Two-way — 单处取消逻辑及回归测试,可直接回退;没有存档格式变更。
Blast Radius: macOS
暂停、面板打开或离局都会取消已有的 Mac 点地路线,与现有鼠标队列/手势取消语义一致。非地面目标走近和触屏点按保留;本次未测试实体手柄或移动设备。改动没有新增外部输入入口、权限或敏感数据输出。
看过了,改法对,也很小。
W_GROUND点地路线只有 macOS 宿主有,w_mouse_cancel_pending也在 macOS 专用的分支里,所以 iOS / 安卓 / 鸿蒙都不受影响。我在 Linux 容器里跑了测试(
-dead_strip换成-ffunction-sections -fdata-sections -Wl,--gc-sections,TargetConditionals.h用桩选 macOS 路径):t_interaction_diag在这个 head 上 22 项、0 失败;dm_world.c换回改之前的版本,同一测试第 39、40 行失败(2 项),说明新断言确实抓得住这个问题;mode_scan.py与t_touch_mac(39 项)也通过。有一处行为变化值得知道:现在只要世界输入变为不可用(任何面板打开),正在走的点地路线都会停下,不只是死亡弹窗。这和原来取消待处理点击的做法一致,我觉得是对的,提一下而已。没在 Mac 上跑过。
Reviewed: the fix is right and small.
W_GROUNDground routes exist only on the macOS host, andw_mouse_cancel_pendingsits in the macOS-only block, so iOS, Android and HarmonyOS are unaffected.I ran the tests in a Linux container (
-ffunction-sections -fdata-sections -Wl,--gc-sectionsin place of-dead_strip, with a stubTargetConditionals.hselecting the macOS path):t_interaction_diagon this head: 22 checks, 0 failures.dm_world.cswapped back to the version before this change, the same test fails at lines 39 and 40 (2 failures), so the new assertions do catch the problem.mode_scan.pyandt_touch_mac(39 checks) pass too.One behaviour change worth knowing: a ground route now stops whenever world input becomes inactive (any panel opening), not only for the death dialog. That matches how pending clicks were already cancelled, and I think it's right; just flagging it. I haven't run it on a Mac.