0-15-00 VMs
Client-side
This commit is contained in:
Victor Chow 2001-10-30 23:23:04 +00:00
parent af767d3b8f
commit 19d863fa5d
5 changed files with 415 additions and 329 deletions

View file

@ -304,13 +304,15 @@ static void CG_Item( centity_t *cent ) {
// autorotate at one of two speeds
//Blaze: no rotating
// if ( item->giType == IT_HEALTH ) {
// VectorCopy( cg.autoAnglesFast, cent->lerpAngles );
// AxisCopy( cg.autoAxisFast, ent.axis );
// } else {
// VectorCopy( cg.autoAngles, cent->lerpAngles );
// AxisCopy( cg.autoAxis, ent.axis );
// }
/*
if ( item->giType == IT_HEALTH ) {
VectorCopy( cg.autoAnglesFast, cent->lerpAngles );
AxisCopy( cg.autoAxisFast, ent.axis );
} else {
VectorCopy( cg.autoAngles, cent->lerpAngles );
AxisCopy( cg.autoAxis, ent.axis );
}
*/
if (item->giType == IT_WEAPON && item->giTag != WP_KNIFE &&
(es->pos.trDelta[0] != 0 || es->pos.trDelta[1] != 0 || es->pos.trDelta[2] != 0) ) {
@ -325,12 +327,17 @@ static void CG_Item( centity_t *cent ) {
VectorNegate(ent.axis[2], ent.axis[1]);
VectorCopy(myvec, ent.axis[2]);
}
else if (item->giType == IT_HOLDABLE &&
(es->pos.trDelta[0] != 0 || es->pos.trDelta[1] != 0 || es->pos.trDelta[2] != 0))
else if (item->giType == IT_HOLDABLE)
{
//Elder: rotate item if moving
if (es->pos.trDelta[0] != 0 || es->pos.trDelta[1] != 0 || es->pos.trDelta[2] != 0)
{
VectorCopy( cg.autoAnglesFast, cent->lerpAngles );
AxisCopy( cg.autoAxisFast, ent.axis );
}
else
AnglesToAxis(es->angles, ent.axis);
}
wi = NULL;
// the weapons have their origin where they attatch to player
@ -342,6 +349,10 @@ static void CG_Item( centity_t *cent ) {
vec3_t myvec;
// Elder: bad hack -- but oh well.
if (es->pos.trDelta[0] == 0 && es->pos.trDelta[1] == 0 && es->pos.trDelta[2] == 0)
AnglesToAxis(es->angles, ent.axis);
//CG_Printf("Should not be in here if it's a thrown knife\n");
wi = &cg_weapons[item->giTag];
cent->lerpOrigin[0] -=
@ -357,15 +368,16 @@ static void CG_Item( centity_t *cent ) {
wi->weaponMidpoint[1] * ent.axis[1][2] +
wi->weaponMidpoint[2] * ent.axis[2][2];
//Blaze: Dont raise the weapon, but lower it
//Elder: increased value
//Elder: don't lower knives by much - this is bad hardcode but oh well
if ( item->giTag == WP_KNIFE)
cent->lerpOrigin[2] -= 10;
else
cent->lerpOrigin[2] -= 14;
// cent->lerpOrigin[2] += 8; // an extra height boost
if (es->pos.trDelta[0] == 0 && es->pos.trDelta[1] == 0 && es->pos.trDelta[2] == 0) {
if (es->pos.trDelta[0] == 0 && es->pos.trDelta[1] == 0 && es->pos.trDelta[2] == 0)
{
// Blaze: rotate the gun by 90 degrees to place it on the ground
VectorCopy(ent.axis[1], myvec);
VectorNegate(ent.axis[2], ent.axis[1]);

View file

@ -446,7 +446,7 @@ static void CG_Obituary_Head( entityState_t *ent ) {
target = ent->otherEntityNum;
attacker = ent->otherEntityNum2;
mod = ent->eventParm;
CG_Printf("(%s) (%s) (%d) (%d)\n",targetName, attackerName,target,attacker);
if ( target < 0 || target >= MAX_CLIENTS ) {
CG_Error( "CG_Obituary: target out of range" );
}
@ -655,7 +655,7 @@ static void CG_Obituary_Chest( entityState_t *ent ) {
target = ent->otherEntityNum;
attacker = ent->otherEntityNum2;
mod = ent->eventParm;
CG_Printf("(%s) (%s) (%d) (%d)\n",targetName, attackerName,target,attacker);
if ( target < 0 || target >= MAX_CLIENTS ) {
CG_Error( "CG_Obituary: target out of range" );
}
@ -834,7 +834,7 @@ static void CG_Obituary_Stomach( entityState_t *ent ) {
target = ent->otherEntityNum;
attacker = ent->otherEntityNum2;
mod = ent->eventParm;
CG_Printf("(%s) (%s) (%d) (%d)\n",targetName, attackerName,target,attacker);
if ( target < 0 || target >= MAX_CLIENTS ) {
CG_Error( "CG_Obituary: target out of range" );
}
@ -2360,19 +2360,28 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
DEBUGNAME("EV_BREAK_GLASS1");
// Change cgs.media.gibSound to whatever sound you want it to use
// I think the gib sound sounds pretty good
//Elder: gonna move this into the function
//Elder: gonna move this into the function some day
if ( rand() % 2 )
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glassSound );
else
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glass2Sound );
//Elder: modified
CG_BreakGlass( cent->lerpOrigin, es->eventParm, 0 );
break;
case EV_BREAK_GLASS2:
DEBUGNAME("EV_BREAK_GLASS2");
if ( rand() % 2 )
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glassSound );
else
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glass2Sound );
CG_BreakGlass( cent->lerpOrigin, es->eventParm, 1 );
break;
case EV_BREAK_GLASS3:
DEBUGNAME("EV_BREAK_GLASS3");
if ( rand() % 2 )
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glassSound );
else
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glass2Sound );
CG_BreakGlass( cent->lerpOrigin, es->eventParm, 2 );
break;
case EV_STOPLOOPINGSOUND:

View file

@ -861,6 +861,7 @@ typedef struct {
qhandle_t rq3_healthicon2;
qhandle_t smokePuffShader;
qhandle_t smokePuffAnimShader;
qhandle_t smokePuffRageProShader;
qhandle_t shotgunSmokePuffShader;
qhandle_t plasmaBallShader;
@ -1026,6 +1027,7 @@ typedef struct {
#endif
sfxHandle_t gibSound;
sfxHandle_t glassSound; //Blaze: Reaction breakable glass
sfxHandle_t glass2Sound;
sfxHandle_t gibBounce1Sound;
sfxHandle_t gibBounce2Sound;
sfxHandle_t gibBounce3Sound;

View file

@ -656,6 +656,7 @@ static void CG_RegisterSounds( void ) {
cgs.media.gibSound = trap_S_RegisterSound( "sound/player/gibsplt1.wav", qfalse );
//Blaze: Reaction breakable glass
cgs.media.glassSound = trap_S_RegisterSound( "sound/world/glassbk.wav", qfalse );
cgs.media.glass2Sound = trap_S_RegisterSound( "sound/world/glassbk2.wav", qfalse );
cgs.media.gibBounce1Sound = trap_S_RegisterSound( "sound/player/gibimp1.wav", qfalse );
cgs.media.gibBounce2Sound = trap_S_RegisterSound( "sound/player/gibimp2.wav", qfalse );
cgs.media.gibBounce3Sound = trap_S_RegisterSound( "sound/player/gibimp3.wav", qfalse );
@ -924,6 +925,8 @@ static void CG_RegisterGraphics( void ) {
cgs.media.scoreboardTime = trap_R_RegisterShaderNoMip( "menu/tab/time.tga" );
cgs.media.smokePuffShader = trap_R_RegisterShader( "smokePuff" );
// Elder: expanding animated smoke puff
cgs.media.smokePuffAnimShader = trap_R_RegisterShader( "smokePuff-rq3" );
cgs.media.smokePuffRageProShader = trap_R_RegisterShader( "smokePuffRagePro" );
cgs.media.shotgunSmokePuffShader = trap_R_RegisterShader( "shotgunSmokePuff" );
#ifdef MISSIONPACK

View file

@ -1021,6 +1021,12 @@ void CG_RegisterWeapon( int weaponNum ) {
//weaponInfo->reloadSound2 = trap_S_RegisterSound( "sound/weapons/mp5/mp5in.wav", qfalse );
//weaponInfo->reloadSound3 = trap_S_RegisterSound( "sound/weapons/mp5/mp5slide.wav", qfalse );
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
Com_sprintf( filename, sizeof(filename), "models/weapons2/mp5/animation.cfg" );
if ( !CG_ParseWeaponAnimFile(filename, weaponInfo) ) {
Com_Printf("Failed to load weapon animation file %s\n", filename);
weapAnimLoad = qfalse;
}
break;
case WP_HANDCANNON:
@ -1847,21 +1853,23 @@ void CG_AddViewWeapon( playerState_t *ps ) {
AnglesToAxis( angles, hand.axis );
//Elder: temp hack
//if ( ps->weapon != WP_PISTOL && ps->weapon != WP_M3)
//{
// map torso animations to weapon animations
/*
if ( cg_gun_frame.integer ||
ps->weapon == WP_PISTOL ||
ps->weapon == WP_M3 ||
ps->weapon == WP_HANDCANNON ||
ps->weapon == WP_SSG3000 ||
ps->weapon == WP_M4 ||
ps->weapon == WP_MP5 ||
ps->weapon == WP_AKIMBO ||
ps->weapon == WP_GRENADE ||
ps->weapon == WP_KNIFE ) {
*/
// development tool
hand.frame = hand.oldframe = cg_gun_frame.integer;
hand.backlerp = 0;
/*
} else {
// get clientinfo for animation map
ci = &cgs.clientinfo[ cent->currentState.clientNum ];
@ -1869,7 +1877,8 @@ void CG_AddViewWeapon( playerState_t *ps ) {
hand.oldframe = CG_MapTorsoToWeaponFrame( ci, cent->pe.torso.oldFrame );
hand.backlerp = cent->pe.torso.backlerp;
}
//}
*/
hand.hModel = weapon->handsModel;
hand.renderfx = RF_DEPTHHACK | RF_FIRST_PERSON | RF_MINLIGHT;
@ -2389,7 +2398,6 @@ void CG_Weapon_f( void ) {
}
if (cg.snap->ps.weapon == WP_SSG3000) {
//trap_S_StartSound( NULL, cg.snap->ps.clientNum, CHAN_ITEM, cgs.media.lensSound);
trap_S_StartLocalSound( cgs.media.lensSound, CHAN_ITEM);
if (cg_RQ3_ssgZoomAssist.integer)
CG_RQ3_Zoom();
@ -2398,12 +2406,14 @@ void CG_Weapon_f( void ) {
{
CG_RQ3_GrenadeMode();
}
else
// only play "click" sound for M4/MP5/Pistol
else if (cg.snap->ps.weapon == WP_M4 || cg.snap->ps.weapon == WP_MP5 ||
cg.snap->ps.weapon == WP_PISTOL )
{
//do weapon select sound
trap_S_StartLocalSound( cgs.media.weapToggleSound, CHAN_ITEM);
}
trap_SendClientCommand("weapon");
//Elder: added to get out of function at this point
return;
}
@ -2848,7 +2858,52 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
duration = 600;
switch ( weapon ) {
case WP_M4:
case WP_MP5:
case WP_PISTOL:
case WP_AKIMBO:
case WP_SSG3000:
mod = cgs.media.bulletFlashModel;
shader = cgs.media.bulletExplosionShader;
if (soundType == IMPACTSOUND_GLASS)
mark = cgs.media.glassMarkShader;
else
mark = cgs.media.bulletMarkShader;
r = rand() & 3;
if (soundType == IMPACTSOUND_METAL)
{
if ( r < 2 )
sfx = cgs.media.sfx_metalric1;
else if ( r == 2 )
sfx = cgs.media.sfx_metalric2;
else
sfx = cgs.media.sfx_metalric3;
}
else if (soundType == IMPACTSOUND_GLASS)
{
if ( r < 2 )
sfx = cgs.media.sfx_glassric1;
else if ( r == 2 )
sfx = cgs.media.sfx_glassric2;
else
sfx = cgs.media.sfx_glassric3;
}
else
{
if ( r == 0 )
sfx = cgs.media.sfx_ric1;
else if ( r == 1 )
sfx = cgs.media.sfx_ric2;
else
sfx = cgs.media.sfx_ric3;
}
radius = 8;
break;
/*
//Blaze: Reaction M4
case WP_M4:
mod = cgs.media.bulletFlashModel;
@ -3059,17 +3114,9 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
}
radius = 8;
break;
//Blaze: Reaction Shotgun
*/
case WP_M3:
mod = cgs.media.bulletFlashModel;
shader = cgs.media.bulletExplosionShader;
if (soundType == IMPACTSOUND_GLASS)
mark = cgs.media.glassMarkShader;
else
mark = cgs.media.bulletMarkShader;
sfx = 0;
radius = 4;
break;
case WP_HANDCANNON:
mod = cgs.media.bulletFlashModel;
shader = cgs.media.bulletExplosionShader;
@ -3080,6 +3127,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
sfx = 0;
radius = 4;
break;
case WP_GRENADE:
mod = cgs.media.dishFlashModel;
shader = cgs.media.grenadeExplosionShader;
@ -3120,8 +3168,11 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
break;
}
// Knives, SSG, and grenades always play sound
if (weapon == WP_KNIFE || weapon == WP_SSG3000 || weapon == WP_GRENADE)
//
// ricochet sound
//
if (weapon == WP_KNIFE || weapon == WP_SSG3000 || weapon == WP_GRENADE ||
soundType == IMPACTSOUND_METAL )
i = 1;
else
//Elder: 90% of the time render a bullet ricochet sound
@ -3153,18 +3204,21 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
// impact mark
//
alphaFade = (mark == cgs.media.energyMarkShader); // plasma fades alpha, all others fade color
//Blaze: No more railgun
//if ( weapon == WP_RAILGUN ) {
// float *color;
/*
if ( weapon == WP_RAILGUN ) {
float *color;
// colorize with client color
// color = cgs.clientinfo[clientNum].color;
// CG_ImpactMark( mark, origin, dir, random()*360, color[0],color[1], color[2],1, alphaFade, radius, qfalse );
//} else {
color = cgs.clientinfo[clientNum].color;
CG_ImpactMark( mark, origin, dir, random()*360, color[0],color[1], color[2],1, alphaFade, radius, qfalse );
} else {
*/
// Elder: Our knife slashes aren't vertical so don't go beyond 45 degrees
// Elder: Our knife slashes are vertical
if (weapon == WP_KNIFE)
angle = random() * 90 + 45;
angle = random() * 90;
else
angle = random() * 360;
@ -3173,6 +3227,10 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
//}
//
// impact visual effects
//
//Elder: 75% of the time render a smoke puff
i = rand() % 4;
if (cg_RQ3_impactEffects.integer && i < 3)
@ -3184,6 +3242,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
case WP_MP5:
case WP_M4:
case WP_PISTOL:
case WP_AKIMBO:
case WP_SSG3000:
puffDir[0] = 0;
puffDir[1] = 0;
@ -3200,7 +3259,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
650,
cg.time, 0,
LEF_PUFF_DONT_SCALE,
cgs.media.smokePuffShader );
cgs.media.smokePuffAnimShader );
break;
}
}
@ -3370,7 +3429,7 @@ static void CG_ShotgunPellet( vec3_t start, vec3_t end, int skipNum, int shellWe
// SURF_NOIMPACT will not make a flame puff or a mark
return;
}
if ( tr.surfaceFlags & SURF_METALSTEPS )
if ( (tr.surfaceFlags & SURF_METALSTEPS) || (tr.surfaceFlags & SURF_METAL2) )
{
//Blaze: Changed WP_SHOTGUN to WP_M3
if (shellWeapon == WP_M3)
@ -3394,13 +3453,14 @@ static void CG_ShotgunPellet( vec3_t start, vec3_t end, int skipNum, int shellWe
}
else
{
// Elder: By default, the M3 and HC will spark on all surfaces
// Blaze: Changed WP_SHOTGUN to WP_M3
if (shellWeapon == WP_M3)
CG_MissileHitWall( WP_M3, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_DEFAULT, 0 );
CG_MissileHitWall( WP_M3, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_METAL, 0 );
else if (shellWeapon == WP_HANDCANNON && crandom() > 0.5)
{
//Elder: show only approximately every other impact mark
CG_MissileHitWall( WP_HANDCANNON, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_DEFAULT, 0 );
CG_MissileHitWall( WP_HANDCANNON, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_METAL, 0 );
}
//CG_MissileHitWall( WP_M3, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_DEFAULT, 0 );
}