diff options
-rw-r--r-- | src/cgame/cg_event.c | 11 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 1 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 44 | ||||
-rw-r--r-- | src/game/bg_misc.c | 5 | ||||
-rw-r--r-- | src/game/bg_public.h | 2 | ||||
-rw-r--r-- | src/game/g_weapon.c | 93 |
6 files changed, 152 insertions, 4 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 72e8ab21..7ea62220 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -978,6 +978,17 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qtrue, es->eventParm ); break; + case EV_LAS_HIT_WALL: + DEBUGNAME("EV_LAS_HIT_WALL"); + ByteToDir( es->eventParm, dir ); + CG_LasGunHit( es->pos.trBase, es->otherEntityNum, dir, qfalse, ENTITYNUM_WORLD ); + break; + + case EV_LAS_HIT_FLESH: + DEBUGNAME("EV_LAS_HIT_FLESH"); + CG_LasGunHit( es->pos.trBase, es->otherEntityNum, dir, qtrue, es->eventParm ); + break; + #define MASS_EJECTION_VEL 300 case EV_MASS_DRIVER_HIT: DEBUGNAME("EV_MASS_DRIVER_HIT"); diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index ff6e4aa2..dc9af0e9 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1453,6 +1453,7 @@ void CG_Explosion( int clientNum, vec3_t origin, vec3_t dir ); void CG_MissileHitPlayer( int weapon, vec3_t origin, vec3_t dir, int entityNum, int damage ); void CG_ShotgunFire( entityState_t *es ); void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum ); +void CG_LasGunHit( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum ); void CG_RailTrail( vec3_t start, vec3_t end ); void CG_TeslaTrail( vec3_t start, vec3_t end ); diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 4d66f626..7245a870 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -727,6 +727,12 @@ void CG_RegisterWeapon( int weaponNum ) cgs.media.railRingsShader = trap_R_RegisterShader( "railDisc" ); break; + case WP_LAS_GUN: + MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 ); + weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/plasma/hyprbf1a.wav", qfalse ); + cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" ); + break; + case WP_LUCIFER_CANON: weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/bfg/bfg_hum.wav", qfalse ); MAKERGB( weaponInfo->flashDlightColor, 1, 0.7f, 1 ); @@ -741,6 +747,11 @@ void CG_RegisterWeapon( int weaponNum ) weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse ); break; + case WP_PAIN_SAW: + MAKERGB( weaponInfo->flashDlightColor, 0, 0, 0 ); + weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse ); + break; + case WP_GRAB_CLAW: MAKERGB( weaponInfo->flashDlightColor, 0, 0, 0 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse ); @@ -1911,6 +1922,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im break; case WP_MACHINEGUN: case WP_CHAINGUN: + case WP_LAS_GUN: mod = cgs.media.bulletFlashModel; shader = cgs.media.bulletExplosionShader; mark = cgs.media.bulletMarkShader; @@ -2270,6 +2282,37 @@ static qboolean CG_CalcMuzzlePoint( int entityNum, vec3_t muzzle ) { /* ====================== +CG_LasGunHit + +Renders las gun effects. +====================== +*/ +void CG_LasGunHit( vec3_t end, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum ) +{ + trace_t trace; + vec3_t start; + + // if the shooter is currently valid, calc a source point and possibly + // do trail effects + if( sourceEntityNum >= 0 && cg_tracerChance.value > 0 ) + { + if( CG_CalcMuzzlePoint( sourceEntityNum, start ) ) + { + // draw a tracer + if( random() < cg_tracerChance.value ) + CG_Tracer( start, end ); + } + } + + // impact splash and mark + if( flesh ) + CG_Bleed( end, fleshEntityNum ); + else + CG_MissileHitWall( WP_LAS_GUN, 0, end, normal, IMPACTSOUND_DEFAULT, 0 ); +} + +/* +====================== CG_Bullet Renders bullet effects. @@ -2315,5 +2358,4 @@ void CG_Bullet( vec3_t end, int sourceEntityNum, vec3_t normal, qboolean flesh, } else { CG_MissileHitWall( WP_MACHINEGUN, 0, end, normal, IMPACTSOUND_DEFAULT, 0 ); } - } diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 9d4e359d..d7422b09 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -2181,7 +2181,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qtrue, //int infiniteAmmo; qfalse, //int usesEnergy; - 100, //int repeatRate; + 75, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; @@ -3322,6 +3322,9 @@ char *eventnames[] = { "EV_BULLET_HIT_FLESH", "EV_BULLET_HIT_WALL", + "EV_LAS_HIT_FLESH", + "EV_LAS_HIT_WALL", + "EV_MASS_DRIVER_HIT", "EV_MISSILE_HIT", "EV_MISSILE_MISS", diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 77ad6f2b..6f383de1 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -535,6 +535,8 @@ typedef enum { EV_BULLET_HIT_FLESH, EV_BULLET_HIT_WALL, + EV_LAS_HIT_FLESH, + EV_LAS_HIT_WALL, EV_MASS_DRIVER_HIT, EV_MISSILE_HIT, diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 4965fdb0..32db11fc 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -230,6 +230,95 @@ void flamerFire( gentity_t *ent ) /* ====================================================================== +LAS GUN + +====================================================================== +*/ + +/* +=============== +lasGunFire +=============== +*/ +void lasGunFire( gentity_t *ent ) +{ + trace_t tr; + vec3_t end; + gentity_t *tent; + gentity_t *traceEnt; + + VectorMA( muzzle, 8192 * 16, forward, end ); + + trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); + if( tr.surfaceFlags & SURF_NOIMPACT ) + return; + + traceEnt = &g_entities[ tr.entityNum ]; + + // snap the endpos to integers, but nudged towards the line + SnapVectorTowards( tr.endpos, muzzle ); + + // send bullet impact + if( traceEnt->takedamage && traceEnt->client ) + { + tent = G_TempEntity( tr.endpos, EV_LAS_HIT_FLESH ); + tent->s.eventParm = traceEnt->s.number; + } + else + { + tent = G_TempEntity( tr.endpos, EV_LAS_HIT_WALL ); + tent->s.eventParm = DirToByte( tr.plane.normal ); + } + tent->s.otherEntityNum = ent->s.number; + + if( traceEnt->takedamage ) + G_Damage( traceEnt, ent, ent, forward, tr.endpos, 10, 0, MOD_MACHINEGUN ); +} + +/* +====================================================================== + +PAIN SAW + +====================================================================== +*/ + +void painSawFire( gentity_t *ent ) +{ + trace_t tr; + vec3_t end; + gentity_t *tent; + gentity_t *traceEnt; + + // set aiming directions + AngleVectors( ent->client->ps.viewangles, forward, right, up ); + + CalcMuzzlePoint( ent, forward, right, up, muzzle ); + + VectorMA( muzzle, 32, forward, end ); + + trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); + if ( tr.surfaceFlags & SURF_NOIMPACT ) + return; + + traceEnt = &g_entities[ tr.entityNum ]; + + // send blood impact + if ( traceEnt->takedamage && traceEnt->client ) + { + tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT ); + tent->s.otherEntityNum = traceEnt->s.number; + tent->s.eventParm = DirToByte( tr.plane.normal ); + tent->s.weapon = ent->s.weapon; + } + + if ( traceEnt->takedamage ) + G_Damage( traceEnt, ent, ent, forward, tr.endpos, 5, DAMAGE_NO_KNOCKBACK, MOD_VENOM ); +} + +/* +====================================================================== + LUCIFER CANON ====================================================================== @@ -883,10 +972,10 @@ void FireWeapon( gentity_t *ent ) LCChargeFire( ent, qfalse ); break; case WP_LAS_GUN: - massDriverFire( ent ); + lasGunFire( ent ); break; case WP_PAIN_SAW: - gClawFire( ent ); + painSawFire( ent ); break; case WP_ABUILD: buildFire( ent, MN_A_BUILD ); |