pressure stuff

This commit is contained in:
Bryce Hutchings 2002-04-23 06:09:18 +00:00
parent f17f86d482
commit 28de2770fa
9 changed files with 142 additions and 53 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.25 2002/04/23 06:09:18 niceass
// pressure stuff
//
// Revision 1.24 2002/04/09 18:52:13 makro
// Target_speakers can now be toggled on/off
//
@ -1185,6 +1188,9 @@ static void CG_AddCEntity( centity_t *cent ) {
case ET_BREAKABLE:
CG_Mover( cent );
break;
case ET_PRESSURE:
CG_Mover( cent );
break;
case ET_BEAM:
CG_Beam( cent );
break;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.51 2002/04/23 06:08:58 niceass
// pressure stuff
//
// Revision 1.50 2002/04/20 15:05:08 makro
// More footstep sounds, a few other things
//
@ -2561,6 +2564,11 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
DEBUGNAME("EV_CHIP_GLASS");
CG_BreakGlass( cent->lerpOrigin, es->eventParm, es->number, 1, 1 );
break;
case EV_PRESSURE_WATER:
DEBUGNAME("EV_PRESSURE_WATER");
ByteToDir(es->eventParm, dir);
CG_PressureWater( position, dir );
break;
case EV_STOPLOOPINGSOUND:
DEBUGNAME("EV_STOPLOOPINGSOUND");

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.10 2002/04/23 06:07:23 niceass
// pressure stuff
//
// Revision 1.9 2002/03/31 02:02:15 niceass
// more random shell bouncing
//
@ -813,7 +816,37 @@ void CG_AddScorePlum( localEntity_t *le ) {
}
}
void CG_AddPressureEntity ( localEntity_t *le ) {
vec3_t velocity;
vec3_t origin;
float alpha;
int l;
alpha = -(cg.time - le->startTime) + (le->endTime - le->startTime);
alpha /= (le->endTime - le->startTime);
//steamSound
for (l = 0; l < 1; l++) {
/*
VectorScale(le->pos.trDelta, 200 + rand() % 30, velocity);
velocity[0] += rand() % 20 - 10;
velocity[1] += rand() % 20 - 10;
velocity[2] = 0;
*/
// steam:
VectorScale(le->pos.trDelta, 200 + rand() % 30, velocity);
velocity[0] += rand() % 40 - 20;
velocity[1] += rand() % 40 - 20;
VectorCopy(le->pos.trBase, origin);
//VectorMA(origin, 10, velocity, origin);
//CG_ParticleWater(le->pos.trBase, velocity, 200 + rand() % 120, alpha, -8, 1 );
CG_ParticleSteam(le->pos.trBase, velocity, 200 + rand() % 120, alpha, -8, 1 );
}
}
//==============================================================================
@ -879,6 +912,9 @@ void CG_AddLocalEntities( void ) {
CG_AddScorePlum( le );
break;
case LE_PRESSURE_WATER:
CG_AddPressureEntity( le );
#ifdef MISSIONPACK
case LE_KAMIKAZE:
CG_AddKamikaze( le );

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.57 2002/04/23 06:06:57 niceass
// pressure stuff
//
// Revision 1.56 2002/04/20 15:05:08 makro
// More footstep sounds, a few other things
//
@ -706,6 +709,8 @@ static void CG_RegisterSounds( void ) {
CG_LoadVoiceChats();
#endif
// NiceAss: Used for pressure entities
cgs.media.steamSound = trap_S_RegisterSound( "sound/steam.wav", qtrue );
cgs.media.oneMinuteSound = trap_S_RegisterSound( "sound/feedback/1_minute.wav", qtrue );
cgs.media.fiveMinuteSound = trap_S_RegisterSound( "sound/feedback/5_minute.wav", qtrue );
cgs.media.suddenDeathSound = trap_S_RegisterSound( "sound/feedback/sudden_death.wav", qtrue );
@ -1152,7 +1157,7 @@ static void CG_RegisterGraphics( void ) {
cgs.media.bloodTrailShader = trap_R_RegisterShader( "bloodTrail" );
cgs.media.lagometerShader = trap_R_RegisterShader("lagometer" );
cgs.media.connectionShader = trap_R_RegisterShader( "disconnected" );
cgs.media.waterParticleShader = trap_R_RegisterShader( "gfx/misc/water.tga" ); // NiceAss: Used in pressure entities
cgs.media.waterBubbleShader = trap_R_RegisterShader( "waterBubble" );
cgs.media.tracerShader = trap_R_RegisterShader( "gfx/misc/tracer" );

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.34 2002/04/23 06:03:39 niceass
// pressure stuff
//
// Revision 1.33 2002/04/20 15:03:47 makro
// More footstep sounds, a few other things
//
@ -1423,7 +1426,8 @@ char *eventnames[] = {
"EV_BREAK_GLASS1", // Blaze: Breakable glass
"EV_BREAK_GLASS2",
"EV_BREAK_GLASS3",
"EV_CHIP_GLASS", //Blaze: this even just breaks it a little bit.
"EV_CHIP_GLASS", // Blaze: this even just breaks it a little bit.
"EV_PRESSURE_WATER", // NiceAss: Shot an ent under pressure with water
"EV_SCOREPLUM", // score plum
//#ifdef MISSIONPACK

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.57 2002/04/23 06:04:12 niceass
// pressure stuff
//
// Revision 1.56 2002/04/20 15:03:48 makro
// More footstep sounds, a few other things
//
@ -993,8 +996,9 @@ typedef enum {
EV_BREAK_GLASS1, // Blaze: Breakable glass
EV_BREAK_GLASS2,
EV_BREAK_GLASS3,
EV_CHIP_GLASS, //Blaze: this even just breaks it a little bit.
EV_SCOREPLUM, // score plum
EV_CHIP_GLASS, //Blaze: this even just breaks it a little bit.
EV_PRESSURE_WATER, //NiceAss: Shot an ent under pressure with water
EV_SCOREPLUM, // score plum
//#ifdef MISSIONPACK
EV_PROXIMITY_MINE_STICK,
@ -1283,7 +1287,8 @@ typedef enum {
ET_ITEM,
ET_MISSILE,
ET_MOVER,
ET_BREAKABLE,//Blaze: Breakable glass
ET_BREAKABLE, //Blaze: Breakable glass
ET_PRESSURE, //NiceAss: Pressure entities
ET_BEAM,
ET_PORTAL,
ET_SPEAKER,

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.32 2002/04/23 06:01:58 niceass
// pressure stuff
//
// Revision 1.31 2002/04/22 16:43:34 blaze
// Hey look, breakables explode now! :)
//
@ -772,6 +775,17 @@ void G_BreakGlass( gentity_t *ent, gentity_t *inflictor, gentity_t *attacker, ve
}
}
void SP_func_pressure( gentity_t *ent ) {
// Make it appear as the brush
G_Printf("Creating Pressure entity\n");
trap_SetBrushModel( ent, ent->model );
trap_LinkEntity (ent);
VectorCopy( ent->s.origin, ent->s.pos.trBase );
VectorCopy( ent->s.origin, ent->r.currentOrigin );
ent->s.eType = ET_PRESSURE;
ent->damage = 2;
}
#ifdef MISSIONPACK
static void PortalDie (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod) {

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.17 2002/04/23 06:01:39 niceass
// pressure stuff
//
// Revision 1.16 2002/04/20 02:34:57 jbravo
// Changed weapon and ammo classnames at Sze's request
//
@ -166,6 +169,7 @@ void SP_func_door (gentity_t *ent);
void SP_func_train (gentity_t *ent);
void SP_func_timer (gentity_t *self);
void SP_func_breakable (gentity_t *ent);//Blaze: Breakable glass
void SP_func_pressure (gentity_t *ent); //NiceAss: pressure entity
void SP_trigger_always (gentity_t *ent);
void SP_trigger_multiple (gentity_t *ent);
@ -246,6 +250,7 @@ spawn_t spawns[] = {
{"func_group", SP_info_null},
{"func_timer", SP_func_timer}, // rename trigger_timer?
{"func_breakable", SP_func_breakable}, // Blaze: Breakable glass
{"func_pressure", SP_func_pressure}, // NiceAss: pressure entity
// Triggers are brush objects that cause an effect when contacted
// by a living player, usually involving firing targets.

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.47 2002/04/23 06:00:32 niceass
// pressure stuff
//
// Revision 1.46 2002/04/21 00:31:27 blaze
// ssg now properly breaks breakables
//
@ -428,7 +431,7 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int MOD ) {
int i, passent;
//Makro
int Material;
// Elder: Statistics tracking
if (ent->client && level.team_round_going)
{
@ -448,21 +451,21 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int MOD ) {
break;
}
}
//Elder: removed - for some reason it's set to 0
//damage *= s_quadFactor;
/* Original AQ2 code
vectoangles (aimdir, dir);
AngleVectors (dir, forward, right, up);
r = crandom()*hspread;
u = crandom()*vspread;
VectorMA (start, 8192, forward, end);
VectorMA (end, r, right, end);
VectorMA (end, u, up, end);
r = crandom()*hspread;
u = crandom()*vspread;
VectorMA (start, 8192, forward, end);
VectorMA (end, r, right, end);
VectorMA (end, u, up, end);
*/
/* More AQ2 code to implement
// change bullet's course when it enters water
VectorSubtract (end, start, dir);
@ -474,36 +477,36 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int MOD ) {
VectorMA (end, r, right, end);
VectorMA (end, u, up, end);
*/
//Elder: original Q3 code -- note the first line and its use to reduce spread
//r = random() * M_PI * 2.0f;
//u = sin(r) * crandom() * spread * 16;
//r = cos(r) * crandom() * spread * 16;
//FYI: multiply by 16 so we can reach the furthest ends of a "TA" sized map
u = crandom() * spread * 16;
r = crandom() * spread * 16;
VectorMA (muzzle, 8192*16, forward, end);
VectorMA (end, r, right, end);
VectorMA (end, u, up, end);
passent = ent->s.number;
for (i = 0; i < 10; i++) {
trap_Trace (&tr, muzzle, NULL, NULL, end, passent, MASK_SHOT);
//Makro - saving the material flag to avoid useless calls to the GetMaterialFromFlag function
Material = GetMaterialFromFlag(tr.surfaceFlags);
if ( tr.surfaceFlags & SURF_NOIMPACT ) {
return;
}
traceEnt = &g_entities[ tr.entityNum ];
// snap the endpos to integers, but nudged towards the line
SnapVectorTowards( tr.endpos, muzzle );
// send bullet impact
// NiceAss: Special hit-detection stuff for the head
if ( traceEnt->takedamage && traceEnt->client && G_HitPlayer(traceEnt, forward, tr.endpos) == qfalse ) {
@ -511,7 +514,7 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int MOD ) {
passent = tr.entityNum;
continue;
}
if ( traceEnt->takedamage && traceEnt->client ) {
if (bg_itemlist[traceEnt->client->ps.stats[STAT_HOLDABLE_ITEM]].giTag != HI_KEVLAR)
{
@ -524,44 +527,47 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int MOD ) {
if( LogAccuracyHit( traceEnt, ent ) ) {
ent->client->accuracy_hits++;
// Elder: Statistics tracking
if (level.team_round_going)
{
switch (MOD)
{
case MOD_PISTOL:
ent->client->pers.records[REC_MK23HITS]++;
//ent->client->mk23Hits++;
break;
case MOD_M4:
ent->client->pers.records[REC_M4HITS]++;
//ent->client->m4Hits++;
break;
case MOD_MP5:
ent->client->pers.records[REC_MP5HITS]++;
//ent->client->mp5Hits++;
break;
case MOD_AKIMBO:
ent->client->pers.records[REC_AKIMBOHITS]++;
//ent->client->akimboHits++;
break;
}
}
if (level.team_round_going)
{
switch (MOD)
{
case MOD_PISTOL:
ent->client->pers.records[REC_MK23HITS]++;
//ent->client->mk23Hits++;
break;
case MOD_M4:
ent->client->pers.records[REC_M4HITS]++;
//ent->client->m4Hits++;
break;
case MOD_MP5:
ent->client->pers.records[REC_MP5HITS]++;
//ent->client->mp5Hits++;
break;
case MOD_AKIMBO:
ent->client->pers.records[REC_AKIMBOHITS]++;
//ent->client->akimboHits++;
break;
}
}
}
//Elder: *******************TEST CODE *****************
//} else if ( tr.surfaceFlags & SURF_GRASS ) {
//tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_FLESH);
//tent->s.eventParm = DirToByte( tr.plane.normal );
//Makro - new surfaceparm system
//} else if ((tr.surfaceFlags & SURF_METALSTEPS) || (tr.surfaceFlags & SURF_METAL2) || (tr.surfaceFlags & SURF_HARDMETAL)) {
//Makro - new surfaceparm system
//} else if ((tr.surfaceFlags & SURF_METALSTEPS) || (tr.surfaceFlags & SURF_METAL2) || (tr.surfaceFlags & SURF_HARDMETAL)) {
} else if (IsMetalMat(Material)) {
tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_METAL );
tent->s.eventParm = DirToByte( tr.plane.normal );
tent->s.otherEntityNum = ent->s.number;
//} else if ( tr.surfaceFlags & SURF_GLASS) {
//} else if ( tr.surfaceFlags & SURF_GLASS) {
} else if ( Material == MAT_GLASS ) {
tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_GLASS );
tent->s.eventParm = DirToByte( tr.plane.normal );
tent->s.otherEntityNum = ent->s.number;
} else if ( traceEnt->s.eType == ET_PRESSURE ) {
// Pressure entities
tent = G_TempEntity2( tr.endpos, EV_PRESSURE_WATER, DirToByte(tr.plane.normal) );
} else {
tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_WALL );
tent->s.eventParm = DirToByte( tr.plane.normal );
@ -569,10 +575,10 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int MOD ) {
}
//tent->s.otherEntityNum = ent->s.number;
//G_Printf("Surfaceflags: %d\n", tr.surfaceFlags);
if ( traceEnt->takedamage) {
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, 0, MOD);
// FIXME: poor implementation
if (traceEnt->client && bg_itemlist[traceEnt->client->ps.stats[STAT_HOLDABLE_ITEM]].giTag == HI_KEVLAR) {
if (traceEnt->client->kevlarHit == qfalse) {
@ -584,7 +590,7 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int MOD ) {
tent2->s.otherEntityNum = ent->s.number;
}
}
// NiceAss: Added so the M4 will shoot through bodies
if (MOD == MOD_M4 && traceEnt->client &&
traceEnt->client->kevlarHit == qfalse)