mirror of
https://github.com/UberGames/ioef.git
synced 2024-11-27 22:42:09 +00:00
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.
This commit is contained in:
parent
c52bfbd5a8
commit
53d89b6c10
5 changed files with 37 additions and 14 deletions
|
@ -294,6 +294,11 @@ static void CG_Item( centity_t *cent ) {
|
|||
|
||||
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];
|
||||
|
||||
|
|
|
@ -154,6 +154,8 @@ typedef struct {
|
|||
vec3_t railgunImpact;
|
||||
qboolean railgunFlash;
|
||||
|
||||
int railFireTime;
|
||||
|
||||
// machinegun spinning
|
||||
float barrelAngle;
|
||||
int barrelTime;
|
||||
|
@ -320,6 +322,9 @@ typedef struct {
|
|||
|
||||
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
|
||||
|
|
|
@ -900,9 +900,19 @@ void CG_NewClientInfo( int clientNum ) {
|
|||
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 );
|
||||
|
|
|
@ -1253,21 +1253,18 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
|
|||
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 @@ void CG_FireWeapon( centity_t *cent ) {
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im
|
|||
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 );
|
||||
|
|
|
@ -545,6 +545,8 @@ typedef struct {
|
|||
#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 );
|
||||
|
|
Loading…
Reference in a new issue