diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_buildable.c | 38 | ||||
-rw-r--r-- | src/game/bg_misc.c | 1 | ||||
-rw-r--r-- | src/game/g_buildable.c | 42 |
3 files changed, 55 insertions, 26 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index c83e3692..20a3de09 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -329,7 +329,7 @@ void CG_GhostBuildable( buildable_t buildable ) VectorCopy( entity_origin, target_origin ); VectorMA( entity_origin, 32, normal, entity_origin ); - VectorMA( target_origin, -4096, normal, target_origin ); + VectorMA( target_origin, -128, normal, target_origin ); BG_FindBBoxForBuildable( buildable, mins, maxs ); @@ -338,18 +338,18 @@ void CG_GhostBuildable( buildable_t buildable ) VectorMA( entity_origin, 0.1f, normal, entity_origin ); AngleVectors( angles, forward, NULL, NULL ); - VectorCopy( tr.plane.normal, ent.axis[2] ); - ProjectPointOnPlane( ent.axis[0], forward, ent.axis[2] ); - if( !VectorNormalize( ent.axis[0] ) ) + VectorCopy( tr.plane.normal, ent.axis[ 2 ] ); + ProjectPointOnPlane( ent.axis[ 0 ], forward, ent.axis[ 2 ] ); + if( !VectorNormalize( ent.axis[ 0 ] ) ) { AngleVectors( angles, NULL, NULL, forward ); - ProjectPointOnPlane( ent.axis[0], forward, ent.axis[2] ); - VectorNormalize( ent.axis[0] ); + ProjectPointOnPlane( ent.axis[ 0 ], forward, ent.axis[ 2 ] ); + VectorNormalize( ent.axis[ 0 ] ); } - CrossProduct( ent.axis[0], ent.axis[2], ent.axis[1] ); - ent.axis[1][0] = -ent.axis[1][0]; - ent.axis[1][1] = -ent.axis[1][1]; - ent.axis[1][2] = -ent.axis[1][2]; + CrossProduct( ent.axis[ 0 ], ent.axis[ 2 ], ent.axis[ 1 ] ); + ent.axis[ 1 ][ 0 ] = -ent.axis[ 1 ][ 0 ]; + ent.axis[ 1 ][ 1 ] = -ent.axis[ 1 ][ 1 ]; + ent.axis[ 1 ][ 2 ] = -ent.axis[ 1 ][ 2 ]; VectorMA( entity_origin, -TRACE_DEPTH, tr.plane.normal, end ); VectorMA( entity_origin, 1.0f, tr.plane.normal, start ); @@ -411,18 +411,18 @@ void CG_Buildable( centity_t *cent ) if( surfNormal[ 2 ] != 1.0f ) { AngleVectors( angles, forward, NULL, NULL ); - VectorCopy( surfNormal, ent.axis[2] ); - ProjectPointOnPlane( ent.axis[0], forward, ent.axis[2] ); - if( !VectorNormalize( ent.axis[0] ) ) + VectorCopy( surfNormal, ent.axis[ 2 ] ); + ProjectPointOnPlane( ent.axis[ 0 ], forward, ent.axis[ 2 ] ); + if( !VectorNormalize( ent.axis[ 0 ] ) ) { AngleVectors( angles, NULL, NULL, forward ); - ProjectPointOnPlane( ent.axis[0], forward, ent.axis[2] ); - VectorNormalize( ent.axis[0] ); + ProjectPointOnPlane( ent.axis[ 0 ], forward, ent.axis[ 2 ] ); + VectorNormalize( ent.axis[ 0 ] ); } - CrossProduct( ent.axis[0], ent.axis[2], ent.axis[1] ); - ent.axis[1][0] = -ent.axis[1][0]; - ent.axis[1][1] = -ent.axis[1][1]; - ent.axis[1][2] = -ent.axis[1][2]; + CrossProduct( ent.axis[ 0 ], ent.axis[ 2 ], ent.axis[ 1 ] ); + ent.axis[ 1 ][ 0 ] = -ent.axis[ 1 ][ 0 ]; + ent.axis[ 1 ][ 1 ] = -ent.axis[ 1 ][ 1 ]; + ent.axis[ 1 ][ 2 ] = -ent.axis[ 1 ][ 2 ]; VectorMA( ent.origin, -TRACE_DEPTH, surfNormal, end ); VectorMA( ent.origin, 1.0f, surfNormal, start ); diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 2c294919..f504957e 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -4084,7 +4084,6 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s s->generic1 = ps->generic1; } - //TA: extract the ammo quantity from the array void BG_unpackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int *quan, int *clips, int *maxclips ) { diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 9fa2724b..26de726d 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -383,6 +383,7 @@ void DSpawn_Think( gentity_t *self ) if( ent->s.eType == ET_BUILDABLE || ent->s.number == ENTITYNUM_WORLD ) { + G_Printf( "suiciding %d\n", ent->s.number == ENTITYNUM_WORLD ); G_Damage( self, NULL, NULL, NULL, NULL, 10000, 0, MOD_SUICIDE ); return; } @@ -1506,7 +1507,7 @@ 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; + vec3_t player_origin, entity_origin, target_origin, normal, cross; vec3_t mins, maxs; vec3_t temp_v; trace_t tr1, tr2, tr3; @@ -1516,22 +1517,37 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance int minDistance = 10000; int templength; + 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 ); - angles[PITCH] = 0; // always forward 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 ); - entity_origin[ 2 ] += 32; - target_origin[ 2 ] -= 4096; + VectorMA( entity_origin, 32, normal, entity_origin ); + VectorMA( target_origin, -128, normal, target_origin ); BG_FindBBoxForBuildable( buildable, mins, maxs ); trap_Trace( &tr1, entity_origin, mins, maxs, target_origin, ent->s.number, MASK_PLAYERSOLID ); VectorCopy( tr1.endpos, entity_origin ); - entity_origin[ 2 ] += 0.1f; + VectorMA( entity_origin, 0.1f, normal, entity_origin ); 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 ); @@ -1679,6 +1695,7 @@ Spawns a buildable gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin, vec3_t angles ) { gentity_t *built; + vec3_t normal; //spawn the buildable built = G_Spawn(); @@ -1818,7 +1835,20 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin built->s.groundEntityNum = -1; built->s.pos.trTime = level.time; - VectorSet( built->s.origin2, 0.0f, 0.0f, 1.0f ); + if( builder->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING ) + { + if( builder->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) + VectorSet( normal, 0.0f, 0.0f, -1.0f ); + else + VectorCopy( builder->client->ps.grapplePoint, normal ); + } + else + VectorSet( normal, 0.0f, 0.0f, 1.0f ); + + VectorMA( origin, -10.0f, normal, built->s.pos.trBase ); + + VectorCopy( normal, built->s.origin2 ); + /*VectorSet( built->s.origin2, 0.0f, 0.0f, 1.0f );*/ G_AddEvent( built, EV_BUILD_CONSTRUCT, BANIM_CONSTRUCT1 ); |