From d7b5d29544d13b99fe31d6af8690cf0712bb3254 Mon Sep 17 00:00:00 2001 From: Victor Chow Date: Mon, 12 Nov 2001 08:59:46 +0000 Subject: [PATCH] Elder: Pre- 0-18-00 VMs Client-Side --- reaction/cgame/cg_effects.c | 18 +++--- reaction/cgame/cg_ents.c | 16 +++-- reaction/cgame/cg_local.h | 5 +- reaction/cgame/cg_main.c | 5 ++ reaction/cgame/cg_weapons.c | 120 ++++++++++++++++++++++++++++++++---- 5 files changed, 138 insertions(+), 26 deletions(-) diff --git a/reaction/cgame/cg_effects.c b/reaction/cgame/cg_effects.c index 26505cf8..3e92bb8b 100644 --- a/reaction/cgame/cg_effects.c +++ b/reaction/cgame/cg_effects.c @@ -459,7 +459,7 @@ localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir, // set origin VectorCopy( newOrigin, ex->refEntity.origin ); VectorCopy( newOrigin, ex->refEntity.oldorigin ); - + ex->color[0] = ex->color[1] = ex->color[2] = 1.0; return ex; @@ -960,12 +960,12 @@ void CG_BreakGlass( vec3_t playerOrigin, int glassParm, int type ) { glassParm &= ~newParm; glassParm = glassParm << (type * 4); - CG_Printf("glassParm: %i\n", glassParm); + //CG_Printf("glassParm: %i\n", glassParm); //Elder: check debris type and assign debris models if ( (glassParm & RQ3_DEBRIS_WOOD) == RQ3_DEBRIS_WOOD) { - CG_Printf("Launching wood\n"); + //CG_Printf("Launching wood\n"); debris1 = cgs.media.wood01; debris2 = cgs.media.wood02; debris3 = cgs.media.wood03; @@ -973,7 +973,7 @@ void CG_BreakGlass( vec3_t playerOrigin, int glassParm, int type ) { } else if ( (glassParm & RQ3_DEBRIS_METAL) == RQ3_DEBRIS_METAL) { - CG_Printf("Launching metal\n"); + //CG_Printf("Launching metal\n"); debris1 = cgs.media.metal01; debris2 = cgs.media.metal02; debris3 = cgs.media.metal03; @@ -981,7 +981,7 @@ void CG_BreakGlass( vec3_t playerOrigin, int glassParm, int type ) { } else if ( (glassParm & RQ3_DEBRIS_CERAMIC) == RQ3_DEBRIS_CERAMIC) { - CG_Printf("Launching ceramic\n"); + //CG_Printf("Launching ceramic\n"); debris1 = cgs.media.ceramic01; debris2 = cgs.media.ceramic02; debris3 = cgs.media.ceramic03; @@ -989,7 +989,7 @@ void CG_BreakGlass( vec3_t playerOrigin, int glassParm, int type ) { } else if ( (glassParm & RQ3_DEBRIS_PAPER) == RQ3_DEBRIS_PAPER) { - CG_Printf("Launching paper\n"); + //CG_Printf("Launching paper\n"); debris1 = cgs.media.paper01; debris2 = cgs.media.paper02; debris3 = cgs.media.paper03; @@ -997,7 +997,7 @@ void CG_BreakGlass( vec3_t playerOrigin, int glassParm, int type ) { } else if ( (glassParm & RQ3_DEBRIS_BRICK) == RQ3_DEBRIS_BRICK) { - CG_Printf("Launching brick\n"); + //CG_Printf("Launching brick\n"); debris1 = cgs.media.brick01; debris2 = cgs.media.brick02; debris3 = cgs.media.brick03; @@ -1005,7 +1005,7 @@ void CG_BreakGlass( vec3_t playerOrigin, int glassParm, int type ) { } else if ( (glassParm & RQ3_DEBRIS_CONCRETE) == RQ3_DEBRIS_CONCRETE) { - CG_Printf("Launching concrete\n"); + //CG_Printf("Launching concrete\n"); debris1 = cgs.media.concrete01; debris2 = cgs.media.concrete02; debris3 = cgs.media.concrete03; @@ -1023,7 +1023,7 @@ void CG_BreakGlass( vec3_t playerOrigin, int glassParm, int type ) { else { //glass is default - CG_Printf("Launching glass\n"); + //CG_Printf("Launching glass\n"); debris1 = cgs.media.glass01; debris2 = cgs.media.glass02; debris3 = cgs.media.glass03; diff --git a/reaction/cgame/cg_ents.c b/reaction/cgame/cg_ents.c index 1968f047..b3506e0a 100644 --- a/reaction/cgame/cg_ents.c +++ b/reaction/cgame/cg_ents.c @@ -418,12 +418,20 @@ 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 -//Blaze: Dont make models bigger -/* + + // Elder: only for knives, which are hard to spot + if ( item->giTag == WP_KNIFE ) + { + VectorScale( ent.axis[0], 1.2f, ent.axis[0] ); + VectorScale( ent.axis[1], 1.2f, ent.axis[1] ); + VectorScale( ent.axis[2], 1.2f, ent.axis[2] ); + } + + //Blaze: Dont make models bigger + /* if ( item->giType == IT_WEAPON ) { VectorScale( ent.axis[0], 1.5, ent.axis[0] ); VectorScale( ent.axis[1], 1.5, ent.axis[1] ); @@ -433,7 +441,7 @@ static void CG_Item( centity_t *cent ) { trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cgs.media.weaponHoverSound ); #endif } -*/ + */ #ifdef MISSIONPACK if ( item->giType == IT_HOLDABLE && item->giTag == HI_KAMIKAZE ) { diff --git a/reaction/cgame/cg_local.h b/reaction/cgame/cg_local.h index 48195292..00ef41e2 100644 --- a/reaction/cgame/cg_local.h +++ b/reaction/cgame/cg_local.h @@ -816,7 +816,6 @@ typedef struct { qhandle_t akimbo1stModel; qhandle_t akimboHandModel; - qhandle_t smoke2; qhandle_t machinegunBrassModel; @@ -905,6 +904,10 @@ typedef struct { qhandle_t dishFlashModel; qhandle_t lightningExplosionModel; + // Elder: hit spark to replace bulletFlash + qhandle_t hitSparkModel; + qhandle_t hitSparkShader; + // Elder: RQ3 item models qhandle_t rq3_kevlarModel; diff --git a/reaction/cgame/cg_main.c b/reaction/cgame/cg_main.c index e47e28b2..387eb16d 100644 --- a/reaction/cgame/cg_main.c +++ b/reaction/cgame/cg_main.c @@ -1108,6 +1108,11 @@ static void CG_RegisterGraphics( void ) { cgs.media.bulletFlashModel = trap_R_RegisterModel("models/weaphits/bullet.md3"); cgs.media.ringFlashModel = trap_R_RegisterModel("models/weaphits/ring02.md3"); cgs.media.dishFlashModel = trap_R_RegisterModel("models/weaphits/boom01.md3"); + + // Elder: added + cgs.media.hitSparkModel = trap_R_RegisterModel("models/weaphits/tracer/tracer.md3"); + cgs.media.hitSparkShader = trap_R_RegisterShader("models/weaphits/tracer/tracer"); + #ifdef MISSIONPACK cgs.media.teleportEffectModel = trap_R_RegisterModel( "models/powerups/pop.md3" ); #else diff --git a/reaction/cgame/cg_weapons.c b/reaction/cgame/cg_weapons.c index fd6ad43c..6a94d697 100644 --- a/reaction/cgame/cg_weapons.c +++ b/reaction/cgame/cg_weapons.c @@ -2792,13 +2792,15 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, duration = 600; switch ( weapon ) { + // Elder: bullet weapons all fall under MK23 >:( case WP_M4: case WP_MP5: case WP_PISTOL: case WP_AKIMBO: case WP_SSG3000: - mod = cgs.media.bulletFlashModel; - shader = cgs.media.bulletExplosionShader; + duration = 160; + mod = cgs.media.hitSparkModel; + shader = cgs.media.hitSparkShader; radius = 8; r = rand() & 3; @@ -3049,8 +3051,11 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, case WP_M3: case WP_HANDCANNON: - mod = cgs.media.bulletFlashModel; - shader = cgs.media.bulletExplosionShader; + duration = 200; + mod = cgs.media.hitSparkModel; + shader = cgs.media.hitSparkShader; + //mod = cgs.media.bulletFlashModel; + //shader = cgs.media.bulletExplosionShader; if (soundType == IMPACTSOUND_GLASS) mark = cgs.media.glassMarkShader; else if (soundType == IMPACTSOUND_METAL) @@ -3084,16 +3089,22 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, */ if (weapModification == RQ3_WPMOD_KNIFESLASH) { - mod = cgs.media.bulletFlashModel; - shader = cgs.media.bulletExplosionShader; + duration = 100; + mod = cgs.media.hitSparkModel; + shader = cgs.media.hitSparkShader; + //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; + duration = 180; + mod = cgs.media.hitSparkModel; + shader = cgs.media.hitSparkShader; + //mod = cgs.media.bulletFlashModel; + //shader = cgs.media.bulletExplosionShader; sfx = cgs.media.knifeClankSound; } break; @@ -3118,12 +3129,97 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, // // create the explosion // - if ( mod ) { - le = CG_MakeExplosion( origin, dir, + if ( mod ) + { + if ( weapon == WP_GRENADE ) + { + le = CG_MakeExplosion( origin, dir, mod, shader, duration, isSprite ); - le->light = light; - VectorCopy( lightColor, le->lightColor ); + le->light = light; + VectorCopy( lightColor, le->lightColor ); + } + else + { + vec3_t temp, offsetDir; + byte color[4]; + int flashCount; + float scale; + + switch ( weapon ) + { + case WP_MP5: + case WP_PISTOL: + case WP_AKIMBO: + flashCount = 3 + rand() % 3; + color[0] = 224; + color[1] = 180; + color[2] = 128; + color[3] = 192; + break; + case WP_M4: + case WP_KNIFE: + flashCount = 3 + rand() % 3; + color[0] = 192; + color[1] = 96; + color[2] = 64; + color[3] = 192; + break; + case WP_M3: + case WP_HANDCANNON: + flashCount = 2 + rand() % 3; + color[0] = 192; + color[1] = 96; + color[2] = 64; + color[3] = 192; + break; + case WP_SSG3000: + default: + flashCount = 4 + rand() % 3; + color[0] = 255; + color[1] = 224; + color[2] = 128; + color[3] = 192; + break; + } + + // Elder: should probably dump this into another function + for ( i = 0; i < flashCount; i++ ) + { + // introduce variance + VectorCopy( dir, temp ); + scale = crandom() + 1.8f; + temp[0] += (crandom() * 0.4f) - 0.2f; + temp[1] += (crandom() * 0.4f) - 0.2f; + temp[2] += (crandom() * 0.4f) - 0.2f; + // save result + VectorCopy( temp, offsetDir ); + VectorScale( temp, scale, temp ); + + le = CG_MakeExplosion( origin, dir, + mod, shader, + duration, isSprite ); + + VectorMA( origin, scale + 0.5f, temp, le->refEntity.origin ); + VectorCopy(temp, le->refEntity.axis[0]); + + // set spark colour + le->refEntity.shaderRGBA[0] = color[0]; + le->refEntity.shaderRGBA[1] = color[1]; + le->refEntity.shaderRGBA[2] = color[2]; + le->refEntity.shaderRGBA[3] = color[3]; + + // readjust behaviour + le->leType = LE_MOVE_SCALE_FADE; + le->pos.trType = TR_LINEAR; + le->pos.trTime = cg.time; + VectorCopy(le->refEntity.origin, le->pos.trBase); + VectorScale(offsetDir, 30, le->pos.trDelta); + + le->light = light; + VectorCopy( lightColor, le->lightColor ); + } + } //Blaze: No railgun /* if ( weapon == WP_RAILGUN ) {