Raised This Month: $153 Target: $400
 38% 

How is the value of m_fFlags calculated?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bigbalaboom
Junior Member
Join Date: Aug 2013
Old 09-06-2013 , 12:34   How is the value of m_fFlags calculated?
Reply With Quote #1

I'v been searching this for hours but there are only some references.

PHP Code:
#define IN_ATTACK     (1 << 0)
#define IN_JUMP       (1 << 1)
#define IN_DUCK       (1 << 2)
#define IN_FORWARD    (1 << 3)
#define IN_BACK       (1 << 4)
#define IN_USE        (1 << 5)
#define IN_CANCEL     (1 << 6)
...
#define FL_ONGROUND   (1 << 0) on the ground
#define FL_DUCKING    (1 << 1) fully crouched
#define FL_WATERJUMP  (1 << 2) jumping out of water
#define FL_ONTRAIN    (1 << 3) _controlling_ a train
#define FL_INRAIN     (1 << 4) standing in rain
#define FL_FROZEN     (1 << 5) frozen
#define FL_ATCONTROLS (1 << 6) can't move
#define FL_CLIENT     (1 << 7) player
#define FL_FAKECLIENT (1 << 8) fake client
... 
PHP Code:
SetEntProp(clientProp_Send"m_fFlags"8); 
How is the 8 calculated according to the flags table? Can I directly use FL_*** instead of a calculated number?

Could someone please give me some examples on how to set/remove certain flags? Thanks!
bigbalaboom is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 09-06-2013 , 12:51   Re: How is the value of m_fFlags calculated?
Reply With Quote #2

http://web2.0calc.com/ - Punch in (1 << 0) and you'll receive 1, (1 << 1) to receive 2, (1 << 2) to receive 4, (1 << 3) to receive 8, etc. So 8 == FL_ONTRAIN. You can use 8, (1 << 3), or FL_ONTRAIN, they all mean the same.

PHP Code:
new iFlags GetEntProp(clientProp_Send"m_fFlags");
iFlags &= ~FL_ONTRAIN//Remove flag
if(iFlags FL_DUCKING//possess flag
  
iFlags |= FL_ONGROUND//Add Flag.
SetEntProp(clientProp_Sendm_fFlagsiFlags); 
__________________

Last edited by thetwistedpanda; 09-06-2013 at 19:05.
thetwistedpanda is offline
bigbalaboom
Junior Member
Join Date: Aug 2013
Old 09-06-2013 , 13:18   Re: How is the value of m_fFlags calculated?
Reply With Quote #3

ahaa...big thanks thetwistedpanda

That calculator is good, and your simple explanation and example are really helpful.
bigbalaboom is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-06-2013 , 15:56   Re: How is the value of m_fFlags calculated?
Reply With Quote #4

I'm hoping that SourceMod does some twiddling for these values, because the versions in entity_prop_stocks.inc match the single player values in Source SDK 2013's const.h and not the multiplayer values, which have FL_ANIMDUCKING between FL_DUCKING and FL_WATERJUMP:

Code:
#define FL_ANIMDUCKING            (1<<2)    // Player flag -- Player is in the process of crouching or uncrouching but could be in transition
// examples:                                   Fully ducked:  FL_DUCKING &  FL_ANIMDUCKING
//           Previously fully ducked, unducking in progress:  FL_DUCKING & !FL_ANIMDUCKING
//                                           Fully unducked: !FL_DUCKING & !FL_ANIMDUCKING
//           Previously fully unducked, ducking in progress: !FL_DUCKING &  FL_ANIMDUCKING
Given that this file is essentially from the source code used by HL2:DM, DoD:S, CS:S, and TF2...
__________________
Am I back? Well, we'll see.

Last edited by Powerlord; 09-06-2013 at 16:06.
Powerlord is offline
psychonic

BAFFLED
Join Date: May 2008
Old 09-06-2013 , 19:04   Re: How is the value of m_fFlags calculated?
Reply With Quote #5

Quote:
Originally Posted by Powerlord View Post
I'm hoping that SourceMod does some twiddling for these values,
It does. GetEntityFlags was changed from a stock to a native many versions ago and handles different internal flag values per game.
psychonic is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:35.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode