Bits: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
LordMisfit (talk | contribs)
m Sorry if this is clutter, but I figure I should log this info until it's confirmed this is meant to be the case or a proper input bit check for "Alternate Weapon" is added instead. :V
Line 67: Line 67:
  define INPUT_INVENTORY        1073741824
  define INPUT_INVENTORY        1073741824
  define INPUT_ESC              2147483648
  define INPUT_ESC              2147483648
Currently the input to detect "INPUT_ALTWEAPON" from r6594 is to add "3328" to the current bitvalue, but it is not appearantly defined officially as the bitfield for holding the key.




[[Category:Bitfields]]
[[Category:Bitfields]]
[[Category:Input structure members]]
[[Category:Input structure members]]

Revision as of 19:15, 19 February 2019

'bits' is a bitfield indicating which buttons the player is pressing. A particular button press can be checked by using ifvarand with the values listed at the end of this article.

INPUT_RESERVED will only display "!!! INCORRECT VERSION !!!" message.

This technique does not work properly with the weapon selection keys, however. They share four bits in the second-to-lowest byte, which represent the number of the corresponding weapon. They can be decoded as follows:

getinput[THISACTOR].bits temp
shiftvarr temp 8
andvar temp 0xF
switch temp
    case 1
        //"1" pressed
        break
    case 2
        //"2" pressed
        break
    //etc.
    case 10
        //"0" pressed
        break
    case 11
        //previous weapon
        break
    case 12
        //next weapon
        break
endswitch

Bit values for standard keys:

define INPUT_JUMP                      1
define INPUT_CROUCH                    2
define INPUT_FIRE                      4
define INPUT_AIM_UP                    8
define INPUT_AIM_DOWN                 16
define INPUT_RUNNING                  32
define INPUT_LOOK_LEFT                64
define INPUT_LOOK_RIGHT              128
define INPUT_WEAPON_1                256
define INPUT_WEAPON_2                512
define INPUT_WEAPON_3                768
define INPUT_WEAPON_4               1024
define INPUT_WEAPON_5               1280
define INPUT_WEAPON_6               1536
define INPUT_WEAPON_7               1792
define INPUT_WEAPON_8               2048
define INPUT_WEAPON_9               2304
define INPUT_WEAPON_10              2560
define INPUT_WEAPON_PREV            2816
define INPUT_WEAPON_NEXT            3072
define INPUT_STEROIDS               4096
define INPUT_LOOK_UP                8192
define INPUT_LOOK_DOWN             16384
define INPUT_NIGHTVISION           32768
define INPUT_MEDKIT                65536
define INPUT_RESERVED             131072
define INPUT_CENTER_VIEW          262144
define INPUT_HOLSTER_WEAPON       524288
define INPUT_INVENTORY_LEFT      1048576
define INPUT_PAUSE               2097152
define INPUT_QUICK_KICK          4194304
define INPUT_AIM_MODE            8388608
define INPUT_HOLODUKE           16777216
define INPUT_JETPACK            33554432
define INPUT_QUIT               67108864
define INPUT_INVENTORY_RIGHT   134217728
define INPUT_TURN_AROUND       268435456
define INPUT_OPEN              536870912
define INPUT_INVENTORY        1073741824
define INPUT_ESC              2147483648
Currently the input to detect "INPUT_ALTWEAPON" from r6594 is to add "3328" to the current bitvalue, but it is not appearantly defined officially as the bitfield for holding the key.