Create an account


Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I use the newer 48 slot weapon system?

#1
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".
Reply

#2
"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
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
  Custom Weapon Balance - Live on /v/ server Antares* 30 3,884 09-30-2016, 11:52 AM
Last Post: Antares*
Rainbow curvegun (custom weapon) dingus 8 2,134 08-03-2016, 02:35 PM
Last Post: dingus
  Spawn system Mirio 57 11,919 05-28-2016, 03:49 AM
Last Post: Smilecythe
  Weapon models WIP help. Beagle 1 1,440 05-17-2015, 06:52 PM
Last Post: Beagle
  Weapon and Lightning Gun Testing Mario 18 7,149 11-11-2014, 08:02 PM
Last Post: Lee_Stricklin
  weapon with different effects according to team soukaina 23 9,579 06-06-2013, 01:20 PM
Last Post: Mr. Bougo
Information Spawn Weapon Concept: "Blaster" Samual 85 44,875 03-27-2013, 01:18 PM
Last Post: Samual
Lightbulb Easy to configure *map* balance system Samual 8 6,048 11-17-2012, 04:14 AM
Last Post: Mr. Bougo
  Weapon Settings Question? kidx 22 7,104 08-30-2012, 08:04 PM
Last Post: Mr. Bougo
Question Supressing available weapon errors... cl_weaponsystem.qc confusion twistedlincoln 4 2,860 07-01-2012, 12:38 PM
Last Post: twistedlincoln

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-