From 55aceb66a04ccbf948c3111148b9ab1116058867 Mon Sep 17 00:00:00 2001 From: tayst Date: Fri, 31 May 2024 16:04:01 +0800 Subject: [PATCH] Japro update (#207) * drain line tweak (cherry picked from commit 00f7ec490739bde6506c03c26029e9c3a25f7559) * drain fix tweak (cherry picked from commit a706c5da5d1f3ca87474a50d80f1b5b197de1f95) * drain chain (cherry picked from commit 81eba86a7446fb6d9e06637555c6c2b60a58ffc7) * force drain tweak (cherry picked from commit 8281f2c85990f7e95d585aba6f5ee58cae7398aa) * drain tweak fx better (cherry picked from commit 7fb259ee2b25acb5c763b66ba30e9976f4139fde) * [jaPRO/Force] New jaPRO force drain effect for levels 1/2 (`cg_drainFX 2`) --------- Co-authored-by: videoP --- assets/japro/effects/mp/drain_japro.efx | 105 ++++++++++++++++++++++++ codemp/cgame/cg_local.h | 1 + codemp/cgame/cg_main.c | 1 + codemp/cgame/cg_players.c | 5 +- codemp/game/g_cmds.c | 2 + codemp/game/g_local.h | 2 +- codemp/game/g_svcmds.c | 1 + codemp/game/w_force.c | 102 ++++++++++++++++++++++- 8 files changed, 213 insertions(+), 6 deletions(-) create mode 100644 assets/japro/effects/mp/drain_japro.efx diff --git a/assets/japro/effects/mp/drain_japro.efx b/assets/japro/effects/mp/drain_japro.efx new file mode 100644 index 0000000000..db9f694dc3 --- /dev/null +++ b/assets/japro/effects/mp/drain_japro.efx @@ -0,0 +1,105 @@ +repeatDelay 300 + +Electricity +{ + flags useModel useBBox usePhysics + + spawnFlags rgbComponentInterpolation + + count 1 2 + + life 50 60 + + bounce 0.8 2 + + origin2 500 -16 -2 524 16 2 + + rgb + { + end 1 0 0 + } + + alpha + { + end 0 1 + flags linear + } + + size + { + start 2 5 + flags linear + } + + shaders + [ + gfx/misc/rline + ] +} + +Particle +{ + flags useAlpha + + spawnFlags rgbComponentInterpolation + + life 30 + + rotation 0 360 + + rgb + { + start 1 0 0 1 1 1 + end 1 0 0 + } + + size + { + start 10 18 + flags random + } + + shaders + [ + gfx/misc/lightningFlash + ] +} + +Electricity +{ + name Copy of Unnamed Electricity 0 + + flags useModel useBBox usePhysics useAlpha + + spawnFlags rgbComponentInterpolation + + count 1 2 + + life 50 60 + + bounce 0.8 2 + + origin2 500 -16 -2 524 16 2 + + rgb + { + start 1 0 0 1 1 1 + end 1 0 0 + } + + alpha + { + start 0 1 + } + + size + { + start 8 10 + flags linear + } + + shaders + [ + gfx/misc/rline + ] +} diff --git a/codemp/cgame/cg_local.h b/codemp/cgame/cg_local.h index b2082b9ccc..ddc2d13a97 100644 --- a/codemp/cgame/cg_local.h +++ b/codemp/cgame/cg_local.h @@ -2086,6 +2086,7 @@ typedef struct cgEffects_s { fxHandle_t forceLightningWide; fxHandle_t forceDrain; + fxHandle_t forceDrainJaPRO; fxHandle_t forceDrainWide; fxHandle_t forceDrainWideJaPRO;//japro fxHandle_t forceDrained; diff --git a/codemp/cgame/cg_main.c b/codemp/cgame/cg_main.c index e85690beed..1206db850c 100644 --- a/codemp/cgame/cg_main.c +++ b/codemp/cgame/cg_main.c @@ -1317,6 +1317,7 @@ static void CG_RegisterGraphics( void ) { cgs.effects.forceLightning = trap->FX_RegisterEffect( "effects/force/lightning.efx" ); cgs.effects.forceLightningWide = trap->FX_RegisterEffect( "effects/force/lightningwide.efx" ); cgs.effects.forceDrain = trap->FX_RegisterEffect( "effects/mp/drain.efx" ); + cgs.effects.forceDrainJaPRO = trap->FX_RegisterEffect("effects/mp/drain_japro.efx"); cgs.effects.forceDrainWide = trap->FX_RegisterEffect( "effects/mp/drainwide.efx" ); cgs.effects.forceDrainWideJaPRO = trap->FX_RegisterEffect( "effects/mp/drainwide_japro.efx" ); diff --git a/codemp/cgame/cg_players.c b/codemp/cgame/cg_players.c index fa4a1c326a..5758c17df7 100644 --- a/codemp/cgame/cg_players.c +++ b/codemp/cgame/cg_players.c @@ -11737,7 +11737,10 @@ void CG_Player( centity_t *cent ) { {//line //trap->FX_PlayEffectID( cgs.effects.forceLightning, efOrg, fxDir ); //trap->FX_PlayEntityEffectID(cgs.effects.forceDrain, efOrg, axis, cent->boltInfo, cent->currentState.number, -1, -1); - trap->FX_PlayEntityEffectID(cgs.effects.forceDrain, efOrg, axis, -1, -1, -1, -1); + if (cg_drainFX.integer == 1) + trap->FX_PlayEntityEffectID(cgs.effects.forceDrain, efOrg, axis, -1, -1, -1, -1); + else if (cg_drainFX.integer == 2) + trap->FX_PlayEntityEffectID(cgs.effects.forceDrainJaPRO, efOrg, axis, -1, -1, -1, -1); } /* diff --git a/codemp/game/g_cmds.c b/codemp/game/g_cmds.c index 54481963f3..bbf5c55d3b 100644 --- a/codemp/game/g_cmds.c +++ b/codemp/game/g_cmds.c @@ -8578,6 +8578,8 @@ void Cmd_ServerConfig_f(gentity_t *ent) //loda fixme fix indenting on this, make Q_strcat(buf, sizeof(buf), " ^5Drain takes 25% less forcepoints from target\n"); if (g_tweakForce.integer & FT_FIXGRIPPEDREGEN) Q_strcat(buf, sizeof(buf), " ^5Jump does not pause your regen while being gripped\n"); + if (g_tweakForce.integer & FT_FIXLINEDRAIN) + Q_strcat(buf, sizeof(buf), " ^5Drain level 3 is a line\n"); trap->SendServerCommand(ent-g_entities, va("print \"%s\"", buf)); } diff --git a/codemp/game/g_local.h b/codemp/game/g_local.h index fd65e72b3c..48a923db55 100644 --- a/codemp/game/g_local.h +++ b/codemp/game/g_local.h @@ -267,7 +267,7 @@ extern int dueltypes[MAX_CLIENTS];//JAPRO - Serverside - Fullforce Duels y is th #define FT_BUFFMELEE (1<<20) //not really a forcetweak but no room in weapon tweaks! #define FT_DRAINDMGNERF (1<<21) //drain takes 3 instead of 4fp from enemy #define FT_FIXGRIPPEDREGEN (1<<22) //lets you regen during a jump if you are caught and not holding jump (?) - +#define FT_FIXLINEDRAIN (1<<23) //lets you regen during a jump if you are caught and not holding jump (?) //Saber tweaks #define ST_NO_MP_SABERLERP (1<<0) diff --git a/codemp/game/g_svcmds.c b/codemp/game/g_svcmds.c index d8924c607d..35e25d963e 100644 --- a/codemp/game/g_svcmds.c +++ b/codemp/game/g_svcmds.c @@ -1008,6 +1008,7 @@ static bitInfo_T forceTweaks[] = { {"Stronger / different Melee attack"},//21 { "Drain takes 25% less force from target" },//22 { "Regen force while being gripped if mid jump" },//23 + { "Drain level 3 is a line" },//23 }; static const int MAX_FORCE_TWEAKS = ARRAY_LEN( forceTweaks ); diff --git a/codemp/game/w_force.c b/codemp/game/w_force.c index 135ff6820a..4244ad3ecc 100644 --- a/codemp/game/w_force.c +++ b/codemp/game/w_force.c @@ -2267,6 +2267,7 @@ void ForceDrainDamage( gentity_t *self, gentity_t *traceEnt, vec3_t dir, vec3_t } } +void G_TestLine(vec3_t start, vec3_t end, int color, int time); int ForceShootDrain( gentity_t *self ) { trace_t tr; @@ -2286,7 +2287,7 @@ int ForceShootDrain( gentity_t *self ) center[2] += self->client->ps.viewheight - 16; } - if ( self->client->ps.fd.forcePowerLevel[FP_DRAIN] > FORCE_LEVEL_2 ) + if ((self->client->ps.fd.forcePowerLevel[FP_DRAIN] > FORCE_LEVEL_2) && !(g_tweakForce.integer & FT_FIXLINEDRAIN)) {//arc vec3_t mins, maxs, dir, ent_org, size, v; float radius = MAX_DRAIN_DISTANCE, dot, dist, cof; @@ -2396,20 +2397,113 @@ int ForceShootDrain( gentity_t *self ) } else {//trace-line - VectorMA( center, 2048, forward, end ); + if (g_tweakForce.integer & FT_FIXLINEDRAIN) { + vec3_t mins = { -6, -6, -6 }, maxs = { 6, 6, 6 }; + VectorMA(center, MAX_DRAIN_DISTANCE, forward, end); + JP_Trace(&tr, center, mins, maxs, end, self->s.number, MASK_SHOT, qfalse, 0, 0); + } + else { + VectorMA(center, 2048, forward, end); + JP_Trace(&tr, center, vec3_origin, vec3_origin, end, self->s.number, MASK_SHOT, qfalse, 0, 0); + } - JP_Trace( &tr, center, vec3_origin, vec3_origin, end, self->s.number, MASK_SHOT, qfalse, 0, 0 ); if ( tr.entityNum == ENTITYNUM_NONE || tr.fraction == 1.0 || tr.allsolid || tr.startsolid || !g_entities[tr.entityNum].client || !g_entities[tr.entityNum].inuse ) { + if (g_tweakForce.integer & FT_FIXLINEDRAIN) { + self->client->ps.fd.forcePowerRegenDebounceTime = level.time + 200; + self->client->ps.activeForcePass = 0; //Reset this visual + //cost force? + } return 0; } traceEnt = &g_entities[tr.entityNum]; ForceDrainDamage( self, traceEnt, forward, tr.endpos ); gotOneOrMore = 1; + + if (traceEnt && traceEnt->client && (g_tweakForce.integer & FT_FIXLINEDRAIN)) { //drain chain + int i, numListedEntities, e; + vec3_t mins, maxs; + float radius = 128; + int iEntityList[MAX_GENTITIES]; + gentity_t *entityList[MAX_GENTITIES]; + gentity_t *traceEnt2; + vec3_t dir; + gentity_t *tent; //effect + vec3_t startFX, endFX; + + for (i = 0; i < 3; i++) { + mins[i] = traceEnt->client->ps.origin[i] - radius; + maxs[i] = traceEnt->client->ps.origin[i] + radius; + } + numListedEntities = trap->EntitiesInBox(mins, maxs, iEntityList, MAX_GENTITIES); + + i = 0; + while (i < numListedEntities) + { + entityList[i] = &g_entities[iEntityList[i]]; + + i++; + } + + for (e = 0; e < numListedEntities; e++) + { + traceEnt2 = entityList[e]; + + if (!traceEnt2) + continue; + if (traceEnt2 == self) + continue; + if (!traceEnt2->inuse) + continue; + if (!traceEnt2->takedamage) + continue; + if (traceEnt2->health <= 0)//no torturing corpses + continue; + if (!traceEnt2->client) + continue; + if (!traceEnt2->client->ps.fd.forcePower) + continue; + if (OnSameTeam(self, traceEnt2) && !g_friendlyFire.value) + continue; + if (traceEnt2 == self) + continue; + if (traceEnt2->client->sess.raceMode) + continue; + + //Now check and see if we can actually hit it + VectorCopy(traceEnt->client->ps.origin, startFX); + startFX[2] += 20; + VectorCopy(traceEnt2->client->ps.origin, endFX); + endFX[2] += 20; + + JP_Trace(&tr, startFX, vec3_origin, vec3_origin, endFX, traceEnt->s.number, MASK_SHOT, qfalse, 0, 0); + if (tr.fraction < 1.0f && tr.entityNum != traceEnt2->s.number) + {//must have clear LOS + continue; + } + + if (traceEnt->s.number == traceEnt2->s.number) {//The 2nd chain is the 1st chain?? + continue; // WTF? + } + + // ok, we are within the radius, add us to the incoming list + VectorSubtract(endFX, startFX, dir); + VectorNormalize(dir); + ForceDrainDamage(self, traceEnt2, dir, endFX); + + tent = G_TempEntity(startFX, EV_DISRUPTOR_MAIN_SHOT); + VectorCopy(endFX, tent->s.origin2); + tent->s.eventParm = traceEnt->s.number; + } + } + } - self->client->ps.activeForcePass = self->client->ps.fd.forcePowerLevel[FP_DRAIN] + FORCE_LEVEL_3; + if ((g_tweakForce.integer & FT_FIXLINEDRAIN) && self->client->ps.fd.forcePowerLevel[FP_DRAIN] == FORCE_LEVEL_3) + self->client->ps.activeForcePass = FORCE_LEVEL_2 + FORCE_LEVEL_3; + else + self->client->ps.activeForcePass = self->client->ps.fd.forcePowerLevel[FP_DRAIN] + FORCE_LEVEL_3; BG_ForcePowerDrain( &self->client->ps, FP_DRAIN, 5 ); //used to be 1, but this did, too, anger the God of Balance.