VM 0-17-00
Client-side
This commit is contained in:
Victor Chow 2001-11-11 07:23:16 +00:00
parent c4638e632a
commit 4371354291
7 changed files with 66 additions and 173 deletions

View file

@ -48,10 +48,6 @@ static void CG_DropWeapon_f (void) {
return;
}
//Elder: don't allow weapon dropping when in the middle of bursts
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");
@ -85,10 +81,6 @@ static void CG_DropItem_f (void) {
return;
}
//Elder: don't allow item dropping when in the middle of bursts
//if (cg.snap->ps.stats[STAT_BURST] > 0)
//return;
trap_SendClientCommand("dropitem");
}

View file

@ -608,8 +608,8 @@ static void CG_DrawStatusBar( void ) {
}
// Elder: temporary
if (cg.snap->ps.stats[STAT_RELOADTIME] > 0)
UI_DrawProportionalString( 10, 400, va("%i", cg.snap->ps.stats[STAT_RELOADTIME]), style, colors[2]);
//if (cg.snap->ps.stats[STAT_RELOADTIME] > 0)
//UI_DrawProportionalString( 10, 400, va("%i", cg.snap->ps.stats[STAT_RELOADTIME]), style, colors[2]);
//Elder: draw grenades, if any, on the side
if (cg.snap->ps.ammo[ WP_GRENADE ] > 0)

View file

@ -418,6 +418,7 @@ static void CG_Item( centity_t *cent ) {
( item->giType == IT_AMMO) ||
( item->giType == IT_HOLDABLE) ) {
ent.renderfx |= RF_MINLIGHT;
//ent.customShader = cgs.media.itemStrobeShader;
}
// increase the size of the weapons when they are presented as items

View file

@ -2125,7 +2125,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
*/
case RQ3_SOUND_LCA:
//Global sound
trap_S_StartSound( NULL, cg.snap->ps.clientNum, CHAN_AUTO, cgs.media.lcaSound);
//trap_S_StartSound( NULL, cg.snap->ps.clientNum, CHAN_AUTO, cgs.media.lcaSound);
break;
case RQ3_SOUND_KEVLARHIT:
//TODO: make sparks from hit position

View file

@ -403,18 +403,16 @@ typedef struct {
#define MAX_OTHER_SOUNDS 5
#define MAX_ANIM_SOUNDS 16
// Singly-linked list
struct sfxSyncInfo_s {
int frame;
sfxHandle_t sound;
qboolean played;
//struct sfxSyncInfo_s *next;
};
typedef struct sfxSyncInfo_s sfxSyncInfo_t;
typedef struct sfxWeapTiming_s {
typedef struct {
int numFrames;
sfxSyncInfo_t sfxInfo[MAX_ANIM_SOUNDS];
} sfxWeapTiming_t;
@ -462,19 +460,11 @@ typedef struct weaponInfo_s {
sfxHandle_t readySound;
sfxHandle_t firingSound;
sfxWeapTiming_t animationSounds[MAX_ANIM_SOUNDS];
// Elder: sounds to queue
/*
sfxSyncInfo_t activateSound[2]; // last one is an endpoint node
sfxSyncInfo_t disarmSound[2]; // last one is an endpoint node
sfxSyncInfo_t reloadSounds[MAX_RELOAD_SOUNDS];
sfxSyncInfo_t otherSounds[MAX_OTHER_SOUNDS];
*/
// Deprecated
sfxHandle_t reloadSound1; // Elder: for various reload stages such as
sfxHandle_t reloadSound2; // Clip in, clip out, sliding, sliding bolt,
sfxHandle_t reloadSound3; // etc. Three should be enough
sfxWeapTiming_t animationSounds[MAX_ANIM_SOUNDS];
sfxHandle_t worldReloadSound[3];
qboolean loopFireSound;
} weaponInfo_t;
@ -850,6 +840,9 @@ typedef struct {
qhandle_t backTileShader;
qhandle_t noammoShader;
//Elder: item strobe to increase brightness
qhandle_t itemStrobeShader;
//Elder: C3A Laser tutorial
qhandle_t laserShader;
@ -967,7 +960,7 @@ typedef struct {
// sounds
sfxHandle_t kickSound; //Elder: kick sound
sfxHandle_t headshotSound; //Elder: splat
sfxHandle_t lcaSound; //Elder: lights, camera, action!
//sfxHandle_t lcaSound; //Elder: lights, camera, action!
sfxHandle_t lensSound; //Elder: sniper lens zoom
sfxHandle_t silencerSound;
sfxHandle_t kevlarHitSound;

View file

@ -665,7 +665,7 @@ static void CG_RegisterSounds( void ) {
cgs.media.kickSound = trap_S_RegisterSound( "sound/misc/kick.wav", qfalse);
cgs.media.lensSound = trap_S_RegisterSound( "sound/misc/lens.wav", qfalse);
cgs.media.headshotSound = trap_S_RegisterSound( "sound/misc/headshot.wav", qfalse);
cgs.media.lcaSound = trap_S_RegisterSound( "sound/misc/lca.wav", qfalse);
//cgs.media.lcaSound = trap_S_RegisterSound( "sound/misc/lca.wav", qfalse);
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);
@ -962,6 +962,7 @@ static void CG_RegisterGraphics( void ) {
// Elder: RQ3 misc. shaders
cgs.media.irPlayerShader = trap_R_RegisterShader("powerups/irdetail");
cgs.media.itemStrobeShader = trap_R_RegisterShader("rq3-itemstrobe");
#ifdef MISSIONPACK
if ( cgs.gametype == GT_CTF || cgs.gametype == GT_1FCTF || cgs.gametype == GT_HARVESTER || cg_buildScript.integer ) {

View file

@ -20,12 +20,8 @@ static qboolean CG_ParseWeaponSoundFile( const char *filename, weaponInfo_t *wea
int skip; // Elder: What's this for?
char text[20000];
fileHandle_t f;
//animation_t *animations;
//sfxSyncInfo_t *reloadSounds;
sfxWeapTiming_t *weapTiming;
//animations = weapon->animations;
//reloadSounds = weapon->reloadSounds;
weapTiming = weapon->animationSounds;
// load the file
@ -54,7 +50,7 @@ static qboolean CG_ParseWeaponSoundFile( const char *filename, weaponInfo_t *wea
// Add it to the array
if ( atoi( token ) )
{
Com_Printf("(%i): %s\n", i, token);
//Com_Printf("(%i): %s\n", i, token);
weapTiming->sfxInfo[i].frame = atoi(token);
}
else
@ -66,106 +62,18 @@ static qboolean CG_ParseWeaponSoundFile( const char *filename, weaponInfo_t *wea
if ( !token ) break;
//return qfalse;
Com_Printf("(%i): %s\n", i, token);
//Com_Printf("(%i): %s\n", i, token);
weapTiming->sfxInfo[i].sound = trap_S_RegisterSound( token, qfalse );
}
// Store total number
weapTiming->numFrames = i;
Com_Printf("Total Frames: %i\n", weapTiming->numFrames);
//Com_Printf("Total Frames: %i\n", weapTiming->numFrames);
return qtrue;
// Old crap code
/*
// read information for each phase of a reload
for ( i = 0 ; i < MAX_RELOAD_SOUNDS ; i++ )
{
token = COM_Parse( &text_p );
if ( !token ) break;
// handle "0"/blank listings
if ( !atoi( token ) )
{
// set these to the end frames
reloadSounds[i].frame = animations[WP_ANIM_RELOAD].firstFrame + animations[WP_ANIM_RELOAD].numFrames;
continue;
}
else
reloadSounds[i].frame = atoi( token );
token = COM_Parse( &text_p );
if ( !token ) break;
reloadSounds[i].sound = trap_S_RegisterSound(token, qfalse);
}
if ( i != MAX_RELOAD_SOUNDS ) {
CG_Printf( "Error parsing weapon sound file in reload stage: %s", filename );
return qfalse;
}
// link our reload sound nodes
for ( i = 0; i < MAX_RELOAD_SOUNDS ; i++ )
{
// end frames
if (reloadSounds[i].frame == animations[WP_ANIM_RELOAD].firstFrame + animations[WP_ANIM_RELOAD].numFrames)
reloadSounds[i].next = &reloadSounds[0];
// normal case
else if (i + 1 < MAX_RELOAD_SOUNDS && reloadSounds[i+1].frame != 0)
reloadSounds[i].next = &reloadSounds[i+1];
// shouldn't be here
else
reloadSounds[i].next = &reloadSounds[0];
}
// disarm sound
token = COM_Parse( &text_p );
if ( !token ) {
CG_Printf( "Error parsing weapon sound file in disarm stage: %s", filename );
return qfalse;
}
if ( !atoi( token ) )
CG_Printf( "No disarm sound for %s\n", weapon->item->pickup_name);
else
{
weapon->disarmSound[0].frame = atoi( token );
token = COM_Parse( &text_p );
if ( !token ) {
CG_Printf( "Error parsing weapon sound file in disarm stage: %s", filename );
return qfalse;
}
weapon->disarmSound[0].sound = trap_S_RegisterSound( token, qfalse );
weapon->disarmSound[0].next = &weapon->disarmSound[1];
weapon->disarmSound[1].frame = animations[WP_ANIM_DISARM].firstFrame + animations[WP_ANIM_DISARM].numFrames;
weapon->disarmSound[1].next = &weapon->disarmSound[0];
}
// activate sound
token = COM_Parse( &text_p );
if ( !token ) {
CG_Printf( "Error parsing weapon sound file in activate stage: %s", filename );
return qfalse;
}
if ( !atoi( token ) )
CG_Printf( "No activate sound for %s\n", weapon->item->pickup_name);
else
{
weapon->activateSound[0].frame = atoi( token );
token = COM_Parse( &text_p );
if ( !token ) {
CG_Printf( "Error parsing weapon sound file in activate stage: %s", filename );
return qfalse;
}
weapon->activateSound[0].sound = trap_S_RegisterSound( token, qfalse );
weapon->activateSound[0].next = &weapon->activateSound[1];
weapon->activateSound[1].frame = animations[WP_ANIM_ACTIVATE].firstFrame + animations[WP_ANIM_ACTIVATE].numFrames;
weapon->activateSound[1].next = &weapon->activateSound[0];
}
return qtrue;
*/
}
/* [QUARANTINE] - Weapon Animations - CG_ParseWeaponAnimFile
==========================
CG_ParseWeaponAnimFile
@ -312,12 +220,11 @@ static void CG_ShotgunEjectBrass( centity_t *cent ) {
vec3_t velocity, xvelocity;
vec3_t offset, xoffset;
vec3_t v[3];
int i,isHC;
if (cent->currentState.weapon == WP_HANDCANNON) isHC=1;
int i, isHC;
if (cent->currentState.weapon == WP_HANDCANNON)
isHC=1;
else
{
isHC=0;
}
if ( cg_brassTime.integer <= 0 ) {
return;
@ -917,12 +824,14 @@ void CG_RegisterWeapon( int weaponNum ) {
}
weaponInfo->loopFireSound = qfalse;
switch ( weaponNum ) {
//Blaze: Reaction Pistol
//Blaze: Reaction Pistol
case WP_PISTOL:
MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/mk23/mk23fire.wav", qfalse );
weaponInfo->worldReloadSound[0] = trap_S_RegisterSound( "sound/weapons/mk23/mk23reload.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass;
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
@ -970,6 +879,7 @@ void CG_RegisterWeapon( int weaponNum ) {
//Elder: added
MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/m4/m4fire.wav", qfalse );
weaponInfo->worldReloadSound[0] = trap_S_RegisterSound( "sound/weapons/m4/m4reload.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass;
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
@ -994,6 +904,9 @@ void CG_RegisterWeapon( int weaponNum ) {
//Elder: added
MAKERGB( weaponInfo->flashDlightColor, 1, 0.5f, 0 );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/ssg3000/ssgfire.wav", qfalse );
weaponInfo->worldReloadSound[0] = trap_S_RegisterSound( "sound/weapons/ssg3000/ssgbolt.wav", qfalse );
weaponInfo->worldReloadSound[1] = trap_S_RegisterSound( "sound/weapons/ssg3000/ssgin.wav", qfalse );
weaponInfo->worldReloadSound[2] = trap_S_RegisterSound( "sound/weapons/ssg3000/ssgbolt.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass;
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
Com_sprintf( filename, sizeof(filename), "models/weapons2/ssg3000/animation.cfg" );
@ -1016,6 +929,7 @@ void CG_RegisterWeapon( int weaponNum ) {
//Elder: added
MAKERGB( weaponInfo->flashDlightColor, 1, 0.75f, 0 );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/mp5/mp5fire.wav", qfalse );
weaponInfo->worldReloadSound[0] = trap_S_RegisterSound( "sound/weapons/mp5/mp5reload.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass;
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
@ -1040,7 +954,8 @@ void CG_RegisterWeapon( int weaponNum ) {
MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 );
//Elder: changed to hcfire from cannon_fire
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/handcannon/hcfire.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_ShotgunEjectBrass;
weaponInfo->worldReloadSound[0] = trap_S_RegisterSound( "sound/weapons/handcannon/hcreload.wav", qfalse );
//weaponInfo->ejectBrassFunc = CG_ShotgunEjectBrass;
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
Com_sprintf( filename, sizeof(filename), "models/weapons2/handcannon/animation.cfg" );
@ -1063,6 +978,7 @@ void CG_RegisterWeapon( int weaponNum ) {
case WP_M3:
MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/m3/m3fire.wav", qfalse );
weaponInfo->worldReloadSound[1] = trap_S_RegisterSound( "sound/weapons/m3/m3in.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_ShotgunEjectBrass;
Com_sprintf( filename, sizeof(filename), "models/weapons2/m3/animation.cfg" );
@ -1087,6 +1003,7 @@ void CG_RegisterWeapon( int weaponNum ) {
MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0.5f );
// Elder: no more pseudo-dual sound needed :)
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/mk23/mk23fire.wav", qfalse );
weaponInfo->worldReloadSound[0] = trap_S_RegisterSound( "sound/weapons/akimbo/akimboreload.wav", qfalse );
weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass;
cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
Com_sprintf( filename, sizeof(filename), "models/weapons2/akimbo/animation.cfg" );
@ -1110,7 +1027,7 @@ void CG_RegisterWeapon( int weaponNum ) {
case WP_GRENADE:
//Use the projectile model
weaponInfo->missileModel = trap_R_RegisterModel( "models/weapons2/grenade/gren_projectile.md3" );
//Elder: removed for the last time! :)
//Elder: removed smoke for the last time! :)
//weaponInfo->missileTrailFunc = CG_GrenadeTrail;
weaponInfo->wiTrailTime = 700;
weaponInfo->trailRadius = 32;
@ -1584,7 +1501,7 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
if (cg.curSyncSound.played == qfalse)
{
cg.curSyncSound.played = qtrue;
CG_Printf("Playing a timed sound (%i %i %1.1f)\n", gun.frame, gun.oldframe, gun.backlerp);
//CG_Printf("Playing a timed sound (%i %i %1.1f)\n", gun.frame, gun.oldframe, gun.backlerp);
trap_S_StartLocalSound ( cg.curSyncSound.sound, CHAN_WEAPON );
}
}
@ -3126,6 +3043,8 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
shader = cgs.media.bulletExplosionShader;
if (soundType == IMPACTSOUND_GLASS)
mark = cgs.media.glassMarkShader;
else if (soundType == IMPACTSOUND_METAL)
mark = cgs.media.metalMarkShader;
else
mark = cgs.media.bulletMarkShader;
sfx = 0;
@ -3884,52 +3803,39 @@ void CG_ReloadWeapon (centity_t *cent, int reloadStage)
weaponInfo_t *weap;
ent = &cent->currentState;
if ( ent->weapon == WP_NONE ) {
if ( ent->weapon == WP_NONE )
return;
}
if ( ent->weapon >= WP_NUM_WEAPONS ) {
if ( ent->weapon >= WP_NUM_WEAPONS )
{
CG_Error( "CG_ReloadWeapon: ent->weapon >= WP_NUM_WEAPONS" );
return;
}
weap = &cg_weapons[ ent->weapon ];
/*
switch (reloadStage)
weap = &cg_weapons[ent->weapon];
switch ( reloadStage )
{
case 0:
if (weap->reloadSound1)
{
if (ent->clientNum == cg.snap->ps.clientNum)
trap_S_StartLocalSound(weap->reloadSound1, CHAN_AUTO);
else
trap_S_StartSound(cent->lerpOrigin, ent->number,
CHAN_AUTO, weap->reloadSound1);
}
break;
case 1:
if (weap->reloadSound2)
{
if (ent->clientNum == cg.snap->ps.clientNum)
trap_S_StartLocalSound(weap->reloadSound2, CHAN_AUTO);
else
trap_S_StartSound(cent->lerpOrigin, ent->number,
CHAN_AUTO, weap->reloadSound2);
}
//TODO: drop handcannon shells here
break;
case 2:
if (weap->reloadSound3)
{
if (ent->clientNum == cg.snap->ps.clientNum)
trap_S_StartLocalSound(weap->reloadSound3, CHAN_AUTO);
else
trap_S_StartSound(cent->lerpOrigin, ent->number,
CHAN_AUTO, weap->reloadSound3);
}
break;
default:
CG_Error("CG_ReloadWeapon: Reload stage > 2\n");
break;
case 0:
if (weap->worldReloadSound[0] && ent->clientNum != cg.snap->ps.clientNum)
trap_S_StartSound(cent->lerpOrigin, ent->number, CHAN_AUTO, weap->worldReloadSound[0]);
break;
case 1:
if (weap->worldReloadSound[1] && ent->clientNum != cg.snap->ps.clientNum)
trap_S_StartSound(cent->lerpOrigin, ent->number, CHAN_AUTO, weap->worldReloadSound[1]);
if ( ent->weapon == WP_HANDCANNON )
CG_ShotgunEjectBrass( cent );
break;
case 2:
if (weap->worldReloadSound[2] && ent->clientNum != cg.snap->ps.clientNum)
trap_S_StartSound(cent->lerpOrigin, ent->number, CHAN_AUTO, weap->worldReloadSound[2]);
break;
default:
CG_Error("CG_ReloadWeapon: Reload stage > 2\n");
break;
}
*/
}