From 121186a8ffd7da63b1b4ce14c7771fe0c2b30d24 Mon Sep 17 00:00:00 2001 From: yumirak Date: Tue, 5 Mar 2024 20:11:00 +0700 Subject: [PATCH] game, cgame: damageplumstyle 2 now use damage mod dealt rather current playerweapon --- code/cgame/cg_effects.c | 4 ++-- code/cgame/cg_event.c | 6 +++++- code/cgame/cg_local.h | 2 +- code/cgame/cg_localents.c | 39 ++++++++++++++++++++------------------- code/game/g_combat.c | 1 + 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/code/cgame/cg_effects.c b/code/cgame/cg_effects.c index 7029f3ecf2..87b5119e31 100644 --- a/code/cgame/cg_effects.c +++ b/code/cgame/cg_effects.c @@ -447,7 +447,7 @@ CG_DamagePlum ================== */ -void CG_DamagePlum( int client, vec3_t org, int damage ) { +void CG_DamagePlum( int client, vec3_t org, int damage, int mod) { localEntity_t *le; refEntity_t *re; vec3_t angles; @@ -458,7 +458,6 @@ void CG_DamagePlum( int client, vec3_t org, int damage ) { } le = CG_AllocLocalEntity(); - le->leFlags = 0; le->leType = LE_DAMAGEPLUM; le->startTime = cg.time; le->endTime = cg.time + 1000; @@ -467,6 +466,7 @@ void CG_DamagePlum( int client, vec3_t org, int damage ) { le->color[0] = le->color[1] = le->color[2] = le->color[3] = 1.0; le->radius = damage; + le->leFlags = mod; // weapon VectorCopy( org, le->pos.trBase ); if (org[2] >= lastPos[2] - 20 && org[2] <= lastPos[2] + 20) { diff --git a/code/cgame/cg_event.c b/code/cgame/cg_event.c index b87db96760..beab6022a0 100644 --- a/code/cgame/cg_event.c +++ b/code/cgame/cg_event.c @@ -985,7 +985,11 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) { break; case EV_DAMAGEPLUM: DEBUGNAME("EV_DAMAGEPLUM"); - CG_DamagePlum( cent->currentState.otherEntityNum, cent->lerpOrigin, cent->currentState.time ); + // otherEntityNum = ent + // lerpOrigin = origin + // time = damage + // time2 = weapon + CG_DamagePlum( cent->currentState.otherEntityNum, cent->lerpOrigin, cent->currentState.time, cent->currentState.time2); break; // // missile impacts diff --git a/code/cgame/cg_local.h b/code/cgame/cg_local.h index c4255afbb9..6366fdced5 100644 --- a/code/cgame/cg_local.h +++ b/code/cgame/cg_local.h @@ -1568,7 +1568,7 @@ void CG_InvulnerabilityJuiced( vec3_t org ); void CG_LightningBoltBeam( vec3_t start, vec3_t end ); #endif void CG_ScorePlum( int client, vec3_t org, int score ); -void CG_DamagePlum( int client, vec3_t org, int score ); +void CG_DamagePlum( int client, vec3_t org, int score, int mod); void CG_GibPlayer(const centity_t *cent); void CG_BigExplode( vec3_t playerOrigin ); diff --git a/code/cgame/cg_localents.c b/code/cgame/cg_localents.c index ebf5cbe26b..4ecc64cece 100644 --- a/code/cgame/cg_localents.c +++ b/code/cgame/cg_localents.c @@ -825,12 +825,9 @@ void CG_AddDamagePlum( localEntity_t *le ) { re = &le->refEntity; c = ( le->endTime - cg.time ) * le->lifeRate; - weapon = cg_entities[cg.snap->ps.clientNum].currentState.weapon;; + weapon = le->leFlags; damage = le->radius; - if (!weapon) { - //CG_Printf("^3WARNING CG_AddDamagePlum() invalid weapon number '%d'\n", weapon); - return; - } + switch(cg_damagePlumStyle.integer) { default: @@ -859,67 +856,71 @@ void CG_AddDamagePlum( localEntity_t *le ) { break; case 2: switch (weapon) { - case WP_GAUNTLET: + case MOD_GAUNTLET: // light blue VectorSet(re->shaderRGBA, 0x38, 0xb0, 0xde); break; - case WP_MACHINEGUN: + case MOD_MACHINEGUN: // yellow VectorSet(re->shaderRGBA, 0xff, 0xff, 0x00); break; - case WP_SHOTGUN: + case MOD_SHOTGUN: // orange VectorSet(re->shaderRGBA, 0xff, 0x7f, 0x00); break; - case WP_GRENADE_LAUNCHER: + case MOD_GRENADE: + case MOD_GRENADE_SPLASH: // dark green VectorSet(re->shaderRGBA, 0x00, 0x7f, 0x00); break; - case WP_ROCKET_LAUNCHER: + case MOD_ROCKET: + case MOD_ROCKET_SPLASH: // red VectorSet(re->shaderRGBA, 0xff, 0x00, 0x00); break; - case WP_LIGHTNING: + case MOD_LIGHTNING: // yellowish white VectorSet(re->shaderRGBA, 0xff, 0xff, 0xaf); break; - case WP_RAILGUN: + case MOD_RAILGUN: // green VectorSet(re->shaderRGBA, 0x00, 0xff, 0x00); break; - case WP_PLASMAGUN: + case MOD_PLASMA: + case MOD_PLASMA_SPLASH: // magenta VectorSet(re->shaderRGBA, 0xaf, 0x00, 0xaf); break; - case WP_BFG: + case MOD_BFG: // dark blue VectorSet(re->shaderRGBA, 0x00, 0x3f, 0xaf); break; - case WP_GRAPPLING_HOOK: + case MOD_GRAPPLE: //FIXME ql doesn't show hook damage plum // purple VectorSet(re->shaderRGBA, 0x55, 0xa8, 0x8b); break; #ifdef MISSIONPACK - case WP_NAILGUN: + case MOD_NAIL: // turquoise VectorSet(re->shaderRGBA, 0x00, 0xaf, 0x7f); break; - case WP_PROX_LAUNCHER: + case MOD_PROXIMITY_MINE: // rose VectorSet(re->shaderRGBA, 0xff, 0x00, 0x7f); break; - case WP_CHAINGUN: + case MOD_CHAINGUN: // light grey VectorSet(re->shaderRGBA, 0xaf, 0xaf, 0xaf); break; #endif - case WP_HMG: + case MOD_HMG: // dark yellowish orange VectorSet(re->shaderRGBA, 0xaf, 0xaf, 0x00); break; default: // light blue + CG_Printf("^3WARNING CG_AddDamagePlum() invalid weapon mod '%d' falling back\n", weapon); VectorSet(re->shaderRGBA, 0x38, 0xb0, 0xde); break; } diff --git a/code/game/g_combat.c b/code/game/g_combat.c index f24d37f6d2..021aedfba3 100644 --- a/code/game/g_combat.c +++ b/code/game/g_combat.c @@ -64,6 +64,7 @@ void DamagePlum( gentity_t *ent, gentity_t *target, int mod, int damage ) { // plum->s.otherEntityNum = ent->s.number; plum->s.time = damage; + plum->s.time2 = mod; } /* ============