New Keys - Which Bits

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Post Reply
Posts: 20
Joined: 2004-10-19, 10:06

New Keys - Which Bits

Post by TheMatrix » 2004-10-20, 11:06

I want to define more keys
I know there are defined in PlayerCommands.hpp, but which Keys are which Bits
Could anyone help me
User avatar
Posts: 195
Joined: 2004-08-28, 06:00
Location: Minesota, USofA

Post by Shadow » 2004-10-20, 13:36

would love to help but i havent toyed with this. its very possible that the scancodes are the same as other languages. i acutally think that this is the case but im not sure
Posts: 20
Joined: 2004-10-19, 10:06

Post by TheMatrix » 2004-10-22, 11:21

Does nobody know ??
User avatar
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany

Re: New Keys - Which Bits

Post by Carsten » 2004-10-22, 12:21

TheMatrix wrote:I want to define more keys
That, unfortunately, is not quite that easy in the current release of Ca3DE.
Below I provide you the list of bindings of "real keys" to the bits defined in PlayerCommand.hpp. This list however, can currently not be changed.

For writing new code for changing this list, I'd first like to understand how Q3, D3, etc. handle their key binding. As fas as I can say now, in the .cfg files, they bind keys to console commands. That is, after e.g.
bind "a" "_moveleft"
pressing "a" causes the _moveleft console function to be called, probably with an argument indicating wether the button went up (released) or down (pressed). The console functions then assemble the bitfield that is required for network transmission.
(Does entering "_moveleft 1" into the console start the player to move left? I'll try later...)

Thus, completing a custom keybinding ideally requires a console var/func system to be implemented (at least when implemented as outlined above). Completing a cvar system for Ca3DE is one of the things I'm currently working on, so I hope that we'll get a solution for this soon enough.
I know there are defined in PlayerCommands.hpp, but which Keys are which Bits

Code: Select all

PCK_MoveForward =0x00000001;    // UP arrow or W.
PCK_MoveBackward=0x00000002;    // DOWN arrow or S.
PCK_TurnLeft    =0x00000004;    // LEFT arrow.
PCK_TurnRight   =0x00000008;    // RIGHT arrow.
PCK_StrafeLeft  =0x00000010;    // A or ,
PCK_StrafeRight =0x00000020;    // D or .
PCK_LookUp      =0x00000040;    // Page Down.
PCK_LookDown    =0x00000080;    // Page Up.
PCK_CenterView  =0x00000100;    // End.
PCK_Jump        =0x00000200;    // SPACE.
PCK_Duck        =0x00000400;    // (unused / not bound)
PCK_Walk        =0x00000800;    // Left or right SHIFT.
PCK_Fire1       =0x00001000;    // Mouse button 0 or R.
PCK_Fire2       =0x00002000;    // Mouse buttons 1 or 2.
PCK_Use         =0x00004000;    // RETURN or ENTER.
The keys 0, 1, ... 9 (both on keyboard as well as num-pad) are stored nummerically in the top four bits, where the 1 key maps to 0x10000000, the 9 key maps to 0x90000000, and the 0 key maps to 0xA0000000. (That is, only one of them can be pressed at a time.)

Sorry for the limitations that Ca3DE currently has. Hope this helps anyway.
Best regards,
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests