Closed PseudoProxen closed 11 years ago
It does work, just the bit offset dosn't work oddly. So basically the line readbit (m_object, 0x208, 7) should work as if crouch button is true or false, but instead the bit offset of 7 isn't registered in the readbit function probably. So it then registers as readbit (m_object, 0x208) making it true false for melee button.
Hmmm, weird. Can you send me the output of this:
hprintf("208 " .. readbyte(m_object + 0x208)) local b = readbit(m_object + 0x208, 7) if (b) then hprintf("1") writebit(m_object + 0x208, 7, 0) else hprintf("0") writebit(m_object + 0x208, 7, 1) end b = readbit(m_object + 0x208, 7) if (b) then hprintf("1") else hprintf("0") end hprintf("209 " .. readbyte(m_object + 0x209))
Don't Crouch This 208 0 0 1 209 0
Do Crouch This 208 1 0 1 209 0
Looks like it works fine to me.
weird then, wonder whats causing this variable to not work properly on my end. Going to debunk this, thanks for the help
I'm pretty sure you're using the wrong offset. Take a look at this (I think you want bit 0):
struct // 0x208
{
// these are action flags, basically client button presses
// these don't actually control whether or not an event occurs
bool crouching : 1; // 0
bool jumping : 1; // 1
UNKNOWN_BITFIELD(2);
bool flashlight : 1; // 4
UNKNOWN_BITFIELD(1);
bool actionPress : 1; // 6 think this is just when they initially press the action button
bool melee : 1; // 7
UNKNOWN_BITFIELD(2);
bool reload : 1; // 10
bool primaryWeaponFire : 1; // 11 right mouse
bool secondaryWeaponFire : 1; // 12 left mouse
bool secondaryWeaponFire1 : 1; // 13
bool actionHold : 1; // 14 holding action button
UNKNOWN_BITFIELD(1);
} actionFlags;
interesting, was going off of wizards offset list.
obj_melee_key = readbit(m_object, 0x208, 0) -- Confirmed. 1 when someone melees, 0 when they aren't
obj_action_key = readbit(m_object, 0x208, 1) -- Confirmed. 1 when someone presses the action key, 0 when not.
--obj_client_action_bit3 = readbit(m_object, 0x208, 2) -- (???)
obj_flashlight2 = readbit(m_object, 0x208, 3) -- Confirmed. 1 when flashlight key pressed, 0 when not.
--obj_client_action_bit5 = readbit(m_object, 0x208, 4) -- (???)
--obj_client_action_bit6 = readbit(m_object, 0x208, 5) -- (???)
obj_jump_key = readbit(m_object, 0x208, 6) -- Confirmed. 1 when pressing jump key, 0 when not.
obj_crouch_key_press_hold = readbit(m_object, 0x208, 7) -- Confirmed. 1 when holding crouch, 0 when not.
so from the looks of it, its all backwards lul
Do you know if they worked with the old Phasor?
yeah they worked with the older phasor
You sure? The code is pretty much the same.
pretty sure, even aelites/wizards functions for crouch and jump used it
JumpFunction - http://pastebin.com/Bd7E0zdc CrouchFunction - http://pastebin.com/3ZPXVNeU
Ah yeah, apparently I reversed it. The old behaviour had bit 0 as the most significant (right most) bit, whereas now it has bit 0 as the least significant (left most) bit, the new behaviour makes a lot more sense because you don't need to know the size of the flags to access anything. I don't know why i decided to use the msb in the old build, whoops.
To convert old bit offsets just do 7 - old
. Sorry.
This isn't really a bug, and I think the new implementation is better (should work with map editing programs) so I'll keep it. It's definitely changed behaviour though, so I'll close + mark it as such.
Yeah I ran into an issue trying to get the boolean flag for crouching to work via bit offset with readbit.
readbit(m_object, 0x208, 7)
but always registers as the melee key
readbit(m_object, 0x208, 0)
Possible prob with readbit?