From 176ad9f581c7612446d6cf04ff06c24b242fbed8 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Fri, 1 Aug 2003 02:04:03 +0000 Subject: * Jetpack media code * Various other media issues * Light flare tweaks * I can spell, no really I can... (canon->cannon) * Other stuff I forgot --- src/cgame/cg_ents.c | 8 ++++---- src/cgame/cg_local.h | 2 ++ src/cgame/cg_main.c | 6 ++++-- src/cgame/cg_players.c | 28 ++++++++++++++++++++++------ src/cgame/cg_weapons.c | 14 +++++++------- src/game/bg_misc.c | 24 ++++++++++++------------ src/game/bg_pmove.c | 6 +++--- src/game/bg_public.h | 4 ++-- src/game/g_active.c | 16 ++++++++-------- src/game/g_missile.c | 6 +++--- src/game/g_weapon.c | 8 ++++---- src/game/tremulous.h | 18 +++++++++--------- 12 files changed, 80 insertions(+), 60 deletions(-) diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index 674c758c..c09f1c0f 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -370,7 +370,7 @@ static void CG_Missile( centity_t *cent ) return; break; - case WP_LUCIFER_CANON: + case WP_LUCIFER_CANNON: ent.skinNum = cg.clientFrame & 1; ent.hModel = weapon->missileModel; ent.renderfx = weapon->missileRenderfx | RF_NOSHADOW; @@ -381,7 +381,7 @@ static void CG_Missile( centity_t *cent ) RotateAroundDirection( ent.axis, cg.time / 4 ); - fraction = (float)s1->generic1 / (float)LCANON_TOTAL_CHARGE; + fraction = (float)s1->generic1 / (float)LCANNON_TOTAL_CHARGE; VectorScale( ent.axis[ 0 ], fraction, ent.axis[ 0 ] ); VectorScale( ent.axis[ 1 ], fraction, ent.axis[ 1 ] ); VectorScale( ent.axis[ 2 ], fraction, ent.axis[ 2 ] ); @@ -522,7 +522,7 @@ static void CG_Portal( centity_t *cent ) #define SETBOUNDS(v1,v2,r) ((v1)[0]=(-r/2),(v1)[1]=(-r/2),(v1)[2]=(-r/2),\ (v2)[0]=(r/2),(v2)[1]=(r/2),(v2)[2]=(r/2)) -#define RADIUSSTEP 1.0f +#define RADIUSSTEP 0.5f #define FLARE_OFF 0 #define FLARE_NOFADE 1 @@ -591,7 +591,7 @@ static void CG_LightFlare( centity_t *cent ) return; //only recalculate radius and ratio every three frames - if( !( cg.clientFrame % 3 ) ) + if( !( cg.clientFrame % 2 ) ) { //can only see the flare when in front of it flare.radius = len / es->origin2[ 0 ]; diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index e1488cba..435de800 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -942,6 +942,8 @@ typedef struct qhandle_t carmourTorsoSkin; qhandle_t clarmourTorsoSkin; qhandle_t larmourTorsoSkin; + + qhandle_t jetpackModel; } cgMedia_t; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 13cd3b96..d651f329 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -880,8 +880,8 @@ static void CG_RegisterClients( void ) trap_UpdateScreen( ); } - cgs.media.helmetModel = trap_R_RegisterModel( "models/players/doom/head.md3" ); - cgs.media.helmetSkin = trap_R_RegisterSkin( "models/players/doom/head_default.skin" ); + cgs.media.helmetModel = trap_R_RegisterModel( "models/players/human_base/helmet.md3" ); + cgs.media.helmetSkin = trap_R_RegisterSkin( "models/players/human_base/helmet_default.skin" ); cgs.media.larmourLegsSkin = trap_R_RegisterSkin( "models/players/sarge/lower_red.skin" ); @@ -889,6 +889,8 @@ static void CG_RegisterClients( void ) cgs.media.clarmourTorsoSkin = trap_R_RegisterSkin( "models/players/sarge/upper_roderic.skin" ); cgs.media.larmourTorsoSkin = trap_R_RegisterSkin( "models/players/sarge/upper_blue.skin" ); + cgs.media.jetpackModel = trap_R_RegisterModel( "models/players/human_base/jetpack.md3" ); + cg.charModelFraction = 1.0f; trap_UpdateScreen( ); diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 3e2235f3..7d49ae2f 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -1501,10 +1501,10 @@ static void CG_PlayerNonSegAngles( centity_t *cent, vec3_t srcAngles, vec3_t non CG_PlayerUpgrade =============== */ -static void CG_PlayerUpgrades( centity_t *cent, refEntity_t *torso ) +static void CG_PlayerUpgrades( centity_t *cent, refEntity_t *legs, + vec3_t torsoAxis[ 3 ], qhandle_t legsModel ) { int held, active; - clientInfo_t *ci; vec3_t acc = { 0.0f, 0.0f, 10.0f }; vec3_t vel = { 0.0f, 0.0f, 0.0f }; vec3_t origin; @@ -1513,15 +1513,28 @@ static void CG_PlayerUpgrades( centity_t *cent, refEntity_t *torso ) vec3_t right = { 0.0f, 1.0f, 0.0f }; vec3_t pvel; int addTime; + refEntity_t jetpack; held = cent->currentState.modelindex; active = cent->currentState.modelindex2; if( held & ( 1 << UP_JETPACK ) ) { - //FIXME: add model to back - //CG_PositionRotatedEntityOnTag( &head, &torso, ci->torsoModel, "tag_back" ); + memset( &jetpack, 0, sizeof( jetpack ) ); + + jetpack.hModel = cgs.media.jetpackModel; + + AxisCopy( torsoAxis, jetpack.axis ); + VectorCopy( cent->lerpOrigin, jetpack.lightingOrigin ); + + //FIXME: change to tag_back when it exists + CG_PositionRotatedEntityOnTag( &jetpack, legs, legsModel, "tag_torso" ); + jetpack.shadowPlane = legs->shadowPlane; + jetpack.renderfx = legs->renderfx; + + trap_R_AddRefEntityToScene( &jetpack ); + if( active & ( 1 << UP_JETPACK ) ) { if( cent->currentState.pos.trDelta[ 2 ] > 10.0f ) @@ -1927,7 +1940,7 @@ void CG_Player( centity_t *cent ) entityState_t *es = ¢->currentState; int class = ( es->powerups >> 8 ) & 0xFF; float scale; - vec3_t tempAxis[ 3 ], tempAxis2[ 3 ]; + vec3_t tempAxis[ 3 ], tempAxis2[ 3 ], torsoAxis[ 3 ]; vec3_t angles; int held = es->modelindex; pTeam_t team = es->powerups & 0xFF; @@ -1980,6 +1993,9 @@ void CG_Player( centity_t *cent ) else CG_PlayerNonSegAngles( cent, angles, legs.axis ); + //for CG_PlayerUpgrades + AxisCopy( torso.axis, torsoAxis ); + //rotate the legs axis to back to the wall if( es->eFlags & EF_WALLCLIMB && BG_rotateAxis( es->angles2, legs.axis, tempAxis, qfalse, es->eFlags & EF_WALLCLIMBCEILING ) ) @@ -2134,7 +2150,7 @@ void CG_Player( centity_t *cent ) if( team == PTE_HUMANS ) CG_AddPlayerWeapon( &torso, NULL, cent ); - CG_PlayerUpgrades( cent, &torso ); + CG_PlayerUpgrades( cent, &legs, torsoAxis, ci->legsModel ); } /* diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index d6efba1f..e5b5fc9d 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -1120,9 +1120,9 @@ void CG_AddViewWeapon( playerState_t *ps ) VectorMA( hand.origin, cg_gun_y.value, cg.refdef.viewaxis[ 1 ], hand.origin ); VectorMA( hand.origin, ( cg_gun_z.value + fovOffset ), cg.refdef.viewaxis[ 2 ], hand.origin ); - if( ps->weapon == WP_LUCIFER_CANON && ps->stats[ STAT_MISC ] > 0 ) + if( ps->weapon == WP_LUCIFER_CANNON && ps->stats[ STAT_MISC ] > 0 ) { - float fraction = (float)ps->stats[ STAT_MISC ] / (float)LCANON_TOTAL_CHARGE; + float fraction = (float)ps->stats[ STAT_MISC ] / (float)LCANNON_TOTAL_CHARGE; VectorMA( hand.origin, random( ) * fraction, cg.refdef.viewaxis[ 0 ], hand.origin ); VectorMA( hand.origin, random( ) * fraction, cg.refdef.viewaxis[ 1 ], hand.origin ); @@ -1648,9 +1648,9 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im radius = 8; break; - #define LCANON_EJECTION_VEL 300 + #define LCANNON_EJECTION_VEL 300 - case WP_LUCIFER_CANON: + case WP_LUCIFER_CANNON: mod = cgs.media.dishFlashModel; shader = cgs.media.bfgExplosionShader; mark = cgs.media.bulletMarkShader; @@ -1671,9 +1671,9 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im else spark = cgs.media.scannerBlipShader; - velocity[ 0 ] = ( 2 * random( ) - 1.0f ) * LCANON_EJECTION_VEL; - velocity[ 1 ] = ( 2 * random( ) - 1.0f ) * LCANON_EJECTION_VEL; - velocity[ 2 ] = ( 2 * random( ) - 1.0f ) * LCANON_EJECTION_VEL; + velocity[ 0 ] = ( 2 * random( ) - 1.0f ) * LCANNON_EJECTION_VEL; + velocity[ 1 ] = ( 2 * random( ) - 1.0f ) * LCANNON_EJECTION_VEL; + velocity[ 2 ] = ( 2 * random( ) - 1.0f ) * LCANNON_EJECTION_VEL; CG_LaunchSprite( origin, velocity, accel, 0.0f, 0.9f, 1.0f, 40.0f, 255, 0, rand( ) % 360, diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 1b2f9777..75d2078e 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1251,12 +1251,12 @@ classAttributes_t bg_classList[ ] = "default", //char *skinname; "alien_general_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages - { -15, -15, -6 }, //vec3_t mins; - { 15, 15, 6 }, //vec3_t maxs; - { 15, 15, 6 }, //vec3_t crouchmaxs; + { -15, -15, -15 }, //vec3_t mins; + { 15, 15, 15 }, //vec3_t maxs; + { 15, 15, 15 }, //vec3_t crouchmaxs; { -15, -15, -4 }, //vec3_t deadmins; { 15, 15, 4 }, //vec3_t deadmaxs; - 7, 7, //int viewheight, crouchviewheight; + 0, 0, //int viewheight, crouchviewheight; SOLDIER_HEALTH, //int health; SOLDIER_REGEN, //int regenRate; SCA_WALLCLIMBER|SCA_CANJUMP|SCA_NOWEAPONDRIFT| @@ -2181,21 +2181,21 @@ weaponAttributes_t bg_weapons[ ] = WUT_HUMANS //WUTeam_t team; }, { - WP_LUCIFER_CANON, //int weaponNum; - LCANON_PRICE, //int price; + WP_LUCIFER_CANNON, //int weaponNum; + LCANNON_PRICE, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages SLOT_WEAPON, //int slots; - "lcanon", //char *weaponName; - "Lucifer Canon", //char *weaponHumanName; - LCANON_AMMO, //int quan; + "lcannon", //char *weaponName; + "Lucifer Cannon", //char *weaponHumanName; + LCANNON_AMMO, //int quan; 0, //int clips; 0, //int maxClips; qfalse, //int infiniteAmmo; qtrue, //int usesEnergy; - LCANON_REPEAT, //int repeatRate1; - LCANON_CHARGEREPEAT, //int repeatRate2; + LCANNON_REPEAT, //int repeatRate1; + LCANNON_CHARGEREPEAT, //int repeatRate2; 0, //int repeatRate3; - LCANON_RELOAD, //int reloadTime; + LCANNON_RELOAD, //int reloadTime; qtrue, //qboolean hasAltMode; qfalse, //qboolean hasThirdMode; qtrue, //qboolean purchasable; diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 16f67a6b..6181e66d 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2530,7 +2530,7 @@ static void PM_Weapon( void ) } break; - case WP_LUCIFER_CANON: + case WP_LUCIFER_CANNON: attack1 = pm->cmd.buttons & BUTTON_ATTACK; attack2 = pm->cmd.buttons & BUTTON_ATTACK2; attack3 = pm->cmd.buttons & BUTTON_USE_HOLDABLE; @@ -2646,9 +2646,9 @@ static void PM_Weapon( void ) if( !BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) ) { //special case for lCanon - if( pm->ps->weapon == WP_LUCIFER_CANON && attack1 ) + if( pm->ps->weapon == WP_LUCIFER_CANNON && attack1 ) { - ammo -= (int)( ceil( ( (float)pm->ps->stats[ STAT_MISC ] / (float)LCANON_TOTAL_CHARGE ) * 10.0f ) ); + ammo -= (int)( ceil( ( (float)pm->ps->stats[ STAT_MISC ] / (float)LCANNON_TOTAL_CHARGE ) * 10.0f ) ); //stay on the safe side if( ammo < 0 ) diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 62ab7fab..dd2f6a15 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -34,7 +34,7 @@ #define CROUCH_VIEWHEIGHT 12 #define DEAD_VIEWHEIGHT -16 -#define LCANON_TOTAL_CHARGE 255 +#define LCANNON_TOTAL_CHARGE 255 // // config strings are a general means of communicating variable length strings @@ -328,7 +328,7 @@ typedef enum WP_FLAMER, WP_MASS_DRIVER, WP_PULSE_RIFLE, - WP_LUCIFER_CANON, + WP_LUCIFER_CANNON, WP_LAS_GUN, WP_PAIN_SAW, diff --git a/src/game/g_active.c b/src/game/g_active.c index ecae1f6c..4f6726d0 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -485,20 +485,20 @@ void ClientTimerActions( gentity_t *ent, int msec ) } //client is charging up an lcanon - if( client->ps.weapon == WP_LUCIFER_CANON ) + if( client->ps.weapon == WP_LUCIFER_CANNON ) { int ammo; - BG_unpackAmmoArray( WP_LUCIFER_CANON, client->ps.ammo, client->ps.powerups, &ammo, NULL, NULL ); + BG_unpackAmmoArray( WP_LUCIFER_CANNON, client->ps.ammo, client->ps.powerups, &ammo, NULL, NULL ); - if( client->ps.stats[ STAT_MISC ] < LCANON_TOTAL_CHARGE && ucmd->buttons & BUTTON_ATTACK ) - client->ps.stats[ STAT_MISC ] += ( 100.0f / LCANON_CHARGE_TIME ) * LCANON_TOTAL_CHARGE; + if( client->ps.stats[ STAT_MISC ] < LCANNON_TOTAL_CHARGE && ucmd->buttons & BUTTON_ATTACK ) + client->ps.stats[ STAT_MISC ] += ( 100.0f / LCANNON_CHARGE_TIME ) * LCANNON_TOTAL_CHARGE; - if( client->ps.stats[ STAT_MISC ] > LCANON_TOTAL_CHARGE ) - client->ps.stats[ STAT_MISC ] = LCANON_TOTAL_CHARGE; + if( client->ps.stats[ STAT_MISC ] > LCANNON_TOTAL_CHARGE ) + client->ps.stats[ STAT_MISC ] = LCANNON_TOTAL_CHARGE; - if( client->ps.stats[ STAT_MISC ] > ( ammo * LCANON_TOTAL_CHARGE ) / 10 ) - client->ps.stats[ STAT_MISC ] = ammo * LCANON_TOTAL_CHARGE / 10; + if( client->ps.stats[ STAT_MISC ] > ( ammo * LCANNON_TOTAL_CHARGE ) / 10 ) + client->ps.stats[ STAT_MISC ] = ammo * LCANNON_TOTAL_CHARGE / 10; } switch( client->ps.weapon ) diff --git a/src/game/g_missile.c b/src/game/g_missile.c index 303b192e..5efecd70 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -340,7 +340,7 @@ gentity_t *fire_luciferCanon( gentity_t *self, vec3_t start, vec3_t dir, int dam { gentity_t *bolt; int localDamage = (int)( ceil( ( (float)damage / - (float)LCANON_TOTAL_CHARGE ) * (float)LCANON_DAMAGE ) ); + (float)LCANNON_TOTAL_CHARGE ) * (float)LCANNON_DAMAGE ) ); VectorNormalize( dir ); @@ -350,7 +350,7 @@ gentity_t *fire_luciferCanon( gentity_t *self, vec3_t start, vec3_t dir, int dam bolt->think = G_ExplodeMissile; bolt->s.eType = ET_MISSILE; bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; - bolt->s.weapon = WP_LUCIFER_CANON; + bolt->s.weapon = WP_LUCIFER_CANNON; bolt->r.ownerNum = self->s.number; bolt->parent = self; bolt->damage = localDamage; @@ -365,7 +365,7 @@ gentity_t *fire_luciferCanon( gentity_t *self, vec3_t start, vec3_t dir, int dam bolt->s.pos.trType = TR_LINEAR; bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame VectorCopy( start, bolt->s.pos.trBase ); - VectorScale( dir, LCANON_SPEED, bolt->s.pos.trDelta ); + VectorScale( dir, LCANNON_SPEED, bolt->s.pos.trDelta ); SnapVector( bolt->s.pos.trDelta ); // save net bandwidth VectorCopy( start, bolt->r.currentOrigin ); diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 968b2149..731f1269 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -333,7 +333,7 @@ void painSawFire( gentity_t *ent ) /* ====================================================================== -LUCIFER CANON +LUCIFER CANNON ====================================================================== */ @@ -348,7 +348,7 @@ void LCChargeFire( gentity_t *ent, qboolean secondary ) gentity_t *m; if( secondary ) - ent->client->ps.stats[ STAT_MISC ] = LCANON_SECONDARY_DAMAGE; + ent->client->ps.stats[ STAT_MISC ] = LCANNON_SECONDARY_DAMAGE; m = fire_luciferCanon( ent, muzzle, forward, ent->client->ps.stats[ STAT_MISC ] ); @@ -985,7 +985,7 @@ void FireWeapon2( gentity_t *ent ) groundPound( ent ); break; - case WP_LUCIFER_CANON: + case WP_LUCIFER_CANNON: LCChargeFire( ent, qtrue ); break; @@ -1055,7 +1055,7 @@ void FireWeapon( gentity_t *ent ) case WP_MASS_DRIVER: massDriverFire( ent ); break; - case WP_LUCIFER_CANON: + case WP_LUCIFER_CANNON: LCChargeFire( ent, qfalse ); break; case WP_LAS_GUN: diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 35eb7a02..d21d5a62 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -315,15 +315,15 @@ #define PRIFLE_DMG HDM(20) #define PRIFLE_SPEED 1500 -#define LCANON_PRICE 400 -#define LCANON_AMMO 30 -#define LCANON_REPEAT 500 -#define LCANON_CHARGEREPEAT 1000 -#define LCANON_RELOAD 2000 -#define LCANON_DAMAGE HDM(200) -#define LCANON_SECONDARY_DAMAGE 20 -#define LCANON_SPEED 250 -#define LCANON_CHARGE_TIME 2000 +#define LCANNON_PRICE 400 +#define LCANNON_AMMO 30 +#define LCANNON_REPEAT 500 +#define LCANNON_CHARGEREPEAT 1000 +#define LCANNON_RELOAD 2000 +#define LCANNON_DAMAGE HDM(200) +#define LCANNON_SECONDARY_DAMAGE 20 +#define LCANNON_SPEED 250 +#define LCANNON_CHARGE_TIME 2000 #define LASGUN_PRICE 200 #define LASGUN_AMMO 300 -- cgit