mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-02-02 14:42:41 +00:00
Items are placed on the ground using their actual bounding box, not magic numbers. Added cg_RQ3_strobeColor cvar (defaults to 1 - red).
This commit is contained in:
parent
03a12dc526
commit
10a96d467b
3 changed files with 43 additions and 27 deletions
|
@ -437,6 +437,10 @@ static void CG_Item(centity_t * cent)
|
||||||
weaponInfo_t *wi;
|
weaponInfo_t *wi;
|
||||||
itemInfo_t *itemInfo;
|
itemInfo_t *itemInfo;
|
||||||
|
|
||||||
|
int boundIndex = 0;
|
||||||
|
float offsetMul = 1.f;
|
||||||
|
int boundAxis = 2;
|
||||||
|
|
||||||
es = ¢->currentState;
|
es = ¢->currentState;
|
||||||
if (es->modelindex >= bg_numItems) {
|
if (es->modelindex >= bg_numItems) {
|
||||||
CG_Error("Bad item index %i on entity", es->modelindex);
|
CG_Error("Bad item index %i on entity", es->modelindex);
|
||||||
|
@ -530,23 +534,21 @@ static void CG_Item(centity_t * cent)
|
||||||
cent->lerpOrigin[1] -=
|
cent->lerpOrigin[1] -=
|
||||||
wi->weaponMidpoint[0] * ent.axis[0][1] +
|
wi->weaponMidpoint[0] * ent.axis[0][1] +
|
||||||
wi->weaponMidpoint[1] * ent.axis[1][1] + wi->weaponMidpoint[2] * ent.axis[2][1];
|
wi->weaponMidpoint[1] * ent.axis[1][1] + wi->weaponMidpoint[2] * ent.axis[2][1];
|
||||||
|
// Makro - did we really need this?
|
||||||
|
/*
|
||||||
cent->lerpOrigin[2] -=
|
cent->lerpOrigin[2] -=
|
||||||
wi->weaponMidpoint[0] * ent.axis[0][2] +
|
wi->weaponMidpoint[0] * ent.axis[0][2] +
|
||||||
wi->weaponMidpoint[1] * ent.axis[1][2] + wi->weaponMidpoint[2] * ent.axis[2][2];
|
wi->weaponMidpoint[1] * ent.axis[1][2] + wi->weaponMidpoint[2] * ent.axis[2][2];
|
||||||
//Blaze: Dont raise the weapon, but lower it
|
*/
|
||||||
//Elder: don't lower knives by much - this is bad hardcode but oh well
|
|
||||||
if (item->giTag == WP_KNIFE)
|
|
||||||
cent->lerpOrigin[2] -= 10;
|
|
||||||
else
|
|
||||||
cent->lerpOrigin[2] -= 14;
|
|
||||||
|
|
||||||
// cent->lerpOrigin[2] += 8; // an extra height boost
|
|
||||||
|
|
||||||
if (es->pos.trDelta[0] == 0 && es->pos.trDelta[1] == 0 && es->pos.trDelta[2] == 0) {
|
if (es->pos.trDelta[0] == 0 && es->pos.trDelta[1] == 0 && es->pos.trDelta[2] == 0) {
|
||||||
// Blaze: rotate the gun by 90 degrees to place it on the ground
|
// Blaze: rotate the gun by 90 degrees to place it on the ground
|
||||||
VectorCopy(ent.axis[1], myvec);
|
VectorCopy(ent.axis[1], myvec);
|
||||||
VectorNegate(ent.axis[2], ent.axis[1]);
|
VectorNegate(ent.axis[2], ent.axis[1]);
|
||||||
VectorCopy(myvec, ent.axis[2]);
|
VectorCopy(myvec, ent.axis[2]);
|
||||||
|
boundIndex = 1;
|
||||||
|
boundAxis = 1;
|
||||||
|
offsetMul = -1.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// JBravo: world skins
|
// JBravo: world skins
|
||||||
|
@ -561,12 +563,6 @@ static void CG_Item(centity_t * cent)
|
||||||
ent.customSkin = itemInfo->customSkin;
|
ent.customSkin = itemInfo->customSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Elder: ammo offset?
|
|
||||||
if (item->giType == IT_AMMO)
|
|
||||||
cent->lerpOrigin[2] -= 12;
|
|
||||||
else if (item->giType == IT_HOLDABLE)
|
|
||||||
cent->lerpOrigin[2] -= 12;
|
|
||||||
|
|
||||||
ent.hModel = cg_items[es->modelindex].models[0];
|
ent.hModel = cg_items[es->modelindex].models[0];
|
||||||
|
|
||||||
VectorCopy(cent->lerpOrigin, ent.origin);
|
VectorCopy(cent->lerpOrigin, ent.origin);
|
||||||
|
@ -608,9 +604,22 @@ static void CG_Item(centity_t * cent)
|
||||||
VectorScale(ent.axis[1], scale, ent.axis[1]);
|
VectorScale(ent.axis[1], scale, ent.axis[1]);
|
||||||
VectorScale(ent.axis[2], scale, ent.axis[2]);
|
VectorScale(ent.axis[2], scale, ent.axis[2]);
|
||||||
|
|
||||||
|
// Makro - offset based on bounding box, not magic numbers
|
||||||
|
{
|
||||||
|
vec3_t bound[2];
|
||||||
|
float offset;
|
||||||
|
|
||||||
|
trap_R_ModelBounds(ent.hModel, bound[0], bound[1]);
|
||||||
|
offset = -ITEM_RADIUS - bound[boundIndex][boundAxis] * offsetMul * scale;
|
||||||
|
|
||||||
// Makro - nudge them up a bit
|
// Makro - nudge them up a bit
|
||||||
// the strobe effect looks a lot better if it isn't clipped by the ground
|
// the strobe effect looks a lot better if it isn't clipped by the ground
|
||||||
ent.origin[2] += 0.5f;
|
// Note - magic number :)
|
||||||
|
offset += 0.5f;
|
||||||
|
|
||||||
|
ent.origin[2] += offset;
|
||||||
|
ent.oldorigin[2] += offset;
|
||||||
|
}
|
||||||
|
|
||||||
// add strobe effect -- should make this toggle?
|
// add strobe effect -- should make this toggle?
|
||||||
// NiceAss: Temp Cvar usage for strobe shader.
|
// NiceAss: Temp Cvar usage for strobe shader.
|
||||||
|
@ -628,21 +637,23 @@ static void CG_Item(centity_t * cent)
|
||||||
refEntity_t glow = ent;
|
refEntity_t glow = ent;
|
||||||
float frac = 1.f - sqrt(dist) * (1.f / MAX_DIST);
|
float frac = 1.f - sqrt(dist) * (1.f / MAX_DIST);
|
||||||
const float freq = 1.f;
|
const float freq = 1.f;
|
||||||
|
vec4_t color;
|
||||||
|
|
||||||
frac *= frac;
|
frac *= frac;
|
||||||
|
|
||||||
// Note: sadly, this looks different depending on overbright bits
|
VectorCopy(g_color_table[cg_RQ3_strobeColor.integer % ARRAY_LEN(g_color_table)], color);
|
||||||
// 96 was picked to look good with OBB on
|
|
||||||
glow.customShader = cgs.media.itemStrobeShader;
|
|
||||||
glow.shaderRGBA[0] = glow.shaderRGBA[1] = 96;
|
|
||||||
glow.shaderRGBA[2] = 0;
|
|
||||||
|
|
||||||
// Makro - constant alpha for values >= 2, otherwise pulse
|
// Makro - constant alpha for values >= 2, otherwise pulse
|
||||||
if (cg_RQ3_strobe.integer > 1)
|
if (cg_RQ3_strobe.integer > 1)
|
||||||
glow.shaderRGBA[3] = (int)Com_Clamp(0.f, 255.f, frac * 255.f);
|
color[3] = Com_Clamp(0.f, 1.f, frac);
|
||||||
else
|
else
|
||||||
glow.shaderRGBA[3] = (int)Com_Clamp(0.f, 255.f, frac * 255.f * (sin(freq * 2.f * M_PI * cg.time / 1000.f) * 0.5 + 0.5));
|
color[3] = Com_Clamp(0.f, 1.f, frac * (sin(freq * 2.f * M_PI * cg.time / 1000.f) * 0.5f + 0.5f));
|
||||||
|
|
||||||
|
glow.shaderRGBA[0] = (int) (color[0] * 255.f + 0.5f);
|
||||||
|
glow.shaderRGBA[1] = (int) (color[1] * 255.f + 0.5f);
|
||||||
|
glow.shaderRGBA[2] = (int) (color[2] * 255.f + 0.5f);
|
||||||
|
glow.shaderRGBA[3] = (int) (color[3] * 255.f + 0.5f);
|
||||||
|
glow.customShader = cgs.media.itemStrobeShader;
|
||||||
trap_R_AddRefEntityToScene(&glow);
|
trap_R_AddRefEntityToScene(&glow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1968,6 +1968,8 @@ extern vmCvar_t cg_RQ3_bloodStyle;
|
||||||
|
|
||||||
//NiceAss: strobing weapons/items like quake 2
|
//NiceAss: strobing weapons/items like quake 2
|
||||||
extern vmCvar_t cg_RQ3_strobe;
|
extern vmCvar_t cg_RQ3_strobe;
|
||||||
|
// Makro - added color
|
||||||
|
extern vmCvar_t cg_RQ3_strobeColor;
|
||||||
extern vmCvar_t cg_RQ3_predictWeapons;
|
extern vmCvar_t cg_RQ3_predictWeapons;
|
||||||
|
|
||||||
//Makro - left-handed weapons
|
//Makro - left-handed weapons
|
||||||
|
|
|
@ -621,6 +621,8 @@ vmCvar_t cg_RQ3_bloodStyle;
|
||||||
|
|
||||||
//NiceAss: Temporary boolean strobe cvar
|
//NiceAss: Temporary boolean strobe cvar
|
||||||
vmCvar_t cg_RQ3_strobe;
|
vmCvar_t cg_RQ3_strobe;
|
||||||
|
// Makro - added color
|
||||||
|
vmCvar_t cg_RQ3_strobeColor;
|
||||||
|
|
||||||
//NiceAss: Predict weapon animations or not. Makes it like Q2 if disabled.
|
//NiceAss: Predict weapon animations or not. Makes it like Q2 if disabled.
|
||||||
vmCvar_t cg_RQ3_predictWeapons;
|
vmCvar_t cg_RQ3_predictWeapons;
|
||||||
|
@ -877,6 +879,7 @@ static cvarTable_t cvarTable[] = { // bk001129
|
||||||
{&cg_RQ3_flash, "cg_RQ3_flash", "1", CVAR_ARCHIVE},
|
{&cg_RQ3_flash, "cg_RQ3_flash", "1", CVAR_ARCHIVE},
|
||||||
// NiceAss: added
|
// NiceAss: added
|
||||||
{&cg_RQ3_strobe, "cg_RQ3_strobe", "1", CVAR_ARCHIVE},
|
{&cg_RQ3_strobe, "cg_RQ3_strobe", "1", CVAR_ARCHIVE},
|
||||||
|
{&cg_RQ3_strobeColor, "cg_RQ3_strobeColor", "1", CVAR_ARCHIVE},
|
||||||
{&cg_RQ3_painblend, "cg_RQ3_painblend", "1", CVAR_ARCHIVE},
|
{&cg_RQ3_painblend, "cg_RQ3_painblend", "1", CVAR_ARCHIVE},
|
||||||
//Slicer: no longer being used
|
//Slicer: no longer being used
|
||||||
//{&cg_RQ3_ssgZoomAssist, "cg_RQ3_ssgZoomAssist", "1", CVAR_ARCHIVE},
|
//{&cg_RQ3_ssgZoomAssist, "cg_RQ3_ssgZoomAssist", "1", CVAR_ARCHIVE},
|
||||||
|
|
Loading…
Reference in a new issue