Support for left-handed weapons

This commit is contained in:
Andrei Drexler 2009-08-22 21:37:18 +00:00
parent e6702a4fe3
commit c527b22861
7 changed files with 25 additions and 9 deletions

View File

@ -509,7 +509,7 @@ static void CG_DrawStatusBar(void)
static float hcolors[3][4] = {
{1.0f, 1.0f, 1.0f, 1.0f},
{1.0f, 1.0f, 0.0f, 1.0f},
{1.0f, 0.0f, 0.0f, 1.0f}
{0.8f, 0.0f, 0.0f, 1.0f}
};
cent = &cg_entities[cg.snap->ps.clientNum];

View File

@ -1949,7 +1949,7 @@ extern vmCvar_t cg_RQ3_strobe;
extern vmCvar_t cg_RQ3_predictWeapons;
//Makro - left-handed weapons
//extern vmCvar_t cg_RQ3_leftHanded;
extern vmCvar_t cg_RQ3_leftHanded;
//Makro - sun flares
extern vmCvar_t cg_RQ3_flareIntensity;
//Makro - ssg crosshair size

View File

@ -628,7 +628,7 @@ vmCvar_t cg_RQ3_predictWeapons;
//Makro - left-handed models
//vmCvar_t cg_RQ3_leftHanded;
vmCvar_t cg_RQ3_leftHanded;
//Makro - dev tools
/*
@ -919,7 +919,7 @@ static cvarTable_t cvarTable[] = { // bk001129
{&cg_oldPlasma, "cg_oldPlasma", "1", CVAR_ARCHIVE},
{&cg_trueLightning, "cg_trueLightning", "0.0", CVAR_ARCHIVE},
//Makro - left-handed weapons
//{&cg_RQ3_leftHanded, "cg_RQ3_leftHanded", "0", CVAR_ARCHIVE},
{&cg_RQ3_leftHanded, "cg_RQ3_leftHanded", "0", CVAR_ARCHIVE},
//Makro - dev tool
/*
{&cg_RQ3_angle0, "cg_RQ3_angle0", "0", 0},

View File

@ -1781,13 +1781,11 @@ void CG_AddViewWeapon(playerState_t * ps)
hand.backlerp = 0;
hand.hModel = weapon->handsModel;
hand.renderfx = RF_DEPTHHACK | RF_FIRST_PERSON | RF_MINLIGHT;
/*
hand.nonNormalizedAxes = qtrue;
if (cg_RQ3_leftHanded.integer)
{
VectorNegate(hand.axis[1], hand.axis[1]);
}
*/
// add everything onto the hand
CG_AddPlayerWeapon(&hand, ps, &cg.predictedPlayerEntity, ps->persistant[PERS_TEAM]);

View File

@ -76,6 +76,7 @@ typedef struct {
qboolean needDlights; // true for bmodels that touch a dlight
qboolean lightingCalculated;
qboolean mirrored; // mirrored matrix, needs reversed culling
vec3_t lightDir; // normalized direction towards light
vec3_t ambientLight; // color normalized to 0-255
int ambientLightInt; // 32 bit rgba packed

View File

@ -207,6 +207,7 @@ RE_AddRefEntityToScene
=====================
*/
void RE_AddRefEntityToScene( const refEntity_t *ent ) {
vec3_t cross;
if ( !tr.registered ) {
return;
}
@ -219,6 +220,9 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) {
backEndData[tr.smpFrame]->entities[r_numentities].e = *ent;
backEndData[tr.smpFrame]->entities[r_numentities].lightingCalculated = qfalse;
CrossProduct(ent->axis[0], ent->axis[1], cross);
backEndData[tr.smpFrame]->entities[r_numentities].mirrored = (DotProduct(ent->axis[2], cross) < 0.f);
r_numentities++;
}

View File

@ -879,8 +879,21 @@ static void RB_SurfaceMesh(md3Surface_t *surface) {
indexes = surface->numTriangles * 3;
Bob = tess.numIndexes;
Doug = tess.numVertexes;
for (j = 0 ; j < indexes ; j++) {
tess.indexes[Bob + j] = Doug + triangles[j];
if (backEnd.currentEntity->mirrored) {
// Makro - this should be done differently, but since we're copying
// indices in a loop anyway (see below), reversing them in the same loop
// is practically free...
for (j = 0 ; j < indexes ; j += 3) {
tess.indexes[Bob + j + 0] = Doug + triangles[j + 0];
tess.indexes[Bob + j + 1] = Doug + triangles[j + 2];
tess.indexes[Bob + j + 2] = Doug + triangles[j + 1];
}
} else {
for (j = 0 ; j < indexes ; j++) {
tess.indexes[Bob + j] = Doug + triangles[j];
}
}
tess.numIndexes += indexes;