diff options
-rw-r--r-- | src/cgame/cg_event.c | 11 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 4 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 6 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 77 | ||||
-rw-r--r-- | src/game/bg_misc.c | 35 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 2 | ||||
-rw-r--r-- | src/game/bg_public.h | 3 | ||||
-rw-r--r-- | src/game/g_weapon.c | 14 | ||||
-rw-r--r-- | src/ui/ui_players.c | 2 |
9 files changed, 120 insertions, 34 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 29b77974..adf51128 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -889,6 +889,17 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) } break; + case EV_TESLATRAIL: + DEBUGNAME("EV_TESLATRAIL"); + cent->currentState.weapon = WP_TESLAGEN; + // if the end was on a nomark surface, don't make an explosion + CG_TeslaTrail( es->origin2, es->pos.trBase ); + if ( es->eventParm != 255 ) { + ByteToDir( es->eventParm, dir ); + CG_MissileHitWall( es->weapon, es->clientNum, position, dir, IMPACTSOUND_DEFAULT ); + } + break; + case EV_BULLET_HIT_WALL: DEBUGNAME("EV_BULLET_HIT_WALL"); ByteToDir( es->eventParm, dir ); diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index d98039ec..12bdff50 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1160,6 +1160,9 @@ extern vmCvar_t cg_animSpeed; extern vmCvar_t cg_debugAnim; extern vmCvar_t cg_debugPosition; extern vmCvar_t cg_debugEvents; +extern vmCvar_t cg_teslaTrailTime; +extern vmCvar_t cg_teslaSegments; +extern vmCvar_t cg_teslaDeviation; extern vmCvar_t cg_railTrailTime; extern vmCvar_t cg_errorDecay; extern vmCvar_t cg_nopredict; @@ -1428,6 +1431,7 @@ void CG_ShotgunFire( entityState_t *es ); void CG_Bullet( 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 ); void CG_GrappleTrail( centity_t *ent, const weaponInfo_t *wi ); void CG_AddViewWeapon (playerState_t *ps); void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent ); diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index d10ed749..ace52e56 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -90,6 +90,9 @@ itemInfo_t cg_items[MAX_ITEMS]; cgItemPos_t cgIP; +vmCvar_t cg_teslaTrailTime; +vmCvar_t cg_teslaSegments; +vmCvar_t cg_teslaDeviation; vmCvar_t cg_railTrailTime; vmCvar_t cg_centertime; vmCvar_t cg_runpitch; @@ -226,6 +229,9 @@ static cvarTable_t cvarTable[] = { { &cg_simpleItems, "cg_simpleItems", "0", CVAR_ARCHIVE }, { &cg_addMarks, "cg_marks", "1", CVAR_ARCHIVE }, { &cg_lagometer, "cg_lagometer", "1", CVAR_ARCHIVE }, + { &cg_teslaTrailTime, "cg_teslaTrailTime", "400", CVAR_ARCHIVE }, + { &cg_teslaSegments, "cg_teslaSegments", "8", CVAR_ARCHIVE }, + { &cg_teslaDeviation, "cg_teslaDeviation", "8", CVAR_ARCHIVE }, { &cg_railTrailTime, "cg_railTrailTime", "400", CVAR_ARCHIVE }, { &cg_gun_x, "cg_gunX", "0", CVAR_CHEAT }, { &cg_gun_y, "cg_gunY", "0", CVAR_CHEAT }, diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index fc425d7f..64b36c96 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -291,6 +291,71 @@ void CG_RailTrail( vec3_t start, vec3_t end ) /* ========================== +CG_TeslaTrail +========================== +*/ +void CG_TeslaTrail( vec3_t start, vec3_t end ) +{ + int i; + vec3_t seg_start, seg_end, delta, dir, perpen, tangent; + float distance; + + localEntity_t *le; + refEntity_t *re; + + start[ 2 ] += 12; //nudge up a bit so the bolt comes from the sphere + + VectorCopy( start, seg_start ); + VectorSubtract( end, start, delta ); + distance = VectorLength( delta ); + VectorNormalize2( delta, dir ); + PerpendicularVector( perpen, dir ); + + //add a bunch of bolt segments + for( i = 1; i <= cg_teslaSegments.integer; i++ ) + { + le = CG_AllocLocalEntity(); + re = &le->refEntity; + + le->leType = LE_FADE_RGB; + le->startTime = cg.time; + le->endTime = cg.time + cg_teslaTrailTime.value; + le->lifeRate = 1.0 / ( le->endTime - le->startTime ); + + re->shaderTime = cg.time / 1000.0f; + re->reType = RT_RAIL_CORE; + re->customShader = cgs.media.lightningShader; + + VectorCopy( seg_start, re->origin ); + + if( i != cg_teslaSegments.integer ) + { + VectorMA( start, i * ( distance / cg_teslaSegments.integer ), dir, seg_end ); + RotatePointAroundVector( tangent, dir, perpen, rand( ) % 360 ); + VectorMA( seg_end, cg_teslaDeviation.value * random( ), tangent, seg_end ); + } + else + VectorCopy( end, seg_end ); + + VectorCopy( seg_end, re->oldorigin ); + VectorCopy( seg_end, seg_start ); + + re->shaderRGBA[0] = 255; + re->shaderRGBA[1] = 255; + re->shaderRGBA[2] = 255; + re->shaderRGBA[3] = 255; + + le->color[0] = 1.0f; + le->color[1] = 1.0f; + le->color[2] = 1.0f; + le->color[3] = 1.0f; + + AxisClear( re->axis ); + } +} + +/* +========================== CG_RocketTrail ========================== */ @@ -626,13 +691,13 @@ void CG_RegisterWeapon( int weaponNum ) { weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse ); break; - case WP_LIGHTNING: + case WP_TESLAGEN: 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 ); weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/lightning/lg_fire.wav", qfalse ); - cgs.media.lightningShader = trap_R_RegisterShader( "lightningBoltNew"); + cgs.media.lightningShader = trap_R_RegisterShader( "models/ammo/tesla/tesla_bolt"); cgs.media.lightningExplosionModel = trap_R_RegisterModel( "models/weaphits/crackle.md3" ); cgs.media.sfx_lghit1 = trap_S_RegisterSound( "sound/weapons/lightning/lg_hit.wav", qfalse ); cgs.media.sfx_lghit2 = trap_S_RegisterSound( "sound/weapons/lightning/lg_hit2.wav", qfalse ); @@ -955,7 +1020,7 @@ static void CG_LightningBolt( centity_t *cent, vec3_t origin ) { vec3_t forward; vec3_t muzzlePoint, endPoint; - if ( cent->currentState.weapon != WP_LIGHTNING ) { + if ( cent->currentState.weapon != WP_TESLAGEN ) { return; } @@ -1233,7 +1298,7 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent } // add the flash - if ( ( weaponNum == WP_LIGHTNING || weaponNum == WP_GAUNTLET || weaponNum == WP_GRAPPLING_HOOK ) + if ( ( weaponNum == WP_TESLAGEN || weaponNum == WP_GAUNTLET || weaponNum == WP_GRAPPLING_HOOK ) && ( nonPredictedCent->currentState.eFlags & EF_FIRING ) ) { // continuous flash @@ -1727,7 +1792,7 @@ void CG_FireWeapon( centity_t *cent ) { cent->muzzleFlashTime = cg.time; // lightning gun only does this this on initial press - if ( ent->weapon == WP_LIGHTNING ) { + if ( ent->weapon == WP_TESLAGEN ) { if ( cent->pe.lightningFiring ) { return; } @@ -1798,7 +1863,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im switch ( weapon ) { default: - case WP_LIGHTNING: + case WP_TESLAGEN: // no explosion at LG impact, it is added with the beam r = rand() & 3; if ( r < 2 ) { diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 9d0d288b..fdc371e0 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -450,29 +450,27 @@ gitem_t bg_itemlist[] = "" },*/ -/*QUAKED weapon_lightning (.3 .3 1) (-16 -16 -16) (16 16 16) suspended +/*QUAKED weapon_teslagen (.3 .3 1) (-16 -16 -16) (16 16 16) suspended */ - /*{ - "weapon_lightning", + { + "weapon_teslagen", "sound/misc/w_pkup.wav", - { "models/weapons2/lightning/lightning.md3", - 0, 0, 0}, + { 0, 0, 0, 0}, "icons/iconw_lightning", - "Lightning Gun", + "Tesla Generator", 100, IT_WEAPON, - WP_LIGHTNING, + WP_TESLAGEN, "", "" - },*/ + }, /*QUAKED weapon_railgun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended */ { "weapon_railgun", "sound/misc/w_pkup.wav", - { "models/weapons2/railgun/railgun.md3", - 0, 0, 0}, + { 0, 0, 0, 0}, "icons/iconw_railgun", "Railgun", 10, @@ -981,11 +979,11 @@ TA: human defense item TA: human defense item */ { - "team_human_def3", + "team_human_tesla", "sound/items/holdable.wav", - { "models/buildables/plasmaturret/pturret_base.md3", 0, 0, 0 }, + { "models/buildables/tesla/tesla.md3", 0, 0, 0 }, "icons/teleporter", //icon - "Human Defense3", //pickup + "Human Tesla Generator", //pickup 0, IT_BUILDABLE, BA_H_DEF3, @@ -1511,10 +1509,10 @@ buildableAttributes_t bg_buildableList[ ] = }, { BA_H_DEF3, //int buildNum; - "railturret", //char *buildName; - "team_human_def3", //char *entityName; - { -24, -24, -11 }, //vec3_t mins; - { 24, 24, 11 }, //vec3_t maxs; + "tesla", //char *buildName; + "team_human_tesla", //char *entityName; + { -22, -22, -40 }, //vec3_t mins; + { 22, 22, 40 }, //vec3_t maxs; TR_GRAVITY, //trType_t traj; 0.0, //float bounce; 80, //int buildPoints; @@ -1529,7 +1527,7 @@ buildableAttributes_t bg_buildableList[ ] = 150, //int nextthink; 4000, //int turretFireSpeed; 1500, //int turretRange; - WP_LIGHTNING, //weapon_t turretProjType; + WP_TESLAGEN, //weapon_t turretProjType; 0.707f, //float minNormal; qfalse, //qboolean invertNormal; qfalse, //qboolean creepTest; @@ -3805,6 +3803,7 @@ char *eventnames[] = { "EV_MISSILE_MISS_METAL", "EV_ITEM_EXPLOSION", //TA: human item explosions "EV_RAILTRAIL", + "EV_TESLATRAIL", "EV_SHOTGUN", "EV_BULLET", // otherEntity is the shooter diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 8bad877c..fe307307 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2325,7 +2325,7 @@ static void PM_Weapon( void ) case WP_GAUNTLET: addTime = 400; break; - case WP_LIGHTNING: + case WP_TESLAGEN: addTime = 50; break; case WP_SHOTGUN: diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 4dbe2542..c96ef9e2 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -341,7 +341,7 @@ typedef enum WP_GRENADE_LAUNCHER, WP_ROCKET_LAUNCHER, WP_LOCKBLOB_LAUNCHER, - WP_LIGHTNING, + WP_TESLAGEN, WP_RAILGUN, WP_FLAMER, WP_PLASMAGUN, @@ -528,6 +528,7 @@ typedef enum { EV_MISSILE_MISS_METAL, EV_ITEM_EXPLOSION, //TA: human item explosions EV_RAILTRAIL, + EV_TESLATRAIL, EV_SHOTGUN, EV_BULLET, // otherEntity is the shooter diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 6bfdcc30..d4599572 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -566,13 +566,13 @@ void Weapon_HookThink (gentity_t *ent) /* ====================================================================== -LIGHTNING GUN +TESLA GENERATOR ====================================================================== */ -void Weapon_LightningFire( gentity_t *ent ) +void Weapon_TeslaFire( gentity_t *ent ) { trace_t tr; vec3_t end; @@ -600,7 +600,7 @@ void Weapon_LightningFire( gentity_t *ent ) SnapVectorTowards( tr.endpos, muzzle ); // send railgun beam effect - tent = G_TempEntity( tr.endpos, EV_RAILTRAIL ); + tent = G_TempEntity( tr.endpos, EV_TESLATRAIL ); // set player number for custom colors on the railtrail tent->s.clientNum = ent->s.clientNum; @@ -1050,8 +1050,8 @@ void FireWeapon2( gentity_t *ent ) case WP_GAUNTLET: Weapon_Gauntlet( ent ); break; - case WP_LIGHTNING: - Weapon_LightningFire( ent ); + case WP_TESLAGEN: + Weapon_TeslaFire( ent ); break; case WP_SHOTGUN: weapon_supershotgun_fire( ent ); @@ -1142,8 +1142,8 @@ void FireWeapon( gentity_t *ent ) case WP_GAUNTLET: Weapon_Gauntlet( ent ); break; - case WP_LIGHTNING: - Weapon_LightningFire( ent ); + case WP_TESLAGEN: + Weapon_TeslaFire( ent ); break; case WP_SHOTGUN: weapon_supershotgun_fire( ent ); diff --git a/src/ui/ui_players.c b/src/ui/ui_players.c index 7a0e0bdd..05c25808 100644 --- a/src/ui/ui_players.c +++ b/src/ui/ui_players.c @@ -101,7 +101,7 @@ tryagain: MAKERGB( pi->flashDlightColor, 1, 0.75f, 0 ); break; - case WP_LIGHTNING: + case WP_TESLAGEN: MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 ); break; |