changing the vanish of a dead body (into the ground)


(Scennative) #1

… just wondering if ya konw where i can change this behavior
… cuz its looks really weird in my opinion
… may its possible to add the behavior from a “bullet”
… so the body is getting/becomes transparent before he dissapeares

thx in advance
:stroggtapir:


(kamikazee) #2

I think you’ll have to look in the client or ui code, search for ET_CORPSE.


(Cambodunum) #3

good evidence … thx kami

greetz Cambo


(Scennative) #4

yes i have found very interestings parts…

@Cambo: Komm ts online xD Habs geschafft ^^


(Scennative) #5

So, I believe I have found just something. But because I have no notion, you could help me there

These is the code of the Moving of the dead body (I think…)

g_mover.c

/*
============
G_TestEntityPosition
============
*/
gentity_t *G_TestEntityPosition( gentity_t *ent ) {
	trace_t	tr;
	int		mask;

	if ( ent->clipmask ) {
//		if ( ent->r.contents == CONTENTS_CORPSE && ent->health <= 0 ) {	// Arnout: players waiting to be revived are important
//		if ( ent->r.contents == CONTENTS_CORPSE ) {
			// corpse aren't important
			//G_Damage( ent, NULL, NULL, NULL, NULL, 99999, 0, MOD_CRUSH );
//			return NULL;
//		} else {
			mask = ent->clipmask;
//		}

		/*if ( ent->r.contents == CONTENTS_CORPSE ) {
			return NULL;
		} else {
			mask = ent->clipmask;
		}*/
	} else {
		mask = MASK_SOLID;
	}

	if ( ent->client ) {
		trap_TraceCapsule( &tr, ent->client->ps.origin, ent->r.mins, ent->r.maxs, ent->client->ps.origin, ent->s.number, mask );

		if( !tr.startsolid && ent->client->ps.eFlags & EF_PRONE ) {
			vec3_t org, flatforward, point;	

			AngleVectors( ent->client->ps.viewangles, flatforward, NULL, NULL );
			flatforward[2] = 0;
			VectorNormalizeFast( flatforward );

			org[0] = ent->client->ps.origin[0] + flatforward[0] * -32;
			org[1] = ent->client->ps.origin[1] + flatforward[1] * -32;
			//org[2] = ent->client->ps.origin[2] + 12;	// 12 units to play with
			org[2] = ent->client->ps.origin[2] + 24.f;	// 12 units to play with

			//VectorSet( point, org[0], org[1], org[2] - 9.6f - 24.f );	// diff between playerlegsMins and playerlegsMaxs z + 24 units to play with
			VectorSet( point, org[0], org[1], org[2] - ( 24.f - 2.4f ) - 24.f );	// diff between playerlegsMins and playerlegsMaxs z + 24 units to play with

			trap_TraceCapsule( &tr, org, playerlegsProneMins, playerlegsProneMaxs, point, ent->s.number, mask );

			if( !tr.startsolid || tr.entityNum < MAX_CLIENTS ) {
				VectorCopy( tr.endpos, org );
				//VectorSet( point, org[0], org[1], org[2] + 9.6f );
				VectorSet( point, org[0], org[1], org[2] + ( 24.f - 2.4f ) );

				trap_TraceCapsule( &tr, org, playerlegsProneMins, playerlegsProneMaxs, point, ent->s.number, mask );

				if( tr.startsolid && tr.entityNum < MAX_CLIENTS ) {
					tr.startsolid = qfalse;
				}
			}
		}    //-------------------------------------------------------------------------------- CAMBO
	} else if( ent->s.eType == ET_CORPSE ) {
		vec3_t pos;
		VectorCopy( ent->s.pos.trBase, pos );
		pos[2] +=4;	// move up a bit - corpses normally got their origin slightly in the ground
		trap_Trace( &tr, pos, ent->r.mins, ent->r.maxs, pos, ent->s.number, mask );
	} else if (ent->s.eType == ET_MISSILE) {
		trap_Trace( &tr, ent->s.pos.trBase, ent->r.mins, ent->r.maxs, ent->s.pos.trBase, ent->r.ownerNum, mask );
	} else {
		trap_Trace( &tr, ent->s.pos.trBase, ent->r.mins, ent->r.maxs, ent->s.pos.trBase, ent->s.number, mask );
	}
	
	if( tr.startsolid )
		return &g_entities[ tr.entityNum ];
		
	return NULL;
}

These is the Code of cg_brasstime

cg_weapons.c

void CG_MachineGunEjectBrassNew( centity_t *cent ) {
	localEntity_t	*le;
	refEntity_t		*re;
	vec3_t			velocity, xvelocity;
	float			waterScale = 1.0f;
	vec3_t			v[3];

	if ( cg_brassTime.integer <= 0 ) {
		return;
	}

	le = CG_AllocLocalEntity();
	re = &le->refEntity;

	velocity[0] = -50+25*crandom(); // JPW NERVE
	velocity[1] = -100+40*crandom(); // JPW NERVE
	velocity[2] = 200+50*random(); // JPW NERVE

	le->leType = LE_FRAGMENT;
	le->startTime = cg.time;
	le->endTime = le->startTime + cg_brassTime.integer + ( cg_brassTime.integer / 4 ) * random();

	le->pos.trType = TR_GRAVITY;
	le->pos.trTime = cg.time - (rand()&15);

	AnglesToAxis( cent->lerpAngles, v );

	VectorCopy (ejectBrassCasingOrigin, re->origin);

	VectorCopy( re->origin, le->pos.trBase );

	if ( CG_PointContents( re->origin, -1 ) & (CONTENTS_WATER | CONTENTS_SLIME) ) {	//----(SA)	modified since slime is no longer deadly
		waterScale = 0.10;
	}

	xvelocity[0] = velocity[0] * v[0][0] + velocity[1] * v[1][0] + velocity[2] * v[2][0];
	xvelocity[1] = velocity[0] * v[0][1] + velocity[1] * v[1][1] + velocity[2] * v[2][1];
	xvelocity[2] = velocity[0] * v[0][2] + velocity[1] * v[1][2] + velocity[2] * v[2][2];
	VectorScale( xvelocity, waterScale, le->pos.trDelta );

	AxisCopy( axisDefault, re->axis );
	re->hModel = cgs.media.smallgunBrassModel;

	le->bounceFactor = 0.4 * waterScale;

	le->angles.trType = TR_LINEAR;
	le->angles.trTime = cg.time;
	le->angles.trBase[0] = (rand()&31) + 60; // bullets should come out horizontal not vertical JPW NERVE
	le->angles.trBase[1] = rand()&255; // random spin from extractor
	le->angles.trBase[2] = rand()&31;
	le->angles.trDelta[0] = 2;
	le->angles.trDelta[1] = 1;
	le->angles.trDelta[2] = 0;

	le->leFlags = LEF_TUMBLE;

	
	{
		int		contents;
		vec3_t	end;
		VectorCopy( cent->lerpOrigin, end );
		end[2] -= 24;
		contents = CG_PointContents( end, 0 );
		if (contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ))
			le->leBounceSoundType = LEBS_NONE;
		else
			le->leBounceSoundType = LEBS_BRASS;
	}

	le->leMarkType = LEMT_NONE;
}


(Scennative) #6

Can me help who?


(Paul) #7

Isnt there a function called bodyquenue?


(Scennative) #8

yes i think thats is…

here the Code in g_client.c (etpub)

/*
=============
BodySink

After sitting around for five seconds, fall into the ground and dissapear 
=============
*/ 
void BodySink2( gentity_t *ent ) {
	ent->physicsObject = qfalse;
	// tjw: BODY_TIME is how long they last all together, not just sink anim
	//ent->nextthink = level.time + BODY_TIME(BODY_TEAM(ent))+1500;
	ent->nextthink = level.time + 4000;
	ent->think = BodyUnlink;
	ent->s.pos.trType = TR_LINEAR;
	ent->s.pos.trTime = level.time;
	VectorCopy( ent->r.currentOrigin, ent->s.pos.trBase );
	VectorSet( ent->s.pos.trDelta, 0, 0, -8 );
}

/*
=============
BodySink

After sitting around for five seconds, fall into the ground and dissapear
=============
*/
void BodySink( gentity_t *ent ) {
	if( ent->activator ) {
		// see if parent is still disguised
		if( ent->activator->client->ps.powerups[PW_OPS_DISGUISED] ) {
			ent->nextthink = level.time + 100;
			return;
		} else {
			ent->activator = NULL;
		}
	}

	BodySink2( ent );
}


(kamikazee) #9

Ah, that that is indeed promising as you can remove the “sinking code” there (everything after “ent->think = BodyUnlink”).

Still, I don’t recall how to communicate from server to the client how to start fading a certain object. I’ve never really dabbled in the client code.