Code updates for VM 0-08-00
Client-side
This commit is contained in:
Victor Chow 2001-08-13 17:25:06 +00:00
parent 67ac416c21
commit 3408381bf7
8 changed files with 168 additions and 35 deletions

View file

@ -52,6 +52,12 @@ static void CG_DropWeapon_f (void) {
if (cg.snap->ps.stats[STAT_BURST] > 0)
return;
if ((cg.snap->ps.stats[STAT_RQ3] & RQ3_BANDAGE_WORK) == RQ3_BANDAGE_WORK)
{
CG_Printf("You are too busy bandaging!\n");
return;
}
CG_RQ3_Zoom1x();
trap_SendClientCommand("dropweapon");
}
@ -707,12 +713,12 @@ static void CG_IRVision_f ( void ) {
{
if (cg.rq3_irvision)
{
CG_Printf("IR vision enabled.\n");
CG_Printf("IR vision disabled.\n");
cg.rq3_irvision = qfalse;
}
else
{
CG_Printf("IR vision disabled.\n");
CG_Printf("IR vision enabled.\n");
cg.rq3_irvision = qtrue;
}
@ -756,10 +762,10 @@ static consoleCommand_t commands[] = {
{ "-reload", CG_ReloadReset_f}, // Elder: added to stop auto-throttle
{ "specialweapon", CG_SpecialWeapon_f }, // Elder: select special weapon
//Elder: added for manual sv_floodProtect check
{ "messagemode", CG_Say_f },
{ "messagemode2", CG_SayTeam_f },
{ "say", CG_Say_f },
{ "say_team", CG_SayTeam_f },
//{ "messagemode", CG_Say_f },
//{ "messagemode2", CG_SayTeam_f },
//{ "say", CG_Say_f },
//{ "say_team", CG_SayTeam_f },
{ "tell_target", CG_TellTarget_f },
{ "tell_attacker", CG_TellAttacker_f },
{ "vtell_target", CG_VoiceTellTarget_f },
@ -881,8 +887,8 @@ void CG_InitConsoleCommands( void ) {
//Elder: try this
trap_AddCommand ("weapon");
trap_AddCommand ("specialweapon");
trap_AddCommand ("messagemode");
trap_AddCommand ("messagemode2");
//trap_AddCommand ("messagemode");
//trap_AddCommand ("messagemode2");
trap_AddCommand ("playerorigin");
trap_AddCommand ("irvision");
}

View file

@ -488,6 +488,7 @@ void CG_BleedSpray ( vec3_t start, vec3_t end, int entityNum, int numBursts )
int i;
int spacing = 30;
int bloodCount = 0;
trace_t tr;
if ( !cg_blood.integer ) {
return;
@ -497,6 +498,7 @@ void CG_BleedSpray ( vec3_t start, vec3_t end, int entityNum, int numBursts )
if (numBursts > MAX_SPRAY_BURSTS)
numBursts = MAX_SPRAY_BURSTS;
VectorCopy (end, move);
VectorSubtract (end, start, vec);
@ -507,13 +509,24 @@ void CG_BleedSpray ( vec3_t start, vec3_t end, int entityNum, int numBursts )
//VectorScale (trueEnd, 300 + rand() % 100, trueEnd);
//VectorAdd (end, trueEnd, trueEnd);
VectorMA(end, 300 + rand() % 100, trueEnd, trueEnd);
// Check end point validity so it doesn't go through walls
// If it does go through wall, take the trace's endpoint
// ****************************** TEST ME!!!!!!! *******************
CG_Trace(&tr, start, NULL, NULL, trueEnd, entityNum, CONTENTS_SOLID);
if (tr.fraction != 1.0)
VectorCopy(tr.endpos, trueEnd);
VectorSubtract (trueEnd, start, vec);
len = VectorNormalize (vec);
//Set velocity
VectorScale(vec, 10, velocity);
if (cg_RQ3_bloodStyle.integer == 1)
velocity[2] += 30;
else
velocity[2] -= 10;
// advance a random amount first
i = rand() % (int)spacing;
@ -535,10 +548,15 @@ void CG_BleedSpray ( vec3_t start, vec3_t end, int entityNum, int numBursts )
cgs.media.bloodTrailShader);
blood->refEntity.rotation = rand() % 360;
blood->leMarkType = LEMT_BLOOD;
//Check blood style
if (cg_RQ3_bloodStyle.integer == 1)
{
blood->leType = LE_FRAGMENT;
blood->leMarkType = LEMT_BLOOD;
blood->pos.trType = TR_GRAVITY;
blood->bounceFactor = 0.4f;
}
VectorAdd (move, vec, move);
}
}

View file

@ -1348,6 +1348,57 @@ static void CG_DMRewardEvent( entityState_t *ent ) {
}
/*
==============
CG_JumpKick
Added by Elder
Handles messages for client jumpkicks plus sound event
==============
*/
static void CG_JumpKick ( entityState_t *ent )
{
int target;
int attacker;
clientInfo_t *ci;
char sex[4]; // null-terminated so one-bigger than pronoun
target = ent->otherEntityNum;
attacker = ent->otherEntityNum2;
if ( target < 0 || target >= MAX_CLIENTS ) {
CG_Error( "CG_JumpKick: target out of range" );
}
else if ( attacker < 0 || target >= MAX_CLIENTS ) {
CG_Error( "CG_JumpKick: attacker out of range" );
}
if (ent->weapon && attacker == cg.clientNum)
{
// this client was the kicker
ci = &cgs.clientinfo[target];
// get gender-appropriate pronoun
if (ci->gender == GENDER_FEMALE)
Q_strncpyz(sex, "her", sizeof(sex));
else if (ci->gender == GENDER_MALE)
Q_strncpyz(sex, "his", sizeof(sex));
else
Q_strncpyz(sex, "its", sizeof(sex));
CG_Printf("You kicked %s's %s from %s hands!\n",
ci->name, cg_weapons[ent->weapon].item->pickup_name, sex);
}
else if (ent->weapon && target == cg.clientNum)
{
// this client was the kicked
ci = &cgs.clientinfo[attacker];
CG_Printf("%s kicked your weapon from your hands!\n", ci->name);
}
// everyone hears this
trap_S_StartSound(NULL, ent->number, CHAN_AUTO, cgs.media.kickSound);
}
/*
==============
@ -1912,6 +1963,12 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qtrue, es->eventParm, qtrue );
break;
case EV_JUMPKICK:
DEBUGNAME("EV_JUMPKICK");
ByteToDir( es->eventParm, dir );
CG_MissileHitPlayer( WP_PISTOL, position, dir, es->otherEntityNum );
CG_JumpKick( es );
break;
case EV_SHOTGUN:
DEBUGNAME("EV_SHOTGUN");
@ -1947,9 +2004,12 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
case EV_RQ3_SOUND:
DEBUGNAME("EV_RQ3_SOUND");
switch (es->eventParm) {
// Elder: handled in EV_JUMPKICK now
// But this is for non-client hits like glass
case RQ3_SOUND_KICK:
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.kickSound);
break;
//Elder: handled in EV_HEADSHOT now
/*
case RQ3_SOUND_HEADSHOT:
@ -1967,9 +2027,14 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
//TODO: make sparks from hit position
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.kevlarHitSound);
break;
//case RQ3_SOUND_RELOAD_PISTOL:
//trap_S_StartSound( es->pos.trBase, es->number, CHAN_AUTO, cgs.media.reloadmk23Sound);
//break;
case RQ3_SOUND_KNIFEHIT:
//When a player gets slashed
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.knifeHitSound);
break;
case RQ3_SOUND_KNIFEDEATH:
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.knifeDeathSound);
break;
default:
break;
}

View file

@ -895,6 +895,10 @@ typedef struct {
sfxHandle_t silencerSound;
sfxHandle_t kevlarHitSound;
sfxHandle_t weapToggleSound;
sfxHandle_t knifeClankSound;
sfxHandle_t knifeDeathSound;
sfxHandle_t knifeHitSound;
//sfxHandle_t knifeThrowSound;
sfxHandle_t quadSound;
sfxHandle_t tracerSound;
@ -1244,7 +1248,8 @@ extern vmCvar_t cg_RQ3_impactEffects;
extern vmCvar_t cg_RQ3_laserAssist;
//Blaze: anouncer sounds
extern vmCvar_t cg_RQ3_anouncer;
//Elder: different blood types
extern vmCvar_t cg_RQ3_bloodStyle;
extern vmCvar_t cg_drawFriend;
extern vmCvar_t cg_teamChatsOnly;
extern vmCvar_t cg_noVoiceChats;

View file

@ -157,6 +157,8 @@ vmCvar_t cg_RQ3_impactEffects;
vmCvar_t cg_RQ3_laserAssist;
//Blaze: anouncer sounds
vmCvar_t cg_RQ3_anouncer;
//Elder: different blood types
vmCvar_t cg_RQ3_bloodStyle;
vmCvar_t cg_drawFriend;
vmCvar_t cg_teamChatsOnly;
vmCvar_t cg_noVoiceChats;
@ -327,6 +329,7 @@ static cvarTable_t cvarTable[] = { // bk001129
{ &cg_RQ3_impactEffects, "cg_RQ3_impactEffects", "1", CVAR_ARCHIVE },
{ &cg_RQ3_laserAssist, "cg_RQ3_laserAssist", "0", CVAR_ARCHIVE },
{ &cg_RQ3_anouncer, "cg_RQ3_announcer", "1", CVAR_ARCHIVE },
{ &cg_RQ3_bloodStyle, "cg_RQ3_bloodStyle", "0", CVAR_ARCHIVE },
{ &cg_oldRail, "cg_oldRail", "1", CVAR_ARCHIVE},
{ &cg_oldRocket, "cg_oldRocket", "1", CVAR_ARCHIVE},
{ &cg_oldPlasma, "cg_oldPlasma", "1", CVAR_ARCHIVE},
@ -654,6 +657,9 @@ static void CG_RegisterSounds( void ) {
cgs.media.silencerSound = trap_S_RegisterSound( "sound/misc/silencershot.wav", qfalse);
cgs.media.kevlarHitSound = trap_S_RegisterSound( "sound/misc/vest.wav", qfalse);
cgs.media.weapToggleSound = trap_S_RegisterSound( "sound/misc/click.wav", qfalse);
cgs.media.knifeClankSound = trap_S_RegisterSound( "sound/misc/knife_clank.wav", qfalse);
cgs.media.knifeDeathSound = trap_S_RegisterSound( "sound/player/gurp2.wav", qfalse);
cgs.media.knifeHitSound = trap_S_RegisterSound( "sound/misc/knife_hit.wav", qfalse);
#ifdef MISSIONPACK
@ -1000,7 +1006,8 @@ static void CG_RegisterGraphics( void ) {
cgs.media.armorIcon = trap_R_RegisterShaderNoMip( "icons/iconr_yellow" );
cgs.media.machinegunBrassModel = trap_R_RegisterModel( "models/weapons2/shells/m_shell.md3" );
cgs.media.shotgunBrassModel = trap_R_RegisterModel( "models/weapons2/shells/m_shell.md3" );
//Elder: changed from m_shel to s_shell
cgs.media.shotgunBrassModel = trap_R_RegisterModel( "models/weapons2/shells/s_shell.md3" );
cgs.media.gibAbdomen = trap_R_RegisterModel( "models/gibs/abdomen.md3" );
cgs.media.gibArm = trap_R_RegisterModel( "models/gibs/arm.md3" );

View file

@ -1101,6 +1101,8 @@ static void CG_SetWeaponLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int newAni
CG_Printf("Anim: %d, Old lf->frame %d, New lf->frame: %d\n",
newAnimation, lf->frame, anim->firstFrame);
}
lf->oldFrame = lf->frame;
lf->frame = anim->firstFrame;
}
@ -1144,6 +1146,7 @@ cg.time should be between oldFrameTime and frameTime after exit
static void CG_RunLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int newAnimation, float speedScale, qboolean weaponAnim ) {
int f, numFrames;
animation_t *anim;
qboolean resetAnim = qfalse;
// debugging tool to get no animations
if ( cg_animSpeed.integer == 0 ) {
@ -1155,11 +1158,20 @@ static void CG_RunLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int newAnimation
if ( newAnimation != lf->animationNumber || !lf->animation ) {
if (weaponAnim) {
CG_SetWeaponLerpFrame( ci, lf, newAnimation );
resetAnim = qtrue;
} else {
CG_SetLerpFrameAnimation( ci, lf, newAnimation );
}
}
// Elder's chunk of debug code
if (weaponAnim && cg_debugAnim.integer)
{
CG_Printf("(%d)==================\n", cg.time);
CG_Printf("lf->frame (%d), lf->frameTime (%d),\n", lf->frame, lf->frameTime);
CG_Printf("lf->oldFrame (%d), lf->oldFrameTime (%d),\n", lf->oldFrame, lf->oldFrameTime);
}
// if we have passed the current frame, move it to
// oldFrame and calculate a new frame
if ( cg.time >= lf->frameTime ) {
@ -1202,6 +1214,10 @@ static void CG_RunLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int newAnimation
lf->frame = anim->firstFrame + anim->numFrames - 1 - (f%anim->numFrames);
}
else {
//Elder's stuff
if (resetAnim)
lf->frame = anim->firstFrame;
else
lf->frame = anim->firstFrame + f;
}
if ( cg.time > lf->frameTime ) {
@ -1225,6 +1241,7 @@ static void CG_RunLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int newAnimation
} else {
lf->backlerp = 1.0 - (float)( cg.time - lf->oldFrameTime ) / ( lf->frameTime - lf->oldFrameTime );
}
}

View file

@ -1057,13 +1057,6 @@ static void CG_ServerCommand( void ) {
return;
}
/* // zoom back to 1x for Reaction. hawkins
if ( !strcmp( cmd, "zoom1x") ) {
rxn_zoom1x();
return;
}
*/
if ( !strcmp( cmd, "selectpistol") ) {
//CG_Printf("Selecting pistol\n");
//trap_SendConsoleCommand(va("cmd weapon %i\n", WP_PISTOL));

View file

@ -2350,7 +2350,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
mod = cgs.media.bulletFlashModel;
shader = cgs.media.bulletExplosionShader;
mark = cgs.media.bulletMarkShader;
sfx = 0;
sfx = cgs.media.knifeClankSound;
radius = 4;
break;
@ -2358,8 +2358,13 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
break;
}
// Knives always play sound
if (weapon == WP_KNIFE)
i = 1;
else
//Elder: 75% of the time render a bullet ricochet sound
i = (int)(random() * 35) % 4;
if ( sfx && i < 3) {
trap_S_StartSound( origin, ENTITYNUM_WORLD, CHAN_AUTO, sfx );
}
@ -2790,6 +2795,7 @@ void CG_Bullet( vec3_t end, int sourceEntityNum, vec3_t normal,
trace_t trace;
int sourceContentType, destContentType;
vec3_t start;
centity_t *cent;
// if the shooter is currently valid, calc a source point and possibly
// do trail effects
@ -2814,11 +2820,27 @@ void CG_Bullet( vec3_t end, int sourceEntityNum, vec3_t normal,
}
// draw a tracer
// Elder: only if not using SSG, check if this client is the source
if (sourceEntityNum == cg.snap->ps.clientNum)
{
if (cg.snap->ps.weapon != WP_SSG3000)
{
if ( random() < cg_tracerChance.value )
CG_Tracer( start, end );
}
}
else
{
cent = &cg_entities[sourceEntityNum];
if ( cent->currentValid && cent->currentState.weapon != WP_SSG3000)
{
if ( random() < cg_tracerChance.value ) {
CG_Tracer( start, end );
}
}
}
}
}
// impact splash and mark
if ( flesh ) {