summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_ents.c130
-rw-r--r--src/cgame/cg_event.c10
-rw-r--r--src/cgame/cg_local.h1
-rw-r--r--src/cgame/cg_main.c1
-rw-r--r--src/cgame/cg_weapons.c2
-rw-r--r--src/game/bg_public.h4
-rw-r--r--src/game/g_active.c4
-rw-r--r--src/game/g_buildable.c45
-rw-r--r--src/game/g_combat.c6
-rw-r--r--src/game/g_local.h5
-rw-r--r--src/game/g_misc.c5
11 files changed, 188 insertions, 25 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index 757a626a..cec42e78 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -388,6 +388,10 @@ static void CG_Buildable( centity_t *cent ) {
if ( es->modelindex >= bg_numItems ) {
CG_Error( "Bad item index %i on entity", es->modelindex );
}
+
+ //add creep
+ if( es->modelindex2 == BIT_DROIDS )
+ CG_Creep( cent );
// if set to invisible, skip
if ( !es->modelindex || ( es->eFlags & EF_NODRAW ) ) {
@@ -695,6 +699,9 @@ static void CG_Portal( centity_t *cent ) {
//============================================================================
+#define MAX_MARK_FRAGMENTS 128
+#define MAX_MARK_POINTS 384
+
/*
===============
CG_TorchLight
@@ -705,7 +712,122 @@ static void CG_TorchLight( centity_t *cent )
float r, g, b;
int i, j, k;
byte lum;
+ polyVert_t verts[ 4 ];
+ vec3_t square[ 4 ];
+ vec2_t tex[ 4 ];
+ float size;
+ trace_t tr;
+ vec3_t temp, origin, normal, projection, angles;
+ vec4_t axis[ 3 ], color;
+ markFragment_t markFragments[ MAX_MARK_FRAGMENTS ], *mf;
+ vec3_t markPoints[ MAX_MARK_POINTS ];
+ int numFragments;
+ float texCoordScale;
+
+
+ if( cent->currentState.frame == cg.predictedPlayerState.clientNum )
+ {
+ vec3_t to, from, forward, length;
+ float veclength;
+
+ VectorCopy( cg.predictedPlayerState.origin, from );
+ VectorCopy( cg.predictedPlayerState.viewangles, angles );
+
+ from[2] += cg.predictedPlayerState.viewheight;
+
+ AngleVectors( angles, forward, NULL, NULL );
+ VectorMA( from, 4096, forward, to );
+
+ CG_Trace( &tr, from, NULL, NULL, to, cg.predictedPlayerState.clientNum, MASK_SOLID );
+
+ VectorSubtract( tr.endpos, from, length );
+ veclength = VectorLength( length );
+
+ VectorMA( tr.endpos, -(veclength / 5), forward, origin );
+
+ //VectorCopy( cent->lerpOrigin, origin );
+ size = veclength / 2.0f;
+ if( size > 255 ) size = 255;
+ if( size < 0 ) size = 0;
+ }
+ else
+ {
+ VectorCopy( cent->lerpOrigin, origin );
+ VectorCopy( cent->lerpAngles, angles );
+
+ size = ( cent->currentState.constantLight >> 24 ) & 0xFF; //CREEP_BASESIZE / 2;
+ }
+
+ AngleVectors( angles, temp, NULL, NULL );
+ VectorMA( origin, 4096, temp, temp );
+
+ CG_Trace( &tr, origin, NULL, NULL, temp, cent->currentState.number, MASK_SOLID );
+ VectorCopy( tr.endpos, origin );
+ VectorCopy( tr.plane.normal, normal );
+
+ //slightly above surface
+ VectorMA( origin, 1, normal, origin );
+
+ texCoordScale = 0.5f / size;
+
+ //decide where the corners of the poly go
+ VectorNormalize2( normal, axis[0] );
+ PerpendicularVector( axis[1], axis[0] );
+ CrossProduct( axis[0], axis[1], axis[2] );
+
+ for ( i = 0 ; i < 3 ; i++ ) {
+ square[0][i] = origin[i] - size * axis[1][i] - size * axis[2][i];
+ square[1][i] = origin[i] - size * axis[1][i] + size * axis[2][i];
+ square[2][i] = origin[i] + size * axis[1][i] + size * axis[2][i];
+ square[3][i] = origin[i] + size * axis[1][i] - size * axis[2][i];
+ }
+
+ //set texture coordinates
+ Vector2Set( tex[ 0 ], 0, 0 );
+ Vector2Set( tex[ 1 ], 0, 1 );
+ Vector2Set( tex[ 2 ], 1, 1 );
+ Vector2Set( tex[ 3 ], 1, 0 );
+
+ VectorScale( normal, -20, projection );
+ numFragments = trap_CM_MarkFragments( 4, (void *)square,
+ projection, MAX_MARK_POINTS, markPoints[0],
+ MAX_MARK_FRAGMENTS, markFragments );
+
+ color[ 0 ] = 255;
+ color[ 1 ] = 255;
+ color[ 2 ] = 255;
+ color[ 3 ] = 255;
+
+ for ( i = 0, mf = markFragments ; i < numFragments ; i++, mf++ )
+ {
+ polyVert_t *v;
+ polyVert_t verts[MAX_VERTS_ON_POLY];
+ markPoly_t *mark;
+
+ // we have an upper limit on the complexity of polygons
+ // that we store persistantly
+ if ( mf->numPoints > MAX_VERTS_ON_POLY )
+ mf->numPoints = MAX_VERTS_ON_POLY;
+
+ for ( j = 0, v = verts ; j < mf->numPoints ; j++, v++ )
+ {
+ vec3_t delta;
+
+ VectorCopy( markPoints[ mf->firstPoint + j ], v->xyz );
+ VectorMA( v->xyz, 1, normal, v->xyz );
+
+ VectorSubtract( v->xyz, origin, delta );
+ v->st[0] = 0.5 + DotProduct( delta, axis[1] ) * texCoordScale;
+ v->st[1] = 0.5 + DotProduct( delta, axis[2] ) * texCoordScale;
+ *(int *)v->modulate = *(int *)color;
+ }
+
+ //trap_R_AddPolyToScene( cgs.media.humanTorch, mf->numPoints, verts );
+ trap_R_AddPolyToScene( cgs.media.humanTorch, mf->numPoints, verts );
+
+ }
+
r = ( (float)( cent->currentState.constantLight & 0xFF ) ) / 255.0;
g = ( (float)( ( cent->currentState.constantLight >> 8 ) & 0xFF ) ) / 255.0;
b = ( (float)( ( cent->currentState.constantLight >> 16 ) & 0xFF ) ) / 255.0;
@@ -725,8 +847,9 @@ static void CG_TorchLight( centity_t *cent )
b *= 1.0f - ( (float)lum / 64.0f );
}
- for( j = 0; j <= k; j++ )
- trap_R_AddLightToScene(cent->lerpOrigin, i*2, r, g, b );
+ /*for( j = 0; j <= k; j++ )
+ trap_R_AddLightToScene(cent->lerpOrigin, i*2, r, g, b );*/
+ //trap_R_AddLightToScene( origin, (int)size, r, g, b );
}
/*
@@ -886,9 +1009,6 @@ static void CG_AddCEntity( centity_t *cent ) {
case ET_BUILDABLE:
CG_Buildable( cent );
break;
- case ET_CREEP:
- CG_Creep( cent );
- break;
case ET_MISSILE:
CG_Missile( cent );
break;
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index eb92bd28..42ac22da 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -815,6 +815,12 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
DEBUGNAME("EV_ITEM_GROW");
cent->miscTime = cg.time; // scale up from this
break;
+
+ //TA: make droid creep "recede"
+ case EV_ITEM_RECEDE:
+ DEBUGNAME("EV_ITEM_RECEDE");
+ cent->miscTime = -cg.time; // scale down from this
+ break;
case EV_GRENADE_BOUNCE:
DEBUGNAME("EV_GRENADE_BOUNCE");
@@ -956,8 +962,8 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
CG_GibPlayer( cent->lerpOrigin );
break;
- case EV_GIB_GENERIC:
- DEBUGNAME("EV_GIB_GENERIC");
+ case EV_GIB_DROID:
+ DEBUGNAME("EV_GIB_DROID");
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.gibSound );
CG_GenericGib( cent->lerpOrigin );
break;
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 4874d0cf..3417ddfc 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -737,6 +737,7 @@ typedef struct {
qhandle_t explosionTrailShader;
qhandle_t humanNV;
+ qhandle_t humanTorch;
qhandle_t droidNav9;
qhandle_t droidNav8;
qhandle_t droidNav7;
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 0672442f..f1a2af5d 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -795,6 +795,7 @@ static void CG_RegisterGraphics( void ) {
//TA: screenfades
cgs.media.humanNV = trap_R_RegisterShader( "humanNV" );
+ cgs.media.humanTorch = trap_R_RegisterShader( "humanTorch" );
cgs.media.droidNav9 = trap_R_RegisterShader( "droidNav9" );
cgs.media.droidNav8 = trap_R_RegisterShader( "droidNav8" );
cgs.media.droidNav7 = trap_R_RegisterShader( "droidNav7" );
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index 6eab6c7c..777271c3 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -561,7 +561,7 @@ void CG_RegisterWeapon( int weaponNum ) {
case WP_FLAMER:
weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/plasma/lasfly.wav", qfalse );
MAKERGB( weaponInfo->flashDlightColor, 0.25, 0.1, 0 );
- weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/railgun/railgf1a.wav", qfalse );
+ //weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/railgun/railgf1a.wav", qfalse );
cgs.media.flameExplShader = trap_R_RegisterShader( "rocketExplosion" );
break;
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index a4e6ea46..0f53ef30 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -484,7 +484,8 @@ typedef enum {
EV_POWERUP_REGEN,
EV_GIB_PLAYER, // gib a previously living player
- EV_GIB_GENERIC, //TA: generic green gib for droids
+ EV_GIB_DROID, //TA: generic green gib for droids
+ EV_ITEM_RECEDE, //TA: sent when creep should recede
EV_DEBUG_LINE,
EV_STOPLOOPINGSOUND,
@@ -781,4 +782,5 @@ qboolean BG_gotWeapon( int weapon, int stats[ ] );*/
//TA: conceptually should live in q_shared.h
void AxisToAngles( vec3_t axis[3], vec3_t angles);
float arccos( float x );
+#define Vector2Set(v, x, y) ((v)[0]=(x), (v)[1]=(y))
diff --git a/src/game/g_active.c b/src/game/g_active.c
index e4a1ffbf..6b0c7218 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -737,7 +737,7 @@ void ClientThink_real( gentity_t *ent ) {
client->ps.speed = g_speed.value * client->classSpeed;
//TA: slow player if standing in creep
- for ( i = 1, creepNode = g_entities + i; i < level.num_entities; i++, creepNode++ )
+ /*for ( i = 1, creepNode = g_entities + i; i < level.num_entities; i++, creepNode++ )
{
if( !Q_stricmp( creepNode->classname, "team_droid_creep" ) )
{
@@ -753,7 +753,7 @@ void ClientThink_real( gentity_t *ent ) {
break;
}
}
- }
+ }*/
if( !cSlowed )
client->ps.stats[ STAT_STATE ] &= ~SS_CREEPSLOWED;
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 4a75366f..cc67c2eb 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -36,6 +36,27 @@ void nullDieFunction( gentity_t *self, gentity_t *inflictor, gentity_t *attacker
{
}
+/*
+================
+D_CreepRecede
+
+Called when an droid spawn dies
+================
+*/
+void D_CreepRecede( gentity_t *self )
+{
+ if( ( self->timestamp + 100 ) == level.time )
+ G_AddEvent( self, EV_ITEM_RECEDE, 0 );
+
+ if( ( self->timestamp + 10000 ) > level.time )
+ {
+ self->nextthink = level.time + 500;
+ trap_LinkEntity( self );
+ }
+ else
+ G_FreeEntity( self );
+}
+
/*
================
@@ -49,6 +70,9 @@ void DSpawn_Melt( gentity_t *self )
G_SelectiveRadiusDamage( self->s.pos.trBase, self->parent, 2,
self->splashRadius, self, self->splashMethodOfDeath, PTE_DROIDS );
+ if( ( self->timestamp + 500 ) == level.time )
+ G_AddEvent( self, EV_ITEM_RECEDE, 0 );
+
if( ( self->timestamp + 10000 ) > level.time )
{
self->nextthink = level.time + 500;
@@ -80,7 +104,7 @@ void DSpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
self->splashRadius, self, self->splashMethodOfDeath, PTE_DROIDS );
self->s.modelindex = 0; //don't draw the model once its destroyed
- G_AddEvent( self, EV_GIB_GENERIC, DirToByte( dir ) );
+ G_AddEvent( self, EV_GIB_DROID, DirToByte( dir ) );
self->r.contents = CONTENTS_TRIGGER;
self->timestamp = level.time;
self->die = nullDieFunction;
@@ -110,11 +134,14 @@ void DDef1_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
self->splashRadius, self, self->splashMethodOfDeath, PTE_DROIDS );
self->s.modelindex = 0; //don't draw the model once its destroyed
- G_AddEvent( self, EV_GIB_GENERIC, DirToByte( dir ) );
+ G_AddEvent( self, EV_GIB_DROID, DirToByte( dir ) );
self->r.contents = CONTENTS_TRIGGER;
self->timestamp = level.time;
- self->freeAfterEvent = qtrue;
self->die = nullDieFunction;
+ self->think = D_CreepRecede;
+ self->nextthink = level.time + 100;
+
+ trap_LinkEntity( self );
}
@@ -127,8 +154,10 @@ think function for Droid Spawn
*/
void DSpawn_Think( gentity_t *self )
{
- if( self->parentNode == NULL )
- self->parentNode = createCreepNode( self->s.origin );
+ /*if( self->parentNode == NULL )
+ self->parentNode = createCreepNode( self );
+
+ VectorCopy( self->s.origin, self->parentNode->s.origin );*/
self->nextthink = level.time + 100;
}
@@ -167,7 +196,7 @@ void DDef1_Think( gentity_t *self )
}
}
- if( minDistance <= CREEP_BASESIZE )
+ if( minDistance <= ( CREEP_BASESIZE * 3 ) )
self->parentNode = closestSpawn;
else
{
@@ -187,7 +216,7 @@ void DDef1_Think( gentity_t *self )
// Anthony "inolen" Pesch (www.inolen.com)
//with modifications by me of course :)
#define HDEF1_RANGE 500
-#define HDEF1_ANGULARSPEED 15
+#define HDEF1_ANGULARSPEED 10
#define HDEF1_FIRINGSPEED 200
#define HDEF1_ACCURACYTOLERANCE 10
#define HDEF1_VERTICALCAP 20
@@ -461,7 +490,7 @@ qboolean itemFits( gentity_t *ent, gitem_t *item, int distance )
if( !Q_stricmp( creepent->classname, "team_droid_spawn" ) )
{
VectorSubtract( entity_origin, creepent->s.origin, temp_v );
- if( VectorLength( temp_v ) <= CREEP_BASESIZE )
+ if( VectorLength( temp_v ) <= ( CREEP_BASESIZE * 3 ) )
{
nearcreep = qtrue;
break;
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 77b836f6..0f915e0a 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -326,7 +326,11 @@ GibEntity
==================
*/
void GibEntity( gentity_t *self, int killer ) {
- G_AddEvent( self, EV_GIB_PLAYER, killer );
+ if( self->client->ps.stats[ STAT_PCLASS ] == PTE_HUMANS )
+ G_AddEvent( self, EV_GIB_PLAYER, killer );
+ else
+ G_AddEvent( self, EV_GIB_DROID, killer );
+
self->takedamage = qfalse;
self->s.eType = ET_INVISIBLE;
self->r.contents = 0;
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 54d73c90..b7e02177 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -474,11 +474,6 @@ qboolean itemFits( gentity_t *ent, gitem_t *item, int distance );
gentity_t *Build_Item( gentity_t *ent, gitem_t *item, int distance );
//
-// g_creep.c
-//
-gentity_t *createCreepNode( vec3_t origin );
-
-//
// g_utils.c
//
int G_ModelIndex( char *name );
diff --git a/src/game/g_misc.c b/src/game/g_misc.c
index 60f5dd70..8b776118 100644
--- a/src/game/g_misc.c
+++ b/src/game/g_misc.c
@@ -118,6 +118,11 @@ void ShineTorch( gentity_t *self )
else
G_SetOrigin( self, to );
+ VectorCopy( angles, self->s.apos.trBase );
+
+ //so we can use the predicted values client side if available
+ self->s.frame = self->parent->s.number;
+
trap_LinkEntity( self );
}