From 688d528f2860d456248363cb1c041de7dabe1911 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Tue, 25 Sep 2001 22:27:28 +0000 Subject: Added 2 experimental weapons --- src/cgame/cg_draw.c | 4 +- src/cgame/cg_ents.c | 9 ++++ src/cgame/cg_event.c | 35 +++++++++++++- src/cgame/cg_scanner.c | 15 ++++-- src/cgame/cg_view.c | 2 +- src/cgame/cg_weapons.c | 28 +++++++++++- src/game/bg_misc.c | 85 ++++++++++++++++++++++------------ src/game/bg_pmove.c | 14 ++++-- src/game/bg_public.h | 6 ++- src/game/g_active.c | 14 ++++-- src/game/g_local.h | 1 + src/game/g_missile.c | 40 ++++++++++++++++ src/game/g_weapon.c | 122 ++++++++++++++++++++++++++++++++++++------------- 13 files changed, 294 insertions(+), 81 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 647b2fd0..5bbc23ed 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -2310,8 +2310,8 @@ static void CG_Draw2D( void ) { if ( cgs.gametype >= GT_TEAM ) { CG_DrawTeamInfo(); } - if( cg.snap->ps.weapon == WP_SCANNER ) - CG_Scanner(); + if( BG_gotItem( UP_HELMET, cg.snap->ps.stats ) ) + CG_Scanner( ); } CG_DrawVote(); diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index c523378f..6e5fbdcf 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -436,6 +436,15 @@ static void CG_Missile( centity_t *cent ) return; break; + case WP_PULSE_RIFLE: + ent.reType = RT_SPRITE; + ent.radius = 4; + ent.rotation = 0; + ent.customShader = cgs.media.plasmaBallShader; + trap_R_AddRefEntityToScene( &ent ); + return; + break; + case WP_FLAMER: fraction = ( ( cg.time - s1->pos.trTime ) / FIREBALL_LIFETIME ); diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 1d2bf6eb..29b77974 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -464,14 +464,15 @@ also called by CG_CheckPlayerstateEvents ============== */ #define DEBUGNAME(x) if(cg_debugEvents.integer){CG_Printf(x"\n");} -void CG_EntityEvent( centity_t *cent, vec3_t position ) { +void CG_EntityEvent( centity_t *cent, vec3_t position ) +{ entityState_t *es; int event; vec3_t dir; const char *s; int clientNum; clientInfo_t *ci; - int steptime; + int steptime, i; steptime = BG_FindSteptimeForClass( cg.predictedPlayerState.stats[ STAT_PCLASS ] ); @@ -899,6 +900,36 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) { CG_Bullet( 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"); + for( i = 0; i <= 10; i++ ) + { + qhandle_t spark; + vec3_t velocity; + vec3_t accel = { 0.0f, 0.0f, -DEFAULT_GRAVITY }; + vec3_t origin, normal; + + ByteToDir( es->eventParm, normal ); + + VectorMA( es->pos.trBase, 10.0f, normal, origin ); + + if( crandom( ) > 0.5f ) + spark = cgs.media.gibSpark1; + else + spark = cgs.media.gibSpark2; + + velocity[ 0 ] = crandom( ) * MASS_EJECTION_VEL; + velocity[ 1 ] = crandom( ) * MASS_EJECTION_VEL; + velocity[ 2 ] = MASS_EJECTION_VEL + crandom( ) * MASS_EJECTION_VEL; + + CG_LaunchSprite( origin, velocity, accel, 0.6, 4.0f, 2.0f, 255, 0, rand( ) % 360, + cg.time, 5000 + ( crandom( ) * 3000 ), + spark, qfalse, qfalse ); + } + + break; + case EV_SHOTGUN: DEBUGNAME("EV_SHOTGUN"); CG_ShotgunFire( es ); diff --git a/src/cgame/cg_scanner.c b/src/cgame/cg_scanner.c index 75b7eefa..e67bd0b6 100644 --- a/src/cgame/cg_scanner.c +++ b/src/cgame/cg_scanner.c @@ -48,11 +48,18 @@ static void CG_DrawBlips( vec3_t origin, vec4_t colour ) drawOrigin[ 0 ] /= ( 2 * RANGE / WIDTH ); drawOrigin[ 1 ] /= ( 2 * RANGE / HEIGHT ); drawOrigin[ 2 ] /= ( 2 * RANGE / WIDTH ); - + trap_R_SetColor( colour ); - CG_DrawPic( XPOS + ( WIDTH / 2 ) - ( STALKWIDTH / 2 ) - drawOrigin[ 0 ], - YPOS + ( HEIGHT / 2 ) + drawOrigin[ 1 ], - STALKWIDTH, -drawOrigin[ 2 ], cgs.media.scannerLineShader ); + + if( drawOrigin[ 2 ] > 0 ) + CG_DrawPic( XPOS + ( WIDTH / 2 ) - ( STALKWIDTH / 2 ) - drawOrigin[ 0 ], + YPOS + ( HEIGHT / 2 ) + drawOrigin[ 1 ] - drawOrigin[ 2 ], + STALKWIDTH, drawOrigin[ 2 ], cgs.media.scannerLineShader ); + else + CG_DrawPic( XPOS + ( WIDTH / 2 ) - ( STALKWIDTH / 2 ) - drawOrigin[ 0 ], + YPOS + ( HEIGHT / 2 ) + drawOrigin[ 1 ], + STALKWIDTH, -drawOrigin[ 2 ], cgs.media.scannerLineShader ); + CG_DrawPic( XPOS + ( WIDTH / 2 ) - ( BLIPX / 2 ) - drawOrigin[ 0 ], YPOS + ( HEIGHT / 2 ) - ( BLIPY / 2 ) + drawOrigin[ 1 ] - drawOrigin[ 2 ], BLIPX, BLIPY, cgs.media.scannerBlipShader ); diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index b70fc0e8..36dccc49 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -1148,7 +1148,7 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo memcpy( cg.refdef.areamask, cg.snap->areamask, sizeof( cg.refdef.areamask ) ); // warning sounds when powerup is wearing off - CG_PowerupTimerSounds(); + /*CG_PowerupTimerSounds();*/ // update audio positions trap_S_Respatialize( cg.snap->ps.clientNum, cg.refdef.vieworg, cg.refdef.viewaxis, inwater ); diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 50a97655..fc425d7f 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -662,6 +662,14 @@ void CG_RegisterWeapon( int weaponNum ) { cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" ); break; + case WP_MASS_DRIVER: + MAKERGB( weaponInfo->flashDlightColor, 0, 0, 1 ); + weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf1b.wav", qfalse ); + weaponInfo->flashSound[1] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf2b.wav", qfalse ); + weaponInfo->flashSound[2] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf3b.wav", qfalse ); + weaponInfo->flashSound[3] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf4b.wav", qfalse ); + break; + case WP_CHAINGUN: MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/machinegun/machgf1b.wav", qfalse ); @@ -730,6 +738,14 @@ void CG_RegisterWeapon( int weaponNum ) { cgs.media.railRingsShader = trap_R_RegisterShader( "railDisc" ); break; + case WP_PULSE_RIFLE: + weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/plasma/lasfly.wav", qfalse ); + MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); + weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/plasma/hyprbf1a.wav", qfalse ); + cgs.media.plasmaExplosionShader = trap_R_RegisterShader( "plasmaExplosion" ); + cgs.media.railRingsShader = trap_R_RegisterShader( "railDisc" ); + break; + case WP_RAILGUN: weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/railgun/rg_hum.wav", qfalse ); MAKERGB( weaponInfo->flashDlightColor, 1, 0.5f, 0 ); @@ -767,7 +783,6 @@ void CG_RegisterWeapon( int weaponNum ) { case WP_DBUILD2: case WP_HBUILD: case WP_HBUILD2: - case WP_SCANNER: //nowt break; @@ -1850,6 +1865,13 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im mark = cgs.media.energyMarkShader; radius = 16; break; + case WP_PULSE_RIFLE: + mod = cgs.media.ringFlashModel; + shader = cgs.media.plasmaExplosionShader; + sfx = cgs.media.sfx_plasmaexp; + mark = cgs.media.energyMarkShader; + radius = 16; + break; case WP_BFG: mod = cgs.media.dishFlashModel; shader = cgs.media.bfgExplosionShader; @@ -1865,6 +1887,10 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im sfx = 0; radius = 4; break; + case WP_MASS_DRIVER: + shader = cgs.media.bulletExplosionShader; + mark = cgs.media.bulletMarkShader; + break; case WP_MACHINEGUN: mod = cgs.media.bulletFlashModel; shader = cgs.media.bulletExplosionShader; diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 32c20566..a2f521e3 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -322,22 +322,6 @@ gitem_t bg_itemlist[] = "" }, -/*QUAKED weapon_scanner (.3 .3 1) (-16 -16 -16) (16 16 16) suspended -*/ - { - "weapon_scanner", - "sound/misc/w_pkup.wav", - { "models/weapons2/shotgun/shotgun.md3", - 0, 0, 0}, - "icons/iconw_shotgun", - "Scanner", - 0, - IT_WEAPON, - WP_SCANNER, - "", - "" - }, - /*QUAKED weapon_shotgun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended */ /*{ @@ -386,6 +370,38 @@ gitem_t bg_itemlist[] = "" }, +/*QUAKED weapon_massdriver (.3 .3 1) (-16 -16 -16) (16 16 16) suspended +*/ + { + "weapon_massdriver", + "sound/misc/w_pkup.wav", + { "models/weapons2/bfg/bfg.md3", + 0, 0, 0}, + "icons/iconw_bfg", + "Mass Driver", + 40, + IT_WEAPON, + WP_MASS_DRIVER, + "", + "" + }, + +/*QUAKED weapon_pulserifle (.3 .3 1) (-16 -16 -16) (16 16 16) suspended +*/ + { + "weapon_pulserifle", + "sound/misc/w_pkup.wav", + { "models/weapons2/plasma/plasma.md3", + 0, 0, 0}, + "icons/iconw_gauntlet", + "Pulse Rifle", + 40, + IT_WEAPON, + WP_PULSE_RIFLE, + "", + "" + }, + /*QUAKED weapon_ggrenade (.3 .3 1) (-16 -16 -16) (16 16 16) suspended */ { @@ -2883,6 +2899,30 @@ weaponAttributes_t bg_weapons[ ] = qfalse, //qboolean hasAltMode; qfalse //qboolean synced; }, + { + WP_MASS_DRIVER, //int weaponNum; + 100, //int price; + SLOT_WEAPON, //int slots; + "mdriver", //char *weaponName; + "Mass Driver", //char *weaponHumanName; + 5, //int quan; + 2, //int clips; + 3, //int maxClips; + qfalse, //qboolean hasAltMode; + qfalse //qboolean synced; + }, + { + WP_PULSE_RIFLE, //int weaponNum; + 100, //int price; + SLOT_WEAPON, //int slots; + "prifle", //char *weaponName; + "Pulse Rifle", //char *weaponHumanName; + 50, //int quan; + 3, //int clips; + 3, //int maxClips; + qfalse, //qboolean hasAltMode; + qfalse //qboolean synced; + }, { WP_HBUILD, //int weaponNum; 100, //int price; @@ -2966,18 +3006,6 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qfalse, //qboolean hasAltMode; qfalse //qboolean synced; - }, - { - WP_SCANNER, //int weaponNum; - 100, //int price; - SLOT_WEAPON, //int slots; - "scanner", //char *weaponName; - "Scanner", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; - 0, //int maxClips; - qfalse, //qboolean hasAltMode; - qfalse //qboolean synced; } }; @@ -4073,7 +4101,6 @@ qboolean BG_infiniteAmmo( int weapon ) case WP_DBUILD2: case WP_HBUILD: case WP_HBUILD2: - case WP_SCANNER: return qtrue; break; diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 685a0617..8bad877c 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2161,9 +2161,6 @@ static void PM_Weapon( void ) return; } - if( pm->ps->weapon == WP_SCANNER ) - return; //doesn't actually do anything - // start the animation even if out of ammo BG_unpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips, &maxclips ); @@ -2182,6 +2179,8 @@ static void PM_Weapon( void ) switch( pm->ps->weapon ) { case WP_MACHINEGUN: + case WP_MASS_DRIVER: + case WP_PULSE_RIFLE: clips--; BG_FindAmmoForWeapon( pm->ps->weapon, &ammo, NULL, NULL ); break; @@ -2201,6 +2200,8 @@ static void PM_Weapon( void ) switch( pm->ps->weapon ) { case WP_MACHINEGUN: + case WP_MASS_DRIVER: + case WP_PULSE_RIFLE: addTime = 2000; break; @@ -2366,11 +2367,16 @@ static void PM_Weapon( void ) case WP_POUNCE: addTime = 750; break; + case WP_MASS_DRIVER: + addTime = 1000; + break; + case WP_PULSE_RIFLE: + addTime = 50; + break; case WP_DBUILD: case WP_DBUILD2: case WP_HBUILD: case WP_HBUILD2: - case WP_SCANNER: addTime = 1000; //abritutary since doesn't "fire" break; } diff --git a/src/game/bg_public.h b/src/game/bg_public.h index b0acd7a7..284bbf86 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -328,7 +328,7 @@ typedef enum { } holdable_t; //TA: needed client side to size sprites -#define FIREBALL_LIFETIME 1500.0f +#define FIREBALL_LIFETIME 1000.0f typedef enum { @@ -350,6 +350,8 @@ typedef enum WP_VENOM, WP_GRABANDCSAW, WP_POUNCE, + WP_MASS_DRIVER, + WP_PULSE_RIFLE, //build weapons must remain in a block WP_DBUILD, @@ -358,7 +360,6 @@ typedef enum WP_HBUILD, //ok? - WP_SCANNER, WP_GGRENADE, WP_NUM_WEAPONS @@ -520,6 +521,7 @@ typedef enum { EV_BULLET_HIT_FLESH, EV_BULLET_HIT_WALL, + EV_MASS_DRIVER_HIT, EV_MISSILE_HIT, EV_MISSILE_MISS, diff --git a/src/game/g_active.c b/src/game/g_active.c index 5abeeaf8..3bff151b 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -412,6 +412,7 @@ qboolean ClientInactivityTimer( gclient_t *client ) { #define STAMINA_STOP_RESTORE 10 #define STAMINA_WALK_RESTORE 5 #define STAMINA_SPRINT_TAKE 10 +#define STAMINA_LARMOUR_TAKE 5 /* ================== @@ -446,7 +447,10 @@ void ClientTimerActions( gentity_t *ent, int msec ) if( ( client->ps.stats[ STAT_STATE ] & SS_SPEEDBOOST ) && ucmd->upmove >= 0 ) { //subtract stamina - client->ps.stats[ STAT_STAMINA ] -= STAMINA_SPRINT_TAKE; + if( BG_gotItem( UP_LIMBARMOUR, client->ps.stats ) ) + client->ps.stats[ STAT_STAMINA ] -= STAMINA_LARMOUR_TAKE; + else + client->ps.stats[ STAT_STAMINA ] -= STAMINA_SPRINT_TAKE; if( client->ps.stats[ STAT_STAMINA ] < -1000 ) client->ps.stats[ STAT_STAMINA ] = -1000; @@ -608,12 +612,12 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) { if ( item ) { drop = Drop_Item( ent, item, 0 ); // decide how many seconds it has left - drop->count = ( ent->client->ps.powerups[ j ] - level.time ) / 1000; + /*drop->count = ( ent->client->ps.powerups[ j ] - level.time ) / 1000;*/ if ( drop->count < 1 ) { drop->count = 1; } - ent->client->ps.powerups[ j ] = 0; + /*ent->client->ps.powerups[ j ] = 0;*/ } SelectSpawnPoint( ent->client->ps.origin, origin, angles ); @@ -1164,11 +1168,11 @@ void ClientEndFrame( gentity_t *ent ) { pers = &ent->client->pers; // turn off any expired powerups - for ( i = 0 ; i < MAX_POWERUPS ; i++ ) { +/* for ( i = 0 ; i < MAX_POWERUPS ; i++ ) { if ( ent->client->ps.powerups[ i ] < level.time ) { ent->client->ps.powerups[ i ] = 0; } - } + }*/ // save network bandwidth #if 0 diff --git a/src/game/g_local.h b/src/game/g_local.h index f70ade0b..cf5bb8f4 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -615,6 +615,7 @@ void G_RunMissile( gentity_t *ent ); gentity_t *fire_blaster( gentity_t *self, vec3_t start, vec3_t aimdir ); gentity_t *fire_flamer( gentity_t *self, vec3_t start, vec3_t aimdir ); gentity_t *fire_plasma( gentity_t *self, vec3_t start, vec3_t aimdir ); +gentity_t *fire_pulseRifle( gentity_t *self, vec3_t start, vec3_t dir ); gentity_t *fire_grenade( gentity_t *self, vec3_t start, vec3_t aimdir ); gentity_t *fire_rocket( gentity_t *self, vec3_t start, vec3_t dir ); gentity_t *fire_lockblob( gentity_t *self, vec3_t start, vec3_t dir ); diff --git a/src/game/g_missile.c b/src/game/g_missile.c index 8b2aba73..24c70390 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -378,6 +378,46 @@ gentity_t *fire_plasma( gentity_t *self, vec3_t start, vec3_t dir ) return bolt; } +/* +================= +fire_plasma + +================= +*/ +gentity_t *fire_pulseRifle( gentity_t *self, vec3_t start, vec3_t dir ) +{ + gentity_t *bolt; + + VectorNormalize (dir); + + bolt = G_Spawn(); + bolt->classname = "pulse"; + bolt->nextthink = level.time + 10000; + bolt->think = G_ExplodeMissile; + bolt->s.eType = ET_MISSILE; + bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; + bolt->s.weapon = WP_PULSE_RIFLE; + bolt->r.ownerNum = self->s.number; + bolt->parent = self; + bolt->damage = 20; + bolt->splashDamage = 0; + bolt->splashRadius = 0; + //bolt->methodOfDeath = MOD_FLAMER; + //bolt->splashMethodOfDeath = MOD_FLAMER_SPLASH; + bolt->clipmask = MASK_SHOT; + bolt->target_ent = NULL; + + bolt->s.pos.trType = TR_LINEAR; + 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, 1500, bolt->s.pos.trDelta ); + SnapVector( bolt->s.pos.trDelta ); // save net bandwidth + + VectorCopy (start, bolt->r.currentOrigin); + + return bolt; +} + //============================================================================= /* diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 85a9b59d..d27adb73 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -146,14 +146,14 @@ void SnapVectorTowards( vec3_t v, vec3_t to ) { #define CHAINGUN_SPREAD 1200 #define CHAINGUN_DAMAGE 14 -void Bullet_Fire (gentity_t *ent, float spread, int damage, int mod ) { +void Bullet_Fire( gentity_t *ent, float spread, int damage, int mod ) +{ trace_t tr; vec3_t end; float r; float u; gentity_t *tent; gentity_t *traceEnt; - int i, passent; r = random() * M_PI * 2.0f; u = sin(r) * crandom() * spread * 16; @@ -162,40 +162,73 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int mod ) { VectorMA (end, r, right, end); VectorMA (end, u, up, end); - passent = ent->s.number; - for (i = 0; i < 10; i++) { - - trap_Trace (&tr, muzzle, NULL, NULL, end, passent, MASK_SHOT); - if ( tr.surfaceFlags & SURF_NOIMPACT ) { - return; - } + trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT); + if( tr.surfaceFlags & SURF_NOIMPACT ) + return; - traceEnt = &g_entities[ tr.entityNum ]; + traceEnt = &g_entities[ tr.entityNum ]; - // snap the endpos to integers, but nudged towards the line - SnapVectorTowards( tr.endpos, muzzle ); + // 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_BULLET_HIT_FLESH ); - tent->s.eventParm = traceEnt->s.number; - if( LogAccuracyHit( traceEnt, ent ) ) { - ent->client->accuracy_hits++; - } - } else { - tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_WALL ); - tent->s.eventParm = DirToByte( tr.plane.normal ); - } - tent->s.otherEntityNum = ent->s.number; + // send bullet impact + if( traceEnt->takedamage && traceEnt->client ) + { + tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_FLESH ); + tent->s.eventParm = traceEnt->s.number; + if( LogAccuracyHit( traceEnt, ent ) ) + ent->client->accuracy_hits++; + } + else + { + tent = G_TempEntity( tr.endpos, EV_BULLET_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, - damage, 0, MOD_MACHINEGUN); - } - break; + if( traceEnt->takedamage ) + { + G_Damage( traceEnt, ent, ent, forward, tr.endpos, + damage, 0, MOD_MACHINEGUN); } } +/* +====================================================================== + +MASS DRIVER + +====================================================================== +*/ + +void massDriverFire( 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 impact + tent = G_TempEntity( tr.endpos, EV_MASS_DRIVER_HIT ); + tent->s.eventParm = DirToByte( tr.plane.normal ); + + if( traceEnt->takedamage ) + { + G_Damage( traceEnt, ent, ent, forward, tr.endpos, + 50, 0, MOD_MACHINEGUN); + } +} /* ====================================================================== @@ -374,6 +407,23 @@ void Weapon_Plasma_Fire (gentity_t *ent) { /* ====================================================================== +PULSE RIFLE + +====================================================================== +*/ + +void Weapon_PulseRifle_Fire (gentity_t *ent) +{ + gentity_t *m; + + m = fire_pulseRifle( ent, muzzle, forward ); + +// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics +} + +/* +====================================================================== + FLAME THROWER ====================================================================== @@ -1022,9 +1072,15 @@ void FireWeapon2( gentity_t *ent ) case WP_PLASMAGUN: Weapon_Plasma_Fire( ent ); break; + case WP_PULSE_RIFLE: + Weapon_PulseRifle_Fire( ent ); + break; case WP_RAILGUN: weapon_railgun_fire( ent ); break; + case WP_MASS_DRIVER: + massDriverFire( ent ); + break; case WP_LOCKBLOB_LAUNCHER: break; case WP_BFG: @@ -1053,7 +1109,6 @@ void FireWeapon2( gentity_t *ent ) case WP_HBUILD2: Weapon_Hbuild2_Fire( ent ); break; - case WP_SCANNER: //scanner doesn't "fire" default: // FIXME G_Error( "Bad ent->s.weapon" ); break; @@ -1109,9 +1164,15 @@ void FireWeapon( gentity_t *ent ) case WP_PLASMAGUN: Weapon_Plasma_Fire( ent ); break; + case WP_PULSE_RIFLE: + Weapon_PulseRifle_Fire( ent ); + break; case WP_RAILGUN: weapon_railgun_fire( ent ); break; + case WP_MASS_DRIVER: + massDriverFire( ent ); + break; case WP_LOCKBLOB_LAUNCHER: Weapon_LockBlobLauncher_Fire( ent ); break; @@ -1142,7 +1203,6 @@ void FireWeapon( gentity_t *ent ) case WP_HBUILD2: Weapon_Hbuild2_Fire( ent ); break; - case WP_SCANNER: //scanner doesn't "fire" default: // FIXME G_Error( "Bad ent->s.weapon" ); break; -- cgit