[quake3-commits] r2064 - in trunk/code: cgame qcommon
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Jun 28 04:28:12 EDT 2011
Author: thilo
Date: 2011-06-28 04:28:12 -0400 (Tue, 28 Jun 2011)
New Revision: 2064
Modified:
trunk/code/cgame/cg_ents.c
trunk/code/cgame/cg_local.h
trunk/code/cgame/cg_players.c
trunk/code/cgame/cg_weapons.c
trunk/code/qcommon/q_shared.h
Log:
More color fixes for railgun
Show other players' railgun color and their firetime state.
Show snapshot client's color on world item models of railgun.
Fix the impact mark using color2 (spiral) rather than color1 (beam).
Credits go to Ensiform and Harekiet for the refire portion.
Modified: trunk/code/cgame/cg_ents.c
===================================================================
--- trunk/code/cgame/cg_ents.c 2011-06-27 23:53:40 UTC (rev 2063)
+++ trunk/code/cgame/cg_ents.c 2011-06-28 08:28:12 UTC (rev 2064)
@@ -294,6 +294,11 @@
cent->lerpOrigin[2] += 8; // an extra height boost
}
+
+ if( item->giType == IT_WEAPON && item->giTag == WP_RAILGUN ) {
+ clientInfo_t *ci = &cgs.clientinfo[cg.snap->ps.clientNum];
+ Byte4Copy( ci->c1RGBA, ent.shaderRGBA );
+ }
ent.hModel = cg_items[es->modelindex].models[0];
Modified: trunk/code/cgame/cg_local.h
===================================================================
--- trunk/code/cgame/cg_local.h 2011-06-27 23:53:40 UTC (rev 2063)
+++ trunk/code/cgame/cg_local.h 2011-06-28 08:28:12 UTC (rev 2064)
@@ -154,6 +154,8 @@
vec3_t railgunImpact;
qboolean railgunFlash;
+ int railFireTime;
+
// machinegun spinning
float barrelAngle;
int barrelTime;
@@ -320,6 +322,9 @@
vec3_t color1;
vec3_t color2;
+
+ byte c1RGBA[4];
+ byte c2RGBA[4];
int score; // updated by score servercmds
int location; // location index for team mode
Modified: trunk/code/cgame/cg_players.c
===================================================================
--- trunk/code/cgame/cg_players.c 2011-06-27 23:53:40 UTC (rev 2063)
+++ trunk/code/cgame/cg_players.c 2011-06-28 08:28:12 UTC (rev 2064)
@@ -900,9 +900,19 @@
v = Info_ValueForKey( configstring, "c1" );
CG_ColorFromString( v, newInfo.color1 );
+ newInfo.c1RGBA[0] = 255 * newInfo.color1[0];
+ newInfo.c1RGBA[1] = 255 * newInfo.color1[1];
+ newInfo.c1RGBA[2] = 255 * newInfo.color1[2];
+ newInfo.c1RGBA[3] = 255;
+
v = Info_ValueForKey( configstring, "c2" );
CG_ColorFromString( v, newInfo.color2 );
+ newInfo.c2RGBA[0] = 255 * newInfo.color2[0];
+ newInfo.c2RGBA[1] = 255 * newInfo.color2[1];
+ newInfo.c2RGBA[2] = 255 * newInfo.color2[2];
+ newInfo.c2RGBA[3] = 255;
+
// bot skill
v = Info_ValueForKey( configstring, "skill" );
newInfo.botSkill = atoi( v );
Modified: trunk/code/cgame/cg_weapons.c
===================================================================
--- trunk/code/cgame/cg_weapons.c 2011-06-27 23:53:40 UTC (rev 2063)
+++ trunk/code/cgame/cg_weapons.c 2011-06-28 08:28:12 UTC (rev 2064)
@@ -1253,21 +1253,18 @@
gun.renderfx = parent->renderfx;
// set custom shading for railgun refire rate
- if ( ps || cent->currentState.clientNum == cg.predictedPlayerState.clientNum ) {
- if ( cg.predictedPlayerState.weapon == WP_RAILGUN
- && cg.predictedPlayerState.weaponstate == WEAPON_FIRING ) {
- float f;
-
- f = (float)cg.predictedPlayerState.weaponTime / 1500;
- gun.shaderRGBA[1] = 0;
- gun.shaderRGBA[0] =
- gun.shaderRGBA[2] = 255 * ( 1.0 - f );
- } else {
- gun.shaderRGBA[0] = 255;
- gun.shaderRGBA[1] = 255;
- gun.shaderRGBA[2] = 255;
+ if( weaponNum == WP_RAILGUN ) {
+ clientInfo_t *ci = &cgs.clientinfo[cent->currentState.clientNum];
+ if( cent->pe.railFireTime + 1500 > cg.time ) {
+ int scale = 255 * ( cg.time - cent->pe.railFireTime ) / 1500;
+ gun.shaderRGBA[0] = ( ci->c1RGBA[0] * scale ) >> 8;
+ gun.shaderRGBA[1] = ( ci->c1RGBA[1] * scale ) >> 8;
+ gun.shaderRGBA[2] = ( ci->c1RGBA[2] * scale ) >> 8;
gun.shaderRGBA[3] = 255;
}
+ else {
+ Byte4Copy( ci->c1RGBA, gun.shaderRGBA );
+ }
}
gun.hModel = weapon->weaponModel;
@@ -1743,6 +1740,10 @@
}
}
+ if( ent->weapon == WP_RAILGUN ) {
+ cent->pe.railFireTime = cg.time;
+ }
+
// play quad sound if needed
if ( cent->currentState.powerups & ( 1 << PW_QUAD ) ) {
trap_S_StartSound (NULL, cent->currentState.number, CHAN_ITEM, cgs.media.quadSound );
@@ -1978,7 +1979,7 @@
float *color;
// colorize with client color
- color = cgs.clientinfo[clientNum].color2;
+ color = cgs.clientinfo[clientNum].color1;
CG_ImpactMark( mark, origin, dir, random()*360, color[0],color[1], color[2],1, alphaFade, radius, qfalse );
} else {
CG_ImpactMark( mark, origin, dir, random()*360, 1,1,1,1, alphaFade, radius, qfalse );
Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h 2011-06-27 23:53:40 UTC (rev 2063)
+++ trunk/code/qcommon/q_shared.h 2011-06-28 08:28:12 UTC (rev 2064)
@@ -545,6 +545,8 @@
#define VectorSet(v, x, y, z) ((v)[0]=(x), (v)[1]=(y), (v)[2]=(z))
#define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
+#define Byte4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
+
#define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));}
// just in case you do't want to use the macros
vec_t _DotProduct( const vec3_t v1, const vec3_t v2 );
More information about the quake3-commits
mailing list