Jump to content

[FIXED!] +openJK +JA +MP Creating a new weapon.


Recommended Posts

Hello, im creating a new weapon for a mod, but I'm frustrated with one problem I have. I pretend to create a weapon similar to one, and the idea is to switch weapons pressing the key like the explosives. ¿The problem? I don't understand some things of the source code.

This is the code I edited for create the new weapon:

 

[Go to the end for the conclussion]

 

codemp/cgame/cg_event.c

old	new	
...	...	@@ -169,6 +169,7 @@ static void CG_Obituary( entityState_t *ent ) {
169	169	 		case MOD_BOWCASTER:
170	170	 		case MOD_REPEATER:
171	171	 		case MOD_REPEATER_ALT:
	172	+		case MOD_BURST_REPEATER:
172	173	 		case MOD_FLECHETTE:
173	174	 			if ( gender == GENDER_FEMALE )
174	175	 				message = "SUICIDE_SHOT_FEMALE";
...	...	@@ -360,6 +361,9 @@ clientkilled:
360	361	 		case MOD_REPEATER_ALT_SPLASH:
361	362	 			message = "KILLED_REPEATERALT";
362	363	 			break;
	364	+		case MOD_BURST_REPEATER:
	365	+			message = "KILLED_BURST_REPEATER";
	366	+			break;
363	367	 		case MOD_DEMP2:
364	368	 		case MOD_DEMP2_ALT:
365	369	 			message = "KILLED_DEMP2";
...	...	@@ -1092,6 +1096,7 @@ void CG_G2MarkEvent(entityState_t *es)
1092	1096	 	case WP_DISRUPTOR:
1093	1097	 	case WP_BOWCASTER:
1094	1098	 	case WP_REPEATER:
	1099	+	case WP_BURST_REPEATER:
1095	1100	 	case WP_TURRET:
1096	1101	 		if ( !size )
1097	1102	 		{

 

 

codemp/cgame/cg_local.h

old	new	
...	...	@@ -1415,6 +1415,11 @@ typedef struct
1415	1415	 	fxHandle_t  repeaterWallImpactEffect;	
1416	1416	 	fxHandle_t  repeaterFleshImpactEffect;
1417	1417	 	fxHandle_t  repeaterAltWallImpactEffect;
	1418	+	
	1419	+	// BURST REPEATER
	1420	+	fxHandle_t  burstrepeaterProjectileEffect;
	1421	+	fxHandle_t  burstrepeaterWallImpactEffect;	
	1422	+	fxHandle_t  burstrepeaterFleshImpactEffect;
1418	1423	 
1419	1424	 	// DEMP2
1420	1425	 	fxHandle_t  demp2ProjectileEffect;

 

 

codemp/cgame/cg_weaponinit.c

old	new	
...	...	@@ -367,6 +367,36 @@ void CG_RegisterWeapon( int weaponNum) {
367	367	 		//cgs.effects.repeaterAltWallImpactEffect	= trap_FX_RegisterEffect( "repeater/alt_wall_impact" );
368	368	 		cgs.effects.repeaterAltWallImpactEffect	= trap_FX_RegisterEffect( "repeater/concussion" );
369	369	 		break;
	370	+		
	371	+	case WP_BURST_REPEATER:
	372	+		weaponInfo->selectSound			= trap_S_RegisterSound("sound/weapons/burst_repeater/select.wav");
	373	+
	374	+		weaponInfo->flashSound[0]		= trap_S_RegisterSound( "sound/weapons/burst_repeater/fire.wav");
	375	+		weaponInfo->firingSound			= NULL_SOUND;
	376	+		weaponInfo->chargeSound			= NULL_SOUND;
	377	+		weaponInfo->muzzleEffect		= trap_FX_RegisterEffect( "burst_repeater/muzzle_flash" );
	378	+		weaponInfo->missileModel		= NULL_HANDLE;
	379	+		weaponInfo->missileSound		= NULL_SOUND;
	380	+		weaponInfo->missileDlight		= 0;
	381	+//		weaponInfo->missileDlightColor	= {0,0,0};
	382	+		weaponInfo->missileHitSound		= NULL_SOUND;
	383	+		weaponInfo->missileTrailFunc	= FX_BurstRepeaterProjectileThink;
	384	+
	385	+		weaponInfo->altFlashSound[0]	= trap_S_RegisterSound( "sound/weapons/burst_repeater/alt_fire.wav");
	386	+		weaponInfo->altFiringSound		= NULL_SOUND;
	387	+		weaponInfo->altChargeSound		= NULL_SOUND;
	388	+		weaponInfo->altMuzzleEffect		= trap_FX_RegisterEffect( "burst_repeater/muzzle_flash" );
	389	+		weaponInfo->altMissileModel		= NULL_HANDLE;
	390	+		weaponInfo->altMissileSound		= NULL_SOUND;
	391	+		weaponInfo->altMissileDlight	= 0;
	392	+//		weaponInfo->altMissileDlightColor= {0,0,0};
	393	+		weaponInfo->altMissileHitSound	= NULL_SOUND;
	394	+		weaponInfo->altMissileTrailFunc = FX_BurstRepeaterAltProjectileThink;
	395	+
	396	+		cgs.effects.burstrepeaterProjectileEffect	= trap_FX_RegisterEffect( "burst_repeater/projectile" );
	397	+		cgs.effects.burstrepeaterWallImpactEffect	= trap_FX_RegisterEffect( "burst_repeater/wall_impact" );
	398	+		cgs.effects.burstrepeaterFleshImpactEffect	= trap_FX_RegisterEffect( "burst_repeater/flesh_impact" );
	399	+		break;
370	400	 
371	401	 	case WP_DEMP2:
372	402	 		weaponInfo->selectSound			= trap_S_RegisterSound("sound/weapons/demp2/select.wav");

 

 

codemp/cgame/fx_local.h

old	new	
...	...	@@ -46,6 +46,12 @@ void FX_RepeaterAltHitWall( vec3_t origin, vec3_t normal );
46	46	 void FX_RepeaterHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
47	47	 void FX_RepeaterAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
48	48	 
	49	+// Burst Repeater
	50	+void FX_BurstRepeaterProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon );
	51	+void FX_BurstRepeaterAltProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon );
	52	+void FX_BurstRepeaterHitWall( vec3_t origin, vec3_t normal );
	53	+void FX_BurstRepeaterHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );
	54	+
49	55	 // DEMP2
50	56	 void FX_DEMP2_ProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon );
51	57	 void FX_DEMP2_HitWall( vec3_t origin, vec3_t normal );

 

 

codemp/game/bg_misc.c

old	new	
...	...	@@ -240,6 +240,7 @@ int WeaponReadyAnim[WP_NUM_WEAPONS] =
240	240	 	TORSO_WEAPONREADY3,//TORSO_WEAPONREADY4,//WP_DISRUPTOR,
241	241	 	TORSO_WEAPONREADY3,//TORSO_WEAPONREADY5,//WP_BOWCASTER,
242	242	 	TORSO_WEAPONREADY3,//TORSO_WEAPONREADY6,//WP_REPEATER,
	243	+	TORSO_WEAPONREADY3,//TORSO_WEAPONREADY6,//WP_BURST_REPEATER,
243	244	 	TORSO_WEAPONREADY3,//TORSO_WEAPONREADY7,//WP_DEMP2,
244	245	 	TORSO_WEAPONREADY3,//TORSO_WEAPONREADY8,//WP_FLECHETTE,
245	246	 	TORSO_WEAPONREADY3,//TORSO_WEAPONREADY9,//WP_ROCKET_LAUNCHER,
...	...	@@ -266,6 +267,7 @@ int WeaponReadyLegsAnim[WP_NUM_WEAPONS] =
266	267	 	BOTH_STAND1,//TORSO_WEAPONREADY4,//WP_DISRUPTOR,
267	268	 	BOTH_STAND1,//TORSO_WEAPONREADY5,//WP_BOWCASTER,
268	269	 	BOTH_STAND1,//TORSO_WEAPONREADY6,//WP_REPEATER,
	270	+	BOTH_STAND1,//TORSO_WEAPONREADY6,//WP_BURST_REPEATER,
269	271	 	BOTH_STAND1,//TORSO_WEAPONREADY7,//WP_DEMP2,
270	272	 	BOTH_STAND1,//TORSO_WEAPONREADY8,//WP_FLECHETTE,
271	273	 	BOTH_STAND1,//TORSO_WEAPONREADY9,//WP_ROCKET_LAUNCHER,
...	...	@@ -292,6 +294,7 @@ int WeaponAttackAnim[WP_NUM_WEAPONS] =
292	294	 	BOTH_ATTACK3,//BOTH_ATTACK4,//WP_DISRUPTOR,
293	295	 	BOTH_ATTACK3,//BOTH_ATTACK5,//WP_BOWCASTER,
294	296	 	BOTH_ATTACK3,//BOTH_ATTACK6,//WP_REPEATER,
	297	+	BOTH_ATTACK3,//BOTH_ATTACK6,//WP_BURST_REPEATER,
295	298	 	BOTH_ATTACK3,//BOTH_ATTACK7,//WP_DEMP2,
296	299	 	BOTH_ATTACK3,//BOTH_ATTACK8,//WP_FLECHETTE,
297	300	 	BOTH_ATTACK3,//BOTH_ATTACK9,//WP_ROCKET_LAUNCHER,
...	...	@@ -1235,6 +1238,24 @@ Don't place this
1235	1238	 /* sounds */ "",
1236	1239	 		"@MENUS_THIS_DESTRUCTIVE_PROJECTILE"					// description
1237	1240	 	},
	1241	+	
	1242	+	/*QUAKED weapon_burst_repeater (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
	1243	+*/
	1244	+	{
	1245	+		"weapon_burst_repeater", 
	1246	+		"sound/weapons/w_pkup.wav",
	1247	+        { "models/weapons2/burst_repeater/burst_repeater_w.glm", 
	1248	+		0, 0, 0},
	1249	+/* view */		"models/weapons2/burst_repeater/burst_repeater.md3", 
	1250	+/* icon */		"gfx/hud/w_icon_burst_repeater",
	1251	+/* pickup *///	"Imperial Burst Repeater",
	1252	+		100,
	1253	+		IT_WEAPON,
	1254	+		WP_BURST_REPEATER,
	1255	+/* precache */ "",
	1256	+/* sounds */ "",
	1257	+		"@MENUS_THIS_BURSTED_GUN"					// description
	1258	+	},
1238	1259	 
1239	1260	 /*QUAKED weapon_demp2 (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
1240	1261	 NOTENOTE This weapon is not yet complete.  Don't place it.
...	...	@@ -1495,7 +1516,7 @@ Ammo for Tenloss Disruptor, Wookie Bowcaster, and the Destructive Electro Magnet
1495	1516	 	},
1496	1517	 
1497	1518	 /*QUAKED ammo_metallic_bolts (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
1498		-Ammo for Imperial Heavy Repeater and the Golan Arms Flechette
	1519	+Ammo for Imperial Heavy Repeater, Burst Repeater and the Golan Arms Flechette
1499	1520	 */
1500	1521	 	{
1501	1522	 		"ammo_metallic_bolts",

 

 

codemp/game/bg_saga.c

old	new	
...	...	@@ -83,6 +83,7 @@ stringID_table_t WPTable[] =
83	83	 	ENUM2STRING(WP_DISRUPTOR),
84	84	 	ENUM2STRING(WP_BOWCASTER),
85	85	 	ENUM2STRING(WP_REPEATER),
	86	+	ENUM2STRING(WP_BURST_REPEATER),
86	87	 	ENUM2STRING(WP_DEMP2),
87	88	 	ENUM2STRING(WP_FLECHETTE),
88	89	 	ENUM2STRING(WP_ROCKET_LAUNCHER),

 

 

codemp/game/bg_weapons.c

old	new	
...	...	@@ -183,6 +183,23 @@ weaponData_t weaponData[WP_NUM_WEAPONS] =
183	183	 		0,						//	int		maxCharge;			// stop subtracting once charged for this many ms
184	184	 		0						//	int		altMaxCharge;		// above for secondary
185	185	 	},
	186	+	{	// WP_BURST_REPEATER
	187	+//		"Imperial Burst Repeater",//	char	classname[32];		// Spawning name
	188	+		AMMO_METAL_BOLTS,		//	int		ammoIndex;			// Index to proper ammo slot
	189	+		5,						//	int		ammoLow;			// Count when ammo is low
	190	+		1,						//	int		energyPerShot;		// Amount of energy used per shot
	191	+		100,					//	int		fireTime;			// Amount of time between firings
	192	+		8192,					//	int		range;				// Range of weapon
	193	+		3,						//	int		altEnergyPerShot;	// Amount of energy used for alt-fire
	194	+		300,					//	int		altFireTime;		// Amount of time between alt-firings
	195	+		8192,					//	int		altRange;			// Range of alt-fire
	196	+		0,						//	int		chargeSubTime;		// ms interval for subtracting ammo during charge
	197	+		0,						//	int		altChargeSubTime;	// above for secondary
	198	+		0,						//	int		chargeSub;			// amount to subtract during charge on each interval
	199	+		0,						//int		altChargeSub;		// above for secondary
	200	+		0,						//	int		maxCharge;			// stop subtracting once charged for this many ms
	201	+		0						//	int		altMaxCharge;		// above for secondary
	202	+	},
186	203	 	{	// WP_DEMP2
187	204	 //		"DEMP2",				//	char	classname[32];		// Spawning name
188	205	 		AMMO_POWERCELL,			//	int		ammoIndex;			// Index to proper ammo slot

 

 

codemp/game/bg_weapons.h

old	new	
...	...	@@ -15,6 +15,7 @@ typedef enum {
15	15	 	WP_DISRUPTOR,
16	16	 	WP_BOWCASTER,
17	17	 	WP_REPEATER,
	18	+	WP_BURST_REPEATER,
18	19	 	WP_DEMP2,
19	20	 	WP_FLECHETTE,
20	21	 	WP_ROCKET_LAUNCHER,

 

 

codemp/game/g_weapon.c

old	new	
...	...	@@ -61,6 +61,14 @@ static vec3_t muzzle;
61	61	 #define REPEATER_ALT_SPLASH_RAD_SIEGE	80
62	62	 #define	REPEATER_ALT_VELOCITY			1100
63	63	 
	64	+// Light Repeater // Burst Repeater
	65	+//----------
	66	+#define BURST_REPEATER_SPREAD				0.8f    // This is more accurately than the heavy version
	67	+#define	BURST_REPEATER_DAMAGE				14
	68	+#define	BURST_REPEATER_VELOCITY			1600
	69	+
	70	+#define BURST_REPEATER_ALT_SHOTS			3
	71	+
64	72	 // DEMP2
65	73	 //----------
66	74	 #define	DEMP2_DAMAGE				35
...	...	@@ -1184,6 +1192,117 @@ static void WP_FireRepeater( gentity_t *ent, qboolean altFire )
1184	1192	 }
1185	1193	 
1186	1194	 
 
+
+/*
+======================================================================
+
+BURST REPEATER
+
+======================================================================
+*/
+
+//---------------------------------------------------------
+static void WP_BurstRepeaterMainFire( gentity_t *ent, vec3_t dir )
+//---------------------------------------------------------
+{
+	int	damage	= BURST_REPEATER_DAMAGE;
+
+	gentity_t *missile = CreateMissile( muzzle, dir, BURST_REPEATER_VELOCITY, 10000, ent, qfalse );
+
+	missile->classname = "burst_proj";
+	missile->s.weapon = WP_BURST_REPEATER;
+
+	missile->damage = damage;
+	missile->dflags = DAMAGE_DEATH_KNOCKBACK;
+	missile->methodOfDeath = MOD_BURST_REPEATER;
+	missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER;
+
+	// we don't want it to bounce forever
+	missile->bounceCount = 8;
+}
+
+//---------------------------------------------------------
+static void WP_BurstRepeaterAltFire( gentity_t *ent )
+//---------------------------------------------------------
	1227	+{
	1228	+	vec3_t		fwd, angs;
	1229	+	gentity_t	*missile;
	1230	+	int i;
	1231	+
	1232	+	for (i = 0; i < BURST_REPEATER_ALT_SHOTS; i++ )
	1233	+	{
	1234	+		vectoangles( forward, angs );
	1235	+
	1236	+		/*if (i != 0)
	1237	+		{ //do nothing on the first shot, it will hit the crosshairs
	1238	+			angs[PITCH] += crandom() * BURST_REPEATER_SPREAD;
	1239	+			angs[YAW]	+= crandom() * BURST_REPEATER_SPREAD;
	1240	+		}*/
	1241	+		
	1242	+		if (i == 1)
	1243	+		{
	1244	+			angs[PITCH] += 2;
	1245	+			angs[YAW]	+= 1;
	1246	+		}
	1247	+		
	1248	+		if (i == 2)
	1249	+		{
	1250	+			angs[PITCH] += 2;
	1251	+			angs[YAW]	+= -1;
	1252	+		}
	1253	+		
	1254	+		if (i == 3)
	1255	+		{
	1256	+			angs[PITCH] += -1;
	1257	+			angs[YAW]	+= 0;
	1258	+		}
	1259	+
	1260	+		AngleVectors( angs, fwd, NULL, NULL );
	1261	+
	1262	+		missile = CreateMissile( muzzle, fwd, BURST_REPEATER_VELOCITY, 10000, ent, qfalse);
	1263	+
	1264	+		missile->classname = "tri_proj";
	1265	+		missile->s.weapon = WP_BURST_REPEATER;
	1266	+
	1267	+		VectorSet( missile->r.maxs, FLECHETTE_SIZE, FLECHETTE_SIZE, FLECHETTE_SIZE );
	1268	+		VectorScale( missile->r.maxs, -1, missile->r.mins );
	1269	+
	1270	+		missile->damage = BURST_REPEATER_DAMAGE;
	1271	+		missile->dflags = DAMAGE_DEATH_KNOCKBACK;
	1272	+		missile->methodOfDeath = MOD_BURST_REPEATER;
	1273	+		missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER;
	1274	+
	1275	+		// we don't want it to bounce forever
	1276	+		missile->bounceCount = 8;
	1277	+	}
	1278	+}
	1279	+
	1280	+//---------------------------------------------------------
	1281	+static void WP_BurstFireRepeater( gentity_t *ent, qboolean altFire )
	1282	+//---------------------------------------------------------
	1283	+{
	1284	+	vec3_t	dir, angs;
	1285	+
	1286	+	vectoangles( forward, angs );
	1287	+
	1288	+	if ( altFire )
	1289	+	{
	1290	+		WP_BurstRepeaterAltFire( ent );
	1291	+	}
	1292	+	else
	1293	+	{
	1294	+		// add some slop to the alt-fire direction
	1295	+		angs[PITCH] += crandom() * BURST_REPEATER_SPREAD;
	1296	+		angs[YAW]	+= crandom() * BURST_REPEATER_SPREAD;
	1297	+
	1298	+		AngleVectors( angs, dir, NULL, NULL );
	1299	+
	1300	+		WP_BurstRepeaterMainFire( ent, dir );
	1301	+	}
	1302	+}
	1303	+
	1304	+
	1305	+
1187	1306	 /*
1188	1307	 ======================================================================
1189	1308	 
...	...	@@ -4585,6 +4704,10 @@ void FireWeapon( gentity_t *ent, qboolean altFire ) {
4585	4704	 		case WP_REPEATER:
4586	4705	 			WP_FireRepeater( ent, altFire );
4587	4706	 			break;
	4707	+			
	4708	+		case WP_BURST_REPEATER:
	4709	+			WP_BurstFireRepeater( ent, altFire );
	4710	+			break;
4588	4711	 
4589	4712	 		case WP_DEMP2:
4590	4713	 			WP_FireDEMP2( ent, altFire );

 

 

codemp/qcommon/q_shared.h

old	new	
...	...	@@ -2130,7 +2130,7 @@ typedef enum {
2130	2130	 #define	MAX_STATS				16
2131	2131	 #define	MAX_PERSISTANT			16
2132	2132	 #define	MAX_POWERUPS			16
2133		-#define	MAX_WEAPONS				19		
	2133	+#define	MAX_WEAPONS				32		// original 19
2134	2134	 
2135	2135	 #define	MAX_PS_EVENTS			2
2136	2136	 

 

 

codemp/cgame/fx_burstrepeater.c

old	new	
...	...	@@ -0,0 +1,61 @@
	1	+// Burst Repeater
	2	+
	3	+#include "cg_local.h"
	4	+
	5	+/*
	6	+-------------------------
	7	+FX_BurstRepeaterProjectileThink
	8	+-------------------------
	9	+*/
	10	+
	11	+void FX_BurstRepeaterProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon )
	12	+{
	13	+	vec3_t forward;
	14	+
	15	+	if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )
	16	+	{
	17	+		forward[2] = 1.0f;
	18	+	}
	19	+
	20	+	trap_FX_PlayEffectID( cgs.effects.burstrepeaterProjectileEffect, cent->lerpOrigin, forward, -1, -1 );
	21	+}
	22	+
	23	+/*
	24	+-------------------------
	25	+FX_BurstRepeaterAltProjectileThink
	26	+-------------------------
	27	+*/
	28	+void FX_BurstRepeaterAltProjectileThink( centity_t *cent, const struct weaponInfo_s *weapon )
	29	+{
	30	+	vec3_t forward;
	31	+
	32	+	if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )
	33	+	{
	34	+		forward[2] = 1.0f;
	35	+	}
	36	+
	37	+	trap_FX_PlayEffectID( cgs.effects.burstrepeaterProjectileEffect, cent->lerpOrigin, forward, -1, -1 );
	38	+}
	39	+
	40	+/*
	41	+------------------------
	42	+FX_BurstRepeaterHitWall
	43	+------------------------
	44	+*/
	45	+
	46	+void FX_BurstRepeaterHitWall( vec3_t origin, vec3_t normal )
	47	+{
	48	+	trap_FX_PlayEffectID( cgs.effects.burstrepeaterWallImpactEffect, origin, normal, -1, -1 );
	49	+}
	50	+
	51	+/*
	52	+------------------------
	53	+FX_BurstRepeaterHitPlayer
	54	+------------------------
	55	+*/
	56	+
	57	+void FX_BurstRepeaterHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )
	58	+{
	59	+	trap_FX_PlayEffectID( cgs.effects.burstrepeaterFleshImpactEffect, origin, normal, -1, -1 );
	60	+}
	61	+

 

 

codemp/cgame/cg_weapons.c  This is the file i need to edit i think.

old	new	
...	...	@@ -1562,6 +1562,25 @@ void CG_Weapon_f( void ) {
1562	1562	 		return;
1563	1563	 	}
1564	1564	 
	1565	+	// Fix for the new weapons
	1566	+	if (num == WP_REPEATER)
	1567	+	{/*
	1568	+		if (current_weapon == WP_BURST_REPEATER)
	1569	+		{
	1570	+			select(WP_REPEATER);
	1571	+		}
	1572	+		else
	1573	+		{
	1574	+			select(WP_BURST_REPEATER);
	1575	+		}
	1576	+	 */ //// I don't know how to do this
	1577	+	}
	1578	+
	1579	+	if (num >= WP_BURST_REPEATER)
	1580	+	{
	1581	+		num += 1; // Add one per new weapon
	1582	+	}
	1583	+	
1565	1584	 	if (num >= WP_THERMAL && num <= WP_DET_PACK)
1566	1585	 	{
1567	1586	 		int weap, i = 0;
...	...	@@ -1884,6 +1903,10 @@ void CG_FireWeapon( centity_t *cent, qboolean altFire ) {
1884	1903	 			{
1885	1904	 				CGCam_Shake(flrand(2, 3), 350);
1886	1905	 			}
	1906	+			else if (ent->weapon == WP_BURST_REPEATER)
	1907	+			{
	1908	+				CGCam_Shake(flrand(2, 3), 350);
	1909	+			}
1887	1910	 			else if (ent->weapon == WP_FLECHETTE)
1888	1911	 			{
1889	1912	 				if (altFire)
...	...	@@ -2034,6 +2057,10 @@ void CG_MissileHitWall(int weapon, int clientNum, vec3_t origin, vec3_t dir, imp
2034	2057	 			FX_RepeaterHitWall( origin, dir );
2035	2058	 		}
2036	2059	 		break;
	2060	+		
	2061	+	case WP_BURST_REPEATER:
	2062	+		FX_BurstRepeaterHitWall( origin, dir );
	2063	+		break;
2037	2064	 
2038	2065	 	case WP_DEMP2:
2039	2066	 		if (altFire)
...	...	@@ -2154,6 +2181,10 @@ void CG_MissileHitPlayer(int weapon, vec3_t origin, vec3_t dir, int entityNum, q
2154	2181	 			FX_RepeaterHitPlayer( origin, dir, humanoid );
2155	2182	 		}
2156	2183	 		break;
	2184	+		
	2185	+	case WP_BURST_REPEATER:
	2186	+		FX_BurstRepeaterHitPlayer( origin, dir, humanoid );
	2187	+		break;
2157	2188	 
2158	2189	 	case WP_DEMP2:
2159	2190	 		// Do a full body effect here for some more feedback

 

 

codemp/game/bg_public.h

old	new	
...	...	@@ -1058,6 +1058,7 @@ typedef enum {
1058	1058	 	MOD_REPEATER,
1059	1059	 	MOD_REPEATER_ALT,
1060	1060	 	MOD_REPEATER_ALT_SPLASH,
	1061	+	MOD_BURST_REPEATER,
1061	1062	 	MOD_DEMP2,
1062	1063	 	MOD_DEMP2_ALT,
1063	1064	 	MOD_FLECHETTE,

 

 

codemp/game/g_combat.c

old	new	
...	...	@@ -767,6 +767,7 @@ char	*modNames[MOD_MAX] = {
767	767	 	"MOD_REPEATER",
768	768	 	"MOD_REPEATER_ALT",
769	769	 	"MOD_REPEATER_ALT_SPLASH",
	770	+	"MOD_BURST_REPEATER",
770	771	 	"MOD_DEMP2",
771	772	 	"MOD_DEMP2_ALT",
772	773	 	"MOD_FLECHETTE",

 

 

codemp/game/g_combat.c

old	new	
...	...	@@ -767,6 +767,7 @@ char	*modNames[MOD_MAX] = {
767	767	 	"MOD_REPEATER",
768	768	 	"MOD_REPEATER_ALT",
769	769	 	"MOD_REPEATER_ALT_SPLASH",
	770	+	"MOD_BURST_REPEATER",
770	771	 	"MOD_DEMP2",
771	772	 	"MOD_DEMP2_ALT",
772	773	 	"MOD_FLECHETTE",

 

 

codemp/game/g_log.c

old	new	
...	...	@@ -46,6 +46,7 @@ int weaponFromMOD[MOD_MAX] =
46	46	 	WP_REPEATER,			//MOD_REPEATER,
47	47	 	WP_REPEATER,			//MOD_REPEATER_ALT,
48	48	 	WP_REPEATER,			//MOD_REPEATER_ALT_SPLASH,
	49	+	WP_BURST_REPEATER,		//MOD_BURST_REPEATER,
49	50	 	WP_DEMP2,				//MOD_DEMP2,
50	51	 	WP_DEMP2,				//MOD_DEMP2_ALT,
51	52	 	WP_FLECHETTE,			//MOD_FLECHETTE,

 

 

code/game/g_itemLoad.cpp

old	new	
...	...	@@ -121,6 +121,8 @@ static void IT_Name(const char **holdBuf)
121	121	 		itemNum = ITM_BOWCASTER_PICKUP;
122	122	 	else if (!Q_stricmp(tokenStr,"ITM_REPEATER_PICKUP"))	
123	123	 		itemNum = ITM_REPEATER_PICKUP;
	124	+	else if (!Q_stricmp(tokenStr,"ITM_BURST_REPEATER_PICKUP"))	
	125	+		itemNum = ITM_BURST_REPEATER_PICKUP;
124	126	 	else if (!Q_stricmp(tokenStr,"ITM_DEMP2_PICKUP"))	
125	127	 		itemNum = ITM_DEMP2_PICKUP;
126	128	 	else if (!Q_stricmp(tokenStr,"ITM_FLECHETTE_PICKUP"))	

 

 

code/game/g_items.h

old	new	
...	...	@@ -32,6 +32,7 @@ ITM_BLASTER_PICKUP,
32	32	 ITM_DISRUPTOR_PICKUP,
33	33	 ITM_BOWCASTER_PICKUP,
34	34	 ITM_REPEATER_PICKUP,
	35	+ITM_BURST_REPEATER_PICKUP,
35	36	 ITM_DEMP2_PICKUP,
36	37	 ITM_FLECHETTE_PICKUP,
37	38	 ITM_CONCUSSION_RIFLE_PICKUP,

 

100%
100%

 

Ok, back to the red one file: "codemp/cgame/cg_weapons.c"

 

At "CG_Weapon_f" i added this:

 

        // Fix for the new weapons
	if (num == WP_REPEATER)
	{/*
		if (current_weapon == WP_BURST_REPEATER)
		{
			select(WP_REPEATER);
		}
		else
		{
			select(WP_BURST_REPEATER);
		}
	 */ //// I don't know how to do this
	}

	if (num >= WP_BURST_REPEATER)
	{
		num += 1; // Add one per new weapon
	}

 

I think, the code I need must be something like this:

 

IF (press 6 key)

  IF (current weapon IS burst repeater)

    THEN --> change to repeater

  ELSE --> change to burst repeater

  ENDIF

ENDIF

 

But I don't have any idea to how to do this.

Link to comment
        int 	ufix; // Ugle Fix
..
..
..
        // Fix for the new weapons. If anybody has a better idea, I will accept.
	if (num == WP_REPEATER)
	{
		if(cg.weaponSelect == WP_BURST_REPEATER)
		{
			num = WP_REPEATER;
			ufix = 0;
		}
		else
		{
			num = WP_BURST_REPEATER;
			ufix = 1;
		}
	}
	if (num >= WP_BURST_REPEATER)
	{
		if (ufix == 1)
		{
			// Do nothing
		}
		else
		{
			num += 1; // Add one per new weapon
		}
	}

 

I fixed this using this code, THANKS @@Scooper, really.

Link to comment
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...