Xonotic is a free, open source (GPL) ultra-fast, first-person shooter


Follow Xonotic on

Post Reply 
How do I use the newer 48 slot weapon system?
04-19-2012, 06:26 PM
Post: #1
How do I use the newer 48 slot weapon system?
qcsrc / common / items.qh

http://git.xonotic.org/?p=xonotic/xonoti...5a;hb=HEAD

I enabled the idef'd code here:
Code:
121 #else

122 # define WEP_MAXCOUNT 48

123 # define WEP_FIRST2 25

124 .float _WS1_weapons;

125 .float _WS2_weapons;

126 # define WEPSET_BIT1(a)                 (((a) < WEP_FIRST2) ? power2of((a) - WEP_FIRST) : 0)

127 # define WEPSET_BIT2(a)                 (((a) >= WEP_FIRST2) ? power2of((a) - WEP_FIRST2) : 0)

128 # define WEPSET_DECLARE_A(a)            float _WS1_##a, _WS2_##a

129 # define WEPSET_CLEAR_E(e)              ((e)._WS1_weapons = (e)._WS2_weapons = 0)

130 # define WEPSET_CLEAR_A(a)              ((_WS1_##a) = (_WS2_##a) = 0)

131 # define WEPSET_EMPTY_E(e)              ((e)._WS1_weapons == 0 && (e)._WS2_weapons == 0)

132 # define WEPSET_EMPTY_A(a)              ((_WS1_##a) == 0 && (_WS2_##a) == 0)

133 # define WEPSET_COPY_AS(a)              ((_WS1_##a) = getstati(STAT_WEAPONS), (_WS2_##a) = getstati(STAT_WEAPONS2))

134 # define WEPSET_ADDSTAT()               addstat(STAT_WEAPONS, AS_INT, _WS1_weapons); addstat(STAT_WEAPONS2, AS_INT, _WS2_weapons)

135 # define WEPSET_OP1_EE(a,b,mergeop,x)   (((a)._WS1_weapons x (b)._WS1_weapons) mergeop ((a)._WS2_weapons x (b)._WS2_weapons))

136 # define WEPSET_OP2_EE(a,b,mergeop,x,y) (((a)._WS1_weapons x (b)._WS1_weapons y (a)._WS1_weapons) mergeop ((a)._WS2_weapons x (b)._WS2_weapons y (a)._WS2_weapons))

137 # define WEPSET_OP1_EA(a,b,mergeop,x)   (((a)._WS1_weapons x _WS1_##b) mergeop ((a)._WS2_weapons x _WS2_##b))

138 # define WEPSET_OP2_EA(a,b,mergeop,x,y) (((a)._WS1_weapons x _WS1_##b y (a)._WS1_weapons) mergeop ((a)._WS2_weapons x _WS2_##b y (a)._WS2_weapons))

139 # define WEPSET_OP1_EW(a,b,mergeop,x)   (((a)._WS1_weapons x WEPSET_BIT1(b)) mergeop ((a)._WS2_weapons x WEPSET_BIT2(b)))

140 # define WEPSET_OP2_EW(a,b,mergeop,x,y) (((a)._WS1_weapons x WEPSET_BIT1(b) y (a)._WS1_weapons) mergeop ((a)._WS2_weapons x WEPSET_BIT2(b) y (a)._WS2_weapons))

141 # define WEPSET_OP1_AE(a,b,mergeop,x)   ((_WS1_##a x (b)._WS1_weapons) mergeop (_WS2_##a x (b)._WS2_weapons))

142 # define WEPSET_OP2_AE(a,b,mergeop,x,y) ((_WS1_##a x (b)._WS1_weapons y _WS1_##a) mergeop (_WS2_##a x (b)._WS2_weapons y _WS2_##a))

143 # define WEPSET_OP1_AA(a,b,mergeop,x)   ((_WS1_##a x _WS1_##b) mergeop (_WS2_##a x _WS2_##b))

144 # define WEPSET_OP2_AA(a,b,mergeop,x,y) ((_WS1_##a x _WS1_##b y _WS1_##a) mergeop (_WS2_##a x _WS2_##b y _WS2_##a))

145 # define WEPSET_OP1_AW(a,b,mergeop,x)   ((_WS1_##a x WEPSET_BIT1(b)) mergeop (_WS2_##a x WEPSET_BIT2(b)))

146 # define WEPSET_OP2_AW(a,b,mergeop,x,y) ((_WS1_##a x WEPSET_BIT1(b) y _WS1_##a) mergeop (_WS2_##a x WEPSET_BIT2(b) y _WS2_##a))

147 #endif

And defined STAT_WEAPONS2 as some number (is this correct?) in qcsrc / common / constants.qh
http://git.xonotic.org/?p=xonotic/xonoti...4d;hb=HEAD

Compiled fine. Runs fine, untill I add the 25th weapon to compile in, or so.
Then I get a crash in the quakeC. So it seems, I guess, I have to add a macro to the 25th and above weapons I guess. What would that be?

Please don't ask why. Trying to test this if you need an answer to "why would you want to add more weapons".
Find all posts by this user
Quote this message in a reply
04-20-2012, 01:28 AM
Post: #2
RE: How do I use the newer 48 slot weapon system?
"a crash", that's not very specific. Care to give more details about the crash? In case of a segfault, do you know how to do a gdb backtrace?

[Image:http://i.imgur.com/4XODR.png]640K ought to be enough for anybody.
     ― Linux Torvalds
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  weapon with different effects according to team soukaina 23 2,299 06-06-2013 01:20 PM
Last Post: Mr. Bougo
Information Spawn Weapon Concept: "Blaster" Samual 85 12,749 03-27-2013 01:18 PM
Last Post: Samual
Lightbulb Easy to configure *map* balance system Samual 8 2,564 11-17-2012 04:14 AM
Last Post: Mr. Bougo
  Weapon Settings Question? kidx 22 1,496 08-30-2012 08:04 PM
Last Post: Mr. Bougo
Question Supressing available weapon errors... cl_weaponsystem.qc confusion twistedlincoln 4 818 07-01-2012 12:38 PM
Last Post: twistedlincoln
  Reconfiguring Spawn weapon (laser) hutty 7 1,079 05-26-2012 09:51 AM
Last Post: Samual
  Fixing spammy weapon combos FruitieX 15 2,271 05-21-2012 07:38 AM
Last Post: FruitieX
  Bone based damage system (feature vote and debate) MirceaKitsune 42 5,209 05-17-2012 01:29 AM
Last Post: CuBe0wL
  A Garry's Mod / sandbox system MirceaKitsune 19 7,081 11-24-2011 04:59 PM
Last Post: Ihsan
  Weapon displays that show ammo MirceaKitsune 13 2,774 11-22-2011 06:46 AM
Last Post: Halogene

Forum Jump: