diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 87 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 60 | ||||
-rw-r--r-- | src/game/bg_public.h | 20 | ||||
-rw-r--r-- | src/game/g_active.c | 5 |
4 files changed, 103 insertions, 69 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index cc97f387..1fef2b5c 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1282,6 +1282,7 @@ classAttributes_t bg_classList[ ] = "Builder", //char *className; "Builder", //char *humanName; "lucy", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1310,6 +1311,7 @@ classAttributes_t bg_classList[ ] = "BuilderLevel1", //char *classname; "Advanced Builder", //char *humanname; "lucy", //char *modelname; + 1.0f, //float modelScale; "angel", //char *skinname; "alien_hud", //char *hudname; ( 1 << S2 )|( 1 << S3 ), //int stages @@ -1338,6 +1340,7 @@ classAttributes_t bg_classList[ ] = "Offensive", //char *classname; "Offensive", //char *humanname; "klesk", //char *modelname; + 0.5f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1366,6 +1369,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel1", //char *classname; "Offensive Level 1", //char *humanname; "anarki", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1394,6 +1398,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel1-Upgrade", //char *classname; "Offensive Level 1 Upgrade", //char *humanname; "anarki", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1422,6 +1427,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel2", //char *classname; "Offensive Level 2", //char *humanname; "bones", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1450,6 +1456,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel2-Upgrade", //char *classname; "Offensive Level 2 Upgrade", //char *humanname; "bones", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1478,6 +1485,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel3", //char *classname; "Offensive Level 3", //char *humanname; "orbb", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1506,6 +1514,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel3-Upgrade", //char *classname; "Offensive Level 3 Upgrade", //char *humanname; "orbb", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1534,6 +1543,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel4", //char *classname; "Offensive Level 4", //char *humanname; "xaero", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1562,6 +1572,7 @@ classAttributes_t bg_classList[ ] = "Human", //char *classname; "Human", //char *humanname; "sarge", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "human_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1667,6 +1678,26 @@ char *BG_FindModelNameForClass( int pclass ) /* ============== +BG_FindModelScaleForClass +============== +*/ +float BG_FindModelScaleForClass( int pclass ) +{ + int i; + + for( i = 0; i < bg_numPclasses; i++ ) + { + if( bg_classList[ i ].classNum == pclass ) + { + return bg_classList[ i ].modelScale; + } + } + + return 1.0f; +} + +/* +============== BG_FindSkinNameForClass ============== */ @@ -3699,10 +3730,9 @@ void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean s->powerups = ps->stats[ STAT_PTEAM ] | ( ps->stats[ STAT_PCLASS ] << 8 ); //TA: have to get the surfNormal thru somehow... + VectorCopy( ps->grapplePoint, s->angles2 ); if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) - VectorCopy( ceilingNormal, s->angles2 ); - else - VectorCopy( ps->grapplePoint, s->angles2 ); + s->eFlags |= EF_WALLCLIMBCEILING; s->loopSound = ps->loopSound; s->generic1 = ps->generic1; @@ -3799,10 +3829,9 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s s->powerups = ps->stats[ STAT_PTEAM ] | ( ps->stats[ STAT_PCLASS ] << 8 ); //TA: have to get the surfNormal thru somehow... + VectorCopy( ps->grapplePoint, s->angles2 ); if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) - VectorCopy( ceilingNormal, s->angles2 ); - else - VectorCopy( ps->grapplePoint, s->angles2 ); + s->eFlags |= EF_WALLCLIMBCEILING; s->loopSound = ps->loopSound; s->generic1 = ps->generic1; @@ -3929,3 +3958,49 @@ qboolean BG_activated( int item, int stats[ ] ) return( stats[ STAT_ACTIVEITEMS ] & ( 1 << item ) ); } +qboolean BG_rotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ], + vec3_t outAxis[ 3 ], qboolean inverse, qboolean ceiling ) +{ + vec3_t refNormal = { 0.0f, 0.0f, 1.0f }; + vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f }; + vec3_t localNormal, xNormal; + float rotAngle; + + //the grapplePoint being a surfNormal rotation Normal hack... see above :) + if( ceiling ) + { + VectorCopy( ceilingNormal, localNormal ); + VectorCopy( surfNormal, xNormal ); + } + else + { + //cross the reference normal and the surface normal to get the rotation axis + VectorCopy( surfNormal, localNormal ); + CrossProduct( localNormal, refNormal, xNormal ); + VectorNormalize( xNormal ); + } + + //if we're a wall climber.. and we're climbing rotate the axis + if( VectorLength( xNormal ) != 0.0f ) + { + //if the normal pointing straight down then the rotAngle will always be 180deg + if( surfNormal[ 2 ] == -1.0f ) + rotAngle = 180.0f; + else + rotAngle = RAD2DEG( acos( DotProduct( localNormal, refNormal ) ) ); + + if( inverse ) + rotAngle = -rotAngle; + + AngleNormalize180( rotAngle ); + + //hmmm could get away with only one rotation and some clever stuff later... but i'm lazy + RotatePointAroundVector( outAxis[ 0 ], xNormal, inAxis[ 0 ], -rotAngle ); + RotatePointAroundVector( outAxis[ 1 ], xNormal, inAxis[ 1 ], -rotAngle ); + RotatePointAroundVector( outAxis[ 2 ], xNormal, inAxis[ 2 ], -rotAngle ); + } + else + return qfalse; + + return qtrue; +} diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 7c948e91..9b274e2f 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -97,12 +97,12 @@ static void PM_StartLegsAnim( int anim ) { if ( pm->ps->legsTimer > 0 ) { return; // a high priority animation is running } - pm->ps->legsAnim = ( ( pm->ps->legsAnim & ( ANIM_TOGGLEBIT | ANIM_WALLCLIMBING ) ) ^ ANIM_TOGGLEBIT ) + pm->ps->legsAnim = ( ( pm->ps->legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim; } static void PM_ContinueLegsAnim( int anim ) { - if ( ( pm->ps->legsAnim & ~( ANIM_TOGGLEBIT | ANIM_WALLCLIMBING ) ) == anim ) { + if ( ( pm->ps->legsAnim & ~ANIM_TOGGLEBIT ) == anim ) { return; } if ( pm->ps->legsTimer > 0 ) { @@ -112,7 +112,7 @@ static void PM_ContinueLegsAnim( int anim ) { } static void PM_ContinueTorsoAnim( int anim ) { - if ( ( pm->ps->torsoAnim & ~( ANIM_TOGGLEBIT | ANIM_WALLCLIMBING ) ) == anim ) { + if ( ( pm->ps->torsoAnim & ~ANIM_TOGGLEBIT ) == anim ) { return; } if ( pm->ps->torsoTimer > 0 ) { @@ -1358,7 +1358,7 @@ static void PM_GroundClimbTrace( void ) vec3_t surfNormal, movedir, lookdir, forward, right, point; vec3_t refNormal = { 0.0f, 0.0f, 1.0f }; vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f }; - float toAngles[3], surfAngles[3]; + vec3_t toAngles, surfAngles; trace_t trace; int i; @@ -1578,7 +1578,7 @@ static void PM_GroundClimbTrace( void ) pml.groundTrace = trace; //so everything knows where we're wallclimbing (ie client side) - pm->ps->legsAnim |= ANIM_WALLCLIMBING; + pm->ps->eFlags |= EF_WALLCLIMB; //if we're not stuck to the ceiling then set grapplePoint to be a surface normal if( !VectorCompare( trace.plane.normal, ceilingNormal ) ) @@ -1606,7 +1606,7 @@ static void PM_GroundClimbTrace( void ) PM_GroundTraceMissed(); pml.groundPlane = qfalse; pml.walking = qfalse; - pm->ps->legsAnim &= ~ANIM_WALLCLIMBING; + pm->ps->eFlags &= ~EF_WALLCLIMB; pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING; @@ -1642,7 +1642,6 @@ PM_GroundTrace static void PM_GroundTrace( void ) { vec3_t point, forward, srotAxis; vec3_t refNormal = { 0.0f, 0.0f, 1.0f }; - vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f }; trace_t trace; float srotAngle; @@ -1673,7 +1672,7 @@ static void PM_GroundTrace( void ) { pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING; pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING; - pm->ps->legsAnim &= ~ANIM_WALLCLIMBING; + pm->ps->eFlags &= ~EF_WALLCLIMB; //make sure that the surfNormal is reset to the ground if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) ) @@ -2488,13 +2487,9 @@ are being updated instead of a full move */ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ) { - short temp[3]; + short temp[ 3 ]; int i; - vec3_t surfNormal, xNormal; - vec3_t axis[3], rotaxis[3]; - vec3_t refNormal = { 0.0f, 0.0f, 1.0f }; - vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f }; - float rotAngle; + vec3_t axis[ 3 ], rotaxis[ 3 ]; vec3_t tempang; if( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPINTERMISSION ) @@ -2528,42 +2523,9 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ) //convert viewangles -> axis AnglesToAxis( tempang, axis ); - //the grapplePoint being a surfNormal rotation Normal hack... see above :) - if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) - { - VectorCopy( ceilingNormal, surfNormal ); - VectorCopy( ps->grapplePoint, xNormal ); - } - else - { - //cross the reference normal and the surface normal to get the rotation axis - VectorCopy( ps->grapplePoint, surfNormal ); - CrossProduct( surfNormal, refNormal, xNormal ); - VectorNormalize( xNormal ); - } - - //if we're a wall climber.. and we're climbing rotate the axis - if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) && - ( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) && - ( VectorLength( xNormal ) != 0 ) ) - { - //if the normal pointing straight down then the rotAngle will always be 180deg - if( surfNormal[2] == -1 ) - rotAngle = 180; - else - rotAngle = RAD2DEG( acos( DotProduct( surfNormal, refNormal ) ) ); - - //hmmm could get away with only one rotation and some clever stuff later... but i'm lazy - RotatePointAroundVector( rotaxis[0], xNormal, axis[0], -rotAngle ); - RotatePointAroundVector( rotaxis[1], xNormal, axis[1], -rotAngle ); - RotatePointAroundVector( rotaxis[2], xNormal, axis[2], -rotAngle ); - } - else - { - //we can't wall climb/aren't wall climbing - rotAngle = 0; + if( !BG_rotateAxis( ps->grapplePoint, axis, rotaxis, qfalse, + ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) ) AxisCopy( axis, rotaxis ); - } //convert the new axis back to angles AxisToAngles( rotaxis, tempang ); diff --git a/src/game/bg_public.h b/src/game/bg_public.h index ab3a1a61..cce117f8 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -278,11 +278,11 @@ typedef enum { // entityState_t->eFlags #define EF_DEAD 0x00000001 // don't draw a foe marker over players with EF_DEAD #define EF_TELEPORT_BIT 0x00000002 // toggled every time the origin abruptly changes -#define EF_AWARD_EXCELLENT 0x00000004 // draw an excellent sprite -#define EF_PLAYER_EVENT 0x00000008 -#define EF_BOUNCE 0x00000010 // for missiles -#define EF_BOUNCE_HALF 0x00000020 // for missiles -#define EF_AWARD_GAUNTLET 0x00000040 // draw a gauntlet sprite +#define EF_PLAYER_EVENT 0x00000004 +#define EF_BOUNCE 0x00000008 // for missiles +#define EF_BOUNCE_HALF 0x00000010 // for missiles +#define EF_WALLCLIMB 0x00000020 // TA: wall walking +#define EF_WALLCLIMBCEILING 0x00000040 // TA: wall walking ceiling hack #define EF_NODRAW 0x00000080 // may have an event, but no model (unspawned items) #define EF_FIRING 0x00000100 // for lightning gun #define EF_FIRING2 0x00000200 // alt fire @@ -291,9 +291,8 @@ typedef enum { #define EF_CONNECTION 0x00001000 // draw a connection trouble sprite #define EF_VOTED 0x00002000 // already cast a vote #define EF_TEAMVOTED 0x00004000 // already cast a vote -#define EF_AWARD_IMPRESSIVE 0x00008000 // draw an impressive sprite -#define EF_OVERDRAW_OFF 0x00010000 // TA: disable overdraw protection on sprites -#define EF_REAL_LIGHT 0x00020000 // TA: light sprites according to ambient light +#define EF_OVERDRAW_OFF 0x00008000 // TA: disable overdraw protection on sprites +#define EF_REAL_LIGHT 0x00010000 // TA: light sprites according to ambient light typedef enum { PW_NONE, @@ -720,7 +719,6 @@ typedef struct animation_s { // flip the togglebit every time an animation // changes so a restart of the same anim can be detected #define ANIM_TOGGLEBIT 128 -#define ANIM_WALLCLIMBING 64 typedef enum { @@ -853,6 +851,7 @@ typedef struct char *humanName; char *modelName; + float modelScale; char *skinName; char *hudName; @@ -1017,6 +1016,8 @@ qboolean BG_gotItem( int item, int stats[ ] ); void BG_activateItem( int item, int stats[ ] ); 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 ); int BG_FindBuildNumForName( char *name ); int BG_FindBuildNumForEntityName( char *name ); @@ -1053,6 +1054,7 @@ int BG_FindClassNumForName( char *name ); char *BG_FindNameForClassNum( int pclass ); char *BG_FindHumanNameForClassNum( int pclass ); char *BG_FindModelNameForClass( int pclass ); +float BG_FindModelScaleForClass( int pclass ); char *BG_FindSkinNameForClass( int pclass ); char *BG_FindHudNameForClass( int pclass ); qboolean BG_FindStagesForClass( int pclass, stage_t stage ); diff --git a/src/game/g_active.c b/src/game/g_active.c index f6a76c70..077acecd 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -852,11 +852,6 @@ void ClientThink_real( gentity_t *ent ) { return; } - // clear the rewards if time - if ( level.time > client->rewardTime ) { - client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET ); - } - if( client->noclip ) client->ps.pm_type = PM_NOCLIP; else if( client->ps.stats[STAT_HEALTH] <= 0 ) |