[Scummvm-devel] AGI keyboard input problems
Max Horn
max at quendi.de
Mon Dec 24 00:29:15 CET 2007
Am 24.12.2007 um 00:04 schrieb David Symonds:
> On Dec 24, 2007 2:26 AM, Max Horn <max at quendi.de> wrote:
>> Hi folks,
>>
>> 2) As you can tell by the FIXME comments in agi.cpp, line 222 and
>> following, things are still not quite clear. In particular, I wonder
>> why we check the key*code* instead of the key ascii value. I propose
>> that we insert the following line in line 222 (i.e. just after
>> "default:"):
>> key = event.kbd.ascii;
>> Does this look OK to the AGI experts? Could somebody test with that
>> line, and see whether it causes regressions? If not, just commit
>> it...
>
> I would guess that it would break some rather obscure things.
I can't believe that, or at least I can't believe it would break
harder than it already does. We *do* perform some remapping from
"ScummVM keycodes" to "AGI keycodes" already. Right now the code
roughly looks like this.
if key == known special key
convert keycode
else if key is ascii or ctrl-ascii
convert keycode
else
pass ScummVM keycode and prey that by chance it is identical to
AGI keycode
That doesn't seem like a particular good algorithm ;). My point here
is that the last "else" branch, the "we got a key code that we have
no idea of how we should deal with", should be modified. Namely, by
either ignoring that key, or at least trying to pass it's ASCII value
or so to the core. Possibly after having passed it through a lookup
table.
> The AGI
> event handling is all done with key codes (since that's what's used in
> the bytecode), both for the top menus, as well as other random places
> (PQ1 is a notable user). I don't think the original games would have
> supported AZERTY keyboards; perhaps it would be cleaner to just have a
> higher-level mapping of its keycodes to the equivalent pc101 keycodes.
Fine by me. As long as it is documented and complies to *some* kind
of logic, instead of being semi-random as the current code.
Note that there already is a scancode table in place, it seems, at
least for Alt-ASCII key combinations.
Bye,
Max
More information about the Scummvm-devel
mailing list