Older systems: iOS 18+ / macOS 15+ via the older-API build; floating left stick; runeword required level; Mac keyboard, mouse and docs; clearer older-device dialog
This commit is contained in:
+26
-5
@@ -161,17 +161,38 @@ void dm_touch_host_game_start(uint64_t now) {
|
||||
|
||||
void dm_touch_host_step(uint64_t now, uint64_t *buttons, int32_t *lx, int32_t *ly, int32_t *rx, int32_t *ry) {
|
||||
if (!g_touch.ready) touch_init(now);
|
||||
if (g_live_on) { // Mac 键盘的回车与 Esc(front_mac.m 用两个游戏不认的高位送来):按下那一刻按当前页定成哪个手柄键,按住期间不变 | Return and Esc on a Mac keyboard (sent by front_mac.m as two high bits the game does not recognise): decided as a gamepad key by the current page at the moment of pressing, unchanged while held
|
||||
static uint64_t ent, esc; int dm_padmode_legend_has(uint32_t glyph), dm_game_paused(void), dm_uiscreen_ingame(void); uint64_t kb = *buttons; *buttons &= ~((1ull << 40) | (1ull << 41));
|
||||
// 回车:缺省 = 确认(A)——提示条写的是手柄字母,拿键盘的人按回车是想确认;当前页的提示条里有「+」这一条时 = +(起名页的「创建」等;主菜单除外,见 dm_padmode_legend_has)
|
||||
// 起名页另有一条:名字还没填时回车 = 输入名称(A),填过之后才是接受(+)——「回车弹框 → 打字 → 回车 → 回车创建」
|
||||
// Return: default = confirm (A) - the hint bar shows gamepad letters, and someone with a keyboard presses Return to confirm; when the current page's hint bar has a "+" entry = + ("Create" on the naming page and so on; except the main menu, see dm_padmode_legend_has)
|
||||
// The naming page has one more rule: before a name is filled in Return = Enter Name (A), and only afterwards is it Accept (+) - "Return opens the dialog -> type -> Return -> Return creates"
|
||||
if (!(kb & (1ull << 40))) ent = 0; else if (!ent) { int dm_ui_fe_name_wants_input(void); ent = !dm_ui_fe_name_wants_input() && dm_padmode_legend_has(0xe005) ? DM_BTN_PLUS : DM_BTN_A; }
|
||||
// Esc:返回(B);局内没有面板开着、游戏也没停着时 = 开功能页(+)——那时 B 是一格技能
|
||||
// Esc: back (B); with no panel open in game and the game not stopped = open the function page (+) - B is a skill slot then
|
||||
if (!(kb & (1ull << 41))) esc = 0; else if (!esc) esc = dm_uiscreen_ingame() && !g_touch.state.navigation_mode && !dm_game_paused() ? DM_BTN_PLUS : DM_BTN_B;
|
||||
*buttons |= ent | esc; }
|
||||
if (g_live_on) { // 真鼠标:前端页直通界面点击;局内并进事件表(拍 = 此刻),与脚本事件同一段处理 | Real mouse: on front-end pages it goes straight to a UI click; in game it joins the event table (tick = now) and is handled in the same pass as script events
|
||||
int dm_uiscreen_ingame(void); int in = dm_uiscreen_ingame(); static float px, py; unsigned h;
|
||||
if (in && !g_live_based) { g_live_based = 1; g_live_tick0 = touch_cur_tick(); if (!g_touch.based) { g_touch.started = 1; g_touch.based = 1; g_touch.loaded = 1; g_touch.tick_set = 1; g_touch.start_tick = g_live_tick0; g_touch.to_game_tick = g_live_tick0; } }
|
||||
if (!in) g_live_based = 0;
|
||||
while ((h = atomic_load(&g_live.head)) != atomic_load(&g_live.tail)) {
|
||||
int op = g_live.q[h % 64].op; float nx = g_live.q[h % 64].nx, ny = g_live.q[h % 64].ny; if (op != 2) { px = nx; py = ny; }
|
||||
// 按在按键提示条的某一条上:这一下不当点击,改成按那个键 4 拍(dm_padmode.c);吞到抬起为止
|
||||
// Pressed on an entry of the key-hint bar: this is not treated as a click but as pressing that key for 4 ticks (dm_padmode.c); swallowed until release
|
||||
{ uint64_t dm_padmode_legend_click(float, float); static int eat; uint64_t lb = op == 0 ? dm_padmode_legend_click(px, py) : 0;
|
||||
if (lb) { eat = 1; g_live_btn = lb; g_live_btn_until = touch_cur_tick() + 4; }
|
||||
if (eat) { if (op == 2) eat = 0; atomic_store(&g_live.head, h + 1); continue; } }
|
||||
// 按在按键提示条的某一条上:这一下不当点击,改成按那个键 4 拍(dm_padmode.c);按在局内底部 HUD 的技能格 / 腰带格 / 钮上:按住期间按着对应的键,抬起再放(至少 3 拍);
|
||||
// HUD 上没有对应键的东西(血球、魔球、经验条):吃掉。都吞到抬起为止
|
||||
// Pressed on an entry of the key-hint bar: this is not treated as a click but as pressing that key for 4 ticks (dm_padmode.c); pressed on a skill slot / belt cell / button of the in-game bottom HUD: the corresponding key is held while the mouse is down and released on mouse up (at least 3 ticks);
|
||||
// things on the HUD with no corresponding key (life orb, mana orb, experience bar): swallowed. All are swallowed until release
|
||||
{ uint64_t dm_padmode_legend_click(float, float); int dm_padmode_hud_click(float, float, uint64_t *); static int eat, hold; uint64_t lb = op == 0 ? dm_padmode_legend_click(px, py) : 0, hb = 0; int hk = op == 0 && !lb && in && !g_touch.state.navigation_mode ? dm_padmode_hud_click(px, py, &hb) : 0; /* 有面板开着:不认 HUD(面板底下那排 HUD 还画着) | a panel is open: the HUD is not recognised (the HUD row under the panel is still drawn) */
|
||||
if (lb) { eat = 1; hold = 0; g_live_btn = lb; g_live_btn_until = touch_cur_tick() + 4; }
|
||||
else if (hk == 1) { eat = 1; hold = 1; g_live_btn = hb; g_live_btn_until = touch_cur_tick() + 30 * 600; }
|
||||
else if (hk == 2) { eat = 1; hold = 0; }
|
||||
// 右上角小地图(同 iOS 壳):点它顶上区域名那一条(矩形高的 1/4)= 切到全屏地图;全屏地图开着时点 HUD 以外的任何地方 = 回到小地图。只在没有面板开着时认
|
||||
// Top-right minimap (same as the iOS shell): clicking the area-name strip at its top (1/4 of the rectangle's height) = switch to the full-screen map; with the full-screen map open, clicking anywhere outside the HUD = back to the minimap. Recognised only when no panel is open
|
||||
else if (op == 0 && in && !g_touch.state.navigation_mode) { int dm_ui_minimap_rect(float r[4]), dm_ui_map_is_full(void); void dm_ui_map_full(int on); float mr[4];
|
||||
if (dm_ui_map_is_full()) { dm_ui_map_full(0); eat = 1; hold = 0; fprintf(stderr, "[dm] 鼠标:全屏地图开着,点一下 → 回到小地图\n"); }
|
||||
else if (dm_ui_minimap_rect(mr)) { float band = (mr[3] - mr[1]) / 4; if (band < 0.042f) band = 0.042f; if (band > (mr[3] - mr[1]) * 0.4f) band = (mr[3] - mr[1]) * 0.4f;
|
||||
if (px >= mr[0] && px <= mr[2] && py >= mr[1] && py <= mr[1] + band) { dm_ui_map_full(1); eat = 1; hold = 0; fprintf(stderr, "[dm] 鼠标:点在小地图顶上那一条 → 切到全屏地图\n"); } } }
|
||||
if (eat) { if (op == 2) { eat = 0; if (hold) { hold = 0; g_live_btn_until = touch_cur_tick() + 3; } } atomic_store(&g_live.head, h + 1); continue; } }
|
||||
if (!in) { // 前端页:抬起时先问一次命中——落在页签上就走「点页签 = 按对应的手柄键」(页签不认鼠标点击;局内由手势层做同一件事),其余照旧发鼠标点击 | front-end pages: on release, hit-test once first - landing on a tab goes through "clicking a tab = pressing the corresponding gamepad key" (tabs do not take mouse clicks; in game the gesture layer does the same), everything else sends a mouse click as before
|
||||
if (op == 2 && dm_ui_item_at_now(px, py) == 2) { dm_ui_touch(3, px, py); dm_ui_tab_go(); } else dm_ui_touch(op, px, py);
|
||||
atomic_store(&g_live.head, h + 1); continue; }
|
||||
|
||||
Reference in New Issue
Block a user