diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_consolecmds.c | 1 | ||||
-rw-r--r-- | src/cgame/cg_ents.c | 32 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 6 | ||||
-rw-r--r-- | src/game/bg_misc.c | 24 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 1 | ||||
-rw-r--r-- | src/game/bg_public.h | 3 | ||||
-rw-r--r-- | src/game/g_active.c | 2 | ||||
-rw-r--r-- | src/game/g_client.c | 49 | ||||
-rw-r--r-- | src/game/g_cmds.c | 25 | ||||
-rw-r--r-- | src/game/g_combat.c | 13 | ||||
-rw-r--r-- | src/game/g_local.h | 2 | ||||
-rw-r--r-- | src/game/g_missile.c | 6 | ||||
-rw-r--r-- | src/game/g_weapon.c | 309 |
13 files changed, 279 insertions, 194 deletions
diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c index 697796de..63e095df 100644 --- a/src/cgame/cg_consolecmds.c +++ b/src/cgame/cg_consolecmds.c @@ -324,6 +324,7 @@ void CG_InitConsoleCommands( void ) { trap_AddCommand ("sell"); trap_AddCommand ("deposit"); trap_AddCommand ("withdraw"); + trap_AddCommand ("spawnbody"); trap_AddCommand ("itemact"); trap_AddCommand ("itemdeact"); trap_AddCommand ("itemtoggle"); diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index a7e95e1c..8cc0fe1b 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -289,20 +289,21 @@ static void CG_Missile( centity_t *cent ) break; case WP_FLAMER: - fraction = ( ( cg.time - s1->pos.trTime ) / FIREBALL_LIFETIME ); - - if( fraction > 1.0f ) - fraction = 1.0f; + { + fraction = ( ( cg.time - s1->pos.trTime ) / FIREBALL_LIFETIME ); - ent.reType = RT_SPRITE; - ent.radius = fraction * 32; - ent.shaderTime = s1->pos.trTime / 1000.0f; - ent.rotation = 0; - - index = (int)( fraction * 31 ); - ent.customShader = cgs.media.flameShader[ index ]; - trap_R_AddRefEntityToScene( &ent ); - return; + if( fraction > 1.0f ) + fraction = 1.0f; + + ent.reType = RT_SPRITE; + ent.radius = fraction * 32; + ent.rotation = s1->generic1; + + index = (int)( fraction * 31 ); + ent.customShader = cgs.media.flameShader[ index ]; + trap_R_AddRefEntityToScene( &ent ); + return; + } break; default: @@ -910,7 +911,7 @@ void CG_AddPacketEntities( void ) { cgIP.numAlienClients = 0; cgIP.numHumanClients = 0; - for ( num = 0 ; num < cg.snap->numEntities ; num++ ) + for( num = 0 ; num < cg.snap->numEntities ; num++ ) { cent = &cg_entities[ cg.snap->entities[ num ].number ]; @@ -953,7 +954,8 @@ void CG_AddPacketEntities( void ) { //Com_Printf( "%d %d\n", cgIP.numAlienClients, cgIP.numHumanClients ); // add each entity sent over by the server - for ( num = 0 ; num < cg.snap->numEntities ; num++ ) { + for( num = 0; num < cg.snap->numEntities; num++ ) + { cent = &cg_entities[ cg.snap->entities[ num ].number ]; CG_AddCEntity( cent ); } diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 1df76a89..089df54f 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -650,6 +650,8 @@ void CG_RegisterWeapon( int weaponNum ) switch( weaponNum ) { case WP_TESLAGEN: + case WP_AREA_ZAP: + case WP_DIRECT_ZAP: MAKERGB( weaponInfo->flashDlightColor, 0.6f, 0.6f, 1.0f ); weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/melee/fsthum.wav", qfalse ); weaponInfo->firingSound = trap_S_RegisterSound( "sound/weapons/lightning/lg_hum.wav", qfalse ); @@ -1741,6 +1743,8 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im { default: case WP_TESLAGEN: + case WP_AREA_ZAP: + case WP_DIRECT_ZAP: mod = cgs.media.lightningExplosionModel; shader = cgs.media.lightningShader; sfx = cgs.media.sfx_lghit; @@ -1754,7 +1758,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im isSprite = qtrue; break; case WP_FLAMER: - sfx = cgs.media.sfx_lghit; + sfx = cgs.media.sfx_plasmaexp; mark = cgs.media.burnMarkShader; radius = 32; break; diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index a7c21ba7..506bf599 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1960,7 +1960,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qfalse, //int infiniteAmmo; - 40, //int repeatRate; + 20, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; @@ -2160,7 +2160,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //int infiniteAmmo; - 500, //int repeatRate; + 1500, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; @@ -2168,6 +2168,26 @@ weaponAttributes_t bg_weapons[ ] = WUT_ALIENS //WUTeam_t team; }, { + WP_DIRECT_ZAP, //int weaponNum; + 100, //int price; + ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages + SLOT_WEAPON, //int slots; + "directzap", //char *weaponName; + "Directed Zap", //char *weaponHumanName; + { "models/weapons2/gauntlet/gauntlet.md3", 0, 0, 0 }, + "icons/iconw_gauntlet", + 0, //int quan; + 0, //int clips; + 0, //int maxClips; + qtrue, //int infiniteAmmo; + 1500, //int repeatRate; + 0, //int reloadTime; + qtrue, //qboolean hasAltMode; + qfalse, //qboolean synced; + qfalse, //qboolean purchasable; + WUT_ALIENS //WUTeam_t team; + }, + { WP_POUNCE, //int weaponNum; 100, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index c0ba5e82..42281d8d 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2487,7 +2487,6 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ) ps->delta_angles[ i ] -= ANGLE2SHORT( fabs( diff ) * 0.05f ); } } - } diff --git a/src/game/bg_public.h b/src/game/bg_public.h index dbeb7e43..42e92464 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -32,7 +32,7 @@ #define ITEM_RADIUS 15 // item sizes are needed for client side pickup detection -#define LIGHTNING_RANGE 768 +#define LIGHTNING_RANGE 1024 #define SCORE_NOT_PRESENT -9999 // for the CS_SCORES[12] when only one player is present @@ -338,6 +338,7 @@ typedef enum WP_GRAB_CLAW, WP_POUNCE, WP_AREA_ZAP, + WP_DIRECT_ZAP, WP_MASS_DRIVER, WP_PULSE_RIFLE, diff --git a/src/game/g_active.c b/src/game/g_active.c index 871db488..0767afe5 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -842,7 +842,7 @@ void ClientThink_real( gentity_t *ent ) { client->ps.pm_type = PM_NORMAL; if( client->ps.stats[ STAT_STATE ] & SS_GRABBED && - client->lastGrabTime + 500 < level.time ) + client->lastGrabTime + BG_FindRepeatRateForWeapon( WP_GRAB_CLAW ) + 100 < level.time ) client->ps.stats[ STAT_STATE ] &= ~SS_GRABBED; if( client->ps.stats[ STAT_STATE ] & SS_BLOBLOCKED && diff --git a/src/game/g_client.c b/src/game/g_client.c index 806af002..5decc90b 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -679,13 +679,12 @@ void SpawnCorpse( gentity_t *ent ) VectorCopy( ent->r.currentOrigin, origin ); - trap_UnlinkEntity (ent); + /*trap_UnlinkEntity( ent );*/ // if client is in a nodrop area, don't leave the body - contents = trap_PointContents( ent->s.origin, -1 ); - if ( contents & CONTENTS_NODROP ) { + contents = trap_PointContents( origin, -1 ); + if( contents & CONTENTS_NODROP ) return; - } body = G_Spawn( ); @@ -727,20 +726,21 @@ void SpawnCorpse( gentity_t *ent ) body->use = useBody; - switch ( body->s.legsAnim & ~ANIM_TOGGLEBIT ) { - case BOTH_DEATH1: - case BOTH_DEAD1: - body->s.torsoAnim = body->s.legsAnim = BOTH_DEAD1; - break; - case BOTH_DEATH2: - case BOTH_DEAD2: - body->s.torsoAnim = body->s.legsAnim = BOTH_DEAD2; - break; - case BOTH_DEATH3: - case BOTH_DEAD3: - default: - body->s.torsoAnim = body->s.legsAnim = BOTH_DEAD3; - break; + switch( body->s.legsAnim & ~ANIM_TOGGLEBIT ) + { + case BOTH_DEATH1: + case BOTH_DEAD1: + body->s.torsoAnim = body->s.legsAnim = BOTH_DEAD1; + break; + case BOTH_DEATH2: + case BOTH_DEAD2: + body->s.torsoAnim = body->s.legsAnim = BOTH_DEAD2; + break; + case BOTH_DEATH3: + case BOTH_DEAD3: + default: + body->s.torsoAnim = body->s.legsAnim = BOTH_DEAD3; + break; } body->takedamage = qfalse; @@ -751,8 +751,8 @@ void SpawnCorpse( gentity_t *ent ) ent->r.contents = 0; ent->s.solid = 0; ent->r.s.solid = 0; - body->health = ent->health = ent->client->ps.stats[STAT_HEALTH]; - ent->health = ent->client->ps.stats[STAT_HEALTH] = GIB_HEALTH - 1; + body->health = ent->health = ent->client->ps.stats[ STAT_HEALTH ]; + ent->health = ent->client->ps.stats[ STAT_HEALTH ] = GIB_HEALTH - 1; //change body dimensions BG_FindBBoxForClass( ent->client->ps.stats[ STAT_PCLASS ], NULL, NULL, NULL, body->r.mins, body->r.maxs ); @@ -770,7 +770,6 @@ void SpawnCorpse( gentity_t *ent ) VectorCopy ( body->s.pos.trBase, body->r.currentOrigin ); trap_LinkEntity( body ); - } //====================================================================== @@ -1487,13 +1486,13 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) break; case PCL_A_O_LEV3: - BG_packWeapon( WP_VENOM, client->ps.stats ); - BG_packAmmoArray( WP_VENOM, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); + BG_packWeapon( WP_AREA_ZAP, client->ps.stats ); + BG_packAmmoArray( WP_AREA_ZAP, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); break; case PCL_A_O_LEV3_UPG: - BG_packWeapon( WP_VENOM, client->ps.stats ); - BG_packAmmoArray( WP_VENOM, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); + BG_packWeapon( WP_DIRECT_ZAP, client->ps.stats ); + BG_packAmmoArray( WP_DIRECT_ZAP, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); break; case PCL_A_O_LEV4: diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 10680949..d0c53d91 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -2250,6 +2250,29 @@ void Cmd_Boost_f( gentity_t *ent ) /* ================= +Cmd_Spawnbody_f +================= +*/ +void Cmd_Spawnbody_f( gentity_t *ent ) +{ + gentity_t *dummy = G_Spawn( ); + vec3_t forward; + + AngleVectors( ent->client->ps.viewangles, forward, NULL, NULL ); + VectorMA( ent->client->ps.origin, 128.0f, forward, dummy->r.currentOrigin ); + + dummy->client->ps.stats[ STAT_PTEAM ] = PTE_HUMANS; + dummy->client->ps.stats[ STAT_PCLASS ] = PCL_H_BASE; + + dummy->client->lasthurt_client = dummy->client->ps.clientNum = -1; + + SpawnCorpse( dummy ); + + G_FreeEntity( dummy ); +} + +/* +================= ClientCommand ================= */ @@ -2377,6 +2400,8 @@ void ClientCommand( int clientNum ) { Cmd_SetViewpos_f( ent ); else if (Q_stricmp (cmd, "stats") == 0) Cmd_Stats_f( ent ); + else if (Q_stricmp (cmd, "spawnbody") == 0) + Cmd_Spawnbody_f( ent ); else trap_SendServerCommand( clientNum, va("print \"unknown cmd %s\n\"", cmd ) ); } diff --git a/src/game/g_combat.c b/src/game/g_combat.c index e0f0e0ea..391a4800 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -1076,13 +1076,6 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, return; } - //TA: handicaps.. WTF is all that about? If someone is shit they deserve to die. - // reduce damage by the attacker's handicap value - // unless they are rocket jumping - /*if ( attacker->client && attacker != targ ) { - damage = damage * attacker->client->ps.stats[STAT_MAX_HEALTH] / 100; - }*/ - client = targ->client; if( client ) @@ -1385,9 +1378,6 @@ qboolean G_SelectiveRadiusDamage ( vec3_t origin, gentity_t *attacker, float dam points = damage * ( 1.0 - dist / radius ); if( CanDamage (ent, origin) ) { - if( LogAccuracyHit( ent, attacker ) ) { - hitClient = qtrue; - } VectorSubtract (ent->r.currentOrigin, origin, dir); // push the center of mass higher than the origin so players // get knocked into the air more @@ -1455,9 +1445,6 @@ qboolean G_RadiusDamage ( vec3_t origin, gentity_t *attacker, float damage, floa points = damage * ( 1.0 - dist / radius ); if( CanDamage (ent, origin) ) { - if( LogAccuracyHit( ent, attacker ) ) { - hitClient = qtrue; - } VectorSubtract (ent->r.currentOrigin, origin, dir); // push the center of mass higher than the origin so players // get knocked into the air more diff --git a/src/game/g_local.h b/src/game/g_local.h index aeba3c64..ff58b36f 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -348,6 +348,8 @@ struct gclient_s { qboolean allowedToPounce; vec3_t hovelOrigin; //TA: player origin before entering hovel + + int lastFlameBall; //TA: s.number of the last flame ball fired }; #define MAX_LOCDAMAGE_TEXT 8192 diff --git a/src/game/g_missile.c b/src/game/g_missile.c index 03478674..f715bf21 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -115,10 +115,6 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) { if ( ent->damage ) { vec3_t velocity; - if( LogAccuracyHit( other, &g_entities[ent->r.ownerNum] ) ) { - g_entities[ent->r.ownerNum].client->accuracy_hits++; - hitClient = qtrue; - } BG_EvaluateTrajectoryDelta( &ent->s.pos, level.time, velocity ); if ( VectorLength( velocity ) == 0 ) { velocity[2] = 1; // stepped on a grenade @@ -258,6 +254,8 @@ gentity_t *fire_flamer( gentity_t *self, vec3_t start, vec3_t dir ) bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; bolt->s.weapon = WP_FLAMER; bolt->r.ownerNum = self->s.number; + //random rotation for the flame sprite + bolt->s.generic1 = rand( ) % 360; bolt->parent = self; bolt->damage = 60; bolt->splashDamage = 65; diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index e0dec309..f08ae2fe 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -28,27 +28,20 @@ static vec3_t muzzle; G_BounceProjectile ================ */ -void G_BounceProjectile( vec3_t start, vec3_t impact, vec3_t dir, vec3_t endout ) { +void G_BounceProjectile( vec3_t start, vec3_t impact, vec3_t dir, vec3_t endout ) +{ vec3_t v, newv; float dot; VectorSubtract( impact, start, v ); dot = DotProduct( v, dir ); - VectorMA( v, -2*dot, dir, newv ); + VectorMA( v, -2 * dot, dir, newv ); VectorNormalize(newv); VectorMA(impact, 8192, newv, endout); } /* -====================================================================== - -MACHINEGUN - -====================================================================== -*/ - -/* ====================== SnapVectorTowards @@ -58,18 +51,27 @@ rather than blindly truncating. This prevents it from truncating into a wall. ====================== */ -void SnapVectorTowards( vec3_t v, vec3_t to ) { +void SnapVectorTowards( vec3_t v, vec3_t to ) +{ int i; - for ( i = 0 ; i < 3 ; i++ ) { - if ( to[i] <= v[i] ) { - v[i] = (int)v[i]; - } else { - v[i] = (int)v[i] + 1; - } + for( i = 0 ; i < 3 ; i++ ) + { + if( to[ i ] <= v[ i ] ) + v[ i ] = (int)v[ i ]; + else + v[ i ] = (int)v[ i ] + 1; } } +/* +====================================================================== + +MACHINEGUN + +====================================================================== +*/ + #define MACHINEGUN_SPREAD 200 #define MACHINEGUN_DAMAGE 7 #define MACHINEGUN_TEAM_DAMAGE 5 // wimpier MG in teamplay @@ -77,7 +79,7 @@ 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 bulletFire( gentity_t *ent, float spread, int damage, int mod ) { trace_t tr; vec3_t end; @@ -107,8 +109,6 @@ void Bullet_Fire( gentity_t *ent, float spread, int damage, int mod ) { tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_FLESH ); tent->s.eventParm = traceEnt->s.number; - if( LogAccuracyHit( traceEnt, ent ) ) - ent->client->accuracy_hits++; } else { @@ -139,7 +139,7 @@ void massDriverFire( gentity_t *ent ) gentity_t *tent; gentity_t *traceEnt; - VectorMA( muzzle, 8192*16, forward, end ); + VectorMA( muzzle, 8192 * 16, forward, end ); trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); if( tr.surfaceFlags & SURF_NOIMPACT ) @@ -169,7 +169,7 @@ LOCKBLOB ====================================================================== */ -void Weapon_LockBlobLauncher_Fire( gentity_t *ent ) +void lockBlobLauncherFire( gentity_t *ent ) { gentity_t *m; @@ -186,7 +186,8 @@ PLASMAGUN ====================================================================== */ -void Weapon_Plasma_Fire (gentity_t *ent) { +void plasmaFire( gentity_t *ent ) +{ gentity_t *m; m = fire_plasma (ent, muzzle, forward); @@ -202,7 +203,7 @@ PULSE RIFLE ====================================================================== */ -void Weapon_PulseRifle_Fire (gentity_t *ent) +void pulseRifleFire( gentity_t *ent ) { gentity_t *m; @@ -219,10 +220,11 @@ FLAME THROWER ====================================================================== */ -void Weapon_Flamer_Fire (gentity_t *ent) { +void flamerFire( gentity_t *ent ) +{ gentity_t *m; - m = fire_flamer (ent, muzzle, forward); + m = fire_flamer( ent, muzzle, forward ); VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics } @@ -236,7 +238,7 @@ TESLA GENERATOR */ -void Weapon_TeslaFire( gentity_t *ent ) +void teslaFire( gentity_t *ent ) { trace_t tr; vec3_t end; @@ -266,9 +268,6 @@ void Weapon_TeslaFire( gentity_t *ent ) // send railgun beam effect tent = G_TempEntity( tr.endpos, EV_TESLATRAIL ); - // set player number for custom colors on the railtrail - tent->s.clientNum = ent->s.clientNum; - VectorCopy( muzzle, tent->s.origin2 ); // move origin a bit to come closer to the drawn gun muzzle VectorMA( tent->s.origin2, 16, up, tent->s.origin2 ); @@ -291,23 +290,12 @@ BUILD GUN ====================================================================== */ - -/* -=============== -Weapon_Cancel_Build -=============== -*/ -void Weapon_Cancel_Build( gentity_t *ent ) +void cancelBuildFire( gentity_t *ent ) { ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE; } -/* -=============== -Weapon_Build_Fire -=============== -*/ -void Weapon_Build_Fire( gentity_t *ent, dynMenu_t menu ) +void buildFire( gentity_t *ent, dynMenu_t menu ) { if( ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE ) { @@ -384,15 +372,6 @@ qboolean CheckVenomAttack( gentity_t *ent ) } /* -=============== -Weapon_Venom_Fire -=============== -*/ -void Weapon_Venom_Fire( gentity_t *ent ) -{ -} - -/* ====================================================================== GRAB AND CLAW @@ -400,12 +379,7 @@ GRAB AND CLAW ====================================================================== */ -/* -=============== -Weapon_GClaw_Fire -=============== -*/ -void Weapon_GClaw_Fire( gentity_t *ent ) +void gClawFire( gentity_t *ent ) { trace_t tr; vec3_t end; @@ -413,7 +387,7 @@ void Weapon_GClaw_Fire( gentity_t *ent ) gentity_t *traceEnt; // set aiming directions - AngleVectors (ent->client->ps.viewangles, forward, right, up); + AngleVectors( ent->client->ps.viewangles, forward, right, up ); CalcMuzzlePoint( ent, forward, right, up, muzzle ); @@ -438,12 +412,7 @@ void Weapon_GClaw_Fire( gentity_t *ent ) G_Damage( traceEnt, ent, ent, forward, tr.endpos, 5, DAMAGE_NO_KNOCKBACK, MOD_VENOM ); } -/* -=============== -Weapon_Grab_Fire -=============== -*/ -void Weapon_Grab_Fire( gentity_t *ent ) +void grabFire( gentity_t *ent ) { trace_t tr; vec3_t end; @@ -476,7 +445,9 @@ void Weapon_Grab_Fire( gentity_t *ent ) //lock client traceEnt->client->ps.stats[ STAT_STATE ] |= SS_GRABBED; traceEnt->client->lastGrabTime = level.time; - VectorCopy( traceEnt->client->ps.viewangles, traceEnt->client->ps.grapplePoint ); + + if( !( traceEnt->client->ps.stats[ STAT_STATE ] & SS_GRABBED ) ) + VectorCopy( traceEnt->client->ps.viewangles, traceEnt->client->ps.grapplePoint ); } } @@ -526,10 +497,10 @@ CLAW AND POUNCE /* =============== -Weapon_Claw_Fire +clawFire =============== */ -void Weapon_Claw_Fire( gentity_t *ent ) +void clawFire( gentity_t *ent ) { trace_t tr; vec3_t end; @@ -582,25 +553,25 @@ qboolean CheckPounceAttack( gentity_t *ent ) return qfalse; // set aiming directions - AngleVectors (ent->client->ps.viewangles, forward, right, up); + AngleVectors( ent->client->ps.viewangles, forward, right, up ); CalcMuzzlePoint( ent, forward, right, up, muzzle ); - VectorMA (muzzle, 48, forward, end); + VectorMA( muzzle, 48, forward, end ); - trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT); + trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); //miss if( tr.fraction >= 1.0 ) return qfalse; - if ( tr.surfaceFlags & SURF_NOIMPACT ) + if( tr.surfaceFlags & SURF_NOIMPACT ) return qfalse; traceEnt = &g_entities[ tr.entityNum ]; // send blood impact - if ( traceEnt->takedamage && traceEnt->client ) + if( traceEnt->takedamage && traceEnt->client ) { tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT ); tent->s.otherEntityNum = traceEnt->s.number; @@ -620,45 +591,119 @@ qboolean CheckPounceAttack( gentity_t *ent ) return qtrue; } -//====================================================================== +/* +====================================================================== + +ZAP + +====================================================================== +*/ + +#define AREAZAP_DAMAGE 500.0f /* =============== -LogAccuracyHit +areaZapFire =============== */ -qboolean LogAccuracyHit( gentity_t *target, gentity_t *attacker ) -{ - //TA: theres a crash bug in here somewhere, but i'm too lazy to find it hence, - return qfalse; +void areaZapFire( gentity_t *ent ) +{ + int entityList[ MAX_GENTITIES ]; + int targetList[ MAX_GENTITIES ]; + vec3_t range = { 200, 200, 200 }; + vec3_t mins, maxs, dir; + int i, num, numTargets = 0; + gentity_t *enemy; + gentity_t *tent; + trace_t tr; + int damage; + + VectorAdd( muzzle, range, maxs ); + VectorSubtract( muzzle, range, mins ); - /*if( !target->takedamage ) { - return qfalse; - } + //do some damage + num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); + for( i = 0; i < num; i++ ) + { + enemy = &g_entities[ entityList[ i ] ]; + + if( ( enemy->client && enemy->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) || + ( enemy->s.eType == ET_BUILDABLE && BG_FindTeamForBuildable( enemy->s.modelindex ) == BIT_HUMANS ) ) + { + trap_Trace( &tr, muzzle, NULL, NULL, enemy->s.origin, ent->s.number, MASK_SHOT ); + + //can't see target from here + if( tr.entityNum == ENTITYNUM_WORLD ) + continue; - if ( target == attacker ) { - return qfalse; + targetList[ numTargets++ ] = entityList[ i ]; + } } - if( !target->client ) { - return qfalse; - } + damage = (int)( AREAZAP_DAMAGE / (float)numTargets ); + for( i = 0; i < numTargets; i++ ) + { + enemy = &g_entities[ targetList[ i ] ]; - if( !attacker->client ) { - return qfalse; - } + VectorSubtract( enemy->s.origin, muzzle, dir ); + VectorNormalize( dir ); + + G_Damage( enemy, ent, ent, dir, tr.endpos, + damage, DAMAGE_NO_KNOCKBACK, MOD_LIGHTNING ); + + // snap the endpos to integers to save net bandwidth, but nudged towards the line + SnapVectorTowards( tr.endpos, muzzle ); - if( target->client->ps.stats[STAT_HEALTH] <= 0 ) { - return qfalse; + // send railgun beam effect + tent = G_TempEntity( enemy->s.pos.trBase, EV_TESLATRAIL ); + + VectorCopy( muzzle, tent->s.origin2 ); } +} - if ( OnSameTeam( target, attacker ) ) { - return qfalse; +/* +=============== +directZapFire +=============== +*/ +void directZapFire( gentity_t *ent ) +{ + trace_t tr; + vec3_t end; + gentity_t *traceEnt, *tent; + int damage, i, passent; + + damage = 100; + + VectorMA( muzzle, LIGHTNING_RANGE, forward, end ); + + trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); + + if( tr.entityNum != ENTITYNUM_NONE ) + traceEnt = &g_entities[ tr.entityNum ]; + + if( traceEnt->takedamage ) + { + G_Damage( traceEnt, ent, ent, forward, tr.endpos, + damage, 0, MOD_LIGHTNING); } - return qtrue;*/ + // snap the endpos to integers to save net bandwidth, but nudged towards the line + SnapVectorTowards( tr.endpos, muzzle ); + + // send railgun beam effect + tent = G_TempEntity( tr.endpos, EV_TESLATRAIL ); + + VectorCopy( muzzle, tent->s.origin2 ); + + // no explosion at end if SURF_NOIMPACT, but still make the trail + if( tr.surfaceFlags & SURF_NOIMPACT ) + tent->s.eventParm = 255; // don't make the explosion at the end + else + tent->s.eventParm = DirToByte( tr.plane.normal ); } +//====================================================================== /* =============== @@ -667,10 +712,12 @@ CalcMuzzlePoint set muzzle location relative to pivoting eye =============== */ -void CalcMuzzlePoint( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint ) { +void CalcMuzzlePoint( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint ) +{ VectorCopy( ent->s.pos.trBase, muzzlePoint ); - muzzlePoint[2] += ent->client->ps.viewheight; + muzzlePoint[ 2 ] += ent->client->ps.viewheight; VectorMA( muzzlePoint, 1, forward, muzzlePoint ); + VectorMA( muzzlePoint, 1, right, muzzlePoint ); // snap to integer coordinates for more efficient network bandwidth usage SnapVector( muzzlePoint ); } @@ -685,7 +732,7 @@ void FireWeapon2( gentity_t *ent ) if( ent->client ) { // set aiming directions - AngleVectors (ent->client->ps.viewangles, forward, right, up); + AngleVectors( ent->client->ps.viewangles, forward, right, up ); CalcMuzzlePoint( ent, forward, right, up, muzzle ); } else @@ -698,47 +745,43 @@ void FireWeapon2( gentity_t *ent ) switch( ent->s.weapon ) { case WP_TESLAGEN: - Weapon_TeslaFire( ent ); + teslaFire( ent ); break; case WP_MACHINEGUN: - Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE, MOD_MACHINEGUN ); + bulletFire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE, MOD_MACHINEGUN ); break; case WP_CHAINGUN: - Bullet_Fire( ent, CHAINGUN_SPREAD, CHAINGUN_DAMAGE, MOD_CHAINGUN ); + bulletFire( ent, CHAINGUN_SPREAD, CHAINGUN_DAMAGE, MOD_CHAINGUN ); break; case WP_FLAMER: - Weapon_Flamer_Fire( ent ); + flamerFire( ent ); break; case WP_PLASMAGUN: - Weapon_Plasma_Fire( ent ); + plasmaFire( ent ); break; case WP_PULSE_RIFLE: - Weapon_PulseRifle_Fire( ent ); + pulseRifleFire( ent ); break; case WP_MASS_DRIVER: massDriverFire( ent ); break; case WP_LOCKBLOB_LAUNCHER: break; - case WP_VENOM: - Weapon_Venom_Fire( ent ); - break; case WP_GRAB_CLAW: - Weapon_Grab_Fire( ent ); + grabFire( ent ); + break; + case WP_AREA_ZAP: + case WP_DIRECT_ZAP: + areaZapFire( ent ); break; + case WP_VENOM: case WP_POUNCE: break; case WP_ABUILD: - Weapon_Cancel_Build( ent ); - break; case WP_ABUILD2: - Weapon_Cancel_Build( ent ); - break; case WP_HBUILD: - Weapon_Cancel_Build( ent ); - break; case WP_HBUILD2: - Weapon_Cancel_Build( ent ); + cancelBuildFire( ent ); break; default: // FIXME G_Error( "Bad ent->s.weapon" ); @@ -756,13 +799,12 @@ void FireWeapon( gentity_t *ent ) if( ent->client ) { // set aiming directions - AngleVectors (ent->client->ps.viewangles, forward, right, up); + AngleVectors( ent->client->ps.viewangles, forward, right, up ); CalcMuzzlePoint( ent, forward, right, up, muzzle ); } else { AngleVectors( ent->turretAim, forward, right, up ); - /*AngleVectors( ent->s.angles2, forward, right, up );*/ VectorCopy( ent->s.pos.trBase, muzzle ); } @@ -770,49 +812,54 @@ void FireWeapon( gentity_t *ent ) switch( ent->s.weapon ) { case WP_TESLAGEN: - Weapon_TeslaFire( ent ); + teslaFire( ent ); break; case WP_MACHINEGUN: - Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE, MOD_MACHINEGUN ); + bulletFire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE, MOD_MACHINEGUN ); break; case WP_CHAINGUN: - Bullet_Fire( ent, CHAINGUN_SPREAD, CHAINGUN_DAMAGE, MOD_CHAINGUN ); + bulletFire( ent, CHAINGUN_SPREAD, CHAINGUN_DAMAGE, MOD_CHAINGUN ); break; case WP_FLAMER: - Weapon_Flamer_Fire( ent ); + flamerFire( ent ); break; case WP_PLASMAGUN: - Weapon_Plasma_Fire( ent ); + plasmaFire( ent ); break; case WP_PULSE_RIFLE: - Weapon_PulseRifle_Fire( ent ); + pulseRifleFire( ent ); break; case WP_MASS_DRIVER: massDriverFire( ent ); break; case WP_LOCKBLOB_LAUNCHER: - Weapon_LockBlobLauncher_Fire( ent ); + lockBlobLauncherFire( ent ); break; case WP_VENOM: - Weapon_Venom_Fire( ent ); break; case WP_GRAB_CLAW: - Weapon_GClaw_Fire( ent ); + gClawFire( ent ); break; case WP_POUNCE: - Weapon_Claw_Fire( ent ); + clawFire( ent ); + break; + case WP_AREA_ZAP: + areaZapFire( ent ); + break; + case WP_DIRECT_ZAP: + directZapFire( ent ); break; case WP_ABUILD: - Weapon_Build_Fire( ent, MN_A_BUILD ); + buildFire( ent, MN_A_BUILD ); break; case WP_ABUILD2: - Weapon_Build_Fire( ent, MN_A_BUILD ); + buildFire( ent, MN_A_BUILD ); break; case WP_HBUILD: - Weapon_Build_Fire( ent, MN_H_BUILD ); + buildFire( ent, MN_H_BUILD ); break; case WP_HBUILD2: - Weapon_Build_Fire( ent, MN_H_BUILD ); + buildFire( ent, MN_H_BUILD ); break; default: // FIXME G_Error( "Bad ent->s.weapon" ); |