From 433e81b98e31ef5914bf2a705f6b4e57aead0ac7 Mon Sep 17 00:00:00 2001 From: yumirak Date: Wed, 6 Mar 2024 17:46:18 +0700 Subject: [PATCH] cgame: add cg_itemFx bitmask. 1-bob 2-rotate 4-spawn scale --- code/cgame/cg_ents.c | 27 ++++++++++++++++++++------- code/cgame/cg_local.h | 3 ++- code/cgame/cg_main.c | 7 +++++++ 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/code/cgame/cg_ents.c b/code/cgame/cg_ents.c index 1b191eb95e..eec968a93e 100644 --- a/code/cgame/cg_ents.c +++ b/code/cgame/cg_ents.c @@ -268,17 +268,24 @@ static void CG_Item( centity_t *cent ) { // items bob up and down continuously scale = 0.005 + cent->currentState.number * 0.00001; - cent->lerpOrigin[2] += 4 + cos( ( cg.time + 1000 ) * scale ) * 4; + if (cg_itemFx.integer & 0x1) { + cent->lerpOrigin[2] += 4 + cos( ( cg.time + 1000 ) * scale ) * 4; + } memset (&ent, 0, sizeof(ent)); // autorotate at one of two speeds - if ( item->giType == IT_HEALTH ) { - VectorCopy( cg.autoAnglesFast, cent->lerpAngles ); - AxisCopy( cg.autoAxisFast, ent.axis ); + if (cg_itemFx.integer & 0x2) { + if ( item->giType == IT_HEALTH ) { + VectorCopy( cg.autoAnglesFast, cent->lerpAngles ); + AxisCopy( cg.autoAxisFast, ent.axis ); + } else { + VectorCopy( cg.autoAngles, cent->lerpAngles ); + AxisCopy( cg.autoAxis, ent.axis ); + } } else { - VectorCopy( cg.autoAngles, cent->lerpAngles ); - AxisCopy( cg.autoAxis, ent.axis ); + VectorCopy(cent->currentState.apos.trBase, cent->lerpAngles); + AnglesToAxis(cent->lerpAngles, ent.axis); } wi = NULL; @@ -317,14 +324,20 @@ static void CG_Item( centity_t *cent ) { // if just respawned, slowly scale up msec = cg.time - cent->miscTime; - if ( msec >= 0 && msec < ITEM_SCALEUP_TIME ) { + if (msec >= 0 && msec < ITEM_SCALEUP_TIME && cg_itemFx.integer & 0x4) { frac = (float)msec / ITEM_SCALEUP_TIME; + frac *= cg_itemSize.value; VectorScale( ent.axis[0], frac, ent.axis[0] ); VectorScale( ent.axis[1], frac, ent.axis[1] ); VectorScale( ent.axis[2], frac, ent.axis[2] ); ent.nonNormalizedAxes = qtrue; } else { frac = 1.0; + frac *= cg_itemSize.value; + VectorScale( ent.axis[0], frac, ent.axis[0] ); + VectorScale( ent.axis[1], frac, ent.axis[1] ); + VectorScale( ent.axis[2], frac, ent.axis[2] ); + ent.nonNormalizedAxes = qtrue; } // items without glow textures need to keep a minimum light value diff --git a/code/cgame/cg_local.h b/code/cgame/cg_local.h index 92c00358e3..26b94a0d68 100644 --- a/code/cgame/cg_local.h +++ b/code/cgame/cg_local.h @@ -1314,7 +1314,8 @@ extern vmCvar_t cg_damagePlum; extern vmCvar_t cg_damagePlumStyle; extern vmCvar_t cg_damagePlumSize; // - +extern vmCvar_t cg_itemFx; +extern vmCvar_t cg_itemSize; // // cg_main.c diff --git a/code/cgame/cg_main.c b/code/cgame/cg_main.c index ac549f0ea1..d07abe773c 100644 --- a/code/cgame/cg_main.c +++ b/code/cgame/cg_main.c @@ -251,6 +251,10 @@ vmCvar_t cg_damagePlum; vmCvar_t cg_damagePlumStyle; vmCvar_t cg_damagePlumSize; // +vmCvar_t cg_itemFx; +vmCvar_t cg_itemSize; + + typedef struct { vmCvar_t *vmCvar; char *cvarName; @@ -416,6 +420,9 @@ static cvarTable_t cvarTable[] = { { &cg_damagePlum, "cg_damagePlum", "1", CVAR_USERINFO | CVAR_ARCHIVE}, { &cg_damagePlumStyle, "cg_damagePlumColorStyle", "1", CVAR_USERINFO | CVAR_ARCHIVE}, { &cg_damagePlumSize, "cg_damagePlumSize", "8", CVAR_USERINFO | CVAR_ARCHIVE}, + // + { &cg_itemFx, "cg_itemFx", "7", CVAR_ARCHIVE }, + { &cg_itemSize, "cg_itemSize", "1.0", CVAR_ARCHIVE }, // { &cg_pmove_fixed, "cg_pmove_fixed", "0", CVAR_USERINFO | CVAR_ARCHIVE } };