Skip to content

Commit

Permalink
Japro update (#207)
Browse files Browse the repository at this point in the history
* drain line tweak

(cherry picked from commit 00f7ec4)

* drain fix tweak

(cherry picked from commit a706c5d)

* drain chain

(cherry picked from commit 81eba86)

* force drain tweak

(cherry picked from commit 8281f2c)

* drain tweak fx better

(cherry picked from commit 7fb259e)

* [jaPRO/Force] New jaPRO force drain effect for levels 1/2 (`cg_drainFX 2`)

---------

Co-authored-by: videoP <videoprofess@gmail.com>
  • Loading branch information
taysta and videoP authored May 31, 2024
1 parent 87145eb commit 55aceb6
Show file tree
Hide file tree
Showing 8 changed files with 213 additions and 6 deletions.
105 changes: 105 additions & 0 deletions assets/japro/effects/mp/drain_japro.efx
Original file line number Diff line number Diff line change
@@ -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
]
}
1 change: 1 addition & 0 deletions codemp/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions codemp/cgame/cg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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" );

Expand Down
5 changes: 4 additions & 1 deletion codemp/cgame/cg_players.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*
Expand Down
2 changes: 2 additions & 0 deletions codemp/game/g_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion codemp/game/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions codemp/game/g_svcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
102 changes: 98 additions & 4 deletions codemp/game/w_force.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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.

Expand Down

0 comments on commit 55aceb6

Please sign in to comment.