From 7a2a0519322d3680eecadd17b0a67c6517ccede6 Mon Sep 17 00:00:00 2001 From: Victor Chow Date: Sat, 18 Aug 2001 20:01:21 +0000 Subject: [PATCH] Elder: Code for VM 0-09-00 Client-side --- reaction/cgame/cg_draw.c | 23 ++++++++++++++++ reaction/cgame/cg_effects.c | 1 - reaction/cgame/cg_event.c | 12 ++++++--- reaction/cgame/cg_local.h | 6 ++++- reaction/cgame/cg_main.c | 2 ++ reaction/cgame/cg_weapons.c | 53 +++++++++++++++++++++++++------------ 6 files changed, 75 insertions(+), 22 deletions(-) diff --git a/reaction/cgame/cg_draw.c b/reaction/cgame/cg_draw.c index fb34764e..a6b7fb3d 100644 --- a/reaction/cgame/cg_draw.c +++ b/reaction/cgame/cg_draw.c @@ -2832,6 +2832,28 @@ static void CG_DrawDamageBlend() CG_FillRect(0,0, SCREEN_WIDTH, SCREEN_HEIGHT, damageColor); } +/* +===================== +CG_DrawIRBlend + +Elder: Small red tint +Note: This sucks - causes 10fps drop on my system so don't use it +===================== +*/ +static void CG_DrawIRBlend() +{ + vec4_t irColor; + + if (bg_itemlist[cg.snap->ps.stats[STAT_HOLDABLE_ITEM]].giTag == HI_BANDOLIER + && cg.rq3_irvision) + { + irColor[0] = 0; + irColor[1] = 1.0f; + irColor[2] = 0; + irColor[3] = 0.1f; + CG_FillRect(0,0,SCREEN_WIDTH, SCREEN_HEIGHT, irColor); + } +} /* @@ -2893,6 +2915,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) { // Elder: draw damage blend CG_DrawDamageBlend(); + //CG_DrawIRBlend(); // draw status bar and other floating elements CG_Draw2D(); diff --git a/reaction/cgame/cg_effects.c b/reaction/cgame/cg_effects.c index 0cb36a90..0ee2589c 100644 --- a/reaction/cgame/cg_effects.c +++ b/reaction/cgame/cg_effects.c @@ -512,7 +512,6 @@ void CG_BleedSpray ( vec3_t start, vec3_t end, int entityNum, int numBursts ) // 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); diff --git a/reaction/cgame/cg_event.c b/reaction/cgame/cg_event.c index d5f1387e..dcae69ae 100644 --- a/reaction/cgame/cg_event.c +++ b/reaction/cgame/cg_event.c @@ -1944,13 +1944,18 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) { case EV_MISSILE_MISS: DEBUGNAME("EV_MISSILE_MISS"); ByteToDir( es->eventParm, dir ); - CG_MissileHitWall( es->weapon, 0, position, dir, IMPACTSOUND_DEFAULT ); + CG_MissileHitWall( es->weapon, 0, position, dir, IMPACTSOUND_DEFAULT, 0 ); break; case EV_MISSILE_MISS_METAL: DEBUGNAME("EV_MISSILE_MISS_METAL"); ByteToDir( es->eventParm, dir ); - CG_MissileHitWall( es->weapon, 0, position, dir, IMPACTSOUND_METAL ); + CG_MissileHitWall( es->weapon, 0, position, dir, IMPACTSOUND_METAL, 0 ); + break; + case EV_KNIFE_MISS: + DEBUGNAME("EV_KNIFE_MISS"); + ByteToDir( es->eventParm, dir ); + CG_MissileHitWall( es->weapon, 0, position, dir, IMPACTSOUND_DEFAULT, RQ3_WPMOD_KNIFESLASH ); break; case EV_RAILTRAIL: @@ -1961,7 +1966,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) { //CG_RailTrail( ci, es->origin2, es->pos.trBase ); if ( es->eventParm != 255 ) { ByteToDir( es->eventParm, dir ); - CG_MissileHitWall( es->weapon, es->clientNum, position, dir, IMPACTSOUND_DEFAULT ); + CG_MissileHitWall( es->weapon, es->clientNum, position, dir, IMPACTSOUND_DEFAULT, 0 ); } break; @@ -1987,6 +1992,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) { case EV_JUMPKICK: DEBUGNAME("EV_JUMPKICK"); ByteToDir( es->eventParm, dir ); + // obviously not the pistol but oh well CG_MissileHitPlayer( WP_PISTOL, position, dir, es->otherEntityNum ); CG_JumpKick( es ); break; diff --git a/reaction/cgame/cg_local.h b/reaction/cgame/cg_local.h index 9a690759..facc843d 100644 --- a/reaction/cgame/cg_local.h +++ b/reaction/cgame/cg_local.h @@ -821,6 +821,9 @@ typedef struct { qhandle_t holeMarkShader; qhandle_t energyMarkShader; + // Elder: rq3 marks + qhandle_t slashMarkShader; + // powerup shaders qhandle_t quadShader; qhandle_t redQuadShader; @@ -1474,7 +1477,8 @@ void CG_RegisterItemVisuals( int itemNum ); void CG_FireWeapon( centity_t *cent, int weapModification ); void CG_ReloadWeapon( centity_t *cent, int reloadStage ); //Elder: added -void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, impactSound_t soundType ); +void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, + vec3_t dir, impactSound_t soundType, int weapModification ); //Elder: added weapMod void CG_MissileHitPlayer( int weapon, vec3_t origin, vec3_t dir, int entityNum ); void CG_ShotgunFire( entityState_t *es, qboolean ism3 ); void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum, qboolean armorPiercing ); diff --git a/reaction/cgame/cg_main.c b/reaction/cgame/cg_main.c index 94ebd980..f3da9c77 100644 --- a/reaction/cgame/cg_main.c +++ b/reaction/cgame/cg_main.c @@ -1145,6 +1145,8 @@ static void CG_RegisterGraphics( void ) { cgs.media.shadowMarkShader = trap_R_RegisterShader( "markShadow" ); cgs.media.wakeMarkShader = trap_R_RegisterShader( "wake" ); cgs.media.bloodMarkShader = trap_R_RegisterShader( "bloodMark" ); + // Elder: added + cgs.media.slashMarkShader = trap_R_RegisterShader( "gfx/damage/slash_mrk" ); // register the inline models cgs.numInlineModels = trap_CM_NumInlineModels(); diff --git a/reaction/cgame/cg_weapons.c b/reaction/cgame/cg_weapons.c index 8e7d4e1f..3871fd43 100644 --- a/reaction/cgame/cg_weapons.c +++ b/reaction/cgame/cg_weapons.c @@ -745,6 +745,8 @@ void CG_RegisterWeapon( int weaponNum ) { //Elder: if no _1st model, point to the weaponModel... this may get funky :) if ( !weaponInfo->firstModel ) { + // Added warning message + CG_Printf(" ^3Warning: %s first-person model not found; using world model^7\n", weaponInfo->item->pickup_name); weaponInfo->firstModel = weaponInfo->weaponModel; } @@ -2224,7 +2226,7 @@ Caused by an EV_MISSILE_MISS event, or directly by local bullet tracing ================= */ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, - vec3_t dir, impactSound_t soundType ) { + vec3_t dir, impactSound_t soundType, int weapModification ) { qhandle_t mod; qhandle_t mark; qhandle_t shader; @@ -2237,6 +2239,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, qboolean alphaFade; qboolean isSprite; int duration; + int angle; //Elder: for impact smoke marks localEntity_t *smokePuff; @@ -2262,7 +2265,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, switch ( weapon ) { -//Blaze: Reaction M4 + //Blaze: Reaction M4 case WP_M4: mod = cgs.media.bulletFlashModel; shader = cgs.media.bulletExplosionShader; @@ -2356,12 +2359,20 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, isSprite = qtrue; break; */ - mod = cgs.media.bulletFlashModel; - shader = cgs.media.bulletExplosionShader; - mark = cgs.media.bulletMarkShader; - sfx = cgs.media.knifeClankSound; - radius = 4; - + if (weapModification == RQ3_WPMOD_KNIFESLASH) + { + mod = cgs.media.bulletFlashModel; + shader = cgs.media.bulletExplosionShader; + mark = cgs.media.slashMarkShader; + sfx = cgs.media.knifeClankSound; + radius = rand() % 4 + 6; + } + else + { + mod = cgs.media.bulletFlashModel; + shader = cgs.media.bulletExplosionShader; + sfx = cgs.media.knifeClankSound; + } break; default: break; @@ -2408,7 +2419,15 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, // color = cgs.clientinfo[clientNum].color; // CG_ImpactMark( mark, origin, dir, random()*360, color[0],color[1], color[2],1, alphaFade, radius, qfalse ); //} else { - CG_ImpactMark( mark, origin, dir, random()*360, 1,1,1,1, alphaFade, radius, qfalse ); + + // Elder: Our knife slashes aren't vertical so don't go beyond 45 degrees + if (weapon == WP_KNIFE) + angle = random() * 90 + 45; + else + angle = random() * 360; + + if ( mark ) + CG_ImpactMark( mark, origin, dir, angle, 1,1,1,1, alphaFade, radius, qfalse ); //} @@ -2449,7 +2468,7 @@ CG_MissileHitPlayer */ void CG_MissileHitPlayer( int weapon, vec3_t origin, vec3_t dir, int entityNum ) { CG_Bleed( origin, entityNum ); - + // some weapons will make an explosion with the blood, while // others will just make the blood //Blaze: None of these are valid @@ -2462,7 +2481,7 @@ void CG_MissileHitPlayer( int weapon, vec3_t origin, vec3_t dir, int entityNum ) case WP_CHAINGUN: case WP_PROX_LAUNCHER: #endif - CG_MissileHitWall( weapon, 0, origin, dir, IMPACTSOUND_FLESH ); + CG_MissileHitWall( weapon, 0, origin, dir, IMPACTSOUND_FLESH, 0 ); break; default: break; @@ -2537,24 +2556,24 @@ static void CG_ShotgunPellet( vec3_t start, vec3_t end, int skipNum, int shellWe { //Blaze: Changed WP_SHOTGUN to WP_M3 if (shellWeapon == WP_M3) - CG_MissileHitWall( WP_M3, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_METAL ); + 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_METAL ); + CG_MissileHitWall( WP_HANDCANNON, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_METAL, 0 ); } } else { //Blaze: Changed WP_SHOTGUN to WP_M3 if (shellWeapon == WP_M3) - CG_MissileHitWall( WP_M3, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_DEFAULT ); + CG_MissileHitWall( WP_M3, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_DEFAULT, 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 ); + CG_MissileHitWall( WP_HANDCANNON, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_DEFAULT, 0 ); } - //CG_MissileHitWall( WP_M3, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_DEFAULT ); + //CG_MissileHitWall( WP_M3, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_DEFAULT, 0 ); } } } @@ -2860,7 +2879,7 @@ void CG_Bullet( vec3_t end, int sourceEntityNum, vec3_t normal, CG_Bleed( end, fleshEntityNum ); } else { //Blaze: Changed WP_MACHINEGUN to WP_PISTOL - CG_MissileHitWall( WP_PISTOL, 0, end, normal, IMPACTSOUND_DEFAULT ); + CG_MissileHitWall( WP_PISTOL, 0, end, normal, IMPACTSOUND_DEFAULT, 0 ); } }