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;
}