diff options
author | Tim Angus <tim@ngus.net> | 2004-03-03 05:22:52 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2004-03-03 05:22:52 +0000 |
commit | 0825a563b705c50de551951c4c131d0482935c45 (patch) | |
tree | 980527e27a664251cd6ab4bccddcf72eabd00bf3 /src/game | |
parent | b217fba48b8bff70880b33301502adf42ac61973 (diff) |
* Fixed chasecam engagement bug
* Raised turret effectiveness again
* Raised human weapon damage by 5%
* Refactored buildable rendering code
* Buildable rendering now falls back to a box trace when a cap trace misses
* Human ckit can't repair destroyed buildables
* Human reactor strengthened by 50%
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 51 | ||||
-rw-r--r-- | src/game/bg_public.h | 5 | ||||
-rw-r--r-- | src/game/g_active.c | 2 | ||||
-rw-r--r-- | src/game/g_buildable.c | 39 | ||||
-rw-r--r-- | src/game/g_cmds.c | 6 | ||||
-rw-r--r-- | src/game/g_local.h | 2 | ||||
-rw-r--r-- | src/game/g_weapon.c | 2 | ||||
-rw-r--r-- | src/game/tremulous.h | 8 |
8 files changed, 71 insertions, 44 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index a53b8472..167ce0d5 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -4768,3 +4768,54 @@ qboolean BG_rotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ], return qtrue; } + +/* +=============== +BG_PositionBuildableRelativeToPlayer + +Find a place to build a buildable +=============== +*/ +void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps, + const vec3_t mins, const vec3_t maxs, + void (*trace)( trace_t *, const vec3_t, const vec3_t, + const vec3_t, const vec3_t, int, int ), + vec3_t outOrigin, vec3_t outAngles, trace_t *tr ) +{ + vec3_t forward, entityOrigin, targetOrigin; + vec3_t angles, playerOrigin, playerNormal; + float buildDist; + + if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) + { + if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) + VectorSet( playerNormal, 0.0f, 0.0f, -1.0f ); + else + VectorCopy( ps->grapplePoint, playerNormal ); + } + else + VectorSet( playerNormal, 0.0f, 0.0f, 1.0f ); + + VectorCopy( ps->viewangles, angles ); + VectorCopy( ps->origin, playerOrigin ); + buildDist = BG_FindBuildDistForClass( ps->stats[ STAT_PCLASS ] ); + + AngleVectors( angles, forward, NULL, NULL ); + ProjectPointOnPlane( forward, forward, playerNormal ); + VectorNormalize( forward ); + + VectorMA( playerOrigin, buildDist, forward, entityOrigin ); + + VectorCopy( entityOrigin, targetOrigin ); + + //so buildings can be placed facing slopes + VectorMA( entityOrigin, 32, playerNormal, entityOrigin ); + + //so buildings drop to floor + VectorMA( targetOrigin, -128, playerNormal, targetOrigin ); + + (*trace)( tr, entityOrigin, mins, maxs, targetOrigin, ps->clientNum, MASK_PLAYERSOLID ); + VectorCopy( tr->endpos, entityOrigin ); + VectorMA( entityOrigin, 0.1f, playerNormal, outOrigin ); + vectoangles( forward, outAngles ); +} diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 822306a0..02ffad71 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -1067,6 +1067,11 @@ void BG_deactivateItem( int item, int stats[ ] ); qboolean BG_activated( int item, int stats[ ] ); qboolean BG_rotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ], vec3_t outAxis[ 3 ], qboolean inverse, qboolean ceiling ); +void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps, + const vec3_t mins, const vec3_t maxs, + void (*trace)( trace_t *, const vec3_t, const vec3_t, + const vec3_t, const vec3_t, int, int ), + vec3_t outOrigin, vec3_t outAngles, trace_t *tr ); int BG_FindBuildNumForName( char *name ); int BG_FindBuildNumForEntityName( char *name ); diff --git a/src/game/g_active.c b/src/game/g_active.c index 516bac5a..9a1e625c 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -361,7 +361,7 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) } if( ( client->buttons & BUTTON_USE_HOLDABLE ) && !( client->oldbuttons & BUTTON_USE_HOLDABLE ) ) - Cmd_Follow_f( ent ); + Cmd_Follow_f( ent, qtrue ); } diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index ac9b3cbd..fba8a54a 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -2214,10 +2214,9 @@ Checks to see if an item fits in a specific area */ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance, vec3_t origin ) { - vec3_t forward, angles; - vec3_t player_origin, entity_origin, target_origin, normal, cross; + vec3_t angles; + vec3_t entity_origin, normal; vec3_t mins, maxs; - vec3_t temp_v; trace_t tr1, tr2, tr3; int i; itemBuildError_t reason = IBE_NONE; @@ -2226,44 +2225,16 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance int templength; float minNormal; qboolean invert; - - if( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING ) - { - if( ent->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) - VectorSet( normal, 0.0f, 0.0f, -1.0f ); - else - VectorCopy( ent->client->ps.grapplePoint, normal ); - } - else - VectorSet( normal, 0.0f, 0.0f, 1.0f ); - - //FIXME: must sync with cg_buildable.c/CG_GhostBuildable ick. - VectorCopy( ent->s.apos.trBase, angles ); - - AngleVectors( angles, forward, NULL, NULL ); - CrossProduct( forward, normal, cross ); - VectorNormalize( cross ); - CrossProduct( normal, cross, forward ); - VectorNormalize( forward ); - - VectorCopy( ent->s.pos.trBase, player_origin ); - VectorMA( player_origin, distance, forward, entity_origin ); - - VectorCopy( entity_origin, target_origin ); - VectorMA( entity_origin, 32, normal, entity_origin ); - VectorMA( target_origin, -128, normal, target_origin ); + playerState_t *ps = &ent->client->ps; BG_FindBBoxForBuildable( buildable, mins, maxs ); - trap_Trace( &tr1, entity_origin, mins, maxs, target_origin, ent->s.number, MASK_PLAYERSOLID ); - VectorCopy( tr1.endpos, entity_origin ); - VectorMA( entity_origin, 0.1f, normal, entity_origin ); + BG_PositionBuildableRelativeToPlayer( ps, mins, maxs, trap_Trace, entity_origin, angles, &tr1 ); trap_Trace( &tr2, entity_origin, mins, maxs, entity_origin, ent->s.number, MASK_PLAYERSOLID ); - trap_Trace( &tr3, player_origin, NULL, NULL, entity_origin, ent->s.number, MASK_PLAYERSOLID ); + trap_Trace( &tr3, ps->origin, NULL, NULL, entity_origin, ent->s.number, MASK_PLAYERSOLID ); VectorCopy( entity_origin, origin ); - vectoangles( forward, angles ); //this item does not fit here if( tr2.fraction < 1.0 || tr3.fraction < 1.0 ) diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 5762d3f0..b2d56731 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1830,12 +1830,12 @@ void G_StopFollowing( gentity_t *ent ) Cmd_Follow_f ================= */ -void Cmd_Follow_f( gentity_t *ent ) +void Cmd_Follow_f( gentity_t *ent, qboolean toggle ) { int i; char arg[ MAX_TOKEN_CHARS ]; - if( trap_Argc( ) != 2 ) + if( trap_Argc( ) != 2 || toggle ) { if( ent->client->sess.spectatorState == SPECTATOR_FOLLOW ) G_StopFollowing( ent ); @@ -2067,7 +2067,7 @@ void ClientCommand( int clientNum ) else if( Q_stricmp( cmd, "callteamvote" ) == 0 ) Cmd_CallTeamVote_f( ent ); else if( Q_stricmp( cmd, "follow" ) == 0 ) - Cmd_Follow_f( ent ); + Cmd_Follow_f( ent, qfalse ); else if( Q_stricmp (cmd, "follownext") == 0) Cmd_FollowCycle_f( ent, 1 ); else if( Q_stricmp( cmd, "followprev" ) == 0 ) diff --git a/src/game/g_local.h b/src/game/g_local.h index 5f73424d..34491015 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -565,7 +565,7 @@ char *G_NewString( const char *string ); // void Cmd_Score_f( gentity_t *ent ); void G_StopFollowing( gentity_t *ent ); -void Cmd_Follow_f( gentity_t *ent ); +void Cmd_Follow_f( gentity_t *ent, qboolean toggle ); // // g_physics.c diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 2c24c58c..850ccd72 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -575,7 +575,7 @@ void cancelBuildFire( gentity_t *ent ) ( traceEnt->biteam == ent->client->ps.stats[ STAT_PTEAM ] ) && ( ( ent->client->ps.weapon >= WP_HBUILD2 ) && ( ent->client->ps.weapon <= WP_HBUILD ) ) && - traceEnt->spawned ) + traceEnt->spawned && traceEnt->health > 0 ) { if( ent->client->ps.stats[ STAT_MISC ] > 0 ) { diff --git a/src/game/tremulous.h b/src/game/tremulous.h index fa8a1e71..a7b943ff 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -307,7 +307,7 @@ * */ -#define HUMAN_WDMG_MODIFIER 1.0f +#define HUMAN_WDMG_MODIFIER 1.05f #define HDM(d) ((int)((float)d*HUMAN_WDMG_MODIFIER)) #define BLASTER_REPEAT 600 @@ -469,14 +469,14 @@ #define MGTURRET_HEALTH HBHM(450) #define MGTURRET_SPLASHDAMAGE 50 #define MGTURRET_SPLASHRADIUS 100 -#define MGTURRET_ANGULARSPEED 5 //degrees/think ~= 200deg/sec +#define MGTURRET_ANGULARSPEED 6 //degrees/think ~= 200deg/sec #define MGTURRET_ACCURACYTOLERANCE MGTURRET_ANGULARSPEED / 1.5f //angular difference for turret to fire #define MGTURRET_VERTICALCAP 30 // +/- maximum pitch #define MGTURRET_REPEAT 100 #define MGTURRET_RANGE 250 #define MGTURRET_SPREAD 200 #define MGTURRET_DMG HDM(5) -#define MGTURRET_DCC_ANGULARSPEED 6 +#define MGTURRET_DCC_ANGULARSPEED 7 #define MGTURRET_DCC_ACCURACYTOLERANCE MGTURRET_DCC_ANGULARSPEED / 1.5f #define TESLAGEN_BP 10 @@ -502,7 +502,7 @@ #define REACTOR_BP 0 #define REACTOR_BT 20000 -#define REACTOR_HEALTH HBHM(1000) +#define REACTOR_HEALTH HBHM(1500) #define REACTOR_SPLASHDAMAGE 200 #define REACTOR_SPLASHRADIUS 300 #define REACTOR_VALUE 2 |