summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame')
-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
5 files changed, 136 insertions, 8 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;