aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


commit 0deb33f40e4a41ebb5b90a1ec11ba7869e75c103
parent b68b3939304f7b69c31ef21726c6f2c983e2c21a
Author: anon <anon@example.com>
Date:   Sun,  8 Nov 2026 17:09:49 +0000

Release active camera dragging regardless of held modifiers

Diffstat:
MTODO.md | 6++++++
Mclient/game/ccr.dll/lifted-0000.c | 6++++++
Mclient/tests/native_input.c | 28++++++++++++++++++++++++++++
Mserver/e2e_api.go | 2+-
Mtests/e2e/cursor.test.mjs | 38++++++++++++++++++++++++++++++++++++++
5 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/TODO.md b/TODO.md @@ -453,6 +453,12 @@ rewriting this document does not close them. clicks, right-button camera control, resize/Retina scaling, inventory dragging and touch. Dragged-item icons use a separate native renderer and remain frame-bound. + November 8: fixed Shift-right-drag leaving the pointer hidden and causing + rapid spinning when the right button is released first. Active camera release + now ignores modifier bits. Both release orders restore the browser pointer; + later mouse motion leaves camera, character and server facing unchanged. + Native modifier/binding regressions and all three Chromium cursor scenarios + pass, including ordinary dragging and mobile touch transfers. - [x] **Use external assets by default; make single-executable bundling opt-in.** The assets directory currently occupies about 1.2 GB and is unconditionally embedded into the server/test build. Default development builds should read diff --git a/client/game/ccr.dll/lifted-0000.c b/client/game/ccr.dll/lifted-0000.c @@ -20105,6 +20105,12 @@ void sub_27003930(void) { RECOMP_REGS_LOCALS RECOMP_ENTER(0x27003930u); + /* End an active camera drag through the plain RightRelease binding even + * when Shift/Control/Alt is held. Other modified clicks keep their bindings. */ + if ((MEM32(esp + 4) & 0xffffu) == 8 && + (MEM8(ecx + 0x25) || MEM8(ecx + 0x64))) + MEM32(esp + 4) &= ~0x000e0000u; + L_27003930: PUSH32(esp, ebp); /* 0x27003930: push ebp */ ebp = esp; /* 0x27003931: mov ebp, esp */ diff --git a/client/tests/native_input.c b/client/tests/native_input.c @@ -180,6 +180,32 @@ static void later_empty_click_is_visible_to_earlier_click_commands(void) assert(command_references[2] == 0 && command_references[3] == 0); } +static void camera_release_ignores_held_modifiers(void) +{ + for (unsigned modifiers = 0; modifiers < 8; ++modifiers) { + initialize_input(); + MEM8(0x50000064) = 1; /* MouseLookMode in the persistent mode array. */ + queue_input(8 | (modifiers << 17), 100); + + process_frame(); + + assert(command_count == 1); + assert(command_references[0] == 100); + } +} + +static void modified_release_outside_camera_keeps_its_binding(void) +{ + initialize_input(); + MEM32(0x50000548) = 0x20008; /* Shift + RightRelease. */ + queue_input(0x20008, 100); + + process_frame(); + + assert(command_count == 1); + assert(command_references[0] == 100); +} + int main(void) { assert(guest_map("native input fixture", 0x50000000, 0x10000)); @@ -190,5 +216,7 @@ int main(void) clicks_in_separate_frames_use_their_own_hotspots(); clicks_in_one_frame_use_the_final_hotspot(); later_empty_click_is_visible_to_earlier_click_commands(); + camera_release_ignores_held_modifiers(); + modified_release_outside_camera_keeps_its_binding(); puts("native input: event coordinates, two-pass frame dispatch and shared hotspot references passed"); } diff --git a/server/e2e_api.go b/server/e2e_api.go @@ -82,7 +82,7 @@ func (server *server) e2eOwnedPlayer(w http.ResponseWriter, r *http.Request, id lower, _ := player.experienceBounds() w.Header().Set("Content-Type", "application/json") result := map[string]any{"id": player.id, "name": player.name, - "playfield": player.playfield, "position": player.position, "sitting": player.sitting, + "playfield": player.playfield, "position": player.position, "rotation": player.rotation, "sitting": player.sitting, "level": player.level, "experience": lower + player.experience, "ip": player.stats.ImprovementPoints, "credits": player.inventory.Credits, "health": player.health, "maximumHealth": player.maximumHealth(), diff --git a/tests/e2e/cursor.test.mjs b/tests/e2e/cursor.test.mjs @@ -5,6 +5,44 @@ import {buildServer, withFixture} from './fixture.mjs'; before(buildServer); +test('Shift right-drag releases camera control in either release order', {timeout: 120_000}, async () => { + await withFixture('cursor-shift', async fixture => { + const context = await fixture.visitor(); + await fixture.setup(context, 'position', {playfield: 705, position: [960, 16.5, 510], rotation: [0, 0, 0, 1]}); + const game = await fixture.game(context); + const page = game.page; + if (!game.state.camera.firstPerson) await game.key('F8'); + + for (const shiftFirst of [true, false]) { + await page.mouse.move(500, 300); + await page.keyboard.down('Shift'); + await page.mouse.down({button: 'right'}); + await game.wait('camera control active', state => !state.cursor.visible); + await page.mouse.move(560, 350, {steps: 8}); + await game.snapshot(); + if (shiftFirst) await page.keyboard.up('Shift'); + await page.mouse.up({button: 'right'}); + if (!shiftFirst) await page.keyboard.up('Shift'); + + await game.wait('pointer restored after Shift right-drag', state => state.cursor.visible); + const rotation = game.local().rotation; + const angles = game.state.camera.angles; + // Movement packets quantize quaternion components to 1/16384. + await game.waitFor('server facing after camera release', async () => + (await fixture.state(context)).rotation.every((value, index) => Math.abs(value - rotation[index]) < 0.0001)); + const serverRotation = (await fixture.state(context)).rotation; + await page.mouse.move(400, 250, {steps: 8}); + await game.snapshot(); + assert.deepEqual(game.local().rotation, rotation); + assert.deepEqual(game.state.camera.angles, angles); + assert.deepEqual((await fixture.state(context)).rotation, serverRotation); + assert.equal(game.state.cursor.visible, true); + assert.notEqual(await page.locator('canvas').evaluate(canvas => getComputedStyle(canvas).cursor), 'none'); + } + assert.deepEqual(game.errors, []); + }); +}); + test('browser cursor preserves native shapes, camera controls and item dragging', {timeout: 180_000}, async () => { await withFixture('cursor', async fixture => { const context = await fixture.browser.newContext({viewport: {width: 1024, height: 768}, deviceScaleFactor: 2});