Bits: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
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
Fox (talk | contribs)
No edit summary
 
Line 2: Line 2:


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


'''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:
'''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:
Line 26: Line 28:
  endswitch
  endswitch


'''Bit values for standard keys:'''
== Flags ==
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.


{{Bits}}


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

Latest revision as of 16:44, 20 February 2020

'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.

Weapons

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

Flags

The following values are used with bits.

WARNING: All weapon bits operate on non-power-of-two!

Exposed Value Label Description
No 1 INPUT_JUMP
No 2 INPUT_CROUCH
No 4 INPUT_FIRE
No 8 INPUT_AIM_UP
No 16 INPUT_AIM_DOWN
No 32 INPUT_RUNNING
No 64 INPUT_LOOK_LEFT
No 128 INPUT_LOOK_RIGHT
No 256 INPUT_WEAPON_1
No 512 INPUT_WEAPON_2
No 768 INPUT_WEAPON_3 NPOT
No 1024 INPUT_WEAPON_4
No 1280 INPUT_WEAPON_5 NPOT
No 1536 INPUT_WEAPON_6 NPOT
No 1792 INPUT_WEAPON_7 NPOT
No 2048 INPUT_WEAPON_8
No 2304 INPUT_WEAPON_9 NPOT
No 2560 INPUT_WEAPON_10 NPOT
No 2816 INPUT_WEAPON_PREV NPOT
No 3072 INPUT_WEAPON_NEXT NPOT
No 3328 INPUT_ALT_WEAPON Note: NPOT. Not defined as a macro in the source.
No 3584 INPUT_LAST_WEAPON Note: NPOT. Not defined as a macro in the source.
No 4096 INPUT_STEROIDS
No 8192 INPUT_LOOK_UP
No 16384 INPUT_LOOK_DOWN
No 32768 INPUT_NIGHTVISION
No 65536 INPUT_MEDKIT
No 131072 INPUT_RESERVED
No 262144 INPUT_CENTER_VIEW
No 524288 INPUT_HOLSTER_WEAPON
No 1048576 INPUT_INVENTORY_LEFT
No 2097152 INPUT_PAUSE
No 4194304 INPUT_QUICK_KICK
No 8388608 INPUT_AIM_MODE
No 16777216 INPUT_HOLODUKE
No 33554432 INPUT_JETPACK
No 67108864 INPUT_QUIT
No 134217728 INPUT_INVENTORY_RIGHT
No 268435456 INPUT_TURN_AROUND
No 536870912 INPUT_OPEN
No 1073741824 INPUT_INVENTORY
No 2147483648 INPUT_ESC


Defines
define INPUT_JUMP                       0x00000001
define INPUT_CROUCH                     0x00000002
define INPUT_FIRE                       0x00000004
define INPUT_AIM_UP                     0x00000008
define INPUT_AIM_DOWN                   0x00000010
define INPUT_RUNNING                    0x00000020
define INPUT_LOOK_LEFT                  0x00000040
define INPUT_LOOK_RIGHT                 0x00000080
define INPUT_WEAPON_1                   0x00000100
define INPUT_WEAPON_2                   0x00000200
define INPUT_WEAPON_3                   0x00000300
define INPUT_WEAPON_4                   0x00000400
define INPUT_WEAPON_5                   0x00000500
define INPUT_WEAPON_6                   0x00000600
define INPUT_WEAPON_7                   0x00000700
define INPUT_WEAPON_8                   0x00000800
define INPUT_WEAPON_9                   0x00000900
define INPUT_WEAPON_10                  0x00000A00
define INPUT_WEAPON_PREV                0x00000B00
define INPUT_WEAPON_NEXT                0x00000C00
define INPUT_ALT_WEAPON                 0x00000D00
define INPUT_LAST_WEAPON                0x00000E00
define INPUT_STEROIDS                   0x00001000
define INPUT_LOOK_UP                    0x00002000
define INPUT_LOOK_DOWN                  0x00004000
define INPUT_NIGHTVISION                0x00008000
define INPUT_MEDKIT                     0x00010000
define INPUT_RESERVED                   0x00020000
define INPUT_CENTER_VIEW                0x00040000
define INPUT_HOLSTER_WEAPON             0x00080000
define INPUT_INVENTORY_LEFT             0x00100000
define INPUT_PAUSE                      0x00200000
define INPUT_QUICK_KICK                 0x00400000
define INPUT_AIM_MODE                   0x00800000
define INPUT_HOLODUKE                   0x01000000
define INPUT_JETPACK                    0x02000000
define INPUT_QUIT                       0x04000000
define INPUT_INVENTORY_RIGHT            0x08000000
define INPUT_TURN_AROUND                0x10000000
define INPUT_OPEN                       0x20000000
define INPUT_INVENTORY                  0x40000000
define INPUT_ESC                        0x80000000