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?
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Where are Weapon skins? NoClue 0 1,490 07-07-2022, 01:26 PM
Last Post: NoClue
  Can I adjust the weapon model size and stuff? Molnija 1 2,280 03-13-2019, 12:28 AM
Last Post: BuddyFriendGuy
  A Garry's Mod / sandbox system MirceaKitsune 20 37,849 01-05-2019, 10:52 PM
Last Post: 3agle427
  weapon size Molnija 0 2,153 12-03-2018, 05:22 AM
Last Post: Molnija
  Custom Weapon Balance - Live on /v/ server Antares* 30 19,313 09-30-2016, 11:52 AM
Last Post: Antares*
Rainbow curvegun (custom weapon) dingus 8 8,840 08-03-2016, 02:35 PM
Last Post: dingus
  Spawn system Mirio 57 41,263 05-28-2016, 03:49 AM
Last Post: Smilecythe
  Weapon models WIP help. Beagle 1 3,494 05-17-2015, 06:52 PM
Last Post: Beagle
  Weapon and Lightning Gun Testing Mario 18 16,198 11-11-2014, 08:02 PM
Last Post: Lee_Stricklin
  weapon with different effects according to team soukaina 23 19,106 06-06-2013, 01:20 PM
Last Post: Mr. Bougo

Forum Jump:


Users browsing this thread:
1 Guest(s)

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