summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_buildable.c17
-rw-r--r--src/cgame/cg_event.c8
-rw-r--r--src/cgame/cg_weapons.c20
-rw-r--r--src/game/bg_misc.c24
-rw-r--r--src/game/bg_public.h8
-rw-r--r--src/game/g_buildable.c15
-rw-r--r--src/game/g_combat.c4
-rw-r--r--src/game/g_weapon.c15
-rw-r--r--src/game/tremulous.h7
9 files changed, 100 insertions, 18 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index fd362f9d..4c1db197 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -340,7 +340,7 @@ static void CG_SetBuildableLerpFrameAnimation( buildable_t buildable, lerpFrame_
animation_t *anim;
lf->animationNumber = newAnimation;
- newAnimation &= ~ANIM_TOGGLEBIT;
+ newAnimation &= ~( ANIM_TOGGLEBIT|ANIM_FORCEBIT );
if( newAnimation < 0 || newAnimation >= MAX_BUILDABLE_ANIMATIONS )
CG_Error( "Bad animation number: %i", newAnimation );
@@ -478,9 +478,9 @@ static void CG_BuildableAnimation( centity_t *cent, int *old, int *now, float *b
if( cent->buildableAnim == BANIM_NONE )
cent->buildableAnim = es->torsoAnim;
- if( cent->oldBuildableAnim != es->legsAnim )
+ if( ( cent->oldBuildableAnim ^ es->legsAnim ) & ANIM_TOGGLEBIT )
{
- if( cent->buildableAnim == es->torsoAnim || es->legsAnim & ANIM_TOGGLEBIT )
+ if( cent->buildableAnim == es->torsoAnim || es->legsAnim & ANIM_FORCEBIT )
cent->buildableAnim = cent->oldBuildableAnim = es->legsAnim;
}
@@ -933,6 +933,17 @@ void CG_Buildable( centity_t *cent )
break;
}
+ if( cg.time - cent->muzzleFlashTime > MUZZLE_FLASH_TIME && es->eFlags & EF_FIRING )
+ {
+ weaponInfo_t *weapon = &cg_weapons[ es->weapon ];
+
+ if( weapon->flashDlightColor[ 0 ] || weapon->flashDlightColor[ 1 ] || weapon->flashDlightColor[ 2 ] )
+ {
+ trap_R_AddLightToScene( cent->lerpOrigin, 300 + ( rand( ) & 31 ), weapon->flashDlightColor[ 0 ],
+ weapon->flashDlightColor[ 1 ], weapon->flashDlightColor[ 2 ] );
+ }
+ }
+
//smoke etc for damaged buildables
CG_BuildableParticleEffects( cent );
}
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index fe3ebd24..087dafc1 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -96,7 +96,7 @@ static void CG_Obituary( entityState_t *ent )
case MOD_ASPAWN:
message = "was melted by the acid blood";
break;
- case MOD_MACHINEGUN:
+ case MOD_MGTURRET:
message = "was gunned down by a turret";
break;
case MOD_TESLAGEN:
@@ -199,6 +199,12 @@ static void CG_Obituary( entityState_t *ent )
case MOD_PRIFLE:
message = "was pulse rifled by";
break;
+ case MOD_MDRIVER:
+ message = "was mass driven by";
+ break;
+ case MOD_LASGUN:
+ message = "was lasgunned by";
+ break;
case MOD_FLAMER:
message = "was grilled by";
message2 = "'s flamer";
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index aeab2db3..343e359d 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -486,6 +486,7 @@ void CG_RegisterWeapon( int weaponNum )
switch( weaponNum )
{
case WP_MACHINEGUN:
+ case WP_MGTURRET:
case WP_CHAINGUN:
weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass;
break;
@@ -1518,7 +1519,20 @@ void CG_FireWeapon( centity_t *cent, int mode )
// do brass ejection
if( weap->ejectBrassFunc && cg_brassTime.integer > 0 )
- weap->ejectBrassFunc( cent );
+ {
+ if( ent->eType == ET_BUILDABLE )
+ {
+ //yucko hack to get turret brass ejecting with the barrel instead of the base
+ vec3_t temp;
+
+ VectorCopy( cent->lerpAngles, temp );
+ VectorCopy( ent->angles2, cent->lerpAngles );
+ weap->ejectBrassFunc( cent );
+ VectorCopy( temp, cent->lerpAngles );
+ }
+ else
+ weap->ejectBrassFunc( cent );
+ }
}
@@ -1529,7 +1543,8 @@ CG_MissileHitWall
Caused by an EV_MISSILE_MISS event, or directly by local bullet tracing
=================
*/
-void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, impactSound_t soundType, int damage ) {
+void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, impactSound_t soundType, int damage )
+{
qhandle_t mod;
qhandle_t mark;
qhandle_t shader;
@@ -1606,6 +1621,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im
break;
case WP_MACHINEGUN:
+ case WP_MGTURRET:
case WP_CHAINGUN:
case WP_LAS_GUN:
mod = cgs.media.bulletFlashModel;
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index bcb90316..0a9e2928 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -344,7 +344,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean usable;
MGTURRET_RANGE, //int turretRange;
MGTURRET_REPEAT, //int turretFireSpeed;
- WP_MACHINEGUN, //weapon_t turretProjType;
+ WP_MGTURRET, //weapon_t turretProjType;
0.95f, //float minNormal;
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
@@ -2624,6 +2624,28 @@ weaponAttributes_t bg_weapons[ ] =
WUT_ALIENS //WUTeam_t team;
},
{
+ WP_MGTURRET, //int weaponNum;
+ 0, //int price;
+ ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
+ SLOT_WEAPON, //int slots;
+ "mgturret", //char *weaponName;
+ "Machinegun Turret", //char *weaponHumanName;
+ 0, //int quan;
+ 0, //int clips;
+ 0, //int maxClips;
+ qtrue, //int infiniteAmmo;
+ qfalse, //int usesEnergy;
+ 0, //int repeatRate1;
+ 0, //int repeatRate2;
+ 0, //int repeatRate3;
+ 0, //int reloadTime;
+ qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean hasThirdMode;
+ qfalse, //qboolean purchasable;
+ 0, //int buildDelay;
+ WUT_HUMANS //WUTeam_t team;
+ },
+ {
WP_TESLAGEN, //int weaponNum;
0, //int price;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index ffeefc70..f2b63342 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -332,6 +332,7 @@ typedef enum
WP_LOCKBLOB_LAUNCHER,
WP_TESLAGEN,
+ WP_MGTURRET,
//build weapons must remain in a block
WP_ABUILD,
@@ -717,7 +718,8 @@ typedef struct animation_s
// flip the togglebit every time an animation
// changes so a restart of the same anim can be detected
-#define ANIM_TOGGLEBIT 128
+#define ANIM_TOGGLEBIT 0x80
+#define ANIM_FORCEBIT 0x40
typedef enum
@@ -782,6 +784,8 @@ typedef enum
MOD_MACHINEGUN,
MOD_CHAINGUN,
MOD_PRIFLE,
+ MOD_MDRIVER,
+ MOD_LASGUN,
MOD_LCANNON,
MOD_LCANNON_SPLASH,
MOD_FLAMER,
@@ -812,6 +816,8 @@ typedef enum
MOD_HSPAWN,
MOD_TESLAGEN,
+ MOD_MGTURRET,
+
MOD_ASPAWN,
MOD_ATUBE,
MOD_OVERMIND
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 8163bbf9..cb48dc21 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -25,7 +25,9 @@ void G_setBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim, qboolean fo
int localAnim = anim;
if( force )
- localAnim |= ANIM_TOGGLEBIT;
+ localAnim |= ANIM_FORCEBIT;
+
+ localAnim |= ( ( ent->s.legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT );
ent->s.legsAnim = localAnim;
}
@@ -1534,7 +1536,11 @@ void HTeslaGen_FireOnEnemy( gentity_t *self, int firespeed )
//fire at target
FireWeapon( self );
+
+ self->s.eFlags |= EF_FIRING;
+ G_AddEvent( self, EV_FIRE_WEAPON, 0 );
G_setBuildableAnim( self, BANIM_ATTACK1, qfalse );
+
self->count = level.time + firespeed;
}
@@ -1549,7 +1555,11 @@ void HMGTurret_FireOnEnemy( gentity_t *self, int firespeed )
{
//fire at target
FireWeapon( self );
+
+ self->s.eFlags |= EF_FIRING;
+ G_AddEvent( self, EV_FIRE_WEAPON, 0 );
G_setBuildableAnim( self, BANIM_ATTACK1, qfalse );
+
self->count = level.time + firespeed;
}
@@ -1640,6 +1650,9 @@ void HDef_Think( gentity_t *self )
self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
+ //used for client side muzzle flashes
+ self->s.eFlags &= ~EF_FIRING;
+
//if not powered don't do anything and check again for power next think
if( !( self->powered = findPower( self ) ) )
{
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 8c82dd2e..2410821b 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -118,6 +118,8 @@ char *modNames[ ] =
"MOD_MACHINEGUN",
"MOD_CHAINGUN",
"MOD_PRIFLE",
+ "MOD_MDRIVER",
+ "MOD_LASGUN",
"MOD_LCANNON",
"MOD_LCANNON_SPLASH",
"MOD_FLAMER",
@@ -148,6 +150,8 @@ char *modNames[ ] =
"MOD_HSPAWN",
"MOD_TESLAGEN",
+ "MOD_MGTURRET",
+
"MOD_ASPAWN",
"MOD_ATUBE",
"MOD_OVERMIND"
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index a7809263..79bd1cb7 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -151,7 +151,7 @@ void bulletFire( gentity_t *ent, float spread, int damage, int mod )
if( traceEnt->takedamage )
{
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
- damage, 0, MOD_MACHINEGUN );
+ damage, 0, mod );
}
}
@@ -188,7 +188,7 @@ void massDriverFire( gentity_t *ent )
if( traceEnt->takedamage )
{
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
- MDRIVER_DMG, 0, MOD_MACHINEGUN );
+ MDRIVER_DMG, 0, MOD_MDRIVER );
}
}
@@ -303,7 +303,7 @@ void lasGunFire( gentity_t *ent )
tent->s.otherEntityNum = ent->s.number;
if( traceEnt->takedamage )
- G_Damage( traceEnt, ent, ent, forward, tr.endpos, LASGUN_DAMAGE, 0, MOD_MACHINEGUN );
+ G_Damage( traceEnt, ent, ent, forward, tr.endpos, LASGUN_DAMAGE, 0, MOD_LASGUN );
}
/*
@@ -386,9 +386,7 @@ void teslaFire( gentity_t *ent )
trace_t tr;
vec3_t end;
gentity_t *traceEnt, *tent;
- int damage, i, passent;
-
- damage = 8;
+ int i, passent;
VectorMA( muzzle, TESLAGEN_RANGE, forward, end );
@@ -402,7 +400,7 @@ void teslaFire( gentity_t *ent )
if( traceEnt->takedamage)
{
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
- damage, 0, MOD_TESLAGEN );
+ TESLAGEN_DMG, 0, MOD_TESLAGEN );
}
// snap the endpos to integers to save net bandwidth, but nudged towards the line
@@ -1091,6 +1089,9 @@ void FireWeapon( gentity_t *ent )
case WP_TESLAGEN:
teslaFire( ent );
break;
+ case WP_MGTURRET:
+ bulletFire( ent, MGTURRET_SPREAD, MGTURRET_DMG, MOD_MGTURRET );
+ break;
case WP_ABUILD:
buildFire( ent, MN_A_BUILD );
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index 4bac0e4e..f9ec2ef3 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -421,17 +421,20 @@
#define MGTURRET_SPLASHDAMAGE 50
#define MGTURRET_SPLASHRADIUS 100
#define MGTURRET_ANGULARSPEED 5 //degrees/think ~= 200deg/sec
-#define MGTURRET_ACCURACYTOLERANCE MGTURRET_ANGULARSPEED / 2 //angular difference for turret to fire
+#define MGTURRET_ACCURACYTOLERANCE MGTURRET_ANGULARSPEED / 1.5f //angular difference for turret to fire
#define MGTURRET_VERTICALCAP 30 // +/- maximum pitch
#define MGTURRET_REPEAT 100
#define MGTURRET_RANGE 250
+#define MGTURRET_SPREAD 200
+#define MGTURRET_DMG HDM(5)
#define TESLAGEN_BP 100
#define TESLAGEN_HEALTH HBHM(200)
#define TESLAGEN_SPLASHDAMAGE 50
#define TESLAGEN_SPLASHRADIUS 100
#define TESLAGEN_REPEAT 500
-#define TESLAGEN_RANGE 1500
+#define TESLAGEN_RANGE 750
+#define TESLAGEN_DMG HDM(50)
#define DC_BP 80
#define DC_HEALTH HBHM(150)