anyways , you might want to do something more , harder , cause that might not work , and u did not even shot a grenade at all?
1st , you need to declare that there's a alt shot in g_misc.c
{
WP_BLASTER, //int weaponNum;
0, //int price;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
0, //int slots;
"blaster", //char *weaponName;
"Blaster", //char *weaponHumanName;
0, //int maxAmmo;
0, //int maxClips;
qtrue, //int infiniteAmmo;
qfalse, //int usesEnergy;
BLASTER_REPEAT, //int repeatRate1;
GBLASTER_REPEAT //int repeatRate2; //define alt shot repeat rate
0, //int repeatRate3;
0, //int reloadTime;
BLASTER_K_SCALE, //float knockbackScale;
qtrue, //qboolean hasAltMode; // qtrue if to 2nd shot activated
qfalse, //qboolean hasThirdMode;
qfalse, //qboolean canZoom;
90.0f, //float zoomFov;
qfalse, //qboolean purchasable;
qtrue, //qboolean longRanged;
0, //int buildDelay;
WUT_HUMANS //WUTeam_t team;
},
then , you need to say that the 2nd shot works , which is on g_weapon.c
g_weapon.c
when u came to somewhere around here
/*
======================================================================
BLASTER PISTOL
======================================================================
*/
void blasterFire( gentity_t *ent )
{
gentity_t *m;
m = fire_blaster( ent, muzzle, forward );
// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics
}
add this below blaster
/*
======================================================================
BLASTER GRENADE
======================================================================
*/
void blasterNadeFire( gentity_t *ent )
{
gentity_t *m;
m = fire_blasterNade( ent, muzzle, forward );
// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics
}
after that , search for FireWeapon2 on g_weapon.c
you will be able to see this
/*
===============
FireWeapon2
===============
*/
void FireWeapon2( gentity_t *ent )
{
if( ent->client )
{
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
}
else
{
AngleVectors( ent->s.angles2, forward, right, up );
VectorCopy( ent->s.pos.trBase, muzzle );
}
// fire the specific weapon
switch( ent->s.weapon )
{
case WP_ALEVEL1_UPG:
poisonCloud( ent );
break;
case WP_ALEVEL2_UPG:
areaZapFire( ent );
break;
case WP_LUCIFER_CANNON:
LCChargeFire( ent, qtrue );
break;
case WP_ABUILD:
case WP_ABUILD2:
case WP_HBUILD:
case WP_HBUILD2:
cancelBuildFire( ent );
break;
default:
break;
}
}
then , change it to
/*
===============
FireWeapon2
===============
*/
void FireWeapon2( gentity_t *ent )
{
if( ent->client )
{
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
}
else
{
AngleVectors( ent->s.angles2, forward, right, up );
VectorCopy( ent->s.pos.trBase, muzzle );
}
// fire the specific weapon
switch( ent->s.weapon )
{
case WP_ALEVEL1_UPG:
poisonCloud( ent );
break;
case WP_ALEVEL2_UPG:
areaZapFire( ent );
break;
case WP_LUCIFER_CANNON:
LCChargeFire( ent, qtrue );
break;
case WP_BLASTER:
blasterNadeFire( ent );
break;
case WP_ABUILD:
case WP_ABUILD2:
case WP_HBUILD:
case WP_HBUILD2:
cancelBuildFire( ent );
break;
default:
break;
}
}
then , you need to tell the qvm that there's a project tile for the weapon , as you did not say anything damage on here , you need to put it on
g_missle.c
scroll until you see
/*
=================
launch_grenade
=================
*/
gentity_t *launch_grenade( gentity_t *self, vec3_t start, vec3_t dir )
{
gentity_t *bolt;
VectorNormalize( dir );
bolt = G_Spawn( );
bolt->classname = "grenade";
bolt->nextthink = level.time + 5000;
bolt->think = G_ExplodeMissile;
bolt->s.eType = ET_MISSILE;
bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN;
bolt->s.weapon = WP_GRENADE;
bolt->s.eFlags = EF_BOUNCE_HALF;
bolt->s.generic1 = WPM_PRIMARY; //weaponMode
bolt->r.ownerNum = self->s.number;
bolt->parent = self;
bolt->damage = GRENADE_DAMAGE;
bolt->splashDamage = GRENADE_DAMAGE;
bolt->splashRadius = GRENADE_RANGE;
bolt->methodOfDeath = MOD_GRENADE;
bolt->splashMethodOfDeath = MOD_GRENADE;
bolt->clipmask = MASK_SHOT;
bolt->target_ent = NULL;
bolt->r.mins[ 0 ] = bolt->r.mins[ 1 ] = bolt->r.mins[ 2 ] = -3.0f;
bolt->r.maxs[ 0 ] = bolt->r.maxs[ 1 ] = bolt->r.maxs[ 2 ] = 3.0f;
bolt->s.time = level.time;
bolt->s.pos.trType = TR_GRAVITY;
bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame
VectorCopy( start, bolt->s.pos.trBase );
VectorScale( dir, GRENADE_SPEED, bolt->s.pos.trDelta );
SnapVector( bolt->s.pos.trDelta ); // save net bandwidth
VectorCopy( start, bolt->r.currentOrigin );
return bolt;
}
below this , add
/*
=================
fire_blasterNade
=================
*/
gentity_t *fire_blasterNade( gentity_t *self, vec3_t start, vec3_t dir )
{
gentity_t *bolt;
VectorNormalize( dir );
bolt = G_Spawn( );
bolt->classname = "blasternade";
bolt->nextthink = level.time + 5000;
bolt->think = G_ExplodeMissile;
bolt->s.eType = ET_MISSILE;
bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN;
bolt->s.weapon = WP_BLASTER;
bolt->s.eFlags = EF_BOUNCE_HALF;
bolt->s.generic1 = WPM_SECONDARY; //weaponMode
bolt->r.ownerNum = self->s.number;
bolt->parent = self;
bolt->damage = BGRENADE_DAMAGE;
bolt->splashDamage = BGRENADE_SDAMAGE;
bolt->splashRadius = BGRENADE_RANGE;
bolt->methodOfDeath = MOD_GRENADE;
bolt->splashMethodOfDeath = MOD_GRENADE;
bolt->clipmask = MASK_SHOT;
bolt->target_ent = NULL;
bolt->r.mins[ 0 ] = bolt->r.mins[ 1 ] = bolt->r.mins[ 2 ] = -3.0f;
bolt->r.maxs[ 0 ] = bolt->r.maxs[ 1 ] = bolt->r.maxs[ 2 ] = 3.0f;
bolt->s.time = level.time;
bolt->s.pos.trType = TR_GRAVITY;
bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame
VectorCopy( start, bolt->s.pos.trBase );
VectorScale( dir, GRENADE_SPEED, bolt->s.pos.trDelta );
SnapVector( bolt->s.pos.trDelta ); // save net bandwidth
VectorCopy( start, bolt->r.currentOrigin );
return bolt;
}
then , finally in tremulous.h
add the following below BLASTER_DMG
#define BGRENADE_REPEAT 500
#define BGRENADE_DAMAGE HDM(310)
#define BGRENADE_RANGE 192.0f
#define BGRENADE_SDAMAGE HDM(150)