water pressure & shell ejection stuff

This commit is contained in:
Bryce Hutchings 2002-12-02 19:52:05 +00:00
parent 0a6f82e6f4
commit c60cc3b8e8
4 changed files with 68 additions and 22 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.131 2002/12/02 19:52:05 niceass
// water pressure & shell ejection stuff
//
// Revision 1.130 2002/11/18 04:39:47 jbravo
// Cleanup of cg_weapons.c
//
@ -2347,6 +2350,7 @@ void CG_ParticleMisc(qhandle_t pshader, vec3_t origin, int size, int duration, f
void CG_ParticleExplosion(char *animStr, vec3_t origin, vec3_t vel, int duration, int sizeStart, int sizeEnd);
void CG_ParticleAir(vec3_t org, vec3_t vel, int duration, float alpha, float speed, float scale);
void CG_ParticleSteam(vec3_t org, vec3_t vel, int duration, float alpha, float speed, float scale, int Shader);
void CG_ParticleWater(vec3_t org, vec3_t vel, int duration, float alpha, float speed, float scale);
extern qboolean initparticles;
int CG_NewParticleArea(int num);

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.21 2002/12/02 19:52:05 niceass
// water pressure & shell ejection stuff
//
// Revision 1.20 2002/08/25 07:08:18 niceass
// added "life" setting to func_pressure
//
@ -274,7 +277,7 @@ void CG_ReflectVelocity(localEntity_t * le, trace_t * trace)
// check for stop, making sure that even on low FPS systems it doesn't bobble
if (trace->allsolid || VectorLength(le->pos.trDelta) < 30.0) {
// NiceAss: I don't know what this crap is, but it didn't work too well no sloped surfaces
// NiceAss: I don't know what this crap is, but it didn't work too well on sloped surfaces
/*( trace->plane.normal[2] > 0 &&
( le->pos.trDelta[2] < 40 || le->pos.trDelta[2] < -cg.frametime * le->pos.trDelta[2] ) ) ) {
*/
@ -675,31 +678,13 @@ void CG_AddPressureEntity(localEntity_t * le)
if (cg.lca)
CG_FreeLocalEntity(le);
if (le->leFlags == LEF_WATER) {
return;
/*
refEntity_t water;
memset( &water, 0, sizeof( water ) );
water.hModel = cgs.media.waterPressureModel;
water.renderfx = RF_NOSHADOW;
water.reType = RT_MODEL;
VectorCopy(le->pos.trBase, water.origin);
trap_R_AddRefEntityToScene( &water );
return;
*/
}
alpha = -(cg.time - le->startTime) + (le->endTime - le->startTime);
alpha /= (le->endTime - le->startTime);
//steamSound!!!
// steam:
if (le->leFlags != LEF_AIR) {
if ( le->leFlags != LEF_AIR && le->leFlags != LEF_WATER ) {
VectorScale(le->pos.trDelta, le->size + rand() % 30, velocity);
velocity[0] += rand() % 40 - 20;
@ -714,6 +699,8 @@ void CG_AddPressureEntity(localEntity_t * le)
else if (le->leFlags == LEF_FLAME)
CG_ParticleSteam(le->pos.trBase, velocity, le->life + rand() % 120, alpha, 2, 1,
cgs.media.flamePressureShader);
else if (le->leFlags == LEF_WATER)
CG_ParticleWater(le->pos.trBase, velocity, le->life + rand() % 120, alpha, 1, 2);
else
CG_ParticleSteam(le->pos.trBase, velocity, le->life + rand() % 120, alpha, 2, 1,
cgs.media.smokePuffShader);

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.17 2002/12/02 19:52:05 niceass
// water pressure & shell ejection stuff
//
// Revision 1.16 2002/08/25 23:20:18 niceass
// steam looks/acts better
//
@ -2358,3 +2361,51 @@ void CG_ParticleSteam(vec3_t org, vec3_t vel, int duration, float alpha, float s
p->reflectdistance = VectorLength(dist);
VectorCopy(tr.plane.normal, p->reflectnormal);
}
void CG_ParticleWater(vec3_t org, vec3_t vel, int duration, float alpha, float speed, float scale)
{
cparticle_t *p;
if (!free_particles)
return;
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
p->time = cg.time;
p->mtime = cg.time;
p->endtime = cg.time + duration;
p->startfade = cg.time + duration / 1.5;
if (rand() % 2)
p->color = DARK_BLUE_WATER;
else
p->color = LIGHT_BLUE_WATER;
p->alpha = alpha;
p->alphavel = p->alpha / ((p->endtime - p->startfade) * .0001f);
p->height = scale;
p->width = scale;
p->endheight = scale;
p->endwidth = scale;
p->pshader = cgs.media.smokePuffShader;
p->type = P_SMOKE;
VectorCopy(org, p->org);
p->vel[0] = vel[0] * speed;
p->vel[1] = vel[1] * speed;
p->vel[2] = vel[2] * speed;
p->accel[0] = p->accel[1] = 0;
p->accel[2] = -PARTICLE_GRAVITY * 8;
p->vel[0] += (crandom() * 40);
p->vel[1] += (crandom() * 40);
p->vel[2] += (20 + (crandom() * 40)) * speed;
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.100 2002/12/02 19:52:05 niceass
// water pressure & shell ejection stuff
//
// Revision 1.99 2002/11/18 04:39:47 jbravo
// Cleanup of cg_weapons.c
//
@ -1313,10 +1316,11 @@ void CG_AddPlayerWeapon(refEntity_t * parent, playerState_t * ps, centity_t * ce
// The handcannon hacks have ruined my beautiful code =(
if (cg.time > cent->ejectBrassTime && cent->ejectBrassTime && weapon->ejectBrassFunc &&
(ps || cg.renderingThirdPerson || cent->currentState.number != cg.predictedPlayerState.clientNum)) {
orientation_t tag;
shell = weapon->ejectBrassFunc(cent);
if (shell != NULL) {
if (shell != NULL && trap_R_LerpTag(&tag, gun.hModel, 0, 0, 1, "tag_shell") ) {
float speed = 1.0f;
int axis1 = 0, axis2 = 0;
@ -1350,7 +1354,7 @@ void CG_AddPlayerWeapon(refEntity_t * parent, playerState_t * ps, centity_t * ce
VectorAdd(shell->pos.trDelta, cent->currentState.pos.trDelta, shell->pos.trDelta);
}
// All this code for a SECOND shell on the HC
if (weaponNum == WP_HANDCANNON) {
if (weaponNum == WP_HANDCANNON && trap_R_LerpTag(&tag, gun.hModel, 0, 0, 1, "tag_shell2") ) {
float speed = -1.0f;
shell = weapon->ejectBrassFunc(cent);