lfnetwork.com mark read register faq members calendar

 Thread: How does g_weapondisable work ingame? Thread Tools Display Modes
 11-17-2007, 10:58 PM #1 Lathain Valtiel @Lathain Valtiel Ex-Angel     Join Date: Jul 2002 Posts: 929 How does g_weapondisable work ingame? I know how it is calculated, it's a power of two for each weapon... but how does the game check the result? Keep diving by 2 until there's no more weapons to disable, starting with the highest weapon on the list? Kurgan's Meatgrinder (JA Server: 72.5.248.212:29070) Player tested, Valtiel approved. Valtiel approved downloads for Meatgrinder: http://strategy.jediknight.net/jka/downloads.shtml you may: quote & reply,
 11-18-2007, 12:11 AM #2 Cohsty243 @Cohsty243 Rookie     Join Date: Apr 2007 Posts: 67 if im right lol.. Each weapon has its own bitflag. i think it checks that if the g_weapondisable integer contains a bitflag assigned to a weapon then disable it/cannot be spawned. ensi or razor can probably explain it better lol. you may: quote & reply,
 11-18-2007, 04:12 AM #3 XycaleTh @XycaleTh Rookie     Join Date: Apr 2006 Location: UK Posts: 67 As Cohsty said, the g_weapondisable cvar contains a number which tells the game which weapons to disable. I haven't got JKA code in front of me so the numbers might not be right. If say, g_weapondisable = 24, in binary this is 11000. If the game wanted to check if the saber was enabled (for this example, the bitflag for saber can be 8, or 01000 in binary), you would do: Code: `if ( g_weapondisable.integer & WP_SABER )......` The & is a bitwise AND operator like this: 110000 010000 & 010000 When there are two 1s in the same column, the answer is 1, otherwise its 0. The if statement checks the result in between the brackets if it's true/false. False = 0, true = anything else. Hope that helps, and that you understood it you may: quote & reply,
 11-18-2007, 01:27 PM #4 ensiform @ensiform The Stig     Join Date: Nov 2004 Location: Sawtooth Cauldron Posts: 1,241 Current Game: Borderlands 2 Power of 2 is the correct way, not binary :P. WP_NONE = 0 WP_STUN_BATON = 1 WP_MELEE = 2 WP_SABER = 3 WP_BRYAR_PISTOL = 4 WP_BLASTER = 5 WP_DISRUPTOR = 6 WP_BOWCASTER = 7 WP_REPEATER = 8 WP_DEMP2 = 9 WP_FLECHETTE = 10 WP_ROCKET_LAUNCHER = 11 WP_THERMAL = 12 WP_TRIP_MINE = 13 WP_DET_PACK = 14 WP_CONCUSSION = 15 WP_BRYAR_OLD = 16 WP_EMPLACED_GUN = 17 WP_TURRET = 18 WP_NUM_WEAPONS = 19 2^0 = 1 2^1 = 2 2^2 = 4 2^3 = 8 2^4 = 16 2^5 = 32 2^6 = 64 2^7 = 128 2^8 = 256 2^9 = 512 2^10 = 1024 2^11 = 2048 2^12 = 4096 2^13 = 8192 2^14 = 16384 2^15 = 32768 2^16 = 65536 2^17 = 131072 2^18 = 262144 2^19 = 524288 Also, checking is done by & (1 << WP_) not just & WP_ iojamp project lead / coder you may: quote & reply,
 11-18-2007, 02:19 PM #5 XycaleTh @XycaleTh Rookie     Join Date: Apr 2006 Location: UK Posts: 67 It's pretty much the same thing :P you may: quote & reply,
11-18-2007, 10:28 PM   #6
ensiform
@ensiform
The Stig

Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
Quote:
 Originally Posted by XycaleTh It's pretty much the same thing :P
No its not when the r-value of the & isn't already a 1 <<.

iojamp project lead / coder
you may: quote & reply,
 LucasForums > How does g_weapondisable work ingame?

 Thread Tools Display Modes Linear Mode

 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 Off HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home -------------------- Network     Star Wars Gamer     Knights of the Old Republic     Mixnmojo.com     Monkey Island Discussion     Brutal Legend Discussion     Grim Fandango Discussion     Psychonauts Discussion at Razputin's Domain     Sam And Max.Net     The Dig Museum     Full Throttle Discussion     IndyJones.net     Fracture     Forum Help & Feedback Center     LucasForums Archive         LEGO Star Wars series         Star Wars         Star Wars: Battlefront series         Star Wars: Classic Gaming         Star Wars: Empire At War         Star Wars: The Force Unleashed series         Star Wars: Galaxies         Star Wars: Jedi Knight series         Star Wars: The Old Republic         Star Wars: Republic Commando         Star Wars: Rogue Squadron series         Star Wars: X-Wing series

 Contact Us - LucasForums.com - Archive - Privacy Statement - Top

All times are GMT -4. The time now is 03:49 AM.

Powered by vBulletin®
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.