给刷箱子的人
刷图最烦的不是怪,是漏箱子。
一个角落里的篮子、一棵树后面的隐藏储物点、贴着墙的箱子 —— 小地图上什么都没有,你只能凭记忆回头找,或者在每张图上顺着墙溜一遍。漏掉的那个可能正好是 30 号符文,也可能是一件暗金。
这个 PR 把还没开的箱子、篮子、隐藏储物点直接点到小地图上:一个金色小方块,开了就消失。开过的不会亮,火把、雾、灯这些装饰也不会亮(不然满屏都是点,等于没有)。
覆盖 76 类容器:各种箱子(普通 / 上锁 / 隐藏 / 大箱子)、篮子、瓮、桶、木箱、石棺、储物点…… 门和尸体不算。
怎么用
原版地图,不用改任何设置。角上的小地图和全屏地图都会标。
For reviewers
- Host side —
dm_chest_marks()walks the client unit table bucket 2 (main+0x2d603a0 + 2*0x400), keeping object units (+0== 2) whosemode(+0xc) is 0 and whose class (+4) is inis_container_cls(). That list is 76 entries built fromobjects.txt(chest / stash / casket / urn / barrel / jug / basket / crate), minus doors and corpses. - Projection — reuses
dm_ui_map_geom()for the per-cell pixel size anddm_ui_minimap_rect()/dm_cam_map_heading()for the centre;mx = (dx-dy)*1.6*cell,my = (dx+dy)*0.8*cell. Same overlay path as the existing map marks, no new renderer. - Why the unit table and not the room records — the randomised containers are not in the static room record chain (
level+0x10→room+0x98); a scan of 84 room records in Flayer Jungle found zero containers while the unit table had the Baskets, chest and hidden stash right next to the player. - Three things worth reviewing — (1) objects within 2 tiles of the player are skipped: a picked-up container's unit is recycled but still reads as "mode 0", which otherwise leaves a marker that follows you around; (2) two seconds of silence after a level change, since the unit table still holds the old level during the load animation; (3)
CamThreatsnow invalidates every frame — the old condition missed the 1 → 0 transition and left the previous frame's square on screen.
Verified on OnePlus Ace 5 Pro (Adreno 830), Android 14: markers appear on unopened Baskets / chests, vanish on open, no ghost markers, nothing left behind after a level change.
Activity
8四点都改了,在 0e6907a(chest-marks 分支):
- 界面线程遍历单位表 —— 按
dm_map_goals的模式改了:收集挪到游戏线程的w_chest_step()(在dm_world_step里跟w_map_goal_step并排),用序号锁(g_chest_seq/g_chest_pub,跟g_mg_seq同一套写法)发布「相对玩家的格差」数组(上限 64 个);dm_chest_marks现在只读这份数组再按小地图几何投影,完全不碰游戏内存。遍历另外加了 512 个节点的上限。 map_mark开关 —— 现在查dm_custom_get("map_mark"),跟小地图标注同一个开关(另留DM_CHEST_MARK环境变量给调试用)。自定义页里关了标注的玩家不会看到金点。- 乱码注释 ——
dm_world.c那两行是我整段重写时带进来的(UTF-8 被当 Latin-1 又编了一次),已按 UTF-8 重存;CamThreats.java第 119 行同样修了。现在整个改动里没有乱码。 - 注释与代码不符 / 多余空行 —— 注释改成「贴玩家 2 格内不标」,函数后面多出来的空行删掉了。
真机验证过(一加 Ace 5 Pro / Android 14):未开的篮子、箱子照样标,开掉立刻消失,过图后不残留,没有再出现贴着人走的方块。
All four are fixed in 0e6907a (chest-marks):
- Walking the unit table on the UI thread — changed to the
dm_map_goalspattern: collection moved to a game-thread step,w_chest_step(), sitting next tow_map_goal_step()indm_world_step. It publishes an array of offsets from the player (capped at 64) through a seqlock (g_chest_seq/g_chest_pub, same shape asg_mg_seq), anddm_chest_marksnow only reads that array and projects it — no game memory is touched on the UI thread. The walk also has a 512-node cap now. - The
map_markswitch — it now checksdm_custom_get("map_mark"), the same switch as the minimap marks (withDM_CHEST_MARKleft as a debugging override). Players who turned minimap marking off won't see the dots. - Garbled comments — those two lines in
dm_world.ccame in when I rewrote the block (UTF-8 read as Latin-1 and re-encoded); re-saved as UTF-8. Same forCamThreats.javaline 119. There is no garbled text left in the change. - Comment vs. code / stray blank lines — the comment now says "not drawn within 2 cells of the player", and the blank lines after the function are gone.
Verified on OnePlus Ace 5 Pro / Android 14: unopened baskets and chests still get marked, vanish the moment they are opened, nothing is left behind after a level change, and no marker follows the player any more.
谢谢,0e6907a 四点都对了:
- 收集在游戏线程(
w_chest_step,dm_world_step里),按g_mg_seq的写法用序号锁发布格差。dm_chest_marks只拷这份数组再投影,界面线程不再碰游戏内存。遍历有 512 节点上限。 - 由
map_mark门控,DM_CHEST_MARK留作调试覆盖。 - 改动里没有乱码了(新增行里没有 Latin-1 范围的字符)。
- 注释与代码一致,多余的空行也没了。
宿主闸门在这个 head 上通过(Linux 容器):mode_scan.py、t_hid_receipt 5/5、t_hid_script 37/37、t_touch_mac 39/39;dm_world.c 语法检查(-Wall)没有报错也没有警告。我这边没有其他意见了;没在手机上跑过(你在一加 Ace 5 Pro 上验证过)。
Thanks, all four are right in 0e6907a:
- Collection runs on the game thread (
w_chest_step, indm_world_step) and publishes the offsets through a seqlock the same way asg_mg_seq.dm_chest_marksonly copies that array and projects it, so the UI thread no longer touches game memory. The walk has a 512-node cap. - It's gated on
map_mark, withDM_CHEST_MARKas a debugging override. - No garbled text is left in the change (no Latin-1-range characters in the added lines).
- The comments match the code, and the stray blank lines are gone.
The host gate passes on this head (Linux container): mode_scan.py, t_hid_receipt 5/5, t_hid_script 37/37, t_touch_mac 39/39. A -Wall syntax check of dm_world.c gives no errors or warnings. No further comments from me. I haven't run it on a phone myself (you verified it on a OnePlus Ace 5 Pro).
想法很实用,投影和朝向箭头同一套几何,容器类表也整理得很全。有一处需要先改,另外三处小的:
(需要改)在界面线程上遍历游戏的单位表。
dm_chest_marks由CamThreats.doFrame(Choreographer,安卓界面线程)经 JNI 每帧调用,它直接走客户端单位哈希表main+0x2d603a0,沿+0x158链表、再读+0x38路径。游戏线程同时在加、删单位(走动、换区、开箱)。读到刚释放的单位会读野指针(崩溃),链表正被改写时还可能绕圈(界面线程卡死 → ANR)。现有的小地图数据都不这么做:dm_cam_threats的怪物方位是游戏线程算好、持g_mu发布,界面只拷一份;dm_map_goals用序号锁发布g_mg_pub(w_map_goal_step在游戏线程)。建议照这个模式:在
dm_world.c每帧的游戏线程步骤里收集「没开的容器格坐标」(连同所在关卡),发布成一个小数组;dm_chest_marks只读这份数组,再按当前小地图几何投影。遍历时每个桶也最好加个次数上限。map_mark开关没生效。 说明里写「复用 map_mark 叠加」,但代码没有查dm_custom_get("map_mark")。自定义页里关了小地图标注的玩家照样会看到金点。建议按它(或加一个自己的开关)门控。有三行中文注释是乱码(UTF-8 被当成 Latin-1 再编了一次):
dm_world.c第 732、734 行,CamThreats.java第 119 行。请按 UTF-8 重存这几行。小处:注释「贴玩家 8 格内不画」,代码是
ddx²+ddy² < 4,即 2 格以内;函数后面多了 7 个空行。dm_world.c是共享代码,iOS / 鸿蒙也会编到这个函数(不会调用)。A useful idea. The projection uses the same geometry as the heading arrow, and the container class list is thorough. One thing needs fixing first, plus three small ones:
(needs a change) The game's unit table is walked on the UI thread.
dm_chest_marksis called every frame fromCamThreats.doFrame(Choreographer, the Android UI thread) via JNI. It walks the client unit hashmain+0x2d603a0directly, follows the+0x158list and reads the+0x38path, while the game thread adds and frees units (walking, changing areas, opening chests). A unit freed in between means reading a dangling pointer (crash), and a list being relinked can loop (UI thread stuck → ANR). The existing minimap data never does this:dm_cam_threatsgets monster positions computed on the game thread and published underg_mu; the UI only copies them;dm_map_goalspublishesg_mg_pubwith a sequence lock, andw_map_goal_stepruns on the game thread.Following that pattern: collect the unopened containers' cells (and their level) in
dm_world.c's per-frame game-thread step, publish them as a small array, and havedm_chest_marksonly read that array and project it with the current minimap geometry. A per-bucket iteration cap would also help.The
map_markswitch isn't honoured. The description says it reuses map_mark, but the code never checksdm_custom_get("map_mark"), so players who turned minimap markers off on the Custom page still see the dots. Gate it on that switch, or add one of its own.Three Chinese comment lines are garbled (UTF-8 read as Latin-1 and encoded again):
dm_world.clines 732 and 734, andCamThreats.javaline 119. Please re-save them as UTF-8.Small: the comment says "not drawn within 8 cells of the player", but the code is
ddx²+ddy² < 4, i.e. within 2 cells. There are also 7 blank lines after the function.dm_world.cis shared, so iOS and HarmonyOS compile this function too (they never call it).