[quake3-commits] r1743 - trunk/code/cgame
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Nov 9 07:23:03 EST 2009
Author: thilo
Date: 2009-11-09 07:23:03 -0500 (Mon, 09 Nov 2009)
New Revision: 1743
Modified:
trunk/code/cgame/cg_event.c
trunk/code/cgame/cg_weapons.c
Log:
Zakk wisheth - Thilo answereth (#4070)
Use cg_drawWeapon 2/3 to make weapon left-handed/centered
Modified: trunk/code/cgame/cg_event.c
===================================================================
--- trunk/code/cgame/cg_event.c 2009-11-08 17:36:05 UTC (rev 1742)
+++ trunk/code/cgame/cg_event.c 2009-11-09 12:23:03 UTC (rev 1743)
@@ -923,8 +923,18 @@
case EV_RAILTRAIL:
DEBUGNAME("EV_RAILTRAIL");
cent->currentState.weapon = WP_RAILGUN;
+
+ if(es->clientNum == cg.snap->ps.clientNum && !cg.renderingThirdPerson)
+ {
+ if(cg_drawGun.integer == 2)
+ VectorMA(es->origin2, 8, cg.refdef.viewaxis[1], es->origin2);
+ else if(cg_drawGun.integer == 3)
+ VectorMA(es->origin2, 4, cg.refdef.viewaxis[1], es->origin2);
+ }
+
+ CG_RailTrail(ci, es->origin2, es->pos.trBase);
+
// if the end was on a nomark surface, don't make an explosion
- CG_RailTrail( ci, es->origin2, es->pos.trBase );
if ( es->eventParm != 255 ) {
ByteToDir( es->eventParm, dir );
CG_MissileHitWall( es->weapon, es->clientNum, position, dir, IMPACTSOUND_DEFAULT );
Modified: trunk/code/cgame/cg_weapons.c
===================================================================
--- trunk/code/cgame/cg_weapons.c 2009-11-08 17:36:05 UTC (rev 1742)
+++ trunk/code/cgame/cg_weapons.c 2009-11-09 12:23:03 UTC (rev 1743)
@@ -225,13 +225,6 @@
#define SPACING 5
start[2] -= 4;
- VectorCopy (start, move);
- VectorSubtract (end, start, vec);
- len = VectorNormalize (vec);
- PerpendicularVector(temp, vec);
- for (i = 0 ; i < 36; i++) {
- RotatePointAroundVector(axis[i], vec, temp, i * 10);//banshee 2.4 was 10
- }
le = CG_AllocLocalEntity();
re = &le->refEntity;
@@ -249,9 +242,9 @@
VectorCopy(end, re->oldorigin);
re->shaderRGBA[0] = ci->color1[0] * 255;
- re->shaderRGBA[1] = ci->color1[1] * 255;
- re->shaderRGBA[2] = ci->color1[2] * 255;
- re->shaderRGBA[3] = 255;
+ re->shaderRGBA[1] = ci->color1[1] * 255;
+ re->shaderRGBA[2] = ci->color1[2] * 255;
+ re->shaderRGBA[3] = 255;
le->color[0] = ci->color1[0] * 0.75;
le->color[1] = ci->color1[1] * 0.75;
@@ -260,60 +253,73 @@
AxisClear( re->axis );
- VectorMA(move, 20, vec, move);
- VectorCopy(move, next_move);
- VectorScale (vec, SPACING, vec);
-
- if (cg_oldRail.integer != 0) {
+ if (cg_oldRail.integer)
+ {
// nudge down a bit so it isn't exactly in center
re->origin[2] -= 8;
re->oldorigin[2] -= 8;
return;
}
+
+ VectorCopy (start, move);
+ VectorSubtract (end, start, vec);
+ len = VectorNormalize (vec);
+ PerpendicularVector(temp, vec);
+ for (i = 0 ; i < 36; i++)
+ {
+ RotatePointAroundVector(axis[i], vec, temp, i * 10);//banshee 2.4 was 10
+ }
+
+ VectorMA(move, 20, vec, move);
+ VectorCopy(move, next_move);
+ VectorScale (vec, SPACING, vec);
+
skip = -1;
j = 18;
- for (i = 0; i < len; i += SPACING) {
- if (i != skip) {
+ for (i = 0; i < len; i += SPACING)
+ {
+ if (i != skip)
+ {
skip = i + SPACING;
le = CG_AllocLocalEntity();
- re = &le->refEntity;
- le->leFlags = LEF_PUFF_DONT_SCALE;
+ re = &le->refEntity;
+ le->leFlags = LEF_PUFF_DONT_SCALE;
le->leType = LE_MOVE_SCALE_FADE;
- le->startTime = cg.time;
- le->endTime = cg.time + (i>>1) + 600;
- le->lifeRate = 1.0 / (le->endTime - le->startTime);
+ le->startTime = cg.time;
+ le->endTime = cg.time + (i>>1) + 600;
+ le->lifeRate = 1.0 / (le->endTime - le->startTime);
- re->shaderTime = cg.time / 1000.0f;
- re->reType = RT_SPRITE;
- re->radius = 1.1f;
+ re->shaderTime = cg.time / 1000.0f;
+ re->reType = RT_SPRITE;
+ re->radius = 1.1f;
re->customShader = cgs.media.railRingsShader;
- re->shaderRGBA[0] = ci->color2[0] * 255;
- re->shaderRGBA[1] = ci->color2[1] * 255;
- re->shaderRGBA[2] = ci->color2[2] * 255;
- re->shaderRGBA[3] = 255;
+ re->shaderRGBA[0] = ci->color2[0] * 255;
+ re->shaderRGBA[1] = ci->color2[1] * 255;
+ re->shaderRGBA[2] = ci->color2[2] * 255;
+ re->shaderRGBA[3] = 255;
- le->color[0] = ci->color2[0] * 0.75;
- le->color[1] = ci->color2[1] * 0.75;
- le->color[2] = ci->color2[2] * 0.75;
- le->color[3] = 1.0f;
+ le->color[0] = ci->color2[0] * 0.75;
+ le->color[1] = ci->color2[1] * 0.75;
+ le->color[2] = ci->color2[2] * 0.75;
+ le->color[3] = 1.0f;
- le->pos.trType = TR_LINEAR;
- le->pos.trTime = cg.time;
+ le->pos.trType = TR_LINEAR;
+ le->pos.trTime = cg.time;
VectorCopy( move, move2);
- VectorMA(move2, RADIUS , axis[j], move2);
- VectorCopy(move2, le->pos.trBase);
+ VectorMA(move2, RADIUS , axis[j], move2);
+ VectorCopy(move2, le->pos.trBase);
- le->pos.trDelta[0] = axis[j][0]*6;
- le->pos.trDelta[1] = axis[j][1]*6;
- le->pos.trDelta[2] = axis[j][2]*6;
+ le->pos.trDelta[0] = axis[j][0]*6;
+ le->pos.trDelta[1] = axis[j][1]*6;
+ le->pos.trDelta[2] = axis[j][2]*6;
}
- VectorAdd (move, vec, move);
+ VectorAdd (move, vec, move);
- j = j + ROTATION < 36 ? j + ROTATION : (j + ROTATION) % 36;
+ j = (j + ROTATION) % 36;
}
}
@@ -1227,7 +1233,7 @@
weapon_t weaponNum;
weaponInfo_t *weapon;
centity_t *nonPredictedCent;
-// int col;
+ orientation_t lerped;
weaponNum = cent->currentState.weapon;
@@ -1275,8 +1281,23 @@
}
}
- CG_PositionEntityOnTag( &gun, parent, parent->hModel, "tag_weapon");
+ trap_R_LerpTag(&lerped, parent->hModel, parent->oldframe, parent->frame,
+ 1.0 - parent->backlerp, "tag_weapon");
+ VectorCopy(parent->origin, gun.origin);
+ VectorMA(gun.origin, lerped.origin[0], parent->axis[0], gun.origin);
+
+ // Make weapon appear left-handed for 2 and centered for 3
+ if(ps && cg_drawGun.integer == 2)
+ VectorMA(gun.origin, -lerped.origin[1], parent->axis[1], gun.origin);
+ else if(!ps || cg_drawGun.integer != 3)
+ VectorMA(gun.origin, lerped.origin[1], parent->axis[1], gun.origin);
+
+ VectorMA(gun.origin, lerped.origin[2], parent->axis[2], gun.origin);
+
+ MatrixMultiply(lerped.axis, ((refEntity_t *)parent)->axis, gun.axis);
+ gun.backlerp = parent->backlerp;
+
CG_AddWeaponWithPowerups( &gun, cent->currentState.powerups );
// add the spinning barrel
More information about the quake3-commits
mailing list