From c52bfbd5a8d92034a91910c0f3e5d5bfbf5dbc4a Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Mon, 27 Jun 2011 23:53:40 +0000 Subject: [PATCH] All patches by Zack Middleton: - Bug 5057 - Two weapon number range checks allows invalid number - Bug 5058 - Railgun explosion cannot be colorized - Bug 5059 - Client's railgun does not glow in third person and mirror - Bug 5060 - Warning in RAVENMD4 R_GetAnimTag cross compiling with amd64-mingw32 --- code/cgame/cg_ents.c | 4 ++-- code/cgame/cg_weapons.c | 6 +++++- code/renderer/tr_model.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/code/cgame/cg_ents.c b/code/cgame/cg_ents.c index 58ec0f46..0f7e1067 100644 --- a/code/cgame/cg_ents.c +++ b/code/cgame/cg_ents.c @@ -410,7 +410,7 @@ static void CG_Missile( centity_t *cent ) { // int col; s1 = ¢->currentState; - if ( s1->weapon > WP_NUM_WEAPONS ) { + if ( s1->weapon >= WP_NUM_WEAPONS ) { s1->weapon = 0; } weapon = &cg_weapons[s1->weapon]; @@ -519,7 +519,7 @@ static void CG_Grapple( centity_t *cent ) { const weaponInfo_t *weapon; s1 = ¢->currentState; - if ( s1->weapon > WP_NUM_WEAPONS ) { + if ( s1->weapon >= WP_NUM_WEAPONS ) { s1->weapon = 0; } weapon = &cg_weapons[s1->weapon]; diff --git a/code/cgame/cg_weapons.c b/code/cgame/cg_weapons.c index 34622910..3b7738a9 100644 --- a/code/cgame/cg_weapons.c +++ b/code/cgame/cg_weapons.c @@ -1253,7 +1253,7 @@ 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 ) { + if ( ps || cent->currentState.clientNum == cg.predictedPlayerState.clientNum ) { if ( cg.predictedPlayerState.weapon == WP_RAILGUN && cg.predictedPlayerState.weaponstate == WEAPON_FIRING ) { float f; @@ -1963,6 +1963,10 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im if ( weapon == WP_RAILGUN ) { // colorize with client color VectorCopy( cgs.clientinfo[clientNum].color1, le->color ); + le->refEntity.shaderRGBA[0] = le->color[0] * 0xff; + le->refEntity.shaderRGBA[1] = le->color[1] * 0xff; + le->refEntity.shaderRGBA[2] = le->color[2] * 0xff; + le->refEntity.shaderRGBA[3] = 0xff; } } diff --git a/code/renderer/tr_model.c b/code/renderer/tr_model.c index c25c4bd2..64dd3567 100644 --- a/code/renderer/tr_model.c +++ b/code/renderer/tr_model.c @@ -1160,7 +1160,7 @@ void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, md3Tag_t // uncompressed model... // - frameSize = (long)( &((mdrFrame_t *)0)->bones[ mod->numBones ] ); + frameSize = (intptr_t)( &((mdrFrame_t *)0)->bones[ mod->numBones ] ); frame = (mdrFrame_t *)((byte *)mod + mod->ofsFrames + framenum * frameSize ); for (j = 0; j < 3; j++)