Skip to content

Commit

Permalink
game, cgame: damageplumstyle 2 now use damage mod dealt rather curren…
Browse files Browse the repository at this point in the history
…t playerweapon
  • Loading branch information
yumirak committed Mar 5, 2024
1 parent 6e85764 commit 121186a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
4 changes: 2 additions & 2 deletions code/cgame/cg_effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion code/cgame/cg_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
39 changes: 20 additions & 19 deletions code/cgame/cg_localents.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions code/game/g_combat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
/*
============
Expand Down

0 comments on commit 121186a

Please sign in to comment.