diff options
author | Tim Angus <tim@ngus.net> | 2007-10-01 14:52:21 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2007-10-01 14:52:21 +0000 |
commit | e6513f95705560250f00f1ccc0707e01e318192f (patch) | |
tree | e5722c16048785141228061e72ac9e67af0c2f2d /src | |
parent | 939f7c21246459c44b5dbfd12549eb9a1707234c (diff) |
* Fix to bug where crouching and moving wouldn't replenish stamina
* s/MASK_PLAYERSOLID & ~CONTENTS_BODY/MASK_DEADSOLID/
* When finding a player in the server browser, only list each server once
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_predict.c | 4 | ||||
-rw-r--r-- | src/game/g_active.c | 32 | ||||
-rw-r--r-- | src/game/g_physics.c | 2 | ||||
-rw-r--r-- | src/ui/ui_main.c | 19 |
4 files changed, 42 insertions, 15 deletions
diff --git a/src/cgame/cg_predict.c b/src/cgame/cg_predict.c index 59a1641b..e167f0f8 100644 --- a/src/cgame/cg_predict.c +++ b/src/cgame/cg_predict.c @@ -583,12 +583,12 @@ void CG_PredictPlayerState( void ) cg_pmove.debugLevel = cg_debugMove.integer; if( cg_pmove.ps->pm_type == PM_DEAD ) - cg_pmove.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY; + cg_pmove.tracemask = MASK_DEADSOLID; else cg_pmove.tracemask = MASK_PLAYERSOLID; if( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR ) - cg_pmove.tracemask &= ~CONTENTS_BODY; // spectators can fly through bodies + cg_pmove.tracemask = MASK_DEADSOLID; // spectators can fly through bodies cg_pmove.noFootsteps = 0; diff --git a/src/game/g_active.c b/src/game/g_active.c index 17f66352..14c7ad52 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -400,7 +400,7 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) memset( &pm, 0, sizeof( pm ) ); pm.ps = &client->ps; pm.cmd = *ucmd; - pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY; // spectators can fly through bodies + pm.tracemask = MASK_DEADSOLID; // spectators can fly through bodies pm.trace = trap_Trace; pm.pointcontents = trap_PointContents; @@ -513,6 +513,9 @@ void ClientTimerActions( gentity_t *ent, int msec ) gclient_t *client; usercmd_t *ucmd; int aForward, aRight; + qboolean walking = qfalse, stopped = qfalse, + crouched = qfalse, jumping = qfalse, + strafing = qfalse; int i; ucmd = &ent->client->pers.cmd; @@ -520,6 +523,19 @@ void ClientTimerActions( gentity_t *ent, int msec ) aForward = abs( ucmd->forwardmove ); aRight = abs( ucmd->rightmove ); + if( aForward == 0 && aRight == 0 ) + stopped = qtrue; + else if( aForward <= 64 && aRight <= 64 ) + walking = qtrue; + + if( aRight > 0 ) + strafing = qtrue; + + if( ucmd->upmove > 0 ) + jumping = qtrue; + else if( ucmd->upmove < 0 ) + crouched = qtrue; + client = ent->client; client->time100 += msec; client->time1000 += msec; @@ -530,13 +546,13 @@ void ClientTimerActions( gentity_t *ent, int msec ) client->time100 -= 100; //if not trying to run then not trying to sprint - if( aForward <= 64 ) + if( walking || stopped ) client->ps.stats[ STAT_STATE ] &= ~SS_SPEEDBOOST; if( BG_InventoryContainsUpgrade( UP_JETPACK, client->ps.stats ) && BG_UpgradeIsActive( UP_JETPACK, client->ps.stats ) ) client->ps.stats[ STAT_STATE ] &= ~SS_SPEEDBOOST; - if( ( client->ps.stats[ STAT_STATE ] & SS_SPEEDBOOST ) && ucmd->upmove >= 0 ) + if( ( client->ps.stats[ STAT_STATE ] & SS_SPEEDBOOST ) && !crouched ) { //subtract stamina if( BG_InventoryContainsUpgrade( UP_LIGHTARMOUR, client->ps.stats ) ) @@ -548,7 +564,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) client->ps.stats[ STAT_STAMINA ] = -MAX_STAMINA; } - if( ( aForward <= 64 && aForward > 5 ) || ( aRight <= 64 && aRight > 5 ) ) + if( walking || crouched ) { //restore stamina client->ps.stats[ STAT_STAMINA ] += STAMINA_WALK_RESTORE; @@ -556,7 +572,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) if( client->ps.stats[ STAT_STAMINA ] > MAX_STAMINA ) client->ps.stats[ STAT_STAMINA ] = MAX_STAMINA; } - else if( aForward <= 5 && aRight <= 5 ) + else if( stopped ) { //restore stamina faster client->ps.stats[ STAT_STAMINA ] += STAMINA_STOP_RESTORE; @@ -626,7 +642,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) client->ps.stats[ STAT_STATE ] |= SS_CHARGING; //if the charger has stopped moving take a chunk of charge away - if( VectorLength( client->ps.velocity ) < 64.0f || aRight ) + if( VectorLength( client->ps.velocity ) < 64.0f || strafing ) client->ps.stats[ STAT_MISC ] = client->ps.stats[ STAT_MISC ] / 2; //can't charge backwards @@ -1503,11 +1519,11 @@ void ClientThink_real( gentity_t *ent ) pm.cmd = *ucmd; if( pm.ps->pm_type == PM_DEAD ) - pm.tracemask = MASK_PLAYERSOLID; // & ~CONTENTS_BODY; + pm.tracemask = MASK_DEADSOLID; if( pm.ps->stats[ STAT_STATE ] & SS_INFESTING || pm.ps->stats[ STAT_STATE ] & SS_HOVELING ) - pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY; + pm.tracemask = MASK_DEADSOLID; else pm.tracemask = MASK_PLAYERSOLID; diff --git a/src/game/g_physics.c b/src/game/g_physics.c index 58c64878..a053cc81 100644 --- a/src/game/g_physics.c +++ b/src/game/g_physics.c @@ -111,7 +111,7 @@ void G_Physics( gentity_t *ent, int msec ) if( ent->clipmask ) mask = ent->clipmask; else - mask = MASK_PLAYERSOLID & ~CONTENTS_BODY;//MASK_SOLID; + mask = MASK_DEADSOLID; if( ent->s.pos.trType == TR_STATIONARY ) { diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index f3a17f1e..0af801a0 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -4689,10 +4689,11 @@ UI_BuildFindPlayerList */ static void UI_BuildFindPlayerList(qboolean force) { static int numFound, numTimeOuts; - int i, j, resend; + int i, j, k, resend; serverStatusInfo_t info; char name[MAX_NAME_LENGTH+2]; char infoString[MAX_STRING_CHARS]; + qboolean duplicate; if (!force) { if (!uiInfo.nextFindPlayerRefresh || uiInfo.nextFindPlayerRefresh > uiInfo.uiDC.realTime) { @@ -4742,8 +4743,18 @@ static void UI_BuildFindPlayerList(qboolean force) { // clean string first Q_strncpyz(name, info.lines[j][3], sizeof(name)); Q_CleanStr(name); + + duplicate = qfalse; + for( k = 0; k < uiInfo.numFoundPlayerServers - 1; k++ ) + { + if( Q_strncmp( uiInfo.foundPlayerServerAddresses[ k ], + uiInfo.pendingServerStatus.server[ i ].adrstr, + MAX_ADDRESSLENGTH ) == 0 ) + duplicate = qtrue; + } + // if the player name is a substring - if (stristr(name, uiInfo.findPlayerName)) { + if( stristr( name, uiInfo.findPlayerName ) && !duplicate ) { // add to found server list if we have space (always leave space for a line with the number found) if (uiInfo.numFoundPlayerServers < MAX_FOUNDPLAYER_SERVERS-1) { // @@ -4763,7 +4774,7 @@ static void UI_BuildFindPlayerList(qboolean force) { } Com_sprintf(uiInfo.foundPlayerServerNames[uiInfo.numFoundPlayerServers-1], sizeof(uiInfo.foundPlayerServerNames[uiInfo.numFoundPlayerServers-1]), - "searching %d/%d...", uiInfo.pendingServerStatus.num, numFound); + "searching %d/%d...", numFound, uiInfo.pendingServerStatus.num ); // retrieved the server status so reuse this spot uiInfo.pendingServerStatus.server[i].valid = qfalse; } @@ -4789,7 +4800,7 @@ static void UI_BuildFindPlayerList(qboolean force) { uiInfo.pendingServerStatus.num++; Com_sprintf(uiInfo.foundPlayerServerNames[uiInfo.numFoundPlayerServers-1], sizeof(uiInfo.foundPlayerServerNames[uiInfo.numFoundPlayerServers-1]), - "searching %d/%d...", uiInfo.pendingServerStatus.num, numFound); + "searching %d/%d...", numFound, uiInfo.pendingServerStatus.num ); } } } |